12
12
import com .oracle .truffle .api .CompilerDirectives ;
13
13
import com .oracle .truffle .api .CompilerDirectives .TruffleBoundary ;
14
14
import com .oracle .truffle .api .dsl .Cached ;
15
+ import com .oracle .truffle .api .dsl .CachedLanguage ;
15
16
import com .oracle .truffle .api .dsl .ImportStatic ;
16
17
import com .oracle .truffle .api .dsl .Specialization ;
17
18
import com .oracle .truffle .api .frame .VirtualFrame ;
20
21
import com .oracle .truffle .api .profiles .ConditionProfile ;
21
22
import org .jcodings .specific .USASCIIEncoding ;
22
23
import org .jcodings .specific .UTF8Encoding ;
24
+ import org .truffleruby .RubyLanguage ;
23
25
import org .truffleruby .SuppressFBWarnings ;
24
26
import org .truffleruby .builtins .CoreMethod ;
25
27
import org .truffleruby .builtins .CoreMethodArrayArgumentsNode ;
33
35
import org .truffleruby .core .string .RubyString ;
34
36
import org .truffleruby .core .string .StringNodes ;
35
37
import org .truffleruby .core .string .StringUtils ;
36
- import org .truffleruby .core .symbol .CoreSymbols ;
37
38
import org .truffleruby .language .Nil ;
38
39
import org .truffleruby .language .RubyDynamicObject ;
39
40
import org .truffleruby .language .Visibility ;
@@ -76,8 +77,9 @@ protected double add(double a, RubyBignum b) {
76
77
77
78
@ Specialization (guards = "!isRubyNumber(b)" )
78
79
protected Object addCoerced (double a , Object b ,
79
- @ Cached DispatchNode redoCoerced ) {
80
- return redoCoerced .call (a , "redo_coerced" , CoreSymbols .PLUS , b );
80
+ @ Cached DispatchNode redoCoerced ,
81
+ @ CachedLanguage RubyLanguage language ) {
82
+ return redoCoerced .call (a , "redo_coerced" , language .coreSymbols .PLUS , b );
81
83
}
82
84
}
83
85
@@ -101,8 +103,9 @@ protected double sub(double a, RubyBignum b) {
101
103
102
104
@ Specialization (guards = "!isRubyNumber(b)" )
103
105
protected Object subCoerced (double a , Object b ,
104
- @ Cached DispatchNode redoCoerced ) {
105
- return redoCoerced .call (a , "redo_coerced" , CoreSymbols .MINUS , b );
106
+ @ Cached DispatchNode redoCoerced ,
107
+ @ CachedLanguage RubyLanguage language ) {
108
+ return redoCoerced .call (a , "redo_coerced" , language .coreSymbols .MINUS , b );
106
109
}
107
110
108
111
}
@@ -127,8 +130,9 @@ protected double mul(double a, RubyBignum b) {
127
130
128
131
@ Specialization (guards = "!isRubyNumber(b)" )
129
132
protected Object mulCoerced (double a , Object b ,
130
- @ Cached DispatchNode redoCoerced ) {
131
- return redoCoerced .call (a , "redo_coerced" , CoreSymbols .MULTIPLY , b );
133
+ @ Cached DispatchNode redoCoerced ,
134
+ @ CachedLanguage RubyLanguage language ) {
135
+ return redoCoerced .call (a , "redo_coerced" , language .coreSymbols .MULTIPLY , b );
132
136
}
133
137
134
138
}
@@ -183,8 +187,9 @@ protected double pow(double base, RubyBignum exponent) {
183
187
184
188
@ Specialization (guards = "!isRubyNumber(exponent)" )
185
189
protected Object powCoerced (double base , Object exponent ,
186
- @ Cached DispatchNode redoCoerced ) {
187
- return redoCoerced .call (base , "redo_coerced" , CoreSymbols .POW , exponent );
190
+ @ Cached DispatchNode redoCoerced ,
191
+ @ CachedLanguage RubyLanguage language ) {
192
+ return redoCoerced .call (base , "redo_coerced" , language .coreSymbols .POW , exponent );
188
193
}
189
194
190
195
}
@@ -209,8 +214,9 @@ protected double div(double a, RubyBignum b) {
209
214
210
215
@ Specialization (guards = "!isRubyNumber(b)" )
211
216
protected Object divCoerced (double a , Object b ,
212
- @ Cached DispatchNode redoCoerced ) {
213
- return redoCoerced .call (a , "redo_coerced" , CoreSymbols .DIVIDE , b );
217
+ @ Cached DispatchNode redoCoerced ,
218
+ @ CachedLanguage RubyLanguage language ) {
219
+ return redoCoerced .call (a , "redo_coerced" , language .coreSymbols .DIVIDE , b );
214
220
}
215
221
216
222
}
@@ -255,8 +261,9 @@ protected double mod(double a, RubyBignum b) {
255
261
256
262
@ Specialization (guards = "!isRubyNumber(b)" )
257
263
protected Object modCoerced (double a , Object b ,
258
- @ Cached DispatchNode redoCoerced ) {
259
- return redoCoerced .call (a , "redo_coerced" , CoreSymbols .MODULO , b );
264
+ @ Cached DispatchNode redoCoerced ,
265
+ @ CachedLanguage RubyLanguage language ) {
266
+ return redoCoerced .call (a , "redo_coerced" , language .coreSymbols .MODULO , b );
260
267
}
261
268
262
269
}
@@ -283,8 +290,9 @@ protected RubyArray divMod(double a, RubyBignum b) {
283
290
284
291
@ Specialization (guards = "!isRubyBignum(b)" )
285
292
protected Object divModCoerced (double a , RubyDynamicObject b ,
286
- @ Cached DispatchNode redoCoerced ) {
287
- return redoCoerced .call (a , "redo_coerced" , CoreSymbols .DIVMOD , b );
293
+ @ Cached DispatchNode redoCoerced ,
294
+ @ CachedLanguage RubyLanguage language ) {
295
+ return redoCoerced .call (a , "redo_coerced" , language .coreSymbols .DIVMOD , b );
288
296
}
289
297
290
298
}
@@ -309,8 +317,9 @@ protected boolean lessBignum(double a, RubyBignum b) {
309
317
310
318
@ Specialization (guards = "!isRubyNumber(b)" )
311
319
protected Object lessCoerced (double a , Object b ,
312
- @ Cached DispatchNode redoCompare ) {
313
- return redoCompare .call (a , "redo_compare" , CoreSymbols .LESS_THAN , b );
320
+ @ Cached DispatchNode redoCompare ,
321
+ @ CachedLanguage RubyLanguage language ) {
322
+ return redoCompare .call (a , "redo_compare" , language .coreSymbols .LESS_THAN , b );
314
323
}
315
324
}
316
325
@@ -334,8 +343,9 @@ protected boolean lessEqual(double a, RubyBignum b) {
334
343
335
344
@ Specialization (guards = "!isRubyNumber(b)" )
336
345
protected Object lessEqualCoerced (double a , Object b ,
337
- @ Cached DispatchNode redoCompare ) {
338
- return redoCompare .call (a , "redo_compare" , CoreSymbols .LEQ , b );
346
+ @ Cached DispatchNode redoCompare ,
347
+ @ CachedLanguage RubyLanguage language ) {
348
+ return redoCompare .call (a , "redo_compare" , language .coreSymbols .LEQ , b );
339
349
}
340
350
}
341
351
@@ -451,8 +461,9 @@ protected boolean greaterEqual(double a, RubyBignum b) {
451
461
452
462
@ Specialization (guards = "!isRubyNumber(b)" )
453
463
protected Object greaterEqualCoerced (double a , Object b ,
454
- @ Cached DispatchNode redoCompare ) {
455
- return redoCompare .call (a , "redo_compare" , CoreSymbols .GEQ , b );
464
+ @ Cached DispatchNode redoCompare ,
465
+ @ CachedLanguage RubyLanguage language ) {
466
+ return redoCompare .call (a , "redo_compare" , language .coreSymbols .GEQ , b );
456
467
}
457
468
458
469
}
@@ -477,8 +488,9 @@ protected boolean greater(double a, RubyBignum b) {
477
488
478
489
@ Specialization (guards = "!isRubyNumber(b)" )
479
490
protected Object greaterCoerced (double a , Object b ,
480
- @ Cached DispatchNode redoCompare ) {
481
- return redoCompare .call (a , "redo_compare" , CoreSymbols .GREATER_THAN , b );
491
+ @ Cached DispatchNode redoCompare ,
492
+ @ CachedLanguage RubyLanguage language ) {
493
+ return redoCompare .call (a , "redo_compare" , language .coreSymbols .GREATER_THAN , b );
482
494
}
483
495
}
484
496
0 commit comments