Help with performance issues.

Boehm, Hans
Mon Jul 30 08:41:00 GMT 2001

> Sun's JIT is almost certainly inlining Math.abs() and we 
> probably aren't.
I checked that we aren't.  Things are worsened by the fact that Math.abs()
appears to call _Jv_InitClass.  Among other things, I count 4 call
instructions to compute an absolute value:

1) call Math.abs()
2) x86 call to get PC value in register for PIC code.
3) Call _Jv_InitClass
4) x86 call to get PC value in register for PIC code, this time for

Is there any reason to call _Jv_InitClass on bultin classes like

> Try replacing this with a static final method in your class 
> to see if it
> gets inlined (put it before this method in your class definition).
> It seems like gcj should be able to replace Math.abs() with 
> __builtin_abs in
> this case.  Does anybody think otherwise?
That would be nice.

Another problem that we've sometimes seen in code like this is that the
array null pointer checks don't completely disappear, at least not on
Itanium.  On 32-bit machines this may be hard to avoid.  On 64-bit machines,
it might be possible to arrange that there is nothing mapped within the
first 32GB of address space, so that accesses through null array pointers
are also guaranteed to result in an identifiable SIGSEGV.  Does this make


More information about the Java mailing list