exceptions and integrating intrp/jit

Senthil Kumar skumars at earthlink.net
Sat Sep 12 20:45:22 PDT 1998

I am only concentrating on linux/i386.

The exception handling in intrp mode is simple.
Implemented using setjmp/longjmp. Every method
call (via virtualMachine) registers its exception
stuff with the current thread.

However this does
not seem to happen in the case of JIT?? What is
the mechanism by which we walk up the exception frame?
The code seems to imply

nextframe = current->retbp (So retbp hold the previous frame)
But where is it set??

In fact, I am not even clear about how we get to the frame
in the first place.

frame = *((exceptionFrame*)(((uintp) &eobj) - 8));

where eobj is the object passed to the throwException function.

We have for the jit:

typedef struct _exceptionFrame
   uintp retbp;
   uintp retpc;
} exceptionFrame;

For the intrp:

typedef struct _vmException
    jmp_buf buf;
    struct _vmException *prev;
    // some other stuff
} vmException;

I merged the two structs into one, and I thought that
the simplest way would be to make the JIT also register
its exceptionFrame with the current thread and have similar
semantics as we have with the intrp, i.e. have a prev pointer
which points to the previous frame. There will also be a flag
which indicates if the frame belongs to a translated or an intrp
method. and thus depending upon this flag, we can take the
right action, either long_jmp or jmp to the handler in ASM.

Am in the right direction. I seem quite confused about this mess.
Would appreciate some help.


More information about the kaffe mailing list