Skip to content

Commit fcb2944

Browse files
committed
remove usages of FrameUtil
1 parent 2518768 commit fcb2944

File tree

5 files changed

+13
-18
lines changed

5 files changed

+13
-18
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/frame/ReadLocalVariableNode.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
import com.oracle.truffle.api.dsl.Cached;
3939
import com.oracle.truffle.api.dsl.Specialization;
4040
import com.oracle.truffle.api.frame.FrameSlot;
41-
import com.oracle.truffle.api.frame.FrameUtil;
4241
import com.oracle.truffle.api.frame.VirtualFrame;
4342
import com.oracle.truffle.api.instrumentation.StandardTags;
4443
import com.oracle.truffle.api.instrumentation.Tag;
@@ -65,26 +64,26 @@ public final FrameSlot getSlot() {
6564

6665
@Specialization(guards = "frame.isBoolean(frameSlot)")
6766
boolean readLocalBoolean(VirtualFrame frame) {
68-
return FrameUtil.getBooleanSafe(frame, frameSlot);
67+
return frame.getBoolean(frameSlot);
6968
}
7069

7170
@Specialization(guards = "frame.isInt(frameSlot)")
7271
int readLocalInt(VirtualFrame frame) {
73-
return FrameUtil.getIntSafe(frame, frameSlot);
72+
return frame.getInt(frameSlot);
7473
}
7574

7675
@Specialization(guards = "frame.isLong(frameSlot)")
7776
long readLocalLong(VirtualFrame frame) {
78-
return FrameUtil.getLongSafe(frame, frameSlot);
77+
return frame.getLong(frameSlot);
7978
}
8079

8180
@Specialization(guards = "frame.isDouble(frameSlot)")
8281
double readLocalDouble(VirtualFrame frame) {
83-
return FrameUtil.getDoubleSafe(frame, frameSlot);
82+
return frame.getDouble(frameSlot);
8483
}
8584

8685
protected final Object getObjectResult(VirtualFrame frame) {
87-
return FrameUtil.getObjectSafe(frame, frameSlot);
86+
return frame.getObject(frameSlot);
8887
}
8988

9089
@Specialization(guards = {"frame.isObject(frameSlot)", "result != null"})

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/function/ExpressionDefinitionNode.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import com.oracle.truffle.api.CompilerDirectives;
3434
import com.oracle.truffle.api.frame.Frame;
3535
import com.oracle.truffle.api.frame.FrameSlot;
36-
import com.oracle.truffle.api.frame.FrameUtil;
3736
import com.oracle.truffle.api.nodes.ExplodeLoop;
3837
import com.oracle.truffle.api.profiles.ConditionProfile;
3938
import com.oracle.truffle.api.profiles.ValueProfile;
@@ -60,7 +59,7 @@ PCell[] getClosureFromLocals(Frame frame) {
6059

6160
for (int i = 0; i < freeVarDefinitionSlots.length; i++) {
6261
FrameSlot defFrameSlot = freeVarDefinitionSlots[i];
63-
Object cell = FrameUtil.getObjectSafe(frame, defFrameSlot);
62+
Object cell = frame.getObject(defFrameSlot);
6463
assert cell instanceof PCell : "getting closure from locals: expected a cell";
6564
closure[i] = (PCell) cell;
6665
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/function/FunctionRootNode.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
import com.oracle.truffle.api.frame.Frame;
4040
import com.oracle.truffle.api.frame.FrameDescriptor;
4141
import com.oracle.truffle.api.frame.FrameSlot;
42-
import com.oracle.truffle.api.frame.FrameUtil;
4342
import com.oracle.truffle.api.frame.VirtualFrame;
4443
import com.oracle.truffle.api.nodes.ExplodeLoop;
4544
import com.oracle.truffle.api.nodes.NodeUtil;
@@ -146,7 +145,7 @@ private void initializeCellVars(Frame frame) {
146145
// get the cell
147146
PCell cell = null;
148147
if (isGenerator) {
149-
cell = (PCell) FrameUtil.getObjectSafe(frame, frameSlot);
148+
cell = (PCell) frame.getObject(frameSlot);
150149
}
151150
if (cell == null) {
152151
cell = new PCell(cellEffectivelyFinalAssumptions[i]);

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/generator/ReadGeneratorFrameVariableNode.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
import com.oracle.truffle.api.dsl.Specialization;
4343
import com.oracle.truffle.api.frame.Frame;
4444
import com.oracle.truffle.api.frame.FrameSlot;
45-
import com.oracle.truffle.api.frame.FrameUtil;
4645
import com.oracle.truffle.api.frame.VirtualFrame;
4746
import com.oracle.truffle.api.instrumentation.StandardTags;
4847
import com.oracle.truffle.api.instrumentation.Tag;
@@ -73,29 +72,29 @@ public final FrameSlot getSlot() {
7372
@Specialization(guards = "generatorFrame.isBoolean(frameSlot)")
7473
boolean readLocalBoolean(@SuppressWarnings("unused") VirtualFrame frame,
7574
@Bind("getGeneratorFrame(frame)") Frame generatorFrame) {
76-
return FrameUtil.getBooleanSafe(generatorFrame, frameSlot);
75+
return generatorFrame.getBoolean(frameSlot);
7776
}
7877

7978
@Specialization(guards = "generatorFrame.isInt(frameSlot)")
8079
int readLocalInt(@SuppressWarnings("unused") VirtualFrame frame,
8180
@Bind("getGeneratorFrame(frame)") Frame generatorFrame) {
82-
return FrameUtil.getIntSafe(generatorFrame, frameSlot);
81+
return generatorFrame.getInt(frameSlot);
8382
}
8483

8584
@Specialization(guards = "generatorFrame.isLong(frameSlot)")
8685
long readLocalLong(@SuppressWarnings("unused") VirtualFrame frame,
8786
@Bind("getGeneratorFrame(frame)") Frame generatorFrame) {
88-
return FrameUtil.getLongSafe(generatorFrame, frameSlot);
87+
return generatorFrame.getLong(frameSlot);
8988
}
9089

9190
@Specialization(guards = "generatorFrame.isDouble(frameSlot)")
9291
double readLocalDouble(@SuppressWarnings("unused") VirtualFrame frame,
9392
@Bind("getGeneratorFrame(frame)") Frame generatorFrame) {
94-
return FrameUtil.getDoubleSafe(generatorFrame, frameSlot);
93+
return generatorFrame.getDouble(frameSlot);
9594
}
9695

9796
protected final Object getObjectResult(Frame frame) {
98-
return FrameUtil.getObjectSafe(frame, frameSlot);
97+
return frame.getObject(frameSlot);
9998
}
10099

101100
@Specialization(guards = {"generatorFrame.isObject(frameSlot)", "result != null"})

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/parser/ScopeEnvironment.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@
7272
import com.oracle.truffle.api.frame.FrameDescriptor;
7373
import com.oracle.truffle.api.frame.FrameSlot;
7474
import com.oracle.truffle.api.frame.FrameSlotKind;
75-
import com.oracle.truffle.api.frame.FrameUtil;
7675

7776
public class ScopeEnvironment implements CellFrameSlotSupplier {
7877

@@ -531,7 +530,7 @@ public void setFreeVarsInRootScope(Frame frame) {
531530
for (Object identifier : frame.getFrameDescriptor().getIdentifiers()) {
532531
FrameSlot frameSlot = frame.getFrameDescriptor().findFrameSlot(identifier);
533532
if (frameSlot != null && frame.isObject(frameSlot)) {
534-
Object value = FrameUtil.getObjectSafe(frame, frameSlot);
533+
Object value = frame.getObject(frameSlot);
535534
if (value instanceof PCell) {
536535
globalScope.addFreeVar((String) frameSlot.getIdentifier(), false);
537536
}

0 commit comments

Comments
 (0)