Skip to content

Commit 9bd160a

Browse files
committed
Reduce duplication in getSpecialVariablesIfRequired() for host inlining
* 695 -> 579 for org.truffleruby.language.SpecialVariablesSendingNode.getSpecialVariablesIfRequired
1 parent 99a3105 commit 9bd160a

File tree

1 file changed

+10
-20
lines changed

1 file changed

+10
-20
lines changed

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

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -226,26 +226,16 @@ public static GetSpecialVariableStorage create() {
226226
protected SpecialVariableStorage getFromKnownFrameDescriptor(Frame frame,
227227
@Cached("frame.getFrameDescriptor()") FrameDescriptor descriptor,
228228
@Cached("declarationDepth(frame)") int declarationFrameDepth) {
229-
Object variables;
230-
if (declarationFrameDepth == 0) {
231-
variables = SpecialVariableStorage.get(frame);
232-
if (variables == nil) {
233-
CompilerDirectives.transferToInterpreterAndInvalidate();
234-
variables = initializeSpecialVariablesSlot(frame);
235-
}
236-
} else {
237-
Frame storageFrame = RubyArguments.getDeclarationFrame(frame, declarationFrameDepth);
238-
239-
if (storageFrame == null) {
240-
CompilerDirectives.transferToInterpreterAndInvalidate();
241-
noStorageFrameError(frame, declarationFrameDepth);
242-
}
243-
244-
variables = SpecialVariableStorage.get(storageFrame);
245-
if (variables == nil) {
246-
CompilerDirectives.transferToInterpreterAndInvalidate();
247-
variables = initializeSpecialVariablesSlot(storageFrame);
248-
}
229+
Frame storageFrame = RubyArguments.getDeclarationFrame(frame, declarationFrameDepth);
230+
if (storageFrame == null) {
231+
CompilerDirectives.transferToInterpreterAndInvalidate();
232+
noStorageFrameError(frame, declarationFrameDepth);
233+
}
234+
235+
Object variables = SpecialVariableStorage.get(storageFrame);
236+
if (variables == nil) {
237+
CompilerDirectives.transferToInterpreterAndInvalidate();
238+
variables = initializeSpecialVariablesSlot(storageFrame);
249239
}
250240
return (SpecialVariableStorage) variables;
251241
}

0 commit comments

Comments
 (0)