Mercurial > hg > truffle
comparison src/share/vm/graal/graalCodeInstaller.cpp @ 9740:c4b1aa93b9af
rename: HotSpotRuntimeCallTarget -> HotSpotForeignCallLinkage
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 16 May 2013 17:23:44 +0200 |
parents | ed6202820ecf |
children | d552919fbb05 |
comparison
equal
deleted
inserted
replaced
9739:4cd4926ec683 | 9740:c4b1aa93b9af |
---|---|
645 void CodeInstaller::site_Call(CodeBuffer& buffer, jint pc_offset, oop site) { | 645 void CodeInstaller::site_Call(CodeBuffer& buffer, jint pc_offset, oop site) { |
646 oop target = CompilationResult_Call::target(site); | 646 oop target = CompilationResult_Call::target(site); |
647 InstanceKlass* target_klass = InstanceKlass::cast(target->klass()); | 647 InstanceKlass* target_klass = InstanceKlass::cast(target->klass()); |
648 | 648 |
649 oop hotspot_method = NULL; // JavaMethod | 649 oop hotspot_method = NULL; // JavaMethod |
650 oop global_stub = NULL; | 650 oop foreign_call = NULL; |
651 | 651 |
652 if (target_klass->is_subclass_of(SystemDictionary::HotSpotRuntimeCallTarget_klass())) { | 652 if (target_klass->is_subclass_of(SystemDictionary::HotSpotForeignCallLinkage_klass())) { |
653 global_stub = target; | 653 foreign_call = target; |
654 } else { | 654 } else { |
655 hotspot_method = target; | 655 hotspot_method = target; |
656 } | 656 } |
657 | 657 |
658 oop debug_info = CompilationResult_Call::debugInfo(site); | 658 oop debug_info = CompilationResult_Call::debugInfo(site); |
659 | 659 |
660 assert((hotspot_method ? 1 : 0) + (global_stub ? 1 : 0) == 1, "Call site needs exactly one type"); | 660 assert((hotspot_method ? 1 : 0) + (foreign_call ? 1 : 0) == 1, "Call site needs exactly one type"); |
661 | 661 |
662 NativeInstruction* inst = nativeInstruction_at(_instructions->start() + pc_offset); | 662 NativeInstruction* inst = nativeInstruction_at(_instructions->start() + pc_offset); |
663 jint next_pc_offset = 0x0; | 663 jint next_pc_offset = 0x0; |
664 if (inst->is_call() || inst->is_jump()) { | 664 if (inst->is_call() || inst->is_jump()) { |
665 assert(NativeCall::instruction_size == (int)NativeJump::instruction_size, "unexpected size"); | 665 assert(NativeCall::instruction_size == (int)NativeJump::instruction_size, "unexpected size"); |
702 } else { | 702 } else { |
703 // Stubs do not record scope info, just oop maps | 703 // Stubs do not record scope info, just oop maps |
704 } | 704 } |
705 } | 705 } |
706 | 706 |
707 if (global_stub != NULL) { | 707 if (foreign_call != NULL) { |
708 jlong global_stub_destination = HotSpotRuntimeCallTarget::address(global_stub); | 708 jlong foreign_call_destination = HotSpotForeignCallLinkage::address(foreign_call); |
709 if (inst->is_call()) { | 709 if (inst->is_call()) { |
710 // NOTE: for call without a mov, the offset must fit a 32-bit immediate | 710 // NOTE: for call without a mov, the offset must fit a 32-bit immediate |
711 // see also CompilerToVM.getMaxCallTargetOffset() | 711 // see also CompilerToVM.getMaxCallTargetOffset() |
712 NativeCall* call = nativeCall_at((address) (inst)); | 712 NativeCall* call = nativeCall_at((address) (inst)); |
713 call->set_destination((address) global_stub_destination); | 713 call->set_destination((address) foreign_call_destination); |
714 _instructions->relocate(call->instruction_address(), runtime_call_Relocation::spec(), Assembler::call32_operand); | 714 _instructions->relocate(call->instruction_address(), runtime_call_Relocation::spec(), Assembler::call32_operand); |
715 } else if (inst->is_mov_literal64()) { | 715 } else if (inst->is_mov_literal64()) { |
716 NativeMovConstReg* mov = nativeMovConstReg_at((address) (inst)); | 716 NativeMovConstReg* mov = nativeMovConstReg_at((address) (inst)); |
717 mov->set_data((intptr_t) global_stub_destination); | 717 mov->set_data((intptr_t) foreign_call_destination); |
718 _instructions->relocate(mov->instruction_address(), runtime_call_Relocation::spec(), Assembler::imm_operand); | 718 _instructions->relocate(mov->instruction_address(), runtime_call_Relocation::spec(), Assembler::imm_operand); |
719 } else { | 719 } else { |
720 NativeJump* jump = nativeJump_at((address) (inst)); | 720 NativeJump* jump = nativeJump_at((address) (inst)); |
721 jump->set_jump_destination((address) global_stub_destination); | 721 jump->set_jump_destination((address) foreign_call_destination); |
722 _instructions->relocate((address)inst, runtime_call_Relocation::spec(), Assembler::call32_operand); | 722 _instructions->relocate((address)inst, runtime_call_Relocation::spec(), Assembler::call32_operand); |
723 } | 723 } |
724 TRACE_graal_3("relocating (stub) at %p", inst); | 724 TRACE_graal_3("relocating (foreign call) at %p", inst); |
725 } else { // method != NULL | 725 } else { // method != NULL |
726 assert(hotspot_method != NULL, "unexpected JavaMethod"); | 726 assert(hotspot_method != NULL, "unexpected JavaMethod"); |
727 #ifdef ASSERT | 727 #ifdef ASSERT |
728 Method* method = NULL; | 728 Method* method = NULL; |
729 // we need to check, this might also be an unresolved method | 729 // we need to check, this might also be an unresolved method |