[LLVMdev] Re: Newbie questions

Tom Tromey
Wed, 26 Apr 2006 15:45:44 -0000

>>>>> "Vikram" == Vikram Adve <vadve at
cs.uiuc.edu> writes:

Vikram> Either way, one issue that you will have to deal with is preserving
Vikram> the behavior of Java exceptions (assuming you care about that).  LLVM
Vikram> does not preserve the order of potentially excepting instructions
Vikram> (e.g., a divide or a load).  This would have to be handled
Vikram> explicitly, whether you use llvm-java or simply used LLVM on the C
Vikram> code from Soot.  I don't know if/how libgcj handles this but Tom
may
Vikram> be able to say more about that.

libgcj has two different approaches.

On some platforms we generate explicit checks for null pointer
dereferences and for division by zero (division is a bit different in
that we also have to handle java's special rule for dividing -1 by the
minimum integer -- I think most platforms actually call the helper
function).

On other platforms, we don't generate explicit checks but instead let
them signal, and then we have special code in the runtime to turn a
signal into an exception.  The second part here is that GCC knows
about implicitly trapping instructions (the -fnon-call-exceptions
flag, which we pass to all compilations for these targets).

Tom