< prev index next >

src/cpu/sparc/vm/jvmciCodeInstaller_sparc.cpp

Print this page




  73     NativeMovConstReg* move = nativeMovConstReg_at(pc);
  74     void* reference = record_metadata_reference(_instructions, pc, constant, CHECK);
  75     move->set_data((intptr_t)reference);
  76     TRACE_jvmci_3("relocating (metaspace constant) at " PTR_FORMAT "/" PTR_FORMAT, p2i(pc), p2i(reference));
  77   }
  78 }
  79 
  80 void CodeInstaller::pd_patch_DataSectionReference(int pc_offset, int data_offset, TRAPS) {
  81   address pc = _instructions->start() + pc_offset;
  82   NativeInstruction* inst = nativeInstruction_at(pc);
  83   NativeInstruction* inst1 = nativeInstruction_at(pc + 4);
  84   if(inst->is_sethi() && inst1->is_nop()) {
  85       address const_start = _constants->start();
  86       address dest = _constants->start() + data_offset;
  87       if(_constants_size > 0) {
  88         _instructions->relocate(pc + NativeMovConstReg::sethi_offset, internal_word_Relocation::spec((address) dest));
  89         _instructions->relocate(pc + NativeMovConstReg::add_offset, internal_word_Relocation::spec((address) dest));
  90       }
  91       TRACE_jvmci_3("relocating at " PTR_FORMAT " (+%d) with destination at %d", p2i(pc), pc_offset, data_offset);
  92   }else {
  93     int const_size = align_size_up(_constants->end()-_constants->start(), CodeEntryAlignment);
  94     NativeMovRegMem* load = nativeMovRegMem_at(pc);
  95     // This offset must match with SPARCLoadConstantTableBaseOp.emitCode
  96     load->set_offset(- (const_size - data_offset + Assembler::min_simm13()));
  97     TRACE_jvmci_3("relocating ld at " PTR_FORMAT " (+%d) with destination at %d", p2i(pc), pc_offset, data_offset);
  98   }
  99 }
 100 
 101 void CodeInstaller::pd_relocate_ForeignCall(NativeInstruction* inst, jlong foreign_call_destination, TRAPS) {
 102   address pc = (address) inst;
 103   if (inst->is_call()) {
 104     NativeCall* call = nativeCall_at(pc);
 105     call->set_destination((address) foreign_call_destination);
 106     _instructions->relocate(call->instruction_address(), runtime_call_Relocation::spec());
 107   } else if (inst->is_sethi()) {
 108     NativeJump* jump = nativeJump_at(pc);
 109     jump->set_jump_destination((address) foreign_call_destination);
 110     _instructions->relocate(jump->instruction_address(), runtime_call_Relocation::spec());
 111   } else {
 112     JVMCI_ERROR("unknown call or jump instruction at " PTR_FORMAT, p2i(pc));
 113   }




  73     NativeMovConstReg* move = nativeMovConstReg_at(pc);
  74     void* reference = record_metadata_reference(_instructions, pc, constant, CHECK);
  75     move->set_data((intptr_t)reference);
  76     TRACE_jvmci_3("relocating (metaspace constant) at " PTR_FORMAT "/" PTR_FORMAT, p2i(pc), p2i(reference));
  77   }
  78 }
  79 
  80 void CodeInstaller::pd_patch_DataSectionReference(int pc_offset, int data_offset, TRAPS) {
  81   address pc = _instructions->start() + pc_offset;
  82   NativeInstruction* inst = nativeInstruction_at(pc);
  83   NativeInstruction* inst1 = nativeInstruction_at(pc + 4);
  84   if(inst->is_sethi() && inst1->is_nop()) {
  85       address const_start = _constants->start();
  86       address dest = _constants->start() + data_offset;
  87       if(_constants_size > 0) {
  88         _instructions->relocate(pc + NativeMovConstReg::sethi_offset, internal_word_Relocation::spec((address) dest));
  89         _instructions->relocate(pc + NativeMovConstReg::add_offset, internal_word_Relocation::spec((address) dest));
  90       }
  91       TRACE_jvmci_3("relocating at " PTR_FORMAT " (+%d) with destination at %d", p2i(pc), pc_offset, data_offset);
  92   }else {
  93     int const_size = align_up(_constants->end()-_constants->start(), CodeEntryAlignment);
  94     NativeMovRegMem* load = nativeMovRegMem_at(pc);
  95     // This offset must match with SPARCLoadConstantTableBaseOp.emitCode
  96     load->set_offset(- (const_size - data_offset + Assembler::min_simm13()));
  97     TRACE_jvmci_3("relocating ld at " PTR_FORMAT " (+%d) with destination at %d", p2i(pc), pc_offset, data_offset);
  98   }
  99 }
 100 
 101 void CodeInstaller::pd_relocate_ForeignCall(NativeInstruction* inst, jlong foreign_call_destination, TRAPS) {
 102   address pc = (address) inst;
 103   if (inst->is_call()) {
 104     NativeCall* call = nativeCall_at(pc);
 105     call->set_destination((address) foreign_call_destination);
 106     _instructions->relocate(call->instruction_address(), runtime_call_Relocation::spec());
 107   } else if (inst->is_sethi()) {
 108     NativeJump* jump = nativeJump_at(pc);
 109     jump->set_jump_destination((address) foreign_call_destination);
 110     _instructions->relocate(jump->instruction_address(), runtime_call_Relocation::spec());
 111   } else {
 112     JVMCI_ERROR("unknown call or jump instruction at " PTR_FORMAT, p2i(pc));
 113   }


< prev index next >