Skip to content
Snippets Groups Projects
Commit ad3a9696 authored by Lukas Stadler's avatar Lukas Stadler
Browse files

simplify AccessEnclosingFrameNode

parent 955e5c3a
Branches
No related tags found
No related merge requests found
......@@ -24,27 +24,15 @@ package com.oracle.truffle.r.nodes.access;
import com.oracle.truffle.api.dsl.*;
import com.oracle.truffle.api.frame.*;
import com.oracle.truffle.api.nodes.*;
import com.oracle.truffle.r.nodes.*;
import com.oracle.truffle.r.runtime.*;
@NodeField(name = "level", type = int.class)
public abstract class AccessEnclosingFrameNode extends RNode {
@Override
public final Object execute(VirtualFrame frame) {
return executeMaterializedFrame(frame);
}
public abstract MaterializedFrame executeMaterializedFrame(VirtualFrame frame);
@Specialization
@ExplodeLoop
protected MaterializedFrame doMaterializedFrame(VirtualFrame frame, int level) {
MaterializedFrame enclosingFrame = RArguments.getFunction(frame).getEnclosingFrame();
for (int i = 1; i < level; i++) {
enclosingFrame = RArguments.getFunction(enclosingFrame).getEnclosingFrame();
}
return enclosingFrame;
protected MaterializedFrame doMaterializedFrame(VirtualFrame frame) {
return RArguments.getEnclosingFrame(frame);
}
}
......@@ -116,7 +116,7 @@ public abstract class WriteSuperFrameVariableNode extends WriteSuperFrameVariabl
* we've reached the global scope, do unconditional write // if this is the first
* node in the chain, needs the rhs and enclosingFrame // nodes
*/
AccessEnclosingFrameNode enclosingFrameNode = RArguments.getEnclosingFrame(frame) == enclosingFrame ? AccessEnclosingFrameNodeGen.create(1) : null;
AccessEnclosingFrameNode enclosingFrameNode = RArguments.getEnclosingFrame(frame) == enclosingFrame ? AccessEnclosingFrameNodeGen.create() : null;
writeNode = WriteSuperFrameVariableNodeGen.create(getRhs(), enclosingFrameNode, FrameSlotNode.create(findOrAddFrameSlot(enclosingFrame.getFrameDescriptor(), symbol)), getName(), mode);
} else {
WriteSuperFrameVariableNode actualWriteNode = WriteSuperFrameVariableNodeGen.create(null, null, FrameSlotNode.create(symbol), this.getName(), mode);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment