Skip to content

Commit 2075fb1

Browse files
committed
ConvertForOperatorAndReDispatchNode is DSL inline node
1 parent 181b405 commit 2075fb1

File tree

4 files changed

+22
-27
lines changed

4 files changed

+22
-27
lines changed

src/main/java/org/truffleruby/core/cast/ToSymbolNode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ protected static RubySymbol rubyStringUncached(Node node, Object str,
8383
@Specialization(guards = { "!isRubySymbol(object)", "!isString(object)", "isNotRubyString(object)" })
8484
protected static RubySymbol toStr(Node node, Object object,
8585
@Cached InlinedBranchProfile errorProfile,
86-
@Cached DispatchNode toStrNode,
86+
@Cached(inline = false) DispatchNode toStrNode,
8787
@Cached @Exclusive RubyStringLibrary strings,
8888
@Cached(inline = false) ToSymbolNode toSymbolNode) {
8989
var coerced = toStrNode.call(

src/main/java/org/truffleruby/core/string/StringHelperNodes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ protected static boolean empty(
158158
@Specialization(guards = { "compatibleEncoding != null", "!a.isEmpty()", "!b.isEmpty()" })
159159
protected static boolean equalBytes(
160160
AbstractTruffleString a, AbstractTruffleString b, RubyEncoding compatibleEncoding,
161-
@Cached TruffleString.EqualNode equalNode) {
161+
@Cached(inline = false) TruffleString.EqualNode equalNode) {
162162
return equalNode.execute(a, b, compatibleEncoding.tencoding);
163163
}
164164

src/main/java/org/truffleruby/language/methods/CallForeignMethodNode.java

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
package org.truffleruby.language.methods;
1111

1212
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
13-
import com.oracle.truffle.api.dsl.Bind;
1413
import com.oracle.truffle.api.dsl.Cached;
1514
import com.oracle.truffle.api.dsl.Cached.Shared;
1615
import com.oracle.truffle.api.dsl.GenerateCached;
@@ -89,10 +88,10 @@ protected static Object invokeOrRead(Node node, Object receiver, String name, Ob
8988
}
9089

9190
@Specialization(guards = { "name == cachedName", "isOperatorMethod(cachedName)" }, limit = "1")
92-
protected static Object operatorMethod(Object receiver, String name, Object[] args,
91+
protected static Object operatorMethod(Node node, Object receiver, String name, Object[] args,
9392
@Cached("name") String cachedName,
9493
@Cached ConvertForOperatorAndReDispatchNode operatorNode) {
95-
return operatorNode.execute(receiver, name, args);
94+
return operatorNode.execute(node, receiver, name, args);
9695
}
9796

9897
@Specialization(guards = { "name == cachedName", "isAssignmentMethod(cachedName)" }, limit = "1")
@@ -156,16 +155,17 @@ protected static Object invoke(Node node, Object receiver, String name, Object[]
156155
}
157156

158157
@GenerateUncached
158+
@GenerateCached(false)
159+
@GenerateInline
159160
protected abstract static class ConvertForOperatorAndReDispatchNode extends RubyBaseNode {
160161

161-
protected abstract Object execute(Object receiver, String name, Object[] args);
162+
protected abstract Object execute(Node node, Object receiver, String name, Object[] args);
162163

163164
@Specialization(guards = "receivers.isBoolean(receiver)", limit = "getInteropCacheLimit()")
164-
protected static Object callBoolean(Object receiver, String name, Object[] args,
165+
protected static Object callBoolean(Node node, Object receiver, String name, Object[] args,
165166
@CachedLibrary("receiver") InteropLibrary receivers,
166167
@Cached @Shared TranslateInteropExceptionNode translateInteropException,
167-
@Cached @Shared DispatchNode dispatch,
168-
@Bind("this") Node node) {
168+
@Cached @Shared DispatchNode dispatch) {
169169
try {
170170
return dispatch.call(receivers.asBoolean(receiver), name, args);
171171
} catch (InteropException e) {
@@ -176,11 +176,10 @@ protected static Object callBoolean(Object receiver, String name, Object[] args,
176176
@Specialization(
177177
guards = { "receivers.isNumber(receiver)", "receivers.fitsInInt(receiver)" },
178178
limit = "getInteropCacheLimit()")
179-
protected static Object callInt(Object receiver, String name, Object[] args,
179+
protected static Object callInt(Node node, Object receiver, String name, Object[] args,
180180
@CachedLibrary("receiver") InteropLibrary receivers,
181181
@Cached @Shared TranslateInteropExceptionNode translateInteropException,
182-
@Cached @Shared DispatchNode dispatch,
183-
@Bind("this") Node node) {
182+
@Cached @Shared DispatchNode dispatch) {
184183
try {
185184
return dispatch.call(receivers.asInt(receiver), name, args);
186185
} catch (InteropException e) {
@@ -194,11 +193,10 @@ protected static Object callInt(Object receiver, String name, Object[] args,
194193
"!receivers.fitsInInt(receiver)",
195194
"receivers.fitsInLong(receiver)" },
196195
limit = "getInteropCacheLimit()")
197-
protected static Object callLong(Object receiver, String name, Object[] args,
196+
protected static Object callLong(Node node, Object receiver, String name, Object[] args,
198197
@CachedLibrary("receiver") InteropLibrary receivers,
199198
@Cached @Shared TranslateInteropExceptionNode translateInteropException,
200-
@Cached @Shared DispatchNode dispatch,
201-
@Bind("this") Node node) {
199+
@Cached @Shared DispatchNode dispatch) {
202200
try {
203201
return dispatch.call(receivers.asLong(receiver), name, args);
204202
} catch (InteropException e) {
@@ -212,11 +210,10 @@ protected static Object callLong(Object receiver, String name, Object[] args,
212210
"!receivers.fitsInLong(receiver)",
213211
"receivers.fitsInBigInteger(receiver)" },
214212
limit = "getInteropCacheLimit()")
215-
protected static Object callBigInteger(Object receiver, String name, Object[] args,
213+
protected static Object callBigInteger(Node node, Object receiver, String name, Object[] args,
216214
@CachedLibrary("receiver") InteropLibrary receivers,
217215
@Cached @Shared TranslateInteropExceptionNode translateInteropException,
218-
@Cached @Shared DispatchNode dispatch,
219-
@Bind("this") Node node) {
216+
@Cached @Shared DispatchNode dispatch) {
220217
try {
221218
return dispatch.call(new RubyBignum(receivers.asBigInteger(receiver)), name, args);
222219
} catch (InteropException e) {
@@ -230,11 +227,10 @@ protected static Object callBigInteger(Object receiver, String name, Object[] ar
230227
"!receivers.fitsInBigInteger(receiver)",
231228
"receivers.fitsInDouble(receiver)" },
232229
limit = "getInteropCacheLimit()")
233-
protected static Object callDouble(Object receiver, String name, Object[] args,
230+
protected static Object callDouble(Node node, Object receiver, String name, Object[] args,
234231
@CachedLibrary("receiver") InteropLibrary receivers,
235232
@Cached @Shared TranslateInteropExceptionNode translateInteropException,
236-
@Cached @Shared DispatchNode dispatch,
237-
@Bind("this") Node node) {
233+
@Cached @Shared DispatchNode dispatch) {
238234
try {
239235
return dispatch.call(receivers.asDouble(receiver), name, args);
240236
} catch (InteropException e) {
@@ -244,10 +240,9 @@ protected static Object callDouble(Object receiver, String name, Object[] args,
244240

245241
@Specialization(guards = { "!receivers.isBoolean(receiver)", "!receivers.isNumber(receiver)" },
246242
limit = "getInteropCacheLimit()")
247-
protected static Object call(Object receiver, String name, Object[] args,
243+
protected static Object call(Node node, Object receiver, String name, Object[] args,
248244
@CachedLibrary("receiver") InteropLibrary receivers,
249-
@Cached InteropNodes.InvokeMemberNode invokeNode,
250-
@Bind("this") Node node) {
245+
@Cached InteropNodes.InvokeMemberNode invokeNode) {
251246
return invokeNode.execute(node, receiver, name, args);
252247
}
253248
}

test/truffle/compiler/host-inlining.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ file=${1:-host-inlining.txt}
66

77
if [ -f "$file" ]; then
88
# shellcheck disable=SC2016
9-
ruby tool/extract_host_inlining.rb 'org.truffleruby.language.methods.CallForeignMethodNodeGen$ConvertForOperatorAndReDispatchNodeGen.execute' "$file" > out.txt
9+
ruby tool/extract_host_inlining.rb 'org.truffleruby.language.methods.CallForeignMethodNodeGen.execute' "$file" > out.txt
1010
# shellcheck disable=SC2016
11-
grep -F 'Root[org.truffleruby.language.methods.CallForeignMethodNodeGen$ConvertForOperatorAndReDispatchNodeGen.execute]' out.txt
11+
grep -F 'Root[org.truffleruby.language.methods.CallForeignMethodNodeGen.execute]' out.txt
1212
if ! grep -E 'Out of budget|too big to explore' out.txt; then
13-
echo 'ConvertForOperatorAndReDispatchNodeGen.execute should be out of budget (too much code), did host inlining output change?'
13+
echo 'CallForeignMethodNodeGen.execute should be out of budget (too much code), did host inlining output change?'
1414
cat out.txt
1515
exit 1
1616
fi

0 commit comments

Comments
 (0)