benchmark result

Andrew Haley aph@redhat.com
Tue Dec 7 11:12:00 GMT 2004


Mathieu Lacage writes:
 > On Tue, 2004-12-07 at 10:52 +0000, Andrew Haley wrote:
 > > What CPU are you using?  I would expect these calls to log to be
 > > inlined on an x86.
 > 
 > pentium4: -O2 -mtune=pentium4 -ffast-math

That shouldn't happen; there should be no calls to _ieee754_log.  I
just tried a simple test with


public class f
{
  public static void main (String[] s)
  {
    System.err.println (Math.log (2.4));
  }
}


/local/aph/gcc-3_4-branch/build/gcc/gcj -B/local/aph/gcc-3_4-branch/build/gcc/ -S -ffast-math -O2 f.java

and the call to log was inlined as a CPU instruction, not a call to "log":

f.main(java.lang.String[]):
.LFB2:
        pushl   %ebp
.LCFI0:
        movl    %esp, %ebp
.LCFI1:
        pushl   %ebx
.LCFI2:
        subl    20, %esp
.LCFI3:
        cmpb    13, java.lang.System.class$+86
        movl    f.class$, (%esp)
        setg    %bl
        call    _Jv_InitClass
        testb   %bl, %bl
        je      .L5
.L3:
        fldl    .LC0
        fldln2
        fxch    %st(1)
        movl    java.lang.System.err, %edx
        fyl2x
        movl    (%edx), %eax
        movl    %edx, (%esp)
        fstpl   4(%esp)
        call    *112(%eax)
        addl    20, %esp
        popl    %ebx
        popl    %ebp
        ret
        .p2align 4,,7
.L5:
        movl    java.lang.System.class$, (%esp)
        call    _Jv_InitClass
        jmp     .L3



More information about the Java mailing list