diff --git a/ci/common.jsonnet b/ci/common.jsonnet index a5bdf79c1acf..43f78c8a4812 100644 --- a/ci/common.jsonnet +++ b/ci/common.jsonnet @@ -61,7 +61,8 @@ local common_json = import "../common.json"; [name]: jdk_base + common_json.jdks[name] + { jdk_version:: parse_labsjdk_version(self), jdk_name:: "jdk-latest"} for name in ["oraclejdk-latest"] + variants("labsjdk-ce-latest") + variants("labsjdk-ee-latest") }, - assert std.assertEqual(std.objectFields(common_json.jdks), std.objectFields(jdks_data)), + # We do not want to expose galahad-jdk + assert std.assertEqual([x for x in std.objectFields(common_json.jdks) if x != "galahad-jdk"], std.objectFields(jdks_data)), # Verify oraclejdk-latest and labsjdk-ee-latest versions match assert local _labsjdk = common_json.jdks["labsjdk-ee-latest"]; diff --git a/common.json b/common.json index 52c1ac841c90..e9b51bd96972 100644 --- a/common.json +++ b/common.json @@ -4,10 +4,12 @@ "Jsonnet files should not include this file directly but use ci/common.jsonnet instead." ], - "mx_version": "7.3.1", + "mx_version": "7.4.1", "COMMENT.jdks": "When adding or removing JDKs keep in sync with JDKs in ci/common.jsonnet", "jdks": { + "galahad-jdk": {"name": "jpg-jdk", "version": "22", "build_id": "jdk-22+25", "platformspecific": true, "extrabundles": ["static-libs"]}, + "oraclejdk11": {"name": "jpg-jdk", "version": "11.0.11", "build_id": "9", "release": true, "platformspecific": true, "extrabundles": ["static-libs"] }, "oraclejdk17": {"name": "jpg-jdk", "version": "17.0.7", "build_id": "8", "release": true, "platformspecific": true, "extrabundles": ["static-libs"]}, @@ -35,20 +37,20 @@ "labsjdk-ee-20-llvm": {"name": "labsjdk", "version": "ee-20.0.2+2-jvmci-23.1-b02-sulong", "platformspecific": true }, "oraclejdk21": {"name": "jpg-jdk", "version": "21", "build_id": "33", "release": true, "platformspecific": true, "extrabundles": ["static-libs"]}, - "labsjdk-ce-21": {"name": "labsjdk", "version": "ce-21.0.1+12-jvmci-23.1-b22", "platformspecific": true }, - "labsjdk-ce-21Debug": {"name": "labsjdk", "version": "ce-21.0.1+12-jvmci-23.1-b22-debug", "platformspecific": true }, - "labsjdk-ce-21-llvm": {"name": "labsjdk", "version": "ce-21.0.1+12-jvmci-23.1-b22-sulong", "platformspecific": true }, - "labsjdk-ee-21": {"name": "labsjdk", "version": "ee-21.0.1+11-jvmci-23.1-b22", "platformspecific": true }, - "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 }, + "labsjdk-ce-21": {"name": "labsjdk", "version": "ce-21.0.1+12-jvmci-23.1-b26", "platformspecific": true }, + "labsjdk-ce-21Debug": {"name": "labsjdk", "version": "ce-21.0.1+12-jvmci-23.1-b26-debug", "platformspecific": true }, + "labsjdk-ce-21-llvm": {"name": "labsjdk", "version": "ce-21.0.1+12-jvmci-23.1-b26-sulong", "platformspecific": true }, + "labsjdk-ee-21": {"name": "labsjdk", "version": "ee-21.0.1+11-jvmci-23.1-b26", "platformspecific": true }, + "labsjdk-ee-21Debug": {"name": "labsjdk", "version": "ee-21.0.1+11-jvmci-23.1-b26-debug", "platformspecific": true }, + "labsjdk-ee-21-llvm": {"name": "labsjdk", "version": "ee-21.0.1+11-jvmci-23.1-b26-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": { diff --git a/mx.truffleruby/suite.py b/mx.truffleruby/suite.py index a0944d077b2f..b019af4d8af6 100644 --- a/mx.truffleruby/suite.py +++ b/mx.truffleruby/suite.py @@ -20,7 +20,7 @@ { "name": "regex", "subdir": True, - "version": "f363b55797fe85ea6aa24218364b57f3c71aeb56", + "version": "f0e8373ec294b7af06e70a5d2e12488ce99e6cdb", "urls": [ {"url": "https://github.com/oracle/graal.git", "kind": "git"}, {"url": "https://curio.ssw.jku.at/nexus/content/repositories/snapshots", "kind": "binary"}, @@ -29,7 +29,7 @@ { "name": "sulong", "subdir": True, - "version": "f363b55797fe85ea6aa24218364b57f3c71aeb56", + "version": "f0e8373ec294b7af06e70a5d2e12488ce99e6cdb", "urls": [ {"url": "https://github.com/oracle/graal.git", "kind": "git"}, {"url": "https://curio.ssw.jku.at/nexus/content/repositories/snapshots", "kind": "binary"}, diff --git a/src/main/java/org/truffleruby/interop/InteropNodes.java b/src/main/java/org/truffleruby/interop/InteropNodes.java index 0dc55dbb1b66..b5b8e5e6774f 100644 --- a/src/main/java/org/truffleruby/interop/InteropNodes.java +++ b/src/main/java/org/truffleruby/interop/InteropNodes.java @@ -2262,6 +2262,27 @@ static long getBufferSize(Object receiver, } + @CoreMethod(names = "read_buffer", onSingleton = true, required = 3, lowerFixnum = { 2, 3 }) + public abstract static class ReadBufferNode extends CoreMethodArrayArgumentsNode { + + @Specialization(limit = "getInteropCacheLimit()") + static RubyString readBuffer(Object receiver, long byteOffset, int length, + @CachedLibrary("receiver") InteropLibrary interop, + @Cached TranslateInteropExceptionNode translateInteropException, + @Cached TruffleString.FromByteArrayNode fromByteArrayNode, + @Bind("this") Node node) { + byte[] bytes = new byte[length]; + try { + interop.readBuffer(receiver, byteOffset, bytes, 0, length); + } catch (InteropException e) { + throw translateInteropException.execute(node, e); + } + + return createString(node, fromByteArrayNode, bytes, Encodings.BINARY); + } + + } + @CoreMethod(names = "read_buffer_byte", onSingleton = true, required = 2) public abstract static class ReadBufferByteNode extends CoreMethodArrayArgumentsNode { diff --git a/src/processor/java/org/truffleruby/processor/CoreModuleChecks.java b/src/processor/java/org/truffleruby/processor/CoreModuleChecks.java index e9814057a834..fbf06b48947b 100644 --- a/src/processor/java/org/truffleruby/processor/CoreModuleChecks.java +++ b/src/processor/java/org/truffleruby/processor/CoreModuleChecks.java @@ -34,7 +34,7 @@ public class CoreModuleChecks { this.processor = processor; } - void checks(int[] lowerFixnum, CoreMethod coreMethod, TypeElement klass, boolean hasZeroArgument) { + void checks(int[] lowerFixnum, CoreMethod coreMethod, TypeElement klass, boolean hasSelfArgument) { byte[] lowerArgs = null; List specializationMethods = new ArrayList<>(); @@ -54,13 +54,11 @@ void checks(int[] lowerFixnum, CoreMethod coreMethod, TypeElement klass, boolean specializationMethods.add(specializationMethod); lowerArgs = checkLowerFixnumArguments(specializationMethod, lowerArgs); + if (coreMethod != null) { - checkAmbiguousOptionalArguments( - coreMethod, - specializationMethod, - specializationAnnotation); + checkCoreMethodArguments(coreMethod, specializationMethod, specializationAnnotation, + hasSelfArgument); } - } klassIt = processor @@ -81,8 +79,8 @@ void checks(int[] lowerFixnum, CoreMethod coreMethod, TypeElement klass, boolean // Verify against the lowerFixnum annotation for (int i = 0; i < lowerArgs.length; i++) { boolean shouldLower = lowerArgs[i] == 0b01; // int without long - if (shouldLower && !contains(lowerFixnum, hasZeroArgument ? i : i + 1)) { - processor.error("should use lowerFixnum for argument " + (hasZeroArgument ? i : i + 1), klass); + if (shouldLower && !contains(lowerFixnum, hasSelfArgument ? i : i + 1)) { + processor.error("should use lowerFixnum for argument " + (hasSelfArgument ? i : i + 1), klass); } } } @@ -133,10 +131,11 @@ private static boolean contains(int[] array, int value) { return false; } - private void checkAmbiguousOptionalArguments( + private void checkCoreMethodArguments( CoreMethod coreMethod, ExecutableElement specializationMethod, - Specialization specializationAnnotation) { + Specialization specializationAnnotation, + boolean hasSelfArgument) { List parameters = specializationMethod.getParameters(); int n = getLastParameterIndex(parameters); @@ -145,21 +144,24 @@ private void checkAmbiguousOptionalArguments( processor.error("last argument must be a RootCallTarget for alwaysInlined ", specializationMethod); return; } - n--; + // All other arguments are packed as Object[] + return; } - if (coreMethod.needsBlock() && !coreMethod.alwaysInlined()) { + final int parametersCount = getParametersCount(parameters); + int expectedParametersCount = coreMethod.required() + coreMethod.optional(); + if (hasSelfArgument) { + expectedParametersCount++; + } + + if (coreMethod.needsBlock()) { if (n < 0) { processor.error("invalid block method parameter position for", specializationMethod); return; } checkParameterBlock(parameters.get(n)); n--; // Ignore block argument. - } - - if (coreMethod.alwaysInlined()) { - // All other arguments are packed as Object[] - return; + expectedParametersCount++; } if (coreMethod.rest()) { @@ -173,6 +175,13 @@ private void checkAmbiguousOptionalArguments( return; } n--; // ignore final Object[] argument + expectedParametersCount++; + } + + if (parametersCount != expectedParametersCount) { + processor.error("expected " + expectedParametersCount + " parameters for this @CoreMethod but there are " + + parametersCount, specializationMethod); + return; } for (int i = 0; i < coreMethod.optional(); i++, n--) { @@ -221,6 +230,25 @@ private static int getLastParameterIndex(List paramet return n; } + private int getParametersCount(List parameters) { + int last = getLastParameterIndex(parameters); + int count = last + 1; + + if (count > 0) { + var type = parameters.get(0).asType(); + if (processor.isSameType(type, processor.nodeType)) { + if (processor.isSameType(type, processor.virtualFrameType)) { + return count - 2; + } else { + return count - 1; + } + } else if (processor.isSameType(type, processor.virtualFrameType)) { + return count - 1; + } + } + return count; + } + private void checkParameterUnguarded(Specialization specializationAnnotation, VariableElement parameter) { String name = parameter.getSimpleName().toString(); diff --git a/src/processor/java/org/truffleruby/processor/CoreModuleProcessor.java b/src/processor/java/org/truffleruby/processor/CoreModuleProcessor.java index e3f09000a4b8..a82f1da4d879 100644 --- a/src/processor/java/org/truffleruby/processor/CoreModuleProcessor.java +++ b/src/processor/java/org/truffleruby/processor/CoreModuleProcessor.java @@ -93,6 +93,7 @@ public class CoreModuleProcessor extends TruffleRubyProcessor { TypeMirror rubyProcType; TypeMirror rootCallTargetType; // node types + TypeMirror nodeType; TypeMirror rubyNodeType; TypeMirror rubyBaseNodeType; TypeMirror primitiveNodeType; @@ -108,6 +109,7 @@ public boolean process(Set annotations, RoundEnvironment notProvidedType = elementUtils.getTypeElement("org.truffleruby.language.NotProvided").asType(); rubyProcType = elementUtils.getTypeElement("org.truffleruby.core.proc.RubyProc").asType(); rootCallTargetType = elementUtils.getTypeElement("com.oracle.truffle.api.RootCallTarget").asType(); + nodeType = elementUtils.getTypeElement("com.oracle.truffle.api.nodes.Node").asType(); rubyNodeType = elementUtils.getTypeElement("org.truffleruby.language.RubyNode").asType(); rubyBaseNodeType = elementUtils.getTypeElement("org.truffleruby.language.RubyBaseNode").asType(); primitiveNodeType = elementUtils.getTypeElement("org.truffleruby.builtins.PrimitiveNode").asType(); @@ -188,15 +190,11 @@ private void processCoreModule(TypeElement coreModuleElement) throws IOException if (coreMethod != null) { // Do not use needsSelf=true in module functions, it is either the module/class or the instance. // Usage of needsSelf is quite rare for singleton methods (except constructors). - boolean needsSelf = coreMethod.constructor() || + boolean hasSelfArgument = coreMethod.constructor() || (!coreMethod.isModuleFunction() && !coreMethod.onSingleton() && coreMethod.needsSelf()); - CoreMethod checkAmbiguous = !coreMethod.alwaysInlined() && - (coreMethod.optional() > 0 || coreMethod.needsBlock()) - ? coreMethod - : null; - coreModuleChecks.checks(coreMethod.lowerFixnum(), checkAmbiguous, klass, needsSelf); + coreModuleChecks.checks(coreMethod.lowerFixnum(), coreMethod, klass, hasSelfArgument); if (!inherits(e.asType(), coreMethodNodeType) && !inherits(e.asType(), alwaysInlinedMethodNodeType)) { error(e + @@ -204,7 +202,7 @@ private void processCoreModule(TypeElement coreModuleElement) throws IOException e); } processCoreMethod(stream, rubyStream, coreModuleElement, coreModule, klass, coreMethod, - needsSelf); + hasSelfArgument); } } } @@ -287,7 +285,7 @@ private void processCoreMethod( CoreModule coreModule, TypeElement klass, CoreMethod coreMethod, - boolean needsSelf) { + boolean hasSelfArgument) { final StringJoiner names = new StringJoiner(", "); for (String name : coreMethod.names()) { names.add(quote(name)); @@ -312,7 +310,7 @@ private void processCoreMethod( int numberOfArguments = getNumberOfArguments(coreMethod); String[] argumentNamesFromAnnotation = coreMethod.argumentNames(); - final List argumentNames = getArgumentNames(klass, argumentNamesFromAnnotation, needsSelf, + final List argumentNames = getArgumentNames(klass, argumentNamesFromAnnotation, hasSelfArgument, coreMethod.alwaysInlined(), numberOfArguments);