Skip to content

Commit bff2e3d

Browse files
[GR-26395] Periodic update of the graal import.
PullRequest: truffleruby/4037
2 parents 153f9ad + 5aa9488 commit bff2e3d

27 files changed

+357
-359
lines changed

ci/common.jsonnet

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ local common_json = import "../common.json";
2626
local variants(name) = [name, name + "Debug", name + "-llvm"],
2727
# gets the JDK major version from a labsjdk version string (e.g., "ce-21+35-jvmci-23.1-b15" -> 21)
2828
local parse_labsjdk_version(jdk) =
29-
if jdk.name == "jpg-jdk" then jdk.version else
29+
if jdk.name == "jpg-jdk" then std.parseInt(jdk.version) else
3030
local version = jdk.version;
3131
assert std.startsWith(version, "ce-") || std.startsWith(version, "ee-") : "Unsupported labsjdk version: " + version;
3232
local number_prefix(str) =
@@ -107,7 +107,8 @@ local common_json = import "../common.json";
107107
"windows-jdk19": { packages+: { "devkit:VS2022-17.1.0+1": "==0" }},
108108
"windows-jdk20": { packages+: { "devkit:VS2022-17.1.0+1": "==0" }},
109109
"windows-jdk21": { packages+: { "devkit:VS2022-17.1.0+1": "==1" }},
110-
"windows-jdkLatest": { packages+: { "devkit:VS2022-17.1.0+1": "==1" }},
110+
"windows-jdk-latest": { packages+: { "devkit:VS2022-17.1.0+1": "==1" }},
111+
"windows-jdkLatest": self["windows-jdk-latest"],
111112
"linux-jdk17": { packages+: { "devkit:gcc11.2.0-OL6.4+1": "==0" }},
112113
"linux-jdk19": { packages+: { "devkit:gcc11.2.0-OL6.4+1": "==0" }},
113114
"linux-jdk20": { packages+: { "devkit:gcc11.2.0-OL6.4+1": "==0" }},
@@ -149,6 +150,16 @@ local common_json = import "../common.json";
149150
} else {},
150151
},
151152

153+
local code_tools = {
154+
downloads+: if 'jdk_version' in self && self.jdk_version > 21 then {
155+
TOOLS_JAVA_HOME: jdks_data['oraclejdk21'],
156+
} else {},
157+
},
158+
# GR-46676: ProGuard does not yet run on JDK 22
159+
proguard: code_tools,
160+
# GR-49566: SpotBugs does not yet run on JDK 22
161+
spotbugs: code_tools,
162+
152163
sulong:: {
153164
packages+: {
154165
cmake: "==3.22.2",
@@ -259,9 +270,9 @@ local common_json = import "../common.json";
259270

260271
local common = mx + {
261272
catch_files+: [
262-
# Keep in sync with org.graalvm.compiler.debug.StandardPathUtilitiesProvider#DIAGNOSTIC_OUTPUT_DIRECTORY_MESSAGE_REGEXP
273+
# Keep in sync with jdk.graal.compiler.debug.StandardPathUtilitiesProvider#DIAGNOSTIC_OUTPUT_DIRECTORY_MESSAGE_REGEXP
263274
"Graal diagnostic output saved in '(?P<filename>[^']+)'",
264-
# Keep in sync with org.graalvm.compiler.debug.DebugContext#DUMP_FILE_MESSAGE_REGEXP
275+
# Keep in sync with jdk.graal.compiler.debug.DebugContext#DUMP_FILE_MESSAGE_REGEXP
265276
"Dumping debug output to '(?P<filename>[^']+)'",
266277
# Keep in sync with com.oracle.svm.hosted.NativeImageOptions#DEFAULT_ERROR_FILE_NAME
267278
" (?P<filename>.+/svm_err_b_\\d+T\\d+\\.\\d+_pid\\d+\\.md)",

common.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"Jsonnet files should not include this file directly but use ci/common.jsonnet instead."
55
],
66

7-
"mx_version": "6.50.2",
7+
"mx_version": "6.52.0",
88

99
"COMMENT.jdks": "When adding or removing JDKs keep in sync with JDKs in ci/common.jsonnet",
1010
"jdks": {
@@ -35,20 +35,20 @@
3535
"labsjdk-ee-20-llvm": {"name": "labsjdk", "version": "ee-20.0.2+2-jvmci-23.1-b02-sulong", "platformspecific": true },
3636

3737
"oraclejdk21": {"name": "jpg-jdk", "version": "21", "build_id": "33", "release": true, "platformspecific": true, "extrabundles": ["static-libs"]},
38-
"labsjdk-ce-21": {"name": "labsjdk", "version": "ce-21+35-jvmci-23.1-b15", "platformspecific": true },
39-
"labsjdk-ce-21Debug": {"name": "labsjdk", "version": "ce-21+35-jvmci-23.1-b15-debug", "platformspecific": true },
40-
"labsjdk-ce-21-llvm": {"name": "labsjdk", "version": "ce-21+35-jvmci-23.1-b15-sulong", "platformspecific": true },
41-
"labsjdk-ee-21": {"name": "labsjdk", "version": "ee-21+35-jvmci-23.1-b15", "platformspecific": true },
42-
"labsjdk-ee-21Debug": {"name": "labsjdk", "version": "ee-21+35-jvmci-23.1-b15-debug", "platformspecific": true },
43-
"labsjdk-ee-21-llvm": {"name": "labsjdk", "version": "ee-21+35-jvmci-23.1-b15-sulong", "platformspecific": true },
38+
"labsjdk-ce-21": {"name": "labsjdk", "version": "ce-21.0.1+12-jvmci-23.1-b22", "platformspecific": true },
39+
"labsjdk-ce-21Debug": {"name": "labsjdk", "version": "ce-21.0.1+12-jvmci-23.1-b22-debug", "platformspecific": true },
40+
"labsjdk-ce-21-llvm": {"name": "labsjdk", "version": "ce-21.0.1+12-jvmci-23.1-b22-sulong", "platformspecific": true },
41+
"labsjdk-ee-21": {"name": "labsjdk", "version": "ee-21.0.1+11-jvmci-23.1-b22", "platformspecific": true },
42+
"labsjdk-ee-21Debug": {"name": "labsjdk", "version": "ee-21.0.1+11-jvmci-23.1-b22-debug", "platformspecific": true },
43+
"labsjdk-ee-21-llvm": {"name": "labsjdk", "version": "ee-21.0.1+11-jvmci-23.1-b22-sulong", "platformspecific": true },
4444

45-
"oraclejdk-latest": {"name": "jpg-jdk", "version": "22", "build_id": "17", "release": true, "platformspecific": true, "extrabundles": ["static-libs"]},
46-
"labsjdk-ce-latest": {"name": "labsjdk", "version": "ce-22+17-jvmci-b01", "platformspecific": true },
47-
"labsjdk-ce-latestDebug": {"name": "labsjdk", "version": "ce-22+17-jvmci-b01-debug", "platformspecific": true },
48-
"labsjdk-ce-latest-llvm": {"name": "labsjdk", "version": "ce-22+17-jvmci-b01-sulong", "platformspecific": true },
49-
"labsjdk-ee-latest": {"name": "labsjdk", "version": "ee-22+17-jvmci-b01", "platformspecific": true },
50-
"labsjdk-ee-latestDebug": {"name": "labsjdk", "version": "ee-22+17-jvmci-b01-debug", "platformspecific": true },
51-
"labsjdk-ee-latest-llvm": {"name": "labsjdk", "version": "ee-22+17-jvmci-b01-sulong", "platformspecific": true }
45+
"oraclejdk-latest": {"name": "jpg-jdk", "version": "22", "build_id": "18", "release": true, "platformspecific": true, "extrabundles": ["static-libs"]},
46+
"labsjdk-ce-latest": {"name": "labsjdk", "version": "ce-22+18-jvmci-b03", "platformspecific": true },
47+
"labsjdk-ce-latestDebug": {"name": "labsjdk", "version": "ce-22+18-jvmci-b03-debug", "platformspecific": true },
48+
"labsjdk-ce-latest-llvm": {"name": "labsjdk", "version": "ce-22+18-jvmci-b03-sulong", "platformspecific": true },
49+
"labsjdk-ee-latest": {"name": "labsjdk", "version": "ee-22+18-jvmci-b03", "platformspecific": true },
50+
"labsjdk-ee-latestDebug": {"name": "labsjdk", "version": "ee-22+18-jvmci-b03-debug", "platformspecific": true },
51+
"labsjdk-ee-latest-llvm": {"name": "labsjdk", "version": "ee-22+18-jvmci-b03-sulong", "platformspecific": true }
5252
},
5353

5454
"eclipse": {

mx.truffleruby/suite.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
{
2121
"name": "regex",
2222
"subdir": True,
23-
"version": "7f29f8bd69ebeb74f4ba2ce0a7096388bf757dfa",
23+
"version": "12aaa484b6d2dde4c8951f36207e394471ef9d51",
2424
"urls": [
2525
{"url": "https://github.com/oracle/graal.git", "kind": "git"},
2626
{"url": "https://curio.ssw.jku.at/nexus/content/repositories/snapshots", "kind": "binary"},
@@ -29,7 +29,7 @@
2929
{
3030
"name": "sulong",
3131
"subdir": True,
32-
"version": "7f29f8bd69ebeb74f4ba2ce0a7096388bf757dfa",
32+
"version": "12aaa484b6d2dde4c8951f36207e394471ef9d51",
3333
"urls": [
3434
{"url": "https://github.com/oracle/graal.git", "kind": "git"},
3535
{"url": "https://curio.ssw.jku.at/nexus/content/repositories/snapshots", "kind": "binary"},

src/main/java/org/truffleruby/cext/CExtNodes.java

Lines changed: 76 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,14 @@
8080
import org.truffleruby.interop.ToJavaStringNode;
8181
import org.truffleruby.interop.TranslateInteropExceptionNode;
8282
import org.truffleruby.core.string.ImmutableRubyString;
83-
import org.truffleruby.language.LazyWarnNode;
83+
import org.truffleruby.language.LazyWarningNode;
8484
import org.truffleruby.language.LexicalScope;
8585
import org.truffleruby.language.Nil;
8686
import org.truffleruby.language.RubyBaseNode;
8787
import org.truffleruby.language.RubyDynamicObject;
8888
import org.truffleruby.language.RubyGuards;
8989
import org.truffleruby.language.RubyRootNode;
90-
import org.truffleruby.language.WarnNode;
90+
import org.truffleruby.language.WarningNode;
9191
import org.truffleruby.language.arguments.ArgumentsDescriptor;
9292
import org.truffleruby.language.arguments.EmptyArgumentsDescriptor;
9393
import org.truffleruby.language.arguments.KeywordArgumentsDescriptor;
@@ -1046,55 +1046,47 @@ Object rbConstSet(RubyModule module, Object name, Object value,
10461046
@Primitive(name = "rb_gv_get")
10471047
@ReportPolymorphism
10481048
public abstract static class RbGvGetNode extends PrimitiveArrayArgumentsNode {
1049-
1050-
@Specialization(guards = "name == cachedName", limit = "getCacheLimit()")
1051-
static Object rbGvGetCached(VirtualFrame frame, String name,
1052-
@Cached("name") String cachedName,
1053-
@Cached("create(cachedName)") ReadGlobalVariableNode readGlobalVariableNode,
1049+
@Specialization
1050+
Object rbGvGet(VirtualFrame frame, String name,
10541051
@Cached InlinedBranchProfile notExistsProfile,
1055-
@Cached @Shared LazyWarnNode lazyWarnNode,
1056-
@Bind("this") Node node) {
1057-
boolean exists = getContext(node).getCoreLibrary().globalVariables.contains(cachedName);
1052+
@Cached LazyWarningNode lazyWarningNode,
1053+
@Cached RbGvGetInnerNode rbGvGetInnerNode) {
1054+
boolean exists = getContext().getCoreLibrary().globalVariables.contains(name);
10581055

1056+
// Check if it exists and return if not, before creating the GlobalVariableStorage
10591057
if (!exists) {
1060-
notExistsProfile.enter(node);
1061-
warn(node, lazyWarnNode.get(node),
1062-
StringUtils.format("global variable `%s' not initialized", cachedName));
1063-
1058+
notExistsProfile.enter(this);
1059+
WarningNode warningNode = lazyWarningNode.get(this);
1060+
if (warningNode.shouldWarn()) {
1061+
warningNode.warningMessage(getContext(this).getCallStack().getTopMostUserSourceSection(),
1062+
StringUtils.format("global variable `%s' not initialized", name));
1063+
}
10641064
return nil;
10651065
}
10661066

1067-
return readGlobalVariableNode.execute(frame);
1067+
return rbGvGetInnerNode.execute(frame, this, name);
10681068
}
1069+
}
10691070

1070-
@TruffleBoundary
1071-
@Specialization
1072-
Object rbGvGetUncached(String name,
1073-
@Cached DispatchNode dispatchNode,
1074-
@Cached @Shared LazyWarnNode lazyWarnNode) {
1075-
boolean exists = getContext().getCoreLibrary().globalVariables.contains(name);
1076-
1077-
if (!exists) {
1078-
warn(this, lazyWarnNode.get(this), StringUtils.format("global variable `%s' not initialized", name));
10791071

1080-
return nil;
1081-
}
1072+
@GenerateInline
1073+
@GenerateCached(false)
1074+
public abstract static class RbGvGetInnerNode extends RubyBaseNode {
10821075

1083-
return dispatchNode.call(coreLibrary().topLevelBinding, "eval", name);
1084-
}
1076+
public abstract Object execute(VirtualFrame frame, Node node, String name);
10851077

1086-
private static void warn(Node node, WarnNode warnNode, String message) {
1087-
if (warnNode.shouldWarn()) {
1088-
warnNode.warningMessage(
1089-
getContext(node).getCallStack().getTopMostUserSourceSection(),
1090-
message);
1091-
}
1078+
@Specialization(guards = "name == cachedName", limit = "getDefaultCacheLimit()")
1079+
static Object rbGvGetCached(VirtualFrame frame, Node node, String name,
1080+
@Cached("name") String cachedName,
1081+
@Cached(value = "create(cachedName)", inline = false) ReadGlobalVariableNode readGlobalVariableNode) {
1082+
return readGlobalVariableNode.execute(frame);
10921083
}
10931084

1094-
protected int getCacheLimit() {
1095-
return getLanguage().options.DEFAULT_CACHE;
1085+
@Specialization
1086+
static Object rbGvGetUncached(Node node, String name,
1087+
@Cached(inline = false) DispatchNode dispatchNode) {
1088+
return dispatchNode.call(coreLibrary(node).topLevelBinding, "eval", name);
10961089
}
1097-
10981090
}
10991091

11001092
@CoreMethod(names = "cext_module_function", onSingleton = true, required = 2)
@@ -1988,60 +1980,28 @@ protected RubyArray compileArgTypes(AbstractTruffleString format, RubyEncoding e
19881980
@ReportPolymorphism
19891981
public abstract static class RBSprintfNode extends CoreMethodArrayArgumentsNode {
19901982

1991-
@Specialization(
1992-
guards = {
1993-
"libFormat.isRubyString(format)",
1994-
"equalNode.execute(node, libFormat, format, cachedFormat, cachedEncoding)" },
1995-
limit = "2")
1996-
static RubyString formatCached(Object format, Object stringReader, RubyArray argArray,
1997-
@Cached @Shared ArrayToObjectArrayNode arrayToObjectArrayNode,
1998-
@Cached @Shared RubyStringLibrary libFormat,
1999-
@Cached @Shared InlinedBranchProfile exceptionProfile,
2000-
@Cached @Shared InlinedConditionProfile resizeProfile,
2001-
@Cached @Shared TruffleString.FromByteArrayNode fromByteArrayNode,
2002-
@Cached("asTruffleStringUncached(format)") TruffleString cachedFormat,
2003-
@Cached("libFormat.getEncoding(format)") RubyEncoding cachedEncoding,
2004-
@Cached("cachedFormat.byteLength(cachedEncoding.tencoding)") int cachedFormatLength,
2005-
@Cached("create(compileFormat(cachedFormat, cachedEncoding, stringReader))") DirectCallNode formatNode,
2006-
@Cached StringHelperNodes.EqualSameEncodingNode equalNode,
1983+
@Specialization(guards = "libFormat.isRubyString(format)", limit = "1")
1984+
static RubyString format(Object format, Object stringReader, RubyArray argArray,
1985+
@Cached ArrayToObjectArrayNode arrayToObjectArrayNode,
1986+
@Cached RubyStringLibrary libFormat,
1987+
@Cached TruffleString.FromByteArrayNode fromByteArrayNode,
1988+
@Cached RBSprintfInnerNode rbSprintfInnerNode,
1989+
@Cached InlinedBranchProfile exceptionProfile,
1990+
@Cached InlinedConditionProfile resizeProfile,
20071991
@Bind("this") Node node) {
2008-
final BytesResult result;
2009-
final Object[] arguments = arrayToObjectArrayNode.executeToObjectArray(argArray);
2010-
try {
2011-
result = (BytesResult) formatNode.call(new Object[]{ arguments, arguments.length, null });
2012-
} catch (FormatException e) {
2013-
exceptionProfile.enter(node);
2014-
throw FormatExceptionTranslator.translate(getContext(node), node, e);
2015-
}
2016-
2017-
return finishFormat(node, cachedFormatLength, result, resizeProfile, fromByteArrayNode);
2018-
}
2019-
2020-
@Specialization(guards = "libFormat.isRubyString(format)", replaces = "formatCached")
2021-
RubyString formatUncached(Object format, Object stringReader, RubyArray argArray,
2022-
@Cached IndirectCallNode formatNode,
2023-
@Cached @Shared InlinedBranchProfile exceptionProfile,
2024-
@Cached @Shared InlinedConditionProfile resizeProfile,
2025-
@Cached @Shared TruffleString.FromByteArrayNode fromByteArrayNode,
2026-
@Cached @Shared ArrayToObjectArrayNode arrayToObjectArrayNode,
2027-
@Cached @Shared RubyStringLibrary libFormat) {
20281992
var tstring = libFormat.getTString(format);
20291993
var encoding = libFormat.getEncoding(format);
20301994
final Object[] arguments = arrayToObjectArrayNode.executeToObjectArray(argArray);
1995+
20311996
final BytesResult result;
20321997
try {
2033-
result = (BytesResult) formatNode.call(compileFormat(tstring, encoding, stringReader),
2034-
new Object[]{ arguments, arguments.length, null });
1998+
result = rbSprintfInnerNode.execute(node, tstring, encoding, stringReader, arguments);
20351999
} catch (FormatException e) {
2036-
exceptionProfile.enter(this);
2037-
throw FormatExceptionTranslator.translate(getContext(), this, e);
2000+
exceptionProfile.enter(node);
2001+
throw FormatExceptionTranslator.translate(getContext(node), node, e);
20382002
}
20392003

2040-
return finishFormat(this, tstring.byteLength(encoding.tencoding), result, resizeProfile, fromByteArrayNode);
2041-
}
2042-
2043-
private static RubyString finishFormat(Node node, int formatLength, BytesResult result,
2044-
InlinedConditionProfile resizeProfile, TruffleString.FromByteArrayNode fromByteArrayNode) {
2004+
int formatLength = tstring.byteLength(encoding.tencoding);
20452005
byte[] bytes = result.getOutput();
20462006

20472007
if (resizeProfile.profile(node, bytes.length != result.getOutputLength())) {
@@ -2052,14 +2012,43 @@ private static RubyString finishFormat(Node node, int formatLength, BytesResult
20522012
result.getEncoding().getEncodingForLength(formatLength));
20532013
}
20542014

2015+
}
2016+
2017+
@GenerateInline
2018+
@GenerateCached(false)
2019+
public abstract static class RBSprintfInnerNode extends RubyBaseNode {
2020+
2021+
public abstract BytesResult execute(Node node, AbstractTruffleString format, RubyEncoding encoding,
2022+
Object stringReader, Object[] arguments);
2023+
2024+
@Specialization(
2025+
guards = "equalNode.execute(node, format, encoding, cachedFormat, cachedEncoding)",
2026+
limit = "2")
2027+
static BytesResult formatCached(
2028+
Node node, AbstractTruffleString format, RubyEncoding encoding, Object stringReader, Object[] arguments,
2029+
@Cached("format.asTruffleStringUncached(encoding.tencoding)") TruffleString cachedFormat,
2030+
@Cached("encoding") RubyEncoding cachedEncoding,
2031+
@Cached(value = "create(compileFormat(cachedFormat, cachedEncoding, stringReader, node))",
2032+
inline = false) DirectCallNode formatNode,
2033+
@Cached StringHelperNodes.EqualSameEncodingNode equalNode) {
2034+
return (BytesResult) formatNode.call(new Object[]{ arguments, arguments.length, null });
2035+
}
2036+
2037+
@Specialization(replaces = "formatCached")
2038+
static BytesResult formatUncached(
2039+
Node node, AbstractTruffleString format, RubyEncoding encoding, Object stringReader, Object[] arguments,
2040+
@Cached(inline = false) IndirectCallNode formatNode) {
2041+
return (BytesResult) formatNode.call(compileFormat(format, encoding, stringReader, node),
2042+
new Object[]{ arguments, arguments.length, null });
2043+
}
2044+
20552045
@TruffleBoundary
2056-
protected RootCallTarget compileFormat(AbstractTruffleString format, RubyEncoding encoding,
2057-
Object stringReader) {
2046+
protected static RootCallTarget compileFormat(AbstractTruffleString format, RubyEncoding encoding,
2047+
Object stringReader, Node node) {
20582048
try {
2059-
return new RBSprintfCompiler(getLanguage(), this)
2060-
.compile(format, encoding, stringReader);
2049+
return new RBSprintfCompiler(getLanguage(node), node).compile(format, encoding, stringReader);
20612050
} catch (InvalidFormatException e) {
2062-
throw new RaiseException(getContext(), coreExceptions().argumentError(e.getMessage(), this));
2051+
throw new RaiseException(getContext(node), coreExceptions(node).argumentError(e.getMessage(), node));
20632052
}
20642053
}
20652054
}

0 commit comments

Comments
 (0)