comparison src/cpu/x86/vm/stubGenerator_x86_32.cpp @ 3937:c565834fb592

7088020: SEGV in JNIHandleBlock::release_block Reviewed-by: kvn, twisti
author never
date Sat, 10 Sep 2011 00:11:04 -0700
parents d83ac25d0304
children f08d439fab8c
comparison
equal deleted inserted replaced
3936:2c24ef16533d 3937:c565834fb592
2185 // continuation_for_implicit_division_by_zero_exception. All other implicit 2185 // continuation_for_implicit_division_by_zero_exception. All other implicit
2186 // exceptions (e.g., NullPointerException or AbstractMethodError on entry) are 2186 // exceptions (e.g., NullPointerException or AbstractMethodError on entry) are
2187 // 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,
2188 // so caller saved registers were assumed volatile in the compiler. 2188 // so caller saved registers were assumed volatile in the compiler.
2189 address generate_throw_exception(const char* name, address runtime_entry, 2189 address generate_throw_exception(const char* name, address runtime_entry,
2190 bool restore_saved_exception_pc, Register arg1 = noreg, Register arg2 = noreg) { 2190 Register arg1 = noreg, Register arg2 = noreg) {
2191 2191
2192 int insts_size = 256; 2192 int insts_size = 256;
2193 int locs_size = 32; 2193 int locs_size = 32;
2194 2194
2195 CodeBuffer code(name, insts_size, locs_size); 2195 CodeBuffer code(name, insts_size, locs_size);
2202 // which has the ability to fetch the return PC out of 2202 // which has the ability to fetch the return PC out of
2203 // thread-local storage and also sets up last_Java_sp slightly 2203 // thread-local storage and also sets up last_Java_sp slightly
2204 // differently than the real call_VM 2204 // differently than the real call_VM
2205 Register java_thread = rbx; 2205 Register java_thread = rbx;
2206 __ get_thread(java_thread); 2206 __ get_thread(java_thread);
2207 if (restore_saved_exception_pc) {
2208 __ movptr(rax, Address(java_thread, in_bytes(JavaThread::saved_exception_pc_offset())));
2209 __ push(rax);
2210 }
2211 2207
2212 __ enter(); // required for proper stackwalking of RuntimeStub frame 2208 __ enter(); // required for proper stackwalking of RuntimeStub frame
2213 2209
2214 // pc and rbp, already pushed 2210 // pc and rbp, already pushed
2215 __ subptr(rsp, (framesize-2) * wordSize); // prolog 2211 __ subptr(rsp, (framesize-2) * wordSize); // prolog
2321 2317
2322 // Build this early so it's available for the interpreter 2318 // Build this early so it's available for the interpreter
2323 StubRoutines::_throw_WrongMethodTypeException_entry = 2319 StubRoutines::_throw_WrongMethodTypeException_entry =
2324 generate_throw_exception("WrongMethodTypeException throw_exception", 2320 generate_throw_exception("WrongMethodTypeException throw_exception",
2325 CAST_FROM_FN_PTR(address, SharedRuntime::throw_WrongMethodTypeException), 2321 CAST_FROM_FN_PTR(address, SharedRuntime::throw_WrongMethodTypeException),
2326 false, rax, rcx); 2322 rax, rcx);
2327 } 2323 }
2328 2324
2329 2325
2330 void generate_all() { 2326 void generate_all() {
2331 // Generates all stubs and initializes the entry points 2327 // Generates all stubs and initializes the entry points
2332 2328
2333 // These entry points require SharedInfo::stack0 to be set up in non-core builds 2329 // These entry points require SharedInfo::stack0 to be set up in non-core builds
2334 // and need to be relocatable, so they each fabricate a RuntimeStub internally. 2330 // and need to be relocatable, so they each fabricate a RuntimeStub internally.
2335 StubRoutines::_throw_AbstractMethodError_entry = generate_throw_exception("AbstractMethodError throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_AbstractMethodError), false); 2331 StubRoutines::_throw_AbstractMethodError_entry = generate_throw_exception("AbstractMethodError throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_AbstractMethodError));
2336 StubRoutines::_throw_IncompatibleClassChangeError_entry= generate_throw_exception("IncompatibleClassChangeError throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_IncompatibleClassChangeError), false); 2332 StubRoutines::_throw_IncompatibleClassChangeError_entry= generate_throw_exception("IncompatibleClassChangeError throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_IncompatibleClassChangeError));
2337 StubRoutines::_throw_ArithmeticException_entry = generate_throw_exception("ArithmeticException throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_ArithmeticException), true); 2333 StubRoutines::_throw_NullPointerException_at_call_entry= generate_throw_exception("NullPointerException at call throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_NullPointerException_at_call));
2338 StubRoutines::_throw_NullPointerException_entry = generate_throw_exception("NullPointerException throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_NullPointerException), true); 2334 StubRoutines::_throw_StackOverflowError_entry = generate_throw_exception("StackOverflowError throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_StackOverflowError));
2339 StubRoutines::_throw_NullPointerException_at_call_entry= generate_throw_exception("NullPointerException at call throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_NullPointerException_at_call), false);
2340 StubRoutines::_throw_StackOverflowError_entry = generate_throw_exception("StackOverflowError throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_StackOverflowError), false);
2341 2335
2342 //------------------------------------------------------------------------------------------------------------------------ 2336 //------------------------------------------------------------------------------------------------------------------------
2343 // entry points that are platform specific 2337 // entry points that are platform specific
2344 2338
2345 // support for verify_oop (must happen after universe_init) 2339 // support for verify_oop (must happen after universe_init)