This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PC updates while interpreting bytecode


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]