[kaffe] -O4 jit3 problem

Timothy Stack stack at cs.utah.edu
Mon Jun 3 12:30:21 PDT 2002


> One idea I had was to have each JNI function in the
> BEGIN_EXCEPTION_HANDLING macro store its start and size in the
> 'vmException' buffer.  The problem is there is no
> __builtin_function_size() GCC macro or anything that can tell you
> that.
> 
> However, I know that there are tools that can generate such info from
> a .o file.
> 
> So, we'd have to compile jni.c to jni.o, run a script over jni.o to
> extract the length of each function, create a .c file that defines
> 'size_<function_name>' for each JNI entrypoint, compile that and link
> it in.
> 
> The hardest part will probably be getting the Makefiles to do that.  :)
> 
> I'll play around with this and see if it can be made to work (the
> stack unwinding code will have to be updated, too).

What about using local labels in END_EXCEPTION_HANDLING?

#define	BEGIN_EXCEPTION_HANDLING(X)			\
	vmException ebuf;				\
	ebuf.prev = (vmException*)unhand(getCurrentThread())->exceptPtr;\
	ebuf.meth = (Method*)1;				\
	ebuf.start = &&jni_exception_start;		\
	ebuf.end = &&jni_exception_end;			\
	if (JTHREAD_SETJMP(ebuf.jbuf) != 0) {		\
		unhand(getCurrentThread())->exceptPtr = \
		  (struct Hkaffe_util_Ptr*)ebuf.prev;	\
		return X;				\
	}						\
	unhand(getCurrentThread())->exceptPtr = (structHkaffe_util_Ptr*)&ebuf \
	__label__ jni_exception_start;

#define	END_EXCEPTION_HANDLING()			\
	__label__ jni_exception_end;			\
	unhand(getCurrentThread())->exceptPtr = (struct Hkaffe_util_Ptr*)ebuf.prev

This is based on:

http://gcc.gnu.org/onlinedocs/gcc/Local-Labels.html#Local%20Labels
http://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html#Labels%20as%20Values

> -Pat

tim stack




More information about the kaffe mailing list