Tue, 14 Jun 2016 20:04:50 +0800
[C2] Fixed Fast_Unlock.
Running "java -jar SPECjvm2008.jar -bt 4 derby" on 3A2000 may cause jvm crash.
The
crash infomation is:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x000000ffeb17dca8, pid=9369, tid=1098526224880
#
# JRE version: OpenJDK Runtime Environment (8.0) (build
# 1.8.0_internal-loongson_2016_06_02_17_06-b00)
# Java VM: OpenJDK 64-Bit Server VM (25.25-b02 mixed mode linux- compressed
# oops)
# Problematic frame:
# V [libjvm.so+0x8f9ca8] ObjectSynchronizer::slow_exit(oopDesc*, BasicLock*,
# Thread*)+0x10
#
# Failed to write core dump. Core dumps have been disabled. To enable core
# dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/loongson/aoqi/jdk-test/SPECjvm2008/hs_err_pid9369.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.sun.com/bugreport/crash.jsp
#
src/cpu/mips/vm/mips_64.ad | file | annotate | diff | comparison | revisions |
1.1 --- a/src/cpu/mips/vm/mips_64.ad Sun Jun 12 09:32:41 2016 +0800 1.2 +++ b/src/cpu/mips/vm/mips_64.ad Tue Jun 14 20:04:50 2016 +0800 1.3 @@ -3055,6 +3055,7 @@ 1.4 __ ld(tmpReg, Address(tmpReg, ObjectMonitor::owner_offset_in_bytes()-2)) ; 1.5 __ sltiu(AT, tmpReg, 1); /* Jin: AT = !tmpReg; */ 1.6 __ bne(tmpReg, R0, DONE_LABEL); 1.7 + __ delayed()->nop(); 1.8 1.9 __ cmpxchg(TREG, Address(boxReg, ObjectMonitor::owner_offset_in_bytes()-2), tmpReg) ; 1.10 // Intentional fall-through into DONE_LABEL ... 1.11 @@ -3155,11 +3156,12 @@ 1.12 1.13 __ ld(tmpReg, Address(objReg, 0)) ; // Examine the object's markword 1.14 __ ld(AT, Address(boxReg, 0)) ; // Examine the displaced header 1.15 - //masm.jccb (Assembler::zero, DONE_LABEL) ; // 0 indicates recursive stack-lock 1.16 __ beq(AT, R0, DONE_LABEL) ; // 0 indicates recursive stack-lock 1.17 - __ move(AT, 0x1); /* delay slot */ 1.18 - 1.19 - __ andi(AT, tmpReg, 0x02) ; // Inflated? 1.20 + //__ move(AT, 0x1); 1.21 + //__ delayed()->nop(); 1.22 + __ delayed()->daddiu(AT, R0, 0x1); 1.23 + 1.24 + __ andi(AT, tmpReg, markOopDesc::monitor_value) ; // Inflated? 1.25 __ beq(AT, R0, Stacked) ; // Inflated? 1.26 __ delayed()->nop(); 1.27 1.28 @@ -3187,13 +3189,14 @@ 1.29 // IA32's memory-model is SPO, so STs are ordered with respect to 1.30 // each other and there's no need for an explicit barrier (fence). 1.31 // See also http://gee.cs.oswego.edu/dl/jmm/cookbook.html. 1.32 - 1.33 #ifdef OPT_THREAD 1.34 __ move(boxReg, TREG); 1.35 #else 1.36 __ get_thread (boxReg) ; 1.37 #endif 1.38 1.39 +#ifndef _LP64 1.40 + 1.41 // Note that we could employ various encoding schemes to reduce 1.42 // the number of loads below (currently 4) to just 2 or 3. 1.43 // Refer to the comments in synchronizer.cpp. 1.44 @@ -3340,6 +3343,82 @@ 1.45 if ((EmitSync & 65536) == 0) { 1.46 __ bind (CheckSucc) ; 1.47 } 1.48 +#else // _LP64 1.49 + // It's inflated 1.50 + __ ld(AT, Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2)) ; 1.51 + __ xorr(boxReg, boxReg, AT); 1.52 + 1.53 + __ ld(AT, Address (tmpReg, ObjectMonitor::recursions_offset_in_bytes()-2)) ; 1.54 + __ orr(boxReg, boxReg, AT); 1.55 + 1.56 + __ move(AT, R0); 1.57 + __ bne(boxReg, R0, DONE_LABEL); 1.58 + __ delayed()->nop(); 1.59 + 1.60 + __ ld(boxReg, Address (tmpReg, ObjectMonitor::EntryList_offset_in_bytes()-2)) ; 1.61 + __ ld(AT, Address (tmpReg, ObjectMonitor::cxq_offset_in_bytes()-2)) ; 1.62 + __ orr(boxReg, boxReg, AT); 1.63 + 1.64 + __ move(AT, R0); 1.65 + __ bne(boxReg, R0, CheckSucc); 1.66 + __ delayed()->nop(); 1.67 + 1.68 + __ sd(R0, Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2)) ; 1.69 + __ move(AT, 0x1); 1.70 + __ b(DONE_LABEL); 1.71 + __ delayed()->nop(); 1.72 + 1.73 + 1.74 + if ((EmitSync & 65536) == 0) { 1.75 + Label LSuccess, LGoSlowPath ; 1.76 + __ bind (CheckSucc); 1.77 + __ ld(AT, Address (tmpReg, ObjectMonitor::succ_offset_in_bytes()-2)) ; 1.78 + __ beq(AT, R0, LGoSlowPath); 1.79 + __ delayed()->nop(); 1.80 + 1.81 + // I'd much rather use lock:andl m->_owner, 0 as it's faster than the 1.82 + // the explicit ST;MEMBAR combination, but masm doesn't currently support 1.83 + // "ANDQ M,IMM". Don't use MFENCE here. lock:add to TOS, xchg, etc 1.84 + // are all faster when the write buffer is populated. 1.85 + __ sd(R0, Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2)) ; 1.86 + if (os::is_MP()) { 1.87 + // lock (); 1.88 + //addl (Address(rsp, 0), 0); //? 1.89 + } 1.90 + __ ld(AT, Address (tmpReg, ObjectMonitor::succ_offset_in_bytes()-2)) ; 1.91 + __ bne(AT, R0, LSuccess); 1.92 + __ delayed()->nop(); 1.93 + 1.94 + __ move(boxReg, R0) ; // box is really EAX 1.95 + //if (os::is_MP()) { lock(); } 1.96 + __ cmpxchg(SP, Address(tmpReg, ObjectMonitor::owner_offset_in_bytes()-2), boxReg); 1.97 + __ beq(AT, R0, LSuccess); 1.98 + __ delayed()->nop(); 1.99 + // Intentional fall-through into slow-path 1.100 + 1.101 + __ bind (LGoSlowPath); 1.102 + __ ori(boxReg, boxReg, 1) ; // set ICC.ZF=0 to indicate failure 1.103 + __ move(AT, R0); 1.104 + __ b(DONE_LABEL) ; 1.105 + __ delayed()->nop(); 1.106 + 1.107 + 1.108 + __ bind (LSuccess); 1.109 + __ move(boxReg, R0) ; // set ICC.ZF=1 to indicate success 1.110 + __ move(AT, 0x1) ; 1.111 + __ b(DONE_LABEL) ; 1.112 + __ delayed()->nop(); 1.113 + } 1.114 + 1.115 + __ bind (Stacked); 1.116 + __ ld(tmpReg, Address(boxReg, 0)) ; 1.117 + //if (os::is_MP()) { lock(); } 1.118 + __ cmpxchg(tmpReg, Address(objReg, 0), boxReg); // Uses EAX which is box 1.119 + 1.120 + if (EmitSync & 65536) { 1.121 + __ bind (CheckSucc); 1.122 + } 1.123 +#endif 1.124 1.125 __ bind(DONE_LABEL); 1.126 1.127 @@ -3357,7 +3436,7 @@ 1.128 1.129 __ addu(flags, R0, R0); 1.130 __ beq(AT, R0, L); 1.131 - __ nop(); 1.132 + __ delayed()->nop(); 1.133 __ move(flags, 0xFFFFFFFF); 1.134 __ bind(L); 1.135 %}