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: Optimisation bug (?)


> Date: Thu, 24 Jun 1999 22:35:11 +1200
> From: Bryce McKinlay <bryce@albatross.co.nz>
> 
> > So, it looks as though private methods are a bit *too* private when used
> >
> > with optimisation, or I'm missing something (probably blindingly obvious
> > :-)
> 
> I can confirm this. It looks like gcj decides that private methods are not
> required when using -O3  ;-)
> 
> public class Private
> {
>   private static void sayHi()
>   {
>     System.out.println("Hi");
>   }
> 
>   public static void main(String args[])
>    {
>      Private.sayHi();
>    }
> }

1999-06-24  Andrew Haley  <aph@cygnus.com>

	* java/class.c (finish_class): Whenever a deferred method is
	output, rescan the list of methods to see if a new candidate for
	output can be found.

Index: gcc/java/class.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/java/class.c,v
retrieving revision 1.67.2.3
diff -p -2 -c -r1.67.2.3 class.c
*** class.c	1999/05/12 23:31:50	1.67.2.3
--- class.c	1999/06/24 16:52:26
*************** finish_class (cl)
*** 1199,1206 ****
  {
    tree method;
  
!   /* Emit deferred inline methods. */
!   for ( method = TYPE_METHODS (CLASS_TO_HANDLE_TYPE (current_class));
! 	method != NULL_TREE; method = TREE_CHAIN (method))
      {
        if (! TREE_ASM_WRITTEN (method) && DECL_SAVED_INSNS (method) != 0)
--- 1199,1206 ----
  {
    tree method;
+   tree type_methods = TYPE_METHODS (CLASS_TO_HANDLE_TYPE (current_class));
  
!   /* Emit deferred inline methods. */  
!   for (method = type_methods; method != NULL_TREE; )
      {
        if (! TREE_ASM_WRITTEN (method) && DECL_SAVED_INSNS (method) != 0)
*************** finish_class (cl)
*** 1214,1219 ****
--- 1214,1224 ----
  	      output_inline_function (method);
  	      permanent_allocation (1);
+ 	      /* Scan the list again to see if there are any earlier
+                  methods to emit. */
+ 	      method = type_methods;
+ 	      continue;
  	    }
  	}
+       method = TREE_CHAIN (method);
      }


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