[LLVMdev] Re: Newbie questions
Chris Lattner
sabre at nondot.org
Wed Apr 26 21:02:36 PDT 2006
On Wed, 26 Apr 2006, Vikram Adve wrote:
> On Apr 26, 2006, at 3:23 PM, Chris Lattner wrote:
>> On Wed, 26 Apr 2006, Vikram Adve wrote:
>>>> 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).
>>
>>> Specifically, I don't think either of these approaches will be sufficient
>>> when using LLVM as a JIT in libgcj. In either case, an LLVM optimization
>>> could still reorder trapping instructions. In the first approach, this is
>>> less likely to occur but is possible. The second approach of course
>>> wouldn't work because LLVM doesn't have a notion of implicitly trapping
>>> instructions and could merrily reorder such operations.
>>
>> Vikram, I'm confused. How do you think LLVM will break this?
>
> By reordering two instructions that could throw exceptions.
One of us is confused. The approach above never has instructions that
throw exceptions.
> I'm talking about non-fatal conditions like divide-by-0 or a null reference
> that are caught by exception handlers.
With the approach above, no exceptions are non-fatal. There is no "catch
a signal and turn that into an exception" of any sort.
-Chris
--
http://nondot.org/sabre/
http://llvm.org/
More information about the llvm-dev
mailing list