Skip to content

Commit 7c642ec

Browse files
committed
Initialize the ReadCallerFrameNode lazily for RespondToNode
1 parent d67a609 commit 7c642ec

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1559,7 +1559,7 @@ public abstract static class RespondToNode extends CoreMethodNode {
15591559
@Child private InternalRespondToNode dispatch;
15601560
@Child private InternalRespondToNode dispatchIgnoreVisibility;
15611561
@Child private InternalRespondToNode dispatchRespondToMissing;
1562-
@Child private ReadCallerFrameNode readCallerFrame = ReadCallerFrameNode.create();
1562+
@Child private ReadCallerFrameNode readCallerFrame;
15631563
@Child private DispatchNode respondToMissingNode;
15641564
@Child private BooleanCastNode booleanCastNode;
15651565
private final ConditionProfile ignoreVisibilityProfile = ConditionProfile.create();
@@ -1656,6 +1656,10 @@ private boolean respondToMissing(VirtualFrame frame, Object object, RubySymbol n
16561656

16571657
private void useCallerRefinements(VirtualFrame frame) {
16581658
if (frame != null) {
1659+
if (readCallerFrame == null) {
1660+
CompilerDirectives.transferToInterpreterAndInvalidate();
1661+
readCallerFrame = insert(ReadCallerFrameNode.create());
1662+
}
16591663
DeclarationContext context = RubyArguments.getDeclarationContext(readCallerFrame.execute(frame));
16601664
RubyArguments.setDeclarationContext(frame, context);
16611665
}

0 commit comments

Comments
 (0)