Skip to content

Commit

Permalink
Reset context if it is not fresh
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
fniephaus committed Jun 17, 2020
1 parent 710653e commit f3b3dcc
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit f3b3dcc

Please sign in to comment.