54 #else 55 JVMCI_ERROR("compressed oop on 32bit"); 56 #endif 57 } else { 58 NativeMovConstReg* move = nativeMovConstReg_at(pc); 59 move->set_data((intptr_t) value); 60 61 // We need two relocations: one on the sethi and one on the add. 62 int oop_index = _oop_recorder->find_index(value); 63 RelocationHolder rspec = oop_Relocation::spec(oop_index); 64 _instructions->relocate(pc + NativeMovConstReg::sethi_offset, rspec); 65 _instructions->relocate(pc + NativeMovConstReg::add_offset, rspec); 66 } 67 } 68 69 void CodeInstaller::pd_patch_MetaspaceConstant(int pc_offset, Handle constant, TRAPS) { 70 address pc = _instructions->start() + pc_offset; 71 if (HotSpotMetaspaceConstantImpl::compressed(constant)) { 72 #ifdef _LP64 73 NativeMovConstReg32* move = nativeMovConstReg32_at(pc); 74 narrowKlass narrowOop = record_narrow_metadata_reference(constant, CHECK); 75 move->set_data((intptr_t)narrowOop); 76 TRACE_jvmci_3("relocating (narrow metaspace constant) at " PTR_FORMAT "/0x%x", p2i(pc), narrowOop); 77 #else 78 JVMCI_ERROR("compressed Klass* on 32bit"); 79 #endif 80 } else { 81 NativeMovConstReg* move = nativeMovConstReg_at(pc); 82 void* reference = record_metadata_reference(constant, CHECK); 83 move->set_data((intptr_t)reference); 84 TRACE_jvmci_3("relocating (metaspace constant) at " PTR_FORMAT "/" PTR_FORMAT, p2i(pc), p2i(reference)); 85 } 86 } 87 88 void CodeInstaller::pd_patch_DataSectionReference(int pc_offset, int data_offset, TRAPS) { 89 address pc = _instructions->start() + pc_offset; 90 NativeInstruction* inst = nativeInstruction_at(pc); 91 NativeInstruction* inst1 = nativeInstruction_at(pc + 4); 92 if(inst->is_sethi() && inst1->is_nop()) { 93 address const_start = _constants->start(); 94 address dest = _constants->start() + data_offset; 95 if(_constants_size > 0) { 96 _instructions->relocate(pc + NativeMovConstReg::sethi_offset, internal_word_Relocation::spec((address) dest)); 97 _instructions->relocate(pc + NativeMovConstReg::add_offset, internal_word_Relocation::spec((address) dest)); 98 } 99 TRACE_jvmci_3("relocating at " PTR_FORMAT " (+%d) with destination at %d", p2i(pc), pc_offset, data_offset); 100 }else { 101 int const_size = align_size_up(_constants->end()-_constants->start(), CodeEntryAlignment); 102 NativeMovRegMem* load = nativeMovRegMem_at(pc); | 54 #else 55 JVMCI_ERROR("compressed oop on 32bit"); 56 #endif 57 } else { 58 NativeMovConstReg* move = nativeMovConstReg_at(pc); 59 move->set_data((intptr_t) value); 60 61 // We need two relocations: one on the sethi and one on the add. 62 int oop_index = _oop_recorder->find_index(value); 63 RelocationHolder rspec = oop_Relocation::spec(oop_index); 64 _instructions->relocate(pc + NativeMovConstReg::sethi_offset, rspec); 65 _instructions->relocate(pc + NativeMovConstReg::add_offset, rspec); 66 } 67 } 68 69 void CodeInstaller::pd_patch_MetaspaceConstant(int pc_offset, Handle constant, TRAPS) { 70 address pc = _instructions->start() + pc_offset; 71 if (HotSpotMetaspaceConstantImpl::compressed(constant)) { 72 #ifdef _LP64 73 NativeMovConstReg32* move = nativeMovConstReg32_at(pc); 74 narrowKlass narrowOop = record_narrow_metadata_reference(_instructions, pc, constant, CHECK); 75 move->set_data((intptr_t)narrowOop); 76 TRACE_jvmci_3("relocating (narrow metaspace constant) at " PTR_FORMAT "/0x%x", p2i(pc), narrowOop); 77 #else 78 JVMCI_ERROR("compressed Klass* on 32bit"); 79 #endif 80 } else { 81 NativeMovConstReg* move = nativeMovConstReg_at(pc); 82 void* reference = record_metadata_reference(_instructions, pc, constant, CHECK); 83 move->set_data((intptr_t)reference); 84 TRACE_jvmci_3("relocating (metaspace constant) at " PTR_FORMAT "/" PTR_FORMAT, p2i(pc), p2i(reference)); 85 } 86 } 87 88 void CodeInstaller::pd_patch_DataSectionReference(int pc_offset, int data_offset, TRAPS) { 89 address pc = _instructions->start() + pc_offset; 90 NativeInstruction* inst = nativeInstruction_at(pc); 91 NativeInstruction* inst1 = nativeInstruction_at(pc + 4); 92 if(inst->is_sethi() && inst1->is_nop()) { 93 address const_start = _constants->start(); 94 address dest = _constants->start() + data_offset; 95 if(_constants_size > 0) { 96 _instructions->relocate(pc + NativeMovConstReg::sethi_offset, internal_word_Relocation::spec((address) dest)); 97 _instructions->relocate(pc + NativeMovConstReg::add_offset, internal_word_Relocation::spec((address) dest)); 98 } 99 TRACE_jvmci_3("relocating at " PTR_FORMAT " (+%d) with destination at %d", p2i(pc), pc_offset, data_offset); 100 }else { 101 int const_size = align_size_up(_constants->end()-_constants->start(), CodeEntryAlignment); 102 NativeMovRegMem* load = nativeMovRegMem_at(pc); |