diff --git a/common.json b/common.json index b1afd6ab00d1..1d2f959505f9 100644 --- a/common.json +++ b/common.json @@ -4,11 +4,11 @@ "Jsonnet files should not include this file directly but use ci/common.jsonnet instead." ], - "mx_version": "7.38.0", + "mx_version": "7.40.0", "COMMENT.jdks": "When adding or removing JDKs keep in sync with JDKs in ci/common.jsonnet", "jdks": { - "galahad-jdk": {"name": "jpg-jdk", "version": "25", "build_id": "jdk-25+6-477", "platformspecific": true, "extrabundles": ["static-libs"]}, + "galahad-jdk": {"name": "jpg-jdk", "version": "25", "build_id": "jdk-25+8-767", "platformspecific": true, "extrabundles": ["static-libs"]}, "oraclejdk17": {"name": "jpg-jdk", "version": "17.0.7", "build_id": "jdk-17.0.7+8", "platformspecific": true, "extrabundles": ["static-libs"]}, "labsjdk-ce-17": {"name": "labsjdk", "version": "ce-17.0.7+4-jvmci-23.1-b02", "platformspecific": true }, @@ -45,13 +45,13 @@ "oraclejdk23": {"name": "jpg-jdk", "version": "23", "build_id": "jdk-23+37", "platformspecific": true, "extrabundles": ["static-libs"]}, - "oraclejdk-latest": {"name": "jpg-jdk", "version": "25", "build_id": "jdk-25+7", "platformspecific": true, "extrabundles": ["static-libs"]}, - "labsjdk-ce-latest": {"name": "labsjdk", "version": "ce-25+7-jvmci-b01", "platformspecific": true }, - "labsjdk-ce-latestDebug": {"name": "labsjdk", "version": "ce-25+7-jvmci-b01-debug", "platformspecific": true }, - "labsjdk-ce-latest-llvm": {"name": "labsjdk", "version": "ce-25+7-jvmci-b01-sulong", "platformspecific": true }, - "labsjdk-ee-latest": {"name": "labsjdk", "version": "ee-25+7-jvmci-b01", "platformspecific": true }, - "labsjdk-ee-latestDebug": {"name": "labsjdk", "version": "ee-25+7-jvmci-b01-debug", "platformspecific": true }, - "labsjdk-ee-latest-llvm": {"name": "labsjdk", "version": "ee-25+7-jvmci-b01-sulong", "platformspecific": true } + "oraclejdk-latest": {"name": "jpg-jdk", "version": "25", "build_id": "jdk-25+8", "platformspecific": true, "extrabundles": ["static-libs"]}, + "labsjdk-ce-latest": {"name": "labsjdk", "version": "ce-25+8-jvmci-b01", "platformspecific": true }, + "labsjdk-ce-latestDebug": {"name": "labsjdk", "version": "ce-25+8-jvmci-b01-debug", "platformspecific": true }, + "labsjdk-ce-latest-llvm": {"name": "labsjdk", "version": "ce-25+8-jvmci-b01-sulong", "platformspecific": true }, + "labsjdk-ee-latest": {"name": "labsjdk", "version": "ee-25+8-jvmci-b01", "platformspecific": true }, + "labsjdk-ee-latestDebug": {"name": "labsjdk", "version": "ee-25+8-jvmci-b01-debug", "platformspecific": true }, + "labsjdk-ee-latest-llvm": {"name": "labsjdk", "version": "ee-25+8-jvmci-b01-sulong", "platformspecific": true } }, "eclipse": { diff --git a/doc/contributor/how-to-guide.md b/doc/contributor/how-to-guide.md index 3d972e4dc54a..711a686d0e61 100644 --- a/doc/contributor/how-to-guide.md +++ b/doc/contributor/how-to-guide.md @@ -497,13 +497,13 @@ public abstract static class InitializeNode extends CoreMethodArrayArgumentsNode @Specialization protected RubyHash initialize(RubyHash hash, NotProvided defaultValue, RubyProc block, - @Shared @Cached PropagateSharingNode propagateSharingNode) { + @Cached @Shared PropagateSharingNode propagateSharingNode) { // ... } @Specialization(guards = "wasProvided(defaultValue)") protected RubyHash initialize(RubyHash hash, Object defaultValue, Nil block, - @Shared @Cached PropagateSharingNode propagateSharingNode) { + @Cached @Shared PropagateSharingNode propagateSharingNode) { // ... } diff --git a/mx.truffleruby/suite.py b/mx.truffleruby/suite.py index a6fddf22f037..c52d02fbc317 100644 --- a/mx.truffleruby/suite.py +++ b/mx.truffleruby/suite.py @@ -22,7 +22,7 @@ { "name": "regex", "subdir": True, - "version": "9461021a0d01a9a224a2fa7363a78dd44e974ce9", + "version": "d5e3b52521239695cfb42093c50ad2faeaad9360", "urls": [ {"url": "https://github.com/oracle/graal.git", "kind": "git"}, {"url": "https://curio.ssw.jku.at/nexus/content/repositories/snapshots", "kind": "binary"}, @@ -31,7 +31,7 @@ { "name": "sulong", "subdir": True, - "version": "9461021a0d01a9a224a2fa7363a78dd44e974ce9", + "version": "d5e3b52521239695cfb42093c50ad2faeaad9360", "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/c/rubysignal/src/rubysignal.c b/src/main/c/rubysignal/src/rubysignal.c index c0897c68fe0f..a4befb9098b7 100644 --- a/src/main/c/rubysignal/src/rubysignal.c +++ b/src/main/c/rubysignal/src/rubysignal.c @@ -21,6 +21,10 @@ JNIEXPORT void JNICALL Java_org_truffleruby_signal_LibRubySignal_setupLocale(JNI setlocale(LC_CTYPE, ""); } +JNIEXPORT void JNICALL Java_org_truffleruby_signal_LibRubySignal_setupLocaleOnlyCTYPE(JNIEnv *env, jclass clazz) { + setlocale(LC_CTYPE, ""); +} + static void empty_handler(int sig) { } diff --git a/src/main/java/org/truffleruby/RubyLanguage.java b/src/main/java/org/truffleruby/RubyLanguage.java index 80fb9a862fa5..7599c6462bfa 100644 --- a/src/main/java/org/truffleruby/RubyLanguage.java +++ b/src/main/java/org/truffleruby/RubyLanguage.java @@ -11,6 +11,7 @@ import java.io.File; import java.io.IOException; +import java.lang.invoke.MethodHandles; import java.lang.ref.Cleaner; import java.util.Arrays; import java.util.Map; @@ -40,7 +41,6 @@ import com.oracle.truffle.api.strings.InternalByteArray; import com.oracle.truffle.api.strings.TruffleString; import org.graalvm.nativeimage.ImageInfo; -import org.graalvm.nativeimage.ProcessProperties; import org.graalvm.options.OptionDescriptors; import org.prism.Parser; import org.truffleruby.annotations.SuppressFBWarnings; @@ -290,9 +290,9 @@ private RubyThread getOrCreateForeignThread(RubyContext context, Thread thread) private static final RubyObjectType objectType = new RubyObjectType(); - public final Shape basicObjectShape = createShape(RubyBasicObject.class); - public final Shape moduleShape = createShape(RubyModule.class); - public final Shape classShape = createShape(RubyClass.class); + public final Shape basicObjectShape = createShape(RubyBasicObject.class, RubyBasicObject.LOOKUP); + public final Shape moduleShape = createShape(RubyModule.class, RubyModule.LOOKUP); + public final Shape classShape = createShape(RubyClass.class, RubyModule.LOOKUP); public final Shape arrayShape = createShape(RubyArray.class); public final Shape atomicReferenceShape = createShape(RubyAtomicReference.class); @@ -338,7 +338,7 @@ private RubyThread getOrCreateForeignThread(RubyContext context, Thread thread) public final Shape classVariableShape = Shape .newBuilder() .allowImplicitCastIntToLong(true) - .layout(ClassVariableStorage.class) + .layout(ClassVariableStorage.class, ClassVariableStorage.LOOKUP) .build(); public final ThreadLocal parsingRequestParams = new ThreadLocal<>(); @@ -831,13 +831,18 @@ private void setupLocale(Env env, String rubyHome) { // CRuby does setlocale(LC_CTYPE, "") because this is needed to get the locale encoding with nl_langinfo(CODESET). // This means every locale category except LC_CTYPE remains the initial "C". // LC_CTYPE is set according to environment variables (LC_ALL, LC_CTYPE, LANG). - // HotSpot does setlocale(LC_ALL, "") and Native Image does nothing. + // HotSpot and Native Image with UseSystemLocale=true (the default) do setlocale(LC_ALL, ""). // We match CRuby by doing setlocale(LC_ALL, "C") and setlocale(LC_CTYPE, ""). // This also affects C functions that depend on the locale in C extensions, so best to follow CRuby here. // Change the strict minimum if embedded because setlocale() is process-wide. if (env.getOptions().get(OptionsCatalog.EMBEDDED_KEY)) { if (ImageInfo.inImageRuntimeCode()) { - ProcessProperties.setLocale("LC_CTYPE", ""); + // Only do this on Native Image, to handle the case of the embedder setting UseSystemLocale=false. + LibRubySignal.loadLibrary(rubyHome, Platform.LIB_SUFFIX); + LibRubySignal.setupLocaleOnlyCTYPE(); + } else { + // Nothing to do, JVM and Native Image UseSystemLocale=true already did setlocale(LC_ALL, "") + // so there is no need to setlocale(LC_CTYPE, ""). } } else { LibRubySignal.loadLibrary(rubyHome, Platform.LIB_SUFFIX); @@ -879,10 +884,15 @@ public PathToTStringCache getPathToTStringCache() { } private static Shape createShape(Class layoutClass) { + return createShape(layoutClass, RubyDynamicObject.LOOKUP); + } + + private static Shape createShape(Class layoutClass, MethodHandles.Lookup lookup) { + assert lookup.lookupClass().isAssignableFrom(layoutClass) : layoutClass; return Shape .newBuilder() .allowImplicitCastIntToLong(true) - .layout(layoutClass) + .layout(layoutClass, lookup) .dynamicType(RubyLanguage.objectType) .build(); } diff --git a/src/main/java/org/truffleruby/cext/CExtNodes.java b/src/main/java/org/truffleruby/cext/CExtNodes.java index 28f53f41b11e..689101eccca5 100644 --- a/src/main/java/org/truffleruby/cext/CExtNodes.java +++ b/src/main/java/org/truffleruby/cext/CExtNodes.java @@ -742,7 +742,7 @@ static RubyArray rbEncCodePointLen(Object string, @Cached TruffleString.ByteLengthOfCodePointNode byteLengthOfCodePointNode, @Cached TruffleString.CodePointAtByteIndexNode codePointAtByteIndexNode, @Cached InlinedBranchProfile errorProfile, - @Bind("this") Node node) { + @Bind Node node) { var tstring = strings.getTString(node, string); var encoding = strings.getEncoding(node, string); var tencoding = encoding.tencoding; @@ -1642,7 +1642,7 @@ static Object rbTrEncMbcCaseFold(int flags, Object string, Object advance_p, Obj @Cached TranslateInteropExceptionNode translateInteropExceptionNode, @Cached TruffleString.FromByteArrayNode fromByteArrayNode, @Cached TruffleString.GetInternalByteArrayNode byteArrayNode, - @Bind("this") Node node) { + @Bind Node node) { var tstring = strings.getTString(node, string); var encoding = strings.getEncoding(node, string); var bytes = TStringUtils.getBytesOrFail(tstring, encoding, byteArrayNode); @@ -1705,7 +1705,7 @@ Object rbEncMinLen(RubyEncoding value) { public abstract static class RbEncMbLenNode extends CoreMethodArrayArgumentsNode { @Specialization static Object rbEncMbLen(Object string, - @Bind("this") Node node, + @Bind Node node, @Cached RubyStringLibrary strings, @Cached TruffleString.ByteLengthOfCodePointNode byteLengthOfCodePointNode) { var tstring = strings.getTString(node, string); @@ -1718,7 +1718,7 @@ static Object rbEncMbLen(Object string, public abstract static class RbEncPreciseMbclenNode extends CoreMethodArrayArgumentsNode { @Specialization static int rbEncPreciseMbclen(Object string, - @Bind("this") Node node, + @Bind Node node, @Cached RubyStringLibrary strings, @Cached TruffleString.ByteLengthOfCodePointNode byteLengthOfCodePointNode) { var tstring = strings.getTString(node, string); @@ -1732,7 +1732,7 @@ public abstract static class RbEncStrlen extends CoreMethodArrayArgumentsNode { @Specialization static int rbEncStrlen(Object string, - @Bind("this") Node node, + @Bind Node node, @Cached RubyStringLibrary strings, @Cached TruffleString.CodePointLengthNode codePointLengthNode) { var tstring = strings.getTString(node, string); @@ -1764,7 +1764,7 @@ static int rbEncMbcToCodepoint(Object string, @Cached TruffleString.CodePointAtByteIndexNode codePointAtByteIndexNode, @Cached TruffleString.GetInternalByteArrayNode byteArrayNode, @Cached InlinedConditionProfile brokenProfile, - @Bind("this") Node node) { + @Bind Node node) { var tstring = strings.getTString(node, string); var encoding = strings.getEncoding(node, string); int codepoint = codePointAtByteIndexNode.execute(tstring, 0, encoding.tencoding, @@ -2039,7 +2039,7 @@ static RubyString format(Object format, Object stringReader, RubyArray argArray, @Cached InlinedBranchProfile exceptionProfile, @Cached InlinedConditionProfile resizeProfile, @Cached IndirectCallNode formatNode, - @Bind("this") Node node) { + @Bind Node node) { var tstring = libFormat.getTString(node, format); var encoding = libFormat.getEncoding(node, format); final Object[] arguments = arrayToObjectArrayNode.executeToObjectArray(argArray); diff --git a/src/main/java/org/truffleruby/cext/ValueWrapper.java b/src/main/java/org/truffleruby/cext/ValueWrapper.java index 3214d1a0a855..ea76dc7abefd 100644 --- a/src/main/java/org/truffleruby/cext/ValueWrapper.java +++ b/src/main/java/org/truffleruby/cext/ValueWrapper.java @@ -105,7 +105,7 @@ protected boolean isPointer() { static void toNative(ValueWrapper wrapper, @Cached AllocateHandleNode createNativeHandleNode, @Cached @Exclusive InlinedBranchProfile createHandleProfile, - @Bind("$node") Node node) { + @Bind Node node) { if (!wrapper.isPointer()) { createHandleProfile.enter(node); createNativeHandleNode.execute(node, wrapper); @@ -116,7 +116,7 @@ static void toNative(ValueWrapper wrapper, static long asPointer(ValueWrapper wrapper, @Cached KeepAliveNode keepAliveNode, @Cached @Exclusive InlinedBranchProfile taggedObjectProfile, - @Bind("$node") Node node) { + @Bind Node node) { long handle = wrapper.getHandle(); assert handle != ValueWrapperManager.UNSET_HANDLE; @@ -147,7 +147,7 @@ protected boolean isMemberReadable(String member) { @ExportMessage static Object readMember(ValueWrapper wrapper, String member, @Cached @Exclusive InlinedBranchProfile errorProfile, - @Bind("$node") Node node) throws UnknownIdentifierException { + @Bind Node node) throws UnknownIdentifierException { if ("value".equals(member)) { if (wrapper.object != null) { return wrapper.object; diff --git a/src/main/java/org/truffleruby/cext/ValueWrapperManager.java b/src/main/java/org/truffleruby/cext/ValueWrapperManager.java index 6aa63833e920..b854aa9e6518 100644 --- a/src/main/java/org/truffleruby/cext/ValueWrapperManager.java +++ b/src/main/java/org/truffleruby/cext/ValueWrapperManager.java @@ -385,7 +385,7 @@ protected boolean isExecutable() { @ExportMessage protected Object execute(Object[] arguments, @Cached UnwrapNode unwrapNode, - @Bind("$node") Node node) { + @Bind Node node) { return unwrapNode.execute(node, arguments[0]); } } @@ -419,7 +419,7 @@ protected boolean isExecutable() { public Object execute(Object[] arguments, @Cached UnwrapNode unwrapNode, @Cached SymbolToIDNode symbolTOIDNode, - @Bind("$node") Node node) { + @Bind Node node) { return symbolTOIDNode.execute(unwrapNode.execute(node, arguments[0])); } } @@ -452,7 +452,7 @@ protected boolean isExecutable() { @ExportMessage protected boolean execute(Object[] arguments, @Cached IsNativeObjectNode isNativeObjectNode, - @Bind("$node") Node node) { + @Bind Node node) { return isNativeObjectNode.execute(node, arguments[0]); } } diff --git a/src/main/java/org/truffleruby/cext/WrapNode.java b/src/main/java/org/truffleruby/cext/WrapNode.java index 02fdc06944a9..23b2b6f42489 100644 --- a/src/main/java/org/truffleruby/cext/WrapNode.java +++ b/src/main/java/org/truffleruby/cext/WrapNode.java @@ -112,7 +112,7 @@ ValueWrapper wrapImmutable(ImmutableRubyObject value, static ValueWrapper wrapValue(RubyDynamicObject value, @CachedLibrary("value") DynamicObjectLibrary objectLibrary, @Cached @Shared InlinedBranchProfile noHandleProfile, - @Bind("this") Node node) { + @Bind Node node) { ValueWrapper wrapper = (ValueWrapper) objectLibrary.getOrDefault(value, Layouts.VALUE_WRAPPER_IDENTIFIER, null); if (wrapper == null) { noHandleProfile.enter(node); diff --git a/src/main/java/org/truffleruby/core/TruffleSystemNodes.java b/src/main/java/org/truffleruby/core/TruffleSystemNodes.java index 93bba47e9b03..a814ead88872 100644 --- a/src/main/java/org/truffleruby/core/TruffleSystemNodes.java +++ b/src/main/java/org/truffleruby/core/TruffleSystemNodes.java @@ -106,7 +106,7 @@ static Object javaGetEnv(Object name, @Cached ToJavaStringNode toJavaStringNode, @Cached FromJavaStringNode fromJavaStringNode, @Cached InlinedConditionProfile nullValueProfile, - @Bind("this") Node node) { + @Bind Node node) { final String javaName = toJavaStringNode.execute(node, name); final String value = getEnv(javaName); @@ -187,7 +187,7 @@ static Object getJavaProperty(Object property, @Cached RubyStringLibrary strings, @Cached TruffleString.FromJavaStringNode fromJavaStringNode, @Cached ToJavaStringNode toJavaStringNode, - @Bind("this") Node node) { + @Bind Node node) { String value = getProperty(toJavaStringNode.execute(node, property)); if (value == null) { return nil; diff --git a/src/main/java/org/truffleruby/core/VMPrimitiveNodes.java b/src/main/java/org/truffleruby/core/VMPrimitiveNodes.java index ca68ddd8b921..63b0f9e5f879 100644 --- a/src/main/java/org/truffleruby/core/VMPrimitiveNodes.java +++ b/src/main/java/org/truffleruby/core/VMPrimitiveNodes.java @@ -239,7 +239,7 @@ Object vmRaiseException(RubyException exception, static Object foreignException(Object exception, @CachedLibrary("exception") InteropLibrary interopLibrary, @Cached TranslateInteropExceptionNode translateInteropExceptionNode, - @Bind("this") Node node) { + @Bind Node node) { try { throw interopLibrary.throwException(exception); } catch (UnsupportedMessageException e) { diff --git a/src/main/java/org/truffleruby/core/array/ArrayNodes.java b/src/main/java/org/truffleruby/core/array/ArrayNodes.java index 1caf181043d6..43b2712935ee 100644 --- a/src/main/java/org/truffleruby/core/array/ArrayNodes.java +++ b/src/main/java/org/truffleruby/core/array/ArrayNodes.java @@ -139,7 +139,7 @@ public abstract static class AddNode extends CoreMethodArrayArgumentsNode { limit = "storageStrategyLimit()") static RubyArray addGeneralize(RubyArray a, Object bObject, @Cached ToAryNode toAryNode, - @Bind("this") Node node, + @Bind Node node, @Bind("toAryNode.execute(node, bObject)") RubyArray b, @Bind("a.getStore()") Object aStore, @Bind("b.getStore()") Object bStore, @@ -250,7 +250,7 @@ static Object at(RubyArray array, Object index, @Cached ToLongNode toLongNode, @Cached FixnumLowerNode lowerNode, @Cached AtNode atNode, - @Bind("this") Node node) { + @Bind Node node) { return atNode.executeAt(array, lowerNode.execute(node, toLongNode.execute(node, index))); } } @@ -764,7 +764,7 @@ static Object doDelete(RubyArray array, Object indexObject, @Cached InlinedConditionProfile negativeIndexProfile, @Cached InlinedConditionProfile notInBoundsProfile, @Cached InlinedConditionProfile isMutableProfile, - @Bind("this") Node node) { + @Bind Node node) { final int size = arraySizeProfile.profile(node, array.size); final int index = toIntNode.execute(indexObject); int i = index; @@ -859,7 +859,7 @@ static boolean equalSamePrimitiveType(RubyArray a, RubyArray b, @Cached InlinedBranchProfile falseProfile, @Cached InlinedLoopConditionProfile loopProfile, @Cached SameOrEqualNode sameOrEqualNode, - @Bind("this") Node node) { + @Bind Node node) { if (sameProfile.profile(node, a == b)) { return true; @@ -932,7 +932,7 @@ static boolean eqlSamePrimitiveType(RubyArray a, RubyArray b, @Cached InlinedBranchProfile trueProfile, @Cached InlinedBranchProfile falseProfile, @Cached InlinedLoopConditionProfile loopProfile, - @Bind("$node") Node node) { + @Bind Node node) { if (sameProfile.profile(node, a == b)) { return true; @@ -1048,7 +1048,7 @@ static long hash(RubyArray array, @Cached HashingNodes.ToHashByHashCode toHashByHashCode, @Cached @Exclusive InlinedIntValueProfile arraySizeProfile, @Cached @Exclusive InlinedLoopConditionProfile loopProfile, - @Bind("this") Node node) { + @Bind Node node) { final int size = arraySizeProfile.profile(node, array.size); long h = getContext(node).getHashing(node).start(size); h = Hashing.update(h, CLASS_SALT); @@ -1080,7 +1080,7 @@ static boolean include(RubyArray array, Object value, @Cached SameOrEqualNode sameOrEqualNode, @Cached InlinedIntValueProfile arraySizeProfile, @Cached InlinedLoopConditionProfile loopProfile, - @Bind("this") Node node) { + @Bind Node node) { int n = 0; try { @@ -1221,7 +1221,7 @@ static Object initializeBlock(RubyArray array, int size, Object unusedFillingVal @Cached @Exclusive IsSharedNode isSharedNode, @Cached @Exclusive LoopConditionProfile loopProfile, @Cached CallBlockNode yieldNode, - @Bind("this") Node node) { + @Bind Node node) { BuilderState state = arrayBuilder.start(size); int n = 0; @@ -1543,7 +1543,7 @@ static RubyString packCached(Node node, RubyArray array, Object format, Object b @Cached @Shared TruffleString.FromByteArrayNode fromByteArrayNode, @Cached @Shared TruffleString.CopyToByteArrayNode copyToByteArrayNode, @Cached("asTruffleStringUncached(format)") TruffleString cachedFormat, - @Cached("libFormat.getEncoding(this, format)") RubyEncoding cachedEncoding, + @Cached("libFormat.getEncoding($node, format)") RubyEncoding cachedEncoding, @Cached("cachedFormat.byteLength(cachedEncoding.tencoding)") int cachedFormatLength, @Cached("compileFormat(node, getJavaString(format))") RootCallTarget formatCallTarget, @Cached("create(formatCallTarget)") DirectCallNode callPackNode, @@ -2114,7 +2114,7 @@ static RubyArray sortVeryShort(VirtualFrame frame, RubyArray array, Nil block, @Cached @Shared IntValueProfile arraySizeProfile, @Cached @Exclusive DispatchNode compareDispatchNode, @Cached CmpIntNode cmpIntNode, - @Bind("this") Node node) { + @Bind Node node) { final Object newStore = stores .unsharedAllocator(store) .allocate(getContext(node).getOptions().ARRAY_SMALL); @@ -2233,7 +2233,7 @@ RubyArray stealStorageNoOp(RubyArray array, RubyArray other) { static RubyArray stealStorage(RubyArray array, RubyArray other, @CachedLibrary(limit = "storageStrategyLimit()") ArrayStoreLibrary stores, @Cached PropagateSharingNode propagateSharingNode, - @Bind("this") Node node) { + @Bind Node node) { propagateSharingNode.execute(node, array, other); final int size = other.size; diff --git a/src/main/java/org/truffleruby/core/array/library/NativeArrayStorage.java b/src/main/java/org/truffleruby/core/array/library/NativeArrayStorage.java index 546de92f3c56..cf2f11af8296 100644 --- a/src/main/java/org/truffleruby/core/array/library/NativeArrayStorage.java +++ b/src/main/java/org/truffleruby/core/array/library/NativeArrayStorage.java @@ -94,7 +94,7 @@ static String toString(NativeArrayStorage storage) { @ExportMessage protected Object read(int index, @Cached @Shared UnwrapNode unwrapNode, - @Bind("$node") Node node) { + @Bind Node node) { return unwrapNode.execute(node, readElement(index)); } @@ -103,7 +103,7 @@ protected void write(int index, Object value, @CachedLibrary(limit = "1") InteropLibrary wrappers, @Cached WrapNode wrapNode, @Cached InlinedConditionProfile isPointerProfile, - @Bind("$node") Node node) { + @Bind Node node) { final ValueWrapper wrapper = wrapNode.execute(value); if (!isPointerProfile.profile(node, wrappers.isPointer(wrapper))) { wrappers.toNative(wrapper); @@ -142,7 +142,7 @@ protected NativeArrayStorage expand(int newCapacity, @ExportMessage protected Object[] boxedCopyOfRange(int start, int length, @Cached @Shared UnwrapNode unwrapNode, - @Bind("$node") Node node) { + @Bind Node node) { Object[] newStore = new Object[length]; for (int i = 0; i < length; i++) { newStore[i] = unwrapNode.execute(node, readElement(start + i)); @@ -165,7 +165,7 @@ static void shareElements(NativeArrayStorage store, int start, int end, @CachedLibrary("store") ArrayStoreLibrary arrayStoreLibrary, @Cached @Exclusive LoopConditionProfile loopProfile, @Cached WriteBarrierNode writeBarrierNode, - @Bind("$node") Node node) { + @Bind Node node) { int i = start; try { for (; loopProfile.inject(i < end); i++) { @@ -209,7 +209,7 @@ static void fill(NativeArrayStorage store, int start, int length, Object value, @ExportMessage protected Object[] toJavaArrayCopy(int size, @Cached @Shared UnwrapNode unwrapNode, - @Bind("$node") Node node) { + @Bind Node node) { Object[] newStore = new Object[size]; assert size >= length; for (int i = 0; i < length; i++) { diff --git a/src/main/java/org/truffleruby/core/array/library/ObjectArrayStore.java b/src/main/java/org/truffleruby/core/array/library/ObjectArrayStore.java index c6658396acf7..17a22159622f 100644 --- a/src/main/java/org/truffleruby/core/array/library/ObjectArrayStore.java +++ b/src/main/java/org/truffleruby/core/array/library/ObjectArrayStore.java @@ -98,7 +98,7 @@ static void shareElements(Object[] store, int start, int end, @CachedLibrary("store") ArrayStoreLibrary arrayStoreLibrary, @Cached @Exclusive LoopConditionProfile loopProfile, @Cached WriteBarrierNode writeBarrierNode, - @Bind("$node") Node node) { + @Bind Node node) { int i = start; try { for (; loopProfile.inject(i < end); i++) { diff --git a/src/main/java/org/truffleruby/core/array/library/SharedArrayStorage.java b/src/main/java/org/truffleruby/core/array/library/SharedArrayStorage.java index 451222574f2b..fee9a3a31acf 100644 --- a/src/main/java/org/truffleruby/core/array/library/SharedArrayStorage.java +++ b/src/main/java/org/truffleruby/core/array/library/SharedArrayStorage.java @@ -78,7 +78,7 @@ protected Object read(int index, protected void write(int index, Object value, @Cached @Shared WriteBarrierNode writeBarrierNode, @CachedLibrary("this.storage") ArrayStoreLibrary stores, - @Bind("$node") Node node) { + @Bind Node node) { writeBarrierNode.execute(node, value); stores.write(storage, index, value); } @@ -87,7 +87,7 @@ protected void write(int index, Object value, protected void fill(int start, int length, Object value, @Cached @Shared WriteBarrierNode writeBarrierNode, @CachedLibrary("this.storage") ArrayStoreLibrary stores, - @Bind("$node") Node node) { + @Bind Node node) { writeBarrierNode.execute(node, value); stores.fill(storage, start, length, value); } diff --git a/src/main/java/org/truffleruby/core/basicobject/BasicObjectNodes.java b/src/main/java/org/truffleruby/core/basicobject/BasicObjectNodes.java index d4a807616b0c..c7d1be97dfe5 100644 --- a/src/main/java/org/truffleruby/core/basicobject/BasicObjectNodes.java +++ b/src/main/java/org/truffleruby/core/basicobject/BasicObjectNodes.java @@ -185,7 +185,7 @@ long objectIDSmallFixnumOverflow(long value) throws ArithmeticException { @Specialization(replaces = "objectIDSmallFixnumOverflow") static Object objectIDLong(long value, @Cached InlinedCountingConditionProfile smallProfile, - @Bind("this") Node node) { + @Bind Node node) { if (smallProfile.profile(node, ObjectIDOperations.isSmallFixnum(value))) { return ObjectIDOperations.smallFixnumToID(value); } else { @@ -244,7 +244,7 @@ long objectID(RubyDynamicObject object, static int objectIDForeign(Object value, @CachedLibrary("value") InteropLibrary interop, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { if (interop.hasIdentity(value)) { try { return interop.identityHashCode(value); @@ -294,7 +294,7 @@ static Object evalWithString(Frame callerFrame, Object self, Object[] rubyArgs, @Cached ToStrNode toStrNode, @Cached ToIntNode toIntNode, @Cached IndirectCallNode callNode, - @Bind("this") Node node) { + @Bind Node node) { final Object sourceCode; String fileName = coreStrings(node).EVAL_FILENAME_STRING.toString(); int line = 1; diff --git a/src/main/java/org/truffleruby/core/basicobject/RubyBasicObject.java b/src/main/java/org/truffleruby/core/basicobject/RubyBasicObject.java index c260083bc3be..b07d37a2880d 100644 --- a/src/main/java/org/truffleruby/core/basicobject/RubyBasicObject.java +++ b/src/main/java/org/truffleruby/core/basicobject/RubyBasicObject.java @@ -14,6 +14,8 @@ import com.oracle.truffle.api.object.Shape; +import java.lang.invoke.MethodHandles; + /** This is not the common type for Ruby DynamicObjects. See {@link RubyDynamicObject} instead. This class represents * instances of Ruby objects which are not core types such as String, Array, etc. * @@ -21,6 +23,8 @@ * Instance variables are rare for core types. */ public final class RubyBasicObject extends RubyDynamicObject { + public static final MethodHandles.Lookup LOOKUP = MethodHandles.lookup(); + // Same number of inline fields as DynamicObjectBasic @DynamicField private long primitive1; @DynamicField private long primitive2; diff --git a/src/main/java/org/truffleruby/core/cast/ToSymbolNode.java b/src/main/java/org/truffleruby/core/cast/ToSymbolNode.java index 967d314ede74..a1a4d5960f85 100644 --- a/src/main/java/org/truffleruby/core/cast/ToSymbolNode.java +++ b/src/main/java/org/truffleruby/core/cast/ToSymbolNode.java @@ -49,8 +49,8 @@ static RubySymbol symbol(RubySymbol symbol) { @Specialization(guards = "str == cachedStr", limit = "getCacheLimit()") static RubySymbol javaString(String str, - @Cached(value = "str") String cachedStr, - @Cached(value = "getSymbol(cachedStr)") RubySymbol rubySymbol) { + @Cached("str") String cachedStr, + @Cached("getSymbol(cachedStr)") RubySymbol rubySymbol) { return rubySymbol; } @@ -66,10 +66,10 @@ static RubySymbol javaStringUncached(Node node, String str) { limit = "getCacheLimit()") static RubySymbol rubyString(Node node, Object str, @Cached @Exclusive RubyStringLibrary strings, - @Cached(value = "asTruffleStringUncached(str)") TruffleString cachedTString, - @Cached(value = "strings.getEncoding(this, str)") RubyEncoding cachedEncoding, + @Cached("asTruffleStringUncached(str)") TruffleString cachedTString, + @Cached("strings.getEncoding($node, str)") RubyEncoding cachedEncoding, @Cached StringHelperNodes.EqualSameEncodingNode equalNode, - @Cached(value = "getSymbol(node, cachedTString, cachedEncoding)") RubySymbol rubySymbol) { + @Cached("getSymbol(node, cachedTString, cachedEncoding)") RubySymbol rubySymbol) { return rubySymbol; } diff --git a/src/main/java/org/truffleruby/core/encoding/EncodingConverterNodes.java b/src/main/java/org/truffleruby/core/encoding/EncodingConverterNodes.java index d4a1711c2d8d..9b3e891580ac 100644 --- a/src/main/java/org/truffleruby/core/encoding/EncodingConverterNodes.java +++ b/src/main/java/org/truffleruby/core/encoding/EncodingConverterNodes.java @@ -452,7 +452,7 @@ static Object setReplacement(RubyEncodingConverter encodingConverter, Object rep @Cached TruffleString.GetInternalByteArrayNode bytesNode, @Cached RubyStringLibrary libReplacement, @Cached ToStrNode toStrNode, - @Bind("this") Node node) { + @Bind Node node) { final var replacementAsString = toStrNode.execute(node, replacement); var tstring = libReplacement.getTString(node, replacementAsString); var encoding = libReplacement.getEncoding(node, replacementAsString); diff --git a/src/main/java/org/truffleruby/core/encoding/EncodingNodes.java b/src/main/java/org/truffleruby/core/encoding/EncodingNodes.java index 15e4973e1830..df470db92269 100644 --- a/src/main/java/org/truffleruby/core/encoding/EncodingNodes.java +++ b/src/main/java/org/truffleruby/core/encoding/EncodingNodes.java @@ -383,7 +383,7 @@ public abstract static class GetActualEncodingPrimitiveNode extends PrimitiveArr static RubyEncoding getActualEncoding(Object string, @Cached GetActualEncodingNode getActualEncodingNode, @Cached RubyStringLibrary libString, - @Bind("this") Node node) { + @Bind Node node) { return getActualEncodingNode.execute(node, libString.getTString(node, string), libString.getEncoding(node, string)); } @@ -544,7 +544,7 @@ public abstract static class DummyEncodingNode extends EncodingCreationNode { static RubyArray createDummyEncoding(Object nameObject, @Cached RubyStringLibrary strings, @Cached ToJavaStringNode toJavaStringNode, - @Bind("this") Node node) { + @Bind Node node) { final String name = toJavaStringNode.execute(node, nameObject); final RubyEncoding newEncoding = createDummy(node, name); @@ -603,7 +603,7 @@ static RubyEncoding checkEncodingStringString(Object first, Object second, @Cached RubyStringLibrary libSecond, @Cached InlinedBranchProfile errorProfile, @Cached NegotiateCompatibleStringEncodingNode negotiateCompatibleStringEncodingNode, - @Bind("this") Node node) { + @Bind Node node) { final RubyEncoding firstEncoding = libFirst.getEncoding(node, first); final RubyEncoding secondEncoding = libSecond.getEncoding(node, second); diff --git a/src/main/java/org/truffleruby/core/format/convert/StringToPointerNode.java b/src/main/java/org/truffleruby/core/format/convert/StringToPointerNode.java index 2e673447fd6c..e44f945200b6 100644 --- a/src/main/java/org/truffleruby/core/format/convert/StringToPointerNode.java +++ b/src/main/java/org/truffleruby/core/format/convert/StringToPointerNode.java @@ -40,7 +40,7 @@ long toPointer(Nil nil) { static long toPointer(VirtualFrame frame, Object string, @Cached CExtNodes.StringToNativeNode stringToNativeNode, @Cached RubyStringLibrary strings, - @Bind("this") Node node) { + @Bind Node node) { final Pointer pointer = stringToNativeNode.executeToNative(node, string, true); diff --git a/src/main/java/org/truffleruby/core/format/convert/ToLongNode.java b/src/main/java/org/truffleruby/core/format/convert/ToLongNode.java index c00968494f2d..61dd4608ba9b 100644 --- a/src/main/java/org/truffleruby/core/format/convert/ToLongNode.java +++ b/src/main/java/org/truffleruby/core/format/convert/ToLongNode.java @@ -80,7 +80,7 @@ static long toLong(VirtualFrame frame, Object object, @Cached DispatchNode toIntNode, @Cached("create(true)") ToLongNode redoNode, @Cached InlinedBranchProfile noConversionAvailable, - @Bind("this") Node node) { + @Bind Node node) { Object result = toIntNode.call(PRIVATE_RETURN_MISSING, object, "to_int"); if (result == DispatchNode.MISSING) { diff --git a/src/main/java/org/truffleruby/core/format/write/bytes/WriteBase64StringNode.java b/src/main/java/org/truffleruby/core/format/write/bytes/WriteBase64StringNode.java index be469d426b8a..79cb68eb0abd 100644 --- a/src/main/java/org/truffleruby/core/format/write/bytes/WriteBase64StringNode.java +++ b/src/main/java/org/truffleruby/core/format/write/bytes/WriteBase64StringNode.java @@ -36,7 +36,7 @@ public WriteBase64StringNode(int length, boolean ignoreStar) { @Specialization Object write(VirtualFrame frame, Object string, - @Bind("this") Node node, + @Bind Node node, @Cached RubyStringLibrary libString, @Cached TruffleString.GetInternalByteArrayNode byteArrayNode) { var tstring = libString.getTString(node, string); diff --git a/src/main/java/org/truffleruby/core/format/write/bytes/WriteBitStringNode.java b/src/main/java/org/truffleruby/core/format/write/bytes/WriteBitStringNode.java index d81f8f538b07..e1b9430da428 100644 --- a/src/main/java/org/truffleruby/core/format/write/bytes/WriteBitStringNode.java +++ b/src/main/java/org/truffleruby/core/format/write/bytes/WriteBitStringNode.java @@ -74,7 +74,7 @@ public WriteBitStringNode(ByteOrder byteOrder, boolean star, int length) { @Specialization Object write(VirtualFrame frame, Object string, - @Bind("this") Node node, + @Bind Node node, @Cached RubyStringLibrary libString, @Cached TruffleString.GetInternalByteArrayNode byteArrayNode) { var tstring = libString.getTString(node, string); diff --git a/src/main/java/org/truffleruby/core/format/write/bytes/WriteBytesNode.java b/src/main/java/org/truffleruby/core/format/write/bytes/WriteBytesNode.java index 035e498a5a8b..2b80696ff277 100644 --- a/src/main/java/org/truffleruby/core/format/write/bytes/WriteBytesNode.java +++ b/src/main/java/org/truffleruby/core/format/write/bytes/WriteBytesNode.java @@ -31,7 +31,7 @@ static Object write(VirtualFrame frame, byte[] bytes) { @Specialization(guards = "libString.isRubyString(node, string)", limit = "1") static Object writeString(VirtualFrame frame, Object string, - @Bind("this") Node node, + @Bind Node node, @Cached RubyStringLibrary libString, @Cached TruffleString.GetInternalByteArrayNode getInternalByteArrayNode) { var tstring = libString.getTString(node, string); diff --git a/src/main/java/org/truffleruby/core/format/write/bytes/WriteHexStringNode.java b/src/main/java/org/truffleruby/core/format/write/bytes/WriteHexStringNode.java index 1488a3a7fecb..92db67b45c56 100644 --- a/src/main/java/org/truffleruby/core/format/write/bytes/WriteHexStringNode.java +++ b/src/main/java/org/truffleruby/core/format/write/bytes/WriteHexStringNode.java @@ -72,7 +72,7 @@ public WriteHexStringNode(ByteOrder byteOrder, int length) { @Specialization Object write(VirtualFrame frame, Object string, - @Bind("this") Node node, + @Bind Node node, @Cached RubyStringLibrary libString, @Cached TruffleString.GetInternalByteArrayNode byteArrayNode) { var tstring = libString.getTString(node, string); diff --git a/src/main/java/org/truffleruby/core/format/write/bytes/WriteMIMEStringNode.java b/src/main/java/org/truffleruby/core/format/write/bytes/WriteMIMEStringNode.java index bdad71c3191f..232713ac3bd0 100644 --- a/src/main/java/org/truffleruby/core/format/write/bytes/WriteMIMEStringNode.java +++ b/src/main/java/org/truffleruby/core/format/write/bytes/WriteMIMEStringNode.java @@ -74,7 +74,7 @@ Object write(Nil nil) { @Specialization(guards = "libString.isRubyString(node, string)", limit = "1") static Object write(VirtualFrame frame, Object string, - @Bind("this") Node node, + @Bind Node node, @Bind("length") int boundLength, @Cached RubyStringLibrary libString, @Cached TruffleString.GetInternalByteArrayNode byteArrayNode) { diff --git a/src/main/java/org/truffleruby/core/format/write/bytes/WritePaddedBytesNode.java b/src/main/java/org/truffleruby/core/format/write/bytes/WritePaddedBytesNode.java index b045b98a2fee..798cfd52b407 100644 --- a/src/main/java/org/truffleruby/core/format/write/bytes/WritePaddedBytesNode.java +++ b/src/main/java/org/truffleruby/core/format/write/bytes/WritePaddedBytesNode.java @@ -41,7 +41,7 @@ public WritePaddedBytesNode(boolean leftJustified) { @Specialization Object write(VirtualFrame frame, int padding, int precision, Object string, - @Bind("this") Node node, + @Bind Node node, @Cached RubyStringLibrary libString, @Cached TruffleString.CodePointLengthNode codePointLengthNode, @Cached TruffleString.CodePointIndexToByteIndexNode codePointIndexToByteIndexNode, diff --git a/src/main/java/org/truffleruby/core/format/write/bytes/WriteUUStringNode.java b/src/main/java/org/truffleruby/core/format/write/bytes/WriteUUStringNode.java index 854555ecc533..ae9f8798e8b6 100644 --- a/src/main/java/org/truffleruby/core/format/write/bytes/WriteUUStringNode.java +++ b/src/main/java/org/truffleruby/core/format/write/bytes/WriteUUStringNode.java @@ -37,7 +37,7 @@ public WriteUUStringNode(int length, boolean ignoreStar) { @Specialization Object write(VirtualFrame frame, Object string, - @Bind("this") Node node, + @Bind Node node, @Cached RubyStringLibrary libString, @Cached TruffleString.GetInternalByteArrayNode byteArrayNode) { var tstring = libString.getTString(node, string); diff --git a/src/main/java/org/truffleruby/core/hash/HashNodes.java b/src/main/java/org/truffleruby/core/hash/HashNodes.java index 45d077ec0d16..cc4f3f9420bf 100644 --- a/src/main/java/org/truffleruby/core/hash/HashNodes.java +++ b/src/main/java/org/truffleruby/core/hash/HashNodes.java @@ -329,7 +329,7 @@ static Object delete(RubyHash hash, Object key, Object maybeBlock, @Cached CallBlockNode yieldNode, @Cached @Exclusive InlinedConditionProfile hasValue, @Cached @Exclusive InlinedConditionProfile hasBlock, - @Bind("this") Node node) { + @Bind Node node) { final Object value = hashes.delete(hash.store, hash, key); if (hasValue.profile(node, value != null)) { return value; diff --git a/src/main/java/org/truffleruby/core/hash/RubyHash.java b/src/main/java/org/truffleruby/core/hash/RubyHash.java index aa34d82a7ee7..8c5c9faa6b5c 100644 --- a/src/main/java/org/truffleruby/core/hash/RubyHash.java +++ b/src/main/java/org/truffleruby/core/hash/RubyHash.java @@ -131,7 +131,7 @@ public Object accept(Frame frame, Object hash, Object key) { public final boolean isHashEntryExisting(Object key, @CachedLibrary("this.store") HashStoreLibrary hashStores, @Cached @Shared ForeignToRubyNode toRuby, - @Bind("$node") Node node) { + @Bind Node node) { return hashStores.lookupOrDefault(store, null, this, toRuby.execute(node, key), NULL_PROVIDER) != null; } @@ -156,7 +156,7 @@ public Object readHashValue(Object key, // @Exclusive to fix truffle-interpreted-performance warning @Cached @Exclusive ForeignToRubyNode toRuby, @Cached InlinedConditionProfile unknownKey, - @Bind("$node") Node node) + @Bind Node node) throws UnknownKeyException { final Object value = hashStores.lookupOrDefault(store, null, this, toRuby.execute(node, key), NULL_PROVIDER); if (unknownKey.profile(node, value == null)) { @@ -169,7 +169,7 @@ public Object readHashValue(Object key, public Object readHashValueOrDefault(Object key, Object defaultValue, @CachedLibrary("this.store") HashStoreLibrary hashStores, @Cached @Shared ForeignToRubyNode toRuby, - @Bind("$node") Node node) { + @Bind Node node) { return hashStores .lookupOrDefault(store, null, this, toRuby.execute(node, key), new DefaultProvider(defaultValue)); } @@ -179,7 +179,7 @@ public void writeHashEntry(Object key, Object value, @Cached @Exclusive DispatchNode set, @Cached @Shared IsFrozenNode isFrozenNode, @Cached @Shared ForeignToRubyNode toRuby, - @Bind("$node") Node node) + @Bind Node node) throws UnsupportedMessageException { if (isFrozenNode.execute(this)) { throw UnsupportedMessageException.create(); @@ -193,7 +193,7 @@ public void removeHashEntry(Object key, @Cached @Shared IsFrozenNode isFrozenNode, @CachedLibrary("this") InteropLibrary interop, @Cached @Shared ForeignToRubyNode toRuby, - @Bind("$node") Node node) + @Bind Node node) throws UnsupportedMessageException, UnknownKeyException { if (isFrozenNode.execute(this)) { throw UnsupportedMessageException.create(); diff --git a/src/main/java/org/truffleruby/core/hash/library/BucketsHashStore.java b/src/main/java/org/truffleruby/core/hash/library/BucketsHashStore.java index bc3f2c467416..4f80a1359352 100644 --- a/src/main/java/org/truffleruby/core/hash/library/BucketsHashStore.java +++ b/src/main/java/org/truffleruby/core/hash/library/BucketsHashStore.java @@ -220,7 +220,7 @@ static void appendToLookupChain(Entry[] entries, Entry entry, int bucketIndex) { protected Object lookupOrDefault(Frame frame, RubyHash hash, Object key, PEBiFunction defaultNode, @Cached @Shared LookupEntryNode lookup, @Cached @Exclusive InlinedConditionProfile found, - @Bind("$node") Node node) { + @Bind Node node) { final Entry[] entries = this.entries; final HashLookupResult hashLookupResult = lookup.execute(hash, entries, key); @@ -242,7 +242,7 @@ protected boolean set(RubyHash hash, Object key, Object value, boolean byIdentit @Cached @Exclusive InlinedConditionProfile bucketCollision, @Cached @Exclusive InlinedConditionProfile appending, @Cached @Exclusive InlinedConditionProfile resize, - @Bind("$node") Node node) { + @Bind Node node) { assert verify(hash); final Object key2 = freezeHashKeyIfNeeded.executeFreezeIfNeeded(node, key, byIdentity); @@ -291,7 +291,7 @@ protected boolean set(RubyHash hash, Object key, Object value, boolean byIdentit protected Object delete(RubyHash hash, Object key, @Cached @Shared LookupEntryNode lookup, @Cached @Exclusive InlinedConditionProfile missing, - @Bind("$node") Node node) { + @Bind Node node) { assert verify(hash); final Entry[] entries = this.entries; @@ -312,7 +312,7 @@ protected Object delete(RubyHash hash, Object key, @ExportMessage protected Object deleteLast(RubyHash hash, Object key, @Cached @Exclusive InlinedConditionProfile singleEntry, - @Bind("$node") Node node) { + @Bind Node node) { assert verify(hash); final Entry[] entries = this.entries; @@ -380,7 +380,7 @@ protected Object eachEntrySafe(RubyHash hash, EachEntryCallback callback, Object @ExportMessage protected void replace(RubyHash hash, RubyHash dest, @Cached @Exclusive PropagateSharingNode propagateSharing, - @Bind("$node") Node node) { + @Bind Node node) { if (hash == dest) { return; } diff --git a/src/main/java/org/truffleruby/core/hash/library/CompactHashStore.java b/src/main/java/org/truffleruby/core/hash/library/CompactHashStore.java index da8e06903931..312f57b9bffe 100644 --- a/src/main/java/org/truffleruby/core/hash/library/CompactHashStore.java +++ b/src/main/java/org/truffleruby/core/hash/library/CompactHashStore.java @@ -165,7 +165,7 @@ Object lookupOrDefault(Frame frame, RubyHash hash, Object key, PEBiFunction defa @Cached @Shared GetIndexPosForKeyNode getIndexPosForKeyNode, @Cached @Shared HashingNodes.ToHash hashFunction, @Cached @Exclusive InlinedConditionProfile keyNotFound, - @Bind("$node") Node node) { + @Bind Node node) { int keyHash = hashFunction.execute(key, hash.compareByIdentity); int indexPos = getIndexPosForKeyNode.execute(node, key, keyHash, hash.compareByIdentity, index, kvStore, false); @@ -185,7 +185,7 @@ boolean set(RubyHash hash, Object key, Object value, boolean byIdentity, @Cached @Exclusive PropagateSharingNode propagateSharingForKey, @Cached @Exclusive PropagateSharingNode propagateSharingForVal, @Cached SetKvAtNode setKv, - @Bind("$node") Node node) { + @Bind Node node) { var frozenKey = freezeKey.executeFreezeIfNeeded(node, key, byIdentity); int keyHash = hashFunction.execute(frozenKey, byIdentity); int indexPos = getIndexPosForKeyNode.execute(node, frozenKey, keyHash, byIdentity, index, kvStore, true); @@ -202,7 +202,7 @@ Object delete(RubyHash hash, Object key, @Cached @Shared GetIndexPosForKeyNode getIndexPosForKeyNode, @Cached @Shared HashingNodes.ToHash hashFunction, @Cached @Exclusive InlinedConditionProfile keyNotFound, - @Bind("$node") Node node) { + @Bind Node node) { int keyHash = hashFunction.execute(key, hash.compareByIdentity); int indexPos = getIndexPosForKeyNode.execute(node, key, keyHash, hash.compareByIdentity, index, kvStore, false); if (keyNotFound.profile(node, indexPos == KEY_NOT_FOUND)) { @@ -218,7 +218,7 @@ Object deleteLast(RubyHash hash, Object key, @Cached @Shared HashingNodes.ToHash hashFunction, @Cached @Shared GetIndexPosFromKeyPosNode getIndexPosFromKeyPosNode, @Cached @Shared InlinedLoopConditionProfile nonNullKeyNotYetFound, - @Bind("$node") Node node) { + @Bind Node node) { assert hash.size > 0; int keyPos = firstNonNullKeyPosFromEnd(nonNullKeyNotYetFound, node); Object lastKey = kvStore[keyPos]; @@ -239,7 +239,7 @@ RubyArray shift(RubyHash hash, @Cached @Shared HashingNodes.ToHash hashFunction, @Cached @Shared GetIndexPosFromKeyPosNode getIndexPosFromKeyPosNode, @Cached @Shared InlinedLoopConditionProfile nonNullKeyNotYetFound, - @Bind("$node") Node node) { + @Bind Node node) { assert hash.size > 0; int keyPos = firstNonNullKeyPosFromBeginning(nonNullKeyNotYetFound, node); @@ -255,7 +255,7 @@ RubyArray shift(RubyHash hash, Object eachEntry(RubyHash hash, EachEntryCallback callback, Object state, @Cached @Exclusive InlinedConditionProfile keyNotNull, @Cached @Exclusive InlinedLoopConditionProfile loopProfile, - @Bind("$node") Node node) { + @Bind Node node) { int i = 0; int callbackIdx = 0; try { @@ -281,7 +281,7 @@ Object eachEntrySafe(RubyHash hash, EachEntryCallback callback, Object state, void replace(RubyHash hash, RubyHash dest, @Cached @Exclusive PropagateSharingNode propagateSharing, @Cached @Exclusive InlinedConditionProfile noReplaceNeeded, - @Bind("$node") Node node) { + @Bind Node node) { if (noReplaceNeeded.profile(node, hash == dest)) { return; } @@ -302,7 +302,7 @@ void rehash(RubyHash hash, @Cached @Exclusive InlinedConditionProfile slotUsed, @Cached @Exclusive InlinedLoopConditionProfile loopProfile, @CachedLibrary("this") HashStoreLibrary hashlib, - @Bind("$node") Node node) { + @Bind Node node) { Object[] oldKvStore = this.kvStore; int oldKvStoreInsertionPos = this.kvStoreInsertionPos; diff --git a/src/main/java/org/truffleruby/core/hash/library/EmptyHashStore.java b/src/main/java/org/truffleruby/core/hash/library/EmptyHashStore.java index 5c23a17ef6b9..86decb229405 100644 --- a/src/main/java/org/truffleruby/core/hash/library/EmptyHashStore.java +++ b/src/main/java/org/truffleruby/core/hash/library/EmptyHashStore.java @@ -79,7 +79,7 @@ protected Object eachEntrySafe(RubyHash hash, EachEntryCallback callback, Object @ExportMessage protected void replace(RubyHash hash, RubyHash dest, @Cached PropagateSharingNode propagateSharing, - @Bind("$node") Node node) { + @Bind Node node) { if (hash == dest) { return; } diff --git a/src/main/java/org/truffleruby/core/hash/library/PackedHashStoreLibrary.java b/src/main/java/org/truffleruby/core/hash/library/PackedHashStoreLibrary.java index 0287e437c8e3..4cedcdaf5651 100644 --- a/src/main/java/org/truffleruby/core/hash/library/PackedHashStoreLibrary.java +++ b/src/main/java/org/truffleruby/core/hash/library/PackedHashStoreLibrary.java @@ -185,7 +185,7 @@ static boolean setFirst(Object[] store, RubyHash hash, Object key, Object value, @Cached @Shared HashingNodes.ToHash hashNode, @Cached @Shared PropagateSharingNode propagateSharingKey, @Cached @Shared PropagateSharingNode propagateSharingValue, - @Bind("this") Node node) { + @Bind Node node) { final Object key2 = freezeHashKeyIfNeeded.executeFreezeIfNeeded(node, key, byIdentity); propagateSharingKey.execute(node, hash, key2); @@ -205,7 +205,7 @@ static boolean set(Object[] store, RubyHash hash, Object key, Object value, bool @Cached @Shared CompareHashKeysNode compareHashKeys, @CachedLibrary(limit = "hashStrategyLimit()") HashStoreLibrary hashes, @Cached InlinedConditionProfile withinCapacity, - @Bind("this") Node node) { + @Bind Node node) { assert verify(store, hash); final int size = hash.size; @@ -249,7 +249,7 @@ static boolean set(Object[] store, RubyHash hash, Object key, Object value, bool static Object delete(Object[] store, RubyHash hash, Object key, @Cached @Shared HashingNodes.ToHash hashNode, @Cached @Shared CompareHashKeysNode compareHashKeys, - @Bind("$node") Node node) { + @Bind Node node) { assert verify(store, hash); final int hashed = hashNode.execute(key, hash.compareByIdentity); @@ -325,7 +325,7 @@ static Object eachEntrySafe(Object[] store, RubyHash hash, EachEntryCallback cal @ExportMessage static void replace(Object[] store, RubyHash hash, RubyHash dest, @Cached @Exclusive PropagateSharingNode propagateSharing, - @Bind("$node") Node node) { + @Bind Node node) { if (hash == dest) { return; } @@ -362,7 +362,7 @@ static RubyArray shift(Object[] store, RubyHash hash, static void rehash(Object[] store, RubyHash hash, @Cached @Shared CompareHashKeysNode compareHashKeys, @Cached @Shared HashingNodes.ToHash hashNode, - @Bind("$node") Node node) { + @Bind Node node) { assert verify(store, hash); int size = hash.size; @@ -431,7 +431,7 @@ public abstract static class LookupPackedEntryNode extends RubyBaseNode { static Object getConstantIndexPackedArray(RubyHash hash, Object key, int hashed, PEBiFunction defaultValueNode, @Cached ReferenceEqualNode refEqual, @Cached("isCompareByIdentity(hash)") boolean cachedByIdentity, - @Bind("this") Node node, + @Bind Node node, @Cached("index(node, refEqual, hash, key, hashed, cachedByIdentity)") int cachedIndex) { final Object[] store = (Object[]) hash.store; @@ -475,7 +475,7 @@ Object getPackedArray(Frame frame, RubyHash hash, Object key, int hashed, PEBiFu @Cached CompareHashKeysNode compareHashKeys, @Cached InlinedBranchProfile notInHashProfile, @Cached InlinedConditionProfile byIdentityProfile, - @Bind("$node") Node node) { + @Bind Node node) { final boolean compareByIdentity = byIdentityProfile.profile(node, hash.compareByIdentity); final Object[] store = (Object[]) hash.store; diff --git a/src/main/java/org/truffleruby/core/inlined/InlinedAtNode.java b/src/main/java/org/truffleruby/core/inlined/InlinedAtNode.java index f200cb388a59..b8d852717471 100644 --- a/src/main/java/org/truffleruby/core/inlined/InlinedAtNode.java +++ b/src/main/java/org/truffleruby/core/inlined/InlinedAtNode.java @@ -39,7 +39,7 @@ static Object arrayAt(VirtualFrame frame, RubyArray array, int index, @Cached LookupMethodOnSelfNode lookupNode, @Cached ArrayIndexNodes.ReadNormalizedNode readNormalizedNode, @Cached InlinedConditionProfile denormalized, - @Bind("this") Node node) { + @Bind Node node) { if (denormalized.profile(node, index < 0)) { index += array.size; } diff --git a/src/main/java/org/truffleruby/core/inlined/InlinedByteSizeNode.java b/src/main/java/org/truffleruby/core/inlined/InlinedByteSizeNode.java index 61150a005c12..cde38f3fc11c 100644 --- a/src/main/java/org/truffleruby/core/inlined/InlinedByteSizeNode.java +++ b/src/main/java/org/truffleruby/core/inlined/InlinedByteSizeNode.java @@ -39,7 +39,7 @@ public InlinedByteSizeNode(RubyLanguage language, RubyCallNodeParameters callNod int byteSize(VirtualFrame frame, RubyString self, @Cached @Shared LookupMethodOnSelfNode lookupNode, @Cached @Exclusive RubyStringLibrary libString, - @Bind("this") Node node) { + @Bind Node node) { return libString.byteLength(node, self); } @@ -49,7 +49,7 @@ int byteSize(VirtualFrame frame, RubyString self, int byteSizeImmutable(VirtualFrame frame, ImmutableRubyString self, @Cached @Shared LookupMethodOnSelfNode lookupNode, @Cached @Exclusive RubyStringLibrary libString, - @Bind("this") Node node) { + @Bind Node node) { return libString.byteLength(node, self); } diff --git a/src/main/java/org/truffleruby/core/inlined/InlinedIndexGetNode.java b/src/main/java/org/truffleruby/core/inlined/InlinedIndexGetNode.java index caf78ca84ed1..d698d9d2de01 100644 --- a/src/main/java/org/truffleruby/core/inlined/InlinedIndexGetNode.java +++ b/src/main/java/org/truffleruby/core/inlined/InlinedIndexGetNode.java @@ -39,7 +39,7 @@ static Object arrayRead(VirtualFrame frame, RubyArray array, int index, @Cached LookupMethodOnSelfNode lookupNode, @Cached ArrayIndexNodes.ReadNormalizedNode readNormalizedNode, @Cached InlinedConditionProfile denormalized, - @Bind("this") Node node) { + @Bind Node node) { if (denormalized.profile(node, index < 0)) { index += array.size; } diff --git a/src/main/java/org/truffleruby/core/inlined/InlinedIndexSetNode.java b/src/main/java/org/truffleruby/core/inlined/InlinedIndexSetNode.java index 4352423abe57..a3e0d596ef47 100644 --- a/src/main/java/org/truffleruby/core/inlined/InlinedIndexSetNode.java +++ b/src/main/java/org/truffleruby/core/inlined/InlinedIndexSetNode.java @@ -45,7 +45,7 @@ public InlinedIndexSetNode(RubyLanguage language, RubyCallNodeParameters callNod static Object arrayWrite(VirtualFrame frame, RubyArray array, int index, Object value, @Cached LookupMethodOnSelfNode lookupNode, @Cached InlinedConditionProfile denormalized, - @Bind("this") Node node, + @Bind Node node, @Bind("normalize(node, array, index, denormalized)") int normalizedIndex, @Cached ArrayWriteNormalizedNode writeNode) { return writeNode.executeWrite(array, normalizedIndex, value); diff --git a/src/main/java/org/truffleruby/core/inlined/InlinedNotNode.java b/src/main/java/org/truffleruby/core/inlined/InlinedNotNode.java index 07b93153bf34..ebeaf2605e58 100644 --- a/src/main/java/org/truffleruby/core/inlined/InlinedNotNode.java +++ b/src/main/java/org/truffleruby/core/inlined/InlinedNotNode.java @@ -36,7 +36,7 @@ public InlinedNotNode(RubyLanguage language, RubyCallNodeParameters callNodePara static boolean not(VirtualFrame frame, Object self, @Cached LookupMethodOnSelfNode lookupNode, @Cached BooleanCastNode booleanCastNode, - @Bind("this") Node node) { + @Bind Node node) { return !booleanCastNode.execute(node, self); } diff --git a/src/main/java/org/truffleruby/core/kernel/KernelNodes.java b/src/main/java/org/truffleruby/core/kernel/KernelNodes.java index 4cc1452dd431..c46cf0178f38 100644 --- a/src/main/java/org/truffleruby/core/kernel/KernelNodes.java +++ b/src/main/java/org/truffleruby/core/kernel/KernelNodes.java @@ -249,7 +249,7 @@ static Object findFile(Object featureString, @Cached TruffleString.FromJavaStringNode fromJavaStringNode, @Cached RubyStringLibrary libFeatureString, @Cached ToJavaStringNode toJavaStringNode, - @Bind("this") Node node) { + @Bind Node node) { String feature = toJavaStringNode.execute(node, featureString); final String expandedPath = getContext(node).getFeatureLoader().findFeature(feature); if (expandedPath == null) { @@ -267,7 +267,7 @@ public abstract static class GetCallerPathNode extends PrimitiveArrayArgumentsNo @Specialization(guards = "libFeature.isRubyString(node, feature)", limit = "1") @TruffleBoundary static RubyString getCallerPath(Object feature, - @Bind("this") Node node, + @Bind Node node, @Cached RubyStringLibrary libFeature, @Cached TruffleString.FromJavaStringNode fromJavaStringNode) { final String featureString = RubyGuards.getJavaString(feature); @@ -310,7 +310,7 @@ static boolean loadFeature(Object featureString, Object expandedPathString, @Cached RubyStringLibrary libFeatureString, @Cached ToJavaStringNode toJavaStringNode, @Cached RequireNode requireNode, - @Bind("this") Node node) { + @Bind Node node) { return requireNode.executeRequire( toJavaStringNode.execute(node, featureString), expandedPathString); @@ -339,7 +339,7 @@ public abstract static class BindingNode extends AlwaysInlinedMethodNode { @Specialization RubyBinding binding(Frame callerFrame, Object self, Object[] rubyArgs, RootCallTarget target, @Cached( - value = "getAdoptedNode(this).getEncapsulatingSourceSection()", + value = "getAdoptedNode($node).getEncapsulatingSourceSection()", allowUncached = true, neverDefault = false) SourceSection sourceSection) { needCallerFrame(callerFrame, target); return BindingNodes.createBinding(getContext(), getLanguage(), callerFrame.materialize(), sourceSection); @@ -375,7 +375,7 @@ public abstract static class CanonicalizePathNode extends PrimitiveArrayArgument @Specialization(guards = "strings.isRubyString(node, string)", limit = "1") @TruffleBoundary static RubyString canonicalPath(Object string, - @Bind("this") Node node, + @Bind Node node, @Cached RubyStringLibrary strings, @Cached TruffleString.FromJavaStringNode fromJavaStringNode) { final String expandedPath = getContext(node) @@ -547,7 +547,7 @@ static RubyDynamicObject copyable(Object object, Object freeze, @Cached IsFrozenNode isFrozenNode, @Cached FreezeNode freezeNode, @Cached LazySingletonClassNode lazySingletonClassNode, - @Bind("this") Node node) { + @Bind Node node) { final RubyDynamicObject newObject = copyNode.executeCopy(object); // Copy the singleton class if any. @@ -726,7 +726,7 @@ public abstract static class EvalInternalNode extends RubyBaseNode { "bindingDescriptor == getBindingDescriptor(binding)" }, limit = "getCacheLimit()") static Object evalCached(Object self, Object source, RubyBinding binding, Object file, int line, - @Bind("this") Node node, + @Bind Node node, @Cached @Exclusive RubyStringLibrary libSource, @Cached @Exclusive RubyStringLibrary libFile, @Cached("asTruffleStringUncached(source)") TruffleString cachedSource, @@ -746,7 +746,7 @@ static Object evalCached(Object self, Object source, RubyBinding binding, Object @Specialization(replaces = "evalCached") static Object evalBindingUncached(Object self, Object source, RubyBinding binding, Object file, int line, - @Bind("this") Node node, + @Bind Node node, @Cached IndirectCallNode callNode, @Cached @Exclusive RubyStringLibrary libSource, @Cached ToJavaStringNode toJavaStringNode) { @@ -863,14 +863,14 @@ long hashBignum(RubyBignum value) { @Specialization static long hashString(RubyString value, @Cached @Exclusive StringHelperNodes.HashStringNode stringHashNode, - @Bind("this") Node node) { + @Bind Node node) { return stringHashNode.execute(node, value); } @Specialization static long hashImmutableString(ImmutableRubyString value, @Cached @Exclusive StringHelperNodes.HashStringNode stringHashNode, - @Bind("this") Node node) { + @Bind Node node) { return stringHashNode.execute(node, value); } @@ -896,7 +896,7 @@ int hashRubyDynamicObject(RubyDynamicObject value) { static int hashForeign(Object value, @CachedLibrary("value") InteropLibrary interop, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { if (interop.hasIdentity(value)) { try { return interop.identityHashCode(value); @@ -1096,7 +1096,7 @@ public abstract static class AnyInstanceVariableNode extends PrimitiveArrayArgum static boolean any(RubyDynamicObject self, @CachedLibrary("self") DynamicObjectLibrary objectLibrary, @Cached InlinedConditionProfile noPropertiesProfile, - @Bind("this") Node node) { + @Bind Node node) { var shape = objectLibrary.getShape(self); if (noPropertiesProfile.profile(node, shape.getPropertyCount() == 0)) { @@ -1615,7 +1615,7 @@ public abstract static class SprintfNode extends CoreMethodArrayArgumentsNode { @Specialization(guards = "libFormat.isRubyString(this, formatAsString)", limit = "1") static RubyString sprintf(VirtualFrame frame, Object format, Object[] arguments, @Cached ToStrNode toStrNode, - @Bind("toStrNode.execute(this, format)") Object formatAsString, + @Bind("toStrNode.execute($node, format)") Object formatAsString, @Cached(parameters = "GVAR_DEBUG") ReadGlobalVariableNode readDebugGlobalNode, @Cached BooleanCastNode booleanCastNode, @Cached RubyStringLibrary libFormat, @@ -1623,7 +1623,7 @@ static RubyString sprintf(VirtualFrame frame, Object format, Object[] arguments, @Cached InlinedConditionProfile resizeProfile, @Cached TruffleString.FromByteArrayNode fromByteArrayNode, @Cached SprintfInnerNode sprintfInnerNode, - @Bind("this") Node node) { + @Bind Node node) { var tstring = libFormat.getTString(node, formatAsString); var encoding = libFormat.getEncoding(node, formatAsString); @@ -1669,7 +1669,7 @@ public abstract BytesResult execute(Node node, AbstractTruffleString format, Rub limit = "3") static BytesResult formatCached( Node node, AbstractTruffleString format, RubyEncoding encoding, Object[] arguments, boolean isDebug, - @Cached @Shared WarningNode warnNode, + @Cached(inline = false) @Shared WarningNode warnNode, @Cached("isDebug") boolean cachedIsDebug, @Cached("format.asTruffleStringUncached(encoding.tencoding)") TruffleString cachedFormat, @Cached("encoding") RubyEncoding cachedEncoding, @@ -1683,7 +1683,7 @@ static BytesResult formatCached( @Specialization(replaces = "formatCached") static BytesResult formatUncached( Node node, AbstractTruffleString format, RubyEncoding encoding, Object[] arguments, boolean isDebug, - @Cached @Shared WarningNode warnNode, + @Cached(inline = false) @Shared WarningNode warnNode, @Cached(inline = false) IndirectCallNode callPackNode) { return (BytesResult) callPackNode.call( compileFormat(format, encoding, arguments, isDebug, warnNode, node), diff --git a/src/main/java/org/truffleruby/core/method/RubyMethod.java b/src/main/java/org/truffleruby/core/method/RubyMethod.java index a42aaefb9c7c..d9f8df64f8e1 100644 --- a/src/main/java/org/truffleruby/core/method/RubyMethod.java +++ b/src/main/java/org/truffleruby/core/method/RubyMethod.java @@ -72,7 +72,7 @@ public boolean isExecutable() { public Object execute(Object[] arguments, @Cached ForeignToRubyArgumentsNode foreignToRubyArgumentsNode, @Cached CallInternalMethodNode callInternalMethodNode, - @Bind("$node") Node node) { + @Bind Node node) { final Object[] convertedArguments = foreignToRubyArgumentsNode.executeConvert(node, arguments); final Object[] frameArgs = RubyArguments.pack(null, null, method, null, receiver, nil, NoKeywordArgumentsDescriptor.INSTANCE, convertedArguments); diff --git a/src/main/java/org/truffleruby/core/module/ModuleNodes.java b/src/main/java/org/truffleruby/core/module/ModuleNodes.java index 159d5e549765..2d6daf0b5e88 100644 --- a/src/main/java/org/truffleruby/core/module/ModuleNodes.java +++ b/src/main/java/org/truffleruby/core/module/ModuleNodes.java @@ -616,7 +616,7 @@ public abstract static class AutoloadNode extends CoreMethodArrayArgumentsNode { static Object autoload(RubyModule module, Object nameObject, Object filename, @Cached NameToJavaStringNode nameToJavaStringNode, @Cached ToPathNode toPathNode, - @Bind("this") Node node, + @Bind Node node, @Bind("toPathNode.execute(node, filename)") Object filenameAsPath, @Cached RubyStringLibrary libFilename) { final var name = nameToJavaStringNode.execute(node, nameObject); @@ -704,7 +704,7 @@ static Object evalWithString(Frame callerFrame, RubyModule self, Object[] rubyAr @Cached ToStrNode toStrNode, @Cached ToIntNode toIntNode, @Cached IndirectCallNode callNode, - @Bind("this") Node node) { + @Bind Node node) { final Object sourceCode; String fileName = coreStrings(node).EVAL_FILENAME_STRING.toString(); int line = 1; @@ -1579,7 +1579,7 @@ static Object methods(Frame callerFrame, RubyModule module, Object[] rubyArgs, R @Cached @Exclusive InlinedBranchProfile errorProfile, @Cached InlinedLoopConditionProfile loopProfile, @Cached SingleValueCastNode singleValueCastNode, - @Bind("this") Node node) { + @Bind Node node) { checkNotClass(node, module, errorProfile); int i = 0; try { @@ -1664,7 +1664,7 @@ static Object methods(Frame callerFrame, RubyModule module, Object[] rubyArgs, R @Bind("getPositionalArguments(rubyArgs)") Object[] names, @Cached SetMethodVisibilityNode setMethodVisibilityNode, @Cached SingleValueCastNode singleValueCastNode, - @Bind("this") Node node) { + @Bind Node node) { for (Object name : names) { setMethodVisibilityNode.execute(node, module, name, Visibility.PUBLIC); } @@ -1707,7 +1707,7 @@ static Object methods(Frame callerFrame, RubyModule module, Object[] rubyArgs, R @Bind("getPositionalArguments(rubyArgs)") Object[] names, @Cached SetMethodVisibilityNode setMethodVisibilityNode, @Cached SingleValueCastNode singleValueCastNode, - @Bind("this") Node node) { + @Bind Node node) { for (Object name : names) { setMethodVisibilityNode.execute(node, module, name, Visibility.PRIVATE); } @@ -1984,7 +1984,7 @@ static Object methods(Frame callerFrame, RubyModule module, Object[] rubyArgs, R @Bind("getPositionalArguments(rubyArgs)") Object[] names, @Cached SetMethodVisibilityNode setMethodVisibilityNode, @Cached SingleValueCastNode singleValueCastNode, - @Bind("this") Node node) { + @Bind Node node) { for (Object name : names) { setMethodVisibilityNode.execute(node, module, name, Visibility.PROTECTED); } diff --git a/src/main/java/org/truffleruby/core/module/RubyModule.java b/src/main/java/org/truffleruby/core/module/RubyModule.java index 5e5c7777af08..2209e6eb1e29 100644 --- a/src/main/java/org/truffleruby/core/module/RubyModule.java +++ b/src/main/java/org/truffleruby/core/module/RubyModule.java @@ -9,6 +9,7 @@ */ package org.truffleruby.core.module; +import java.lang.invoke.MethodHandles; import java.util.Set; import com.oracle.truffle.api.dsl.Cached; @@ -36,6 +37,7 @@ public class RubyModule extends RubyDynamicObject implements ObjectGraphNode { public static final RubyModule[] EMPTY_ARRAY = new RubyModule[0]; + public static final MethodHandles.Lookup LOOKUP = MethodHandles.lookup(); public final ModuleFields fields; diff --git a/src/main/java/org/truffleruby/core/numeric/FloatNodes.java b/src/main/java/org/truffleruby/core/numeric/FloatNodes.java index 7d2a7faa8237..5b19908673af 100644 --- a/src/main/java/org/truffleruby/core/numeric/FloatNodes.java +++ b/src/main/java/org/truffleruby/core/numeric/FloatNodes.java @@ -379,7 +379,7 @@ public abstract static class EqualNode extends AlwaysInlinedMethodNode { @Specialization Object equal(Object self, Object[] rubyArgs, RootCallTarget target, @Cached EqualInternalNode equalInternalNode, - @Bind("this") Node node) { + @Bind Node node) { Object other = RubyArguments.getArgument(rubyArgs, 0); return equalInternalNode.execute(node, self, other); } diff --git a/src/main/java/org/truffleruby/core/numeric/IntegerNodes.java b/src/main/java/org/truffleruby/core/numeric/IntegerNodes.java index 7018e40857c8..10a619d29799 100644 --- a/src/main/java/org/truffleruby/core/numeric/IntegerNodes.java +++ b/src/main/java/org/truffleruby/core/numeric/IntegerNodes.java @@ -790,7 +790,7 @@ public abstract static class EqualNode extends AlwaysInlinedMethodNode { @Specialization static Object equal(Object self, Object[] rubyArgs, RootCallTarget target, @Cached EqualInternalNode equalInternalNode, - @Bind("this") Node node) { + @Bind Node node) { Object other = RubyArguments.getArgument(rubyArgs, 0); return equalInternalNode.execute(node, self, other); } @@ -1300,7 +1300,7 @@ Object leftShiftNeg(Object a, RubyBignum b) { static Object leftShiftCoerced(Object a, Object b, @Cached ToRubyIntegerNode toRubyIntNode, @Cached LeftShiftNode leftShiftNode, - @Bind("this") Node node) { + @Bind Node node) { return leftShiftNode.executeLeftShift(a, toRubyIntNode.execute(node, b)); } @@ -1421,7 +1421,7 @@ Object rightShiftNeg(Object a, RubyBignum b) { static Object rightShiftCoerced(Object a, Object b, @Cached ToRubyIntegerNode toRubyIntNode, @Cached RightShiftNode rightShiftNode, - @Bind("this") Node node) { + @Bind Node node) { return rightShiftNode.executeRightShift(a, toRubyIntNode.execute(node, b)); } diff --git a/src/main/java/org/truffleruby/core/objectspace/WeakKeyMapNodes.java b/src/main/java/org/truffleruby/core/objectspace/WeakKeyMapNodes.java index a17f8133e849..4e9b904cfa4a 100644 --- a/src/main/java/org/truffleruby/core/objectspace/WeakKeyMapNodes.java +++ b/src/main/java/org/truffleruby/core/objectspace/WeakKeyMapNodes.java @@ -10,6 +10,7 @@ package org.truffleruby.core.objectspace; import com.oracle.truffle.api.dsl.Cached; +import com.oracle.truffle.api.dsl.Cached.Shared; import com.oracle.truffle.api.profiles.InlinedConditionProfile; import org.truffleruby.annotations.CoreMethod; import org.truffleruby.annotations.CoreModule; @@ -121,7 +122,7 @@ public abstract static class DeleteNode extends CoreMethodArrayArgumentsNode { @Specialization Object delete(RubyWeakKeyMap map, Object key, RubyProc block, - @Cached InlinedConditionProfile isContainedProfile, + @Cached @Shared InlinedConditionProfile isContainedProfile, @Cached CallBlockNode yieldNode) { Object value = map.storage.remove(key); @@ -134,7 +135,7 @@ Object delete(RubyWeakKeyMap map, Object key, RubyProc block, @Specialization Object delete(RubyWeakKeyMap map, Object key, Nil block, - @Cached InlinedConditionProfile isContainedProfile) { + @Cached @Shared InlinedConditionProfile isContainedProfile) { Object value = map.storage.remove(key); if (isContainedProfile.profile(this, value != null)) { diff --git a/src/main/java/org/truffleruby/core/objectspace/WeakMapNodes.java b/src/main/java/org/truffleruby/core/objectspace/WeakMapNodes.java index da263bc275e8..187b11fa886b 100644 --- a/src/main/java/org/truffleruby/core/objectspace/WeakMapNodes.java +++ b/src/main/java/org/truffleruby/core/objectspace/WeakMapNodes.java @@ -10,6 +10,7 @@ package org.truffleruby.core.objectspace; import com.oracle.truffle.api.dsl.Cached; +import com.oracle.truffle.api.dsl.Cached.Shared; import com.oracle.truffle.api.profiles.InlinedConditionProfile; import org.truffleruby.RubyContext; import org.truffleruby.annotations.CoreMethod; @@ -109,7 +110,7 @@ public abstract static class DeleteNode extends CoreMethodArrayArgumentsNode { @Specialization Object delete(RubyWeakMap map, Object key, RubyProc block, - @Cached InlinedConditionProfile isContainedProfile, + @Cached @Shared InlinedConditionProfile isContainedProfile, @Cached CallBlockNode yieldNode) { Object value = map.storage.remove(new CompareByRubyIdentityWrapper(key)); @@ -122,7 +123,7 @@ Object delete(RubyWeakMap map, Object key, RubyProc block, @Specialization Object delete(RubyWeakMap map, Object key, Nil block, - @Cached InlinedConditionProfile isContainedProfile) { + @Cached @Shared InlinedConditionProfile isContainedProfile) { Object value = map.storage.remove(new CompareByRubyIdentityWrapper(key)); if (isContainedProfile.profile(this, value != null)) { diff --git a/src/main/java/org/truffleruby/core/proc/RubyProc.java b/src/main/java/org/truffleruby/core/proc/RubyProc.java index d32756f8e978..a6514f6347f7 100644 --- a/src/main/java/org/truffleruby/core/proc/RubyProc.java +++ b/src/main/java/org/truffleruby/core/proc/RubyProc.java @@ -172,7 +172,7 @@ public boolean isExecutable() { public Object execute(Object[] arguments, @Cached CallBlockNode yieldNode, @Cached ForeignToRubyArgumentsNode foreignToRubyArgumentsNode, - @Bind("$node") Node node) { + @Bind Node node) { return yieldNode.yield(node, this, foreignToRubyArgumentsNode.executeConvert(node, arguments)); } // endregion diff --git a/src/main/java/org/truffleruby/core/regexp/InterpolatedRegexpNode.java b/src/main/java/org/truffleruby/core/regexp/InterpolatedRegexpNode.java index fb300df12412..654d7a313d73 100644 --- a/src/main/java/org/truffleruby/core/regexp/InterpolatedRegexpNode.java +++ b/src/main/java/org/truffleruby/core/regexp/InterpolatedRegexpNode.java @@ -45,7 +45,7 @@ public InterpolatedRegexpNode(RubyEncoding encoding, RegexpOptions options, ToSN @Specialization RubyRegexp interpolatedRegexp(VirtualFrame frame, - @Bind("this") Node node, + @Bind Node node, @Cached("create(encoding, options)") RegexpBuilderNode builderNode, @Cached AsTruffleStringNode asTruffleStringNode, @Cached RubyStringLibrary libString) { diff --git a/src/main/java/org/truffleruby/core/regexp/RegexpNodes.java b/src/main/java/org/truffleruby/core/regexp/RegexpNodes.java index a7abbf73f38b..f3c707cc5b6d 100644 --- a/src/main/java/org/truffleruby/core/regexp/RegexpNodes.java +++ b/src/main/java/org/truffleruby/core/regexp/RegexpNodes.java @@ -84,7 +84,7 @@ static RubyString quoteGeneric(Object raw, @Cached @Exclusive RubyStringLibrary libString, @Cached ToStrNode toStrNode, @Cached QuoteNode recursive, - @Bind("this") Node node) { + @Bind Node node) { return recursive.execute(toStrNode.execute(node, raw)); } @@ -191,10 +191,10 @@ static RubyRegexp fastCompiling(Object pattern, int options, @Cached @Shared TruffleString.AsTruffleStringNode asTruffleStringNode, @Cached @Exclusive RubyStringLibrary libPattern, @Cached("asTruffleStringUncached(pattern)") TruffleString cachedPattern, - @Cached("libPattern.getEncoding(this, pattern)") RubyEncoding cachedPatternEnc, + @Cached("libPattern.getEncoding($node, pattern)") RubyEncoding cachedPatternEnc, @Cached("options") int cachedOptions, @Cached StringHelperNodes.EqualSameEncodingNode patternEqualNode, - @Bind("this") Node node, + @Bind Node node, @Cached("compile(pattern, options, node, libPattern, asTruffleStringNode, UNCACHED_BRANCH_PROFILE)") RubyRegexp regexp) { return regexp; } diff --git a/src/main/java/org/truffleruby/core/regexp/TruffleRegexpNodes.java b/src/main/java/org/truffleruby/core/regexp/TruffleRegexpNodes.java index 2ce6fb7a5753..dd35c4020a7d 100644 --- a/src/main/java/org/truffleruby/core/regexp/TruffleRegexpNodes.java +++ b/src/main/java/org/truffleruby/core/regexp/TruffleRegexpNodes.java @@ -124,7 +124,7 @@ public abstract static class RegexpCheckEncodingNode extends PrimitiveArrayArgum @Specialization static RubyEncoding regexpPrepareEncoding(RubyRegexp regexp, Object string, @Cached PrepareRegexpEncodingNode prepareRegexpEncodingNode, - @Bind("this") Node node) { + @Bind Node node) { return prepareRegexpEncodingNode.executePrepare(node, regexp, string); } @@ -308,7 +308,7 @@ public abstract static class RegexpUnionNode extends CoreMethodArrayArgumentsNod guards = "argsMatch(node, frame, cachedArgs, args, sameOrEqualNode)", limit = "getDefaultCacheLimit()") static Object fastUnion(VirtualFrame frame, RubyString str, Object sep, Object[] args, - @Bind("this") Node node, + @Bind Node node, @Cached SameOrEqualNode sameOrEqualNode, @Cached(value = "args", dimensions = 1) Object[] cachedArgs, @Cached @Exclusive RubyStringLibrary libString, @@ -827,7 +827,7 @@ static Object matchInRegion( @Cached InlinedConditionProfile zeroOffsetProfile, @Cached MatchNode matchNode, @Cached RubyStringLibrary libString, - @Bind("this") Node node) { + @Bind Node node) { Regex regex = regexp.regex; final RubyEncoding negotiatedEncoding = prepareRegexpEncodingNode.executePrepare(node, regexp, string); @@ -925,7 +925,7 @@ static Object matchInRegionTRegex( @Cached TranslateInteropExceptionNode translateInteropExceptionNode, @Cached LazyMatchInRegionNode fallbackMatchInRegionNode, @Cached LazyTruffleStringSubstringByteIndexNode substringByteIndexNode, - @Bind("this") Node node) { + @Bind Node node) { stringToTruffleStringInplaceNode.execute(node, string); final RubyEncoding negotiatedEncoding = prepareRegexpEncodingNode.executePrepare(node, regexp, string); var tstring = switchEncodingNode.execute(libString.getTString(node, string), negotiatedEncoding.tencoding); @@ -1068,7 +1068,7 @@ Object isLinearTime(RubyRegexp regexp, @Cached TRegexCompileNode tRegexCompileNode, @CachedLibrary(limit = "getInteropCacheLimit()") InteropLibrary regexInterop, @Cached TranslateInteropExceptionNode translateInteropExceptionNode, - @Bind("this") Node node) { + @Bind Node node) { final Object compiledRegex = tRegexCompileNode.executeTRegexCompile(regexp, false, regexp.encoding); if (tRegexCouldNotCompileProfile.profile(node, compiledRegex == nil)) { diff --git a/src/main/java/org/truffleruby/core/string/ImmutableRubyString.java b/src/main/java/org/truffleruby/core/string/ImmutableRubyString.java index b6af0b3d8991..a98659239ad4 100644 --- a/src/main/java/org/truffleruby/core/string/ImmutableRubyString.java +++ b/src/main/java/org/truffleruby/core/string/ImmutableRubyString.java @@ -159,7 +159,7 @@ public static final class AsString { guards = "equalNode.execute(string.tstring, libString.getEncoding(node, string), cachedTString, cachedEncoding)", limit = "getLimit()") static String asStringCached(ImmutableRubyString string, - @Bind("this") Node node, + @Bind Node node, @Cached @Shared RubyStringLibrary libString, @Cached("string.asTruffleStringUncached()") TruffleString cachedTString, @Cached("string.getEncodingUncached()") RubyEncoding cachedEncoding, @@ -174,7 +174,7 @@ static String asStringUncached(ImmutableRubyString string, @Cached TruffleString.GetByteCodeRangeNode codeRangeNode, @Cached TruffleString.ToJavaStringNode toJavaStringNode, @Cached InlinedConditionProfile binaryNonAsciiProfile, - @Bind("this") Node node) { + @Bind Node node) { var encoding = libString.getEncoding(node, string); if (binaryNonAsciiProfile.profile(node, encoding == Encodings.BINARY && !StringGuards.is7Bit(string.tstring, encoding, codeRangeNode))) { diff --git a/src/main/java/org/truffleruby/core/string/RubyString.java b/src/main/java/org/truffleruby/core/string/RubyString.java index 2ea883aa9448..56e53bc92556 100644 --- a/src/main/java/org/truffleruby/core/string/RubyString.java +++ b/src/main/java/org/truffleruby/core/string/RubyString.java @@ -134,7 +134,7 @@ public static final class AsString { guards = "equalNode.execute(string.tstring, libString.getEncoding(node, string), cachedTString, cachedEncoding)", limit = "getLimit()") static String asStringCached(RubyString string, - @Bind("this") Node node, + @Bind Node node, @Cached @Shared RubyStringLibrary libString, @Cached("string.asTruffleStringUncached()") TruffleString cachedTString, @Cached("string.getEncodingUncached()") RubyEncoding cachedEncoding, @@ -149,7 +149,7 @@ static String asStringUncached(RubyString string, @Cached TruffleString.GetByteCodeRangeNode codeRangeNode, @Cached TruffleString.ToJavaStringNode toJavaStringNode, @Cached InlinedConditionProfile binaryNonAsciiProfile, - @Bind("this") Node node) { + @Bind Node node) { var encoding = libString.getEncoding(node, string); if (binaryNonAsciiProfile.profile(node, encoding == Encodings.BINARY && !StringGuards.is7Bit(string.tstring, encoding, codeRangeNode))) { diff --git a/src/main/java/org/truffleruby/core/string/StringHelperNodes.java b/src/main/java/org/truffleruby/core/string/StringHelperNodes.java index f55d449b2e2e..7844321193f8 100644 --- a/src/main/java/org/truffleruby/core/string/StringHelperNodes.java +++ b/src/main/java/org/truffleruby/core/string/StringHelperNodes.java @@ -197,12 +197,12 @@ int countFast(Object string, TStringWithEncoding[] args, @Cached TruffleString.EqualNode equalNode, @Cached @Shared RubyStringLibrary libString, @Cached @Shared EncodingNodes.CheckStringEncodingNode checkEncodingNode, - @Bind("libString.getTString(this, string)") AbstractTruffleString tstring, - @Bind("libString.getEncoding(this, string)") RubyEncoding encoding, - @Cached("libString.getEncoding(this, string)") RubyEncoding cachedEncoding, + @Bind("libString.getTString($node, string)") AbstractTruffleString tstring, + @Bind("libString.getEncoding($node, string)") RubyEncoding encoding, + @Cached("libString.getEncoding($node, string)") RubyEncoding cachedEncoding, @Cached(value = "squeeze()", dimensions = 1) boolean[] squeeze, - @Cached("findEncoding(this, libString.getTString(this, string), libString.getEncoding(this, string), cachedArgs, checkEncodingNode)") RubyEncoding compatEncoding, - @Cached("makeTables(this, cachedArgs, squeeze, compatEncoding)") StringSupport.TrTables tables, + @Cached("findEncoding($node, libString.getTString($node, string), libString.getEncoding($node, string), cachedArgs, checkEncodingNode)") RubyEncoding compatEncoding, + @Cached("makeTables($node, cachedArgs, squeeze, compatEncoding)") StringSupport.TrTables tables, @Cached @Shared TruffleString.GetInternalByteArrayNode byteArrayNode, @Cached @Shared TruffleString.GetByteCodeRangeNode getByteCodeRangeNode) { var byteArray = byteArrayNode.execute(tstring, encoding.tencoding); @@ -326,9 +326,9 @@ static Object deleteBangFast(Node node, RubyString string, TStringWithEncoding[] @Cached(value = "args", dimensions = 1) TStringWithEncoding[] cachedArgs, @Cached(inline = false) TruffleString.EqualNode equalNode, @Cached @Exclusive RubyStringLibrary libString, - @Cached("libString.getEncoding(this, string)") RubyEncoding cachedEncoding, + @Cached("libString.getEncoding($node, string)") RubyEncoding cachedEncoding, @Cached(value = "squeeze()", dimensions = 1) boolean[] squeeze, - @Cached("findEncoding(node, libString.getTString(this, string), libString.getEncoding(this, string), cachedArgs, UNCACHED_CHECK_ENCODING_NODE)") RubyEncoding compatEncoding, + @Cached("findEncoding(node, libString.getTString($node, string), libString.getEncoding($node, string), cachedArgs, UNCACHED_CHECK_ENCODING_NODE)") RubyEncoding compatEncoding, @Cached("makeTables(node, cachedArgs, squeeze, compatEncoding)") StringSupport.TrTables tables, @Cached @Exclusive InlinedBranchProfile nullProfile) { var processedTString = processStr(node, string, squeeze, compatEncoding, tables); diff --git a/src/main/java/org/truffleruby/core/string/StringNodes.java b/src/main/java/org/truffleruby/core/string/StringNodes.java index 2bb5712a9d47..41b0451c8f3d 100644 --- a/src/main/java/org/truffleruby/core/string/StringNodes.java +++ b/src/main/java/org/truffleruby/core/string/StringNodes.java @@ -310,7 +310,7 @@ static boolean equalString(Frame callerFrame, Object self, Object[] rubyArgs, Ro @Cached NegotiateCompatibleStringEncodingNode negotiateCompatibleStringEncodingNode, @Cached StringHelperNodes.StringEqualInternalNode stringEqualInternalNode, @Bind("getArgument(rubyArgs, 0)") Object other, - @Bind("this") Node node) { + @Bind Node node) { var tstringSelf = libSelf.getTString(node, self); var encSelf = libSelf.getEncoding(node, self); var tstringOther = libOther.getTString(node, other); @@ -344,8 +344,8 @@ public abstract static class CompareNode extends PrimitiveArrayArgumentsNode { int empty(Object a, Object b, RubyEncoding compatibleEncoding, @Cached @Shared RubyStringLibrary libA, @Cached @Shared RubyStringLibrary libB, - @Bind("libA.getTString(this, a)") AbstractTruffleString first, - @Bind("libB.getTString(this, b)") AbstractTruffleString second, + @Bind("libA.getTString($node, a)") AbstractTruffleString first, + @Bind("libB.getTString($node, b)") AbstractTruffleString second, @Cached @Exclusive InlinedConditionProfile bothEmpty) { if (bothEmpty.profile(this, first.isEmpty() && second.isEmpty())) { return 0; @@ -358,8 +358,8 @@ int empty(Object a, Object b, RubyEncoding compatibleEncoding, int compatible(Object a, Object b, RubyEncoding compatibleEncoding, @Cached @Shared RubyStringLibrary libA, @Cached @Shared RubyStringLibrary libB, - @Bind("libA.getTString(this, a)") AbstractTruffleString first, - @Bind("libB.getTString(this, b)") AbstractTruffleString second, + @Bind("libA.getTString($node, a)") AbstractTruffleString first, + @Bind("libB.getTString($node, b)") AbstractTruffleString second, @Cached @Shared InlinedConditionProfile sameStringProfile, @Cached @Shared TruffleString.CompareBytesNode compareBytesNode, @Cached @Shared InlinedConditionProfile equalProfile, @@ -431,7 +431,7 @@ public abstract static class StringConcatOneNode extends CoreMethodArrayArgument @Specialization(guards = "libFirst.isRubyString(node, first)", limit = "1") static RubyString concat(RubyString string, Object first, - @Bind("this") Node node, + @Bind Node node, @Cached StringAppendPrimitiveNode stringAppendNode, @Cached RubyStringLibrary libFirst) { return stringAppendNode.executeStringAppend(string, first); @@ -463,7 +463,7 @@ RubyString concatZero(RubyString string, NotProvided first, Object[] rest) { @Specialization(guards = { "rest.length == 0", "libFirst.isRubyString(node, first)" }, limit = "1") static RubyString concat(RubyString string, Object first, Object[] rest, - @Bind("this") Node node, + @Bind Node node, @Cached StringAppendPrimitiveNode stringAppendNode, @Cached @Exclusive RubyStringLibrary libFirst) { return stringAppendNode.executeStringAppend(string, first); @@ -637,7 +637,7 @@ static Object sliceCapture(VirtualFrame frame, Object string, RubyRegexp regexp, @Cached @Exclusive InlinedConditionProfile sameThreadProfile, @Cached @Exclusive InlinedConditionProfile notMatchedProfile, @Cached @Exclusive InlinedConditionProfile captureSetProfile, - @Bind("this") Node node) { + @Bind Node node) { final Object capture = RubyGuards.wasProvided(maybeCapture) ? maybeCapture : 0; final Object matchStrPair = callNode.call( @@ -673,7 +673,7 @@ static Object slice2(Object string, Object matchStr, NotProvided length, @Cached @Exclusive DispatchNode includeNode, @Cached BooleanCastNode booleanCastNode, @Cached AsTruffleStringNode asTruffleStringNode, - @Bind("this") Node node) { + @Bind Node node) { final Object included = includeNode.call(string, "include?", matchStr); @@ -764,10 +764,10 @@ static Object caseCmpSingleByte(Node node, Object string, Object other, @Cached @Shared InlinedConditionProfile sameProfile, @Cached @Shared NegotiateCompatibleStringEncodingNode negotiateCompatibleEncodingNode, @Cached @Shared SingleByteOptimizableNode singleByteOptimizableNode, - @Bind("libString.getTString(this, string)") AbstractTruffleString selfTString, - @Bind("libString.getEncoding(this, string)") RubyEncoding selfEncoding, - @Bind("libOther.getTString(this, other)") AbstractTruffleString otherTString, - @Bind("libOther.getEncoding(this, other)") RubyEncoding otherEncoding, + @Bind("libString.getTString($node, string)") AbstractTruffleString selfTString, + @Bind("libString.getEncoding($node, string)") RubyEncoding selfEncoding, + @Bind("libOther.getTString($node, other)") AbstractTruffleString otherTString, + @Bind("libOther.getEncoding($node, other)") RubyEncoding otherEncoding, @Cached(inline = false) TruffleString.GetInternalByteArrayNode byteArraySelfNode, @Cached(inline = false) TruffleString.GetInternalByteArrayNode byteArrayOtherNode) { // Taken from org.jruby.RubyString#casecmp19. @@ -797,10 +797,10 @@ static Object caseCmp(Node node, Object string, Object other, @Cached @Shared InlinedConditionProfile sameProfile, @Cached @Shared NegotiateCompatibleStringEncodingNode negotiateCompatibleEncodingNode, @Cached @Shared SingleByteOptimizableNode singleByteOptimizableNode, - @Bind("libString.getTString(this, string)") AbstractTruffleString selfTString, - @Bind("libString.getEncoding(this, string)") RubyEncoding selfEncoding, - @Bind("libOther.getTString(this, other)") AbstractTruffleString otherTString, - @Bind("libOther.getEncoding(this, other)") RubyEncoding otherEncoding) { + @Bind("libString.getTString($node, string)") AbstractTruffleString selfTString, + @Bind("libString.getEncoding($node, string)") RubyEncoding selfEncoding, + @Bind("libOther.getTString($node, other)") AbstractTruffleString otherTString, + @Bind("libOther.getEncoding($node, other)") RubyEncoding otherEncoding) { // Taken from org.jruby.RubyString#casecmp19 final RubyEncoding encoding = negotiateCompatibleEncodingNode.execute(node, selfTString, selfEncoding, @@ -1057,7 +1057,7 @@ Object downcaseAsciiCodePoints(RubyString string, int caseMappingOptions, @Cached @Shared RubyStringLibrary libString, @Cached("createUpperToLower()") StringHelperNodes.InvertAsciiCaseNode invertAsciiCaseNode, @Bind("string.tstring") AbstractTruffleString tstring, - @Bind("libString.getEncoding(this, string)") RubyEncoding encoding) { + @Bind("libString.getEncoding($node, string)") RubyEncoding encoding) { if (dummyEncodingProfile.profile(encoding.isDummy)) { throw new RaiseException( getContext(), @@ -1077,7 +1077,7 @@ Object downcaseMultiByteComplex(RubyString string, int caseMappingOptions, @Cached TruffleString.GetInternalByteArrayNode byteArrayNode, @Cached InlinedConditionProfile modifiedProfile, @Bind("string.tstring") AbstractTruffleString tstring, - @Bind("libString.getEncoding(this, string)") RubyEncoding encoding) { + @Bind("libString.getEncoding($node, string)") RubyEncoding encoding) { if (dummyEncodingProfile.profile(encoding.isDummy)) { throw new RaiseException( getContext(), @@ -1120,7 +1120,7 @@ static Object eachByte(Object string, RubyProc block, @Cached TruffleString.MaterializeNode materializeNode, @Cached TruffleString.ReadByteNode readByteNode, @Cached CallBlockNode yieldNode, - @Bind("this") Node node) { + @Bind Node node) { var tstring = strings.getTString(node, string); var encoding = strings.getEncoding(node, string).tencoding; @@ -1144,7 +1144,7 @@ public abstract static class StringBytesNode extends CoreMethodArrayArgumentsNod // use separate specialization instances for getTString() in the loop @Specialization(guards = "strings.seen(node, string)", limit = "2") static RubyArray bytesWithoutBlock(Object string, Nil block, - @Bind("this") Node node, + @Bind Node node, @Cached RubyStringLibrary strings, @Cached TruffleString.MaterializeNode materializeNode, @Cached TruffleString.ReadByteNode readByteNode) { @@ -1349,7 +1349,7 @@ RubyString immutable(RubyString string, RubyEncoding newEncoding, @Cached @Shared RubyStringLibrary profileEncoding, @Cached TruffleString.ForceEncodingNode forceEncodingNode, @Bind("string.tstring") AbstractTruffleString tstring, - @Bind("libString.getEncoding(this, string)") RubyEncoding encoding) { + @Bind("libString.getEncoding($node, string)") RubyEncoding encoding) { var newEncodingProfiled = profileEncoding.profileEncoding(this, newEncoding); var newTString = forceEncodingNode.execute(tstring, encoding.tencoding, newEncodingProfiled.tencoding); string.setTString(newTString, newEncodingProfiled); @@ -1363,7 +1363,7 @@ RubyString mutableManaged(RubyString string, RubyEncoding newEncoding, @Cached @Shared RubyStringLibrary profileEncoding, @Cached MutableTruffleString.ForceEncodingNode forceEncodingNode, @Bind("string.tstring") AbstractTruffleString tstring, - @Bind("libString.getEncoding(this, string)") RubyEncoding encoding) { + @Bind("libString.getEncoding($node, string)") RubyEncoding encoding) { var newEncodingProfiled = profileEncoding.profileEncoding(this, newEncoding); var newTString = forceEncodingNode.execute(tstring, encoding.tencoding, newEncodingProfiled.tencoding); string.setTString(newTString, newEncodingProfiled); @@ -1378,7 +1378,7 @@ RubyString mutableNative(RubyString string, RubyEncoding newEncoding, @Cached TruffleString.GetInternalNativePointerNode getInternalNativePointerNode, @Cached MutableTruffleString.FromNativePointerNode fromNativePointerNode, @Bind("string.tstring") AbstractTruffleString tstring, - @Bind("libString.getEncoding(this, string)") RubyEncoding encoding) { + @Bind("libString.getEncoding($node, string)") RubyEncoding encoding) { var newEncodingProfiled = profileEncoding.profileEncoding(this, newEncoding); var currentEncoding = encoding.tencoding; var pointer = (Pointer) getInternalNativePointerNode.execute(tstring, currentEncoding); @@ -1395,7 +1395,7 @@ static RubyString forceEncodingString(RubyString string, Object newEncoding, @Cached ToJavaStringNode toJavaStringNode, @Cached InlinedBranchProfile errorProfile, @Cached @Exclusive ForceEncodingNode forceEncodingNode, - @Bind("this") Node node) { + @Bind Node node) { final String stringName = toJavaStringNode.execute(node, newEncoding); final RubyEncoding rubyEncoding = getContext(node).getEncodingManager().getRubyEncoding(stringName); @@ -1413,7 +1413,7 @@ static RubyString forceEncodingString(RubyString string, Object newEncoding, static RubyString forceEncoding(RubyString string, Object newEncoding, @Cached ToStrNode toStrNode, @Cached @Exclusive ForceEncodingNode forceEncodingNode, - @Bind("this") Node node) { + @Bind Node node) { return forceEncodingNode.execute(string, toStrNode.execute(node, newEncoding)); } } @@ -1492,7 +1492,7 @@ RubyString initialize(RubyString string, Object from, Object encoding, static RubyString initialize(VirtualFrame frame, RubyString string, Object from, Object encoding, @Cached @Exclusive RubyStringLibrary stringLibrary, @Cached ToStrNode toStrNode, - @Bind("this") Node node) { + @Bind Node node) { final Object stringFrom = toStrNode.execute(node, from); string.setTString(stringLibrary.getTString(node, stringFrom), stringLibrary.getEncoding(node, stringFrom)); return string; @@ -1537,7 +1537,7 @@ Object initializeCopyImmutable(RubyString self, Object from, @Cached @Shared RubyStringLibrary stringsFrom, @Cached @Shared WriteObjectFieldNode writeAssociatedNode, @Cached @Shared StringHelperNodes.StringGetAssociatedNode stringGetAssociatedNode, - @Bind("stringsFrom.getTString(this, from)") AbstractTruffleString tstring) { + @Bind("stringsFrom.getTString($node, from)") AbstractTruffleString tstring) { self.setTString(tstring, stringsFrom.getEncoding(this, from)); final Object associated = stringGetAssociatedNode.execute(this, from); @@ -1555,7 +1555,7 @@ Object initializeCopyMutable(RubyString self, Object from, @Cached @Shared WriteObjectFieldNode writeAssociatedNode, @Cached @Shared StringHelperNodes.StringGetAssociatedNode stringGetAssociatedNode, @Cached MutableTruffleString.SubstringByteIndexNode copyMutableTruffleStringNode, - @Bind("stringsFrom.getTString(this, from)") AbstractTruffleString tstring) { + @Bind("stringsFrom.getTString($node, from)") AbstractTruffleString tstring) { var encoding = stringsFrom.getEncoding(this, from); var tencoding = encoding.tencoding; int byteLength = tstring.byteLength(tencoding); @@ -1624,7 +1624,7 @@ static Object lstripBangSingleByte(RubyString string, @Cached InlinedBranchProfile nonSpaceCodePointProfile, @Cached InlinedBranchProfile badCodePointProfile, @Cached InlinedConditionProfile noopProfile, - @Bind("this") Node node) { + @Bind Node node) { var tstring = string.tstring; var encoding = getActualEncodingNode.execute(node, tstring, libString.getEncoding(node, string)); var tencoding = encoding.tencoding; @@ -1764,7 +1764,7 @@ static Object rstripBangNonEmptyString(RubyString string, @Cached InlinedBranchProfile badCodePointProfile, @Cached TruffleString.SubstringByteIndexNode substringNode, @Cached @Exclusive InlinedConditionProfile noopProfile, - @Bind("this") Node node) { + @Bind Node node) { var tstring = string.tstring; var encoding = getActualEncodingNode.execute(node, tstring, libString.getEncoding(node, string)); var tencoding = encoding.tencoding; @@ -1836,8 +1836,8 @@ public abstract static class ScrubNode extends PrimitiveArrayArgumentsNode { RubyString scrubAsciiCompat(Object string, RubyProc block, @Cached @Shared RubyStringLibrary strings, @Cached @Exclusive TruffleString.ByteLengthOfCodePointNode byteLengthOfCodePointNode, - @Bind("strings.getTString(this, string)") AbstractTruffleString tstring, - @Bind("strings.getEncoding(this, string)") RubyEncoding encoding, + @Bind("strings.getTString($node, string)") AbstractTruffleString tstring, + @Bind("strings.getEncoding($node, string)") RubyEncoding encoding, @Cached @Shared CallBlockNode yieldNode) { final Encoding enc = encoding.jcoding; var tencoding = encoding.tencoding; @@ -1921,8 +1921,8 @@ RubyString scrubAsciiCompat(Object string, RubyProc block, RubyString scrubAsciiIncompatible(Object string, RubyProc block, @Cached @Shared RubyStringLibrary strings, @Cached @Exclusive TruffleString.ByteLengthOfCodePointNode byteLengthOfCodePointNode, - @Bind("strings.getTString(this, string)") AbstractTruffleString tstring, - @Bind("strings.getEncoding(this, string)") RubyEncoding encoding, + @Bind("strings.getTString($node, string)") AbstractTruffleString tstring, + @Bind("strings.getEncoding($node, string)") RubyEncoding encoding, @Cached @Shared CallBlockNode yieldNode) { final Encoding enc = encoding.jcoding; var tencoding = encoding.tencoding; @@ -2004,7 +2004,7 @@ Object swapcaseAsciiCodePoints(RubyString string, int caseMappingOptions, @Cached @Shared RubyStringLibrary libString, @Cached("createSwapCase()") StringHelperNodes.InvertAsciiCaseNode invertAsciiCaseNode, @Bind("string.tstring") AbstractTruffleString tstring, - @Bind("libString.getEncoding(this, string)") RubyEncoding encoding) { + @Bind("libString.getEncoding($node, string)") RubyEncoding encoding) { if (dummyEncodingProfile.profile(encoding.isDummy)) { throw new RaiseException( getContext(), @@ -2024,7 +2024,7 @@ Object swapcaseMultiByteComplex(RubyString string, int caseMappingOptions, @Cached TruffleString.GetInternalByteArrayNode byteArrayNode, @Cached InlinedConditionProfile modifiedProfile, @Bind("string.tstring") AbstractTruffleString tstring, - @Bind("libString.getEncoding(this, string)") RubyEncoding encoding) { + @Bind("libString.getEncoding($node, string)") RubyEncoding encoding) { // Taken from org.jruby.RubyString#swapcase_bang19. if (dummyEncodingProfile.profile(encoding.isDummy)) { throw new RaiseException( @@ -2366,7 +2366,7 @@ Object squeezeBangZeroArgs(RubyString string, Object[] args, static Object squeezeBang(RubyString string, Object[] args, @Cached CheckStringEncodingNode checkEncodingNode, @Cached ToStrNode toStrNode, - @Bind("this") Node node) { + @Bind Node node) { // Taken from org.jruby.RubyString#squeeze_bang19. final Object[] otherStrings = new Object[args.length]; @@ -2509,7 +2509,7 @@ Object sum(Object string, NotProvided bits, static Object sum(Object string, Object bits, @Cached ToLongNode toLongNode, @Cached SumNode sumNode, - @Bind("this") Node node) { + @Bind Node node) { return sumNode.executeSum(string, toLongNode.execute(node, bits)); } @@ -2573,7 +2573,7 @@ public abstract static class ToSymNode extends PrimitiveArrayArgumentsNode { "preserveSymbol == cachedPreserveSymbol" }, limit = "getDefaultCacheLimit()") static RubySymbol toSymCached(Object string, boolean preserveSymbol, - @Bind("this") Node node, + @Bind Node node, @Cached @Exclusive RubyStringLibrary strings, @Cached("asTruffleStringUncached(string)") TruffleString cachedTString, @Cached("strings.getEncoding(node, string)") RubyEncoding cachedEncoding, @@ -2588,7 +2588,7 @@ static RubySymbol toSymCached(Object string, boolean preserveSymbol, @Specialization(guards = "!isBrokenCodeRange(tstring, encoding, codeRangeNode)", replaces = "toSymCached", limit = "1") static RubySymbol toSym(Object string, boolean preserveSymbol, - @Bind("this") Node node, + @Bind Node node, @Cached @Exclusive RubyStringLibrary strings, @Bind("strings.getTString(node, string)") AbstractTruffleString tstring, @Bind("strings.getEncoding(node, string)") RubyEncoding encoding) { @@ -2597,7 +2597,7 @@ static RubySymbol toSym(Object string, boolean preserveSymbol, @Specialization(guards = "isBrokenCodeRange(tstring, encoding, codeRangeNode)", limit = "1") static RubySymbol toSymBroken(Object string, boolean preserveSymbol, - @Bind("this") Node node, + @Bind Node node, @Cached @Exclusive RubyStringLibrary strings, @Bind("strings.getTString(node, string)") AbstractTruffleString tstring, @Bind("strings.getEncoding(node, string)") RubyEncoding encoding) { @@ -2616,7 +2616,7 @@ public abstract static class ReverseBangNode extends CoreMethodArrayArgumentsNod RubyString reverseNoOp(RubyString string, @Cached @Shared RubyStringLibrary libString, @Bind("string.tstring") AbstractTruffleString tstring, - @Bind("libString.getEncoding(this, string)") RubyEncoding encoding) { + @Bind("libString.getEncoding($node, string)") RubyEncoding encoding) { return string; } @@ -2629,7 +2629,7 @@ RubyString reverseSingleByteOptimizable(RubyString string, @Cached @Shared SingleByteOptimizableNode singleByteOptimizableNode, @Cached @Shared TruffleString.GetInternalByteArrayNode byteArrayNode, @Bind("string.tstring") AbstractTruffleString tstring, - @Bind("libString.getEncoding(this, string)") RubyEncoding encoding) { + @Bind("libString.getEncoding($node, string)") RubyEncoding encoding) { var tencoding = encoding.tencoding; var byteArray = byteArrayNode.execute(tstring, tencoding); @@ -2654,7 +2654,7 @@ RubyString reverse(RubyString string, @Cached TruffleString.ByteLengthOfCodePointNode byteLengthOfCodePointNode, @Cached @Shared TruffleString.GetInternalByteArrayNode byteArrayNode, @Bind("string.tstring") AbstractTruffleString tstring, - @Bind("libString.getEncoding(this, string)") RubyEncoding encoding) { + @Bind("libString.getEncoding($node, string)") RubyEncoding encoding) { // Taken from org.jruby.RubyString#reverse! var tencoding = encoding.tencoding; @@ -2762,7 +2762,7 @@ Object trSBangEmpty(RubyString self, Object fromStr, Object toStr) { static Object trSBang(RubyString self, Object fromStr, Object toStr, @Cached ToStrNode fromStrNode, @Cached ToStrNode toStrNode, - @Bind("this") Node node, + @Bind Node node, @Bind("fromStrNode.execute(node, fromStr)") Object fromStrAsString, @Bind("toStrNode.execute(node, toStr)") Object toStrAsString, @Cached CheckStringEncodingNode checkEncodingNode, @@ -2792,8 +2792,8 @@ RubyArray unpackCached(Object string, Object format, Object offsetObject, @Cached @Shared RubyStringLibrary libString, @Cached @Shared RubyStringLibrary libFormat, @Cached("asTruffleStringUncached(format)") TruffleString cachedFormat, - @Cached("libFormat.getEncoding(this, format)") RubyEncoding cachedEncoding, - @Cached("create(compileFormat(this, getJavaString(format)))") DirectCallNode callUnpackNode, + @Cached("libFormat.getEncoding($node, format)") RubyEncoding cachedEncoding, + @Cached("create(compileFormat($node, getJavaString(format)))") DirectCallNode callUnpackNode, @Cached StringHelperNodes.EqualNode equalNode, @Cached @Shared StringHelperNodes.StringGetAssociatedNode stringGetAssociatedNode, @Cached @Shared TruffleString.GetInternalByteArrayNode byteArrayNode) { @@ -2845,7 +2845,7 @@ static RubyArray unpackUncached(Object string, Object format, Object offsetObjec @Cached IndirectCallNode callUnpackNode, @Cached @Shared StringHelperNodes.StringGetAssociatedNode stringGetAssociatedNode, @Cached @Shared TruffleString.GetInternalByteArrayNode byteArrayNode, - @Bind("this") Node node) { + @Bind Node node) { var byteArray = byteArrayNode.execute(libString.getTString(node, string), libString.getTEncoding(node, string)); @@ -2916,7 +2916,7 @@ Object upcaseAsciiCodePoints(RubyString string, int caseMappingOptions, @Cached @Shared RubyStringLibrary libString, @Cached("createLowerToUpper()") StringHelperNodes.InvertAsciiCaseNode invertAsciiCaseNode, @Bind("string.tstring") AbstractTruffleString tstring, - @Bind("libString.getEncoding(this, string)") RubyEncoding encoding) { + @Bind("libString.getEncoding($node, string)") RubyEncoding encoding) { if (dummyEncodingProfile.profile(encoding.isDummy)) { throw new RaiseException( getContext(), @@ -2936,7 +2936,7 @@ Object upcaseMultiByteComplex(RubyString string, int caseMappingOptions, @Cached TruffleString.GetInternalByteArrayNode byteArrayNode, @Cached InlinedConditionProfile modifiedProfile, @Bind("string.tstring") AbstractTruffleString tstring, - @Bind("libString.getEncoding(this, string)") RubyEncoding encoding) { + @Bind("libString.getEncoding($node, string)") RubyEncoding encoding) { var tencoding = encoding.tencoding; if (dummyEncodingProfile.profile(encoding.isDummy)) { @@ -2998,7 +2998,7 @@ Object capitalizeAsciiCodePoints(RubyString string, int caseMappingOptions, @Cached @Exclusive InlinedConditionProfile firstCharIsLowerProfile, @Cached @Exclusive InlinedConditionProfile modifiedProfile, @Bind("string.tstring") AbstractTruffleString tstring, - @Bind("libString.getEncoding(this, string)") RubyEncoding encoding) { + @Bind("libString.getEncoding($node, string)") RubyEncoding encoding) { var tencoding = encoding.tencoding; if (emptyStringProfile.profile(tstring.isEmpty())) { @@ -3038,7 +3038,7 @@ Object capitalizeMultiByteComplex(RubyString string, int caseMappingOptions, @Cached @Exclusive InlinedConditionProfile modifiedProfile, @Cached TruffleString.GetInternalByteArrayNode byteArrayNode, @Bind("string.tstring") AbstractTruffleString tstring, - @Bind("libString.getEncoding(this, string)") RubyEncoding encoding) { + @Bind("libString.getEncoding($node, string)") RubyEncoding encoding) { if (dummyEncodingProfile.profile(encoding.isDummy)) { throw new RaiseException( @@ -3169,7 +3169,7 @@ public abstract static class StringAwkSplitPrimitiveNode extends PrimitiveArrayA @Specialization(guards = "is7Bit(tstring, encoding, codeRangeNode)", limit = "1") static Object stringAwkSplitAsciiOnly(Object string, int limit, Object block, - @Bind("this") Node node, + @Bind Node node, @Cached @Exclusive RubyStringLibrary strings, @Cached @Exclusive InlinedConditionProfile executeBlockProfile, @Cached @Exclusive InlinedConditionProfile growArrayProfile, @@ -3252,7 +3252,7 @@ static Object stringAwkSplitAsciiOnly(Object string, int limit, Object block, @Specialization(guards = "isValid(tstring, encoding, codeRangeNode)", limit = "1") static Object stringAwkSplit(Object string, int limit, Object block, - @Bind("this") Node node, + @Bind Node node, @Cached @Exclusive RubyStringLibrary strings, @Cached @Exclusive InlinedConditionProfile executeBlockProfile, @Cached @Exclusive InlinedConditionProfile growArrayProfile, @@ -3335,7 +3335,7 @@ static Object stringAwkSplit(Object string, int limit, Object block, @Specialization(guards = "isBrokenCodeRange(tstring, encoding, codeRangeNode)", limit = "1") static Object broken(Object string, int limit, Object block, - @Bind("this") Node node, + @Bind Node node, @Cached @Exclusive RubyStringLibrary strings, @Bind("strings.getTString(node, string)") AbstractTruffleString tstring, @Bind("strings.getEncoding(node, string)") RubyEncoding encoding) { @@ -3427,7 +3427,7 @@ public abstract static class StringChrAtPrimitiveNode extends PrimitiveArrayArgu guards = "indexOutOfBounds(strings.byteLength(node, string), byteIndex)", limit = "1") static Object stringChrAtOutOfBounds(Object string, int byteIndex, @Cached @Exclusive RubyStringLibrary strings, - @Bind("this") Node node) { + @Bind Node node) { return nil; } @@ -3437,7 +3437,7 @@ static Object stringChrAtOutOfBounds(Object string, int byteIndex, "is7Bit(tstring, encoding, codeRangeNode)" }, limit = "1") static Object stringChrAtSingleByte(Object string, int byteIndex, - @Bind("this") Node node, + @Bind Node node, @Cached @Exclusive RubyStringLibrary strings, @Cached @Shared TruffleString.GetByteCodeRangeNode codeRangeNode, @Cached @Exclusive TruffleString.SubstringByteIndexNode substringByteIndexNode, @@ -3452,7 +3452,7 @@ static Object stringChrAtSingleByte(Object string, int byteIndex, "!is7Bit(originalTString, originalEncoding, codeRangeNode)" }, limit = "1") static Object stringChrAt(Object string, int byteIndex, - @Bind("this") Node node, + @Bind Node node, @Cached @Exclusive RubyStringLibrary strings, @Cached @Shared TruffleString.GetByteCodeRangeNode codeRangeNode, @Cached GetActualEncodingNode getActualEncodingNode, @@ -3767,7 +3767,7 @@ public abstract static class StringIndexPrimitiveNode extends PrimitiveArrayArgu @Specialization(guards = "patternTString.isEmpty()", limit = "1") static int stringIndexEmptyPattern(Object rubyString, Object rubyPattern, int byteOffset, - @Bind("this") Node node, + @Bind Node node, @Cached @Exclusive RubyStringLibrary libPattern, @Bind("libPattern.getTString(node, rubyPattern)") AbstractTruffleString patternTString) { assert byteOffset >= 0; @@ -3776,7 +3776,7 @@ static int stringIndexEmptyPattern(Object rubyString, Object rubyPattern, int by @Specialization(guards = "!patternTString.isEmpty()", limit = "1") static Object findStringByteIndex(Object rubyString, Object rubyPattern, int byteOffset, - @Bind("this") Node node, + @Bind Node node, @Cached @Exclusive RubyStringLibrary libString, @Cached @Exclusive RubyStringLibrary libPattern, @Cached CheckStringEncodingNode checkEncodingNode, @@ -3816,8 +3816,8 @@ public abstract static class StringByteCharacterIndexNode extends PrimitiveArray int byteIndexToCodePointIndex(Object string, int byteIndex, @Cached RubyStringLibrary libString, @Cached TruffleString.ByteIndexToCodePointIndexNode byteIndexToCodePointIndexNode, - @Bind("libString.getTString(this, string)") AbstractTruffleString tstring, - @Bind("libString.getEncoding(this, string)") RubyEncoding encoding) { + @Bind("libString.getTString($node, string)") AbstractTruffleString tstring, + @Bind("libString.getEncoding($node, string)") RubyEncoding encoding) { return byteIndexToCodePointIndexNode.execute(tstring, 0, byteIndex, encoding.tencoding); } } @@ -3844,10 +3844,10 @@ Object singleByteOptimizable( @Cached @Shared SingleByteOptimizableNode singleByteOptimizableNode, @Cached @Shared RubyStringLibrary libString, @Cached @Shared RubyStringLibrary libPattern, - @Bind("libString.getTString(this, rubyString)") AbstractTruffleString string, - @Bind("libString.getEncoding(this, rubyString)") RubyEncoding stringEncoding, - @Bind("libPattern.getTString(this, rubyPattern)") AbstractTruffleString pattern, - @Bind("libPattern.getEncoding(this, rubyPattern)") RubyEncoding patternEncoding, + @Bind("libString.getTString($node, rubyString)") AbstractTruffleString string, + @Bind("libString.getEncoding($node, rubyString)") RubyEncoding stringEncoding, + @Bind("libPattern.getTString($node, rubyPattern)") AbstractTruffleString pattern, + @Bind("libPattern.getEncoding($node, rubyPattern)") RubyEncoding patternEncoding, @Cached TruffleString.ByteIndexOfStringNode byteIndexOfStringNode, @Cached @Shared InlinedConditionProfile foundProfile) { @@ -3874,10 +3874,10 @@ Object multiByte(Object rubyString, Object rubyPattern, RubyEncoding compatibleE @Cached @Shared SingleByteOptimizableNode singleByteOptimizableNode, @Cached @Shared RubyStringLibrary libString, @Cached @Shared RubyStringLibrary libPattern, - @Bind("libString.getTString(this, rubyString)") AbstractTruffleString string, - @Bind("libString.getEncoding(this, rubyString)") RubyEncoding stringEncoding, - @Bind("libPattern.getTString(this, rubyPattern)") AbstractTruffleString pattern, - @Bind("libPattern.getEncoding(this, rubyPattern)") RubyEncoding patternEncoding, + @Bind("libString.getTString($node, rubyString)") AbstractTruffleString string, + @Bind("libString.getEncoding($node, rubyString)") RubyEncoding stringEncoding, + @Bind("libPattern.getTString($node, rubyPattern)") AbstractTruffleString pattern, + @Bind("libPattern.getEncoding($node, rubyPattern)") RubyEncoding patternEncoding, @Cached CodePointLengthNode codePointLengthNode, @Cached TruffleString.IndexOfStringNode indexOfStringNode, @Cached @Shared InlinedConditionProfile foundProfile) { @@ -4113,7 +4113,7 @@ Object splicePrepend( @Specialization(guards = "spliceByteIndex == byteLength", limit = "1") static Object spliceAppend( RubyString string, Object other, int spliceByteIndex, int byteCountToReplace, RubyEncoding rubyEncoding, - @Bind("this") Node node, + @Bind Node node, @Cached @Exclusive RubyStringLibrary libString, @Cached @Exclusive RubyStringLibrary libOther, @Cached @Shared TruffleString.ConcatNode concatNode, @@ -4138,8 +4138,8 @@ static RubyString splice( @Cached @Exclusive TruffleString.SubstringByteIndexNode rightSubstringNode, @Cached @Shared TruffleString.ConcatNode concatNode, @Cached TruffleString.ForceEncodingNode forceEncodingNode, - @Bind("libString.byteLength(this, string)") int byteLength, - @Bind("this") Node node) { + @Bind("libString.byteLength($node, string)") int byteLength, + @Bind Node node) { var sourceTEncoding = libString.getTEncoding(node, string); var resultTEncoding = rubyEncoding.tencoding; var source = string.tstring; @@ -4254,7 +4254,7 @@ private Object bytesToInum(AbstractTruffleString tstring, RubyEncoding encoding, public abstract static class StringByteAppendPrimitiveNode extends PrimitiveArrayArgumentsNode { @Specialization(guards = "libOther.isRubyString(node, other)", limit = "1") static RubyString stringByteAppend(RubyString string, Object other, - @Bind("this") Node node, + @Bind Node node, @Cached RubyStringLibrary libString, @Cached RubyStringLibrary libOther, @Cached TruffleString.ConcatNode concatNode, @@ -4276,7 +4276,7 @@ static RubyString stringByteAppend(RubyString string, Object other, public abstract static class StringBinaryAppendNode extends PrimitiveArrayArgumentsNode { @Specialization(guards = "libOther.isRubyString(node, other)", limit = "1") static RubyString stringBinaryAppend(RubyString string, Object other, - @Bind("this") Node node, + @Bind Node node, @Cached RubyStringLibrary libString, @Cached RubyStringLibrary libOther, @Cached TruffleString.ConcatNode concatNode, @@ -4301,8 +4301,8 @@ public abstract static class StringSubstringPrimitiveNode extends PrimitiveArray @Specialization Object stringSubstringGeneric(Object string, int codePointOffset, int codePointLength, @Cached RubyStringLibrary libString, - @Bind("libString.getTString(this, string)") AbstractTruffleString tstring, - @Bind("libString.getEncoding(this, string)") RubyEncoding encoding, + @Bind("libString.getTString($node, string)") AbstractTruffleString tstring, + @Bind("libString.getEncoding($node, string)") RubyEncoding encoding, @Cached StringHelperNodes.NormalizeIndexNode normalizeIndexNode, @Cached CodePointLengthNode codePointLengthNode, @Cached TruffleString.SubstringNode substringNode, @@ -4352,7 +4352,7 @@ public abstract static class StringToNullTerminatedByteArrayNode extends Primiti @Specialization(guards = "libString.isRubyString(node, string)", limit = "1") static Object stringToNullTerminatedByteArray(Object string, - @Bind("this") Node node, + @Bind Node node, @Cached TruffleString.CopyToByteArrayNode copyToByteArrayNode, @Cached RubyStringLibrary libString) { final var encoding = libString.getEncoding(node, string); @@ -4415,7 +4415,7 @@ RubyString truncateLengthNegative(RubyString string, int newByteLength) { @Specialization(guards = { "newByteLength >= 0", "newByteLength > byteLength" }) RubyString truncateLengthTooLong(RubyString string, int newByteLength, @Cached @Shared RubyStringLibrary libString, - @Bind("libString.byteLength(this, string)") int byteLength) { + @Bind("libString.byteLength($node, string)") int byteLength) { throw new RaiseException( getContext(), coreExceptions().argumentError(formatTooLongError(newByteLength, string), this)); @@ -4425,7 +4425,7 @@ RubyString truncateLengthTooLong(RubyString string, int newByteLength, RubyString tuncate(RubyString string, int newByteLength, @Cached @Shared RubyStringLibrary libString, @Cached TruffleString.SubstringByteIndexNode substringNode, - @Bind("libString.byteLength(this, string)") int byteLength) { + @Bind("libString.byteLength($node, string)") int byteLength) { var tencoding = libString.getTEncoding(this, string); string.setTString(substringNode.execute(string.tstring, 0, newByteLength, tencoding, true)); return string; diff --git a/src/main/java/org/truffleruby/core/support/ByteArrayNodes.java b/src/main/java/org/truffleruby/core/support/ByteArrayNodes.java index 438efc0ee7fb..22c1ca5650df 100644 --- a/src/main/java/org/truffleruby/core/support/ByteArrayNodes.java +++ b/src/main/java/org/truffleruby/core/support/ByteArrayNodes.java @@ -80,7 +80,7 @@ public abstract static class PrependNode extends CoreMethodArrayArgumentsNode { @Specialization(guards = "strings.isRubyString(node, string)", limit = "1") static RubyByteArray prepend(RubyByteArray byteArray, Object string, - @Bind("this") Node node, + @Bind Node node, @Cached RubyStringLibrary strings, @Cached TruffleString.CopyToByteArrayNode copyToByteArrayNode) { final byte[] bytes = byteArray.bytes; @@ -163,8 +163,8 @@ Object getByteSingleByte(RubyByteArray byteArray, Object pattern, int start, int @Cached InlinedBranchProfile tooSmallStartProfile, @Cached InlinedBranchProfile tooLargeStartProfile, @Cached @Shared RubyStringLibrary libPattern, - @Bind("libPattern.getTString(this, pattern)") AbstractTruffleString patternTString, - @Bind("libPattern.getTEncoding(this, pattern)") TruffleString.Encoding patternEncoding) { + @Bind("libPattern.getTString($node, pattern)") AbstractTruffleString patternTString, + @Bind("libPattern.getTEncoding($node, pattern)") TruffleString.Encoding patternEncoding) { byte[] bytes = byteArray.bytes; int searchByte = readByteNode.execute(patternTString, 0, patternEncoding); @@ -191,8 +191,8 @@ Object getByte(RubyByteArray byteArray, Object pattern, int start, int length, @Cached InlinedConditionProfile noCopyProfile, @Cached InlinedConditionProfile notFoundProfile, @Cached @Shared RubyStringLibrary libPattern, - @Bind("libPattern.getTString(this, pattern)") AbstractTruffleString patternTString, - @Bind("libPattern.getTEncoding(this, pattern)") TruffleString.Encoding patternEncoding) { + @Bind("libPattern.getTString($node, pattern)") AbstractTruffleString patternTString, + @Bind("libPattern.getTEncoding($node, pattern)") TruffleString.Encoding patternEncoding) { // TODO (nirvdrum 09-June-2022): Copying the byte array here is wasteful, but ArrayUtils.indexOfWithOrMask does not accept an offset or length for the needle. // Another possibility would be to create a MutableTruffleString for the RubyByteArray and use ByteIndexOfStringNode, but that would force computation of the coderange of the byte[] final byte[] patternBytes = TStringUtils.getBytesOrCopy(this, patternTString, patternEncoding, diff --git a/src/main/java/org/truffleruby/core/support/IONodes.java b/src/main/java/org/truffleruby/core/support/IONodes.java index 0397d97f04b6..22cd7a6cfd90 100644 --- a/src/main/java/org/truffleruby/core/support/IONodes.java +++ b/src/main/java/org/truffleruby/core/support/IONodes.java @@ -135,7 +135,7 @@ public abstract static class FileFNMatchPrimitiveNode extends PrimitiveArrayArgu guards = { "stringsPattern.isRubyString(node, pattern)", "stringsPath.isRubyString(node, path)" }, limit = "1") static boolean fnmatch(Object pattern, Object path, int flags, - @Bind("this") Node node, + @Bind Node node, @Cached RubyStringLibrary stringsPattern, @Cached RubyStringLibrary stringsPath, @Cached TruffleString.GetInternalByteArrayNode getInternalByteArrayPatternNode, diff --git a/src/main/java/org/truffleruby/core/support/TypeNodes.java b/src/main/java/org/truffleruby/core/support/TypeNodes.java index 12dd9a268a32..7f987e73168b 100644 --- a/src/main/java/org/truffleruby/core/support/TypeNodes.java +++ b/src/main/java/org/truffleruby/core/support/TypeNodes.java @@ -138,7 +138,7 @@ static Object freezeSingletonObject(RubyDynamicObject self, @Cached InlinedConditionProfile singletonClassUnfrozenProfile, @Cached IsFrozenNode isFrozenMetaClassNode, @Cached @Exclusive FreezeNode freezeMetaClasNode, - @Bind("this") Node node) { + @Bind Node node) { RubyClass metaClass = metaClassNode.execute(node, self); if (metaClass.isSingleton) { if (singletonClassUnfrozenProfile.profile(node, @@ -267,7 +267,7 @@ public static ObjectInstanceVariablesNode create() { static RubyArray instanceVariables(RubyDynamicObject object, @CachedLibrary("object") DynamicObjectLibrary objectLibrary, @Cached InlinedConditionProfile noPropertiesProfile, - @Bind("this") Node node) { + @Bind Node node) { var shape = objectLibrary.getShape(object); if (noPropertiesProfile.profile(node, shape.getPropertyCount() == 0)) { @@ -529,7 +529,7 @@ static boolean other(Object value, @Cached InlinedConditionProfile numericProfile, @Cached DispatchNode isRealNode, @Cached BooleanCastNode booleanCastNode, - @Bind("this") Node node) { + @Bind Node node) { return numericProfile.profile(node, isANode.executeIsA(value, coreLibrary(node).numericClass)) && booleanCastNode.execute(node, isRealNode.call(value, "real?")); } diff --git a/src/main/java/org/truffleruby/core/symbol/SymbolNodes.java b/src/main/java/org/truffleruby/core/symbol/SymbolNodes.java index 91be81797701..071fe62534a4 100644 --- a/src/main/java/org/truffleruby/core/symbol/SymbolNodes.java +++ b/src/main/java/org/truffleruby/core/symbol/SymbolNodes.java @@ -94,9 +94,9 @@ public abstract static class HashSymbolNode extends RubyBaseNode { guards = { "isSingleContext()", "symbol == cachedSymbol", "!preInitializing" }, limit = "1") static long hashCached(Node node, RubySymbol symbol, - @Cached(value = "isPreInitializing(getContext())") boolean preInitializing, - @Cached(value = "symbol") RubySymbol cachedSymbol, - @Cached(value = "hash(node, cachedSymbol)") long cachedHash) { + @Cached("isPreInitializing(getContext())") boolean preInitializing, + @Cached("symbol") RubySymbol cachedSymbol, + @Cached("hash(node, cachedSymbol)") long cachedHash) { return cachedHash; } diff --git a/src/main/java/org/truffleruby/core/thread/ThreadNodes.java b/src/main/java/org/truffleruby/core/thread/ThreadNodes.java index 7faf90707a6e..46d516c2dbdb 100644 --- a/src/main/java/org/truffleruby/core/thread/ThreadNodes.java +++ b/src/main/java/org/truffleruby/core/thread/ThreadNodes.java @@ -686,7 +686,7 @@ static Object call( RubyThread thread, Object wrapper, Object function, Object arg, long unblocker, long unblockerArg, @CachedLibrary("wrapper") InteropLibrary receivers, @Cached TranslateInteropExceptionNode translateInteropExceptionNode, - @Bind("this") Node node, + @Bind Node node, @Cached("new(node, receivers, translateInteropExceptionNode)") BlockingCallInterruptible blockingCallInterruptible) { var context = getContext(node); final ThreadManager threadManager = context.getThreadManager(); @@ -988,7 +988,7 @@ Object runBlockingSystemCall(Object executable, RubyArray argsArray, @Cached ArrayToObjectArrayNode arrayToObjectArrayNode, @CachedLibrary(limit = "1") InteropLibrary receivers, @Cached TranslateInteropExceptionNode translateInteropExceptionNode, - @Cached("new(this, receivers, translateInteropExceptionNode)") BlockingCallInterruptible blockingCallInterruptible, + @Cached("new($node, receivers, translateInteropExceptionNode)") BlockingCallInterruptible blockingCallInterruptible, @Cached ForeignToRubyNode foreignToRubyNode) { final Object[] args = arrayToObjectArrayNode.executeToObjectArray(argsArray); final RubyThread thread = getLanguage().getCurrentThread(); diff --git a/src/main/java/org/truffleruby/core/thread/TruffleThreadNodes.java b/src/main/java/org/truffleruby/core/thread/TruffleThreadNodes.java index f22c1bc6314a..819213433e06 100644 --- a/src/main/java/org/truffleruby/core/thread/TruffleThreadNodes.java +++ b/src/main/java/org/truffleruby/core/thread/TruffleThreadNodes.java @@ -40,7 +40,7 @@ static Object findRubyCaller(RubyArray modules, @Bind("modules.getStore()") Object store, @CachedLibrary("store") ArrayStoreLibrary stores, @Cached GetSpecialVariableStorage storageNode, - @Bind("this") Node node) { + @Bind Node node) { final int modulesSize = modules.size; Object[] moduleArray = stores.boxedCopyOfRange(store, 0, modulesSize); MaterializedFrame frame = getContext(node) diff --git a/src/main/java/org/truffleruby/core/time/TimeNodes.java b/src/main/java/org/truffleruby/core/time/TimeNodes.java index 7559e4fabef8..d49cfc0dfbde 100644 --- a/src/main/java/org/truffleruby/core/time/TimeNodes.java +++ b/src/main/java/org/truffleruby/core/time/TimeNodes.java @@ -428,7 +428,7 @@ public abstract static class TimeStrftimePrimitiveNode extends PrimitiveArrayArg static RubyString timeStrftimeCached(RubyTime time, Object format, @Cached @Exclusive RubyStringLibrary libFormat, @Cached("asTruffleStringUncached(format)") TruffleString cachedFormat, - @Cached("libFormat.getEncoding(this, format)") RubyEncoding cachedEncoding, + @Cached("libFormat.getEncoding($node, format)") RubyEncoding cachedEncoding, @Cached(value = "compilePattern(cachedFormat, cachedEncoding)", dimensions = 1) Token[] pattern, @Cached StringHelperNodes.EqualSameEncodingNode equalNode, @Cached("formatCanBeFast(pattern)") boolean canUseFast, @@ -438,7 +438,7 @@ static RubyString timeStrftimeCached(RubyTime time, Object format, @Cached @Shared TruffleString.CodePointLengthNode codePointLengthNode, @Cached @Shared TruffleString.FromByteArrayNode fromByteArrayNode, @Cached @Shared ErrnoErrorNode errnoErrorNode, - @Bind("this") Node node) { + @Bind Node node) { if (canUseFast && yearIsFastProfile.profile(node, yearIsFast(time))) { var tstring = RubyDateFormatter.formatToTStringFast(pattern, time.dateTime, concatNode, fromLongNode, codePointLengthNode); diff --git a/src/main/java/org/truffleruby/debug/BindingLocalVariablesObject.java b/src/main/java/org/truffleruby/debug/BindingLocalVariablesObject.java index f58e16b58a58..f490f33eb515 100644 --- a/src/main/java/org/truffleruby/debug/BindingLocalVariablesObject.java +++ b/src/main/java/org/truffleruby/debug/BindingLocalVariablesObject.java @@ -62,7 +62,7 @@ protected Object getMembers(boolean includeInternal) { @ExportMessage protected Object readMember(String member, @Cached @Exclusive BindingNodes.LocalVariableGetNode localVariableGetNode, - @Bind("$node") Node node) + @Bind Node node) throws UnknownIdentifierException { try { return localVariableGetNode.execute(node, binding, member); @@ -74,7 +74,7 @@ protected Object readMember(String member, @ExportMessage protected void writeMember(String member, Object value, @Cached BindingNodes.LocalVariableSetNode localVariableSetNode, - @Bind("$node") Node node) throws UnknownIdentifierException { + @Bind Node node) throws UnknownIdentifierException { if (isValidLocalVariableName(member)) { localVariableSetNode.execute(node, binding, member, value); } else { @@ -86,7 +86,7 @@ protected void writeMember(String member, Object value, @ExportMessage(name = "isMemberModifiable") protected boolean memberExists(String member, @Cached @Exclusive BindingNodes.HasLocalVariableNode hasLocalVariableNode, - @Bind("$node") Node node) { + @Bind Node node) { return hasLocalVariableNode.execute(node, binding, member); } diff --git a/src/main/java/org/truffleruby/debug/RubyScope.java b/src/main/java/org/truffleruby/debug/RubyScope.java index d6ec70fa4752..df87238f83e4 100644 --- a/src/main/java/org/truffleruby/debug/RubyScope.java +++ b/src/main/java/org/truffleruby/debug/RubyScope.java @@ -128,7 +128,7 @@ static Object readSelf(RubyScope scope, String member) { @Specialization(guards = "!RECEIVER_MEMBER.equals(member)") static Object read(RubyScope scope, String member, @Cached @Exclusive BindingNodes.LocalVariableGetNode localVariableGetNode, - @Bind("this") Node node) + @Bind Node node) throws UnknownIdentifierException { try { return localVariableGetNode.execute(node, scope.binding, member); @@ -155,7 +155,7 @@ static boolean readSelf(RubyScope scope, String member) { @Specialization(guards = "!RECEIVER_MEMBER.equals(member)") static boolean isMemberReadable(RubyScope scope, String member, @Cached @Exclusive BindingNodes.HasLocalVariableNode hasLocalVariableNode, - @Bind("this") Node node) { + @Bind Node node) { return hasLocalVariableNode.execute(node, scope.binding, member); } } @@ -170,7 +170,7 @@ static boolean readSelf(RubyScope scope, String member) { @Specialization(guards = "!RECEIVER_MEMBER.equals(member)") static boolean isMemberModifiable(RubyScope scope, String member, @Cached @Exclusive BindingNodes.HasLocalVariableNode hasLocalVariableNode, - @Bind("this") Node node) { + @Bind Node node) { return hasLocalVariableNode.execute(node, scope.binding, member); } } @@ -182,7 +182,7 @@ static final class WriteMember { static void writeMember(RubyScope scope, String member, Object value, @CachedLibrary("scope") InteropLibrary interopLibrary, @Cached BindingNodes.LocalVariableSetNode localVariableSetNode, - @Bind("this") Node node) throws UnknownIdentifierException { + @Bind Node node) throws UnknownIdentifierException { if (interopLibrary.isMemberModifiable(scope, member)) { localVariableSetNode.execute(node, scope.binding, member, value); } else { diff --git a/src/main/java/org/truffleruby/debug/SingleElementArray.java b/src/main/java/org/truffleruby/debug/SingleElementArray.java index cf1e4925177a..c354b2908e58 100644 --- a/src/main/java/org/truffleruby/debug/SingleElementArray.java +++ b/src/main/java/org/truffleruby/debug/SingleElementArray.java @@ -41,7 +41,7 @@ protected long getArraySize() { @ExportMessage protected Object readArrayElement(long index, @Cached InlinedBranchProfile errorProfile, - @Bind("$node") Node node) throws InvalidArrayIndexException { + @Bind Node node) throws InvalidArrayIndexException { if (isArrayElementReadable(index)) { return element; } else { diff --git a/src/main/java/org/truffleruby/debug/SingleMemberDescriptor.java b/src/main/java/org/truffleruby/debug/SingleMemberDescriptor.java index 53ff47edbe02..99297284b1e0 100644 --- a/src/main/java/org/truffleruby/debug/SingleMemberDescriptor.java +++ b/src/main/java/org/truffleruby/debug/SingleMemberDescriptor.java @@ -48,7 +48,7 @@ protected boolean isMemberReadable(String member) { @ExportMessage protected Object readMember(String member, @Cached InlinedBranchProfile errorProfile, - @Bind("$node") Node node) throws UnknownIdentifierException { + @Bind Node node) throws UnknownIdentifierException { if (isMemberReadable(member)) { return value; } else { diff --git a/src/main/java/org/truffleruby/debug/TruffleDebugNodes.java b/src/main/java/org/truffleruby/debug/TruffleDebugNodes.java index 427ef4095b68..28dce1af2828 100644 --- a/src/main/java/org/truffleruby/debug/TruffleDebugNodes.java +++ b/src/main/java/org/truffleruby/debug/TruffleDebugNodes.java @@ -141,7 +141,7 @@ public abstract static class TStringToDebugPrintNode extends CoreMethodArrayArgu @TruffleBoundary @Specialization(guards = "strings.isRubyString(node, string)", limit = "1") static RubyString toStringDebug(Object string, - @Bind("this") Node node, + @Bind Node node, @Cached RubyStringLibrary strings, @Cached TruffleString.FromJavaStringNode fromJavaStringNode) { return createString(node, fromJavaStringNode, strings.getTString(node, string).toStringDebug(), @@ -155,7 +155,7 @@ public abstract static class FlattenStringNode extends CoreMethodArrayArgumentsN @TruffleBoundary @Specialization(guards = "libString.isRubyString(node, string)", limit = "1") static RubyString flattenString(Object string, - @Bind("this") Node node, + @Bind Node node, @Cached TruffleString.FromByteArrayNode fromByteArrayNode, @Cached RubyStringLibrary libString) { final RubyEncoding rubyEncoding = libString.getEncoding(node, string); @@ -256,7 +256,7 @@ public abstract static class ParseASTNode extends CoreMethodArrayArgumentsNode { @TruffleBoundary @Specialization(guards = "strings.isRubyString(node, code)", limit = "1") static Object ast(Object code, - @Bind("this") Node node, + @Bind Node node, @Cached RubyStringLibrary strings, @Cached TruffleString.FromJavaStringNode fromJavaStringNode) { var codeString = new TStringWithEncoding(RubyGuards.asTruffleStringUncached(code), diff --git a/src/main/java/org/truffleruby/debug/VariableNamesObject.java b/src/main/java/org/truffleruby/debug/VariableNamesObject.java index 34d5ad0475c4..6fbd3c6017c9 100644 --- a/src/main/java/org/truffleruby/debug/VariableNamesObject.java +++ b/src/main/java/org/truffleruby/debug/VariableNamesObject.java @@ -41,7 +41,7 @@ protected long getArraySize() { @ExportMessage protected Object readArrayElement(long index, @Cached InlinedBranchProfile errorProfile, - @Bind("$node") Node node) throws InvalidArrayIndexException { + @Bind Node node) throws InvalidArrayIndexException { if (isArrayElementReadable(index)) { return names[(int) index]; } else { diff --git a/src/main/java/org/truffleruby/extra/TruffleGraalNodes.java b/src/main/java/org/truffleruby/extra/TruffleGraalNodes.java index 3a9457b1ea8a..68afb931f027 100644 --- a/src/main/java/org/truffleruby/extra/TruffleGraalNodes.java +++ b/src/main/java/org/truffleruby/extra/TruffleGraalNodes.java @@ -187,7 +187,7 @@ public abstract static class BailoutNode extends PrimitiveArrayArgumentsNode { static Object bailout(Object message, @Cached RubyStringLibrary strings, @Cached ToJavaStringNode toJavaStringNode, - @Bind("this") Node node) { + @Bind Node node) { CompilerDirectives.bailout(toJavaStringNode.execute(node, message)); return nil; } diff --git a/src/main/java/org/truffleruby/extra/TruffleRubyNodes.java b/src/main/java/org/truffleruby/extra/TruffleRubyNodes.java index fb26377d8e33..66a841848d75 100644 --- a/src/main/java/org/truffleruby/extra/TruffleRubyNodes.java +++ b/src/main/java/org/truffleruby/extra/TruffleRubyNodes.java @@ -120,7 +120,7 @@ public abstract static class SynchronizedNode extends CoreMethodArrayArgumentsNo static Object synchronize(RubyDynamicObject object, RubyProc block, @Cached GetLockNode getLockNode, @Cached CallBlockNode yieldNode, - @Bind("this") Node node) { + @Bind Node node) { final ReentrantLock lock = getLockNode.execute(node, object); MutexOperations.lockInternal(getContext(node), lock, node); diff --git a/src/main/java/org/truffleruby/extra/ffi/PointerNodes.java b/src/main/java/org/truffleruby/extra/ffi/PointerNodes.java index fa86cc4ac793..e9d92da8bb16 100644 --- a/src/main/java/org/truffleruby/extra/ffi/PointerNodes.java +++ b/src/main/java/org/truffleruby/extra/ffi/PointerNodes.java @@ -342,7 +342,7 @@ static Object writeBytes(long address, Object string, int index, int length, @Cached TruffleString.CopyToNativeMemoryNode copyToNativeMemoryNode, @Cached RubyStringLibrary libString, @Cached CheckNullPointerNode checkNullPointerNode, - @Bind("this") Node node) { + @Bind Node node) { Pointer ptr = new Pointer(getContext(node), address); var tstring = libString.getTString(node, string); var encoding = libString.getTEncoding(node, string); diff --git a/src/main/java/org/truffleruby/interop/InteropNodes.java b/src/main/java/org/truffleruby/interop/InteropNodes.java index 482bd1d72800..f01cf21f9757 100644 --- a/src/main/java/org/truffleruby/interop/InteropNodes.java +++ b/src/main/java/org/truffleruby/interop/InteropNodes.java @@ -155,7 +155,7 @@ static Object interopExecuteWithoutConversion(Object receiver, RubyArray argsArr @CachedLibrary("receiver") InteropLibrary receivers, @Cached ArrayToObjectArrayNode arrayToObjectArrayNode, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { final Object[] args = arrayToObjectArrayNode.executeToObjectArray(argsArray); return InteropNodes.execute(node, receiver, args, receivers, translateInteropException); } @@ -244,13 +244,13 @@ public abstract static class EvalNode extends CoreMethodArrayArgumentsNode { "sourceEqualNode.execute(stringsSource, source, cachedSource, cachedSourceEnc)" }, limit = "getEvalCacheLimit()") static Object evalCached(Object mimeType, Object source, - @Bind("this") Node node, + @Bind Node node, @Cached @Exclusive RubyStringLibrary stringsMimeType, @Cached @Exclusive RubyStringLibrary stringsSource, @Cached("asTruffleStringUncached(mimeType)") TruffleString cachedMimeType, - @Cached("stringsMimeType.getEncoding(this, mimeType)") RubyEncoding cachedMimeTypeEnc, + @Cached("stringsMimeType.getEncoding($node, mimeType)") RubyEncoding cachedMimeTypeEnc, @Cached("asTruffleStringUncached(source)") TruffleString cachedSource, - @Cached("stringsSource.getEncoding(this, source)") RubyEncoding cachedSourceEnc, + @Cached("stringsSource.getEncoding($node, source)") RubyEncoding cachedSourceEnc, @Cached("create(parse(node, getJavaString(mimeType), getJavaString(source)))") DirectCallNode callNode, @Cached StringHelperNodes.EqualNode mimeTypeEqualNode, @Cached StringHelperNodes.EqualNode sourceEqualNode) { @@ -266,7 +266,7 @@ static Object evalUncached(Object mimeType, RubyString source, @Cached ToJavaStringNode toJavaStringMimeNode, @Cached ToJavaStringNode toJavaStringSourceNode, @Cached IndirectCallNode callNode, - @Bind("this") Node node) { + @Bind Node node) { return callNode.call(parse(node, toJavaStringMimeNode.execute(node, mimeType), toJavaStringSourceNode.execute(node, source)), EMPTY_ARGUMENTS); } @@ -297,7 +297,7 @@ public abstract static class InteropEvalNFINode extends PrimitiveArrayArgumentsN @Specialization(guards = "library.isRubyString(node, code)", limit = "1") static Object evalNFI(Object code, - @Bind("this") Node node, + @Bind Node node, @Cached RubyStringLibrary library, @Cached IndirectCallNode callNode) { return callNode.call(parse(node, code), EMPTY_ARGUMENTS); @@ -355,7 +355,7 @@ public abstract static class ExceptionCauseNode extends CoreMethodArrayArguments static Object getExceptionCause(Object receiver, @Cached TranslateInteropExceptionNode translateInteropException, @CachedLibrary("receiver") InteropLibrary receivers, - @Bind("this") Node node) { + @Bind Node node) { try { return receivers.getExceptionCause(receiver); } catch (UnsupportedMessageException e) { @@ -371,7 +371,7 @@ public abstract static class ExceptionExitStatusSourceNode extends CoreMethodArr static int getExceptionExitStatus(Object receiver, @Cached TranslateInteropExceptionNode translateInteropException, @CachedLibrary("receiver") InteropLibrary receivers, - @Bind("this") Node node) { + @Bind Node node) { try { return receivers.getExceptionExitStatus(receiver); } catch (UnsupportedMessageException e) { @@ -387,7 +387,7 @@ public abstract static class IsExceptionIncompleteSourceNode extends CoreMethodA static boolean isExceptionIncompleteSource(Object receiver, @Cached TranslateInteropExceptionNode translateInteropException, @CachedLibrary("receiver") InteropLibrary receivers, - @Bind("this") Node node) { + @Bind Node node) { try { return receivers.isExceptionIncompleteSource(receiver); } catch (UnsupportedMessageException e) { @@ -413,7 +413,7 @@ public abstract static class ExceptionMessageNode extends CoreMethodArrayArgumen static Object getExceptionMessage(Object receiver, @Cached TranslateInteropExceptionNode translateInteropException, @CachedLibrary("receiver") InteropLibrary receivers, - @Bind("this") Node node) { + @Bind Node node) { try { return receivers.getExceptionMessage(receiver); } catch (UnsupportedMessageException e) { @@ -439,7 +439,7 @@ public abstract static class ExceptionStackTraceNode extends CoreMethodArrayArgu static Object getExceptionStackTrace(Object receiver, @Cached TranslateInteropExceptionNode translateInteropException, @CachedLibrary("receiver") InteropLibrary receivers, - @Bind("this") Node node) { + @Bind Node node) { try { return receivers.getExceptionStackTrace(receiver); } catch (UnsupportedMessageException e) { @@ -455,7 +455,7 @@ public abstract static class ExceptionTypeNode extends CoreMethodArrayArgumentsN static RubySymbol getExceptionType(Object receiver, @Cached TranslateInteropExceptionNode translateInteropException, @CachedLibrary("receiver") InteropLibrary receivers, - @Bind("this") Node node) { + @Bind Node node) { try { final ExceptionType exceptionType = receivers.getExceptionType(receiver); return getLanguage(node).getSymbol(exceptionType.name()); @@ -472,7 +472,7 @@ public abstract static class ThrowExceptionNode extends CoreMethodArrayArguments static Object throwException(Object receiver, @Cached TranslateInteropExceptionNode translateInteropException, @CachedLibrary("receiver") InteropLibrary receivers, - @Bind("this") Node node) { + @Bind Node node) { try { throw receivers.throwException(receiver); } catch (UnsupportedMessageException e) { @@ -511,7 +511,7 @@ public abstract static class ExecutableNameNode extends CoreMethodArrayArguments static Object getExecutableName(Object receiver, @Cached TranslateInteropExceptionNode translateInteropException, @CachedLibrary("receiver") InteropLibrary receivers, - @Bind("this") Node node) { + @Bind Node node) { try { return receivers.getExecutableName(receiver); } catch (UnsupportedMessageException e) { @@ -528,7 +528,7 @@ static Object interopExecute(Object receiver, Object[] args, @CachedLibrary("receiver") InteropLibrary receivers, @Cached ForeignToRubyNode foreignToRubyNode, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { final Object foreign = InteropNodes.execute(node, receiver, args, receivers, translateInteropException); return foreignToRubyNode.execute(node, foreign); } @@ -542,7 +542,7 @@ public abstract static class ExecuteWithoutConversionNode extends CoreMethodArra static Object interopExecuteWithoutConversion(Object receiver, Object[] args, @CachedLibrary("receiver") InteropLibrary receivers, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { return InteropNodes.execute(node, receiver, args, receivers, translateInteropException); } } @@ -567,7 +567,7 @@ static Object newCached(Object receiver, Object[] args, @CachedLibrary("receiver") InteropLibrary receivers, @Cached ForeignToRubyNode foreignToRubyNode, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { final Object foreign; try { foreign = receivers.instantiate(receiver, args); @@ -599,7 +599,7 @@ public abstract static class ArraySizeNode extends CoreMethodArrayArgumentsNode static Object arraySize(Object receiver, @CachedLibrary("receiver") InteropLibrary receivers, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { return receivers.getArraySize(receiver); @@ -618,7 +618,7 @@ static Object readArrayElement(Object receiver, long identifier, @CachedLibrary("receiver") InteropLibrary receivers, @Cached ForeignToRubyNode foreignToRubyNode, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { final Object foreign; try { foreign = receivers.readArrayElement(receiver, identifier); @@ -637,7 +637,7 @@ public abstract static class WriteArrayElementNode extends CoreMethodArrayArgume static Object write(Object receiver, long identifier, Object value, @CachedLibrary("receiver") InteropLibrary receivers, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { receivers.writeArrayElement(receiver, identifier, value); } catch (InteropException e) { @@ -655,7 +655,7 @@ public abstract static class RemoveArrayElementNode extends CoreMethodArrayArgum static Nil readArrayElement(Object receiver, long identifier, @CachedLibrary("receiver") InteropLibrary receivers, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { receivers.removeArrayElement(receiver, identifier); } catch (InteropException e) { @@ -755,7 +755,7 @@ public abstract static class GetSourceLocationNode extends CoreMethodArrayArgume static RubySourceLocation getSourceLocation(Object receiver, @CachedLibrary("receiver") InteropLibrary receivers, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { final SourceSection sourceLocation; try { sourceLocation = receivers.getSourceLocation(receiver); @@ -786,7 +786,7 @@ public abstract static class AsStringNode extends CoreMethodArrayArgumentsNode { static String asString(Object receiver, @CachedLibrary("receiver") InteropLibrary receivers, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { return receivers.asString(receiver); } catch (InteropException e) { @@ -801,7 +801,7 @@ public abstract static class AsTruffleStringNode extends CoreMethodArrayArgument static TruffleString asTruffleString(Object receiver, @CachedLibrary("receiver") InteropLibrary receivers, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { return receivers.asTruffleString(receiver); } catch (InteropException e) { @@ -817,7 +817,7 @@ static RubyString foreignStringToRubyString(Object receiver, @CachedLibrary("receiver") InteropLibrary receivers, @Cached TranslateInteropExceptionNode translateInteropException, @Cached TruffleString.SwitchEncodingNode switchEncodingNode, - @Bind("this") Node node) { + @Bind Node node) { final TruffleString truffleString; try { truffleString = receivers.asTruffleString(receiver); @@ -870,7 +870,7 @@ public abstract static class AsBooleanNode extends CoreMethodArrayArgumentsNode static boolean asBoolean(Object receiver, @Cached TranslateInteropExceptionNode translateInteropException, @CachedLibrary("receiver") InteropLibrary receivers, - @Bind("this") Node node) { + @Bind Node node) { try { return receivers.asBoolean(receiver); } catch (InteropException e) { @@ -896,7 +896,7 @@ public abstract static class AsDateNode extends CoreMethodArrayArgumentsNode { static Object asDate(Object receiver, @CachedLibrary("receiver") InteropLibrary receivers, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { return getContext(node).getEnv().asGuestValue(receivers.asDate(receiver)); } catch (UnsupportedMessageException e) { @@ -920,7 +920,7 @@ public abstract static class AsDurationNode extends CoreMethodArrayArgumentsNode static Object asDuration(Object receiver, @CachedLibrary("receiver") InteropLibrary receivers, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { return getContext(node).getEnv().asGuestValue(receivers.asDuration(receiver)); } catch (UnsupportedMessageException e) { @@ -944,7 +944,7 @@ public abstract static class AsInstantNode extends CoreMethodArrayArgumentsNode static Object asInstant(Object receiver, @CachedLibrary("receiver") InteropLibrary receivers, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { return getContext(node).getEnv().asGuestValue(receivers.asInstant(receiver)); } catch (UnsupportedMessageException e) { @@ -968,7 +968,7 @@ public abstract static class AsTimeNode extends CoreMethodArrayArgumentsNode { static Object asTime(Object receiver, @CachedLibrary("receiver") InteropLibrary receivers, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { return getContext(node).getEnv().asGuestValue(receivers.asTime(receiver)); } catch (UnsupportedMessageException e) { @@ -992,7 +992,7 @@ public abstract static class AsTimeZoneNode extends CoreMethodArrayArgumentsNode static Object asTimeZone(Object receiver, @CachedLibrary("receiver") InteropLibrary receivers, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { return getContext(node).getEnv().asGuestValue(receivers.asTimeZone(receiver)); } catch (UnsupportedMessageException e) { @@ -1081,7 +1081,7 @@ public abstract static class AsByteNode extends CoreMethodArrayArgumentsNode { static int as(Object receiver, @CachedLibrary("receiver") InteropLibrary receivers, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { return receivers.asByte(receiver); } catch (InteropException e) { @@ -1096,7 +1096,7 @@ public abstract static class AsShortNode extends CoreMethodArrayArgumentsNode { static int as(Object receiver, @CachedLibrary("receiver") InteropLibrary receivers, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { return receivers.asShort(receiver); } catch (InteropException e) { @@ -1111,7 +1111,7 @@ public abstract static class AsIntNode extends CoreMethodArrayArgumentsNode { static int as(Object receiver, @CachedLibrary("receiver") InteropLibrary receivers, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { return receivers.asInt(receiver); } catch (InteropException e) { @@ -1126,7 +1126,7 @@ public abstract static class AsLongNode extends CoreMethodArrayArgumentsNode { static long as(Object receiver, @CachedLibrary("receiver") InteropLibrary receivers, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { return receivers.asLong(receiver); } catch (InteropException e) { @@ -1142,7 +1142,7 @@ static Object as(Object receiver, @CachedLibrary("receiver") InteropLibrary receivers, @Cached FixnumOrBignumNode fixnumOrBignumNode, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { return fixnumOrBignumNode.execute(node, receivers.asBigInteger(receiver)); } catch (InteropException e) { @@ -1157,7 +1157,7 @@ public abstract static class AsFloatNode extends CoreMethodArrayArgumentsNode { static double as(Object receiver, @CachedLibrary("receiver") InteropLibrary receivers, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { return receivers.asFloat(receiver); } catch (InteropException e) { @@ -1172,7 +1172,7 @@ public abstract static class AsDoubleNode extends CoreMethodArrayArgumentsNode { static double as(Object receiver, @CachedLibrary("receiver") InteropLibrary receivers, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { return receivers.asDouble(receiver); } catch (InteropException e) { @@ -1213,7 +1213,7 @@ public abstract static class AsPointerNode extends CoreMethodArrayArgumentsNode static long asPointer(Object receiver, @CachedLibrary("receiver") InteropLibrary receivers, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { return receivers.asPointer(receiver); } catch (InteropException e) { @@ -1260,7 +1260,7 @@ Object members(Object receiver, NotProvided internal) { static Object members(Object receiver, boolean internal, @CachedLibrary("receiver") InteropLibrary receivers, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { return receivers.getMembers(receiver, internal); } catch (InteropException e) { @@ -1307,7 +1307,7 @@ static Object readMember(Object receiver, Object identifier, @CachedLibrary("receiver") InteropLibrary receivers, @Cached TranslateInteropExceptionNode translateInteropException, @Cached ToJavaStringNode toJavaStringNode, - @Bind("this") Node node) { + @Bind Node node) { final String name = toJavaStringNode.execute(node, identifier); return InteropNodes.readMember(node, receivers, receiver, name, translateInteropException); } @@ -1321,7 +1321,7 @@ static Object write(Object receiver, Object identifier, Object value, @CachedLibrary("receiver") InteropLibrary receivers, @Cached ToJavaStringNode toJavaStringNode, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { final String name = toJavaStringNode.execute(node, identifier); try { receivers.writeMember(receiver, name, value); @@ -1374,7 +1374,7 @@ static Nil remove(Object receiver, Object identifier, @CachedLibrary("receiver") InteropLibrary receivers, @Cached ToJavaStringNode toJavaStringNode, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { final String name = toJavaStringNode.execute(node, identifier); try { receivers.removeMember(receiver, name); @@ -1422,7 +1422,7 @@ public abstract static class IsMemberReadableNode extends CoreMethodArrayArgumen static boolean isMemberReadable(Object receiver, Object name, @Cached ToJavaStringNode toJavaStringNode, @CachedLibrary("receiver") InteropLibrary receivers, - @Bind("this") Node node) { + @Bind Node node) { return receivers.isMemberReadable(receiver, toJavaStringNode.execute(node, name)); } } @@ -1433,7 +1433,7 @@ public abstract static class IsMemberModifiableNode extends CoreMethodArrayArgum static boolean isMemberModifiable(Object receiver, Object name, @Cached ToJavaStringNode toJavaStringNode, @CachedLibrary("receiver") InteropLibrary receivers, - @Bind("this") Node node) { + @Bind Node node) { return receivers.isMemberModifiable(receiver, toJavaStringNode.execute(node, name)); } } @@ -1444,7 +1444,7 @@ public abstract static class IsMemberInsertableNode extends CoreMethodArrayArgum static boolean isMemberInsertable(Object receiver, Object name, @Cached ToJavaStringNode toJavaStringNode, @CachedLibrary("receiver") InteropLibrary receivers, - @Bind("this") Node node) { + @Bind Node node) { return receivers.isMemberInsertable(receiver, toJavaStringNode.execute(node, name)); } } @@ -1455,7 +1455,7 @@ public abstract static class IsMemberRemovableNode extends CoreMethodArrayArgume static boolean isMemberRemovable(Object receiver, Object name, @Cached ToJavaStringNode toJavaStringNode, @CachedLibrary("receiver") InteropLibrary receivers, - @Bind("this") Node node) { + @Bind Node node) { return receivers.isMemberRemovable(receiver, toJavaStringNode.execute(node, name)); } } @@ -1466,7 +1466,7 @@ public abstract static class IsMemberInvocableNode extends CoreMethodArrayArgume static boolean isMemberInvocable(Object receiver, Object name, @Cached ToJavaStringNode toJavaStringNode, @CachedLibrary("receiver") InteropLibrary receivers, - @Bind("this") Node node) { + @Bind Node node) { return receivers.isMemberInvocable(receiver, toJavaStringNode.execute(node, name)); } } @@ -1477,7 +1477,7 @@ public abstract static class IsMemberInternalNode extends CoreMethodArrayArgumen static boolean isMemberInternal(Object receiver, Object name, @Cached ToJavaStringNode toJavaStringNode, @CachedLibrary("receiver") InteropLibrary receivers, - @Bind("this") Node node) { + @Bind Node node) { return receivers.isMemberInternal(receiver, toJavaStringNode.execute(node, name)); } } @@ -1488,7 +1488,7 @@ public abstract static class IsMemberWritableNode extends CoreMethodArrayArgumen static boolean isMemberWritable(Object receiver, Object name, @Cached ToJavaStringNode toJavaStringNode, @CachedLibrary("receiver") InteropLibrary receivers, - @Bind("this") Node node) { + @Bind Node node) { return receivers.isMemberWritable(receiver, toJavaStringNode.execute(node, name)); } } @@ -1499,7 +1499,7 @@ public abstract static class IsMemberExistingNode extends CoreMethodArrayArgumen static boolean isMemberExisting(Object receiver, Object name, @Cached ToJavaStringNode toJavaStringNode, @CachedLibrary("receiver") InteropLibrary receivers, - @Bind("this") Node node) { + @Bind Node node) { return receivers.isMemberExisting(receiver, toJavaStringNode.execute(node, name)); } } @@ -1510,7 +1510,7 @@ public abstract static class HasMemberReadSideEffectsNode extends CoreMethodArra static boolean hasMemberReadSideEffects(Object receiver, Object name, @Cached ToJavaStringNode toJavaStringNode, @CachedLibrary("receiver") InteropLibrary receivers, - @Bind("this") Node node) { + @Bind Node node) { return receivers.hasMemberReadSideEffects(receiver, toJavaStringNode.execute(node, name)); } } @@ -1521,7 +1521,7 @@ public abstract static class HasMemberWriteSideEffectsNode extends CoreMethodArr static boolean hasMemberWriteSideEffects(Object receiver, Object name, @Cached ToJavaStringNode toJavaStringNode, @CachedLibrary("receiver") InteropLibrary receivers, - @Bind("this") Node node) { + @Bind Node node) { return receivers.hasMemberWriteSideEffects(receiver, toJavaStringNode.execute(node, name)); } } @@ -1584,7 +1584,7 @@ public abstract static class GetLanguageNode extends CoreMethodArrayArgumentsNod static Object getLanguage(Object receiver, @CachedLibrary("receiver") InteropLibrary receivers, @Cached FromJavaStringNode fromJavaStringNode, - @Bind("this") Node node) { + @Bind Node node) { if (!receivers.hasLanguage(receiver)) { return nil; } @@ -1818,7 +1818,7 @@ static Object metaObject(Object value, @CachedLibrary("value") InteropLibrary interop, @Cached InlinedBranchProfile errorProfile, @Cached LogicalClassNode logicalClassNode, - @Bind("this") Node node) { + @Bind Node node) { if (interop.hasMetaObject(value)) { try { return interop.getMetaObject(value); @@ -1847,7 +1847,7 @@ public abstract static class DeclaringMetaObjectNode extends CoreMethodArrayArgu static Object declaringMetaObject(Object value, @CachedLibrary("value") InteropLibrary interop, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { return interop.getDeclaringMetaObject(value); } catch (UnsupportedMessageException e) { @@ -1862,7 +1862,7 @@ public abstract static class IsMetaInstanceNode extends CoreMethodArrayArguments static boolean isMetaInstance(Object metaObject, Object instance, @CachedLibrary("metaObject") InteropLibrary interop, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { return interop.isMetaInstance(metaObject, instance); } catch (UnsupportedMessageException e) { @@ -1877,7 +1877,7 @@ public abstract static class GetMetaSimpleNameNode extends CoreMethodArrayArgume static Object getMetaSimpleName(Object metaObject, @CachedLibrary("metaObject") InteropLibrary interop, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { return interop.getMetaSimpleName(metaObject); } catch (UnsupportedMessageException e) { @@ -1892,7 +1892,7 @@ public abstract static class GetMetaQualifiedNameNode extends CoreMethodArrayArg static Object getMetaQualifiedName(Object metaObject, @CachedLibrary("metaObject") InteropLibrary interop, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { return interop.getMetaQualifiedName(metaObject); } catch (UnsupportedMessageException e) { @@ -1916,7 +1916,7 @@ public abstract static class GetMetaParentsNode extends CoreMethodArrayArguments static Object getMetaParents(Object value, @CachedLibrary("value") InteropLibrary interop, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { return interop.getMetaParents(value); } catch (UnsupportedMessageException e) { @@ -1943,7 +1943,7 @@ public abstract static class HashEntriesIteratorNode extends CoreMethodArrayArgu static Object hashEntriesIterator(Object receiver, @CachedLibrary("receiver") InteropLibrary interop, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { return interop.getHashEntriesIterator(receiver); } catch (UnsupportedMessageException e) { @@ -2013,7 +2013,7 @@ public abstract static class HashKeysIteratorNode extends CoreMethodArrayArgumen static Object hashKeysIterator(Object receiver, @CachedLibrary("receiver") InteropLibrary interop, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { return interop.getHashKeysIterator(receiver); } catch (UnsupportedMessageException e) { @@ -2028,7 +2028,7 @@ public abstract static class HashSizeNode extends CoreMethodArrayArgumentsNode { static long hashSize(Object receiver, @CachedLibrary("receiver") InteropLibrary interop, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { return interop.getHashSize(receiver); } catch (UnsupportedMessageException e) { @@ -2043,7 +2043,7 @@ public abstract static class HashValuesIteratorNode extends CoreMethodArrayArgum static Object hashValuesIterator(Object receiver, @CachedLibrary("receiver") InteropLibrary interop, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { return interop.getHashValuesIterator(receiver); } catch (UnsupportedMessageException e) { @@ -2059,7 +2059,7 @@ public abstract static class ReadHashValueNode extends CoreMethodArrayArgumentsN static Object readHashValue(Object receiver, Object key, @CachedLibrary("receiver") InteropLibrary interop, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { return interop.readHashValue(receiver, key); } catch (InteropException e) { @@ -2074,7 +2074,7 @@ public abstract static class ReadHashValueOrDefaultNode extends CoreMethodArrayA static Object readHashValueOrDefault(Object receiver, Object key, Object defaultValue, @CachedLibrary("receiver") InteropLibrary interop, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { return interop.readHashValueOrDefault(receiver, key, defaultValue); } catch (UnsupportedMessageException e) { @@ -2089,7 +2089,7 @@ public abstract static class RemoveHashEntryNode extends CoreMethodArrayArgument static Object removeHashEntry(Object receiver, Object key, @CachedLibrary("receiver") InteropLibrary interop, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { interop.removeHashEntry(receiver, key); return nil; @@ -2105,7 +2105,7 @@ public abstract static class WriteHashEntryNode extends CoreMethodArrayArguments static Object writeHashEntry(Object receiver, Object key, Object value, @CachedLibrary("receiver") InteropLibrary interop, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { interop.writeHashEntry(receiver, key, value); return value; @@ -2142,7 +2142,7 @@ public abstract static class InteropIdentityHashCodeNode extends CoreMethodArray static int identityHashCode(Object value, @CachedLibrary("value") InteropLibrary interop, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { if (interop.hasIdentity(value)) { try { return interop.identityHashCode(value); @@ -2182,7 +2182,7 @@ public abstract static class GetScopeParentNode extends CoreMethodArrayArguments static Object getScope(Object scope, @CachedLibrary("scope") InteropLibrary interopLibrary, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { if (interopLibrary.hasScopeParent(scope)) { try { return interopLibrary.getScopeParent(scope); @@ -2201,7 +2201,7 @@ public abstract static class GetCurrentScopeNode extends PrimitiveArrayArguments Object getScope(VirtualFrame frame, @CachedLibrary(limit = "1") NodeLibrary nodeLibrary, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { return nodeLibrary.getScope(this, frame, true); } catch (UnsupportedMessageException e) { @@ -2238,7 +2238,7 @@ public abstract static class IsBufferWritableNode extends CoreMethodArrayArgumen static boolean isBufferWritable(Object receiver, @CachedLibrary("receiver") InteropLibrary interop, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { return interop.isBufferWritable(receiver); } catch (UnsupportedMessageException e) { @@ -2255,7 +2255,7 @@ public abstract static class GetBufferSizeNode extends CoreMethodArrayArgumentsN static long getBufferSize(Object receiver, @CachedLibrary("receiver") InteropLibrary interop, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { return interop.getBufferSize(receiver); } catch (UnsupportedMessageException e) { @@ -2273,7 +2273,7 @@ static RubyString readBuffer(Object receiver, long byteOffset, int length, @CachedLibrary("receiver") InteropLibrary interop, @Cached TranslateInteropExceptionNode translateInteropException, @Cached TruffleString.FromByteArrayNode fromByteArrayNode, - @Bind("this") Node node) { + @Bind Node node) { byte[] bytes = new byte[length]; try { interop.readBuffer(receiver, byteOffset, bytes, 0, length); @@ -2293,7 +2293,7 @@ public abstract static class ReadBufferByteNode extends CoreMethodArrayArguments static byte readBufferByte(Object receiver, long byteOffset, @CachedLibrary("receiver") InteropLibrary interop, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { return interop.readBufferByte(receiver, byteOffset); } catch (InteropException e) { @@ -2311,7 +2311,7 @@ static Object writeBufferByte(Object receiver, long byteOffset, Object value, @CachedLibrary("receiver") InteropLibrary interop, @CachedLibrary("value") InteropLibrary interopValue, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { final byte byteValue = interopValue.asByte(value); interop.writeBufferByte(receiver, byteOffset, byteValue); @@ -2331,7 +2331,7 @@ static short readBufferShort(Object receiver, Object byteOrderObject, long byteO @CachedLibrary("receiver") InteropLibrary interop, @Cached SymbolToByteOrderNode symbolToByteOrderNode, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { final var byteOrder = symbolToByteOrderNode.execute(node, byteOrderObject); return interop.readBufferShort(receiver, byteOrder, byteOffset); @@ -2351,7 +2351,7 @@ static Object writeBufferShort(Object receiver, Object byteOrderObject, long byt @CachedLibrary("value") InteropLibrary interopValue, @Cached SymbolToByteOrderNode symbolToByteOrderNode, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { final var byteOrder = symbolToByteOrderNode.execute(node, byteOrderObject); final short shortValue = interopValue.asShort(value); @@ -2372,7 +2372,7 @@ static int readBufferInt(Object receiver, Object byteOrderObject, long byteOffse @CachedLibrary("receiver") InteropLibrary interop, @Cached SymbolToByteOrderNode symbolToByteOrderNode, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { final var byteOrder = symbolToByteOrderNode.execute(node, byteOrderObject); return interop.readBufferInt(receiver, byteOrder, byteOffset); @@ -2392,7 +2392,7 @@ static Object writeBufferInt(Object receiver, Object orderObject, long byteOffse @CachedLibrary("value") InteropLibrary interopValue, @Cached SymbolToByteOrderNode symbolToByteOrderNode, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { final var order = symbolToByteOrderNode.execute(node, orderObject); final int intValue = interopValue.asInt(value); @@ -2413,7 +2413,7 @@ static long readBufferLong(Object receiver, Object byteOrderObject, long byteOff @CachedLibrary("receiver") InteropLibrary interop, @Cached SymbolToByteOrderNode symbolToByteOrderNode, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { final var byteOrder = symbolToByteOrderNode.execute(node, byteOrderObject); return interop.readBufferLong(receiver, byteOrder, byteOffset); @@ -2433,7 +2433,7 @@ static Object writeBufferLong(Object receiver, Object orderObject, long byteOffs @CachedLibrary("value") InteropLibrary interopValue, @Cached SymbolToByteOrderNode symbolToByteOrderNode, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { final var order = symbolToByteOrderNode.execute(node, orderObject); final long longValue = interopValue.asLong(value); @@ -2455,7 +2455,7 @@ static double readBufferFloat(Object receiver, Object byteOrderObject, long byte @CachedLibrary("receiver") InteropLibrary interop, @Cached SymbolToByteOrderNode symbolToByteOrderNode, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { final var byteOrder = symbolToByteOrderNode.execute(node, byteOrderObject); return interop.readBufferFloat(receiver, byteOrder, byteOffset); @@ -2475,7 +2475,7 @@ static Object writeBufferFloat(Object receiver, Object orderObject, long byteOff @CachedLibrary("value") InteropLibrary interopValue, @Cached SymbolToByteOrderNode symbolToByteOrderNode, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { final var order = symbolToByteOrderNode.execute(node, orderObject); final float floatValue = (float) interopValue.asDouble(value); @@ -2496,7 +2496,7 @@ static double readBufferDouble(Object receiver, Object byteOrderObject, long byt @CachedLibrary("receiver") InteropLibrary interop, @Cached SymbolToByteOrderNode symbolToByteOrderNode, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { final var byteOrder = symbolToByteOrderNode.execute(node, byteOrderObject); return interop.readBufferDouble(receiver, byteOrder, byteOffset); @@ -2516,7 +2516,7 @@ static Object writeBufferDouble(Object receiver, Object orderObject, long byteOf @CachedLibrary("value") InteropLibrary interopValue, @Cached SymbolToByteOrderNode symbolToByteOrderNode, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { final var order = symbolToByteOrderNode.execute(node, orderObject); final double doubleValue = interopValue.asDouble(value); @@ -2555,7 +2555,7 @@ public abstract static class GetIteratorNode extends CoreMethodArrayArgumentsNod static Object getIterator(Object receiver, @CachedLibrary("receiver") InteropLibrary interop, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { return interop.getIterator(receiver); } catch (UnsupportedMessageException e) { @@ -2570,7 +2570,7 @@ public abstract static class HasIteratorNextElementNode extends CoreMethodArrayA static boolean hasIteratorNextElement(Object receiver, @CachedLibrary("receiver") InteropLibrary interop, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { return interop.hasIteratorNextElement(receiver); } catch (UnsupportedMessageException e) { @@ -2585,7 +2585,7 @@ public abstract static class GetIteratorNextElementNode extends CoreMethodArrayA static Object getIteratorNextElement(Object receiver, @CachedLibrary("receiver") InteropLibrary interop, @Cached TranslateInteropExceptionNode translateInteropException, - @Bind("this") Node node) { + @Bind Node node) { try { return interop.getIteratorNextElement(receiver); } catch (InteropException e) { diff --git a/src/main/java/org/truffleruby/interop/PolyglotNodes.java b/src/main/java/org/truffleruby/interop/PolyglotNodes.java index 1eb546b7a45b..a48571c32e23 100644 --- a/src/main/java/org/truffleruby/interop/PolyglotNodes.java +++ b/src/main/java/org/truffleruby/interop/PolyglotNodes.java @@ -64,10 +64,10 @@ static Object evalCached(Object langId, Object code, @Cached @Exclusive RubyStringLibrary stringsId, @Cached @Exclusive RubyStringLibrary stringsSource, @Cached("asTruffleStringUncached(langId)") TruffleString cachedLangId, - @Cached("stringsId.getEncoding(this, langId)") RubyEncoding cachedLangIdEnc, + @Cached("stringsId.getEncoding($node, langId)") RubyEncoding cachedLangIdEnc, @Cached("asTruffleStringUncached(code)") TruffleString cachedCode, - @Cached("stringsSource.getEncoding(this, code)") RubyEncoding cachedCodeEnc, - @Bind("this") Node node, + @Cached("stringsSource.getEncoding($node, code)") RubyEncoding cachedCodeEnc, + @Bind Node node, @Cached("create(parse(node, getJavaString(langId), getJavaString(code)))") DirectCallNode callNode, @Cached StringHelperNodes.EqualNode idEqualNode, @Cached StringHelperNodes.EqualNode codeEqualNode) { @@ -83,7 +83,7 @@ static Object evalUncached(Object langId, Object code, @Cached ToJavaStringNode toJavaStringLandNode, @Cached ToJavaStringNode toJavaStringCodeNode, @Cached IndirectCallNode callNode, - @Bind("this") Node node) { + @Bind Node node) { return callNode.call(parse(node, toJavaStringLandNode.execute(node, langId), toJavaStringCodeNode.execute(node, code)), EMPTY_ARGUMENTS); } @@ -230,7 +230,7 @@ public abstract static class InnerContextEvalNode extends PrimitiveArrayArgument "filenameEqualNode.execute(filenameLib, filename, cachedFilename, cachedFilenameEnc)" }, limit = "getCacheLimit()") static Object evalCached(RubyInnerContext rubyInnerContext, Object langId, Object code, Object filename, - @Bind("this") Node node, + @Bind Node node, @Cached @Exclusive RubyStringLibrary idLib, @Cached @Exclusive RubyStringLibrary codeLib, @Cached @Exclusive RubyStringLibrary filenameLib, @@ -253,7 +253,7 @@ static Object evalCached(RubyInnerContext rubyInnerContext, Object langId, Objec guards = { "idLib.isRubyString(node, langId)", "codeLib.isRubyString(node, code)" }, limit = "1", replaces = "evalCached") static Object evalUncached(RubyInnerContext rubyInnerContext, Object langId, Object code, Object filename, - @Bind("this") Node node, + @Bind Node node, @Cached @Exclusive RubyStringLibrary idLib, @Cached @Exclusive RubyStringLibrary codeLib, @Cached @Exclusive RubyStringLibrary filenameLib, diff --git a/src/main/java/org/truffleruby/interop/ProxyForeignObject.java b/src/main/java/org/truffleruby/interop/ProxyForeignObject.java index 32800fce5f61..a1a0a16bbb4d 100644 --- a/src/main/java/org/truffleruby/interop/ProxyForeignObject.java +++ b/src/main/java/org/truffleruby/interop/ProxyForeignObject.java @@ -51,7 +51,7 @@ protected Object send(Message message, Object[] rawArgs, @Cached DispatchNode dispatchNode, @Cached ForeignToRubyArgumentsNode foreignToRubyArgumentsNode, @CachedLibrary("this.delegate") ReflectionLibrary reflections, - @Bind("$node") Node node) throws Exception { + @Bind Node node) throws Exception { if (message == IS_META_INSTANCE) { // Workaround StackOverflowError in asserts (GR-37197) rawArgs = rawArgs.clone(); diff --git a/src/main/java/org/truffleruby/language/ImmutableRubyObject.java b/src/main/java/org/truffleruby/language/ImmutableRubyObject.java index 00dd8e182f2e..f5c7210c1ddc 100644 --- a/src/main/java/org/truffleruby/language/ImmutableRubyObject.java +++ b/src/main/java/org/truffleruby/language/ImmutableRubyObject.java @@ -150,7 +150,7 @@ public Object invokeMember(String name, Object[] arguments, @Cached @Exclusive DispatchNode dispatchMember, @Cached @Exclusive ForeignToRubyArgumentsNode foreignToRubyArgumentsNode, @Cached @Shared BranchProfile errorProfile, - @Bind("$node") Node node) + @Bind Node node) throws UnknownIdentifierException { Object[] convertedArguments = foreignToRubyArgumentsNode.executeConvert(node, arguments); Object result = dispatchMember.call(PRIVATE_RETURN_MISSING, this, name, convertedArguments); diff --git a/src/main/java/org/truffleruby/language/RubyDynamicObject.java b/src/main/java/org/truffleruby/language/RubyDynamicObject.java index 05a71fd256a8..8d0dc49788a0 100644 --- a/src/main/java/org/truffleruby/language/RubyDynamicObject.java +++ b/src/main/java/org/truffleruby/language/RubyDynamicObject.java @@ -57,6 +57,8 @@ import com.oracle.truffle.api.utilities.TriState; import org.truffleruby.language.objects.shared.SharedObjects; +import java.lang.invoke.MethodHandles; + import static org.truffleruby.language.dispatch.DispatchConfiguration.PRIVATE; import static org.truffleruby.language.dispatch.DispatchConfiguration.PRIVATE_RETURN_MISSING; import static org.truffleruby.language.dispatch.DispatchConfiguration.PUBLIC_RETURN_MISSING; @@ -65,6 +67,8 @@ @ExportLibrary(InteropLibrary.class) public abstract class RubyDynamicObject extends DynamicObject { + public static final MethodHandles.Lookup LOOKUP = MethodHandles.lookup(); + private RubyClass metaClass; public RubyDynamicObject(RubyClass metaClass, Shape shape) { @@ -162,7 +166,7 @@ public RubyClass getMetaObject( public boolean hasArrayElements( @Cached @Exclusive DispatchNode dispatchNode, @Cached @Exclusive BooleanCastNode booleanCastNode, - @Bind("$node") Node node) { + @Bind Node node) { Object value = dispatchNode.call(PRIVATE_RETURN_MISSING, this, "polyglot_has_array_elements?"); return value != DispatchNode.MISSING && booleanCastNode.execute(node, value); } @@ -173,7 +177,7 @@ public long getArraySize( @Cached @Shared BranchProfile errorProfile, @Cached @Shared TranslateInteropRubyExceptionNode translateRubyException, @Cached @Exclusive DispatchNode dispatchNode, - @Bind("$node") Node node) + @Bind Node node) throws UnsupportedMessageException { Object value; try { @@ -246,7 +250,7 @@ public void removeArrayElement(long index, public boolean isArrayElementReadable(long index, @Cached @Exclusive DispatchNode dispatchNode, @Cached @Exclusive BooleanCastNode booleanCastNode, - @Bind("$node") Node node) { + @Bind Node node) { Object value = dispatchNode.call(PRIVATE_RETURN_MISSING, this, "polyglot_array_element_readable?", index); return value != DispatchNode.MISSING && booleanCastNode.execute(node, value); } @@ -255,7 +259,7 @@ public boolean isArrayElementReadable(long index, public boolean isArrayElementModifiable(long index, @Cached @Exclusive DispatchNode dispatchNode, @Cached @Exclusive BooleanCastNode booleanCastNode, - @Bind("$node") Node node) { + @Bind Node node) { Object value = dispatchNode.call(PRIVATE_RETURN_MISSING, this, "polyglot_array_element_modifiable?", index); return value != DispatchNode.MISSING && booleanCastNode.execute(node, value); } @@ -264,7 +268,7 @@ public boolean isArrayElementModifiable(long index, public boolean isArrayElementInsertable(long index, @Cached @Exclusive DispatchNode dispatchNode, @Cached @Exclusive BooleanCastNode booleanCastNode, - @Bind("$node") Node node) { + @Bind Node node) { Object value = dispatchNode.call(PRIVATE_RETURN_MISSING, this, "polyglot_array_element_insertable?", index); return value != DispatchNode.MISSING && booleanCastNode.execute(node, value); } @@ -273,7 +277,7 @@ public boolean isArrayElementInsertable(long index, public boolean isArrayElementRemovable(long index, @Cached @Exclusive DispatchNode dispatchNode, @Cached @Exclusive BooleanCastNode booleanCastNode, - @Bind("$node") Node node) { + @Bind Node node) { Object value = dispatchNode.call(PRIVATE_RETURN_MISSING, this, "polyglot_array_element_removable?", index); return value != DispatchNode.MISSING && booleanCastNode.execute(node, value); } @@ -284,7 +288,7 @@ public boolean isArrayElementRemovable(long index, public boolean hasHashEntries( @Cached @Exclusive DispatchNode dispatchNode, @Cached @Exclusive BooleanCastNode booleanCastNode, - @Bind("$node") Node node) { + @Bind Node node) { final Object value = dispatchNode.call(PRIVATE_RETURN_MISSING, this, "polyglot_has_hash_entries?"); return value != DispatchNode.MISSING && booleanCastNode.execute(node, value); } @@ -294,7 +298,7 @@ public long getHashSize( @Cached @Exclusive DispatchNode dispatchNode, @Cached @Shared BranchProfile errorProfile, @Cached @Exclusive ToLongNode toInt, - @Bind("$node") Node node) throws UnsupportedMessageException { + @Bind Node node) throws UnsupportedMessageException { final Object value = dispatchNode.call(PRIVATE_RETURN_MISSING, this, "polyglot_hash_size"); if (value == DispatchNode.MISSING) { errorProfile.enter(); @@ -307,7 +311,7 @@ public long getHashSize( public boolean isHashEntryReadable(Object key, @Cached @Exclusive DispatchNode dispatchNode, @Cached @Exclusive BooleanCastNode booleanCastNode, - @Bind("$node") Node node) { + @Bind Node node) { final Object value = dispatchNode.call(PRIVATE_RETURN_MISSING, this, "polyglot_hash_entry_readable?", key); return value != DispatchNode.MISSING && booleanCastNode.execute(node, value); } @@ -316,7 +320,7 @@ public boolean isHashEntryReadable(Object key, public boolean isHashEntryModifiable(Object key, @Cached @Exclusive DispatchNode dispatchNode, @Cached @Exclusive BooleanCastNode booleanCastNode, - @Bind("$node") Node node) { + @Bind Node node) { final Object value = dispatchNode.call(PRIVATE_RETURN_MISSING, this, "polyglot_hash_entry_modifiable?", key); return value != DispatchNode.MISSING && booleanCastNode.execute(node, value); } @@ -325,7 +329,7 @@ public boolean isHashEntryModifiable(Object key, public boolean isHashEntryInsertable(Object key, @Cached @Exclusive DispatchNode dispatchNode, @Cached @Exclusive BooleanCastNode booleanCastNode, - @Bind("$node") Node node) { + @Bind Node node) { final Object value = dispatchNode.call(PRIVATE_RETURN_MISSING, this, "polyglot_hash_entry_insertable?", key); return value != DispatchNode.MISSING && booleanCastNode.execute(node, value); } @@ -334,7 +338,7 @@ public boolean isHashEntryInsertable(Object key, public boolean isHashEntryRemovable(Object key, @Cached @Exclusive DispatchNode dispatchNode, @Cached @Exclusive BooleanCastNode booleanCastNode, - @Bind("$node") Node node) { + @Bind Node node) { final Object value = dispatchNode.call(PRIVATE_RETURN_MISSING, this, "polyglot_hash_entry_removable?", key); return value != DispatchNode.MISSING && booleanCastNode.execute(node, value); } @@ -464,7 +468,7 @@ public boolean hasIteratorNextElement( @CachedLibrary("this") InteropLibrary interopLibrary, @Cached @Exclusive DispatchNode dispatchNode, @Cached @Exclusive BooleanCastNode booleanCastNode, - @Bind("$node") Node node) throws UnsupportedMessageException { + @Bind Node node) throws UnsupportedMessageException { if (!interopLibrary.isIterator(this)) { throw UnsupportedMessageException.create(); } @@ -503,7 +507,7 @@ public Object getIteratorNextElement( public boolean isPointer( @Cached @Exclusive DispatchNode dispatchNode, @Cached @Exclusive BooleanCastNode booleanCastNode, - @Bind("$node") Node node) { + @Bind Node node) { Object value = dispatchNode.call(PRIVATE_RETURN_MISSING, this, "polyglot_pointer?"); return value != DispatchNode.MISSING && booleanCastNode.execute(node, value); @@ -515,7 +519,7 @@ public long asPointer( @Cached @Exclusive DispatchNode dispatchNode, @Cached @Shared TranslateInteropRubyExceptionNode translateRubyException, @Cached LongCastNode longCastNode, - @Bind("$node") Node node) throws UnsupportedMessageException { + @Bind Node node) throws UnsupportedMessageException { Object value; try { @@ -545,7 +549,7 @@ public void toNative( public boolean hasMembers( @Cached @Exclusive DispatchNode dispatchNode, @Cached @Exclusive BooleanCastNode booleanCastNode, - @Bind("$node") Node node) { + @Bind Node node) { Object dynamic = dispatchNode.call(PRIVATE_RETURN_MISSING, this, "polyglot_has_members?"); return dynamic == DispatchNode.MISSING || booleanCastNode.execute(node, dynamic); } @@ -607,7 +611,7 @@ public void writeMember(String name, Object value, @Cached @Shared ConditionProfile dynamicProfile, @Cached @Shared TranslateInteropRubyExceptionNode translateRubyException, @Cached @Shared BranchProfile errorProfile, - @Bind("$node") Node node) + @Bind Node node) throws UnknownIdentifierException, UnsupportedMessageException { Object dynamic; try { @@ -669,7 +673,7 @@ public Object invokeMember(String name, Object[] arguments, @Cached @Shared ConditionProfile dynamicProfile, @Cached @Shared TranslateInteropRubyExceptionNode translateRubyException, @Cached @Shared BranchProfile errorProfile, - @Bind("$node") Node node) + @Bind Node node) throws UnknownIdentifierException, UnsupportedTypeException, UnsupportedMessageException, ArityException { Object[] convertedArguments = foreignToRubyArgumentsNode.executeConvert(node, arguments); Object[] combinedArguments = ArrayUtils.unshift(convertedArguments, name); @@ -699,7 +703,7 @@ public boolean isMemberReadable(String name, @Cached @Exclusive BooleanCastNode booleanCastNode, @Cached @Shared ConditionProfile dynamicProfile, @Cached @Shared ConditionProfile ivarFoundProfile, - @Bind("$node") Node node) { + @Bind Node node) { Object dynamic = dispatchNode.call(PRIVATE_RETURN_MISSING, this, "polyglot_member_readable?", name); if (dynamicProfile.profile(dynamic == DispatchNode.MISSING)) { if (ivarFoundProfile.profile(objectLibrary.containsKey(this, name))) { @@ -719,7 +723,7 @@ public boolean isMemberModifiable(String name, @Cached @Exclusive DispatchNode dispatchNode, @Cached @Exclusive BooleanCastNode booleanCastNode, @Cached @Shared ConditionProfile dynamicProfile, - @Bind("$node") Node node) { + @Bind Node node) { Object dynamic = dispatchNode.call(PRIVATE_RETURN_MISSING, this, "polyglot_member_modifiable?", name); return isMemberModifiableRemovable( node, @@ -738,7 +742,7 @@ public boolean isMemberRemovable(String name, @Cached @Exclusive DispatchNode dispatchNode, @Cached @Exclusive BooleanCastNode booleanCastNode, @Cached @Shared ConditionProfile dynamicProfile, - @Bind("$node") Node node) { + @Bind Node node) { Object dynamic = dispatchNode.call(PRIVATE_RETURN_MISSING, this, "polyglot_member_removable?", name); return isMemberModifiableRemovable( node, @@ -774,7 +778,7 @@ public boolean isMemberInsertable(String name, @Cached @Exclusive DispatchNode dispatchNode, @Cached @Exclusive BooleanCastNode booleanCastNode, @Cached @Shared ConditionProfile dynamicProfile, - @Bind("$node") Node node) { + @Bind Node node) { Object dynamic = dispatchNode.call(PRIVATE_RETURN_MISSING, this, "polyglot_member_insertable?", name); if (dynamicProfile.profile(dynamic == DispatchNode.MISSING)) { if (isFrozenNode.execute(this) || !isIVar(name)) { @@ -795,7 +799,7 @@ public boolean isMemberInvocable(String name, @Cached @Exclusive BooleanCastNode booleanCastNode, @Cached @Shared ConditionProfile dynamicProfile, @Cached @Shared ConditionProfile ivarFoundProfile, - @Bind("$node") Node node) { + @Bind Node node) { Object dynamic = dispatchNode.call(PRIVATE_RETURN_MISSING, this, "polyglot_member_invocable?", name); if (dynamicProfile.profile(dynamic == DispatchNode.MISSING)) { Object iVar = objectLibrary.getOrDefault(this, name, null); @@ -818,7 +822,7 @@ public boolean isMemberInternal(String name, @Cached @Exclusive BooleanCastNode booleanCastNode, @Cached @Shared ConditionProfile dynamicProfile, @Cached @Shared ConditionProfile ivarFoundProfile, - @Bind("$node") Node node) { + @Bind Node node) { Object dynamic = dispatchNode.call(PRIVATE_RETURN_MISSING, this, "polyglot_member_internal?", name); if (dynamicProfile.profile(dynamic == DispatchNode.MISSING)) { Object result = objectLibrary.getOrDefault(this, name, null); @@ -839,7 +843,7 @@ public boolean hasMemberReadSideEffects(String name, @Cached @Exclusive DispatchNode dispatchNode, @Cached @Shared ConditionProfile dynamicProfile, @Cached @Exclusive BooleanCastNode booleanCastNode, - @Bind("$node") Node node) { + @Bind Node node) { Object dynamic = dispatchNode.call(PRIVATE_RETURN_MISSING, this, "polyglot_has_member_read_side_effects?", name); if (dynamicProfile.profile(dynamic == DispatchNode.MISSING)) { @@ -854,7 +858,7 @@ public boolean hasMemberWriteSideEffects(String name, @Cached @Exclusive DispatchNode dispatchNode, @Cached @Shared ConditionProfile dynamicProfile, @Cached @Exclusive BooleanCastNode booleanCastNode, - @Bind("$node") Node node) { + @Bind Node node) { Object dynamic = dispatchNode.call(PRIVATE_RETURN_MISSING, this, "polyglot_has_member_write_side_effects?", name); if (dynamicProfile.profile(dynamic == DispatchNode.MISSING)) { @@ -877,7 +881,7 @@ public Object instantiate(Object[] arguments, @Cached @Shared BranchProfile errorProfile, @Cached @Exclusive DispatchNode dispatchNode, @Cached @Exclusive ForeignToRubyArgumentsNode foreignToRubyArgumentsNode, - @Bind("$node") Node node) + @Bind Node node) throws UnsupportedMessageException { Object instance = dispatchNode.call(PUBLIC_RETURN_MISSING, this, "new", foreignToRubyArgumentsNode.executeConvert(node, arguments)); diff --git a/src/main/java/org/truffleruby/language/constants/GetConstantNode.java b/src/main/java/org/truffleruby/language/constants/GetConstantNode.java index 413105672836..bb76f08c5d17 100644 --- a/src/main/java/org/truffleruby/language/constants/GetConstantNode.java +++ b/src/main/java/org/truffleruby/language/constants/GetConstantNode.java @@ -195,7 +195,7 @@ static Object missingConstant( boolean callConstMissing, @Cached ToSymbolNode toSymbolNode, @Cached @Exclusive LazyDispatchNode constMissingNode, - @Bind("this") Node node) { + @Bind Node node) { CompilerAsserts.partialEvaluationConstant(callConstMissing); if (callConstMissing) { return constMissingNode.get(node).call(module, "const_missing", toSymbolNode.execute(node, name)); diff --git a/src/main/java/org/truffleruby/language/constants/LookupConstantNode.java b/src/main/java/org/truffleruby/language/constants/LookupConstantNode.java index fab43b532b38..52b285f3723b 100644 --- a/src/main/java/org/truffleruby/language/constants/LookupConstantNode.java +++ b/src/main/java/org/truffleruby/language/constants/LookupConstantNode.java @@ -73,7 +73,7 @@ static RubyConstant lookupConstant(RubyModule module, String name, boolean check @Cached("isVisible(cachedModule, constant)") boolean isVisible, @Cached @Exclusive InlinedConditionProfile sameNameProfile, @Cached LazyWarnNode lazyWarnNode, - @Bind("this") Node node) { + @Bind Node node) { if (!isValidConstantName) { throw new RaiseException(getContext(node), coreExceptions(node).nameErrorWrongConstantName(cachedName, node)); diff --git a/src/main/java/org/truffleruby/language/dispatch/DispatchMethodMissingNode.java b/src/main/java/org/truffleruby/language/dispatch/DispatchMethodMissingNode.java index 797c14fa610e..01cb91e2b87a 100644 --- a/src/main/java/org/truffleruby/language/dispatch/DispatchMethodMissingNode.java +++ b/src/main/java/org/truffleruby/language/dispatch/DispatchMethodMissingNode.java @@ -60,7 +60,7 @@ static Object dispatchMissingMethod( @Cached ToSymbolNode toSymbol, @Cached DispatchNode callMethodMissing, @Cached InlinedBranchProfile methodMissingMissingProfile, - @Bind("this") Node node) { + @Bind Node node) { final RubySymbol symbolName = toSymbol.execute(node, methodName); final Object[] newArgs = RubyArguments.repack(rubyArgs, receiver, 0, 1); diff --git a/src/main/java/org/truffleruby/language/globals/IsDefinedGlobalVariableNode.java b/src/main/java/org/truffleruby/language/globals/IsDefinedGlobalVariableNode.java index 64a2851be2fa..180b82e057d3 100644 --- a/src/main/java/org/truffleruby/language/globals/IsDefinedGlobalVariableNode.java +++ b/src/main/java/org/truffleruby/language/globals/IsDefinedGlobalVariableNode.java @@ -47,11 +47,11 @@ Object simple(VirtualFrame frame, @Specialization(guards = { "storage.hasHooks()", "arity == 0" }) static Object hooks(VirtualFrame frame, - @Cached(value = "getLanguage().getGlobalVariableIndex(lookupGlobalVariableStorageNode.name)") int index, + @Cached("getLanguage().getGlobalVariableIndex(lookupGlobalVariableStorageNode.name)") int index, @Bind("getStorage(frame)") GlobalVariableStorage storage, - @Cached(value = "isDefinedArity(storage)") int arity, + @Cached("isDefinedArity(storage)") int arity, @Cached @Exclusive CallBlockNode yieldNode, - @Bind("this") Node node) { + @Bind Node node) { return yieldNode.yield(node, storage.getIsDefined()); } @@ -61,7 +61,7 @@ static Object hooksWithBinding(VirtualFrame frame, @Cached("isDefinedArity(storage)") int arity, @Cached @Exclusive CallBlockNode yieldNode, @Cached GetSpecialVariableStorage readStorage, - @Bind("this") Node node) { + @Bind Node node) { return yieldNode.yield(node, storage.getIsDefined(), readStorage.execute(frame, node)); } diff --git a/src/main/java/org/truffleruby/language/globals/ReadGlobalVariableNode.java b/src/main/java/org/truffleruby/language/globals/ReadGlobalVariableNode.java index 9c13198a1c9d..837ad3090251 100644 --- a/src/main/java/org/truffleruby/language/globals/ReadGlobalVariableNode.java +++ b/src/main/java/org/truffleruby/language/globals/ReadGlobalVariableNode.java @@ -56,7 +56,7 @@ static Object readHooksWithStorage(VirtualFrame frame, @Bind("getterArity(storage)") int arity, @Cached @Exclusive CallBlockNode yieldNode, @Cached GetSpecialVariableStorage storageNode, - @Bind("this") Node node) { + @Bind Node node) { return yieldNode.yield(node, storage.getGetter(), storageNode.execute(frame, node)); } diff --git a/src/main/java/org/truffleruby/language/globals/WriteGlobalVariableNode.java b/src/main/java/org/truffleruby/language/globals/WriteGlobalVariableNode.java index 9bf23d798d57..21533cb1cd95 100644 --- a/src/main/java/org/truffleruby/language/globals/WriteGlobalVariableNode.java +++ b/src/main/java/org/truffleruby/language/globals/WriteGlobalVariableNode.java @@ -67,7 +67,7 @@ static Object writeHooksWithStorage(VirtualFrame frame, Object value, @Bind("setterArity(storage)") int arity, @Cached @Exclusive CallBlockNode yieldNode, @Cached GetSpecialVariableStorage storageNode, - @Bind("this") Node node) { + @Bind Node node) { yieldNode.yield(node, storage.getSetter(), value, diff --git a/src/main/java/org/truffleruby/language/globals/WriteSimpleGlobalVariableNode.java b/src/main/java/org/truffleruby/language/globals/WriteSimpleGlobalVariableNode.java index 2612acdfc46c..c4a80389cc56 100644 --- a/src/main/java/org/truffleruby/language/globals/WriteSimpleGlobalVariableNode.java +++ b/src/main/java/org/truffleruby/language/globals/WriteSimpleGlobalVariableNode.java @@ -48,7 +48,7 @@ static Object writeTryToKeepConstant(Object value, @Cached(value = "getLanguage().getGlobalVariableIndex(name)", neverDefault = false) @Shared int index, @Cached("getContext().getGlobalVariableStorage(index)") GlobalVariableStorage storage, @Cached("storage.getValue()") Object previousValue, - @Bind("this") Node node) { + @Bind Node node) { // NOTE: we still do the volatile write to get the proper memory barrier, // as the global variable could be used as a publication mechanism. storage.setValueInternal(value); diff --git a/src/main/java/org/truffleruby/language/methods/CallInternalMethodNode.java b/src/main/java/org/truffleruby/language/methods/CallInternalMethodNode.java index 5fc36e761b93..79da6e45bd48 100644 --- a/src/main/java/org/truffleruby/language/methods/CallInternalMethodNode.java +++ b/src/main/java/org/truffleruby/language/methods/CallInternalMethodNode.java @@ -87,7 +87,7 @@ static Object alwaysInlined(Frame frame, InternalMethod method, Object receiver, @Cached("cachedMethod.getSharedMethodInfo().getArity()") Arity cachedArity, @Cached InlinedBranchProfile checkArityProfile, @Cached InlinedBranchProfile exceptionProfile, - @Bind("this") Node node) { + @Bind Node node) { assert !cachedArity .acceptsKeywords() : "AlwaysInlinedMethodNodes are currently assumed to not use keyword arguments, the arity check depends on this"; assert RubyArguments.getSelf(rubyArgs) == receiver; diff --git a/src/main/java/org/truffleruby/language/objects/IsANode.java b/src/main/java/org/truffleruby/language/objects/IsANode.java index c435c5787458..1ee1e4d9ecb9 100644 --- a/src/main/java/org/truffleruby/language/objects/IsANode.java +++ b/src/main/java/org/truffleruby/language/objects/IsANode.java @@ -51,7 +51,7 @@ public static IsANode getUncached() { limit = "getCacheLimit()") boolean isAMetaClassCached(Object self, RubyModule module, @Cached @Shared MetaClassNode metaClassNode, - @Cached("metaClassNode.execute(this, self)") RubyClass cachedMetaClass, + @Cached("metaClassNode.execute($node, self)") RubyClass cachedMetaClass, @Cached("module") RubyModule cachedModule, @Cached("isA(cachedMetaClass, cachedModule)") boolean result) { return result; diff --git a/src/main/java/org/truffleruby/language/objects/classvariables/ClassVariableStorage.java b/src/main/java/org/truffleruby/language/objects/classvariables/ClassVariableStorage.java index 4765bc0d169d..3ace061db245 100644 --- a/src/main/java/org/truffleruby/language/objects/classvariables/ClassVariableStorage.java +++ b/src/main/java/org/truffleruby/language/objects/classvariables/ClassVariableStorage.java @@ -13,10 +13,13 @@ import com.oracle.truffle.api.object.DynamicObjectLibrary; import org.truffleruby.RubyLanguage; +import java.lang.invoke.MethodHandles; import java.lang.invoke.VarHandle; public final class ClassVariableStorage extends DynamicObject { + public static final MethodHandles.Lookup LOOKUP = MethodHandles.lookup(); + // Same number of inline fields as DynamicObjectBasic @DynamicField private long primitive1; @DynamicField private long primitive2; diff --git a/src/main/java/org/truffleruby/language/supercall/LookupSuperMethodNode.java b/src/main/java/org/truffleruby/language/supercall/LookupSuperMethodNode.java index 071b750cb39c..f37d26d55449 100644 --- a/src/main/java/org/truffleruby/language/supercall/LookupSuperMethodNode.java +++ b/src/main/java/org/truffleruby/language/supercall/LookupSuperMethodNode.java @@ -45,7 +45,7 @@ public abstract class LookupSuperMethodNode extends RubyBaseNode { InternalMethod lookupSuperMethodCached(VirtualFrame frame, Object self, @Cached("getCurrentMethod(frame)") InternalMethod currentMethod, @Cached @Shared MetaClassNode metaClassNode, - @Cached("metaClassNode.execute(this, self)") RubyClass selfMetaClass, + @Cached("metaClassNode.execute($node, self)") RubyClass selfMetaClass, @Cached("doLookup(currentMethod, selfMetaClass)") MethodLookupResult superMethod) { return superMethod.getMethod(); } diff --git a/src/main/java/org/truffleruby/stdlib/digest/DigestNodes.java b/src/main/java/org/truffleruby/stdlib/digest/DigestNodes.java index 89ae959328b3..b37390313c2e 100644 --- a/src/main/java/org/truffleruby/stdlib/digest/DigestNodes.java +++ b/src/main/java/org/truffleruby/stdlib/digest/DigestNodes.java @@ -108,7 +108,7 @@ public abstract static class UpdateNode extends CoreMethodArrayArgumentsNode { @Specialization(guards = "strings.isRubyString(node, message)", limit = "1") static RubyDigest update(RubyDigest digestObject, Object message, - @Bind("this") Node node, + @Bind Node node, @Cached RubyStringLibrary strings, @Cached TruffleString.GetInternalByteArrayNode getInternalByteArrayNode) { final MessageDigest digest = digestObject.digest; diff --git a/src/main/java/org/truffleruby/stdlib/readline/ReadlineNodes.java b/src/main/java/org/truffleruby/stdlib/readline/ReadlineNodes.java index ebebc260dc43..c5fe2cc93316 100644 --- a/src/main/java/org/truffleruby/stdlib/readline/ReadlineNodes.java +++ b/src/main/java/org/truffleruby/stdlib/readline/ReadlineNodes.java @@ -81,7 +81,7 @@ public abstract static class SetBasicWordBreakCharactersNode extends CoreMethodN static Object setBasicWordBreakCharacters(Object characters, @Cached ToStrNode toStrNode, @Cached RubyStringLibrary strings, - @Bind("this") Node node, + @Bind Node node, @Bind("toStrNode.execute(node, characters)") Object charactersAsString) { final String delimiters = RubyGuards.getJavaString(charactersAsString); getContext(node).getConsoleHolder().getParser().setDelimiters(delimiters); diff --git a/src/signal/java/org/truffleruby/signal/LibRubySignal.java b/src/signal/java/org/truffleruby/signal/LibRubySignal.java index bc8a6eec2f47..e0a3b235a004 100644 --- a/src/signal/java/org/truffleruby/signal/LibRubySignal.java +++ b/src/signal/java/org/truffleruby/signal/LibRubySignal.java @@ -19,6 +19,8 @@ public static void loadLibrary(String rubyHome, String libSuffix) { public static native void setupLocale(); + public static native void setupLocaleOnlyCTYPE(); + public static native int setupSIGVTALRMEmptySignalHandler(); public static native long threadID();