NEXTFRAME macro

Kiyo Inaba inaba at src.ricoh.co.jp
Tue Mar 23 22:04:54 PST 1999


I'm sorry, I made mistake to place parentheses in my previous patch.

Kiyo

diff -cr kaffe-snap-0317/config/i386/jit.h kaffe-snap/config/i386/jit.h
*** kaffe-snap-0317/config/i386/jit.h	Tue Jan 26 17:14:03 1999
--- kaffe-snap/config/i386/jit.h	Wed Mar 24 14:13:35 1999
***************
*** 24,30 ****
  
  /* Get the next frame in the chain */
  #define	NEXTFRAME(f)							\
! 	(f) = ((exceptionFrame*)(f)->retbp)
  
  /* Extract the PC from the given frame */
  #define	PCFRAME(f)							\
--- 24,30 ----
  
  /* Get the next frame in the chain */
  #define	NEXTFRAME(f)							\
! 	(((exceptionFrame*)(f))->retbp)
  
  /* Extract the PC from the given frame */
  #define	PCFRAME(f)							\
diff -cr kaffe-snap-0317/config/m68k/jit.h kaffe-snap/config/m68k/jit.h
*** kaffe-snap-0317/config/m68k/jit.h	Mon Mar  1 03:49:07 1999
--- kaffe-snap/config/m68k/jit.h	Wed Mar 24 14:14:02 1999
***************
*** 35,41 ****
  
  /* Get the next frame in the chain */
  #define	NEXTFRAME(f)							\
! 	((f) = (exceptionFrame*)(f)->retfp)
  
  /* Extract the PC from the given frame */
  #define	PCFRAME(f)		((f)->retpc)
--- 35,41 ----
  
  /* Get the next frame in the chain */
  #define	NEXTFRAME(f)							\
! 	(((exceptionFrame*)(f))->retfp)
  
  /* Extract the PC from the given frame */
  #define	PCFRAME(f)		((f)->retpc)
diff -cr kaffe-snap-0317/config/m68k/netbsd1/jit-md.h kaffe-snap/config/m68k/netbsd1/jit-md.h
*** kaffe-snap-0317/config/m68k/netbsd1/jit-md.h	Thu Aug 20 09:50:13 1998
--- kaffe-snap/config/m68k/netbsd1/jit-md.h	Wed Mar 24 13:40:34 1999
***************
*** 38,44 ****
  /* Get the first exception frame from a signal handler */
  #define	EXCEPTIONFRAME(f, c)						\
  	do {								\
! 		(f).retbp = (uintp)__builtin_frame_address(1);		\
  		(f).retpc = (uintp)(c)->sc_pc;				\
  	} while (0)
  
--- 38,44 ----
  /* Get the first exception frame from a signal handler */
  #define	EXCEPTIONFRAME(f, c)						\
  	do {								\
! 		(f).retfp = (uintp)__builtin_frame_address(1);		\
  		(f).retpc = (uintp)(c)->sc_pc;				\
  	} while (0)
  
diff -cr kaffe-snap-0317/config/m68k/netbsd1/jit.h kaffe-snap/config/m68k/netbsd1/jit.h
*** kaffe-snap-0317/config/m68k/netbsd1/jit.h	Thu Aug 20 09:50:14 1998
--- kaffe-snap/config/m68k/netbsd1/jit.h	Wed Mar 24 14:16:33 1999
***************
*** 25,61 ****
  
  /* Structure of exception frame on stack */
  typedef struct _exceptionFrame {
!         uintp   retbp;
          uintp	retpc;
  } exceptionFrame;
  
  /* Is this frame valid (ie. is it on the current stack) ? */
  #define	FRAMEOKAY(f)							\
! 	((f) && (f)->retbp >= (uintp)TCTX(currentThread)->stackBase &&	\
! 	 (f)->retbp < (uintp)TCTX(currentThread)->stackEnd)
  
  /* Get the next frame in the chain */
  #define	NEXTFRAME(f)							\
! 	((f) = (exceptionFrame*)(f)->retbp)
  
  /* Extract the PC from the given frame */
  #define	PCFRAME(f)		((f)->retpc)
  
- /* Extract the object argument from given frame */
- #define FRAMEOBJECT(f) 		(*(Hjava_lang_Object**)((f)->retbp + 8))
- 
  /* Get the first exception frame from a subroutine call */
  #define	FIRSTFRAME(f, o)						\
  	((f) = *(exceptionFrame*)__builtin_frame_address(0))
  
  /* Call the relevant exception handler (rewinding the stack as
     necessary). */
  #define CALL_KAFFE_EXCEPTION(frame, info, obj)				\
  	__asm__ __volatile__(						\
- 		"move%.l %0,%/a6\n\t"					\
  		"move%.l %1,%/d0\n\t"					\
  		"jmp %2@"						\
! 		: : "g"(frame->retbp), "g"(obj), "a"(info.handler)	\
  		: "d0", "cc", "memory")
  
  /**/
--- 25,61 ----
  
  /* Structure of exception frame on stack */
  typedef struct _exceptionFrame {
!         uintp	retfp;
          uintp	retpc;
  } exceptionFrame;
  
  /* Is this frame valid (ie. is it on the current stack) ? */
  #define	FRAMEOKAY(f)							\
! 	((f) && (f)->retfp >= (uintp)TCTX(currentThread)->stackBase &&	\
! 	 (f)->retfp < (uintp)TCTX(currentThread)->stackEnd)
  
  /* Get the next frame in the chain */
  #define	NEXTFRAME(f)							\
! 	(((exceptionFrame*)(f))->retfp)
  
  /* Extract the PC from the given frame */
  #define	PCFRAME(f)		((f)->retpc)
  
  /* Get the first exception frame from a subroutine call */
  #define	FIRSTFRAME(f, o)						\
  	((f) = *(exceptionFrame*)__builtin_frame_address(0))
  
+ /* Extract the object argument from given frame */
+ #define FRAMEOBJECT(f) 		(*(Hjava_lang_Object**)((f)->retfp + 8))
+ 
  /* Call the relevant exception handler (rewinding the stack as
     necessary). */
  #define CALL_KAFFE_EXCEPTION(frame, info, obj)				\
  	__asm__ __volatile__(						\
  		"move%.l %1,%/d0\n\t"					\
+ 		"move%.l %0,%/a6\n\t"					\
  		"jmp %2@"						\
! 		: : "g"(frame->retfp), "g"(obj), "a"(info.handler)	\
  		: "d0", "cc", "memory")
  
  /**/
diff -cr kaffe-snap-0317/config/sparc/jit.h kaffe-snap/config/sparc/jit.h
*** kaffe-snap-0317/config/sparc/jit.h	Wed Apr  1 04:10:53 1998
--- kaffe-snap/config/sparc/jit.h	Wed Mar 24 14:14:12 1999
***************
*** 33,39 ****
  
  /* Get the next frame in the chain */
  #define	NEXTFRAME(f)							\
! 	(f) = ((exceptionFrame*)(f)->retbp)
  
  /* Extract the PC from the given frame */
  #define	PCFRAME(f)							\
--- 33,39 ----
  
  /* Get the next frame in the chain */
  #define	NEXTFRAME(f)							\
! 	(((exceptionFrame*)(f))->retbp)
  
  /* Extract the PC from the given frame */
  #define	PCFRAME(f)							\
diff -cr kaffe-snap-0317/kaffe/kaffevm/exception.c kaffe-snap/kaffe/kaffevm/exception.c
*** kaffe-snap-0317/kaffe/kaffevm/exception.c	Sun Feb 28 18:10:57 1999
--- kaffe-snap/kaffe/kaffevm/exception.c	Wed Mar 24 14:16:11 1999
***************
*** 136,144 ****
  #if defined(TRANSLATOR)
          exceptionFrame* nfm;
  
!         nfm = (exceptionFrame*)(((exceptionFrame*)fm)->retbp);
          /* Note: this should obsolete the FRAMEOKAY macro */
!         if (nfm && jthread_on_current_stack((void *)nfm->retbp)) {
                  return (nfm);
          }
          else {
--- 136,144 ----
  #if defined(TRANSLATOR)
          exceptionFrame* nfm;
  
!         nfm = (exceptionFrame*)NEXTFRAME(fm);
          /* Note: this should obsolete the FRAMEOKAY macro */
!         if (nfm && jthread_on_current_stack((void *)NEXTFRAME(nfm)) {
                  return (nfm);
          }
          else {


More information about the kaffe mailing list