comparison src/cpu/x86/vm/c1_Runtime1_x86.cpp @ 2662:440ceca8e3d7

Add exception handlers only to Invoke and Throw instructions. Deoptimize if there is an exception in a HotSpot runtime call.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Wed, 11 May 2011 18:16:01 +0200
parents b1b58f908044
children 75a99b4f1c98
comparison
equal deleted inserted replaced
2661:194d93d089bd 2662:440ceca8e3d7
36 #include "runtime/sharedRuntime.hpp" 36 #include "runtime/sharedRuntime.hpp"
37 #include "runtime/signature.hpp" 37 #include "runtime/signature.hpp"
38 #include "runtime/vframeArray.hpp" 38 #include "runtime/vframeArray.hpp"
39 #include "vmreg_x86.inline.hpp" 39 #include "vmreg_x86.inline.hpp"
40 40
41 static void restore_live_registers(StubAssembler* sasm, bool restore_fpu_registers = true);
41 42
42 // Implementation of StubAssembler 43 // Implementation of StubAssembler
43 44
44 int StubAssembler::call_RT(Register oop_result1, Register oop_result2, address entry, int args_size) { 45 int StubAssembler::call_RT(Register oop_result1, Register oop_result2, address entry, int args_size) {
45 // setup registers 46 // setup registers
94 movptr(Address(thread, JavaThread::vm_result_offset()), NULL_WORD); 95 movptr(Address(thread, JavaThread::vm_result_offset()), NULL_WORD);
95 } 96 }
96 if (oop_result2->is_valid()) { 97 if (oop_result2->is_valid()) {
97 movptr(Address(thread, JavaThread::vm_result_2_offset()), NULL_WORD); 98 movptr(Address(thread, JavaThread::vm_result_2_offset()), NULL_WORD);
98 } 99 }
99 if (frame_size() == no_frame_size) { 100 // (tw) Deoptimize in case of an exception.
100 leave(); 101 restore_live_registers(this, false);
101 jump(RuntimeAddress(StubRoutines::forward_exception_entry())); 102 movptr(Address(thread, Thread::pending_exception_offset()), NULL_WORD);
102 } else if (_stub_id == Runtime1::forward_exception_id) { 103 leave();
103 should_not_reach_here(); 104 jump(RuntimeAddress(SharedRuntime::deopt_blob()->uncommon_trap()));
104 } else {
105 jump(RuntimeAddress(Runtime1::entry_for(Runtime1::forward_exception_id)));
106 }
107 bind(L); 105 bind(L);
108 } 106 }
109 // get oop results if there are any and reset the values in the thread 107 // get oop results if there are any and reset the values in the thread
110 if (oop_result1->is_valid()) { 108 if (oop_result1->is_valid()) {
111 movptr(oop_result1, Address(thread, JavaThread::vm_result_offset())); 109 movptr(oop_result1, Address(thread, JavaThread::vm_result_offset()));
537 535
538 __ addptr(rsp, extra_space_offset * VMRegImpl::stack_slot_size); 536 __ addptr(rsp, extra_space_offset * VMRegImpl::stack_slot_size);
539 } 537 }
540 538
541 539
542 static void restore_live_registers(StubAssembler* sasm, bool restore_fpu_registers = true) { 540 static void restore_live_registers(StubAssembler* sasm, bool restore_fpu_registers/* = true*/) {
543 __ block_comment("restore_live_registers"); 541 __ block_comment("restore_live_registers");
544 542
545 restore_fpu(sasm, restore_fpu_registers); 543 restore_fpu(sasm, restore_fpu_registers);
546 __ popa(); 544 __ popa();
547 } 545 }