14
14
import com .oracle .truffle .api .Truffle ;
15
15
import com .oracle .truffle .api .dsl .Cached ;
16
16
import com .oracle .truffle .api .dsl .CachedContext ;
17
+ import com .oracle .truffle .api .dsl .CachedLanguage ;
17
18
import com .oracle .truffle .api .dsl .GenerateUncached ;
18
19
import com .oracle .truffle .api .dsl .Specialization ;
19
20
import com .oracle .truffle .api .frame .Frame ;
@@ -57,6 +58,7 @@ protected RubyMethod getMethodObject(
57
58
Object name ,
58
59
DispatchConfiguration dispatchConfig ,
59
60
MaterializedFrame callerFrame ,
61
+ @ CachedLanguage RubyLanguage language ,
60
62
@ CachedContext (RubyLanguage .class ) RubyContext context ,
61
63
@ Cached NameToJavaStringNode nameToJavaStringNode ,
62
64
@ Cached LookupMethodOnSelfNode lookupMethodNode ,
@@ -89,7 +91,7 @@ protected RubyMethod getMethodObject(
89
91
RubyArguments .setDeclarationContext (frame , originalDeclarationContext );
90
92
final InternalMethod methodMissing = lookupMethodNode
91
93
.execute (frame , self , "method_missing" , dispatchConfig );
92
- method = createMissingMethod (self , name , normalizedName , methodMissing , context );
94
+ method = createMissingMethod (self , name , normalizedName , methodMissing , language , context );
93
95
} else {
94
96
throw new RaiseException (
95
97
context ,
@@ -101,24 +103,23 @@ protected RubyMethod getMethodObject(
101
103
}
102
104
final RubyMethod instance = new RubyMethod (
103
105
context .getCoreLibrary ().methodClass ,
104
- RubyLanguage . getCurrentLanguage () .methodShape ,
106
+ language .methodShape ,
105
107
self ,
106
108
method );
107
- AllocationTracing .trace (RubyLanguage . getCurrentLanguage () , context , instance , this );
109
+ AllocationTracing .trace (language , context , instance , this );
108
110
return instance ;
109
111
}
110
112
111
113
@ TruffleBoundary
112
114
private InternalMethod createMissingMethod (Object self , Object name , String normalizedName ,
113
- InternalMethod methodMissing ,
114
- RubyContext context ) {
115
+ InternalMethod methodMissing , RubyLanguage language , RubyContext context ) {
115
116
final SharedMethodInfo info = methodMissing
116
117
.getSharedMethodInfo ()
117
118
.convertMethodMissingToMethod (methodMissing .getDeclaringModule (), normalizedName );
118
119
119
120
final RubyNode newBody = new CallMethodMissingWithStaticName (name );
120
121
final RubyRootNode newRootNode = new RubyRootNode (
121
- RubyLanguage . getCurrentLanguage () ,
122
+ language ,
122
123
info .getSourceSection (),
123
124
new FrameDescriptor (nil ),
124
125
info ,
0 commit comments