Testcase:
import java.util.concurrent.atomic.AtomicReference;
import sun.misc.Unsafe;
public class TestUnsafe extends AtomicReference<Node>{
public static void main(String[] args) {
for (int i = 0; i < 10000; i++) {
Node n1 = new Node(i);
Node n2 = new Node(i+1);
TestUnsafe t = new TestUnsafe(n1);
Node old = t.foo(n2);
if(old.next.v > 20000) {
System.out.println("not enter here" + old.next.v);
}
}
}
TestUnsafe(Node n) {super(n);}
public Node foo(Node n) {
Node old;
old = this.getAndSet(n); // inline sun.misc.Unsafe::getAndSetObject here
old.next = n;
return old;
}
}
class Node
{
int v;
Node next;
Node(int i) {v = i; next = null;}
}
Hotspot error message:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (/home/yangfei/openjdk9_hs-comp/hotspot/src/cpu/aarch64/vm/assembler_aarch64.hpp:1157), pid=7967, tid=8040
# guarantee(Rs != Rn && Rs != Rt) failed: unpredictable instruction
......
Stack: [0x0000007e1b800000,0x0000007e1ba00000], sp=0x0000007e1b9fcd70, free space=2035k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0xf8ddb0] VMError::report(outputStream*, bool)+0x111c
V [libjvm.so+0xf8fd44] VMError::report_and_die(int, char const*, char const*, std::__va_list, Thread*, unsigned char*, void*, void*, cha
r const*, int, unsigned long)+0x528
V [libjvm.so+0xf8f720] VMError::report_and_die(Thread*, char const*, int, char const*, char const*, std::__va_list)+0x90
V [libjvm.so+0x75a1d0] report_vm_error(char const*, int, char const*, char const*, ...)+0x104
V [libjvm.so+0x40b684] Assembler::stlxrw(RegisterImpl*, RegisterImpl*, RegisterImpl*)+0x74
V [libjvm.so+0xc20008] MacroAssembler::atomic_xchgalw(RegisterImpl*, RegisterImpl*, RegisterImpl*)+0x164
V [libjvm.so+0x4f58f8] LIR_Assembler::atomic_op(LIR_Code, LIR_OprDesc*, LIR_OprDesc*, LIR_OprDesc*, LIR_OprDesc*)+0x4dc
V [libjvm.so+0x4e3d80] LIR_Assembler::emit_op2(LIR_Op2*)+0x488
V [libjvm.so+0x4d5994] LIR_Op2::emit_code(LIR_Assembler*)+0x30
V [libjvm.so+0x4e2510] LIR_Assembler::emit_lir_list(LIR_List*)+0x184
V [libjvm.so+0x4e2360] LIR_Assembler::emit_block(BlockBegin*)+0x198
V [libjvm.so+0x4e2150] LIR_Assembler::emit_code(BlockList*)+0x6c
V [libjvm.so+0x485cc4] Compilation::emit_code_body()+0x128
V [libjvm.so+0x485fd0] Compilation::compile_java_method()+0x238
V [libjvm.so+0x48631c] Compilation::compile_method()+0xec
V [libjvm.so+0x4869a8] Compilation::Compilation(AbstractCompiler*, ciEnv*, ciMethod*, int, BufferBlob*, DirectiveSet*)+0x200
V [libjvm.so+0x48c78c] Compiler::compile_method(ciEnv*, ciMethod*, int, DirectiveSet*)+0xa0
V [libjvm.so+0x6eeb6c] CompileBroker::invoke_compiler_on_method(CompileTask*)+0x608
V [libjvm.so+0x6edc4c] CompileBroker::compiler_thread_loop()+0x288
V [libjvm.so+0xf19ef0] compiler_thread_entry(JavaThread*, Thread*)+0x80
V [libjvm.so+0xf14830] JavaThread::thread_main_inner()+0x15c
V [libjvm.so+0xf146a0] JavaThread::run()+0x1c4
V [libjvm.so+0xd3359c] java_start(Thread*)+0x194
C [libpthread.so.0+0x7c50] start_thread+0xb0
C [libc.so.6+0xdac60] thread_start+0x30
import java.util.concurrent.atomic.AtomicReference;
import sun.misc.Unsafe;
public class TestUnsafe extends AtomicReference<Node>{
public static void main(String[] args) {
for (int i = 0; i < 10000; i++) {
Node n1 = new Node(i);
Node n2 = new Node(i+1);
TestUnsafe t = new TestUnsafe(n1);
Node old = t.foo(n2);
if(old.next.v > 20000) {
System.out.println("not enter here" + old.next.v);
}
}
}
TestUnsafe(Node n) {super(n);}
public Node foo(Node n) {
Node old;
old = this.getAndSet(n); // inline sun.misc.Unsafe::getAndSetObject here
old.next = n;
return old;
}
}
class Node
{
int v;
Node next;
Node(int i) {v = i; next = null;}
}
Hotspot error message:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (/home/yangfei/openjdk9_hs-comp/hotspot/src/cpu/aarch64/vm/assembler_aarch64.hpp:1157), pid=7967, tid=8040
# guarantee(Rs != Rn && Rs != Rt) failed: unpredictable instruction
......
Stack: [0x0000007e1b800000,0x0000007e1ba00000], sp=0x0000007e1b9fcd70, free space=2035k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0xf8ddb0] VMError::report(outputStream*, bool)+0x111c
V [libjvm.so+0xf8fd44] VMError::report_and_die(int, char const*, char const*, std::__va_list, Thread*, unsigned char*, void*, void*, cha
r const*, int, unsigned long)+0x528
V [libjvm.so+0xf8f720] VMError::report_and_die(Thread*, char const*, int, char const*, char const*, std::__va_list)+0x90
V [libjvm.so+0x75a1d0] report_vm_error(char const*, int, char const*, char const*, ...)+0x104
V [libjvm.so+0x40b684] Assembler::stlxrw(RegisterImpl*, RegisterImpl*, RegisterImpl*)+0x74
V [libjvm.so+0xc20008] MacroAssembler::atomic_xchgalw(RegisterImpl*, RegisterImpl*, RegisterImpl*)+0x164
V [libjvm.so+0x4f58f8] LIR_Assembler::atomic_op(LIR_Code, LIR_OprDesc*, LIR_OprDesc*, LIR_OprDesc*, LIR_OprDesc*)+0x4dc
V [libjvm.so+0x4e3d80] LIR_Assembler::emit_op2(LIR_Op2*)+0x488
V [libjvm.so+0x4d5994] LIR_Op2::emit_code(LIR_Assembler*)+0x30
V [libjvm.so+0x4e2510] LIR_Assembler::emit_lir_list(LIR_List*)+0x184
V [libjvm.so+0x4e2360] LIR_Assembler::emit_block(BlockBegin*)+0x198
V [libjvm.so+0x4e2150] LIR_Assembler::emit_code(BlockList*)+0x6c
V [libjvm.so+0x485cc4] Compilation::emit_code_body()+0x128
V [libjvm.so+0x485fd0] Compilation::compile_java_method()+0x238
V [libjvm.so+0x48631c] Compilation::compile_method()+0xec
V [libjvm.so+0x4869a8] Compilation::Compilation(AbstractCompiler*, ciEnv*, ciMethod*, int, BufferBlob*, DirectiveSet*)+0x200
V [libjvm.so+0x48c78c] Compiler::compile_method(ciEnv*, ciMethod*, int, DirectiveSet*)+0xa0
V [libjvm.so+0x6eeb6c] CompileBroker::invoke_compiler_on_method(CompileTask*)+0x608
V [libjvm.so+0x6edc4c] CompileBroker::compiler_thread_loop()+0x288
V [libjvm.so+0xf19ef0] compiler_thread_entry(JavaThread*, Thread*)+0x80
V [libjvm.so+0xf14830] JavaThread::thread_main_inner()+0x15c
V [libjvm.so+0xf146a0] JavaThread::run()+0x1c4
V [libjvm.so+0xd3359c] java_start(Thread*)+0x194
C [libpthread.so.0+0x7c50] start_thread+0xb0
C [libc.so.6+0xdac60] thread_start+0x30
- duplicates
-
JDK-8153172 aarch64: hotspot crashes after the 8.1 LSE patch is merged
- Resolved