comparison src/cpu/x86/vm/graalCodeInstaller_x86.hpp @ 11827:ff1d8605f354

graal code installer: minor style cleanup
author Bernhard Urban <bernhard.urban@jku.at>
date Mon, 30 Sep 2013 11:36:52 +0200
parents 2d3d3d36ab3c
children 04a87dc2cfca
comparison
equal deleted inserted replaced
11826:2d3d3d36ab3c 11827:ff1d8605f354
146 } 146 }
147 _instructions->relocate((address)inst, runtime_call_Relocation::spec(), Assembler::call32_operand); 147 _instructions->relocate((address)inst, runtime_call_Relocation::spec(), Assembler::call32_operand);
148 } 148 }
149 149
150 inline void CodeInstaller::pd_relocate_ForeignCall(NativeInstruction* inst, jlong foreign_call_destination) { 150 inline void CodeInstaller::pd_relocate_ForeignCall(NativeInstruction* inst, jlong foreign_call_destination) {
151 address pc = (address) inst;
151 if (inst->is_call()) { 152 if (inst->is_call()) {
152 // NOTE: for call without a mov, the offset must fit a 32-bit immediate 153 // NOTE: for call without a mov, the offset must fit a 32-bit immediate
153 // see also CompilerToVM.getMaxCallTargetOffset() 154 // see also CompilerToVM.getMaxCallTargetOffset()
154 NativeCall* call = nativeCall_at((address) (inst)); 155 NativeCall* call = nativeCall_at(pc);
155 call->set_destination((address) foreign_call_destination); 156 call->set_destination((address) foreign_call_destination);
156 _instructions->relocate(call->instruction_address(), runtime_call_Relocation::spec(), Assembler::call32_operand); 157 _instructions->relocate(call->instruction_address(), runtime_call_Relocation::spec(), Assembler::call32_operand);
157 } else if (inst->is_mov_literal64()) { 158 } else if (inst->is_mov_literal64()) {
158 NativeMovConstReg* mov = nativeMovConstReg_at((address) (inst)); 159 NativeMovConstReg* mov = nativeMovConstReg_at(pc);
159 mov->set_data((intptr_t) foreign_call_destination); 160 mov->set_data((intptr_t) foreign_call_destination);
160 _instructions->relocate(mov->instruction_address(), runtime_call_Relocation::spec(), Assembler::imm_operand); 161 _instructions->relocate(mov->instruction_address(), runtime_call_Relocation::spec(), Assembler::imm_operand);
161 } else if (inst->is_jump()) { 162 } else if (inst->is_jump()) {
162 NativeJump* jump = nativeJump_at((address) (inst)); 163 NativeJump* jump = nativeJump_at(pc);
163 jump->set_jump_destination((address) foreign_call_destination); 164 jump->set_jump_destination((address) foreign_call_destination);
164 _instructions->relocate(jump->instruction_address(), runtime_call_Relocation::spec(), Assembler::call32_operand); 165 _instructions->relocate(jump->instruction_address(), runtime_call_Relocation::spec(), Assembler::call32_operand);
165 } else if (inst->is_cond_jump()) { 166 } else if (inst->is_cond_jump()) {
166 address old_dest = nativeGeneralJump_at((address) (inst))->jump_destination(); 167 address old_dest = nativeGeneralJump_at(pc)->jump_destination();
167 address disp = Assembler::locate_operand((address) (inst), Assembler::call32_operand); 168 address disp = Assembler::locate_operand(pc, Assembler::call32_operand);
168 *(jint*) disp += ((address) foreign_call_destination) - old_dest; 169 *(jint*) disp += ((address) foreign_call_destination) - old_dest;
169 _instructions->relocate((address) (inst), runtime_call_Relocation::spec(), Assembler::call32_operand); 170 _instructions->relocate(pc, runtime_call_Relocation::spec(), Assembler::call32_operand);
170 } else { 171 } else {
171 fatal("unsupported relocation for foreign call"); 172 fatal("unsupported relocation for foreign call");
172 } 173 }
173 174
174 TRACE_graal_3("relocating (foreign call) at %p", inst); 175 TRACE_graal_3("relocating (foreign call) at %p", inst);