[kaffe] Finding out when a thread changes

Damien Uern Damien.Uern at flinders.edu.au
Thu Jul 8 17:53:23 PDT 2004


Hi,

In the MOREJIT debug output (using the interpreter engine), I want to be
able to tell what thread each instruction belongs to so I can have
output like:

getfield 0 25 1
iconst_1
iadd
putfield 0 25 1
New Thread ID = 1 //thread change
aload_0
getfield 0 38 1
ifnonnull 0 11
iconst_0

What is the safest and easiest way to setup a semaphore in kaffe around
the bytecode interpretation so that I know threads aren't going to
switch mid instruction and mess up the output. i.e. in the part
intrp/machine.c

void runVirtualMachine()

...

for (;;) {
       register uintp pc = npc;
   ...
      switch (code[pc]) {
       default:
          dprintf("Unknown bytecode %d\n", code[pc]);
          throwException(NEW_LANG_EXCEPTION(VerifyError));
          break;
#include "kaffe.def"
       }
}


Sorry if this sounds like a newbie question :) Any help would be most
appreciated.

Thanks,

Damien


-- 
---------------------------------------------------

Fry: I'm never gonna get used to the 31st century.
      Caffeinated bacon? Baconated grapefruit?
      Admiral Crunch?

Leela: Well if you don't like that, try some
        Archduke Chocula.








More information about the kaffe mailing list