-
Bug
-
Resolution: Fixed
-
P4
-
11, 16, 17
-
b16
-
generic
-
generic
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8264477 | 11.0.12-oracle | Dukebot | P4 | Resolved | Fixed | b01 |
JDK-8265502 | 11.0.12 | Fei Yang | P4 | Resolved | Fixed | b01 |
$ cat Test.java
class Test {
public static String concatStringConstU(String a) {
return new StringBuilder().append(stringSmallU).append(a).append(stringU).toString();
}
static final String stringU = "\u0f21\u0f22\u0f23\u0f24\u0f25\u0f26\u0f27\u0f28";
static final String stringSmallU = "\u0f21\u0f22\u0f23";
public static void main(String args[]){
String a = "ABC";
Test t = new Test();
for (int i = 0; i < 100_000; i++){
t.concatStringConstU(a);
}
}
}
Disable StrInflatedCopy match rule support for x86 with following trivial change and build a slowdebug jdk on x86_64 Linux:
diff --git a/src/hotspot/cpu/x86/x86.ad b/src/hotspot/cpu/x86/x86.ad
index 7cf669f0e27..84d3e38125b 100644
--- a/src/hotspot/cpu/x86/x86.ad
+++ b/src/hotspot/cpu/x86/x86.ad
@@ -1461,6 +1461,8 @@ const bool Matcher::match_rule_supported(int opcode) {
return false;
}
break;
+ case Op_StrInflatedCopy:
+ return false;
case Op_OnSpinWait:
if (VM_Version::supports_on_spin_wait() == false) {
return false;
$ ~/github/jdk-upstream/build/linux-x86_64-server-slowdebug/jdk/bin/java -XX:-BackgroundCompilation -XX:CICompilerCount=2 Test
1. First JVM crash log
1 #
2 # A fatal error has been detected by the Java Runtime Environment:
3 #
4 # Internal Error (/home/yangfei/github/jdk-upstream/src/hotspot/share/opto/graphKit.cpp:4215), pid=21009, tid=21104
5 # assert(Matcher::match_rule_supported(Op_StrInflatedCopy)) failed: Intrinsic not supported
6 #
7 # JRE version: OpenJDK Runtime Environment (17.0) (slowdebug build 17-internal+0-adhoc.yangfei.jdk-upstream)
8 # Java VM: OpenJDK 64-Bit Server VM (slowdebug 17-internal+0-adhoc.yangfei.jdk-upstream, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
9 # Problematic frame:
10 # V [libjvm.so+0xa6c41c] GraphKit::inflate_string(Node*, Node*, TypeAryPtr const*, Node*)+0x3a
11 #
12 # Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport %p %s %c %d %P %E" (or dumping to /h ome/yangfei/c2/core.21009)
13 #
14 # If you would like to submit a bug report, please visit:
15 # https://bugreport.java.com/bugreport/crash.jsp
16 #
17
18 --------------- S U M M A R Y ------------
19
20 Command Line: -XX:-BackgroundCompilation -XX:CICompilerCount=2 Test
21
22 Host: ubuntu18, Intel(R) Xeon(R) CPU E5-2690 v3 @ 2.60GHz, 48 cores, 377G, Ubuntu 18.04.2 LTS
23 Time: Wed Mar 24 09:57:06 2021 CST elapsed time: 6.732316 seconds (0d 0h 0m 6s)
24
25 --------------- T H R E A D ---------------
26
27 Current thread (0x00007f7e1045efa0): JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=21104, stack(0x00007f7da9160000,0x00007f7d a9261000)]
28
29
30 Current CompileTask:
31 C2: 6732 417 b 4 java.lang.AbstractStringBuilder::append (45 bytes)
32
33 Stack: [0x00007f7da9160000,0x00007f7da9261000], sp=0x00007f7da925bc60, free space=1007k
34 Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
35 V [libjvm.so+0xa6c41c] GraphKit::inflate_string(Node*, Node*, TypeAryPtr const*, Node*)+0x3a
36 V [libjvm.so+0xdb1000] LibraryCallKit::inline_string_copy(bool)+0x552
37 V [libjvm.so+0xdac345] LibraryCallKit::try_to_inline(int)+0x4c3
38 V [libjvm.so+0xdab236] LibraryIntrinsic::generate(JVMState*)+0x188
39 V [libjvm.so+0x9026d8] Parse::do_call()+0xb80
40 V [libjvm.so+0x10070c3] Parse::do_one_bytecode()+0x45e1
41 V [libjvm.so+0xff5068] Parse::do_one_block()+0x4dc
42 V [libjvm.so+0xff146f] Parse::do_all_blocks()+0x3bd
43 V [libjvm.so+0xff0fb3] Parse::Parse(JVMState*, ciMethod*, float)+0x100b
44 V [libjvm.so+0x6c75d4] ParseGenerator::generate(JVMState*)+0x106
......
Proposed patch fixed the first crash by this change:
diff --git a/src/hotspot/share/opto/c2compiler.cpp b/src/hotspot/share/opto/c2compiler.cpp
index 89b0270ab72..f2b9e3ecd6d 100644
--- a/src/hotspot/share/opto/c2compiler.cpp
+++ b/src/hotspot/share/opto/c2compiler.cpp
@@ -179,11 +179,11 @@ bool C2Compiler::is_intrinsic_supported(const methodHandle& method, bool is_virt
switch (id) {
case vmIntrinsics::_compressStringC:
case vmIntrinsics::_compressStringB:
- if (!Matcher::has_match_rule(Op_StrCompressedCopy)) return false;
+ if (!Matcher::match_rule_supported(Op_StrCompressedCopy)) return false;
break;
case vmIntrinsics::_inflateStringC:
case vmIntrinsics::_inflateStringB:
- if (!Matcher::has_match_rule(Op_StrInflatedCopy)) return false;
+ if (!Matcher::match_rule_supported(Op_StrInflatedCopy)) return false;
break;
case vmIntrinsics::_compareToL:
case vmIntrinsics::_compareToU:
2. Second jvm crash log
1 #
2 # A fatal error has been detected by the Java Runtime Environment:
3 #
4 # Internal Error (/home/yangfei/github/jdk-upstream/src/hotspot/share/opto/loopnode.cpp:3790), pid=16853, tid=16868
5 # assert(_ltree_root->_child == __null || C->has_loops() || only_has_infinite_loops() || C->has_exception_backedge()) failed: parsing found no loops but there are some
6 #
7 # JRE version: OpenJDK Runtime Environment (17.0) (slowdebug build 17-internal+0-adhoc.yangfei.jdk-upstream)
8 # Java VM: OpenJDK 64-Bit Server VM (slowdebug 17-internal+0-adhoc.yangfei.jdk-upstream, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
9 # Problematic frame:
10 # V [libjvm.so+0xe14d0e] PhaseIdealLoop::build_and_optimize(LoopOptsMode)+0x334
11 #
12 # Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport %p %s %c %d %P %E" (or dumping to /h ome/yangfei/c2/core.16853)
13 #
14 # If you would like to submit a bug report, please visit:
15 # https://bugreport.java.com/bugreport/crash.jsp
16 #
17
18 --------------- S U M M A R Y ------------
19
20 Command Line: -XX:-BackgroundCompilation -XX:CICompilerCount=2 Test
21
22 Host: ubuntu18, Intel(R) Xeon(R) CPU E5-2690 v3 @ 2.60GHz, 48 cores, 377G, Ubuntu 18.04.2 LTS
23 Time: Wed Mar 24 10:02:49 2021 CST elapsed time: 4.423882 seconds (0d 0h 0m 4s)
24
25 --------------- T H R E A D ---------------
26
27 Current thread (0x00007f39f445efa0): JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=16868, stack(0x00007f398ab5d000,0x00007f39 8ac5e000)]
28
29
30 Current CompileTask:
31 C2: 4423 421 b 4 Test::concatStringConstU (25 bytes)
32
33 Stack: [0x00007f398ab5d000,0x00007f398ac5e000], sp=0x00007f398ac58120, free space=1004k
34 Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
35 V [libjvm.so+0xe14d0e] PhaseIdealLoop::build_and_optimize(LoopOptsMode)+0x334
36 V [libjvm.so+0x7e9c96] PhaseIdealLoop::PhaseIdealLoop(PhaseIterGVN&, LoopOptsMode)+0x10e
37 V [libjvm.so+0x7e9eae] PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x46
38 V [libjvm.so+0x7dcd79] Compile::optimize_loops(PhaseIterGVN&, LoopOptsMode)+0xf7
39 V [libjvm.so+0x7ddc8c] Compile::Optimize()+0xd6e
40 V [libjvm.so+0x7d6bd6] Compile::Compile(ciEnv*, ciMethod*, int, bool, bool, bool, bool, DirectiveSet*)+0x13e4
41 V [libjvm.so+0x6c563e] C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x128
42 V [libjvm.so+0x7f3ac3] CompileBroker::invoke_compiler_on_method(CompileTask*)+0x889
43 V [libjvm.so+0x7f26e7] CompileBroker::compiler_thread_loop()+0x3dd
44 V [libjvm.so+0x815377] CompilerThread::thread_entry(JavaThread*, Thread*)+0x69
45 V [libjvm.so+0x1273a9b] JavaThread::thread_main_inner()+0x14f
46 V [libjvm.so+0x1273944] JavaThread::run()+0x11e
47 V [libjvm.so+0x1270f72] Thread::call_run()+0x180
48 V [libjvm.so+0xfbda2e] thread_native_entry(Thread*)+0x1e4
Proposed patch fixed the second crash by this change:
diff --git a/src/hotspot/share/opto/graphKit.cpp b/src/hotspot/share/opto/graphKit.cpp
index 69e3c4fa9dd..22078bdbff4 100644
--- a/src/hotspot/share/opto/graphKit.cpp
+++ b/src/hotspot/share/opto/graphKit.cpp
@@ -4228,6 +4228,8 @@ void GraphKit::inflate_string_slow(Node* src, Node* dst, Node* start, Node* coun
* }
*/
add_empty_predicates();
+ C->set_has_loops(true);
+
RegionNode* head = new RegionNode(3);
head->init_req(1, control());
gvn().set_type(head, Type::CONTROL);
class Test {
public static String concatStringConstU(String a) {
return new StringBuilder().append(stringSmallU).append(a).append(stringU).toString();
}
static final String stringU = "\u0f21\u0f22\u0f23\u0f24\u0f25\u0f26\u0f27\u0f28";
static final String stringSmallU = "\u0f21\u0f22\u0f23";
public static void main(String args[]){
String a = "ABC";
Test t = new Test();
for (int i = 0; i < 100_000; i++){
t.concatStringConstU(a);
}
}
}
Disable StrInflatedCopy match rule support for x86 with following trivial change and build a slowdebug jdk on x86_64 Linux:
diff --git a/src/hotspot/cpu/x86/x86.ad b/src/hotspot/cpu/x86/x86.ad
index 7cf669f0e27..84d3e38125b 100644
--- a/src/hotspot/cpu/x86/x86.ad
+++ b/src/hotspot/cpu/x86/x86.ad
@@ -1461,6 +1461,8 @@ const bool Matcher::match_rule_supported(int opcode) {
return false;
}
break;
+ case Op_StrInflatedCopy:
+ return false;
case Op_OnSpinWait:
if (VM_Version::supports_on_spin_wait() == false) {
return false;
$ ~/github/jdk-upstream/build/linux-x86_64-server-slowdebug/jdk/bin/java -XX:-BackgroundCompilation -XX:CICompilerCount=2 Test
1. First JVM crash log
1 #
2 # A fatal error has been detected by the Java Runtime Environment:
3 #
4 # Internal Error (/home/yangfei/github/jdk-upstream/src/hotspot/share/opto/graphKit.cpp:4215), pid=21009, tid=21104
5 # assert(Matcher::match_rule_supported(Op_StrInflatedCopy)) failed: Intrinsic not supported
6 #
7 # JRE version: OpenJDK Runtime Environment (17.0) (slowdebug build 17-internal+0-adhoc.yangfei.jdk-upstream)
8 # Java VM: OpenJDK 64-Bit Server VM (slowdebug 17-internal+0-adhoc.yangfei.jdk-upstream, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
9 # Problematic frame:
10 # V [libjvm.so+0xa6c41c] GraphKit::inflate_string(Node*, Node*, TypeAryPtr const*, Node*)+0x3a
11 #
12 # Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport %p %s %c %d %P %E" (or dumping to /h ome/yangfei/c2/core.21009)
13 #
14 # If you would like to submit a bug report, please visit:
15 # https://bugreport.java.com/bugreport/crash.jsp
16 #
17
18 --------------- S U M M A R Y ------------
19
20 Command Line: -XX:-BackgroundCompilation -XX:CICompilerCount=2 Test
21
22 Host: ubuntu18, Intel(R) Xeon(R) CPU E5-2690 v3 @ 2.60GHz, 48 cores, 377G, Ubuntu 18.04.2 LTS
23 Time: Wed Mar 24 09:57:06 2021 CST elapsed time: 6.732316 seconds (0d 0h 0m 6s)
24
25 --------------- T H R E A D ---------------
26
27 Current thread (0x00007f7e1045efa0): JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=21104, stack(0x00007f7da9160000,0x00007f7d a9261000)]
28
29
30 Current CompileTask:
31 C2: 6732 417 b 4 java.lang.AbstractStringBuilder::append (45 bytes)
32
33 Stack: [0x00007f7da9160000,0x00007f7da9261000], sp=0x00007f7da925bc60, free space=1007k
34 Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
35 V [libjvm.so+0xa6c41c] GraphKit::inflate_string(Node*, Node*, TypeAryPtr const*, Node*)+0x3a
36 V [libjvm.so+0xdb1000] LibraryCallKit::inline_string_copy(bool)+0x552
37 V [libjvm.so+0xdac345] LibraryCallKit::try_to_inline(int)+0x4c3
38 V [libjvm.so+0xdab236] LibraryIntrinsic::generate(JVMState*)+0x188
39 V [libjvm.so+0x9026d8] Parse::do_call()+0xb80
40 V [libjvm.so+0x10070c3] Parse::do_one_bytecode()+0x45e1
41 V [libjvm.so+0xff5068] Parse::do_one_block()+0x4dc
42 V [libjvm.so+0xff146f] Parse::do_all_blocks()+0x3bd
43 V [libjvm.so+0xff0fb3] Parse::Parse(JVMState*, ciMethod*, float)+0x100b
44 V [libjvm.so+0x6c75d4] ParseGenerator::generate(JVMState*)+0x106
......
Proposed patch fixed the first crash by this change:
diff --git a/src/hotspot/share/opto/c2compiler.cpp b/src/hotspot/share/opto/c2compiler.cpp
index 89b0270ab72..f2b9e3ecd6d 100644
--- a/src/hotspot/share/opto/c2compiler.cpp
+++ b/src/hotspot/share/opto/c2compiler.cpp
@@ -179,11 +179,11 @@ bool C2Compiler::is_intrinsic_supported(const methodHandle& method, bool is_virt
switch (id) {
case vmIntrinsics::_compressStringC:
case vmIntrinsics::_compressStringB:
- if (!Matcher::has_match_rule(Op_StrCompressedCopy)) return false;
+ if (!Matcher::match_rule_supported(Op_StrCompressedCopy)) return false;
break;
case vmIntrinsics::_inflateStringC:
case vmIntrinsics::_inflateStringB:
- if (!Matcher::has_match_rule(Op_StrInflatedCopy)) return false;
+ if (!Matcher::match_rule_supported(Op_StrInflatedCopy)) return false;
break;
case vmIntrinsics::_compareToL:
case vmIntrinsics::_compareToU:
2. Second jvm crash log
1 #
2 # A fatal error has been detected by the Java Runtime Environment:
3 #
4 # Internal Error (/home/yangfei/github/jdk-upstream/src/hotspot/share/opto/loopnode.cpp:3790), pid=16853, tid=16868
5 # assert(_ltree_root->_child == __null || C->has_loops() || only_has_infinite_loops() || C->has_exception_backedge()) failed: parsing found no loops but there are some
6 #
7 # JRE version: OpenJDK Runtime Environment (17.0) (slowdebug build 17-internal+0-adhoc.yangfei.jdk-upstream)
8 # Java VM: OpenJDK 64-Bit Server VM (slowdebug 17-internal+0-adhoc.yangfei.jdk-upstream, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
9 # Problematic frame:
10 # V [libjvm.so+0xe14d0e] PhaseIdealLoop::build_and_optimize(LoopOptsMode)+0x334
11 #
12 # Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport %p %s %c %d %P %E" (or dumping to /h ome/yangfei/c2/core.16853)
13 #
14 # If you would like to submit a bug report, please visit:
15 # https://bugreport.java.com/bugreport/crash.jsp
16 #
17
18 --------------- S U M M A R Y ------------
19
20 Command Line: -XX:-BackgroundCompilation -XX:CICompilerCount=2 Test
21
22 Host: ubuntu18, Intel(R) Xeon(R) CPU E5-2690 v3 @ 2.60GHz, 48 cores, 377G, Ubuntu 18.04.2 LTS
23 Time: Wed Mar 24 10:02:49 2021 CST elapsed time: 4.423882 seconds (0d 0h 0m 4s)
24
25 --------------- T H R E A D ---------------
26
27 Current thread (0x00007f39f445efa0): JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=16868, stack(0x00007f398ab5d000,0x00007f39 8ac5e000)]
28
29
30 Current CompileTask:
31 C2: 4423 421 b 4 Test::concatStringConstU (25 bytes)
32
33 Stack: [0x00007f398ab5d000,0x00007f398ac5e000], sp=0x00007f398ac58120, free space=1004k
34 Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
35 V [libjvm.so+0xe14d0e] PhaseIdealLoop::build_and_optimize(LoopOptsMode)+0x334
36 V [libjvm.so+0x7e9c96] PhaseIdealLoop::PhaseIdealLoop(PhaseIterGVN&, LoopOptsMode)+0x10e
37 V [libjvm.so+0x7e9eae] PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x46
38 V [libjvm.so+0x7dcd79] Compile::optimize_loops(PhaseIterGVN&, LoopOptsMode)+0xf7
39 V [libjvm.so+0x7ddc8c] Compile::Optimize()+0xd6e
40 V [libjvm.so+0x7d6bd6] Compile::Compile(ciEnv*, ciMethod*, int, bool, bool, bool, bool, DirectiveSet*)+0x13e4
41 V [libjvm.so+0x6c563e] C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x128
42 V [libjvm.so+0x7f3ac3] CompileBroker::invoke_compiler_on_method(CompileTask*)+0x889
43 V [libjvm.so+0x7f26e7] CompileBroker::compiler_thread_loop()+0x3dd
44 V [libjvm.so+0x815377] CompilerThread::thread_entry(JavaThread*, Thread*)+0x69
45 V [libjvm.so+0x1273a9b] JavaThread::thread_main_inner()+0x14f
46 V [libjvm.so+0x1273944] JavaThread::run()+0x11e
47 V [libjvm.so+0x1270f72] Thread::call_run()+0x180
48 V [libjvm.so+0xfbda2e] thread_native_entry(Thread*)+0x1e4
Proposed patch fixed the second crash by this change:
diff --git a/src/hotspot/share/opto/graphKit.cpp b/src/hotspot/share/opto/graphKit.cpp
index 69e3c4fa9dd..22078bdbff4 100644
--- a/src/hotspot/share/opto/graphKit.cpp
+++ b/src/hotspot/share/opto/graphKit.cpp
@@ -4228,6 +4228,8 @@ void GraphKit::inflate_string_slow(Node* src, Node* dst, Node* start, Node* coun
* }
*/
add_empty_predicates();
+ C->set_has_loops(true);
+
RegionNode* head = new RegionNode(3);
head->init_req(1, control());
gvn().set_type(head, Type::CONTROL);
- backported by
-
JDK-8264477 slowdebug jvm crashes when StrInflatedCopy match rule is not supported
-
- Resolved
-
-
JDK-8265502 slowdebug jvm crashes when StrInflatedCopy match rule is not supported
-
- Resolved
-