72 address operand = Assembler::locate_operand(pc, Assembler::narrow_oop_operand); 73 int oop_index = _oop_recorder->find_index(value); 74 _instructions->relocate(pc, oop_Relocation::spec(oop_index), Assembler::narrow_oop_operand); 75 TRACE_jvmci_3("relocating (narrow oop constant) at " PTR_FORMAT "/" PTR_FORMAT, p2i(pc), p2i(operand)); 76 #else 77 JVMCI_ERROR("compressed oop on 32bit"); 78 #endif 79 } else { 80 address operand = Assembler::locate_operand(pc, Assembler::imm_operand); 81 *((jobject*) operand) = value; 82 _instructions->relocate(pc, oop_Relocation::spec_for_immediate(), Assembler::imm_operand); 83 TRACE_jvmci_3("relocating (oop constant) at " PTR_FORMAT "/" PTR_FORMAT, p2i(pc), p2i(operand)); 84 } 85 } 86 87 void CodeInstaller::pd_patch_MetaspaceConstant(int pc_offset, Handle constant, TRAPS) { 88 address pc = _instructions->start() + pc_offset; 89 if (HotSpotMetaspaceConstantImpl::compressed(constant)) { 90 #ifdef _LP64 91 address operand = Assembler::locate_operand(pc, Assembler::narrow_oop_operand); 92 *((narrowKlass*) operand) = record_narrow_metadata_reference(constant, CHECK); 93 TRACE_jvmci_3("relocating (narrow metaspace constant) at " PTR_FORMAT "/" PTR_FORMAT, p2i(pc), p2i(operand)); 94 #else 95 JVMCI_ERROR("compressed Klass* on 32bit"); 96 #endif 97 } else { 98 address operand = Assembler::locate_operand(pc, Assembler::imm_operand); 99 *((void**) operand) = record_metadata_reference(constant, CHECK); 100 TRACE_jvmci_3("relocating (metaspace constant) at " PTR_FORMAT "/" PTR_FORMAT, p2i(pc), p2i(operand)); 101 } 102 } 103 104 void CodeInstaller::pd_patch_DataSectionReference(int pc_offset, int data_offset, TRAPS) { 105 address pc = _instructions->start() + pc_offset; 106 107 address operand = Assembler::locate_operand(pc, Assembler::disp32_operand); 108 address next_instruction = Assembler::locate_next_instruction(pc); 109 address dest = _constants->start() + data_offset; 110 111 long disp = dest - next_instruction; 112 assert(disp == (jint) disp, "disp doesn't fit in 32 bits"); 113 *((jint*) operand) = (jint) disp; 114 115 _instructions->relocate(pc, section_word_Relocation::spec((address) dest, CodeBuffer::SECT_CONSTS), Assembler::disp32_operand); 116 TRACE_jvmci_3("relocating at " PTR_FORMAT "/" PTR_FORMAT " with destination at " PTR_FORMAT " (%d)", p2i(pc), p2i(operand), p2i(dest), data_offset); 117 } 118 119 void CodeInstaller::pd_relocate_ForeignCall(NativeInstruction* inst, jlong foreign_call_destination, TRAPS) { | 72 address operand = Assembler::locate_operand(pc, Assembler::narrow_oop_operand); 73 int oop_index = _oop_recorder->find_index(value); 74 _instructions->relocate(pc, oop_Relocation::spec(oop_index), Assembler::narrow_oop_operand); 75 TRACE_jvmci_3("relocating (narrow oop constant) at " PTR_FORMAT "/" PTR_FORMAT, p2i(pc), p2i(operand)); 76 #else 77 JVMCI_ERROR("compressed oop on 32bit"); 78 #endif 79 } else { 80 address operand = Assembler::locate_operand(pc, Assembler::imm_operand); 81 *((jobject*) operand) = value; 82 _instructions->relocate(pc, oop_Relocation::spec_for_immediate(), Assembler::imm_operand); 83 TRACE_jvmci_3("relocating (oop constant) at " PTR_FORMAT "/" PTR_FORMAT, p2i(pc), p2i(operand)); 84 } 85 } 86 87 void CodeInstaller::pd_patch_MetaspaceConstant(int pc_offset, Handle constant, TRAPS) { 88 address pc = _instructions->start() + pc_offset; 89 if (HotSpotMetaspaceConstantImpl::compressed(constant)) { 90 #ifdef _LP64 91 address operand = Assembler::locate_operand(pc, Assembler::narrow_oop_operand); 92 *((narrowKlass*) operand) = record_narrow_metadata_reference(_instructions, operand, constant, CHECK); 93 TRACE_jvmci_3("relocating (narrow metaspace constant) at " PTR_FORMAT "/" PTR_FORMAT, p2i(pc), p2i(operand)); 94 #else 95 JVMCI_ERROR("compressed Klass* on 32bit"); 96 #endif 97 } else { 98 address operand = Assembler::locate_operand(pc, Assembler::imm_operand); 99 *((void**) operand) = record_metadata_reference(_instructions, operand, constant, CHECK); 100 TRACE_jvmci_3("relocating (metaspace constant) at " PTR_FORMAT "/" PTR_FORMAT, p2i(pc), p2i(operand)); 101 } 102 } 103 104 void CodeInstaller::pd_patch_DataSectionReference(int pc_offset, int data_offset, TRAPS) { 105 address pc = _instructions->start() + pc_offset; 106 107 address operand = Assembler::locate_operand(pc, Assembler::disp32_operand); 108 address next_instruction = Assembler::locate_next_instruction(pc); 109 address dest = _constants->start() + data_offset; 110 111 long disp = dest - next_instruction; 112 assert(disp == (jint) disp, "disp doesn't fit in 32 bits"); 113 *((jint*) operand) = (jint) disp; 114 115 _instructions->relocate(pc, section_word_Relocation::spec((address) dest, CodeBuffer::SECT_CONSTS), Assembler::disp32_operand); 116 TRACE_jvmci_3("relocating at " PTR_FORMAT "/" PTR_FORMAT " with destination at " PTR_FORMAT " (%d)", p2i(pc), p2i(operand), p2i(dest), data_offset); 117 } 118 119 void CodeInstaller::pd_relocate_ForeignCall(NativeInstruction* inst, jlong foreign_call_destination, TRAPS) { |