Skip to content

Commit

Permalink
Merge pull request #17182 from a7ehuo/add-option-disableRecognizeCurr…
Browse files Browse the repository at this point in the history
…entThread

Check options on whether or not to inline Thread.currentThread
  • Loading branch information
hzongaro authored Apr 18, 2023
2 parents 7bff45e + c4b6841 commit b39a9d2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion runtime/compiler/env/VMJ9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7660,18 +7660,25 @@ TR_J9VM::inlineNativeCall(TR::Compilation * comp, TR::TreeTop * callNodeTreeTop,
return callNode;

case TR::java_lang_Thread_currentThread:
{
static const char * notInlineCurrentThread = feGetEnv("TR_DisableRecognizeCurrentThread");
if (comp->cg()->getGRACompleted())
{
return 0;
}
else
else if (!comp->getOption(TR_DisableRecognizeCurrentThread) && !notInlineCurrentThread)
{
if (comp->getOption(TR_TraceOptDetails) || comp->getOption(TR_TraceILGen))
traceMsg(comp, "Inline Thread.currentThread() callNode n%dn 0x%p\n", callNode->getGlobalIndex(), callNode);

comp->cg()->setInlinedGetCurrentThreadMethod();
TR::Node::recreate(callNode, TR::aload);
callNode->setSymbolReference(comp->getSymRefTab()->findOrCreateCurrentThreadSymbolRef());

return callNode;
}
return 0;
}
case TR::java_lang_Float_intBitsToFloat:
if (comp->cg()->getSupportsInliningOfTypeCoersionMethods())
TR::Node::recreate(callNode, TR::ibits2f);
Expand Down

0 comments on commit b39a9d2

Please sign in to comment.