diff --git a/runtime/compiler/compile/J9Compilation.cpp b/runtime/compiler/compile/J9Compilation.cpp index ac8f5a1ebdd..29d3967d551 100644 --- a/runtime/compiler/compile/J9Compilation.cpp +++ b/runtime/compiler/compile/J9Compilation.cpp @@ -734,8 +734,8 @@ J9::Compilation::canAllocateInline(TR::Node* node, TR_OpaqueClassBlock* &classIn if (clazz == NULL) return -1; - // Arrays of primitive value type classes must have all their elements initialized with the - // default value of the component type. For now, prevent inline allocation of them. + // Arrays of null-restricted (a.k.a, primitive value type) classes must have all their elements initialized + // with the default value of the component type. For now, prevent inline allocation of them. // if (areValueTypesEnabled && TR::Compiler->cls.isPrimitiveValueTypeClass(reinterpret_cast(clazz))) { diff --git a/runtime/compiler/env/J9ObjectModel.hpp b/runtime/compiler/env/J9ObjectModel.hpp index 150535694c7..496dcc3766f 100644 --- a/runtime/compiler/env/J9ObjectModel.hpp +++ b/runtime/compiler/env/J9ObjectModel.hpp @@ -63,20 +63,23 @@ class ObjectModel : public OMR::ObjectModelConnector bool mayRequireSpineChecks(); /** - * @brief Whether or not value object is enabled - */ + * @brief Whether or not value object is enabled + */ bool areValueTypesEnabled(); + /** - * @brief Whether or not flattenable value object (aka null restricted) type is enabled - */ + * @brief Whether or not flattenable value object (aka null restricted) type is enabled + */ bool areFlattenableValueTypesEnabled(); + /** * @brief Whether the check is enabled on monitor object being value based class type */ bool areValueBasedMonitorChecksEnabled(); + /** - * @brief Whether the array flattening is enabled for value types - */ + * @brief Whether the array flattening is enabled for value types + */ bool isValueTypeArrayFlatteningEnabled(); int32_t sizeofReferenceField(); diff --git a/runtime/compiler/ilgen/Walker.cpp b/runtime/compiler/ilgen/Walker.cpp index 7fa5900195e..ecfb12b72f8 100644 --- a/runtime/compiler/ilgen/Walker.cpp +++ b/runtime/compiler/ilgen/Walker.cpp @@ -6272,6 +6272,12 @@ TR_J9ByteCodeIlGenerator::genNew(TR::ILOpCodes opCode) if (!node->getFirstChild()->getSymbolReference()->isUnresolved() && node->getFirstChild()->getSymbol()->isStatic()) { TR_OpaqueClassBlock *clazz = (TR_OpaqueClassBlock*)node->getFirstChild()->getSymbol()->castToStaticSymbol()->getStaticAddress(); + + if (TR::Compiler->cls.isValueTypeClass(clazz)) + { + node->setIdentityless(true); + } + int32_t len; char *sig; sig = TR::Compiler->cls.classSignature_DEPRECATED(comp(), clazz, len, comp()->trMemory()); diff --git a/runtime/compiler/optimizer/EscapeAnalysis.cpp b/runtime/compiler/optimizer/EscapeAnalysis.cpp index 335fdfdd355..5743049b49a 100644 --- a/runtime/compiler/optimizer/EscapeAnalysis.cpp +++ b/runtime/compiler/optimizer/EscapeAnalysis.cpp @@ -191,7 +191,15 @@ bool TR_EscapeAnalysis::isImmutableObject(TR::Node *node) return false; } - char *className = getClassName(node->getFirstChild()); + TR::Node *classNode = node->getFirstChild(); + + TR_OpaqueClassBlock *clazz = (TR_OpaqueClassBlock *)classNode->getSymbol()->getStaticSymbol()->getStaticAddress(); + if (TR::Compiler->cls.isValueTypeClass(clazz)) + { + return true; + } + + char *className = getClassName(classNode); if (NULL != className && !strncmp("java/lang/", className, 10) &&