This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: Why does GCJ generate so many explicit checks for null pointers?
- From: Tom Tromey <tromey at redhat dot com>
- To: Jeff Sturm <jsturm at one-point dot com>
- Cc: David Daney <ddaney at avtrex dot com>, <java at gcc dot gnu dot org>
- Date: 29 Jul 2003 07:48:47 -0600
- Subject: Re: Why does GCJ generate so many explicit checks for null pointers?
- References: <Pine.LNX.4.44.0307290114520.32300-100000@ops2.one-point.com>
- Reply-to: tromey at redhat dot com
>>>>> "Jeff" == Jeff Sturm <jsturm@one-point.com> writes:
>> Why check before the constructor call? Is it ever possible for
>> _Jv_AllocObjectNoFinalizer to return null?
Jeff> No, but the backend optimizers don't know that, or else DCE would
Jeff> eliminate the test.
Hmm, on the C++ side we mark this function, and others like it, with
__attribute__((__malloc__)). We do this in gcj as well; from
java/decl.c:
alloc_no_finalizer_node =
builtin_function ("_Jv_AllocObjectNoFinalizer",
build_function_type (ptr_type_node, t),
0, NOT_BUILT_IN, NULL, NULL_TREE);
DECL_IS_MALLOC (alloc_no_finalizer_node) = 1;
Something else must be going on...
Tom