Skip to content

Commit 02513e1

Browse files
committed
[JDK-8349064] Adapt JDK-8347564: ZGC: Crash in DependencyContext::clean_unloading_dependents
Add boolean supplier for JDK <= 21.0.8 (cherry picked from commit d9a3a5ab51357aaf4e21c785027a1bf84e2c91ff)
1 parent 2a661d1 commit 02513e1

File tree

2 files changed

+44
-2
lines changed

2 files changed

+44
-2
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright (c) 2025, 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. Oracle designates this
8+
* particular file as subject to the "Classpath" exception as provided
9+
* by Oracle in the LICENSE file that accompanied this code.
10+
*
11+
* This code is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
* version 2 for more details (a copy is included in the LICENSE file that
15+
* accompanied this code).
16+
*
17+
* You should have received a copy of the GNU General Public License version
18+
* 2 along with this work; if not, write to the Free Software Foundation,
19+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+
*
21+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+
* or visit www.oracle.com if you need additional information or have any
23+
* questions.
24+
*/
25+
package com.oracle.svm.core.jdk;
26+
27+
import java.util.function.BooleanSupplier;
28+
29+
import org.graalvm.compiler.serviceprovider.JavaVersionUtil;
30+
31+
public class JDK21u8OrEarlier implements BooleanSupplier {
32+
33+
public static final boolean jdk21u8OrEarlier = JavaVersionUtil.JAVA_SPEC < 21 ||
34+
(JavaVersionUtil.JAVA_SPEC == 21 && Runtime.version().update() <= 8);
35+
36+
@Override
37+
public boolean getAsBoolean() {
38+
return jdk21u8OrEarlier;
39+
}
40+
}

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/methodhandles/Target_java_lang_invoke_MethodHandleNatives.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -53,6 +53,7 @@
5353
import com.oracle.svm.core.hub.DynamicHub;
5454
import com.oracle.svm.core.invoke.Target_java_lang_invoke_MemberName;
5555
import com.oracle.svm.core.jdk.JDK20OrEarlier;
56+
import com.oracle.svm.core.jdk.JDK21u8OrEarlier;
5657
import com.oracle.svm.core.reflect.target.Target_java_lang_reflect_Field;
5758
import com.oracle.svm.core.util.VMError;
5859
import com.oracle.svm.util.ReflectionUtil;
@@ -196,6 +197,7 @@ private static Object getMemberVMInfo(Target_java_lang_invoke_MemberName self) {
196197
private static native void copyOutBootstrapArguments(Class<?> caller, int[] indexInfo, int start, int end, Object[] buf, int pos, boolean resolve, Object ifNotAvailable);
197198

198199
@Substitute
200+
@TargetElement(onlyWith = JDK21u8OrEarlier.class)
199201
private static void clearCallSiteContext(Target_java_lang_invoke_MethodHandleNatives_CallSiteContext context) {
200202
throw unimplemented("CallSiteContext not supported");
201203
}
@@ -395,6 +397,6 @@ final class Target_java_lang_invoke_MethodHandleNatives_Constants {
395397
// Checkstyle: resume
396398
}
397399

398-
@TargetClass(className = "java.lang.invoke.MethodHandleNatives", innerClass = "CallSiteContext")
400+
@TargetClass(className = "java.lang.invoke.MethodHandleNatives", innerClass = "CallSiteContext", onlyWith = JDK21u8OrEarlier.class)
399401
final class Target_java_lang_invoke_MethodHandleNatives_CallSiteContext {
400402
}

0 commit comments

Comments
 (0)