[PATCH] Java: expand divide, expand conversions
Andrew Haley
aph@pasanda.cygnus.co.uk
Mon Jul 19 10:49:00 GMT 1999
> Date: 1999年7月19日 10:41:39 -0700
> From: Tom Tromey <tromey@cygnus.com>
>> >>>>> "Andrew" == Andrew Haley <aph@pasanda.cygnus.co.uk> writes:
>> Andrew> An unfortunate side effect of this is that the libgcj.spec
> Andrew> file is now required at compile time as well as at link time.
> Andrew> I don't know if this will be a problem for anyone.
>> I don't think it will cause any problems right now, since right now we
> already know how to search the default installation directory (I
> think).
>> Andrew> I have not yet appplied this patch. Comments welcome.
>> Would it be hard to inline the test for divide-by-0?
I could easily do that, but it would result in evil code bloat. This
is the routine which would be expanded for every division:
jint
_Jv_divI (jint dividend, jint divisor)
{
if (divisor == 0)
_Jv_Throw (arithexception);
if (dividend == 0x80000000L && divisor == -1)
return dividend;
return dividend / divisor;
}
> It seems like we
> could potentially optimize the test away in some situations (that is,
> if gcc has the necessary machinery for this, which is something I
> don't know).
The call to the divide subroutine isn't generated when dividing by a
constant, so there's no overhead in that case.
Andrew.
More information about the Java
mailing list