This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


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

Re: gcj: always emit static array data



Andrew wrote:
> Well, okay.  However, this is surely just papering over the cracks in
> the wall: surely we should find out *why* we need to output an array
> which is inaccessible.  Is it because class metadata refers to it?

The array is being used in the class initialization code.

In this case...

public class Foo
{
  private final static int[] a = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
  public static void main (String[] args) {}
}

...the compiler generates a class initialization routine which
allocates a new array with _Jv_NewArray.  The data is then copied into
this array.

Thinking about it for a second now, it seems like we should be able to
get the compiler to create these array objects ahead of time, just
like we do for instances of java.lang.Class.

AG

-- 
Anthony Green                                               Cygnus Solutions
                                                       Sunnyvale, California


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