This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Why does GCJ generate so many explicit checks for null pointers?
- From: David Daney <ddaney at avtrex dot com>
- To: java at gcc dot gnu dot org
- Date: Sat, 26 Jul 2003 17:42:16 -0700
- Subject: Why does GCJ generate so many explicit checks for null pointers?
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.