Wed, 23 Oct 2013 11:15:24 -0700
8026495: JVM Crashes when started with -XX:+DTraceMethodProbes on Solaris x86_64
Summary: Fix wrong calling convention in LIR_Assembler::emit_unwind_handler(), T_METADATA support in calling convention generator, C1 register allocator
Reviewed-by: twisti, jrose
1.1 --- a/src/cpu/sparc/vm/c1_FrameMap_sparc.cpp Wed Oct 23 12:40:23 2013 +0200 1.2 +++ b/src/cpu/sparc/vm/c1_FrameMap_sparc.cpp Wed Oct 23 11:15:24 2013 -0700 1.3 @@ -53,6 +53,8 @@ 1.4 opr = as_long_opr(reg); 1.5 } else if (type == T_OBJECT || type == T_ARRAY) { 1.6 opr = as_oop_opr(reg); 1.7 + } else if (type == T_METADATA) { 1.8 + opr = as_metadata_opr(reg); 1.9 } else { 1.10 opr = as_opr(reg); 1.11 }
2.1 --- a/src/cpu/x86/vm/c1_FrameMap_x86.cpp Wed Oct 23 12:40:23 2013 +0200 2.2 +++ b/src/cpu/x86/vm/c1_FrameMap_x86.cpp Wed Oct 23 11:15:24 2013 -0700 2.3 @@ -52,6 +52,8 @@ 2.4 #endif // _LP64 2.5 } else if (type == T_OBJECT || type == T_ARRAY) { 2.6 opr = as_oop_opr(reg); 2.7 + } else if (type == T_METADATA) { 2.8 + opr = as_metadata_opr(reg); 2.9 } else { 2.10 opr = as_opr(reg); 2.11 }
3.1 --- a/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp Wed Oct 23 12:40:23 2013 +0200 3.2 +++ b/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp Wed Oct 23 11:15:24 2013 -0700 3.3 @@ -432,15 +432,16 @@ 3.4 int offset = code_offset(); 3.5 3.6 // Fetch the exception from TLS and clear out exception related thread state 3.7 - __ get_thread(rsi); 3.8 - __ movptr(rax, Address(rsi, JavaThread::exception_oop_offset())); 3.9 - __ movptr(Address(rsi, JavaThread::exception_oop_offset()), (intptr_t)NULL_WORD); 3.10 - __ movptr(Address(rsi, JavaThread::exception_pc_offset()), (intptr_t)NULL_WORD); 3.11 + Register thread = NOT_LP64(rsi) LP64_ONLY(r15_thread); 3.12 + NOT_LP64(__ get_thread(rsi)); 3.13 + __ movptr(rax, Address(thread, JavaThread::exception_oop_offset())); 3.14 + __ movptr(Address(thread, JavaThread::exception_oop_offset()), (intptr_t)NULL_WORD); 3.15 + __ movptr(Address(thread, JavaThread::exception_pc_offset()), (intptr_t)NULL_WORD); 3.16 3.17 __ bind(_unwind_handler_entry); 3.18 __ verify_not_null_oop(rax); 3.19 if (method()->is_synchronized() || compilation()->env()->dtrace_method_probes()) { 3.20 - __ mov(rsi, rax); // Preserve the exception 3.21 + __ mov(rbx, rax); // Preserve the exception (rbx is always callee-saved) 3.22 } 3.23 3.24 // Preform needed unlocking 3.25 @@ -448,19 +449,24 @@ 3.26 if (method()->is_synchronized()) { 3.27 monitor_address(0, FrameMap::rax_opr); 3.28 stub = new MonitorExitStub(FrameMap::rax_opr, true, 0); 3.29 - __ unlock_object(rdi, rbx, rax, *stub->entry()); 3.30 + __ unlock_object(rdi, rsi, rax, *stub->entry()); 3.31 __ bind(*stub->continuation()); 3.32 } 3.33 3.34 if (compilation()->env()->dtrace_method_probes()) { 3.35 +#ifdef _LP64 3.36 + __ mov(rdi, r15_thread); 3.37 + __ mov_metadata(rsi, method()->constant_encoding()); 3.38 +#else 3.39 __ get_thread(rax); 3.40 __ movptr(Address(rsp, 0), rax); 3.41 __ mov_metadata(Address(rsp, sizeof(void*)), method()->constant_encoding()); 3.42 +#endif 3.43 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_exit))); 3.44 } 3.45 3.46 if (method()->is_synchronized() || compilation()->env()->dtrace_method_probes()) { 3.47 - __ mov(rax, rsi); // Restore the exception 3.48 + __ mov(rax, rbx); // Restore the exception 3.49 } 3.50 3.51 // remove the activation and dispatch to the unwind handler
4.1 --- a/src/share/vm/c1/c1_LIR.cpp Wed Oct 23 12:40:23 2013 +0200 4.2 +++ b/src/share/vm/c1/c1_LIR.cpp Wed Oct 23 11:15:24 2013 -0700 4.3 @@ -183,10 +183,10 @@ 4.4 case T_LONG: 4.5 case T_OBJECT: 4.6 case T_ADDRESS: 4.7 - case T_METADATA: 4.8 case T_VOID: 4.9 return ::type2char(t); 4.10 - 4.11 + case T_METADATA: 4.12 + return 'M'; 4.13 case T_ILLEGAL: 4.14 return '?'; 4.15
5.1 --- a/src/share/vm/c1/c1_LIRGenerator.cpp Wed Oct 23 12:40:23 2013 +0200 5.2 +++ b/src/share/vm/c1/c1_LIRGenerator.cpp Wed Oct 23 11:15:24 2013 -0700 5.3 @@ -1175,7 +1175,7 @@ 5.4 if (compilation()->env()->dtrace_method_probes()) { 5.5 BasicTypeList signature; 5.6 signature.append(LP64_ONLY(T_LONG) NOT_LP64(T_INT)); // thread 5.7 - signature.append(T_OBJECT); // Method* 5.8 + signature.append(T_METADATA); // Method* 5.9 LIR_OprList* args = new LIR_OprList(); 5.10 args->append(getThreadPointer()); 5.11 LIR_Opr meth = new_register(T_METADATA); 5.12 @@ -2720,7 +2720,7 @@ 5.13 if (compilation()->env()->dtrace_method_probes()) { 5.14 BasicTypeList signature; 5.15 signature.append(LP64_ONLY(T_LONG) NOT_LP64(T_INT)); // thread 5.16 - signature.append(T_OBJECT); // Method* 5.17 + signature.append(T_METADATA); // Method* 5.18 LIR_OprList* args = new LIR_OprList(); 5.19 args->append(getThreadPointer()); 5.20 LIR_Opr meth = new_register(T_METADATA); 5.21 @@ -3331,7 +3331,7 @@ 5.22 BasicTypeList* signature = new BasicTypeList(x->number_of_arguments()); 5.23 5.24 if (x->pass_thread()) { 5.25 - signature->append(T_ADDRESS); 5.26 + signature->append(LP64_ONLY(T_LONG) NOT_LP64(T_INT)); // thread 5.27 args->append(getThreadPointer()); 5.28 } 5.29
6.1 --- a/src/share/vm/c1/c1_LinearScan.cpp Wed Oct 23 12:40:23 2013 +0200 6.2 +++ b/src/share/vm/c1/c1_LinearScan.cpp Wed Oct 23 11:15:24 2013 -0700 6.3 @@ -75,9 +75,9 @@ 6.4 6.5 // Map BasicType to spill size in 32-bit words, matching VMReg's notion of words 6.6 #ifdef _LP64 6.7 -static int type2spill_size[T_CONFLICT+1]={ -1, 0, 0, 0, 1, 1, 1, 2, 1, 1, 1, 2, 2, 2, 0, 1, -1}; 6.8 +static int type2spill_size[T_CONFLICT+1]={ -1, 0, 0, 0, 1, 1, 1, 2, 1, 1, 1, 2, 2, 2, 0, 2, 1, 2, 1, -1}; 6.9 #else 6.10 -static int type2spill_size[T_CONFLICT+1]={ -1, 0, 0, 0, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 0, 1, -1}; 6.11 +static int type2spill_size[T_CONFLICT+1]={ -1, 0, 0, 0, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 0, 1, -1, 1, 1, -1}; 6.12 #endif 6.13 6.14