Null pointer check elimination

Joe Buck Joe.Buck@synopsys.COM
Mon Nov 14 19:04:00 GMT 2005


On Mon, Nov 14, 2005 at 01:43:38PM -0500, Michael N. Moran wrote:
> Excuse me. IANALL nor am I a compiler expert but ...
> what kind of optimization might be done with the information
> that a reference *should* never be null? Especially within
> the server code (the implementation of "int f(int& a)" in this case.)

There are several examples. One is converting from a derived class
to a base class when there is multiple inheritance. An offset must
be subtracted, unless it is a null pointer.
Another is the "delete" operator. It must first check that the
argument is null; it only calls the underlying memory allocator if it is
not.


More information about the Java mailing list

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