File tree Expand file tree Collapse file tree 2 files changed +14
-8
lines changed
src/main/java/org/truffleruby Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change 9
9
*/
10
10
package org .truffleruby .core .cast ;
11
11
12
+ import com .oracle .truffle .api .dsl .GenerateCached ;
13
+ import com .oracle .truffle .api .dsl .GenerateInline ;
14
+ import com .oracle .truffle .api .nodes .Node ;
12
15
import org .truffleruby .language .RubyBaseNode ;
13
16
import org .truffleruby .language .control .RaiseException ;
14
17
18
21
19
22
/** See {@link ToIntNode} for a comparison of different integer conversion nodes. */
20
23
@ GenerateUncached
24
+ @ GenerateInline
25
+ @ GenerateCached (false )
21
26
public abstract class LongCastNode extends RubyBaseNode {
22
27
23
- public abstract long executeCastLong (Object value );
28
+ public abstract long executeCastLong (Node node , Object value );
24
29
25
30
@ Specialization
26
- long doInt (int value ) {
31
+ static long doInt (int value ) {
27
32
return value ;
28
33
}
29
34
30
35
@ Specialization
31
- long doLong (long value ) {
36
+ static long doLong (long value ) {
32
37
return value ;
33
38
}
34
39
35
40
@ TruffleBoundary
36
41
@ Specialization (guards = "!isImplicitLong(value)" )
37
- long doBasicObject (Object value ) {
42
+ static long doBasicObject (Node node , Object value ) {
38
43
throw new RaiseException (
39
- getContext (),
40
- coreExceptions ().typeErrorIsNotA (value .toString (), "Integer (fitting in long)" , this ));
44
+ getContext (node ),
45
+ coreExceptions (node ).typeErrorIsNotA (value .toString (), "Integer (fitting in long)" , node ));
41
46
}
42
47
}
Original file line number Diff line number Diff line change @@ -516,7 +516,8 @@ public long asPointer(
516
516
@ Cached @ Shared BranchProfile errorProfile ,
517
517
@ Cached @ Exclusive DispatchNode dispatchNode ,
518
518
@ Cached @ Shared TranslateInteropRubyExceptionNode translateRubyException ,
519
- @ Cached LongCastNode longCastNode ) throws UnsupportedMessageException {
519
+ @ Cached LongCastNode longCastNode ,
520
+ @ Bind ("$node" ) Node node ) throws UnsupportedMessageException {
520
521
521
522
Object value ;
522
523
try {
@@ -528,7 +529,7 @@ public long asPointer(
528
529
errorProfile .enter ();
529
530
throw UnsupportedMessageException .create ();
530
531
}
531
- return longCastNode .executeCastLong (value );
532
+ return longCastNode .executeCastLong (node , value );
532
533
}
533
534
534
535
@ ExportMessage
You can’t perform that action at this time.
0 commit comments