PC updates while interpreting bytecode
Kyle Galloway
kgallowa@redhat.com
Wed Apr 11 17:41:00 GMT 2007
Hi all,
I was wondering about updates to the pc while interpreting bytecodes.
I know that the actual pc is a local variable to the particular
instance of _Jv_InterpMethod::run (or run_debug), but I was wondering
how often frame_desc.pc is updated. The reason I ask is that to get a
stack trace at an arbitrary point in time, it is necessary for the pc
inside the frame structure to be correct in order for the location
reported to be correct. this is particularly important when single
stepping through code in between method calls, where currently, though
the VM is stepping to the right place, the pc in the frame info is not
updated which causes eclipse to incorrectly display the source line
currently executing at some points.
I have thought of a couple of solutions to this, and I was wondering
what opinions there are on this. The first is to update the pc inside
NEXT_INSN in the debug case, though I think this is still less that
ideal since there is a race there if the thread is suspended after the
local pc has changed but before the frame info pc is updated. The
second is to pin the PC with a pointer inside the frame structure in the
debug case like this:
pc_t pc;
frame_desc.pc_ptr = &pc;
I would assume it would be preferable in this case to maintain the
current pc and to access the "real" pc through this pointer, which would
be only a small change to the current stack tracing code. I tend to
think this would be the preferable solution, but I thought I would get
input from people far wiser than I am in this department.
Thanks,
Kyle
More information about the Java
mailing list