Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speculate on no interrupt in WithInterruptHandlerNode #12364

Merged
merged 1 commit into from
Feb 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.profiles.BranchProfile;
import org.enso.interpreter.dsl.BuiltinMethod;
import org.enso.interpreter.dsl.Suspend;
import org.enso.interpreter.node.BaseNode;
Expand All @@ -18,13 +19,15 @@
public class WithInterruptHandlerNode extends Node {
private @Child ThunkExecutorNode actExecutorNode = ThunkExecutorNode.build();
private @Child ThunkExecutorNode handlerExecutorNode = ThunkExecutorNode.build();
private final BranchProfile interruptBranch = BranchProfile.create();

Object execute(VirtualFrame frame, @Suspend Object action, @Suspend Object interrupt_handler) {
var ctx = EnsoContext.get(this);
var state = ctx.currentState();
try {
return actExecutorNode.executeThunk(frame, action, state, BaseNode.TailStatus.NOT_TAIL);
} catch (ThreadInterruptedException e) {
interruptBranch.enter();
handlerExecutorNode.executeThunk(
frame, interrupt_handler, state, BaseNode.TailStatus.NOT_TAIL);
throw e;
Expand Down
Loading