PATCH: Re: gcj non-optimization curiosity
Andrew Haley
aph@cambridge.redhat.com
Mon Dec 17 04:12:00 GMT 2001
Bryce McKinlay writes:
>
> When explicit null pointer checks got added (for MMU-less targets),
> calls to java_check_reference were introduced with the
> flag_check_references argument. But for some reason - presumably a
> mistake - the check that occurs during array bounds checks uses "1"!
If I recall correctly, the explicit pointer check was there before --
but commented out for some reason -- and when the explicit null
pointer checks were added that behavour wasn't left in.
> I guess that with the java_check_reference the optimizer could not
> eliminate the check because it doesn't know that "new" can never return
> null, but why it couldn't move it out of the loop is a mystery!
I presume that NullPointerException will be thrown in the right place
even without the check. I must say that I'd be very interested to
know why the check isn't being hoisted out of the loop, though. I
guess the answer is that our loop optimizer needs some more attention.
Andrew.
More information about the Gcc-patches
mailing list