This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: java memory allocation with gcj
- From: isuru herath <isuru81 at yahoo dot com>
- To: Bryce McKinlay <bmckinlay at gmail dot com>
- Cc: java at gcc dot gnu dot org
- Date: Fri, 6 Nov 2009 12:06:09 -0800 (PST)
- Subject: Re: java memory allocation with gcj
Hi Bryce,
Thanks a lot for the mail. Ya I noticed that too. When I tried to store
data in the first location of the array, in the assembly it was shown as
the (base+8)th location which seems like 8 byte space for the header info.
Thanks for the clarification.
regards,
Isuru
--- On Fri, 11/6/09, Bryce McKinlay <bmckinlay@gmail.com> wrote:
> From: Bryce McKinlay <bmckinlay@gmail.com>
> Subject: Re: java memory allocation with gcj
> To: "isuru herath" <isuru81@yahoo.com>
> Cc: "Andrew Haley" <aph@redhat.com>, java@gcc.gnu.org
> Date: Friday, November 6, 2009, 8:43 AM
> On Fri, Nov 6, 2009 at 4:02 PM, isuru
> herath <isuru81@yahoo.com>
> wrote:
>
> > You were right. The memory address I am getting was
> correct eventhough it is
> > a small number compared to the one I got in C. The
> problem I had was, when I
> > read that location it was not giving me the correct
> data I stored there. The
> > problem was the memroy_read function of the simulator
> was expecting the
> > physical address where as I was giving the logical
> address. When obtained the
> > physical address corresponds to this logical address
> and give it to the
> > memory_read function it gives me the correct value.
>
> Also be aware that Java arrays are different to C arrays.
> Unlike C, in
> Java the pointer returned from the allocator function will
> not
> correspond to the address of the first element stored in
> the array.
> This is due to the class identifier and array size being
> stored as
> well.
>
> Bryce
>