Skip to content

Commit

Permalink
Do not rematerialize register for class pointer or method pointer
Browse files Browse the repository at this point in the history
Do not rematerialize register for class pointer or method pointer if
it's AOT compilation because it doesn't have node info in register
rematerialization to create relocation record for the class pointer
or the method pointer.

Signed-off-by: Annabelle Huo <Annabelle.Huo@ibm.com>
  • Loading branch information
a7ehuo committed Nov 24, 2021
1 parent 41669e7 commit c6a8248
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion compiler/x/codegen/OMRTreeEvaluator.cpp
Expand Up @@ -392,7 +392,12 @@ TR::Register *OMR::X86::TreeEvaluator::loadConstant(TR::Node * node, intptr_t va

TR::Instruction *instr = TR::TreeEvaluator::insertLoadConstant(node, targetRegister, value, type, cg);

if (cg->enableRematerialisation())
// Do not rematerialize register for class pointer or method pointer if
// it's AOT compilation because it doesn't have node info in register
// rematerialization to create relocation record for the class pointer
// or the method pointer.
if (cg->enableRematerialisation() &&
!(cg->comp()->compileRelocatableCode() && node && node->getOpCodeValue() == TR::aconst && (node->isClassPointerConstant() || node->isMethodPointerConstant())))
{
if (node && node->getOpCode().hasSymbolReference() && node->getSymbol() && node->getSymbol()->isClassObject())
(TR::Compiler->om.generateCompressedObjectHeaders() || cg->comp()->target().is32Bit()) ? type = TR_RematerializableInt : type = TR_RematerializableLong;
Expand Down

0 comments on commit c6a8248

Please sign in to comment.