Skip to content

Commit b6f8b6e

Browse files
committed
Pass a parent Frame but not a FrameDescriptor for #instance_eval
* Like other eval's. * The FrameDescriptor path is now dead code in the TranslatorDriver.
1 parent 92470d8 commit b6f8b6e

File tree

4 files changed

+5
-45
lines changed

4 files changed

+5
-45
lines changed

src/main/java/org/truffleruby/core/basicobject/BasicObjectNodes.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,6 @@ private Object instanceEvalHelper(MaterializedFrame callerFrame, Object receiver
305305
final RubyRootNode rootNode = getContext().getCodeLoader().parse(
306306
source,
307307
ParserContext.EVAL,
308-
callerFrame.getFrameDescriptor(),
309308
callerFrame,
310309
true,
311310
this);

src/main/java/org/truffleruby/language/LazyRubyRootNode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public Object execute(VirtualFrame frame) {
7373
final TranslatorDriver translator = new TranslatorDriver(context);
7474

7575
final String[] argumentsArray = argumentNames.toArray(new String[argumentNames.size()]);
76-
final RubyRootNode rootNode = translator.parse(new RubySource(source), ParserContext.TOP_LEVEL, argumentsArray, null, null, true, null);
76+
final RubyRootNode rootNode = translator.parse(new RubySource(source), ParserContext.TOP_LEVEL, argumentsArray, null, true, null);
7777

7878
final RootCallTarget callTarget = Truffle.getRuntime().createCallTarget(rootNode);
7979

src/main/java/org/truffleruby/language/loader/CodeLoader.java

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
1313
import com.oracle.truffle.api.RootCallTarget;
1414
import com.oracle.truffle.api.Truffle;
15-
import com.oracle.truffle.api.frame.FrameDescriptor;
1615
import com.oracle.truffle.api.frame.MaterializedFrame;
1716
import com.oracle.truffle.api.nodes.IndirectCallNode;
1817
import com.oracle.truffle.api.nodes.Node;
@@ -38,25 +37,14 @@ public CodeLoader(RubyContext context) {
3837
this.context = context;
3938
}
4039

41-
// Additional argument: a FrameDescriptor
4240
@TruffleBoundary
4341
public RubyRootNode parse(RubySource source,
4442
ParserContext parserContext,
45-
FrameDescriptor frameDescriptor,
4643
MaterializedFrame parentFrame,
4744
boolean ownScopeForAssignments,
4845
Node currentNode) {
4946
final TranslatorDriver translator = new TranslatorDriver(context);
50-
return translator.parse(source, parserContext, null, frameDescriptor, parentFrame, ownScopeForAssignments, currentNode);
51-
}
52-
53-
@TruffleBoundary
54-
public RubyRootNode parse(RubySource source,
55-
ParserContext parserContext,
56-
MaterializedFrame parentFrame,
57-
boolean ownScopeForAssignments,
58-
Node currentNode) {
59-
return parse(source, parserContext, null, parentFrame, ownScopeForAssignments, currentNode);
47+
return translator.parse(source, parserContext, null, parentFrame, ownScopeForAssignments, currentNode);
6048
}
6149

6250
@TruffleBoundary

src/main/java/org/truffleruby/parser/TranslatorDriver.java

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
package org.truffleruby.parser;
3838

3939
import com.oracle.truffle.api.Truffle;
40-
import com.oracle.truffle.api.frame.FrameDescriptor;
4140
import com.oracle.truffle.api.frame.FrameInstance.FrameAccess;
4241
import com.oracle.truffle.api.frame.FrameSlot;
4342
import com.oracle.truffle.api.frame.MaterializedFrame;
@@ -95,8 +94,8 @@ public TranslatorDriver(RubyContext context) {
9594
parseEnvironment = new ParseEnvironment(context);
9695
}
9796

98-
public RubyRootNode parse(RubySource rubySource, ParserContext parserContext, String[] argumentNames, FrameDescriptor frameDescriptor,
99-
MaterializedFrame parentFrame, boolean ownScopeForAssignments, Node currentNode) {
97+
public RubyRootNode parse(RubySource rubySource, ParserContext parserContext, String[] argumentNames,
98+
MaterializedFrame parentFrame, boolean ownScopeForAssignments, Node currentNode) {
10099

101100
assert parserContext.isTopLevel() == (parentFrame == null) : "A frame should be given iff the context is not toplevel: " + parserContext + " " + parentFrame;
102101

@@ -112,16 +111,7 @@ public RubyRootNode parse(RubySource rubySource, ParserContext parserContext, St
112111

113112
final TranslatorEnvironment parentEnvironment;
114113

115-
if (frameDescriptor != null) {
116-
for (FrameSlot slot : frameDescriptor.getSlots()) {
117-
if (slot.getIdentifier() instanceof String) {
118-
final String name = (String) slot.getIdentifier();
119-
staticScope.addVariableThisScope(name.intern()); // StaticScope expects interned var names
120-
}
121-
}
122-
123-
parentEnvironment = environmentForFrameDescriptor(context, frameDescriptor);
124-
} else if (parentFrame != null) {
114+
if (parentFrame != null) {
125115
MaterializedFrame frame = parentFrame;
126116

127117
while (frame != null) {
@@ -345,23 +335,6 @@ public RootParseNode parseToJRubyAST(RubySource rubySource, StaticScope blockSco
345335
return (RootParseNode) result.getAST();
346336
}
347337

348-
private TranslatorEnvironment environmentForFrameDescriptor(RubyContext context, FrameDescriptor frameDescriptor) {
349-
final SharedMethodInfo sharedMethodInfo = new SharedMethodInfo(
350-
context.getCoreLibrary().getSourceSection(),
351-
context.getRootLexicalScope(),
352-
Arity.NO_ARGUMENTS,
353-
null,
354-
null,
355-
0,
356-
"external",
357-
null,
358-
false);
359-
// TODO(CS): how do we know if the frame is a block or not?
360-
return new TranslatorEnvironment(null, parseEnvironment, parseEnvironment.allocateReturnID(),
361-
true, true, false,
362-
sharedMethodInfo, sharedMethodInfo.getName(), 0, null, frameDescriptor);
363-
}
364-
365338
private TranslatorEnvironment environmentForFrame(RubyContext context, MaterializedFrame frame) {
366339
if (frame == null) {
367340
return null;

0 commit comments

Comments
 (0)