From f3b3dcc3ce803d055e6ed3126e8aee8a799edfc4 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Tue, 16 Jun 2020 17:02:38 +0200 Subject: [PATCH] Reset context if it is not fresh In case an exception is thrown in the middle of a method, the context is not terminated. So the context must be reset if its PC != 0. --- .../swa/trufflesqueak/nodes/ExecuteTopLevelContextNode.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/ExecuteTopLevelContextNode.java b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/ExecuteTopLevelContextNode.java index 8a7408f61..af025f8c0 100644 --- a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/ExecuteTopLevelContextNode.java +++ b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/ExecuteTopLevelContextNode.java @@ -103,12 +103,12 @@ private void executeLoop() { } } - private void ensureCachedContextCanRunAgain(final ContextObject activeContext) { - if (activeContext.isTerminated() && image.getLastParseRequestSource().isCached()) { + private static void ensureCachedContextCanRunAgain(final ContextObject activeContext) { + if (activeContext.getInstructionPointerForBytecodeLoop() != 0) { /** * Reset instruction pointer and stack pointer of the context (see * {@link EnterCodeNode#initializeSlots}) in case it has previously been executed and - * needs to run again, because the Source has been cached. + * needs to run again, for example because the Source has been cached. */ assert !activeContext.hasClosure() : "activeContext is expected to have no closure"; final CompiledMethodObject method = activeContext.getMethod();