From: red5_2@hotmail.com Date: Sat, 17 Mar 2007 02:55:29 +0000 (+0000) Subject: ia64 tailcall fix X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=123ed1219094d530629f94528742b091f4e823a8 ia64 tailcall fix Tail-calls now branch to the end of the function after the call. This stops gcc from trying to move instructions into the space immediately after the call, which confuses the mangler. --- diff --git a/includes/TailCalls.h b/includes/TailCalls.h index 7927359..854c7b4 100644 --- a/includes/TailCalls.h +++ b/includes/TailCalls.h @@ -233,8 +233,17 @@ but uses $$dyncall if necessary to cope, just in case you aren't. #ifdef ia64_HOST_ARCH /* The compiler can more intelligently decide how to do this. We therefore - * implement it as a call and optimise to a jump at mangle time. */ -#define JMP_(cont) ((F_) (cont))(); __asm__ volatile ("--- TAILCALL ---"); + * implement it as a call and optimise to a jump at mangle time. + * + * Sometimes GCC likes to move instructions between the function call and + * the "--- TAILCALL ---". To stop it from finding instructions to put + * there, we insert a jump to the end of the function after the TAILCALL. */ +#define JMP_(cont) \ + ((F_) (cont))(); \ + __asm__ volatile ("--- TAILCALL ---"); \ + goto _function_end; + +#define FE_ _function_end: __asm__ volatile ("--- END ---"); /* Don't emit calls to __DISCARD__ as this causes hassles */ #define __DISCARD__()