Exemplo n.º 1
0
uint8_t TR::ExternalOrderedPair32BitRelocation::collectModifier()
   {
   TR::Compilation *comp = TR::comp();
   uint8_t * relocatableMethodCodeStart = (uint8_t *)comp->getRelocatableMethodCodeStart();
   uint8_t * updateLocation;
   uint8_t * updateLocation2;
   TR_ExternalRelocationTargetKind kind = getTargetKind();

   if (TR::Compiler->target.cpu.isPower() &&
          (kind == TR_ArrayCopyHelper || kind == TR_ArrayCopyToc || kind == TR_RamMethod || kind == TR_GlobalValue || kind == TR_BodyInfoAddressLoad || kind == TR_DataAddress || kind == TR_DebugCounter))
      {
      TR::Instruction *instr = (TR::Instruction *)getUpdateLocation();
      TR::Instruction *instr2 = (TR::Instruction *)getLocation2();
      updateLocation = instr->getBinaryEncoding();
      updateLocation2 = instr2->getBinaryEncoding();
      }
   else
      {
      updateLocation = getUpdateLocation();
      updateLocation2 = getLocation2();
      }

   int32_t iLoc = updateLocation - relocatableMethodCodeStart;
   int32_t iLoc2 = updateLocation2 - relocatableMethodCodeStart;
   AOTcgDiag0(comp, "TR::ExternalOrderedPair32BitRelocation::collectModifier\n");
   if ( (iLoc < MIN_SHORT_OFFSET  || iLoc > MAX_SHORT_OFFSET ) || (iLoc2 < MIN_SHORT_OFFSET || iLoc2 > MAX_SHORT_OFFSET ) )
      return RELOCATION_TYPE_WIDE_OFFSET | RELOCATION_TYPE_ORDERED_PAIR;

   return RELOCATION_TYPE_ORDERED_PAIR;
   }
Exemplo n.º 2
0
void TR::ExternalOrderedPair32BitRelocation::apply(TR::CodeGenerator *codeGen)
   {
   TR::Compilation *comp = codeGen->comp();
   AOTcgDiag0(comp, "TR::ExternalOrderedPair32BitRelocation::apply\n");

   TR::IteratedExternalRelocation *rec = getRelocationRecord();
   uint8_t *codeStart = (uint8_t *)comp->getRelocatableMethodCodeStart();
   TR_ExternalRelocationTargetKind kind = getRelocationRecord()->getTargetKind();
   if (TR::Compiler->target.cpu.isPower() &&
      (kind == TR_ArrayCopyHelper || kind == TR_ArrayCopyToc || kind == TR_RamMethodSequence || kind == TR_GlobalValue || kind == TR_BodyInfoAddressLoad || kind == TR_DataAddress || kind == TR_DebugCounter))
      {
      TR::Instruction *instr = (TR::Instruction *)getUpdateLocation();
      TR::Instruction *instr2 = (TR::Instruction *)getLocation2();
      rec->addRelocationEntry((uint32_t)(instr->getBinaryEncoding() - codeStart));
      rec->addRelocationEntry((uint32_t)(instr2->getBinaryEncoding() - codeStart));
      }
   else
      {
      rec->addRelocationEntry(getUpdateLocation() - codeStart);
      rec->addRelocationEntry(getLocation2() - codeStart);
      }
   }