This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: Null pointer check elimination
- From: Ian Lance Taylor <ian at airs dot com>
- To: David Daney <ddaney at avtrex dot com>
- Cc: Anthony Green <green at redhat dot com>, java at gcc dot gnu dot org, Diego Novillo <dnovillo at redhat dot com>, GCC Mailing List <gcc at gcc dot gnu dot org>
- Date: 11 Nov 2005 22:53:50 -0800
- Subject: Re: Null pointer check elimination
- References: <1131747852.3205.105.camel@localhost.localdomain><4375835F.6070106@avtrex.com>
David Daney <ddaney@avtrex.com> writes:
> > Eventually we should manually mark certain function DECLs as
> > not-returning-null instead of my kludgy test for this one case. I don't
> > know if/when I can get to that. Perhaps somebody else can take it from
> > here.
>
> Looks like all the bits in struct tree_common are used up.
>
> Q: Would it make sense to add a flag to struct tree_decl_common to
> indicate !zero, set it using an attribute, (and automatically in the
> java front-end for the cases above), and then test for it in
> tree-vrp.c similar to below?
This should be done using an attribute, yes. If this is going to be
tested frequently enough, it would make sense to add a bit to struct
tree_function_decl (I don't see any reason to put it in struct
tree_decl-common) (there is currently room for one more bit in
tree_function_decl on a machine which requires 16-bit alignment, or 17
more bits on a machine which requires 32-bit alignment). Note that it
is also possible to simply store the attribute on DECL_ATTRIBUTES and
look it up using lookup_attribute.
Ian