dotgnu-pnet
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pnet-developers] Array access in the java compiler ?


From: Gopal V
Subject: [Pnet-developers] Array access in the java compiler ?
Date: Thu, 27 Mar 2003 21:48:45 +0530
User-agent: Mutt/1.2.5i

Hi All,
        I'm stuck at a small problem with my java compiler right now.

int [][]a=new int[10][10];
a[0]=new int[100];

Java allows jagged arrays ... how do I implement it in IL ?.
ILNode_NewExpression generates int[][]::ctor(int32); 

The C#'s int[,] will not satisfy this ... or so I think. I'm 
absolutely completely 100% stuck at this point.

Other than generating 

int [][]a=new int[10][];
for(int i=0;i<a.length;i++)
{
        a[i]=new int[10];
}

I can't find any decent way to have the constructor.

Similarly array accesses seem to degenerate into recursive ldelems when
I do it this way. 

//a[0][0]=42;

ldloc.1
ldc.i4.0
ldelem
ldc.i4.0
ldc.i4.s 42
stelem.i4

Is there any other solution ?. I don't want to write the codegen parts
in cscc/java/  (except the JMain) . 

So do I need to fix up ILNode_JavaArrayAccess and ILNode_JavaNewExpression ?.
(I hate that !)

Gopal
-- 
The difference between insanity and genius is measured by success


reply via email to

[Prev in Thread] Current Thread [Next in Thread]