File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -615,6 +615,27 @@ public List<String> getBuilderJavaArgs() {
615615 builderJavaArgs .add ("-XX:+UseJVMCINativeLibrary" );
616616 } else if (getHostFlags ().hasUseJVMCICompiler ()) {
617617 builderJavaArgs .add ("-XX:-UseJVMCICompiler" );
618+
619+ if (JavaVersionUtil .JAVA_SPEC == 21 ) {
620+ Runtime .Version version = Runtime .version ();
621+ if (version .interim () == 0 && version .update () < 4 ) {
622+ /*
623+ * Native Image regularly crashes due to JDK-8328702. In JDK 21, the fix
624+ * only landed in 20.0.4 so in earlier JDK 21 versions, disable C2. This
625+ * workaround can be removed when GR-55515, GR-60648 or GR-60669 is
626+ * resolved.
627+ */
628+ builderJavaArgs .add ("-XX:TieredStopAtLevel=1" );
629+
630+ /*
631+ * From the java man page section on ReservedCodeCacheSize: "the default
632+ * maximum code cache size is 240 MB; if you disable tiered compilation ...
633+ * then the default size is 48 MB". Experience shows that Native Image needs
634+ * the larger code cache, even when C2 is disabled.
635+ */
636+ builderJavaArgs .add ("-XX:ReservedCodeCacheSize=240M" );
637+ }
638+ }
618639 }
619640
620641 return builderJavaArgs ;
You can’t perform that action at this time.
0 commit comments