Skip to content

Commit

Permalink
Do not create class unload PIC site assumption if not required
Browse files Browse the repository at this point in the history
The issue is `TR_RelocationRecordSymbolFromManager::activatePointer`
creates `TR_UnloadedClassPicSite` for a J9Method in the pre-prologue
of the current method body. The class of the J9Method is the same as
the class of the current method body. In this case, the class unload
assumption is not needed because once the class is unloaded, no code
will ever reach the J9Method in the pre-prologue.

Fixes: #17734

Signed-off-by: Annabelle Huo <[email protected]>
  • Loading branch information
a7ehuo committed Sep 1, 2023
1 parent 022a2a4 commit e16b1ff
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions runtime/compiler/runtime/RelocationRecord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5462,16 +5462,18 @@ TR_RelocationRecordSymbolFromManager::activatePointer(TR_RelocationRuntime *relo
clazz = (TR_OpaqueClassBlock *)J9_CLASS_FROM_METHOD((J9Method *)(reloPrivateData->_symbol));
}

if (needsUnloadAssumptions(symbolType))
TR::Compilation *comp = reloRuntime->comp();
if (needsUnloadAssumptions(symbolType) &&
comp->fej9()->isUnloadAssumptionRequired(clazz, comp->getCurrentMethod()))
{
SVM_ASSERT(clazz != NULL, "clazz must exist to add Unload Assumptions!");
reloTarget->addPICtoPatchPtrOnClassUnload(clazz, reloLocation);
}
if (needsRedefinitionAssumption(reloRuntime, reloLocation, clazz, symbolType))
{
SVM_ASSERT(clazz != NULL, "clazz must exist to add Redefinition Assumptions!");
createClassRedefinitionPicSite((void *)reloPrivateData->_symbol, (void *) reloLocation, sizeof(uintptr_t), false, reloRuntime->comp()->getMetadataAssumptionList());
reloRuntime->comp()->setHasClassRedefinitionAssumptions();
createClassRedefinitionPicSite((void *)reloPrivateData->_symbol, (void *) reloLocation, sizeof(uintptr_t), false, comp->getMetadataAssumptionList());
comp->setHasClassRedefinitionAssumptions();
}
}

Expand Down

0 comments on commit e16b1ff

Please sign in to comment.