Null pointer check elimination

Tom Tromey tromey@redhat.com
Sat Nov 12 23:53:00 GMT 2005


>>>>> "Chris" == Chris Gray <chris.gray@kiffer.be> writes:

Chris> Another way to look at functions which return 'this' (and there
Chris> are plenty of those in the core Java libraries) is that
Chris> [...]

(Another not-uncommon case is methods that always 'return new ...'.)

We talked a bit on irc the other day about having a way to
automatically recognize situations like this and mark up the class
files (eg) so that we wouldn't have to maintain a separate list of
known-non-null-returning functions inside gcj.

It isn't unreasonable to try to detect known good cases during
bytecode generation and then write a special method attribute.
However, there is a security issue here; I would say we would probably
have to ignore this attribute at least in BC mode.

I wouldn't want this idea to hold up Anthony's patch though.  I think
they are separable and, as this one is harder to implement, it is
reasonable to go with something easy first.

Tom



More information about the Java mailing list