-
Notifications
You must be signed in to change notification settings - Fork 323
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
Move execution environment from State to EnsoContext #11075
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,6 +51,7 @@ | |
import org.enso.interpreter.OptionsHelper; | ||
import org.enso.interpreter.runtime.builtin.Builtins; | ||
import org.enso.interpreter.runtime.data.Type; | ||
import org.enso.interpreter.runtime.data.atom.Atom; | ||
import org.enso.interpreter.runtime.error.DataflowError; | ||
import org.enso.interpreter.runtime.error.PanicException; | ||
import org.enso.interpreter.runtime.instrument.NotificationHandler; | ||
|
@@ -875,6 +876,34 @@ public void setExecutionEnvironment(ExecutionEnvironment executionEnvironment) { | |
this.executionEnvironment = executionEnvironment; | ||
} | ||
|
||
/** | ||
* Enable execution context in the execution environment. | ||
* | ||
* @param context the execution context | ||
* @param environmentName the execution environment name | ||
*/ | ||
public ExecutionEnvironment enableExecutionEnvironment(Atom context, String environmentName) { | ||
ExecutionEnvironment original = executionEnvironment; | ||
if (executionEnvironment.getName().equals(environmentName)) { | ||
executionEnvironment = executionEnvironment.withContextEnabled(context); | ||
} | ||
return original; | ||
} | ||
|
||
/** | ||
* Enable execution context in the execution environment. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The description is wrong. |
||
* | ||
* @param context the execution context | ||
* @param environmentName the execution environment name | ||
*/ | ||
public ExecutionEnvironment disableExecutionEnvironment(Atom context, String environmentName) { | ||
ExecutionEnvironment original = executionEnvironment; | ||
if (executionEnvironment.getName().equals(environmentName)) { | ||
executionEnvironment = executionEnvironment.withContextDisabled(context); | ||
} | ||
return original; | ||
} | ||
|
||
/** Returns a maximal number of warnings that can be attached to a value */ | ||
public int getWarningsLimit() { | ||
return this.warningsLimit; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,7 +54,10 @@ public final class DataflowError extends AbstractTruffleException implements Ens | |
public static DataflowError withDefaultTrace(State state, Object payload, Node location) { | ||
assert payload != null; | ||
boolean attachFullStackTrace = | ||
state == null ? true : state.currentEnvironment().hasContextEnabled("Dataflow_Stack_Trace"); | ||
state == null | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we check for |
||
|| EnsoContext.get(location) | ||
.getExecutionEnvironment() | ||
.hasContextEnabled("Dataflow_Stack_Trace"); | ||
if (attachFullStackTrace) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is a performance bug related to code in this method. How does your change affects the benchmarks? |
||
var result = new DataflowError(payload, UNLIMITED_STACK_TRACE, location); | ||
TruffleStackTrace.fillIn(result); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change changes the
executionEnvironment
for all threads, not only for the caller. That's a change in semantics.