This is the mail archive of the java@gcc.gnu.org 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: gcj performance on Solaris 2.6




On 26 Jul 2001, Tom Tromey wrote:
> If you are running performance tests, always use at least -O1.
> -O2 is probably better.  Often, -O3 can give worse results than -O2,
> though, because (I hear) it inlines too aggressively (perhaps not a
> problem for Java, where inlining is still not quite there).

True.  Gcj has a different problem: every private/static/final method is
declared DECL_INLINE.  That may not always do what you want.

I built one application library at -O0, -O2 and -O3 with the patch below,
and at -O2 unpatched for comparison.

   text    data     bss     dec     hex filename
1659369  247180     704 1907253  1d1a35 libjacl-O0.so
2474525  243612     704 2718841  297c79 libjacl-O2-unpatched.so
1354881  237836     704 1593421  18504d libjacl-O2.so
1418826  236272     704 1655802  1943fa libjacl-O3.so

With the patch -O2 yields the smallest binary, and -O3 slightly larger.
That's what I expect.  But the unpatched gcj nearly doubles the text size
at -O2.  The library built with -O3 executes fastest on my tests.

I'd be inclined to omit DECL_INLINE in the frontend and let the integrator
use its best judgement, at least until we have tree inlining with decent
heuristics.  Of course one application on one platform isn't a good
data set.  Comments?

Index: class.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/class.c,v
retrieving revision 1.100
diff -u -r1.100 class.c
--- class.c     2001/06/27 20:38:20     1.100
+++ class.c     2001/07/26 19:15:45
@@ -674,16 +674,16 @@
   if (access_flags & ACC_PUBLIC) METHOD_PUBLIC (fndecl) = 1;
   if (access_flags & ACC_PROTECTED) METHOD_PROTECTED (fndecl) = 1;
   if (access_flags & ACC_PRIVATE)
-    METHOD_PRIVATE (fndecl) = DECL_INLINE (fndecl) = 1;
+    METHOD_PRIVATE (fndecl) = 1;
   if (access_flags & ACC_NATIVE)
     {
       METHOD_NATIVE (fndecl) = 1;
       DECL_EXTERNAL (fndecl) = 1;
     }
   if (access_flags & ACC_STATIC) 
-    METHOD_STATIC (fndecl) = DECL_INLINE (fndecl) = 1;
+    METHOD_STATIC (fndecl) = 1;
   if (access_flags & ACC_FINAL) 
-    METHOD_FINAL (fndecl) = DECL_INLINE (fndecl) = 1;
+    METHOD_FINAL (fndecl) = 1;
   if (access_flags & ACC_SYNCHRONIZED) METHOD_SYNCHRONIZED (fndecl) = 1;
   if (access_flags & ACC_ABSTRACT) METHOD_ABSTRACT (fndecl) = 1;
   if (access_flags & ACC_TRANSIENT) METHOD_TRANSIENT (fndecl) = 1;



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