[LLVMdev] Proposal: Loads/stores with deterministic trap/unwind behavior

Joe Ranieri joe at alacatialabs.com
Wed Apr 2 07:44:33 PDT 2014


On Wed, Apr 2, 2014 at 8:18 AM, Joerg Sonnenberger
<joerg at britannica.bec.de> wrote:
> libc++abi's unwind doesn't really support unwinding through signal
> handlers, at least it wouldn't do anything special for them. I don't
> have the faintest idea what the correct semantic would even be. Does it
> restore the saved signal mask? Can you even unwind past the frame? In
> general you won't as unwind instructions are not precise/
>
> Joerg

I've done a similar scheme in the past using Mach exception handlers.
Basically there's a thread running that gets told when bad memory
accesses happen and it has access to all of that thread's register
state. Given the state, it determines whether or not an exception
should be thrown (e.g. is the current instruction pointer is in user
code). Then it changes the thread's register state in order to push a
new stack frame and call the function that raises the exception. Once
all of the setup is done, the thread is resumed and things go on their
merry way without crashing.

I'd love to see this become feasible with LLVM as we found this a
significant win in terms of reducing binary size.

-- Joe Ranieri



More information about the llvm-dev mailing list