This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: Analysis of Mauve failures - The final chapter
>>>>> "Mark" == Mark Wielaard <mark@klomp.org> writes:
Mark> import java.lang.reflect.Array;
Mark> public class Big
Mark> {
Mark> public static void main(String[] args)
Mark> {
Mark> String[][] t = (String[][]) Array.newInstance(String.class,
Mark> new int[] {Integer.MAX_VALUE, Integer.MAX_VALUE});
Mark> System.out.println(t.length);
Mark> }
Mark> }
I tried this. I get this result:
creche. gcj --main=Big -o Big Big.java -Wl,-rpath,/x1/gcc3/install/lib
creche. ./Big
Out of Memory! Returning NIL!
This isn't what I expected. I expected OutOfMemoryError to be thrown
and a stack trace to be printed.
I definitely didn't see the failure that you report.
Mark> It seems to me that something like the following is needed since
Mark> the Class type does not have to be an array class with
Mark> Array.newInstanceOf()
In Array.newInstance(Class,int[]) we compute the array type, which we
then pass to _Jv_NewMultiArray:
jclass arrayType = componentType;
for (int i = 0; i < ndims; i++) // FIXME 2nd arg should
// be "current" loader
arrayType = _Jv_GetArrayClass (arrayType, 0);
So I don't think this patch is necessary. I think something else is
going on here. What do you think?
Tom