|
36 | 36 | import org.truffleruby.core.array.library.NativeArrayStorage;
|
37 | 37 | import org.truffleruby.core.cast.BooleanCastNode;
|
38 | 38 | import org.truffleruby.core.cast.CmpIntNode;
|
39 |
| -import org.truffleruby.core.cast.ToIntNode; |
40 |
| -import org.truffleruby.core.cast.ToLongNode; |
41 | 39 | import org.truffleruby.core.cast.ToAryNode;
|
42 | 40 | import org.truffleruby.core.cast.ToAryNodeGen;
|
| 41 | +import org.truffleruby.core.cast.ToIntNode; |
| 42 | +import org.truffleruby.core.cast.ToLongNode; |
43 | 43 | import org.truffleruby.core.cast.ToStrNodeGen;
|
44 | 44 | import org.truffleruby.core.format.BytesResult;
|
45 | 45 | import org.truffleruby.core.format.FormatExceptionTranslator;
|
|
62 | 62 | import org.truffleruby.extra.ffi.Pointer;
|
63 | 63 | import org.truffleruby.language.NotProvided;
|
64 | 64 | import org.truffleruby.language.RubyGuards;
|
65 |
| -import org.truffleruby.language.library.RubyLibrary; |
66 | 65 | import org.truffleruby.language.RubyNode;
|
67 | 66 | import org.truffleruby.language.Visibility;
|
68 | 67 | import org.truffleruby.language.control.RaiseException;
|
69 | 68 | import org.truffleruby.language.dispatch.CallDispatchHeadNode;
|
| 69 | +import org.truffleruby.language.library.RubyLibrary; |
70 | 70 | import org.truffleruby.language.objects.AllocateObjectNode;
|
71 | 71 | import org.truffleruby.language.objects.PropagateTaintNode;
|
72 | 72 | import org.truffleruby.language.objects.WriteObjectFieldNode;
|
73 | 73 | import org.truffleruby.language.objects.shared.PropagateSharingNode;
|
74 | 74 | import org.truffleruby.language.yield.YieldNode;
|
| 75 | +import org.truffleruby.utils.Utils; |
75 | 76 |
|
76 | 77 | import com.oracle.truffle.api.CompilerDirectives;
|
77 | 78 | import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
|
|
92 | 93 | import com.oracle.truffle.api.profiles.BranchProfile;
|
93 | 94 | import com.oracle.truffle.api.profiles.ConditionProfile;
|
94 | 95 | import com.oracle.truffle.api.profiles.IntValueProfile;
|
95 |
| -import org.truffleruby.utils.Utils; |
96 | 96 |
|
97 | 97 | @CoreModule(value = "Array", isClass = true)
|
98 | 98 | public abstract class ArrayNodes {
|
@@ -1027,8 +1027,8 @@ public abstract static class InitializeNode extends YieldingCoreMethodNode {
|
1027 | 1027 | @Child private CallDispatchHeadNode toAryNode;
|
1028 | 1028 | @Child private KernelNodes.RespondToNode respondToToAryNode;
|
1029 | 1029 |
|
1030 |
| - public abstract DynamicObject executeInitialize(VirtualFrame frame, DynamicObject array, Object size, |
1031 |
| - Object fillingValue, Object block); |
| 1030 | + protected abstract DynamicObject executeInitialize(DynamicObject array, Object size, Object fillingValue, |
| 1031 | + NotProvided block); |
1032 | 1032 |
|
1033 | 1033 | @Specialization
|
1034 | 1034 | protected DynamicObject initializeNoArgs(
|
@@ -1120,13 +1120,12 @@ protected DynamicObject initializeWithSizeAndValue(
|
1120 | 1120 | @Specialization(
|
1121 | 1121 | guards = { "wasProvided(size)", "!isInteger(size)", "!isLong(size)", "wasProvided(fillingValue)" })
|
1122 | 1122 | protected DynamicObject initializeSizeOther(
|
1123 |
| - VirtualFrame frame, |
1124 | 1123 | DynamicObject array,
|
1125 | 1124 | Object size,
|
1126 | 1125 | Object fillingValue,
|
1127 | 1126 | NotProvided block) {
|
1128 | 1127 | int intSize = toInt(size);
|
1129 |
| - return executeInitialize(frame, array, intSize, fillingValue, block); |
| 1128 | + return executeInitialize(array, intSize, fillingValue, block); |
1130 | 1129 | }
|
1131 | 1130 |
|
1132 | 1131 | // With block
|
@@ -1168,36 +1167,35 @@ protected DynamicObject initializeFromArray(
|
1168 | 1167 | @Specialization(
|
1169 | 1168 | guards = { "!isInteger(object)", "!isLong(object)", "wasProvided(object)", "!isRubyArray(object)" })
|
1170 | 1169 | protected DynamicObject initialize(
|
1171 |
| - VirtualFrame frame, |
1172 | 1170 | DynamicObject array,
|
1173 | 1171 | Object object,
|
1174 | 1172 | NotProvided unusedValue,
|
1175 | 1173 | NotProvided block) {
|
1176 | 1174 | DynamicObject copy = null;
|
1177 |
| - if (respondToToAry(frame, object)) { |
1178 |
| - Object toAryResult = callToAry(frame, object); |
| 1175 | + if (respondToToAry(object)) { |
| 1176 | + Object toAryResult = callToAry(object); |
1179 | 1177 | if (RubyGuards.isRubyArray(toAryResult)) {
|
1180 | 1178 | copy = (DynamicObject) toAryResult;
|
1181 | 1179 | }
|
1182 | 1180 | }
|
1183 | 1181 |
|
1184 | 1182 | if (copy != null) {
|
1185 |
| - return executeInitialize(frame, array, copy, NotProvided.INSTANCE, NotProvided.INSTANCE); |
| 1183 | + return executeInitialize(array, copy, NotProvided.INSTANCE, NotProvided.INSTANCE); |
1186 | 1184 | } else {
|
1187 | 1185 | int size = toInt(object);
|
1188 |
| - return executeInitialize(frame, array, size, NotProvided.INSTANCE, NotProvided.INSTANCE); |
| 1186 | + return executeInitialize(array, size, NotProvided.INSTANCE, NotProvided.INSTANCE); |
1189 | 1187 | }
|
1190 | 1188 | }
|
1191 | 1189 |
|
1192 |
| - public boolean respondToToAry(VirtualFrame frame, Object object) { |
| 1190 | + public boolean respondToToAry(Object object) { |
1193 | 1191 | if (respondToToAryNode == null) {
|
1194 | 1192 | CompilerDirectives.transferToInterpreterAndInvalidate();
|
1195 | 1193 | respondToToAryNode = insert(KernelNodesFactory.RespondToNodeFactory.create(null, null, null));
|
1196 | 1194 | }
|
1197 |
| - return respondToToAryNode.executeDoesRespondTo(frame, object, coreStrings().TO_ARY.createInstance(), true); |
| 1195 | + return respondToToAryNode.executeDoesRespondTo(null, object, coreStrings().TO_ARY.createInstance(), true); |
1198 | 1196 | }
|
1199 | 1197 |
|
1200 |
| - protected Object callToAry(VirtualFrame frame, Object object) { |
| 1198 | + protected Object callToAry(Object object) { |
1201 | 1199 | if (toAryNode == null) {
|
1202 | 1200 | CompilerDirectives.transferToInterpreterAndInvalidate();
|
1203 | 1201 | toAryNode = insert(CallDispatchHeadNode.createPrivate());
|
|
0 commit comments