X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FAdjustor.c;h=841f75c5d02e24522745e3ce2d57271ab46f84bb;hb=a60af39758448f92d8eaa3b62072f9adcdbbee9d;hp=4b042a17b22a9bf4a82f91bcb56156344418580a;hpb=e3c55aebd4f9ce7a5b4390d4726612865fd207f2;p=ghc-hetmet.git diff --git a/rts/Adjustor.c b/rts/Adjustor.c index 4b042a1..841f75c 100644 --- a/rts/Adjustor.c +++ b/rts/Adjustor.c @@ -40,7 +40,6 @@ Haskell side. #include "Rts.h" #include "RtsExternal.h" #include "RtsUtils.h" -#include "Storage.h" #include #if defined(_WIN32) @@ -114,7 +113,6 @@ extern void obscure_ccall_ret_code(void); #endif #if defined(ia64_HOST_ARCH) -#include "Storage.h" /* Layout of a function descriptor */ typedef struct _IA64FunDesc { @@ -959,8 +957,12 @@ TODO: Depending on how much allocation overhead stgMallocBytes uses for /* These macros distribute a long constant into the two words of an MLX bundle */ #define BITS(val,start,count) (((val) >> (start)) & ((1 << (count))-1)) #define MOVL_LOWORD(val) (BITS(val,22,18) << 46) -#define MOVL_HIWORD(val) (BITS(val,40,23) | (BITS(val,0,7) << 36) | (BITS(val,7,9) << 50) \ - | (BITS(val,16,5) << 55) | (BITS(val,21,1) << 44) | BITS(val,63,1) << 59) +#define MOVL_HIWORD(val) ( (BITS(val,0,7) << 36) \ + | (BITS(val,7,9) << 50) \ + | (BITS(val,16,5) << 45) \ + | (BITS(val,21,1) << 44) \ + | (BITS(val,40,23)) \ + | (BITS(val,63,1) << 59)) { StgStablePtr stable; @@ -969,11 +971,17 @@ TODO: Depending on how much allocation overhead stgMallocBytes uses for IA64FunDesc *fdesc; StgWord64 *code; - /* we allocate on the Haskell heap since malloc'd memory isn't executable - argh */ - adjustor = stgAllocStable(sizeof(IA64FunDesc)+18*8, &stable); + /* we allocate on the Haskell heap since malloc'd memory isn't + * executable - argh */ + /* Allocated memory is word-aligned (8 bytes) but functions on ia64 + * must be aligned to 16 bytes. We allocate an extra 8 bytes of + * wiggle room so that we can put the code on a 16 byte boundary. */ + adjustor = stgAllocStable(sizeof(IA64FunDesc)+18*8+8, &stable); fdesc = (IA64FunDesc *)adjustor; code = (StgWord64 *)(fdesc + 1); + /* add 8 bytes to code if needed to align to a 16-byte boundary */ + if ((StgWord64)code & 15) code++; fdesc->ip = (StgWord64)code; fdesc->gp = wdesc->gp;