File tree Expand file tree Collapse file tree 4 files changed +8
-20
lines changed
src/main/java/org/truffleruby Expand file tree Collapse file tree 4 files changed +8
-20
lines changed Original file line number Diff line number Diff line change 25
25
import com .oracle .truffle .api .frame .VirtualFrame ;
26
26
import com .oracle .truffle .api .profiles .BranchProfile ;
27
27
28
- import static org .truffleruby .language .dispatch .DispatchConfiguration .PRIVATE_RETURN_MISSING ;
29
28
30
29
/*
31
30
* TODO(CS): could probably unify this with SplatCastNode with some final configuration getContext().getOptions().
@@ -37,8 +36,6 @@ public abstract class ArrayCastNode extends RubyContextSourceNode {
37
36
38
37
private final SplatCastNode .NilBehavior nilBehavior ;
39
38
40
- @ Child private DispatchNode toArrayNode = DispatchNode .create (PRIVATE_RETURN_MISSING );
41
-
42
39
public static ArrayCastNode create () {
43
40
return ArrayCastNodeGen .create (null );
44
41
}
@@ -104,9 +101,10 @@ protected Object cast(Nil nil) {
104
101
105
102
@ Specialization (guards = { "!isRubyBignum(object)" , "!isRubyArray(object)" })
106
103
protected Object cast (RubyDynamicObject object ,
107
- @ Cached BranchProfile errorProfile ) {
108
- final Object result = toArrayNode . call ( object , "to_ary" );
104
+ @ Cached BranchProfile errorProfile ,
105
+ @ Cached ( parameters = "PRIVATE_RETURN_MISSING" ) DispatchNode toArrayNode ) {
109
106
107
+ final Object result = toArrayNode .call (object , "to_ary" );
110
108
if (result == nil ) {
111
109
return nil ;
112
110
}
Original file line number Diff line number Diff line change 24
24
import com .oracle .truffle .api .frame .VirtualFrame ;
25
25
import com .oracle .truffle .api .profiles .BranchProfile ;
26
26
27
- import static org .truffleruby .language .dispatch .DispatchConfiguration .PRIVATE_RETURN_MISSING ;
28
27
29
28
// TODO(CS): copy and paste of ArrayCastNode
30
29
31
30
@ NodeChild (value = "child" , type = RubyNode .class )
32
31
public abstract class HashCastNode extends RubyContextSourceNode {
33
32
34
- @ Child private DispatchNode toHashNode = DispatchNode .create (PRIVATE_RETURN_MISSING );
35
-
36
33
protected abstract RubyNode getChild ();
37
34
38
35
@ Specialization
@@ -72,9 +69,10 @@ protected Object castHash(RubyHash hash) {
72
69
73
70
@ Specialization (guards = { "!isRubyBignum(object)" , "!isRubyHash(object)" })
74
71
protected Object cast (RubyDynamicObject object ,
75
- @ Cached BranchProfile errorProfile ) {
76
- final Object result = toHashNode . call ( object , "to_hash" );
72
+ @ Cached BranchProfile errorProfile ,
73
+ @ Cached ( parameters = "PRIVATE_RETURN_MISSING" ) DispatchNode toHashNode ) {
77
74
75
+ final Object result = toHashNode .call (object , "to_hash" );
78
76
if (result == DispatchNode .MISSING ) {
79
77
return nil ;
80
78
}
Original file line number Diff line number Diff line change 15
15
import org .truffleruby .language .control .RaiseException ;
16
16
import org .truffleruby .language .dispatch .DispatchNode ;
17
17
18
- import com .oracle .truffle .api .CompilerDirectives ;
19
18
import com .oracle .truffle .api .dsl .Cached ;
20
19
import com .oracle .truffle .api .dsl .NodeChild ;
21
20
import com .oracle .truffle .api .dsl .Specialization ;
25
24
@ NodeChild (value = "child" , type = RubyNode .class )
26
25
public abstract class ToAryNode extends RubyContextSourceNode {
27
26
28
- @ Child private DispatchNode toAryNode ;
29
-
30
27
public static ToAryNode createInternal () {
31
28
return ToAryNodeGen .create (null );
32
29
}
@@ -40,12 +37,8 @@ protected RubyArray coerceRubyArray(RubyArray array) {
40
37
41
38
@ Specialization (guards = "!isRubyArray(object)" )
42
39
protected RubyArray coerceObject (Object object ,
43
- @ Cached BranchProfile errorProfile ) {
44
- if (toAryNode == null ) {
45
- CompilerDirectives .transferToInterpreterAndInvalidate ();
46
- toAryNode = insert (DispatchNode .create ());
47
- }
48
-
40
+ @ Cached BranchProfile errorProfile ,
41
+ @ Cached DispatchNode toAryNode ) {
49
42
final Object coerced ;
50
43
try {
51
44
coerced = toAryNode .call (object , "to_ary" );
Original file line number Diff line number Diff line change @@ -1615,7 +1615,6 @@ public RubyNode visitHashNode(HashParseNode node) {
1615
1615
final SourceIndexLength sourceSection = node .getPosition ();
1616
1616
1617
1617
final List <RubyNode > hashConcats = new ArrayList <>();
1618
-
1619
1618
final List <RubyNode > keyValues = new ArrayList <>();
1620
1619
1621
1620
for (ParseNodeTuple pair : node .getPairs ()) {
You can’t perform that action at this time.
0 commit comments