From e686d8dc6cd67c35132059d0718d1501f0af1e67 Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Wed, 16 Apr 2008 23:24:33 +0000 Subject: [PATCH] pad step_workspace to 64 bytes, to speed up access to gct->steps[] --- includes/Rts.h | 6 ++++++ rts/sm/GC.c | 3 +++ rts/sm/GCThread.h | 6 +++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/includes/Rts.h b/includes/Rts.h index ec84ed9..1d455f0 100644 --- a/includes/Rts.h +++ b/includes/Rts.h @@ -38,6 +38,12 @@ extern "C" { #define FLEXIBLE_ARRAY 0 #endif +#if __GNUC__ >= 3 +#define ATTRIBUTE_ALIGNED(n) __attribute__((aligned(n))) +#else +#define ATTRIBUTE_ALIGNED(n) /*nothing*/ +#endif + /* Fix for mingw stat problem (done here so it's early enough) */ #ifdef mingw32_HOST_OS #define __MSVCRT__ 1 diff --git a/rts/sm/GC.c b/rts/sm/GC.c index 8bdea7d..2b6dbb7 100644 --- a/rts/sm/GC.c +++ b/rts/sm/GC.c @@ -203,6 +203,9 @@ GarbageCollect ( rtsBool force_major_gc ) } #endif + ASSERT(sizeof(step_workspace) == 16 * sizeof(StgWord)); + // otherwise adjust the padding in step_workspace. + // tell the stats department that we've started a GC stat_startGC(); diff --git a/rts/sm/GCThread.h b/rts/sm/GCThread.h index 8d171ae..338cca7 100644 --- a/rts/sm/GCThread.h +++ b/rts/sm/GCThread.h @@ -95,7 +95,11 @@ typedef struct step_workspace_ { bdescr * part_list; unsigned int n_part_blocks; // count of above -} step_workspace; + StgWord pad[5]; + +} step_workspace ATTRIBUTE_ALIGNED(64); +// align so that computing gct->steps[n] is a shift, not a multiply +// fails if the size is <64, which is why we need the pad above /* ---------------------------------------------------------------------------- GC thread object -- 1.7.10.4