@@ -78,7 +78,6 @@ public static DispatchNode getUncached() {
78
78
@ Child protected ToSymbolNode toSymbol ;
79
79
80
80
protected final ConditionProfile methodMissing ;
81
- protected final ConditionProfile isForeignCall ;
82
81
protected final BranchProfile methodMissingMissing ;
83
82
84
83
protected DispatchNode (
@@ -87,14 +86,12 @@ protected DispatchNode(
87
86
LookupMethodNode methodLookup ,
88
87
CallInternalMethodNode callNode ,
89
88
ConditionProfile methodMissing ,
90
- ConditionProfile isForeignCall ,
91
89
BranchProfile methodMissingMissing ) {
92
90
this .config = config ;
93
91
this .metaclassNode = metaclassNode ;
94
92
this .methodLookup = methodLookup ;
95
93
this .callNode = callNode ;
96
94
this .methodMissing = methodMissing ;
97
- this .isForeignCall = isForeignCall ;
98
95
this .methodMissingMissing = methodMissingMissing ;
99
96
}
100
97
@@ -105,7 +102,6 @@ protected DispatchNode(DispatchConfiguration config) {
105
102
LookupMethodNode .create (),
106
103
CallInternalMethodNode .create (),
107
104
ConditionProfile .create (),
108
- ConditionProfile .create (),
109
105
BranchProfile .create ());
110
106
}
111
107
@@ -122,21 +118,21 @@ public Object dispatch(VirtualFrame frame, Object receiver, String methodName, R
122
118
}
123
119
124
120
public Object execute (VirtualFrame frame , Object receiver , String methodName , RubyProc block , Object [] arguments ) {
125
-
126
121
final RubyClass metaclass = metaclassNode .execute (receiver );
127
122
128
- if (isForeignCall .profile (metaclass == getContext ().getCoreLibrary ().truffleInteropForeignClass )) {
129
- return callForeign (receiver , methodName , block , arguments );
130
- }
131
-
132
123
final InternalMethod method = methodLookup .execute (frame , metaclass , methodName , config );
133
124
134
125
if (methodMissing .profile (method == null || method .isUndefined ())) {
135
126
switch (config .missingBehavior ) {
136
127
case RETURN_MISSING :
137
128
return MISSING ;
138
129
case CALL_METHOD_MISSING :
139
- return callMethodMissing (frame , receiver , methodName , block , arguments );
130
+ // Both branches implicitly profile through lazy node creation
131
+ if (metaclass == getContext ().getCoreLibrary ().truffleInteropForeignClass ) {
132
+ return callForeign (receiver , methodName , block , arguments );
133
+ } else {
134
+ return callMethodMissing (frame , receiver , methodName , block , arguments );
135
+ }
140
136
}
141
137
}
142
138
@@ -240,7 +236,6 @@ protected Uncached(DispatchConfiguration config) {
240
236
LookupMethodNodeGen .getUncached (),
241
237
CallInternalMethodNodeGen .getUncached (),
242
238
ConditionProfile .getUncached (),
243
- ConditionProfile .getUncached (),
244
239
BranchProfile .getUncached ());
245
240
}
246
241
0 commit comments