[llvm-dev] setjmp/longjmp and volatile stores, but non-volatile loads

Jonas Maebe via llvm-dev llvm-dev at lists.llvm.org
Mon Dec 19 03:56:12 PST 2016


On 19/12/16 12:16, Joerg Sonnenberger via llvm-dev wrote:
> On Sun, Dec 18, 2016 at 02:23:01PM +0100, Jonas Maebe via llvm-dev wrote:
>> Recap: we use setjmp/longjmp for our exception handling on all platforms in
>> our regular (non-LLVM) code generators. I'd like to use the same
>> infrastructure with the LLVM code generator for code interoperability
>> purposes (the LLVM SjLj personality is not binary-compatible with our
>> existing setjump/longjump buffers).
>
> I'm moderately sure that SjLj presonality does not use system longjmp
> and does not claim to be binary compatible either. It usees the
> intrinsics.

I know, that's why I was trying to combine our own setjmp/longjmp-based 
exception handling helpers (for binary compatibility) with a bare 
minimum of LLVM's generic exception handling infrastructure ("invoke" 
and "landingpad {i8 *, i32} catch i8* null", to ensure that LLVM's 
control flow analysis is correct).

You can see an example of the result at http://pastebin.com/77jVJJSu, 
which is the try/except-statement of the following program:

{$q+}
var
   i1: int64;
   caught: boolean;
begin
   i1:=low(int64);
   caught:=false;
   try
     i1:=i1-1;
   except
     caught:=true;
   end;
end.


However, that approach does not appear to be possible in the end because 
of the reasons mentioned in my previous mail.


Jonas



More information about the llvm-dev mailing list