Why does GCJ generate so many explicit checks for null pointers?

David Daney ddaney@avtrex.com
Sun Jul 27 00:42:00 GMT 2003


I am running gcj 3.3 on a i386-linux platform.
I have noticed that in the code the GCJ generates, most (if not all) 
places that a reference (or is that a pointer) is dereferenced, an 
explicit check for null is done. If a null value is found an explicit 
call to _Jv_ThrowNullPointerException is done.
I have also noticed that the runtime (in prims.cc) is trying to handle 
SIGSEGV by throwing NullPointerException.
Would someone be kind enough to explain to me why GCJ doesn't generate 
code without the null checks and let the SIGSEGV handler handle null 
pointer problems.
It seems that the generated code would run much faster without all those 
checks (something that I am concerned about in my current project).
Am I missing something here?
Thanks in advance.
David Daney.


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /