diff --git a/src/main/java/org/truffleruby/RubyLanguage.java b/src/main/java/org/truffleruby/RubyLanguage.java index 5b373ed525a..5482bf85ed3 100644 --- a/src/main/java/org/truffleruby/RubyLanguage.java +++ b/src/main/java/org/truffleruby/RubyLanguage.java @@ -111,6 +111,7 @@ import org.truffleruby.language.objects.classvariables.ClassVariableStorage; import org.truffleruby.language.threadlocal.SpecialVariableStorage; import org.truffleruby.options.LanguageOptions; +import org.truffleruby.parser.BlockDescriptorInfo; import org.truffleruby.parser.ParserContext; import org.truffleruby.parser.ParsingParameters; import org.truffleruby.parser.RubySource; @@ -189,8 +190,8 @@ public final class RubyLanguage extends TruffleLanguage { public static final TruffleLogger LOGGER = TruffleLogger.getLogger(TruffleRuby.LANGUAGE_ID); /** This is a truly empty frame descriptor and should only by dummy root nodes which require no variables. Any other - * root nodes should should use - * {@link TranslatorEnvironment#newFrameDescriptorBuilder(org.truffleruby.parser.ParentFrameDescriptor, boolean)}. */ + * root nodes should should use either {@link TranslatorEnvironment#newFrameDescriptorBuilderForMethod()} or + * {@link TranslatorEnvironment#newFrameDescriptorBuilderForBlock(BlockDescriptorInfo)}. */ public static final FrameDescriptor EMPTY_FRAME_DESCRIPTOR = new FrameDescriptor(nil); private RubyThread getOrCreateForeignThread(RubyContext context, Thread thread) { @@ -336,7 +337,7 @@ private RubyThread getOrCreateForeignThread(RubyContext context, Thread thread) * special variable storage. This frame descriptor should be used for those frames to provide a constant frame * descriptor in those cases. */ public final FrameDescriptor emptyDeclarationDescriptor = TranslatorEnvironment - .newFrameDescriptorBuilder(null, true).build(); + .newFrameDescriptorBuilderForMethod().build(); public MaterializedFrame createEmptyDeclarationFrame(Object[] packedArgs, SpecialVariableStorage variables) { // createVirtualFrame().materialize() compiles better if this is in PE code diff --git a/src/main/java/org/truffleruby/core/binding/BindingNodes.java b/src/main/java/org/truffleruby/core/binding/BindingNodes.java index b40080d060a..4a8a549fe2b 100644 --- a/src/main/java/org/truffleruby/core/binding/BindingNodes.java +++ b/src/main/java/org/truffleruby/core/binding/BindingNodes.java @@ -57,7 +57,7 @@ import com.oracle.truffle.api.source.SourceSection; import org.truffleruby.language.locals.WriteFrameSlotNode; import org.truffleruby.language.locals.WriteFrameSlotNodeGen; -import org.truffleruby.parser.ParentFrameDescriptor; +import org.truffleruby.parser.BlockDescriptorInfo; import org.truffleruby.parser.TranslatorEnvironment; @CoreModule(value = "Binding", isClass = true) @@ -80,8 +80,8 @@ public static RubyBinding createBinding(RubyContext context, RubyLanguage langua @TruffleBoundary public static FrameDescriptor newFrameDescriptor(RubyBinding binding) { FrameDescriptor parentDescriptor = binding.getFrame().getFrameDescriptor(); - var ref = new ParentFrameDescriptor(parentDescriptor); - return TranslatorEnvironment.newFrameDescriptorBuilder(ref, false).build(); + var ref = new BlockDescriptorInfo(parentDescriptor); + return TranslatorEnvironment.newFrameDescriptorBuilderForBlock(ref).build(); } static final int NEW_VAR_INDEX = 1; @@ -90,8 +90,8 @@ public static FrameDescriptor newFrameDescriptor(RubyBinding binding) { public static FrameDescriptor newFrameDescriptor(FrameDescriptor parentDescriptor, String name) { assert name != null && !name.isEmpty(); - var ref = new ParentFrameDescriptor(parentDescriptor); - var builder = TranslatorEnvironment.newFrameDescriptorBuilder(ref, false); + var ref = new BlockDescriptorInfo(parentDescriptor); + var builder = TranslatorEnvironment.newFrameDescriptorBuilderForBlock(ref); int index = builder.addSlot(FrameSlotKind.Illegal, name, null); if (index != NEW_VAR_INDEX) { throw CompilerDirectives.shouldNotReachHere("new binding variable not at index 1"); diff --git a/src/main/java/org/truffleruby/debug/DebugHelpers.java b/src/main/java/org/truffleruby/debug/DebugHelpers.java index 88fbab15ce8..a5322cabe5c 100644 --- a/src/main/java/org/truffleruby/debug/DebugHelpers.java +++ b/src/main/java/org/truffleruby/debug/DebugHelpers.java @@ -22,7 +22,7 @@ import org.truffleruby.language.arguments.RubyArguments; import org.truffleruby.language.loader.CodeLoader; import org.truffleruby.language.methods.DeclarationContext; -import org.truffleruby.parser.ParentFrameDescriptor; +import org.truffleruby.parser.BlockDescriptorInfo; import org.truffleruby.parser.ParserContext; import org.truffleruby.parser.RubySource; import org.truffleruby.parser.TranslatorEnvironment; @@ -67,8 +67,8 @@ public static Object eval(RubyContext context, String code, Object... arguments) RubyNode.EMPTY_ARGUMENTS); - var builder = TranslatorEnvironment.newFrameDescriptorBuilder(new ParentFrameDescriptor(currentFrameDescriptor), - false); + var builder = TranslatorEnvironment + .newFrameDescriptorBuilderForBlock(new BlockDescriptorInfo(currentFrameDescriptor)); for (int i = 0; i < nArgs; i++) { final Object identifier = arguments[i * 2]; diff --git a/src/main/java/org/truffleruby/language/RubyRootNode.java b/src/main/java/org/truffleruby/language/RubyRootNode.java index d5b68aadecf..aaf98c3ad62 100644 --- a/src/main/java/org/truffleruby/language/RubyRootNode.java +++ b/src/main/java/org/truffleruby/language/RubyRootNode.java @@ -25,7 +25,7 @@ import com.oracle.truffle.api.frame.VirtualFrame; import com.oracle.truffle.api.source.SourceSection; import org.truffleruby.annotations.Split; -import org.truffleruby.parser.ParentFrameDescriptor; +import org.truffleruby.parser.BlockDescriptorInfo; import java.util.ArrayList; import java.util.IdentityHashMap; @@ -83,8 +83,8 @@ public Object execute(VirtualFrame frame) { @Override public FrameDescriptor getParentFrameDescriptor() { var info = getFrameDescriptor().getInfo(); - if (info instanceof ParentFrameDescriptor) { - return ((ParentFrameDescriptor) info).getDescriptor(); + if (info instanceof BlockDescriptorInfo) { + return ((BlockDescriptorInfo) info).getParentDescriptor(); } else { return null; } diff --git a/src/main/java/org/truffleruby/language/SpecialVariablesSendingNode.java b/src/main/java/org/truffleruby/language/SpecialVariablesSendingNode.java index d2ac69f2fc9..f137dfe5859 100644 --- a/src/main/java/org/truffleruby/language/SpecialVariablesSendingNode.java +++ b/src/main/java/org/truffleruby/language/SpecialVariablesSendingNode.java @@ -16,8 +16,8 @@ import org.truffleruby.core.kernel.TruffleKernelNodes.GetSpecialVariableStorage; import org.truffleruby.language.arguments.ReadCallerVariablesNode; -import org.truffleruby.language.locals.FindDeclarationVariableNodes; import org.truffleruby.language.threadlocal.SpecialVariableStorage; +import org.truffleruby.parser.BlockDescriptorInfo; /** Some Ruby methods need access to the caller special variables: see usages of {@link ReadCallerVariablesNode}. This * is used for methods which need to access the last regexp MatchData or the last IO line. @@ -45,10 +45,12 @@ protected Assumption getSpecialVariableAssumption(Frame frame) { return Assumption.ALWAYS_VALID; } - var outerFrameDescriptor = FindDeclarationVariableNodes.getOuterFrameDescriptor(frame.getFrameDescriptor()); + var descriptor = frame.getFrameDescriptor(); - if (SpecialVariableStorage.hasSpecialVariableAssumption(outerFrameDescriptor)) { - return SpecialVariableStorage.getAssumption(outerFrameDescriptor); + if (SpecialVariableStorage.hasSpecialVariableAssumption(descriptor)) { + return SpecialVariableStorage.getAssumption(descriptor); + } else if (descriptor.getInfo() instanceof BlockDescriptorInfo blockDescriptorInfo) { + return blockDescriptorInfo.getSpecialVariableAssumption(); } else { return Assumption.ALWAYS_VALID; } diff --git a/src/main/java/org/truffleruby/language/locals/FindDeclarationVariableNodes.java b/src/main/java/org/truffleruby/language/locals/FindDeclarationVariableNodes.java index 55be805505f..0e2063b7d38 100644 --- a/src/main/java/org/truffleruby/language/locals/FindDeclarationVariableNodes.java +++ b/src/main/java/org/truffleruby/language/locals/FindDeclarationVariableNodes.java @@ -25,7 +25,6 @@ import com.oracle.truffle.api.dsl.ReportPolymorphism; import com.oracle.truffle.api.dsl.Specialization; import com.oracle.truffle.api.frame.FrameDescriptor; -import org.truffleruby.parser.ParentFrameDescriptor; public abstract class FindDeclarationVariableNodes { public static final class FrameSlotAndDepth { @@ -50,13 +49,6 @@ public static MaterializedFrame getOuterDeclarationFrame(MaterializedFrame topFr return frame; } - public static FrameDescriptor getOuterFrameDescriptor(FrameDescriptor descriptor) { - while (descriptor.getInfo() instanceof ParentFrameDescriptor nextDescriptor) { - descriptor = nextDescriptor.getDescriptor(); - } - return descriptor; - } - private static int findSlot(FrameDescriptor descriptor, String name) { assert descriptor.getNumberOfAuxiliarySlots() == 0; int slots = descriptor.getNumberOfSlots(); diff --git a/src/main/java/org/truffleruby/language/locals/ReadDeclarationVariableNode.java b/src/main/java/org/truffleruby/language/locals/ReadDeclarationVariableNode.java index f91c2e91bf2..7ab18e00a71 100644 --- a/src/main/java/org/truffleruby/language/locals/ReadDeclarationVariableNode.java +++ b/src/main/java/org/truffleruby/language/locals/ReadDeclarationVariableNode.java @@ -15,7 +15,7 @@ import com.oracle.truffle.api.CompilerDirectives; import com.oracle.truffle.api.frame.VirtualFrame; -import org.truffleruby.parser.ParentFrameDescriptor; +import org.truffleruby.parser.BlockDescriptorInfo; public final class ReadDeclarationVariableNode extends ReadLocalNode { @@ -57,7 +57,7 @@ public WriteLocalNode makeWriteNode(RubyNode rhs) { @Override protected String getVariableName() { - var descriptor = ParentFrameDescriptor.getDeclarationFrameDescriptor( + var descriptor = BlockDescriptorInfo.getDeclarationFrameDescriptor( getRootNode().getFrameDescriptor(), frameDepth); return descriptor.getSlotName(frameSlot).toString(); } diff --git a/src/main/java/org/truffleruby/language/locals/WriteDeclarationVariableNode.java b/src/main/java/org/truffleruby/language/locals/WriteDeclarationVariableNode.java index cbceb5f04d0..53503f2c1e3 100644 --- a/src/main/java/org/truffleruby/language/locals/WriteDeclarationVariableNode.java +++ b/src/main/java/org/truffleruby/language/locals/WriteDeclarationVariableNode.java @@ -16,7 +16,7 @@ import com.oracle.truffle.api.CompilerDirectives; import com.oracle.truffle.api.frame.VirtualFrame; -import org.truffleruby.parser.ParentFrameDescriptor; +import org.truffleruby.parser.BlockDescriptorInfo; public final class WriteDeclarationVariableNode extends WriteLocalNode { @@ -60,7 +60,7 @@ public AssignableNode cloneUninitializedAssignable() { @Override protected String getVariableName() { - var descriptor = ParentFrameDescriptor.getDeclarationFrameDescriptor( + var descriptor = BlockDescriptorInfo.getDeclarationFrameDescriptor( getRootNode().getFrameDescriptor(), frameDepth); return descriptor.getSlotName(frameSlot).toString(); } diff --git a/src/main/java/org/truffleruby/language/threadlocal/SpecialVariableStorage.java b/src/main/java/org/truffleruby/language/threadlocal/SpecialVariableStorage.java index c69965c5e40..e95a9a47bb8 100644 --- a/src/main/java/org/truffleruby/language/threadlocal/SpecialVariableStorage.java +++ b/src/main/java/org/truffleruby/language/threadlocal/SpecialVariableStorage.java @@ -51,9 +51,13 @@ public static Assumption getAssumption(FrameDescriptor descriptor) { return (Assumption) descriptor.getInfo(); } + public static boolean isSpecialVariableAssumption(Assumption assumption) { + return assumption.getName() == ASSUMPTION_NAME; + } + public static boolean hasSpecialVariableAssumption(FrameDescriptor descriptor) { var info = descriptor.getInfo(); - return info instanceof Assumption assumption && assumption.getName() == ASSUMPTION_NAME; + return info instanceof Assumption assumption && isSpecialVariableAssumption(assumption); } public static boolean hasSpecialVariableStorageSlot(Frame frame) { @@ -65,7 +69,7 @@ private static boolean hasSpecialVariableStorageSlot(FrameDescriptor descriptor) assert SLOT_INDEX < descriptor.getNumberOfSlots(); assert descriptor.getSlotName(SLOT_INDEX) == SLOT_NAME; Assumption assumption = (Assumption) descriptor.getInfo(); - return assumption.getName() == ASSUMPTION_NAME; + return isSpecialVariableAssumption(assumption); } /** $~ */ diff --git a/src/main/java/org/truffleruby/parser/BlockDescriptorInfo.java b/src/main/java/org/truffleruby/parser/BlockDescriptorInfo.java new file mode 100644 index 00000000000..2da2d5bcaaa --- /dev/null +++ b/src/main/java/org/truffleruby/parser/BlockDescriptorInfo.java @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. All rights reserved. This + * code is released under a tri EPL/GPL/LGPL license. You can use it, + * redistribute it and/or modify it under the terms of the: + * + * Eclipse Public License version 2.0, or + * GNU General Public License version 2, or + * GNU Lesser General Public License version 2.1. + */ +package org.truffleruby.parser; + +import com.oracle.truffle.api.Assumption; +import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; +import com.oracle.truffle.api.frame.FrameDescriptor; +import com.oracle.truffle.api.nodes.ExplodeLoop; +import org.truffleruby.language.threadlocal.SpecialVariableStorage; + +/** This is the {@link FrameDescriptor#getInfo() descriptor info} for blocks. The descriptor info for methods is an + * {@link SpecialVariableStorage#getAssumption(FrameDescriptor) Assumption}. */ +public final class BlockDescriptorInfo { + + @ExplodeLoop + public static FrameDescriptor getDeclarationFrameDescriptor(FrameDescriptor topDescriptor, int depth) { + assert depth > 0; + FrameDescriptor descriptor = topDescriptor; + for (int i = 0; i < depth; i++) { + descriptor = ((BlockDescriptorInfo) descriptor.getInfo()).getParentDescriptor(); + } + return descriptor; + } + + @CompilationFinal private FrameDescriptor parentDescriptor; + private final Assumption specialVariableAssumption; + + public BlockDescriptorInfo(Assumption specialVariableAssumption) { + assert SpecialVariableStorage.isSpecialVariableAssumption(specialVariableAssumption); + this.specialVariableAssumption = specialVariableAssumption; + } + + public BlockDescriptorInfo(FrameDescriptor parentDescriptor) { + this.parentDescriptor = parentDescriptor; + this.specialVariableAssumption = getSpecialVariableAssumptionFromDescriptor(parentDescriptor); + } + + private Assumption getSpecialVariableAssumptionFromDescriptor(FrameDescriptor descriptor) { + if (descriptor.getInfo() instanceof BlockDescriptorInfo blockDescriptorInfo) { + return blockDescriptorInfo.getSpecialVariableAssumption(); + } else { + return SpecialVariableStorage.getAssumption(descriptor); + } + } + + public FrameDescriptor getParentDescriptor() { + assert parentDescriptor != null; + return parentDescriptor; + } + + void setParentDescriptor(FrameDescriptor parentDescriptor) { + assert this.parentDescriptor == null; + this.parentDescriptor = parentDescriptor; + } + + public Assumption getSpecialVariableAssumption() { + assert specialVariableAssumption != null; + return specialVariableAssumption; + } +} diff --git a/src/main/java/org/truffleruby/parser/ParentFrameDescriptor.java b/src/main/java/org/truffleruby/parser/ParentFrameDescriptor.java deleted file mode 100644 index f9b20c7473c..00000000000 --- a/src/main/java/org/truffleruby/parser/ParentFrameDescriptor.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. All rights reserved. This - * code is released under a tri EPL/GPL/LGPL license. You can use it, - * redistribute it and/or modify it under the terms of the: - * - * Eclipse Public License version 2.0, or - * GNU General Public License version 2, or - * GNU Lesser General Public License version 2.1. - */ -package org.truffleruby.parser; - -import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; -import com.oracle.truffle.api.frame.FrameDescriptor; -import com.oracle.truffle.api.nodes.ExplodeLoop; - -public final class ParentFrameDescriptor { - - @ExplodeLoop - public static FrameDescriptor getDeclarationFrameDescriptor(FrameDescriptor topDescriptor, int depth) { - assert depth > 0; - FrameDescriptor descriptor = topDescriptor; - for (int i = 0; i < depth; i++) { - descriptor = ((ParentFrameDescriptor) descriptor.getInfo()).getDescriptor(); - } - return descriptor; - } - - @CompilationFinal private FrameDescriptor descriptor; - - public ParentFrameDescriptor() { - } - - public ParentFrameDescriptor(FrameDescriptor descriptor) { - assert descriptor != null; - this.descriptor = descriptor; - } - - public FrameDescriptor getDescriptor() { - assert descriptor != null; - return descriptor; - } - - void set(FrameDescriptor descriptor) { - assert this.descriptor == null; - this.descriptor = descriptor; - } -} diff --git a/src/main/java/org/truffleruby/parser/TranslatorEnvironment.java b/src/main/java/org/truffleruby/parser/TranslatorEnvironment.java index a350feaa820..49583d7f536 100644 --- a/src/main/java/org/truffleruby/parser/TranslatorEnvironment.java +++ b/src/main/java/org/truffleruby/parser/TranslatorEnvironment.java @@ -46,7 +46,10 @@ public final class TranslatorEnvironment { private EconomicMap nameToIndex = EconomicMap.create(); private FrameDescriptor.Builder frameDescriptorBuilder; private FrameDescriptor frameDescriptor; - private final ParentFrameDescriptor parentFrameDescriptor; + /** The descriptor info is shared for all blocks at the same level (i.e., for TranslatorEnvironment direct + * children), in order to save footprint. It is therefore created in the parent TranslatorEnvironment of those + * blocks using that descriptor info. */ + private final BlockDescriptorInfo descriptorInfoForChildren; private final List flipFlopStates = new ArrayList<>(); @@ -81,14 +84,19 @@ public TranslatorEnvironment( this.parent = parent; if (descriptor == null) { - ParentFrameDescriptor parentDescriptor = blockDepth > 0 - ? Objects.requireNonNull(parent.parentFrameDescriptor) - : null; - this.frameDescriptorBuilder = newFrameDescriptorBuilder(parentDescriptor, blockDepth == 0); - this.parentFrameDescriptor = new ParentFrameDescriptor(); + if (blockDepth > 0) { + BlockDescriptorInfo descriptorInfo = Objects.requireNonNull(parent.descriptorInfoForChildren); + this.frameDescriptorBuilder = newFrameDescriptorBuilderForBlock(descriptorInfo); + this.descriptorInfoForChildren = new BlockDescriptorInfo( + descriptorInfo.getSpecialVariableAssumption()); + } else { + var specialVariableAssumption = createSpecialVariableAssumption(); + this.frameDescriptorBuilder = newFrameDescriptorBuilderForMethod(specialVariableAssumption); + this.descriptorInfoForChildren = new BlockDescriptorInfo(specialVariableAssumption); + } } else { this.frameDescriptor = descriptor; - this.parentFrameDescriptor = new ParentFrameDescriptor(descriptor); + this.descriptorInfoForChildren = new BlockDescriptorInfo(descriptor); assert descriptor.getNumberOfAuxiliarySlots() == 0; int slots = descriptor.getNumberOfSlots(); @@ -143,41 +151,48 @@ public boolean isTopLevelObjectScope() { } // region frame descriptor - public static FrameDescriptor.Builder newFrameDescriptorBuilder(ParentFrameDescriptor parentDescriptor, - boolean canHaveSpecialVariables) { - if ((parentDescriptor != null) == canHaveSpecialVariables) { - throw CompilerDirectives.shouldNotReachHere( - "A descriptor should either be a method and have special variables, or be a block and have no special variables"); + public static FrameDescriptor.Builder newFrameDescriptorBuilderForBlock(BlockDescriptorInfo descriptorInfo) { + var builder = FrameDescriptor.newBuilder().defaultValue(Nil.INSTANCE); + builder.info(Objects.requireNonNull(descriptorInfo)); + + int selfIndex = builder.addSlot(FrameSlotKind.Illegal, SelfNode.SELF_IDENTIFIER, null); + if (selfIndex != SelfNode.SELF_INDEX) { + throw CompilerDirectives.shouldNotReachHere("(self) should be at index 0"); } + return builder; + } + + private static Assumption createSpecialVariableAssumption() { + return Assumption.create(SpecialVariableStorage.ASSUMPTION_NAME); + } + + private static FrameDescriptor.Builder newFrameDescriptorBuilderForMethod(Assumption specialVariableAssumption) { var builder = FrameDescriptor.newBuilder().defaultValue(Nil.INSTANCE); + // We need to access this Assumption from the FrameDescriptor, + // and there is no way to get a RootNode from a FrameDescriptor, so we store it in the descriptor info. + // We do not store it as slot info for footprint, to avoid needing an info array per FrameDescriptor. + builder.info(specialVariableAssumption); - if (parentDescriptor != null) { - builder.info(parentDescriptor); - } else if (canHaveSpecialVariables) { - // We need to access this Assumption from the FrameDescriptor, - // and there is no way to get a RootNode from a FrameDescriptor, so we store it in the descriptor info. - // We do not store it as slot info for footprint, to avoid needing an info array per FrameDescriptor. - final Assumption doesNotNeedSpecialVariableStorageAssumption = Assumption - .create(SpecialVariableStorage.ASSUMPTION_NAME); - builder.info(doesNotNeedSpecialVariableStorageAssumption); - } int selfIndex = builder.addSlot(FrameSlotKind.Illegal, SelfNode.SELF_IDENTIFIER, null); if (selfIndex != SelfNode.SELF_INDEX) { throw CompilerDirectives.shouldNotReachHere("(self) should be at index 0"); } - if (canHaveSpecialVariables) { - int svarsSlot = builder.addSlot(FrameSlotKind.Illegal, SpecialVariableStorage.SLOT_NAME, null); - if (svarsSlot != SpecialVariableStorage.SLOT_INDEX) { - throw CompilerDirectives.shouldNotReachHere("svars should be at index 1"); - } + int svarsSlot = builder.addSlot(FrameSlotKind.Illegal, SpecialVariableStorage.SLOT_NAME, null); + if (svarsSlot != SpecialVariableStorage.SLOT_INDEX) { + throw CompilerDirectives.shouldNotReachHere("svars should be at index 1"); } return builder; } + public static FrameDescriptor.Builder newFrameDescriptorBuilderForMethod() { + var specialVariableAssumption = createSpecialVariableAssumption(); + return newFrameDescriptorBuilderForMethod(specialVariableAssumption); + } + public int declareVar(Object name) { assert name != null && !(name instanceof String && ((String) name).isEmpty()); @@ -280,7 +295,7 @@ public FrameDescriptor computeFrameDescriptor() { } frameDescriptor = frameDescriptorBuilder.build(); - parentFrameDescriptor.set(frameDescriptor); + descriptorInfoForChildren.setParentDescriptor(frameDescriptor); frameDescriptorBuilder = null; nameToIndex = null; return frameDescriptor; diff --git a/src/main/java/org/truffleruby/parser/YARPTranslator.java b/src/main/java/org/truffleruby/parser/YARPTranslator.java index c33978b14f3..5dc474aa856 100644 --- a/src/main/java/org/truffleruby/parser/YARPTranslator.java +++ b/src/main/java/org/truffleruby/parser/YARPTranslator.java @@ -166,7 +166,7 @@ public YARPTranslator( public RubyRootNode translate(Nodes.Node node) { var body = node.accept(this); - var frameDescriptor = TranslatorEnvironment.newFrameDescriptorBuilder(null, true).build(); + var frameDescriptor = TranslatorEnvironment.newFrameDescriptorBuilderForMethod().build(); var sourceSection = CoreLibrary.JAVA_CORE_SOURCE_SECTION; var sharedMethodInfo = new SharedMethodInfo(sourceSection, null, Arity.NO_ARGUMENTS, "
", 0, "
", null, null);