indirect array reference from interpreter

Manjiri Namjoshi manjiri.namjoshi at
Fri Nov 13 11:21:59 PST 2009

Hello Keith,

Thank you for your reply. Yes, what you said about the first __mov32
instruction makes complete sense to me.
But, can you explain a little more about what you are saying in the second
paragraph ?
may be with an example ?

sorry, but I am not really very comfortable about the hotspot assembly
template code yet.

thanks again !


2009/11/13 Keith McGuigan <Keith.McGuigan at>

> Hi Manjiri,
> The code for the interpreter is generated at startup, and at that time the
> current address of ptr_queue is getting embedded in the code as an immediate
> constant.  That first __mov32 instruction isn't evaluating 'ptr_queue' each
> time it executes.
> In order to do what you want here, I think you'll need to use a double
> indirection, where the baked-in address refers to a location in the heap
> which points at your array.  Then you can change the address stored in the
> heap at each iteration.
> hope that helps...
> --
> - Keith
> Manjiri Namjoshi wrote:
>> Hello,
>> I am trying to set a global array from the hotspot interpreter.
>> I am using x86 machine, so in the templateInterpreter_x86_32.cpp (on every
>> method entry) I have put following code :
>> __ mov32(ExternalAddress((address)(ptr_queue)),rdx);   // rdx contains the
>> value that I want to set in the array location that ptr_queue is currently
>> pointing
>> // following code increments the ptr_queue, so that it will point to the
>> next array index.
>> __ mov32(rax, ExternalAddress((address)&(ptr_queue)));
>> __ addl(rax, 4);
>> __ mov32(ExternalAddress((address)&(ptr_queue)),rax);
>> where,
>> int * ptr_queue = &profileQueue[0];
>> // profileQueue is the actual global array that I want to set.
>> But, this code is able to set only profileQueue[0] with the value in rdx.
>> All the other locations in the array are not getting set to rdx.
>> Basically, I need to do indirect array referencing from the interpreter.
>> Please let me know if my question is not clear.
>> Thank You.
>> Sincerely,
>> Manjiri
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the hotspot-dev mailing list