Skip to content

Commit

Permalink
[GR-50430] Update JVMCI to 22+26-jvmci-b01.
Browse files Browse the repository at this point in the history
PullRequest: graal/16266
  • Loading branch information
OracleLabsAutomation authored and zapster committed Dec 5, 2023
2 parents 5dc79e1 + 10f6860 commit 933c660
Show file tree
Hide file tree
Showing 6 changed files with 129 additions and 12 deletions.
14 changes: 7 additions & 7 deletions common.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@
"labsjdk-ee-21Debug": {"name": "labsjdk", "version": "ee-21.0.1+11-jvmci-23.1-b22-debug", "platformspecific": true },
"labsjdk-ee-21-llvm": {"name": "labsjdk", "version": "ee-21.0.1+11-jvmci-23.1-b22-sulong", "platformspecific": true },

"oraclejdk-latest": {"name": "jpg-jdk", "version": "22", "build_id": "25", "release": true, "platformspecific": true, "extrabundles": ["static-libs"]},
"labsjdk-ce-latest": {"name": "labsjdk", "version": "ce-22+25-jvmci-b01", "platformspecific": true },
"labsjdk-ce-latestDebug": {"name": "labsjdk", "version": "ce-22+25-jvmci-b01-debug", "platformspecific": true },
"labsjdk-ce-latest-llvm": {"name": "labsjdk", "version": "ce-22+25-jvmci-b01-sulong", "platformspecific": true },
"labsjdk-ee-latest": {"name": "labsjdk", "version": "ee-22+25-jvmci-b01", "platformspecific": true },
"labsjdk-ee-latestDebug": {"name": "labsjdk", "version": "ee-22+25-jvmci-b01-debug", "platformspecific": true },
"labsjdk-ee-latest-llvm": {"name": "labsjdk", "version": "ee-22+25-jvmci-b01-sulong", "platformspecific": true }
"oraclejdk-latest": {"name": "jpg-jdk", "version": "22", "build_id": "26", "release": true, "platformspecific": true, "extrabundles": ["static-libs"]},
"labsjdk-ce-latest": {"name": "labsjdk", "version": "ce-22+26-jvmci-b01", "platformspecific": true },
"labsjdk-ce-latestDebug": {"name": "labsjdk", "version": "ce-22+26-jvmci-b01-debug", "platformspecific": true },
"labsjdk-ce-latest-llvm": {"name": "labsjdk", "version": "ce-22+26-jvmci-b01-sulong", "platformspecific": true },
"labsjdk-ee-latest": {"name": "labsjdk", "version": "ee-22+26-jvmci-b01", "platformspecific": true },
"labsjdk-ee-latestDebug": {"name": "labsjdk", "version": "ee-22+26-jvmci-b01-debug", "platformspecific": true },
"labsjdk-ee-latest-llvm": {"name": "labsjdk", "version": "ee-22+26-jvmci-b01-sulong", "platformspecific": true }
},

"eclipse": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public final class JVMCIVersionCheck {
private static final Map<String, Map<String, Version>> JVMCI_MIN_VERSIONS = Map.of(
"21", Map.of(DEFAULT_VENDOR_ENTRY, new Version(23, 1, 22)),
"22", Map.of(
"Oracle Corporation", new Version("22+25", 1),
DEFAULT_VENDOR_ENTRY, new Version("22+25", 1)));
"Oracle Corporation", new Version("22+26", 1),
DEFAULT_VENDOR_ENTRY, new Version("22+26", 1)));
private static final int NA = 0;
/**
* Minimum Java release supported by Graal.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@

import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;
import com.oracle.svm.core.annotate.TargetElement;
import com.oracle.svm.core.jdk.JDK21OrEarlier;
import com.oracle.svm.core.jdk.JDK22OrLater;

import jdk.internal.foreign.MemorySessionImpl;

Expand Down Expand Up @@ -65,7 +68,18 @@ static void registerNatives() {
* As one might notice, what is not supported is not creating shared arenas, but closing them.
*/
@Substitute
@TargetElement(onlyWith = JDK22OrLater.class)
void closeScope0(MemorySessionImpl session, Target_jdk_internal_misc_ScopedMemoryAccess_ScopedAccessError error) {
throw unsupportedFeature("Arena.ofShared is not yet supported.");
}

@Substitute
@TargetElement(onlyWith = JDK21OrEarlier.class)
boolean closeScope0(MemorySessionImpl session) {
throw unsupportedFeature("Arena.ofShared is not yet supported.");
}
}

@TargetClass(className = "jdk.internal.misc.ScopedMemoryAccess$ScopedAccessError", onlyWith = JDK22OrLater.class)
final class Target_jdk_internal_misc_ScopedMemoryAccess_ScopedAccessError {
}
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ final class Target_java_util_concurrent_atomic_AtomicLongFieldUpdater_CASUpdater

}

@TargetClass(className = "java.util.concurrent.atomic.AtomicLongFieldUpdater$LockedUpdater")
@TargetClass(className = "java.util.concurrent.atomic.AtomicLongFieldUpdater$LockedUpdater", onlyWith = JDK21OrEarlier.class)
final class Target_java_util_concurrent_atomic_AtomicLongFieldUpdater_LockedUpdater {
@Alias @RecomputeFieldValue(kind = AtomicFieldUpdaterOffset) //
private long offset;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/*
* Copyright (c) 2023, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.oracle.svm.core.jdk.xml;

import java.util.Objects;

import org.graalvm.nativeimage.hosted.FieldValueTransformer;

import com.oracle.svm.core.annotate.Alias;
import com.oracle.svm.core.annotate.RecomputeFieldValue;
import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;
import com.oracle.svm.core.jdk.JDK22OrLater;
import com.oracle.svm.util.ReflectionUtil;

/**
* Substitution to initialize {@link #catalog} at build time.
*
* JDK-8306055 introduced a built-in Catalog to JDK XML module in JDK 22. Without special treatment,
* the initialization code would pull intermediate types (e.g. {@code CatalogReader}) into the image
* heap. To avoid this, we initialize the catalog at build time and substitute the {@link #init}
* method to be empty.
*
* Ideally, we would initialize all of {@code jdk.xml} at run time, but that is too intrusive at the
* current point in time (GR-50683).
*/
@TargetClass(className = "jdk.xml.internal.JdkCatalog", onlyWith = JDK22OrLater.class)
public final class Target_jdk_xml_internal_JdkCatalog {
@Alias //
@RecomputeFieldValue(kind = RecomputeFieldValue.Kind.Custom, declClass = JdkCatalogSupplier.class, isFinal = true) //
public static Target_javax_xml_catalog_Catalog catalog;

@Substitute
@SuppressWarnings("unused")
public static void init(String resolve) {
// initialized at build time
}
}

@TargetClass(className = "javax.xml.catalog.Catalog", onlyWith = JDK22OrLater.class)
final class Target_javax_xml_catalog_Catalog {
}

@TargetClass(className = "javax.xml.catalog.CatalogImpl")
final class Target_javax_xml_catalog_CatalogImpl {
@Alias //
@RecomputeFieldValue(kind = RecomputeFieldValue.Kind.Reset) //
Target_javax_xml_parsers_SAXParser parser;
}

@TargetClass(className = "javax.xml.parsers.SAXParser")
final class Target_javax_xml_parsers_SAXParser {
}

final class JdkCatalogSupplier implements FieldValueTransformer {
@Override
public Object transform(Object receiver, Object originalValue) {
// Ensure the field is initialized.
Class<?> xmlSecurityManager = ReflectionUtil.lookupClass(false, "jdk.xml.internal.XMLSecurityManager");
// The constructor call prepareCatalog which will call JdkCatalog#init.
ReflectionUtil.newInstance(xmlSecurityManager);

Class<?> jdkCatalogClass = ReflectionUtil.lookupClass(false, "jdk.xml.internal.JdkCatalog");
Object catalog = ReflectionUtil.readStaticField(jdkCatalogClass, "catalog");

return Objects.requireNonNull(catalog);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import java.util.List;
import java.util.function.BooleanSupplier;

import jdk.graal.compiler.api.replacements.Fold;
import org.graalvm.nativeimage.Platform;
import org.graalvm.nativeimage.Platforms;
import org.graalvm.nativeimage.ProcessProperties;
Expand All @@ -41,8 +40,10 @@
import com.oracle.svm.core.annotate.TargetElement;
import com.oracle.svm.core.jdk.JDK22OrLater;
import com.oracle.svm.core.jfr.traceid.JfrTraceId;
import com.oracle.svm.core.util.VMError;
import com.oracle.svm.util.ReflectionUtil;

import jdk.graal.compiler.api.replacements.Fold;
import jdk.jfr.internal.JVM;
import jdk.jfr.internal.LogTag;

Expand Down Expand Up @@ -147,14 +148,26 @@ public static String getPid() {
@Substitute
@Uninterruptible(reason = "Needed for SubstrateJVM.getStackTraceId().")
@TargetElement(onlyWith = JDK22OrLater.class)
public static long getStackTraceId(int skipCount) {
public static long getStackTraceId(int skipCount, long stackFilterId) {
/*
* The result is only valid until the epoch changes but this is fine because EventWriter
* instances are invalidated when the epoch changes.
*/
return SubstrateJVM.get().getStackTraceId(skipCount);
}

@Substitute
@TargetElement(onlyWith = JDK22OrLater.class)
public static long registerStackFilter(String[] classes, String[] methods) {
throw VMError.unimplemented("JFR StackFilters are not yet supported.");
}

@Substitute
@TargetElement(onlyWith = JDK22OrLater.class)
public static void unregisterStackFilter(long stackFilterId) {
throw VMError.unimplemented("JFR StackFilters are not yet supported.");
}

/** See {@link JVM#getThreadId}. */
@Substitute
@TargetElement(onlyWith = JDK22OrLater.class)
Expand Down

0 comments on commit 933c660

Please sign in to comment.