-
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
Append warnings extracted before tail call execution #6849
Conversation
Throwing `TailCallException` meant that exceptions that were extracted from the expression before the call was made could not be appended. This change catches the `TailCallException`, adds warnings to it and propagates it further, thus ensuring that we don't loose the information. Closes #6765.
if (warnings == null) { | ||
warnings = e.getWarnings(); | ||
} |
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.
What if warnings != null
?
Shouldn't we somehow concatenate the existing warnings with the new ones?
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.
Thanks for removing the outdated workarounds. The tests look all good.
I just have one question as I'm not sure if I correctly understand a piece of logic. Other than that - looks good.
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.
Every time I look at the engine internals and realize how much bookkeeping is done behind the scenes. I genuinely wonder how it keeps maintaining a decent performance 😄
Warnings affect performance. Quite significantly TBH (benchmarks show it). |
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 is not what I envisioned. I don't understand why TCE should have Warnings
field.
I wrote:
How such "loosing of warnings" can happen?
v.fold 0 (+)
indo_fold_1
strips warnings off and callsfold
on "real v" value.
fold
uses@Tail_Call
and then it returns. The stripped off warnings aren't added.
But how do you want to carry warnings inTailCallException
? They are already stripped off when it is created!
The fix is: When dealing withWarnings
, catchTailCallException
and re-throw with warnings re-attached.
What are the benchmark results? Is regular TCO slower? |
engine/runtime/src/main/java/org/enso/interpreter/node/callable/InvokeMethodNode.java
Outdated
Show resolved
Hide resolved
engine/runtime/src/main/java/org/enso/interpreter/node/callable/dispatch/CurryNode.java
Outdated
Show resolved
Hide resolved
...time/src/main/java/org/enso/interpreter/node/callable/dispatch/LoopingCallOptimiserNode.java
Outdated
Show resolved
Hide resolved
...ntime/src/main/java/org/enso/interpreter/node/callable/dispatch/SimpleCallOptimiserNode.java
Outdated
Show resolved
Hide resolved
https://enso-org.github.io/engine-benchmark-results/
No |
Can't re-attach warnings to the result of method call because there is no result to attach to at that point in time. That's why I enhanced TCE to carry that info when the result is available. |
@JaroslavTulach Couldn't change to |
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.
After 5628c71 I see just three changes setting NOT_TAIL
:
That seems like the right fix.
…le-6756-6804 * develop: (22 commits) Coalesce graph editor view invalidations (#6786) Append warnings extracted before tail call execution (#6849) Detect and override hooks of the same kind (#6842) Dynamic app resampling and better performance measurements. (#6595) Show spinner when opening/creating a project, take #2 (#6827) Infrastructure for testing inter project imports and exports (#6840) Only initialise visualisation chooser if it is used. (#6758) Allow casting a Mixed column into a concrete type (#6777) Stop graph editing when in full-screen visualization mode (#6844) Handle `show-dashboard` event (#6837) Fix some dashboard issues (#6668) Fix JWT leak (#6815) Fix "set username" screen (#6824) Fallback to opened date when ordering projects (#6814) Various test improvements to increase coverage and speed things up (#6820) do not activate nested dropdowns together (#6830) Clearly select single specialization with enum dispatch pattern (#6819) Prevent incorrect application of list widget on incompatible expressions (#6771) Update GraalVM to 22.3.1 JDK17 (#6750) Import/export syntax error have more specific messages (#6808) ...
Partially revert #6849, which introduced a regression in TCO in the presence of warnings. Rather than modifying the tail call status, `TailCallException` now propagates the extracted warnings and appends them to the final result. Compare to the previous attempt we don't pay the penalty of adding the warnings or even checking for them because it is being dealt in a separate specialization.
Partially revert #6849, which introduced a regression in TCO in the presence of warnings. Rather than modifying the tail call status, `TailCallException` now propagates the extracted warnings and appends them to the final result. Closes #7093 # Important Notes Compared to the previous attempt we don't pay the penalty of adding the warnings or even checking for them because it is being dealt in a separate specialization.
Pull Request Description
Throwing
TailCallException
meant that exceptions that were extracted from the expression before the call was made could not be appended. This change catches theTailCallException
, adds warnings to it and propagates it further, thus ensuring that we don't loose the information.Closes #6765.
Important Notes
Removed workarounds introduced in stdlib.
Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.
./run ide build
.