Skip to content

Commit 8cc4b8d

Browse files
committed
[GR-71268] Fix regression in repeated-import.py.
PullRequest: graalpython/4097
2 parents c739206 + 97f8426 commit 8cc4b8d

File tree

3 files changed

+5
-12
lines changed

3 files changed

+5
-12
lines changed

graalpython/com.oracle.graal.python.test/src/tests/test_indirect_call.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@
5353
# Because of splitting, the code may not stabilize after first iteration and we may
5454
# see some stack walks during first few iterations. With default runtime or splitting
5555
# disabled, these tests should pass with STABILIZES_AT=1
56-
STABILIZES_AT = 1 if sys.implementation.name != "graalpy" or __graalpython__.truffle_runtime == 'Interpreted' else 10
57-
STABILIZES_AT = int(os.environ.get('GRAALPY_TEST_INDIRECT_CALL_STABILIZES_AT', STABILIZES_AT))
56+
STABILIZES_AT = int(os.environ.get('GRAALPY_TEST_INDIRECT_CALL_STABILIZES_AT', 10))
5857

5958
has_stack_walk_check = False
6059
if sys.implementation.name == "graalpy":

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/GraalPythonModuleBuiltins.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@
174174
import com.oracle.truffle.api.CompilerDirectives;
175175
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
176176
import com.oracle.truffle.api.RootCallTarget;
177-
import com.oracle.truffle.api.Truffle;
178177
import com.oracle.truffle.api.TruffleFile;
179178
import com.oracle.truffle.api.TruffleLanguage.Env;
180179
import com.oracle.truffle.api.TruffleLogger;
@@ -225,7 +224,6 @@ public void initialize(Python3Core core) {
225224
super.initialize(core);
226225
addBuiltinConstant("is_native", TruffleOptions.AOT);
227226
addBuiltinConstant("is_bytecode_dsl_interpreter", PythonOptions.ENABLE_BYTECODE_DSL_INTERPRETER);
228-
addBuiltinConstant("truffle_runtime", PythonUtils.toTruffleStringUncached(Truffle.getRuntime().getName()));
229227
PythonContext ctx = core.getContext();
230228
TruffleString encodingOpt = ctx.getLanguage().getEngineOption(PythonOptions.StandardStreamEncoding);
231229
TruffleString standardStreamEncoding = null;

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/runtime/ExecutionContext.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -447,15 +447,11 @@ private void exitEscaped(VirtualFrame frame, PRootNode node, Node location, Refe
447447
}
448448
// ReadCallerFrameNode.getCallerFrame must have the assumption invalidated
449449
assert node.needsCallerFrame() : "stack walk did not invalidate caller frame assumption";
450-
} else {
451-
// We may have been called via uncached call where we always pass frame reference,
452-
// but make sure that even if the next call is cached, we get passed the rereference
453-
// from our callers
454-
if (!node.needsCallerFrame()) {
455-
CompilerDirectives.transferToInterpreterAndInvalidate();
456-
node.setNeedsCallerFrame();
457-
}
458450
}
451+
// Else: we may have been called via uncached call where we always pass frame reference.
452+
// We assume uncached execution will eventually flip to cached execution, and then we'll
453+
// go to the other branch and setNeedsCallerFrame. This helps to prevent one-off
454+
// initializations (importing a module) from invalidating the assumption
459455

460456
// force the frame so that it can be accessed later
461457
if (PythonOptions.ENABLE_BYTECODE_DSL_INTERPRETER && node instanceof PBytecodeDSLRootNode) {

0 commit comments

Comments
 (0)