[commit: ghc] simd: Make sure the allocator aligns memory on a 16-byte boundary. (08ba8f7)
Johan Tibell
johan.tibell at gmail.com
Tue Nov 1 18:32:49 CET 2011
Is this going into 7.4? Does this mean all heap objects now use 4 words
(e.g. Int is now twice as big)?
On Tue, Nov 1, 2011 at 10:22 AM, Geoffrey Mainlain <gmainlan at galois.com>wrote:
> Repository : ssh://darcs.haskell.org//srv/darcs/ghc
>
> On branch : simd
>
>
> http://hackage.haskell.org/trac/ghc/changeset/08ba8f79c36d18598cd966b1f70c20575087fb32
>
> >---------------------------------------------------------------
>
> commit 08ba8f79c36d18598cd966b1f70c20575087fb32
> Author: Geoffrey Mainland <gmainlan at microsoft.com>
> Date: Mon Oct 31 13:57:09 2011 +0000
>
> Make sure the allocator aligns memory on a 16-byte boundary.
>
> >---------------------------------------------------------------
>
> includes/rts/storage/Closures.h | 2 ++
> rts/sm/Storage.c | 13 +++++++++++++
> 2 files changed, 15 insertions(+), 0 deletions(-)
>
> diff --git a/includes/rts/storage/Closures.h
> b/includes/rts/storage/Closures.h
> index 5f4f035..c65d7da 100644
> --- a/includes/rts/storage/Closures.h
> +++ b/includes/rts/storage/Closures.h
> @@ -138,6 +138,8 @@ typedef struct StgBlockingQueue_ {
> typedef struct {
> StgHeader header;
> StgWord bytes;
> + StgWord dummy1;
> + StgWord dummy2;
> StgWord payload[FLEXIBLE_ARRAY];
> } StgArrWords;
>
> diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c
> index 82e89a5..7d4526d 100644
> --- a/rts/sm/Storage.c
> +++ b/rts/sm/Storage.c
> @@ -601,12 +601,25 @@ move_STACK (StgStack *src, StgStack *dest)
> Hp/HpLim).
>
> --------------------------------------------------------------------------
> */
>
> +/*
> + * This is a terrible hack to guarantee that *all* allocated objects are
> aligned
> + * on a 4-word boundary so we can use aligned SSE instructions. We can't
> just
> + * align some objects, because when the GC runs and compresses the heap,
> they
> + * could end up non-aligned.
> + */
> +#define ALIGN_WORDS 4
> +#define ALIGN_MASK (ALIGN_WORDS-1)
> +
> +#define ALIGN_ROUND_UP(n) (((n)+ALIGN_WORDS-1) & ~ALIGN_MASK)
> +
> StgPtr
> allocate (Capability *cap, lnat n)
> {
> bdescr *bd;
> StgPtr p;
>
> + n = ALIGN_ROUND_UP(n);
> +
> if (n >= LARGE_OBJECT_THRESHOLD/sizeof(W_)) {
> lnat req_blocks = (lnat)BLOCK_ROUND_UP(n*sizeof(W_)) / BLOCK_SIZE;
>
>
>
>
> _______________________________________________
> Cvs-ghc mailing list
> Cvs-ghc at haskell.org
> http://www.haskell.org/mailman/listinfo/cvs-ghc
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/cvs-ghc/attachments/20111101/2620312f/attachment.htm>
More information about the Cvs-ghc
mailing list