Skip to content

Commit 51403f6

Browse files
committed
[GR-25848] More splitting changes.
PullRequest: truffleruby/2098
2 parents ddaae72 + 74d9783 commit 51403f6

30 files changed

+369
-279
lines changed

src/main/java/org/truffleruby/RubyContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ public Object send(Object object, String methodName, Object... arguments) {
425425

426426
return IndirectCallNode.getUncached().call(
427427
method.getCallTarget(),
428-
RubyArguments.pack(null, null, null, method, null, object, null, arguments));
428+
RubyArguments.pack(null, null, method, null, object, null, arguments));
429429
}
430430

431431
@TruffleBoundary

src/main/java/org/truffleruby/core/binding/BindingNodes.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ public static MaterializedFrame newFrame(MaterializedFrame parent, FrameDescript
110110
RubyArguments.pack(
111111
parent,
112112
null,
113-
null,
114113
RubyArguments.getMethod(parent),
115114
RubyArguments.getDeclarationContext(parent),
116115
null,

src/main/java/org/truffleruby/core/kernel/KernelNodes.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,6 @@ private Object eval(Object target, RootNodeWrapper rootNode, RootCallTarget call
782782
return callNode.call(RubyArguments.pack(
783783
parentFrame,
784784
null,
785-
null,
786785
method,
787786
null,
788787
target,

src/main/java/org/truffleruby/core/kernel/TruffleKernelNodes.java

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import org.truffleruby.language.RubyContextNode;
3131
import org.truffleruby.language.RubyNode;
3232
import org.truffleruby.language.RubyRootNode;
33-
import org.truffleruby.language.arguments.ReadCallerStorageNode;
33+
import org.truffleruby.language.arguments.ReadCallerVariablesNode;
3434
import org.truffleruby.language.arguments.RubyArguments;
3535
import org.truffleruby.language.control.RaiseException;
3636
import org.truffleruby.language.dispatch.DispatchNode;
@@ -234,25 +234,25 @@ protected SpecialVariableStorage getFromKnownFrameDescriptor(VirtualFrame frame,
234234
@Cached("declarationDescriptor(frame, declarationFrameDepth)") FrameDescriptor declarationFrameDescriptor,
235235
@Cached("declarationSlot(declarationFrameDescriptor)") FrameSlot declarationFrameSlot,
236236
@Cached("declarationFrameDescriptor.getVersion()") Assumption frameAssumption) {
237-
Object storage;
237+
Object variables;
238238
if (declarationFrameDepth == 0) {
239-
storage = FrameUtil.getObjectSafe(frame, declarationFrameSlot);
240-
if (storage == nil) {
239+
variables = FrameUtil.getObjectSafe(frame, declarationFrameSlot);
240+
if (variables == nil) {
241241
CompilerDirectives.transferToInterpreterAndInvalidate();
242-
storage = new SpecialVariableStorage();
243-
frame.setObject(declarationFrameSlot, storage);
242+
variables = new SpecialVariableStorage();
243+
frame.setObject(declarationFrameSlot, variables);
244244
}
245245
} else {
246246
MaterializedFrame storageFrame = RubyArguments.getDeclarationFrame(frame, declarationFrameDepth);
247247

248-
storage = FrameUtil.getObjectSafe(storageFrame, declarationFrameSlot);
249-
if (storage == nil) {
248+
variables = FrameUtil.getObjectSafe(storageFrame, declarationFrameSlot);
249+
if (variables == nil) {
250250
CompilerDirectives.transferToInterpreterAndInvalidate();
251-
storage = new SpecialVariableStorage();
252-
storageFrame.setObject(declarationFrameSlot, storage);
251+
variables = new SpecialVariableStorage();
252+
storageFrame.setObject(declarationFrameSlot, variables);
253253
}
254254
}
255-
return (SpecialVariableStorage) storage;
255+
return (SpecialVariableStorage) variables;
256256
}
257257

258258
@Specialization(replaces = "getFromKnownFrameDescriptor")
@@ -267,12 +267,12 @@ public static SpecialVariableStorage getSlow(MaterializedFrame aFrame) {
267267
while (true) {
268268
final FrameSlot slot = getVariableSlot(frame);
269269
if (slot != null) {
270-
Object storage = FrameUtil.getObjectSafe(frame, slot);
271-
if (storage == Nil.INSTANCE) {
272-
storage = new SpecialVariableStorage();
273-
frame.setObject(slot, storage);
270+
Object variables = FrameUtil.getObjectSafe(frame, slot);
271+
if (variables == Nil.INSTANCE) {
272+
variables = new SpecialVariableStorage();
273+
frame.setObject(slot, variables);
274274
}
275-
return (SpecialVariableStorage) storage;
275+
return (SpecialVariableStorage) variables;
276276
}
277277

278278
final MaterializedFrame nextFrame = RubyArguments.getDeclarationFrame(frame);
@@ -282,9 +282,9 @@ public static SpecialVariableStorage getSlow(MaterializedFrame aFrame) {
282282
FrameSlot newSlot = frame
283283
.getFrameDescriptor()
284284
.findOrAddFrameSlot(Layouts.SPECIAL_VARIABLES_STORAGE);
285-
SpecialVariableStorage storage = new SpecialVariableStorage();
286-
frame.setObject(newSlot, storage);
287-
return storage;
285+
SpecialVariableStorage variables = new SpecialVariableStorage();
286+
frame.setObject(newSlot, variables);
287+
return variables;
288288
}
289289
}
290290
}
@@ -297,20 +297,20 @@ public static GetSpecialVariableStorage create() {
297297
@Primitive(name = "caller_special_variables")
298298
public abstract static class GetCallerSpecialVariableStorage extends PrimitiveArrayArgumentsNode {
299299

300-
@Child ReadCallerStorageNode callerStorageNode = new ReadCallerStorageNode();
300+
@Child ReadCallerVariablesNode callerVariablesNode = new ReadCallerVariablesNode();
301301

302302
@Specialization
303303
protected Object storage(VirtualFrame frame) {
304-
return callerStorageNode.execute(frame);
304+
return callerVariablesNode.execute(frame);
305305
}
306306
}
307307

308308
@Primitive(name = "proc_special_variables")
309309
public abstract static class GetProcSpecialVariableStorage extends PrimitiveArrayArgumentsNode {
310310

311311
@Specialization
312-
protected Object storage(VirtualFrame frame, RubyProc proc) {
313-
return proc.declarationStorage;
312+
protected Object variables(VirtualFrame frame, RubyProc proc) {
313+
return proc.declarationVariables;
314314
}
315315
}
316316

@@ -376,10 +376,10 @@ public static GetSpecialVariableStorage create() {
376376
public abstract static class SetRegexpMatch extends PrimitiveArrayArgumentsNode {
377377

378378
@Specialization
379-
protected Object executeSetRegexpMatch(SpecialVariableStorage storage, Object lastMatch,
379+
protected Object executeSetRegexpMatch(SpecialVariableStorage variables, Object lastMatch,
380380
@Cached ConditionProfile unsetProfile,
381381
@Cached ConditionProfile sameThreadProfile) {
382-
storage.setLastMatch(lastMatch, getContext(), unsetProfile, sameThreadProfile);
382+
variables.setLastMatch(lastMatch, getContext(), unsetProfile, sameThreadProfile);
383383
return lastMatch;
384384
}
385385
}
@@ -388,21 +388,21 @@ protected Object executeSetRegexpMatch(SpecialVariableStorage storage, Object la
388388
public abstract static class GetRegexpMatch extends PrimitiveArrayArgumentsNode {
389389

390390
@Specialization
391-
protected Object executeSetRegexpMatch(SpecialVariableStorage storage,
391+
protected Object executeSetRegexpMatch(SpecialVariableStorage variables,
392392
@Cached ConditionProfile unsetProfile,
393393
@Cached ConditionProfile sameThreadProfile) {
394-
return storage.getLastMatch(unsetProfile, sameThreadProfile);
394+
return variables.getLastMatch(unsetProfile, sameThreadProfile);
395395
}
396396
}
397397

398398
@Primitive(name = "io_last_line_set")
399399
public abstract static class SetLastIO extends PrimitiveArrayArgumentsNode {
400400

401401
@Specialization
402-
protected Object executeSetRegexpMatch(SpecialVariableStorage storage, Object lastIO,
402+
protected Object executeSetRegexpMatch(SpecialVariableStorage variables, Object lastIO,
403403
@Cached ConditionProfile unsetProfile,
404404
@Cached ConditionProfile sameThreadProfile) {
405-
storage.setLastLine(lastIO, getContext(), unsetProfile, sameThreadProfile);
405+
variables.setLastLine(lastIO, getContext(), unsetProfile, sameThreadProfile);
406406
return lastIO;
407407
}
408408
}

src/main/java/org/truffleruby/core/method/MethodNodes.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -272,12 +272,12 @@ protected RubyProc toProcUncached(RubyMethod methodObject) {
272272

273273
private RubyProc createProc(RootCallTarget callTarget, InternalMethod method, Object receiver) {
274274
final Object[] packedArgs = RubyArguments
275-
.pack(null, null, null, method, null, receiver, null, EMPTY_ARGUMENTS);
275+
.pack(null, null, method, null, receiver, null, EMPTY_ARGUMENTS);
276276
final MaterializedFrame declarationFrame = Truffle
277277
.getRuntime()
278278
.createMaterializedFrame(packedArgs, coreLibrary().emptyDeclarationDescriptor);
279-
SpecialVariableStorage storage = new SpecialVariableStorage();
280-
declarationFrame.setObject(coreLibrary().emptyDeclarationSpecialVariableSlot, storage);
279+
SpecialVariableStorage variables = new SpecialVariableStorage();
280+
declarationFrame.setObject(coreLibrary().emptyDeclarationSpecialVariableSlot, variables);
281281
return ProcOperations.createRubyProc(
282282
coreLibrary().procClass,
283283
getLanguage().procShape,
@@ -286,7 +286,7 @@ private RubyProc createProc(RootCallTarget callTarget, InternalMethod method, Ob
286286
callTarget,
287287
callTarget,
288288
declarationFrame,
289-
storage,
289+
variables,
290290
method,
291291
null,
292292
null,

src/main/java/org/truffleruby/core/proc/ProcNodes.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ protected RubyProc procSpecial(RubyClass procClass, Object[] args, RubyProc bloc
110110
block.callTargetForType,
111111
block.callTargetForLambdas,
112112
block.declarationFrame,
113-
block.declarationStorage,
113+
block.declarationVariables,
114114
block.method,
115115
block.block,
116116
block.frameOnStackMarker,
@@ -149,7 +149,7 @@ protected RubyProc dup(RubyProc proc,
149149
proc.callTargetForType,
150150
proc.callTargetForLambdas,
151151
proc.declarationFrame,
152-
proc.declarationStorage,
152+
proc.declarationVariables,
153153
proc.method,
154154
proc.block,
155155
proc.frameOnStackMarker,
@@ -270,7 +270,7 @@ protected RubyProc createSameArityProc(RubyProc userProc, RubyProc block) {
270270
block.callTargetForType,
271271
block.callTargetForLambdas,
272272
block.declarationFrame,
273-
block.declarationStorage,
273+
block.declarationVariables,
274274
block.method,
275275
block.block,
276276
block.frameOnStackMarker,

src/main/java/org/truffleruby/core/proc/ProcOperations.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ private static Object[] packArguments(RubyProc proc, Object... args) {
2929
return RubyArguments.pack(
3030
proc.declarationFrame,
3131
null,
32-
null,
3332
proc.method,
3433
proc.frameOnStackMarker,
3534
getSelf(proc),
@@ -58,7 +57,7 @@ public static RubyProc createRubyProc(
5857
RootCallTarget callTargetForProcs,
5958
RootCallTarget callTargetForLambdas,
6059
MaterializedFrame declarationFrame,
61-
SpecialVariableStorage storage,
60+
SpecialVariableStorage variables,
6261
InternalMethod method,
6362
RubyProc block,
6463
FrameOnStackMarker frameOnStackMarker,
@@ -85,7 +84,7 @@ public static RubyProc createRubyProc(
8584
callTargetForType,
8685
callTargetForLambdas,
8786
declarationFrame,
88-
storage,
87+
variables,
8988
method,
9089
block,
9190
frameOnStackMarker,
@@ -103,7 +102,7 @@ public static RubyProc createLambdaFromBlock(RubyContext context, RubyLanguage l
103102
block.callTargetForLambdas,
104103
block.callTargetForLambdas,
105104
block.declarationFrame,
106-
block.declarationStorage,
105+
block.declarationVariables,
107106
block.method,
108107
block.block,
109108
null,

src/main/java/org/truffleruby/core/proc/RubyProc.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class RubyProc extends RubyDynamicObject implements ObjectGraphNode {
4040
public final RootCallTarget callTargetForType;
4141
public final RootCallTarget callTargetForLambdas;
4242
public final MaterializedFrame declarationFrame;
43-
public final SpecialVariableStorage declarationStorage;
43+
public final SpecialVariableStorage declarationVariables;
4444
public final InternalMethod method;
4545
public final RubyProc block;
4646
public final FrameOnStackMarker frameOnStackMarker;
@@ -54,7 +54,7 @@ public RubyProc(
5454
RootCallTarget callTargetForType,
5555
RootCallTarget callTargetForLambdas,
5656
MaterializedFrame declarationFrame,
57-
SpecialVariableStorage declarationStorage,
57+
SpecialVariableStorage declarationVariables,
5858
InternalMethod method,
5959
RubyProc block,
6060
FrameOnStackMarker frameOnStackMarker,
@@ -65,7 +65,7 @@ public RubyProc(
6565
this.callTargetForType = callTargetForType;
6666
this.callTargetForLambdas = callTargetForLambdas;
6767
this.declarationFrame = declarationFrame;
68-
this.declarationStorage = declarationStorage;
68+
this.declarationVariables = declarationVariables;
6969
this.method = method;
7070
this.block = block;
7171
this.frameOnStackMarker = frameOnStackMarker;

src/main/java/org/truffleruby/core/string/StringNodes.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@
164164
import org.truffleruby.language.RubyContextNode;
165165
import org.truffleruby.language.RubyNode;
166166
import org.truffleruby.language.Visibility;
167-
import org.truffleruby.language.arguments.ReadCallerStorageNode;
167+
import org.truffleruby.language.arguments.ReadCallerVariablesNode;
168168
import org.truffleruby.language.control.RaiseException;
169169
import org.truffleruby.language.dispatch.DispatchNode;
170170
import org.truffleruby.language.library.RubyLibrary;
@@ -700,7 +700,7 @@ private Object sliceRange(RubyString string, int begin, int end, boolean exclude
700700
@Specialization
701701
protected Object sliceCapture0(VirtualFrame frame, RubyString string, RubyRegexp regexp, NotProvided capture,
702702
@Cached DispatchNode callNode,
703-
@Cached ReadCallerStorageNode readCallerNode,
703+
@Cached ReadCallerVariablesNode readCallerNode,
704704
@Cached ConditionProfile unsetProfile,
705705
@Cached ConditionProfile sameThreadProfile) {
706706
return sliceCapture(
@@ -717,18 +717,18 @@ protected Object sliceCapture0(VirtualFrame frame, RubyString string, RubyRegexp
717717
@Specialization(guards = "wasProvided(capture)")
718718
protected Object sliceCapture(VirtualFrame frame, RubyString string, RubyRegexp regexp, Object capture,
719719
@Cached DispatchNode callNode,
720-
@Cached ReadCallerStorageNode readCallerStorageNode,
720+
@Cached ReadCallerVariablesNode readCallerStorageNode,
721721
@Cached ConditionProfile unsetProfile,
722722
@Cached ConditionProfile sameThreadProfile) {
723723
final Object matchStrPair = callNode.call(string, "subpattern", regexp, capture);
724724

725-
final SpecialVariableStorage storage = readCallerStorageNode.execute(frame);
725+
final SpecialVariableStorage variables = readCallerStorageNode.execute(frame);
726726
if (matchStrPair == nil) {
727-
storage.setLastMatch(nil, getContext(), unsetProfile, sameThreadProfile);
727+
variables.setLastMatch(nil, getContext(), unsetProfile, sameThreadProfile);
728728
return nil;
729729
} else {
730730
final Object[] array = (Object[]) ((RubyArray) matchStrPair).store;
731-
storage.setLastMatch(array[0], getContext(), unsetProfile, sameThreadProfile);
731+
variables.setLastMatch(array[0], getContext(), unsetProfile, sameThreadProfile);
732732
return array[1];
733733
}
734734
}

src/main/java/org/truffleruby/core/symbol/SymbolNodes.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,15 +165,15 @@ private static RubyProc createProc(RubyContext context, RubyLanguage language,
165165
"proc",
166166
ArgumentDescriptor.ANON_REST);
167167
final Object[] args = RubyArguments
168-
.pack(null, null, null, method, declarationContext, null, nil, null, EMPTY_ARGUMENTS);
168+
.pack(null, null, method, declarationContext, null, nil, null, EMPTY_ARGUMENTS);
169169
// MRI raises an error on Proc#binding if you attempt to access the binding of a procedure generated
170170
// by Symbol#to_proc. We generate a declaration frame here so that all procedures will have a
171171
// binding as this simplifies the logic elsewhere in the runtime.
172172
final MaterializedFrame declarationFrame = Truffle
173173
.getRuntime()
174174
.createMaterializedFrame(args, context.getCoreLibrary().emptyDeclarationDescriptor);
175-
SpecialVariableStorage storage = new SpecialVariableStorage();
176-
declarationFrame.setObject(context.getCoreLibrary().emptyDeclarationSpecialVariableSlot, storage);
175+
SpecialVariableStorage variables = new SpecialVariableStorage();
176+
declarationFrame.setObject(context.getCoreLibrary().emptyDeclarationSpecialVariableSlot, variables);
177177

178178
final RubyRootNode rootNode = new RubyRootNode(
179179
context,
@@ -193,7 +193,7 @@ private static RubyProc createProc(RubyContext context, RubyLanguage language,
193193
callTarget,
194194
callTarget,
195195
declarationFrame,
196-
storage,
196+
variables,
197197
method,
198198
null,
199199
null,

0 commit comments

Comments
 (0)