[kaffe] Bug with jijt and arm (with solution)

Christophe Dubach christophe.dubach@epfl.ch
Mon Dec 22 02:22:01 2003


Hello,

I've found a bug when we enable jit on arm platform. This bug was
introduce with the revision 1.6 of the file
kaffe/config/arm/linux/jit-md.h (you can see the log, the author tell us
about this...).

The bug is :
exception.h: 139: vmExcept_setJNIFrame: Assertion fp!=0 failed.

Here is the easy fix for it, just replace 
#define FIRSTFRAME(f, o) (f) =
*(exceptionFrame*)((uintp)__builtin_frame_address(0) -
sizeof(exceptionFrame))

with
#define FIRSTFRAME(f, o) (f) =
*(exceptionFrame*)((uintp)__builtin_frame_address(0))

Because if I'm not wrong, builtin_frame_address return the address of
the frame, so why substract 12 (sizeof exceptionFrame)?

I think you could also remove the "-sizeof(exceptionFrame) in jit.h for
the macro FIRSTFRAME.

But I we can also simply change the macro KAFFE_JNI_SETEXCEPTFP in
kaffe/kaffevm/jni.c with (why should we do all the stuff as declaring a
variable exceptionFrame ...?) :
#define KAFFE_JNI_SETEXCEPTFP(ebufp) {                          \
        vmExcept_setJNIFrame(ebufp,(uintp)__builtin_frame_address(0));\
        }

I hope someone will take a look at this and change it in the cvs...
It's the first time I propose a "patch" to bug, so if something is not
clear or if something is wrong, please tell me about that...

Christophe.