Patch: Standard comformant arithmetic
Andrew Haley
aph@pasanda.cygnus.co.uk
Wed Jul 21 10:35:00 GMT 1999
> Date: Wed, 21 Jul 1999 10:23:47 -0700
> From: Tom Tromey <tromey@cygnus.com>
>
> This discussion brings to mind the null pointer problems we have.
>
> For systems without memory management support, when -Os is used, it
> might make the most sense to put the check inside the callee and not
> the caller. Of course, this would mean that you'd have to build your
> entire application the same way in order to get consistent null
> pointer checks. Does this sound reasonable?
What exactly do you mean by "the callee and not the caller?" I can
think of several different ways that the check could be done.
My idea was to replace every access to memory with insns like:
or r4, r4
je ThrowNullPointerException
ldr r5, (r4)
and then optimize so that wherever we can prove p is non-NULL we
remove the check. We'll remove most of the checks this way. gcc's
optimizer can already do some of this.
Andrew.
More information about the Java-patches
mailing list