rts: Align the_gc_thread to 64 bytes
authorBen Gamari <bgamari.foss@gmail.com>
Tue, 21 Aug 2018 20:06:12 +0000 (16:06 -0400)
committerBen Gamari <ben@smart-cactus.org>
Tue, 21 Aug 2018 23:03:43 +0000 (19:03 -0400)
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

(cherry picked from commit 68a1fc29b4bb3eae54e4d96c9aec20e700040f34)

rts/sm/GC.c

index 67eba93..aeb0c8a 100644 (file)
@@ -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