gcj: always emit static array data

Andrew Haley aph@pasanda.cygnus.co.uk
Mon Aug 16 07:02:00 GMT 1999


> Date: Mon, 16 Aug 1999 06:58:32 -0700
> From: Anthony Green <green@cygnus.com>
> 
> 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.

So we should stop the compiler from referring to the array in the
class initialization routine, n'est ce pas?  We are initializing an
unreachable array...

Andrew.


More information about the Gcc-patches mailing list