indirect array reference from interpreter
Keith.McGuigan at Sun.COM
Thu Nov 12 22:42:27 PST 2009
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...
Manjiri Namjoshi wrote:
> 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);
> int * ptr_queue = &profileQueue;
> // profileQueue is the actual global array that I want to set.
> But, this code is able to set only profileQueue 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.
More information about the hotspot-dev