Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions runtime/compiler/optimizer/UnsafeFastPath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,7 @@ int32_t TR_UnsafeFastPath::perform()
TR::Symbol::MemoryOrdering ordering = TR::Symbol::MemoryOrdering::Transparent;
bool isArrayOperation = false;
bool isByIndex = false;
bool isObjectPresumedNonNull = false; // Object argument of JITHelpers_get/put methods must be non-null
int32_t objectChild = 1;
int32_t offsetChild = 2;

Expand All @@ -577,7 +578,7 @@ int32_t TR_UnsafeFastPath::perform()
break;
}

// Check for array operation
// Check for array operation and for non-null Object argument
switch (symbol->getRecognizedMethod())
{
case TR::sun_misc_Unsafe_putObjectVolatile_jlObjectJjlObject_V:
Expand All @@ -594,6 +595,20 @@ int32_t TR_UnsafeFastPath::perform()
break;
}
break;
case TR::com_ibm_jit_JITHelpers_getIntFromObject:
case TR::com_ibm_jit_JITHelpers_getIntFromObjectVolatile:
case TR::com_ibm_jit_JITHelpers_getLongFromObject:
case TR::com_ibm_jit_JITHelpers_getLongFromObjectVolatile:
case TR::com_ibm_jit_JITHelpers_getObjectFromObject:
case TR::com_ibm_jit_JITHelpers_getObjectFromObjectVolatile:
case TR::com_ibm_jit_JITHelpers_putIntInObject:
case TR::com_ibm_jit_JITHelpers_putIntInObjectVolatile:
case TR::com_ibm_jit_JITHelpers_putLongInObject:
case TR::com_ibm_jit_JITHelpers_putLongInObjectVolatile:
case TR::com_ibm_jit_JITHelpers_putObjectInObject:
case TR::com_ibm_jit_JITHelpers_putObjectInObjectVolatile:
isObjectPresumedNonNull = true;
break;
case TR::com_ibm_jit_JITHelpers_getByteFromArrayVolatile:
case TR::com_ibm_jit_JITHelpers_getByteFromArrayByIndex:
case TR::com_ibm_jit_JITHelpers_getByteFromArray:
Expand All @@ -618,6 +633,9 @@ int32_t TR_UnsafeFastPath::perform()
case TR::com_ibm_jit_JITHelpers_putLongInArray:
case TR::com_ibm_jit_JITHelpers_putObjectInArrayVolatile:
case TR::com_ibm_jit_JITHelpers_putObjectInArray:
isArrayOperation = true;
isObjectPresumedNonNull = true;
break;
case TR::java_lang_StringUTF16_getChar:
case TR::java_lang_StringUTF16_putChar:
isArrayOperation = true;
Expand Down Expand Up @@ -841,7 +859,11 @@ int32_t TR_UnsafeFastPath::perform()
}

object = node->getChild(objectChild);
object->setIsNonNull(true);
if (isObjectPresumedNonNull)
{
object->setIsNonNull(true);
}

if (isStatic)
{
TR::Node *jlClass = object;
Expand Down