comparison src/share/vm/graal/graalCodeInstaller.cpp @ 7935:0799a7efbe7b

Clean up of usage of marks and code installation.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Tue, 05 Mar 2013 19:00:23 +0100
parents 85bd81dba8fc
children c66aa27ef4da
comparison
equal deleted inserted replaced
7934:6b3c05de9521 7935:0799a7efbe7b
342 342
343 int stack_slots = _total_frame_size / HeapWordSize; // conversion to words 343 int stack_slots = _total_frame_size / HeapWordSize; // conversion to words
344 GrowableArray<jlong>* leaf_graph_ids = get_leaf_graph_ids(comp_result); 344 GrowableArray<jlong>* leaf_graph_ids = get_leaf_graph_ids(comp_result);
345 345
346 result = GraalEnv::register_method(method, nm, entry_bci, &_offsets, _custom_stack_area_offset, &buffer, stack_slots, _debug_recorder->_oopmaps, &_exception_handler_table, 346 result = GraalEnv::register_method(method, nm, entry_bci, &_offsets, _custom_stack_area_offset, &buffer, stack_slots, _debug_recorder->_oopmaps, &_exception_handler_table,
347 &_implicit_exception_table, GraalCompiler::instance(), _debug_recorder, _dependencies, NULL, -1, true, false, leaf_graph_ids, installed_code); 347 GraalCompiler::instance(), _debug_recorder, _dependencies, NULL, -1, true, false, leaf_graph_ids, installed_code);
348 348
349 method->clear_queued_for_compilation(); 349 method->clear_queued_for_compilation();
350 } 350 }
351 351
352 // constructor used to create a stub 352 // constructor used to create a stub
686 #endif 686 #endif
687 assert(debug_info != NULL, "debug info expected"); 687 assert(debug_info != NULL, "debug info expected");
688 688
689 TRACE_graal_3("method call"); 689 TRACE_graal_3("method call");
690 switch (_next_call_type) { 690 switch (_next_call_type) {
691 case MARK_INLINE_INVOKEVIRTUAL: { 691 case MARK_INLINE_INVOKE:
692 break; 692 break;
693 }
694 case MARK_INVOKEVIRTUAL: 693 case MARK_INVOKEVIRTUAL:
695 case MARK_INVOKEINTERFACE: { 694 case MARK_INVOKEINTERFACE: {
696 assert(method == NULL || !method->is_static(), "cannot call static method with invokeinterface"); 695 assert(method == NULL || !method->is_static(), "cannot call static method with invokeinterface");
697 696
698 NativeCall* call = nativeCall_at(_instructions->start() + pc_offset); 697 NativeCall* call = nativeCall_at(_instructions->start() + pc_offset);
699 call->set_destination(SharedRuntime::get_resolve_virtual_call_stub()); 698 call->set_destination(SharedRuntime::get_resolve_virtual_call_stub());
700 _instructions->relocate(call->instruction_address(), virtual_call_Relocation::spec(_invoke_mark_pc), Assembler::call32_operand); 699 _instructions->relocate(call->instruction_address(), virtual_call_Relocation::spec(_invoke_mark_pc), Assembler::call32_operand);
701 break; 700 break;
702 } 701 }
703 case MARK_INVOKESTATIC: {
704 assert(method == NULL || method->is_static(), "cannot call non-static method with invokestatic");
705
706 NativeCall* call = nativeCall_at(_instructions->start() + pc_offset);
707 call->set_destination(SharedRuntime::get_resolve_static_call_stub());
708 _instructions->relocate(call->instruction_address(), relocInfo::static_call_type, Assembler::call32_operand);
709 break;
710 }
711 case MARK_INVOKESPECIAL: {
712 assert(method == NULL || !method->is_static(), "cannot call static method with invokespecial");
713
714 NativeCall* call = nativeCall_at(_instructions->start() + pc_offset);
715 call->set_destination(SharedRuntime::get_resolve_opt_virtual_call_stub());
716 _instructions->relocate(call->instruction_address(), relocInfo::opt_virtual_call_type, Assembler::call32_operand);
717 break;
718 }
719 case MARK_INVOKE_INVALID:
720 default: 702 default:
721 fatal("invalid _next_call_type value"); 703 fatal("invalid _next_call_type value");
722 break; 704 break;
723 } 705 }
724 } 706 }
814 _offsets.set_value(CodeOffsets::Exceptions, pc_offset); 796 _offsets.set_value(CodeOffsets::Exceptions, pc_offset);
815 break; 797 break;
816 case MARK_DEOPT_HANDLER_ENTRY: 798 case MARK_DEOPT_HANDLER_ENTRY:
817 _offsets.set_value(CodeOffsets::Deopt, pc_offset); 799 _offsets.set_value(CodeOffsets::Deopt, pc_offset);
818 break; 800 break;
819 case MARK_STATIC_CALL_STUB: {
820 _instructions->relocate(instruction, metadata_Relocation::spec_for_immediate());
821 assert(references->length() == 1, "static call stub needs one reference");
822 oop ref = ((oop*) references->base(T_OBJECT))[0];
823 address call_pc = _instructions->start() + CompilationResult_Site::pcOffset(ref);
824 _instructions->relocate(instruction, static_stub_Relocation::spec(call_pc));
825 break;
826 }
827 case MARK_INVOKEVIRTUAL: 801 case MARK_INVOKEVIRTUAL:
828 case MARK_INVOKEINTERFACE: { 802 case MARK_INVOKEINTERFACE: {
829 // Convert the initial value of the Klass* slot in an inline cache 803 // Convert the initial value of the Klass* slot in an inline cache
830 // from 0L to Universe::non_oop_word(). 804 // from 0L to Universe::non_oop_word().
831 NativeMovConstReg* n_copy = nativeMovConstReg_at(instruction); 805 NativeMovConstReg* n_copy = nativeMovConstReg_at(instruction);
832 assert(n_copy->data() == 0, "inline cache Klass* initial value should be 0L"); 806 assert(n_copy->data() == 0, "inline cache Klass* initial value should be 0L");
833 n_copy->set_data((intptr_t)Universe::non_oop_word()); 807 n_copy->set_data((intptr_t)Universe::non_oop_word());
834 } 808 }
835 case MARK_INLINE_INVOKEVIRTUAL: 809 case MARK_INLINE_INVOKE:
836 case MARK_INVOKE_INVALID:
837 case MARK_INVOKESPECIAL:
838 case MARK_INVOKESTATIC:
839 _next_call_type = (MarkId) id; 810 _next_call_type = (MarkId) id;
840 _invoke_mark_pc = instruction; 811 _invoke_mark_pc = instruction;
841 break;
842 case MARK_IMPLICIT_NULL:
843 _implicit_exception_table.append(pc_offset, pc_offset);
844 break; 812 break;
845 case MARK_POLL_NEAR: { 813 case MARK_POLL_NEAR: {
846 NativeInstruction* ni = nativeInstruction_at(instruction); 814 NativeInstruction* ni = nativeInstruction_at(instruction);
847 int32_t* disp = (int32_t*) Assembler::locate_operand(instruction, Assembler::disp32_operand); 815 int32_t* disp = (int32_t*) Assembler::locate_operand(instruction, Assembler::disp32_operand);
848 int32_t offset = *disp; // The Java code installed the polling page offset into the disp32 operand 816 int32_t offset = *disp; // The Java code installed the polling page offset into the disp32 operand