This is the mail archive of the java-discuss@sourceware.cygnus.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [PATCH] Java: expand divide, expand conversions


> Date: Mon, 19 Jul 1999 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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]