Skip to content

Commit

Permalink
Require address load instruction for statics in JITServer
Browse files Browse the repository at this point in the history
In some cases, e.g. method enter/exit hooks,
JITServer takes the static hook address directly from the client,
but the address load might be encoded using offset relative
to server's RIP, which results in an invalid address.
This commit ensures that static address loads for out-of-process
compilations always get loaded in a register first, preventing
relative access.

Signed-off-by: Dmitry Ten <Dmitry.Ten@ibm.com>
  • Loading branch information
dmitry-ten committed Nov 10, 2020
1 parent f8c4f85 commit f580a3e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions compiler/x/amd64/codegen/OMRMemoryReference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@ bool OMR::X86::AMD64::MemoryReference::needsAddressLoadInstruction(intptr_t next
return true; // If a class gets replaced, it may no longer fit in an immediate
else if (IS_32BIT_SIGNED(displacement))
return false;
else if (cg->comp()->isOutOfProcessCompilation() && sr.getSymbol() && sr.getSymbol()->isStatic() && !sr.getSymbol()->isNotDataAddress())
return true;
else if (IS_32BIT_RIP(displacement, nextInstructionAddress))
return false;
else
Expand Down

0 comments on commit f580a3e

Please sign in to comment.