RFR: 8285699: riscv: Provide information when hitting a HaltNode
Yadong Wang
yadongwang at openjdk.java.net
Thu Apr 28 04:10:15 UTC 2022
The code generated in MacroAssembler::stop is indeed grossly bloated with pusha()/popa() and a native call. We would like to follow the implementation in aarch64 port [JDK-8245986](https://bugs.openjdk.java.net/browse/JDK-8245986), and provide a halt reason when hitting a C2 HaltNode on riscv, and implement it by triggering illegal instruction exceptions.
hs_err_pid log BEFORE:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGILL (0x4) at pc=0x0000003fdd049cd0, pid=2203593, tid=2203614
#
# JRE version: OpenJDK Runtime Environment (19.0) (fastdebug build 19-internal-adhoc.wangyadong.jdk)
# Java VM: OpenJDK 64-Bit Server VM (fastdebug 19-internal-adhoc.wangyadong.jdk, compiled mode, compressed oops, compressed class ptrs, g1 gc, linux-riscv64)
# Problematic frame:
# J 20 c2 compiler.unsafe.TestUnsafeLoadWithZeroAddress.main([Ljava/lang/String;)V (13 bytes) @ 0x0000003fdd049cd0 [0x0000003fdd049c40+0x0000000000000090]
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# If you would like to submit a bug report, please visit:
# https://bugreport.java.com/bugreport/crash.jsp
#
--------------- S U M M A R Y ------------
Command Line: -Dtest.vm.opts= -Dtest.tool.vm.opts= -Dtest.compiler.opts= -Dtest.java.opts= -Dtest.jdk=/home/wangyadong/openjdk-19-internal-before -Dcompile.jdk=/home/wangyadong/openjdk-19-internal-before -Dtest.timeout.factor=1.0 -Dtest.root=/home/wangyadong/riscv-port/test/hotspot/jtreg -Dtest.name=compiler/unsafe/TestUnsafeLoadWithZeroAddress.java -Dtest.file=/home/wangyadong/riscv-port/test/hotspot/jtreg/compiler/unsafe/TestUnsafeLoadWithZeroAddress.java -Dtest.src=/home/wangyadong/riscv-port/test/hotspot/jtreg/compiler/unsafe -Dtest.src.path=/home/wangyadong/riscv-port/test/hotspot/jtreg/compiler/unsafe -Dtest.classes=/home/wangyadong/riscv-port/JTwork/classes/compiler/unsafe/TestUnsafeLoadWithZeroAddress.d -Dtest.class.path=/home/wangyadong/riscv-port/JTwork/classes/compiler/unsafe/TestUnsafeLoadWithZeroAddress.d -Dtest.modules=java.base/jdk.internal.misc:+open --add-modules=java.base --add-exports=java.base/jdk.internal.misc=ALL-UNNAMED --add-opens=java.base/jdk.internal.misc=A
LL-UNNAMED -Xcomp -Xbatch -XX:-TieredCompilation -XX:+AlwaysIncrementalInline -XX:CompileCommand=compileonly,compiler.unsafe.TestUnsafeLoadWithZeroAddress::* com.sun.javatest.regtest.agent.MainWrapper /home/wangyadong/riscv-port/JTwork/compiler/unsafe/TestUnsafeLoadWithZeroAddress.d/main.0.jta
Host: ubuntu, RISCV64, 4 cores, 15G, Ubuntu 21.04
Time: Thu Apr 28 00:00:50 2022 CST elapsed time: 4.374528 seconds (0d 0h 0m 4s)
--------------- T H R E A D ---------------
Current thread (0x0000003fe8471060): JavaThread "MainThread" [_thread_in_Java, id=2203614, stack(0x0000003fc47a4000,0x0000003fc49a4000)]
Stack: [0x0000003fc47a4000,0x0000003fc49a4000], sp=0x0000003fc49a1f00, free space=2039k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
J 20 c2 compiler.unsafe.TestUnsafeLoadWithZeroAddress.main([Ljava/lang/String;)V (13 bytes) @ 0x0000003fdd049cd0 [0x0000003fdd049c40+0x0000000000000090]
j java.lang.invoke.LambdaForm$DMH+0x0000000800080800.invokeStatic(Ljava/lang/Object;Ljava/lang/Object;)V+10 java.base at 19-internal
j java.lang.invoke.LambdaForm$MH+0x0000000800081c00.invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;+33 java.base at 19-internal
j java.lang.invoke.Invokers$Holder.invokeExact_MT(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;+20 java.base at 19-internal
j jdk.internal.reflect.DirectMethodHandleAccessor.invokeImpl(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+55 java.base at 19-internal
j jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+23 java.base at 19-internal
j java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+102 java.base at 19-internal
j com.sun.javatest.regtest.agent.MainWrapper$MainThread.run()V+172
j java.lang.Thread.run()V+11 java.base at 19-internal
v ~StubRoutines::call_stub
V [libjvm.so+0xa8a0fe] JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, JavaThread*)+0x4cc
V [libjvm.so+0xa8a674] JavaCalls::call_virtual(JavaValue*, Klass*, Symbol*, Symbol*, JavaCallArguments*, JavaThread*)+0x3e0
V [libjvm.so+0xa8aa02] JavaCalls::call_virtual(JavaValue*, Handle, Klass*, Symbol*, Symbol*, JavaThread*)+0x60
V [libjvm.so+0xbcf9b4] thread_entry(JavaThread*, JavaThread*)+0x88
V [libjvm.so+0x1299d94] JavaThread::thread_main_inner()+0x24e
V [libjvm.so+0x12a0cd4] Thread::call_run()+0xd4
V [libjvm.so+0xf3c52e] thread_native_entry(Thread*)+0xee
C [libpthread.so.0+0x7460] start_thread+0xb4
C [libc.so.6+0xa7362]
hs_err_pid log AFTER:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (0xe0000000), pid=2178405, tid=2178428
# stop: unsafe off-heap access with zero address
#
# JRE version: OpenJDK Runtime Environment (19.0) (fastdebug build 19-internal-adhoc.wangyadong.jdk)
# Java VM: OpenJDK 64-Bit Server VM (fastdebug 19-internal-adhoc.wangyadong.jdk, compiled mode, compressed oops, compressed class ptrs, g1 gc, linux-riscv64)
# Problematic frame:
# J 20 c2 compiler.unsafe.TestUnsafeLoadWithZeroAddress.main([Ljava/lang/String;)V (13 bytes) @ 0x0000003fe0f4c5d0 [0x0000003fe0f4c540+0x0000000000000090]
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# If you would like to submit a bug report, please visit:
# https://bugreport.java.com/bugreport/crash.jsp
#
--------------- S U M M A R Y ------------
Command Line: -Dtest.vm.opts= -Dtest.tool.vm.opts= -Dtest.compiler.opts= -Dtest.java.opts= -Dtest.jdk=/home/wangyadong/openjdk-19-internal-fastdebug -Dcompile.jdk=/home/wangyadong/openjdk-19-internal-fastdebug -Dtest.timeout.factor=1.0 -Dtest.root=/home/wangyadong/riscv-port/test/hotspot/jtreg -Dtest.name=compiler/unsafe/TestUnsafeLoadWithZeroAddress.java -Dtest.file=/home/wangyadong/riscv-port/test/hotspot/jtreg/compiler/unsafe/TestUnsafeLoadWithZeroAddress.java -Dtest.src=/home/wangyadong/riscv-port/test/hotspot/jtreg/compiler/unsafe -Dtest.src.path=/home/wangyadong/riscv-port/test/hotspot/jtreg/compiler/unsafe -Dtest.classes=/home/wangyadong/riscv-port/JTwork/classes/compiler/unsafe/TestUnsafeLoadWithZeroAddress.d -Dtest.class.path=/home/wangyadong/riscv-port/JTwork/classes/compiler/unsafe/TestUnsafeLoadWithZeroAddress.d -Dtest.modules=java.base/jdk.internal.misc:+open --add-modules=java.base --add-exports=java.base/jdk.internal.misc=ALL-UNNAMED --add-opens=java.base/jdk.internal.
misc=ALL-UNNAMED -Xcomp -Xbatch -XX:-TieredCompilation -XX:+AlwaysIncrementalInline -XX:CompileCommand=compileonly,compiler.unsafe.TestUnsafeLoadWithZeroAddress::* com.sun.javatest.regtest.agent.MainWrapper /home/wangyadong/riscv-port/JTwork/compiler/unsafe/TestUnsafeLoadWithZeroAddress.d/main.0.jta
Host: ubuntu, RISCV64, 4 cores, 15G, Ubuntu 21.04
Time: Wed Apr 27 23:41:11 2022 CST elapsed time: 4.469731 seconds (0d 0h 0m 4s)
--------------- T H R E A D ---------------
Current thread (0x0000003fec45d7a0): JavaThread "MainThread" [_thread_in_Java, id=2178428, stack(0x0000003fc91fe000,0x0000003fc93fe000)]
Stack: [0x0000003fc91fe000,0x0000003fc93fe000], sp=0x0000003fc93fbf00, free space=2039k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
J 20 c2 compiler.unsafe.TestUnsafeLoadWithZeroAddress.main([Ljava/lang/String;)V (13 bytes) @ 0x0000003fe0f4c5d0 [0x0000003fe0f4c540+0x0000000000000090]
j java.lang.invoke.LambdaForm$DMH+0x00000008000c0000.invokeStatic(Ljava/lang/Object;Ljava/lang/Object;)V+10 java.base at 19-internal
j java.lang.invoke.LambdaForm$MH+0x00000008000c1400.invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;+33 java.base at 19-internal
j java.lang.invoke.Invokers$Holder.invokeExact_MT(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;+20 java.base at 19-internal
j jdk.internal.reflect.DirectMethodHandleAccessor.invokeImpl(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+55 java.base at 19-internal
j jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+23 java.base at 19-internal
j java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+102 java.base at 19-internal
j com.sun.javatest.regtest.agent.MainWrapper$MainThread.run()V+172
j java.lang.Thread.run()V+11 java.base at 19-internal
v ~StubRoutines::call_stub
V [libjvm.so+0xa8a0d2] JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, JavaThread*)+0x4cc
V [libjvm.so+0xa8a648] JavaCalls::call_virtual(JavaValue*, Klass*, Symbol*, Symbol*, JavaCallArguments*, JavaThread*)+0x3e0
V [libjvm.so+0xa8a9d6] JavaCalls::call_virtual(JavaValue*, Handle, Klass*, Symbol*, Symbol*, JavaThread*)+0x60
V [libjvm.so+0xbcf988] thread_entry(JavaThread*, JavaThread*)+0x88
V [libjvm.so+0x1299ca6] JavaThread::thread_main_inner()+0x24e
V [libjvm.so+0x12a0be6] Thread::call_run()+0xd4
V [libjvm.so+0xf3c294] thread_native_entry(Thread*)+0xee
C [libpthread.so.0+0x7460] start_thread+0xb4
C [libc.so.6+0xa7362]
This patch passes hotspot and jdk tiere1 on unmatched, and all jtreg tests are tested on Qemu without new failures.
-------------
Commit messages:
- 8285699: riscv: Provide information when hitting a HaltNode
Changes: https://git.openjdk.java.net/jdk/pull/8442/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=8442&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8285699
Stats: 98 lines in 9 files changed: 45 ins; 39 del; 14 mod
Patch: https://git.openjdk.java.net/jdk/pull/8442.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/8442/head:pull/8442
PR: https://git.openjdk.java.net/jdk/pull/8442
More information about the hotspot-dev
mailing list