Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions substratevm/mx.substratevm/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,24 @@
"workingSets": "SVM",
},

"com.oracle.svm.core.jdk17": {
"subDir": "src",
"sourceDirs": ["src"],
"dependencies": ["com.oracle.svm.core"],
"requiresConcealed" : {
"java.base" : [
"jdk.internal.loader",
"jdk.internal.misc",
"jdk.internal.platform",
"sun.invoke.util",
],
},
"javaCompliance": "17+",
"checkstyle": "com.oracle.svm.core",
"workingSets": "SVM",
},


"com.oracle.svm.core.genscavenge": {
"subDir": "src",
"sourceDirs": [
Expand Down Expand Up @@ -1055,6 +1073,7 @@
"com.oracle.svm.core.jdk14",
"com.oracle.svm.core.jdk15",
"com.oracle.svm.core.jdk16",
"com.oracle.svm.core.jdk17",
"com.oracle.svm.core.graal.amd64",
"com.oracle.svm.core.graal.aarch64",
"com.oracle.svm.core.posix",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* Copyright (c) 2021, 2021, 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.jdk15;

import org.graalvm.compiler.serviceprovider.JavaVersionUtil;
import org.graalvm.nativeimage.ImageSingletons;
import org.graalvm.nativeimage.hosted.Feature;

import com.oracle.svm.core.annotate.AutomaticFeature;

import com.oracle.svm.core.jdk.HiddenClassSupport;


final class HiddenClassSupportImpl extends HiddenClassSupport {
@Override
public boolean isHidden(Class<?> clazz) {
return clazz.isHidden();
}
}

@AutomaticFeature
final class HiddenClassFeature implements Feature {
@Override
public boolean isInConfiguration(IsInConfigurationAccess access) {
return JavaVersionUtil.JAVA_SPEC >= 15;
}

@Override
public void afterRegistration(AfterRegistrationAccess access) {
ImageSingletons.add(HiddenClassSupport.class, new HiddenClassSupportImpl());
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 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
Expand All @@ -22,18 +22,19 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.oracle.svm.jfr;
package com.oracle.svm.core.jdk17;

import com.oracle.svm.core.annotate.Alias;
import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;
import com.oracle.svm.core.jdk.JDK17OrLater;
import static com.oracle.svm.core.Containers.Options.UseContainerSupport;

@TargetClass(className = "jdk.jfr.internal.dcmd.DCmdStart", onlyWith = JfrEnabled.class)
public final class Target_jdk_jfr_internal_dcmd_DCmdStart {
@Alias
public Target_jdk_jfr_internal_dcmd_DCmdStart() {
}
import jdk.internal.platform.CgroupMetrics;

@Alias
public native String execute(String name, String[] settings, Long delay, Long duration, Boolean disk, String path, Long maxAge, Long maxSize, Boolean dumpOnExit, Boolean pathToGcRoots)
throws Exception;
}
@TargetClass(value = jdk.internal.platform.CgroupMetrics.class, onlyWith = JDK17OrLater.class)
public final class Target_jdk_internal_platform_CgroupMetrics_JDK17OrLater {
@Substitute
public static boolean isUseContainerSupport() {
return UseContainerSupport.getValue();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Copyright (c) 2021, 2021, 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;

import org.graalvm.compiler.api.replacements.Fold;
import org.graalvm.nativeimage.ImageSingletons;

import com.oracle.svm.core.util.VMError;

/**
* Abstracts the information about hidden classes, which are not available in Java 11 and Java 8.
* This class provides all information about hidden classes without exposing any JDK types and
* methods that are not yet present in the old JDKs.
*/
public class HiddenClassSupport {
@Fold
public static HiddenClassSupport singleton() {
return ImageSingletons.lookup(HiddenClassSupport.class);
}

@Fold
public static boolean isAvailable() {
return ImageSingletons.contains(HiddenClassSupport.class);
}

/** Same as {@code Class.isHidden()}. */
public boolean isHidden(Class<?> clazz) {
throw VMError.shouldNotReachHere();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -404,4 +404,8 @@ private void changeEpoch() {
JfrTraceIdEpoch.getInstance().changeEpoch();
}
}

public long getChunkStartNanos() {
return chunkStartNanos;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ public boolean getAsBoolean() {
}

public static boolean get() {
return VMInspection.isEnabled() && JavaVersionUtil.JAVA_SPEC == 11 && (OS.getCurrent() == OS.LINUX || OS.getCurrent() == OS.DARWIN);
return VMInspection.isEnabled() && jvmVersionSupported() && osSupported();
}

private static boolean jvmVersionSupported() {
return JavaVersionUtil.JAVA_SPEC == 11 || JavaVersionUtil.JAVA_SPEC == 16 || JavaVersionUtil.JAVA_SPEC == 17;
}
private static boolean osSupported() {
return OS.getCurrent() == OS.LINUX || OS.getCurrent() == OS.DARWIN;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ public void duringSetup(DuringSetupAccess c) {
public void beforeAnalysis(Feature.BeforeAnalysisAccess access) {
RuntimeSupport runtime = RuntimeSupport.getRuntimeSupport();
JfrManager manager = JfrManager.get();
runtime.addStartupHook(manager::setup);
runtime.addShutdownHook(manager::teardown);
runtime.addStartupHook(manager.startupHook());
runtime.addShutdownHook(manager.shutdownHook());
}

@Override
Expand Down Expand Up @@ -180,7 +180,8 @@ public void duringAnalysis(DuringAnalysisAccess access) {
// Use canonical name for package private AbstractJDKEvent
if (c.getCanonicalName().equals("jdk.jfr.Event")
|| c.getCanonicalName().equals("jdk.internal.event.Event")
|| c.getCanonicalName().equals("jdk.jfr.events.AbstractJDKEvent")) {
|| c.getCanonicalName().equals("jdk.jfr.events.AbstractJDKEvent")
|| c.getCanonicalName().equals("jdk.jfr.events.AbstractBufferStatisticsEvent")) {
continue;
}
try {
Expand Down
Loading