Skip to content

Commit 6970cf6

Browse files
committedApr 1, 2025
8352775: JVM crashes with -XX:AOTMode=create -XX:+UseZGC
Reviewed-by: ccheung, matsaave
1 parent afcad8c commit 6970cf6

File tree

2 files changed

+62
-1
lines changed

2 files changed

+62
-1
lines changed
 

‎src/hotspot/share/oops/constantPool.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ void ConstantPool::restore_unshareable_info(TRAPS) {
455455
}
456456
}
457457

458-
if (CDSConfig::is_dumping_final_static_archive() && resolved_references() != nullptr) {
458+
if (CDSConfig::is_dumping_final_static_archive() && CDSConfig::is_dumping_heap() && resolved_references() != nullptr) {
459459
objArrayOop scratch_references = oopFactory::new_objArray(vmClasses::Object_klass(), resolved_references()->length(), CHECK);
460460
HeapShared::add_scratch_resolved_references(this, scratch_references);
461461
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*
23+
*/
24+
25+
/**
26+
* @test
27+
* @summary -XX:AOTMode=create should be compatible with ZGC
28+
* @bug 8352775
29+
* @requires vm.cds
30+
* @requires vm.gc.Z
31+
* @comment work around JDK-8345635
32+
* @requires !vm.jvmci.enabled
33+
* @library /test/lib
34+
* @build AOTCacheWithZGC
35+
* @run driver jdk.test.lib.helpers.ClassFileInstaller -jar app.jar AOTCacheWithZGCApp
36+
* @run driver AOTCacheWithZGC
37+
*/
38+
39+
import jdk.test.lib.cds.SimpleCDSAppTester;
40+
import jdk.test.lib.process.OutputAnalyzer;
41+
42+
public class AOTCacheWithZGC {
43+
public static void main(String... args) throws Exception {
44+
SimpleCDSAppTester.of("AOTCacheWithZGC")
45+
.addVmArgs("-XX:+UseZGC", "-Xlog:cds")
46+
.classpath("app.jar")
47+
.appCommandLine("AOTCacheWithZGCApp")
48+
.setProductionChecker((OutputAnalyzer out) -> {
49+
// AOT-linked classes required cached Java heap objects, which is not
50+
// yet supported by ZGC.
51+
out.shouldContain("Using AOT-linked classes: false");
52+
})
53+
.runAOTWorkflow();
54+
}
55+
}
56+
57+
class AOTCacheWithZGCApp {
58+
public static void main(String[] args) {
59+
60+
}
61+
}

0 commit comments

Comments
 (0)
Please sign in to comment.