[commit: ghc] master: rts: Align the_gc_thread to 64 bytes (68a1fc2)

git at git.haskell.org git at git.haskell.org
Tue Aug 21 22:57:59 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/68a1fc29b4bb3eae54e4d96c9aec20e700040f34/ghc

>---------------------------------------------------------------

commit 68a1fc29b4bb3eae54e4d96c9aec20e700040f34
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Tue Aug 21 16:06:12 2018 -0400

    rts: Align the_gc_thread to 64 bytes
    
    In a previous attempt (c6cc93bca69abc258513af8cf2370b14e70fd8fb) I had
    tried aligning to 8 bytes under the assumption that the problem was that
    the_gc_thread, a StgWord8[], wasn't being aligned to 8-bytes as the
    gc_thread struct would expect. However, we actually need even stronger
    alignment due to the alignment attribute attached to gen_workspace,
    which claims it should be aligned to a 64-byte boundary.
    
    This fixes #15482.
    
    Reviewers: erikd, simonmar
    
    Reviewed By: simonmar
    
    Subscribers: rwbarton, carter
    
    GHC Trac Issues: #15482
    
    Differential Revision: https://phabricator.haskell.org/D5052


>---------------------------------------------------------------

68a1fc29b4bb3eae54e4d96c9aec20e700040f34
 rts/sm/GC.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/rts/sm/GC.c b/rts/sm/GC.c
index 742ae36..90857ab 100644
--- a/rts/sm/GC.c
+++ b/rts/sm/GC.c
@@ -128,7 +128,9 @@ uint32_t mutlist_MUTVARS,
 gc_thread **gc_threads = NULL;
 
 #if !defined(THREADED_RTS)
-StgWord8 the_gc_thread[sizeof(gc_thread) + 64 * sizeof(gen_workspace)];
+// Must be aligned to 64-bytes to meet stated 64-byte alignment of gen_workspace
+StgWord8 the_gc_thread[sizeof(gc_thread) + 64 * sizeof(gen_workspace)]
+    ATTRIBUTE_ALIGNED(64);
 #endif
 
 // Number of threads running in *this* GC.  Affects how many



More information about the ghc-commits mailing list