Question about POSIX libgcj signals / exception handling

David Daney ddaney@avtrex.com
Sat Mar 11 06:25:00 GMT 2006


Andrew Pinski wrote:
> 
> On Mar 11, 2006, at 1:08 AM, David Daney wrote:
> 
>> SIGSEGV gets converted to NullPointerException.  This is unconditional 
>> it happens even if the faulting location is far away from address 
>> zero.      Native code is not treated any differently than the java 
>> code. Any SIGSEGV is converted to NPE.
> 
> 
> This is not true for the PPC OS X implementation.  Only null pointer 
> accesses are
> converted to NPEs.
> 

Most of what I say with respect to anything other than gcj on 
mipsel-linux should probably be a bit suspect.

> The rest of David's analysis applies, well except for the SIGFPE part 
> for integer math.
> On PPC (and most other targets), function calls are made for divides as 
> the target
> does not raise a trap for undefined code unlike x86.
> 

MIPS has a seperate trap instruction that is used.  It makes the code 
longer than a simple divide, but shorter than a function call.

With VRP we could in some cases know if an exception is impossible and 
generate the divide in-line (or omit the trap instruction) instead of 
calling the function.

David Daney.



More information about the Java mailing list