Skip to content

Commit

Permalink
Increment stack counter inCompilationRoot only
Browse files Browse the repository at this point in the history
  • Loading branch information
fniephaus committed Feb 23, 2025
1 parent 51cc251 commit 3da7a78
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,22 @@ public StartContextRootNode(final SqueakLanguage language, final CompiledCodeObj

@Override
public Object execute(final VirtualFrame frame) {
final boolean inCompilationRoot = CompilerDirectives.inCompilationRoot();
initializeFrame(frame);
try {
if (++ApproximateStackDepth > MaximumStackDepth) {
if (inCompilationRoot && ++ApproximateStackDepth > MaximumStackDepth) {
throw ProcessSwitch.create(getGetOrCreateContextNode().executeGet(frame));
}

interruptHandlerNode.execute(frame);
return executeBytecodeNode.execute(frame, initialPC);
} catch (final NonVirtualReturn | ProcessSwitch nvr) {
/* {@link getGetOrCreateContextNode()} acts as {@link BranchProfile} */
getGetOrCreateContextNode().executeGet(frame).markEscaped();
throw nvr;
} finally {
--ApproximateStackDepth;
if (inCompilationRoot) {
--ApproximateStackDepth;
}
materializeContextOnMethodExitNode.execute(frame);
}
}
Expand Down

0 comments on commit 3da7a78

Please sign in to comment.