Skip to content

Commit

Permalink
REPL debugger naturally inherits the state from EnsoContext
Browse files Browse the repository at this point in the history
  • Loading branch information
JaroslavTulach committed Feb 12, 2025
1 parent 4902f6e commit a62c3c0
Showing 1 changed file with 0 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
import org.enso.interpreter.runtime.callable.CallerInfo;
import org.enso.interpreter.runtime.callable.function.Function;
import org.enso.interpreter.runtime.data.text.Text;
import org.enso.interpreter.runtime.state.State;
import org.enso.interpreter.runtime.warning.WarningsLibrary;
import org.enso.interpreter.runtime.warning.WithWarnings;
import org.graalvm.options.OptionDescriptor;
Expand Down Expand Up @@ -131,7 +130,6 @@ private static class ReplExecutionEventNodeImpl extends ExecutionEventNode
private @Child ToJavaStringNode toJavaStringNode = ToJavaStringNode.build();

private ReplExecutionEventNodeState nodeState;
private State monadicState;

private EventContext eventContext;
private DebuggerMessageHandler handler;
Expand Down Expand Up @@ -250,8 +248,6 @@ protected void onEnter(VirtualFrame frame) {
if (atExit == null) {
CallerInfo lastScope = Function.ArgumentsHelper.getCallerInfo(frame.getArguments());
Object lastReturn = EnsoContext.get(this).getNothing();
// Note [Safe Access to State in the Debugger Instrument]
monadicState = null; // Function.ArgumentsHelper.getState(frame.getArguments());
nodeState = new ReplExecutionEventNodeState(lastReturn, lastScope);
startSessionImpl();
}
Expand All @@ -264,12 +260,6 @@ public void onReturnValue(VirtualFrame frame, Object result) {
}
}

/* Note [Safe Access to State in the Debugger Instrument]
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* This is safe to do as we ensure that the instrument's `onEnter` is always called as the
* first instruction of the function that it's observing.
*/

/**
* Called by Truffle whenever an unwind {@see {@link EventContext#createUnwind(Object)}} was
* thrown in the course of REPL execution.
Expand All @@ -292,8 +282,6 @@ private void startSession(RootNode root, VirtualFrame frame, Object toReturn) {
new CallerInfo(frame.materialize(), enso.getLocalScope(), enso.getModuleScope());
}
if (lastScope != null) {
// Note [Safe Access to State in the Debugger Instrument]
monadicState = EnsoContext.get(root).currentState();
nodeState = new ReplExecutionEventNodeState(toReturn, lastScope);
startSessionImpl();
}
Expand Down

0 comments on commit a62c3c0

Please sign in to comment.