Skip to content

Commit 566245f

Browse files
committed
SplatCastNode and ArrayDupNode do not need the frame
1 parent c4e4e43 commit 566245f

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

src/main/java/org/truffleruby/core/array/ArrayDupNode.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import com.oracle.truffle.api.dsl.Cached;
1818
import com.oracle.truffle.api.dsl.ImportStatic;
1919
import com.oracle.truffle.api.dsl.Specialization;
20-
import com.oracle.truffle.api.frame.VirtualFrame;
2120
import com.oracle.truffle.api.library.CachedLibrary;
2221
import com.oracle.truffle.api.nodes.ExplodeLoop;
2322
import org.truffleruby.language.objects.AllocationTracing;
@@ -26,7 +25,7 @@
2625
@ImportStatic(ArrayGuards.class)
2726
public abstract class ArrayDupNode extends RubyContextNode {
2827

29-
public abstract RubyArray executeDup(VirtualFrame frame, RubyArray array);
28+
public abstract RubyArray executeDup(RubyArray array);
3029

3130
@Specialization(
3231
guards = {

src/main/java/org/truffleruby/core/cast/SplatCastNode.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import com.oracle.truffle.api.dsl.Cached;
2525
import com.oracle.truffle.api.dsl.NodeChild;
2626
import com.oracle.truffle.api.dsl.Specialization;
27-
import com.oracle.truffle.api.frame.VirtualFrame;
2827

2928
import static org.truffleruby.language.dispatch.DispatchConfiguration.PRIVATE_RETURN_MISSING;
3029

@@ -59,7 +58,7 @@ public void doNotCopy() {
5958
public abstract RubyNode getChild();
6059

6160
@Specialization
62-
protected Object splatNil(VirtualFrame frame, Nil nil) {
61+
protected Object splatNil(Nil nil) {
6362
switch (nilBehavior) {
6463
case EMPTY_ARRAY:
6564
return createEmptyArray();
@@ -68,7 +67,7 @@ protected Object splatNil(VirtualFrame frame, Nil nil) {
6867
return createArray(new Object[]{ nil });
6968

7069
case CONVERT:
71-
return callToA(frame, nil);
70+
return callToA(nil);
7271

7372
case NIL:
7473
return nil;
@@ -79,18 +78,18 @@ protected Object splatNil(VirtualFrame frame, Nil nil) {
7978
}
8079

8180
@Specialization
82-
protected RubyArray splat(VirtualFrame frame, RubyArray array) {
81+
protected RubyArray splat(RubyArray array) {
8382
// TODO(cs): is it necessary to dup here in all cases?
8483
// It is needed at least for [*ary] (parsed as just a SplatParseNode) and b = *ary.
8584
if (copy) {
86-
return executeDup(frame, array);
85+
return executeDup(array);
8786
} else {
8887
return array;
8988
}
9089
}
9190

9291
@Specialization(guards = { "!isNil(object)", "!isRubyArray(object)" })
93-
protected RubyArray splat(VirtualFrame frame, Object object,
92+
protected RubyArray splat(Object object,
9493
@Cached DispatchNode toArrayNode) {
9594
final Object array = toArrayNode.call(
9695
coreLibrary().truffleTypeModule,
@@ -102,27 +101,27 @@ protected RubyArray splat(VirtualFrame frame, Object object,
102101
return createArray(new Object[]{ object });
103102
} else {
104103
if (copy) {
105-
return executeDup(frame, (RubyArray) array);
104+
return executeDup((RubyArray) array);
106105
} else {
107106
return (RubyArray) array;
108107
}
109108
}
110109
}
111110

112-
private Object callToA(VirtualFrame frame, Object nil) {
111+
private Object callToA(Object nil) {
113112
if (toA == null) {
114113
CompilerDirectives.transferToInterpreterAndInvalidate();
115114
toA = insert(DispatchNode.create(PRIVATE_RETURN_MISSING));
116115
}
117116
return toA.call(nil, "to_a");
118117
}
119118

120-
private RubyArray executeDup(VirtualFrame frame, RubyArray array) {
119+
private RubyArray executeDup(RubyArray array) {
121120
if (dup == null) {
122121
CompilerDirectives.transferToInterpreterAndInvalidate();
123122
dup = insert(ArrayDupNodeGen.create());
124123
}
125-
return dup.executeDup(frame, array);
124+
return dup.executeDup(array);
126125
}
127126

128127
}

0 commit comments

Comments
 (0)