Stack and local variables in bytecode tracing

Colin(Du Li) dawn2004 at
Tue Feb 24 09:25:04 PST 2009

Peng Du wrote:
> Hello, everyone
> I know there is a BytecodeTracer class which is only enabled in DEBUG
> build,
> which is used to spit out bytecodes when the TraceBytecodes option is
> turned
> on. What I am interested in are the addresses to java heap being accessed
> (read/write) when the opcodes, e.g. aload, astore, putfield, etc, are
> executed.
> However, by default this method does not print out  those kind of
> information even in verbose mode AFAIK. So, I want to modify the class by
> adding a new method whose solely purpose is when a memory access code is
> in
> execution, extract the memory addresses, either from the expression stack
> (for xxstore), or from the local variable pool (for xxload).
> I know tos, tos2 are passed directly to the BytecodeTracer::trace()
> method.
> But for array opcodes, e.g. aastore, there are three elements on stack,
> i.e*.
> *arrayref, index, value*. *If "value" is tos, how can I get arrayref?
> Value is on tos, the next two element in the stack is "arrayOff".You can
> take a look at micro bytecodeInterpreter::ARRAY_INTRO, you can get some
> insight about how to access the array with "arrayOff", that is, how get
> arrayRef and index.
> Furthermore, what are the correct ways to peek on the expression stack and
> in local variable pool?
> My another question is: in bytecodes.hpp, there are two groups of
> bytecodes,
> ie. Java bytecodes and JVM bytecodes. I understand what Java bytecodes
> are.
> But what are JVM bytecodes (_fast_XX)?
> Thanks in advance.
> Peng Du

View this message in context:
Sent from the OpenJDK Hotspot Virtual Machine mailing list archive at

More information about the hotspot-dev mailing list