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

Peter Collingbourne peter at pcc.me.uk
Tue Apr 1 11:38:40 PDT 2014


On Tue, Apr 01, 2014 at 11:35:16AM -0500, Krzysztof Parzyszek wrote:
> How do you plan to actually create the exception?

The runtime library can invoke the unwinder directly (i.e. using
_Unwind_RaiseException).

> You cannot simply  
> throw an exception (via "throw" statement) from a signal handler because  
> the unwinding won't happen properly.  To make it work you'll need a  
> runtime support to indicate the origin of the exception (i.e. the  
> address of the offending load/store). Alternatively, you could insert  
> runtime checks at the loads/stores, but then it won't be "zero-cost".

I'm pretty sure that it is possible to unwind through signal handlers. This
is, for example, how gccgo implements some run-time panics.

Thanks,
-- 
Peter



More information about the llvm-dev mailing list