Skip to content
12 changes: 1 addition & 11 deletions common.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,7 @@
"labsjdk-ce-19-llvm": {"name": "labsjdk", "version": "ce-19+27-jvmci-22.3-b01-sulong", "platformspecific": true },
"labsjdk-ee-19": {"name": "labsjdk", "version": "ee-19.0.1+0-jvmci-22.3-b01", "platformspecific": true },
"labsjdk-ee-19Debug": {"name": "labsjdk", "version": "ee-19.0.1+0-jvmci-22.3-b01-debug", "platformspecific": true },
"labsjdk-ee-19-llvm": {"name": "labsjdk", "version": "ee-19.0.1+0-jvmci-22.3-b01-sulong", "platformspecific": true },

"jdk-19-ea": {
"build_id": "jdk-19+28",
"name": "jpg-jdk",
"version": "19",
"extrabundles": [
"static_libs"
],
"platformspecific": true
}
"labsjdk-ee-19-llvm": {"name": "labsjdk", "version": "ee-19.0.1+0-jvmci-22.3-b01-sulong", "platformspecific": true }
},

"COMMENT.devkits" : "The devkits versions reflect those used to build the JVMCI JDKs (e.g., see devkit_platform_revisions in <jdk>/make/conf/jib-profiles.js)",
Expand Down
74 changes: 42 additions & 32 deletions common.jsonnet
Original file line number Diff line number Diff line change
@@ -1,12 +1,41 @@
{
local composable = (import "common-utils.libsonnet").composable,
local composable = (import "common-utils.libsonnet").composable;

local mx_version = (import "graal-common.json").mx_version;
local common_json = composable(import "common.json");
local repo_config = import 'repo-configuration.libsonnet';
local jdks = common_json.jdks;
local deps = common_json.deps;
local downloads = common_json.downloads;

# Finds the first integer in a string and returns it as an integer.
local find_first_integer(versionString) =
local charToInt(c) =
std.codepoint(c) - std.codepoint("0");
local firstNum(s, i) =
assert std.length(s) > i : "No number found in string " + s;
local n = charToInt(s[i]);
if n >=0 && n < 10 then i else firstNum(s, i + 1);
local lastNum(s, i) =
if i >= std.length(s) then
i
else
local n = charToInt(s[i]);
if n < 0 || n > 9 then i else lastNum(s, i + 1);
local versionIndexStart = firstNum(versionString, 0);
local versionIndexEnd = lastNum(versionString, versionIndexStart);
std.parseInt(versionString[versionIndexStart:versionIndexEnd])
;
# jdk_version is an hidden field that can be used to generate job names
local add_jdk_version(name) =
local jdk = jdks[name];
// this assumes that the version is the first number in the jdk.version string
local version = find_first_integer(jdk.version);
// santity check that the parsed version is also included in the name
assert std.length(std.findSubstr(std.toString(version), name)) == 1 : "Cannot find version %d in name %s" % [version, name];
{ jdk_version:: version}
;

local mx_version = (import "graal-common.json").mx_version,
local common_json = composable(import "common.json"),
local repo_config = import 'repo-configuration.libsonnet',
local jdks = common_json.jdks,
local deps = common_json.deps,
local downloads = common_json.downloads,
{

mx:: {
packages+: {
Expand Down Expand Up @@ -74,36 +103,17 @@
}
},

} + {
// JDK definitions
// ***************
# jdk_version is an hidden field that can be used to generate job names
local jdk11 = { jdk_version:: 11},
local jdk17 = { jdk_version:: 17},
local jdk19 = { jdk_version:: 19},

oraclejdk11:: jdk11 + { downloads+: { JAVA_HOME : jdks.oraclejdk11 }},
oraclejdk17:: jdk17 + { downloads+: { JAVA_HOME : jdks.oraclejdk17 }},
openjdk11:: jdk11 + { downloads+: { JAVA_HOME : jdks.openjdk11 }},

"labsjdk-ce-11":: jdk11 + { downloads+: { JAVA_HOME : jdks["labsjdk-ce-11"] }},
"labsjdk-ee-11":: jdk11 + { downloads+: { JAVA_HOME : jdks["labsjdk-ee-11"] }},
"labsjdk-ce-17":: jdk17 + { downloads+: { JAVA_HOME : jdks["labsjdk-ce-17"] }},
"labsjdk-ee-17":: jdk17 + { downloads+: { JAVA_HOME : jdks["labsjdk-ee-17"] }},
"labsjdk-ce-17Debug":: jdk17 + { downloads+: { JAVA_HOME : jdks["labsjdk-ce-17Debug"] }},
"labsjdk-ee-17Debug":: jdk17 + { downloads+: { JAVA_HOME : jdks["labsjdk-ee-17Debug"] }},
"labsjdk-ce-11-llvm":: jdk11 + { downloads+: { LLVM_JAVA_HOME : jdks["labsjdk-ce-11-llvm"] }},
"labsjdk-ee-11-llvm":: jdk11 + { downloads+: { LLVM_JAVA_HOME : jdks["labsjdk-ee-11-llvm"] }},
"labsjdk-ce-17-llvm":: jdk17 + { downloads+: { LLVM_JAVA_HOME : jdks["labsjdk-ce-17-llvm"] }},
"labsjdk-ee-17-llvm":: jdk17 + { downloads+: { LLVM_JAVA_HOME : jdks["labsjdk-ee-17-llvm"] }},

"labsjdk-ce-19":: jdk19 + { downloads+: { JAVA_HOME : jdks["jdk-19-ea"] + { open: false} }},
"labsjdk-ee-19":: jdk19 + { downloads+: { JAVA_HOME : jdks["jdk-19-ea"] + { open: false} }},

// this adds all jdks from common.json
[name]: add_jdk_version(name) + { downloads+: { [if std.endsWith(name, "llvm") then "LLVM_JAVA_HOME" else "JAVA_HOME"] : jdks[name] }},
for name in std.objectFieldsAll(jdks)
} + {
# Aliases to edition specific labsjdks
labsjdk11:: self["labsjdk-" + repo_config.graalvm_edition + "-11"],
labsjdk17:: self["labsjdk-" + repo_config.graalvm_edition + "-17"],
labsjdk19:: self["labsjdk-" + repo_config.graalvm_edition + "-19"],
labsjdk11Debug:: self["labsjdk-" + repo_config.graalvm_edition + "-11Debug"],
labsjdk17Debug:: self["labsjdk-" + repo_config.graalvm_edition + "-17Debug"],
labsjdk11LLVM:: self["labsjdk-" + repo_config.graalvm_edition + "-11-llvm"],
labsjdk17LLVM:: self["labsjdk-" + repo_config.graalvm_edition + "-17-llvm"],
Expand Down
9 changes: 1 addition & 8 deletions substratevm/ci.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,7 @@
linux_amd64_jdk11 + gate("build-ce", "build,checkstubs,helloworld,test,nativeimagehelp,muslcbuild,debuginfotest") + maven + svm_unittest + t("35:00") + musl_toolchain + gdb("10.2"),
linux_amd64_jdk11 + gate("modules-basic", "build,hellomodule,test") + maven + svm_unittest + t("30:00"),
linux_amd64_jdk17 + gate("style-fullbuild", "style,fullbuild,helloworld,test,svmjunit,debuginfotest") + common.eclipse + common.jdt + maven + jsonschema + svm_unittest + t("50:00") + mx_build_exploded + gdb("10.2"),
linux_amd64_jdk19 + gate("build-ce", "build") + {
run: [
# cannot yet use mx gate --tag build due to compile errors in /compiler
["mx", "build"],
# cannot yet use mx gate --tag hello world due to missing JFR support in JDK 19
["mx", "helloworld"],
]
} + maven + svm_unittest + t("35:00"),
linux_amd64_jdk19 + gate("build-ce", "build,helloworld") + maven + svm_unittest + t("35:00"),
windows_jdk17 + gate("basics", "build,helloworld,test,svmjunit") + svm_unittest + t("1:30:00"),
windows_jdk17 + gate("basics-quickbuild", "build,helloworld_quickbuild,test_quickbuild,svmjunit_quickbuild") + svm_unittest + t("1:30:00"),
],
Expand Down
4 changes: 3 additions & 1 deletion substratevm/mx.substratevm/mx_substratevm.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,9 @@ def image_demo_task(extra_image_args=None, flightrecorder=True):
javac_command = ['--javac-command', ' '.join(javac_image_command(svmbuild_dir()))]
helloworld(image_args + javac_command)
helloworld(image_args + ['--shared']) # Build and run helloworld as shared library
if not mx.is_windows() and flightrecorder:
# JFR is currently not supported on JDK 19 [GR-39564] [GR-39642]
is_jdk_version_supported = mx.get_jdk().version < mx.VersionSpec("19")
if is_jdk_version_supported and not mx.is_windows() and flightrecorder:
helloworld(image_args + ['-J-XX:StartFlightRecording=dumponexit=true']) # Build and run helloworld with FlightRecorder at image build time
cinterfacetutorial(extra_image_args)
clinittest([])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.Collections;
import java.util.List;

import org.graalvm.compiler.serviceprovider.JavaVersionUtil;
import org.graalvm.nativeimage.ImageSingletons;
import org.graalvm.nativeimage.Platform;
import org.graalvm.nativeimage.hosted.Feature;
Expand Down Expand Up @@ -106,6 +107,11 @@ public boolean isInConfiguration(IsInConfigurationAccess access) {
}

public static boolean isInConfiguration(boolean allowPrinting) {
boolean javaVersionSupported = JavaVersionUtil.JAVA_SPEC < 19;
if (HOSTED_ENABLED && !javaVersionSupported) {
// [GR-39564] [GR-39642]
throw UserError.abort("FlightRecorder is currently not supported in JDK 19.");
}
boolean systemSupported = osSupported();
if (HOSTED_ENABLED && !systemSupported) {
throw UserError.abort("FlightRecorder cannot be used to profile the image generator on this platform. " +
Expand All @@ -119,7 +125,7 @@ public static boolean isInConfiguration(boolean allowPrinting) {
}
runtimeEnabled = true;
}
return runtimeEnabled && systemSupported;
return javaVersionSupported && runtimeEnabled && systemSupported;
}

private static boolean osSupported() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,12 @@ static Map<Thread, StackTraceElement[]> getAllStackTraces() {
return vmOp.result;
}

static Thread[] getAllThreads() {
GetAllThreadsOperation vmOp = new GetAllThreadsOperation();
vmOp.enqueue();
return vmOp.result.toArray(new Thread[0]);
}

@NeverInline("Starting a stack walk in the caller frame")
private static StackTraceElement[] getStackTrace(IsolateThread thread) {
if (thread == CurrentIsolate.getCurrentThread()) {
Expand Down Expand Up @@ -943,6 +949,22 @@ protected void operate() {
}
}

private static class GetAllThreadsOperation extends JavaVMOperation {
private final ArrayList<Thread> result;

GetAllThreadsOperation() {
super(VMOperationInfos.get(GetAllThreadsOperation.class, "Get all threads", SystemEffect.SAFEPOINT));
result = new ArrayList<>();
}

@Override
protected void operate() {
for (IsolateThread cur = VMThreads.firstThread(); cur.isNonNull(); cur = VMThreads.nextThread(cur)) {
result.add(PlatformThreads.fromVMThread(cur));
}
}
}

/**
* Builds a list of all application threads. This must be done in a VM operation because only
* there we are allowed to allocate Java memory while holding the {@link VMThreads#THREAD_MUTEX}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ static Thread currentVThread() {

@SuppressWarnings("static-method")
@Substitute
@TargetElement(onlyWith = LoomJDK.class)
@TargetElement(onlyWith = JDK19OrLater.class)
void setCurrentThread(Thread thread) {
PlatformThreads.setCurrentThread(JavaThreads.fromTarget(this), thread);
}
Expand Down Expand Up @@ -336,7 +336,14 @@ private Target_java_lang_Thread(
// TODO: derive from characteristics bitset
boolean inheritThreadLocals = false;
/* Initialize the rest of the Thread object, ignoring `characteristics`. */
JavaThreads.initializeNewThread(this, g, target, name, stackSize, acc, inheritThreadLocals);
String nameLocal = (name != null) ? name : genThreadName();
JavaThreads.initializeNewThread(this, g, target, nameLocal, stackSize, acc, inheritThreadLocals);
}

@Substitute
@TargetElement(onlyWith = JDK19OrLater.class)
static String genThreadName() {
return "Thread-" + JavaThreads.threadInitNumber.incrementAndGet();
}

/**
Expand Down Expand Up @@ -558,6 +565,12 @@ private static Map<Thread, StackTraceElement[]> getAllStackTraces() {
return PlatformThreads.getAllStackTraces();
}

@Substitute
@TargetElement(onlyWith = JDK19OrLater.class)
private static Thread[] getAllThreads() {
return PlatformThreads.getAllThreads();
}

/**
* In the JDK, this is a no-op except on Windows. The JDK resets the interrupt event used by
* Process.waitFor ResetEvent((HANDLE) JVM_GetThreadInterruptEvent()); Our implementation in
Expand Down
10 changes: 8 additions & 2 deletions vm/ci_includes/vm.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ local jdks = common_json.jdks;

vm_java_19:: graal_common.labsjdk19 + {
environment+: {
BASE_JDK_NAME: jdks['jdk-19-ea'].name,
BASE_JDK_VERSION: jdks['jdk-19-ea'].version,
BASE_JDK_NAME: jdks['labsjdk-ce-19'].name,
BASE_JDK_VERSION: jdks['labsjdk-ce-19'].version,
BASE_JDK_SHORT_VERSION: '19',
},
},
Expand All @@ -44,6 +44,12 @@ local jdks = common_json.jdks;
},
},

vm_java_19_llvm:: self.vm_java_19 + {
downloads+: {
LLVM_JAVA_HOME: jdks['labsjdk-ce-19-llvm'],
},
},

binaries_repository: 'lafo',
svm_suite:: '/substratevm',
libgraal_env: 'libgraal',
Expand Down