Skip to content

Commit a2b43de

Browse files
committed
Pass a Java String name to GetMethodObjectNode for interop
* Avoids extra j.l.String -> Ruby String -> j.l.String conversion for LookupMethodNode.
1 parent 1ca3cfc commit a2b43de

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

src/main/java/org/truffleruby/language/ImmutableRubyObject.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import org.truffleruby.RubyLanguage;
1515
import org.truffleruby.cext.ValueWrapper;
1616
import org.truffleruby.interop.ForeignToRubyArgumentsNode;
17-
import org.truffleruby.interop.ForeignToRubyNode;
1817
import org.truffleruby.language.dispatch.DispatchConfiguration;
1918
import org.truffleruby.language.dispatch.DispatchNode;
2019
import org.truffleruby.language.dispatch.InternalRespondToNode;
@@ -112,13 +111,11 @@ public boolean isMemberReadable(String name,
112111
@ExportMessage
113112
public Object readMember(String name,
114113
@Cached @Shared("definedNode") InternalRespondToNode definedNode,
115-
@Cached ForeignToRubyNode nameToRubyNode,
116114
@Cached GetMethodObjectNode getMethodObjectNode,
117115
@Shared("errorProfile") @Cached BranchProfile errorProfile)
118116
throws UnknownIdentifierException {
119117
if (definedNode.execute(null, this, name)) {
120-
Object rubyName = nameToRubyNode.executeConvert(name);
121-
return getMethodObjectNode.execute(null, this, rubyName, DispatchConfiguration.PRIVATE);
118+
return getMethodObjectNode.execute(null, this, name, DispatchConfiguration.PRIVATE);
122119
} else {
123120
errorProfile.enter();
124121
throw UnknownIdentifierException.create(name);

src/main/java/org/truffleruby/language/RubyDynamicObject.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ public Object readMember(String name,
591591
if (ivarFoundProfile.profile(iVar != null)) {
592592
return iVar;
593593
} else if (definedNode.execute(null, this, name)) {
594-
return getMethodObjectNode.execute(null, this, rubyName, DispatchConfiguration.PRIVATE);
594+
return getMethodObjectNode.execute(null, this, name, DispatchConfiguration.PRIVATE);
595595
} else {
596596
errorProfile.enter();
597597
throw UnknownIdentifierException.create(name);

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ public static LookupMethodNode create() {
4040
return LookupMethodNodeGen.create();
4141
}
4242

43-
public abstract InternalMethod execute(Frame frame, RubyClass metaClass, String name,
44-
DispatchConfiguration config);
43+
public abstract InternalMethod execute(Frame frame, RubyClass metaClass, String name, DispatchConfiguration config);
4544

4645
@Specialization(
4746
// no need to guard on the context, the metaClass is context-specific

0 commit comments

Comments
 (0)