Skip to content

Commit 9e66f40

Browse files
committed
SyncFrameValuesNode: make sure BytecodeNode is PE constant
1 parent 75f386f commit 9e66f40

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

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

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
import com.oracle.graal.python.nodes.PRootNode;
4848
import com.oracle.graal.python.nodes.bytecode.BytecodeFrameInfo;
4949
import com.oracle.graal.python.nodes.bytecode.FrameInfo;
50-
import com.oracle.graal.python.nodes.bytecode_dsl.BytecodeDSLFrameInfo;
5150
import com.oracle.graal.python.nodes.bytecode_dsl.PBytecodeDSLRootNode;
5251
import com.oracle.graal.python.runtime.PythonOptions;
5352
import com.oracle.graal.python.runtime.object.PFactory;
@@ -195,7 +194,7 @@ static PFrame alreadyEscapedFrame(@SuppressWarnings("unused") Node location, boo
195194
@Cached InlinedConditionProfile syncProfile) {
196195
PFrame pyFrame = getPFrame(frameToMaterialize);
197196
if (syncProfile.profile(inliningTarget, forceSync && !PGenerator.isGeneratorFrame(frameToMaterialize))) {
198-
syncValuesNode.execute(pyFrame, frameToMaterialize);
197+
syncValuesNode.execute(pyFrame, frameToMaterialize, location);
199198
}
200199
if (markAsEscaped) {
201200
pyFrame.getRef().markAsEscaped();
@@ -248,7 +247,7 @@ private static PFrame doEscapeFrame(Frame frameToMaterialize, PFrame escapedFram
248247
// on a freshly created PFrame, we do always sync the arguments
249248
PArguments.synchronizeArgs(frameToMaterialize, escapedFrame);
250249
if (forceSync) {
251-
syncValuesNode.execute(escapedFrame, frameToMaterialize);
250+
syncValuesNode.execute(escapedFrame, frameToMaterialize, location);
252251
}
253252
if (markAsEscaped) {
254253
topFrameRef.markAsEscaped();
@@ -275,10 +274,10 @@ protected static PFrame getPFrame(Frame frame) {
275274
@GenerateUncached
276275
public abstract static class SyncFrameValuesNode extends Node {
277276

278-
public abstract void execute(PFrame pyFrame, Frame frameToSync);
277+
public abstract void execute(PFrame pyFrame, Frame frameToSync, Node location);
279278

280279
@Specialization(guards = "!pyFrame.hasCustomLocals()")
281-
static void doSync(PFrame pyFrame, Frame frameToSync,
280+
static void doSync(PFrame pyFrame, Frame frameToSync, Node location,
282281
@Bind Node inliningTarget,
283282
@Cached(inline = false) ValueProfile frameDescriptorProfile,
284283
@Cached InlinedIntValueProfile slotCountProfile) {
@@ -288,10 +287,10 @@ static void doSync(PFrame pyFrame, Frame frameToSync,
288287
int slotCount = slotCountProfile.profile(inliningTarget, variableSlotCount(cachedFd));
289288

290289
if (PythonOptions.ENABLE_BYTECODE_DSL_INTERPRETER) {
291-
FrameInfo info = (FrameInfo) cachedFd.getInfo();
292-
if (info instanceof BytecodeDSLFrameInfo bytecodeDSLFrameInfo) {
293-
PBytecodeDSLRootNode rootNode = bytecodeDSLFrameInfo.getRootNode();
294-
rootNode.getBytecodeNode().copyLocalValues(0, frameToSync, target, 0, slotCount);
290+
CompilerAsserts.partialEvaluationConstant(location);
291+
BytecodeNode bytecodeNode = BytecodeNode.get(location);
292+
if (bytecodeNode != null) {
293+
bytecodeNode.copyLocalValues(0, frameToSync, target, 0, slotCount);
295294
}
296295
} else {
297296
frameToSync.copyTo(0, target, 0, slotCount);
@@ -300,7 +299,7 @@ static void doSync(PFrame pyFrame, Frame frameToSync,
300299

301300
@Specialization(guards = "pyFrame.hasCustomLocals()")
302301
@SuppressWarnings("unused")
303-
static void doCustomLocals(PFrame pyFrame, Frame frameToSync) {
302+
static void doCustomLocals(PFrame pyFrame, Frame frameToSync, Node location) {
304303
// nothing to do
305304
}
306305

0 commit comments

Comments
 (0)