Mercurial > hg > truffle
comparison src/cpu/x86/vm/stubGenerator_x86_32.cpp @ 3781:d83ac25d0304
7055355: JSR 292: crash while throwing WrongMethodTypeException
Reviewed-by: jrose, twisti, bdelsart
author | never |
---|---|
date | Thu, 16 Jun 2011 13:46:55 -0700 |
parents | 0ac769a57c64 |
children | c565834fb592 |
comparison
equal
deleted
inserted
replaced
3759:cfcf2ba8f3eb | 3781:d83ac25d0304 |
---|---|
2149 // Note that we only have to preserve callee-saved registers since | 2149 // Note that we only have to preserve callee-saved registers since |
2150 // the compilers are responsible for supplying a continuation point | 2150 // the compilers are responsible for supplying a continuation point |
2151 // if they expect all registers to be preserved. | 2151 // if they expect all registers to be preserved. |
2152 enum layout { | 2152 enum layout { |
2153 thread_off, // last_java_sp | 2153 thread_off, // last_java_sp |
2154 arg1_off, | |
2155 arg2_off, | |
2154 rbp_off, // callee saved register | 2156 rbp_off, // callee saved register |
2155 ret_pc, | 2157 ret_pc, |
2156 framesize | 2158 framesize |
2157 }; | 2159 }; |
2158 | 2160 |
2183 // continuation_for_implicit_division_by_zero_exception. All other implicit | 2185 // continuation_for_implicit_division_by_zero_exception. All other implicit |
2184 // exceptions (e.g., NullPointerException or AbstractMethodError on entry) are | 2186 // exceptions (e.g., NullPointerException or AbstractMethodError on entry) are |
2185 // either at call sites or otherwise assume that stack unwinding will be initiated, | 2187 // either at call sites or otherwise assume that stack unwinding will be initiated, |
2186 // so caller saved registers were assumed volatile in the compiler. | 2188 // so caller saved registers were assumed volatile in the compiler. |
2187 address generate_throw_exception(const char* name, address runtime_entry, | 2189 address generate_throw_exception(const char* name, address runtime_entry, |
2188 bool restore_saved_exception_pc) { | 2190 bool restore_saved_exception_pc, Register arg1 = noreg, Register arg2 = noreg) { |
2189 | 2191 |
2190 int insts_size = 256; | 2192 int insts_size = 256; |
2191 int locs_size = 32; | 2193 int locs_size = 32; |
2192 | 2194 |
2193 CodeBuffer code(name, insts_size, locs_size); | 2195 CodeBuffer code(name, insts_size, locs_size); |
2216 | 2218 |
2217 int frame_complete = __ pc() - start; | 2219 int frame_complete = __ pc() - start; |
2218 | 2220 |
2219 // push java thread (becomes first argument of C function) | 2221 // push java thread (becomes first argument of C function) |
2220 __ movptr(Address(rsp, thread_off * wordSize), java_thread); | 2222 __ movptr(Address(rsp, thread_off * wordSize), java_thread); |
2223 if (arg1 != noreg) { | |
2224 __ movptr(Address(rsp, arg1_off * wordSize), arg1); | |
2225 } | |
2226 if (arg2 != noreg) { | |
2227 assert(arg1 != noreg, "missing reg arg"); | |
2228 __ movptr(Address(rsp, arg2_off * wordSize), arg2); | |
2229 } | |
2221 | 2230 |
2222 // Set up last_Java_sp and last_Java_fp | 2231 // Set up last_Java_sp and last_Java_fp |
2223 __ set_last_Java_frame(java_thread, rsp, rbp, NULL); | 2232 __ set_last_Java_frame(java_thread, rsp, rbp, NULL); |
2224 | 2233 |
2225 // Call runtime | 2234 // Call runtime |
2307 StubRoutines::x86::_verify_fpu_cntrl_wrd_entry = generate_verify_fpu_cntrl_wrd(); | 2316 StubRoutines::x86::_verify_fpu_cntrl_wrd_entry = generate_verify_fpu_cntrl_wrd(); |
2308 StubRoutines::_d2i_wrapper = generate_d2i_wrapper(T_INT, | 2317 StubRoutines::_d2i_wrapper = generate_d2i_wrapper(T_INT, |
2309 CAST_FROM_FN_PTR(address, SharedRuntime::d2i)); | 2318 CAST_FROM_FN_PTR(address, SharedRuntime::d2i)); |
2310 StubRoutines::_d2l_wrapper = generate_d2i_wrapper(T_LONG, | 2319 StubRoutines::_d2l_wrapper = generate_d2i_wrapper(T_LONG, |
2311 CAST_FROM_FN_PTR(address, SharedRuntime::d2l)); | 2320 CAST_FROM_FN_PTR(address, SharedRuntime::d2l)); |
2321 | |
2322 // Build this early so it's available for the interpreter | |
2323 StubRoutines::_throw_WrongMethodTypeException_entry = | |
2324 generate_throw_exception("WrongMethodTypeException throw_exception", | |
2325 CAST_FROM_FN_PTR(address, SharedRuntime::throw_WrongMethodTypeException), | |
2326 false, rax, rcx); | |
2312 } | 2327 } |
2313 | 2328 |
2314 | 2329 |
2315 void generate_all() { | 2330 void generate_all() { |
2316 // Generates all stubs and initializes the entry points | 2331 // Generates all stubs and initializes the entry points |