Skip to content

Commit

Permalink
Merge pull request #7386 from dchopra001/interfaceCalls
Browse files Browse the repository at this point in the history
Use JITServer check to create a relocation record for interface calls on Power
  • Loading branch information
ymanton authored Oct 23, 2019
2 parents 4f85c02 + dbd29ed commit de14912
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion runtime/compiler/p/codegen/CallSnippet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ uint8_t *TR::PPCInterfaceCallSnippet::emitSnippetBody()
{
int32_t *patchAddr = (int32_t *)getLowerInstruction()->getBinaryEncoding();
intptrj_t addrValue = (intptrj_t)cursor;
if (!comp->compileRelocatableCode())
if (!comp->compileRelocatableCode() && !comp->isOutOfProcessCompilation())
{
// If the high nibble is 0 and the next nibble's high bit is clear, change the first instruction to a nop and the third to a li
// Next nibble's high bit needs to be clear in order to use li (because li will sign extend the immediate)
Expand All @@ -744,6 +744,10 @@ uint8_t *TR::PPCInterfaceCallSnippet::emitSnippetBody()
}
else
{
// We must take this path for all compiles that need to generate relocatable code (ex. AOT, outOfProcess).
// The immediate fields of relocatable instructions must be clear. This is because when performing the relocation,
// we OR the new address into the fields. So if the fields are not already clear, then OR'ing the new address can
// result in garbage data.
cg()->addExternalRelocation(new (cg()->trHeapMemory()) TR::BeforeBinaryEncodingExternalRelocation(getUpperInstruction(),
(uint8_t *)(addrValue),
(uint8_t *)fixedSequence4,
Expand Down

0 comments on commit de14912

Please sign in to comment.