85 CodeBuffer buffer("exception_blob", 2048, 1024); |
85 CodeBuffer buffer("exception_blob", 2048, 1024); |
86 InterpreterMacroAssembler* masm = new InterpreterMacroAssembler(&buffer); |
86 InterpreterMacroAssembler* masm = new InterpreterMacroAssembler(&buffer); |
87 |
87 |
88 address start = __ pc(); |
88 address start = __ pc(); |
89 |
89 |
90 int frame_size_in_bytes = frame::abi_112_size; |
90 int frame_size_in_bytes = frame::abi_reg_args_size; |
91 OopMap* map = new OopMap(frame_size_in_bytes / sizeof(jint), 0); |
91 OopMap* map = new OopMap(frame_size_in_bytes / sizeof(jint), 0); |
92 |
92 |
93 // Exception pc is 'return address' for stack walker. |
93 // Exception pc is 'return address' for stack walker. |
94 __ std(R4_ARG2/*exception pc*/, _abi(lr), R1_SP); |
94 __ std(R4_ARG2/*exception pc*/, _abi(lr), R1_SP); |
95 |
95 |
97 __ std(R3_ARG1/*exception oop*/, in_bytes(JavaThread::exception_oop_offset()), R16_thread); |
97 __ std(R3_ARG1/*exception oop*/, in_bytes(JavaThread::exception_oop_offset()), R16_thread); |
98 __ std(R4_ARG2/*exception pc*/, in_bytes(JavaThread::exception_pc_offset()), R16_thread); |
98 __ std(R4_ARG2/*exception pc*/, in_bytes(JavaThread::exception_pc_offset()), R16_thread); |
99 |
99 |
100 // Save callee-saved registers. |
100 // Save callee-saved registers. |
101 // Push a C frame for the exception blob. It is needed for the C call later on. |
101 // Push a C frame for the exception blob. It is needed for the C call later on. |
102 __ push_frame_abi112(0, R11_scratch1); |
102 __ push_frame_reg_args(0, R11_scratch1); |
103 |
103 |
104 // This call does all the hard work. It checks if an exception handler |
104 // This call does all the hard work. It checks if an exception handler |
105 // exists in the method. |
105 // exists in the method. |
106 // If so, it returns the handler address. |
106 // If so, it returns the handler address. |
107 // If not, it prepares for stack-unwinding, restoring the callee-save |
107 // If not, it prepares for stack-unwinding, restoring the callee-save |
108 // registers of the frame being removed. |
108 // registers of the frame being removed. |
109 __ set_last_Java_frame(/*sp=*/R1_SP, noreg); |
109 __ set_last_Java_frame(/*sp=*/R1_SP, noreg); |
110 |
110 |
111 __ mr(R3_ARG1, R16_thread); |
111 __ mr(R3_ARG1, R16_thread); |
|
112 #if defined(ABI_ELFv2) |
|
113 __ call_c((address) OptoRuntime::handle_exception_C, relocInfo::none); |
|
114 #else |
112 __ call_c(CAST_FROM_FN_PTR(FunctionDescriptor*, OptoRuntime::handle_exception_C), |
115 __ call_c(CAST_FROM_FN_PTR(FunctionDescriptor*, OptoRuntime::handle_exception_C), |
113 relocInfo::none); |
116 relocInfo::none); |
|
117 #endif |
114 address calls_return_pc = __ last_calls_return_pc(); |
118 address calls_return_pc = __ last_calls_return_pc(); |
115 # ifdef ASSERT |
119 # ifdef ASSERT |
116 __ cmpdi(CCR0, R3_RET, 0); |
120 __ cmpdi(CCR0, R3_RET, 0); |
117 __ asm_assert_ne("handle_exception_C must not return NULL", 0x601); |
121 __ asm_assert_ne("handle_exception_C must not return NULL", 0x601); |
118 # endif |
122 # endif |
160 |
164 |
161 // Same as above, but also set sp to unextended_sp. |
165 // Same as above, but also set sp to unextended_sp. |
162 __ bind(mh_callsite); |
166 __ bind(mh_callsite); |
163 __ mr(R31, R3_RET); // Save branch address. |
167 __ mr(R31, R3_RET); // Save branch address. |
164 __ mr(R3_ARG1, R16_thread); |
168 __ mr(R3_ARG1, R16_thread); |
|
169 #if defined(ABI_ELFv2) |
|
170 __ call_c((address) adjust_SP_for_methodhandle_callsite, relocInfo::none); |
|
171 #else |
165 __ call_c(CAST_FROM_FN_PTR(FunctionDescriptor*, adjust_SP_for_methodhandle_callsite), relocInfo::none); |
172 __ call_c(CAST_FROM_FN_PTR(FunctionDescriptor*, adjust_SP_for_methodhandle_callsite), relocInfo::none); |
|
173 #endif |
166 // Returns unextended_sp in R3_RET. |
174 // Returns unextended_sp in R3_RET. |
167 |
175 |
168 __ mtctr(R31); // Move address of exception handler to SR_CTR. |
176 __ mtctr(R31); // Move address of exception handler to SR_CTR. |
169 __ reset_last_Java_frame(); |
177 __ reset_last_Java_frame(); |
170 |
178 |