X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fincludes%2FTailCalls.h;h=af248da1cd2b8d2b6fc3f9b96bc78d46445ff5f0;hb=55c604790106d8c8b4a470feefe55e19bbfe7477;hp=2d3f36c4b21362b455f6cc119c0626691cacc174;hpb=cb5ccf0a7588f9d67835d99a8135b02f3f5ba884;p=ghc-hetmet.git diff --git a/ghc/includes/TailCalls.h b/ghc/includes/TailCalls.h index 2d3f36c..af248da 100644 --- a/ghc/includes/TailCalls.h +++ b/ghc/includes/TailCalls.h @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: TailCalls.h,v 1.10 2002/06/03 13:08:41 matthewc Exp $ + * $Id: TailCalls.h,v 1.17 2004/11/21 22:25:24 desrt Exp $ * * (c) The GHC Team, 1998-1999 * @@ -16,7 +16,7 @@ #ifdef USE_MINIINTERPRETER -#define JMP_(cont) return(stgCast(StgFunPtr,cont)) +#define JMP_(cont) return((StgFunPtr)(cont)) #define FB_ #define FE_ @@ -51,15 +51,30 @@ extern void __DISCARD__(void); #define JMP_(cont) \ { \ - void *target; \ + void *__target; \ __DISCARD__(); \ - target = (void *)(cont); \ - goto *target; \ + __target = (void *)(cont); \ + goto *__target; \ } #endif /* i386_TARGET_ARCH */ /* ----------------------------------------------------------------------------- + Tail calling on x86_64 + -------------------------------------------------------------------------- */ + +#if x86_64_TARGET_ARCH + +#define JMP_(cont) \ + { \ + void *__target; \ + __target = (void *)(cont); \ + goto *__target; \ + } + +#endif /* x86_64_TARGET_ARCH */ + +/* ----------------------------------------------------------------------------- Tail calling on Sparc -------------------------------------------------------------------------- */ @@ -83,11 +98,14 @@ extern void __DISCARD__(void); #ifdef alpha_TARGET_ARCH +#if IN_STG_CODE register void *_procedure __asm__("$27"); +#endif -#define JMP_(cont) \ - do { _procedure = (void *)(cont); \ - goto *_procedure; \ +#define JMP_(cont) \ + do { _procedure = (void *)(cont); \ + __DISCARD__(); \ + goto *_procedure; \ } while(0) /* Don't need these for alpha mangling */ @@ -185,6 +203,10 @@ but uses $$dyncall if necessary to cope, just in case you aren't. #endif /* powerpc_TARGET_ARCH */ +#ifdef powerpc64_TARGET_ARCH +#define JMP_(cont) ((F_) (cont))() +#endif + /* ----------------------------------------------------------------------------- Tail calling on IA64 -------------------------------------------------------------------------- */