Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Exception stacks #28878
An exception stack system for julia
Here's my attempt to fix #12485 / #19979 by introducing an exception stack
A distinct problem discussed in #12485 is that task switching looses all
To solve the first problem, I've implemented an exception stack mechanism.
try error("A") catch try error("B") catch for (e, bt) in Base.catch_stack() showerror(stdout, e, bt) println() end end end
A new lowered expression head
Interpreter / Codegen
Some minor rearrangement in the interpreter to make the eh buffer management
Mostly small changes in codegen. Representing the enter token as an SSAValue
What? How did this rabbit hole lead down into the GC?
Unfortunately the raw backtrace buffers contain references to GC allocated
I'm not sure this was a good idea, especially having extra code to maintain in
This was referenced
Aug 24, 2018
@iamed2 Hah yes I originally came across this when working on logging.
To add to the commentary above, One of my biggest difficulties with this patch was the need to GC root objects in the bt buffer, and also GC the buffer itself in the case that it's attached to a
Actually I hope to delete most of the GC changes which were done here as they seem like overkill. My current best idea is to use the new efficient array-of-small-
Is this a sound idea? Advice on how to improve the memory management in this patch would be particularly welcome.
Ok, CI failures are because I've got something wrong in GC land and the debug build is failing on an assertion. My best guess is that I've broken whatever invariants
Anyway, the release build does "work" so the branch is in a state where the curious can play with it until the real problem is fixed.
Looking into alternative storage for backtrace buffers, the
Ok, tests have passed after restarting the appveyor x86_64 build three times. There is an intermittent failure in a single one of the spawn tests on that platform related to deleting a directory, see https://ci.appveyor.com/project/JuliaLang/julia/build/1.0.30766/job/wnxk1pxa27xte6un for example.
The fact that it's recurring here more frequently could be related to the changes in this PR.
I just rebased this again to clean up some recent conflicts, and to consolidate a lot of WIP commits into a small number of consistent changes.
This reminded me of an interesting side effect of this patch which I should point out — code generated by
referenced this pull request
Oct 5, 2018
Yes the stack is used underneath but isn't generally exposed to the user unless they called