This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: gcj: always emit static array data
- To: aph at pasanda dot cygnus dot co dot uk
- Subject: Re: gcj: always emit static array data
- From: Anthony Green <green at cygnus dot com>
- Date: Mon, 16 Aug 1999 06:58:32 -0700
- CC: gcc-patches at sourceware dot cygnus dot com
- References: <19990816125509.9134.qmail@pasanda.cygnus.co.uk>
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