X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FArena.c;h=cc18e4e95bc8c6ae1a935c5406dce785c95220d6;hb=0df435464ff825eb66e409fb5668a53cd5362309;hp=f719400c9e4a0ddf814971d425c1dccbe8d8c238;hpb=bda943136e7dee3ad36e368fd81014850b5d6db9;p=ghc-hetmet.git diff --git a/ghc/rts/Arena.c b/ghc/rts/Arena.c index f719400..cc18e4e 100644 --- a/ghc/rts/Arena.c +++ b/ghc/rts/Arena.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - $Id: Arena.c,v 1.1 2001/10/18 14:41:01 simonmar Exp $ + $Id: Arena.c,v 1.4 2002/07/28 02:31:11 sof Exp $ (c) The University of Glasgow 2001 Arena allocation. Arenas provide fast memory allocation at the @@ -19,6 +19,7 @@ which most allocations are small. -------------------------------------------------------------------------- */ +#include #include "Rts.h" #include "RtsUtils.h" #include "BlockAlloc.h" @@ -60,8 +61,12 @@ arenaAlloc( Arena *arena, size_t size ) nat req_blocks; bdescr *bd; - // round up to word size... - size_w = (size + sizeof(W_) - 1) / sizeof(W_); +// The minimum alignment of an allocated block. +#define MIN_ALIGN 8 + + // size of allocated block in words, rounded up to the nearest + // alignment chunk. + size_w = ((size + MIN_ALIGN - 1) / MIN_ALIGN) * (MIN_ALIGN/sizeof(W_)); if ( arena->free + size_w < arena->lim ) { // enough room in the current block...