File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change 16
16
# endif
17
17
18
18
# include < gc/gc_allocator.h>
19
+ # include < gc/gc_tiny_fl.h> // For GC_GRANULE_BYTES
19
20
20
21
# include < boost/coroutine2/coroutine.hpp>
21
22
# include < boost/coroutine2/protected_fixedsize_stack.hpp>
22
23
# include < boost/context/stack_context.hpp>
23
24
24
25
#endif
25
26
27
+ /*
28
+ * Ensure that Boehm satisfies our alignment requirements. This is the default configuration [^]
29
+ * and this assertion should never break for any platform. Let's assert it just in case.
30
+ *
31
+ * This alignment is particularly useful to be able to use aligned
32
+ * load/store instructions for loading/writing Values.
33
+ *
34
+ * [^]: https://github.com/bdwgc/bdwgc/blob/54ac18ccbc5a833dd7edaff94a10ab9b65044d61/include/gc/gc_tiny_fl.h#L31-L33
35
+ */
36
+ static_assert (sizeof (void *) * 2 == GC_GRANULE_BYTES, " Boehm GC must use GC_GRANULE_WORDS = 2" );
37
+
26
38
namespace nix {
27
39
28
40
#if NIX_USE_BOEHMGC
Original file line number Diff line number Diff line change @@ -369,7 +369,7 @@ namespace detail {
369
369
/* Whether to use a specialization of ValueStorage that does bitpacking into
370
370
alignment niches. */
371
371
template <std::size_t ptrSize>
372
- inline constexpr bool useBitPackedValueStorage = (ptrSize == 8 ) && (__STDCPP_DEFAULT_NEW_ALIGNMENT__ >= 8 );
372
+ inline constexpr bool useBitPackedValueStorage = (ptrSize == 8 ) && (__STDCPP_DEFAULT_NEW_ALIGNMENT__ >= 16 );
373
373
374
374
} // namespace detail
375
375
@@ -378,7 +378,8 @@ inline constexpr bool useBitPackedValueStorage = (ptrSize == 8) && (__STDCPP_DEF
378
378
* Packs discriminator bits into the pointer alignment niches.
379
379
*/
380
380
template <std::size_t ptrSize>
381
- class ValueStorage <ptrSize, std::enable_if_t <detail::useBitPackedValueStorage<ptrSize>>> : public detail::ValueBase
381
+ class alignas (16 ) ValueStorage<ptrSize, std::enable_if_t <detail::useBitPackedValueStorage<ptrSize>>>
382
+ : public detail::ValueBase
382
383
{
383
384
/* Needs a dependent type name in order for member functions (and
384
385
* potentially ill-formed bit casts) to be SFINAE'd out.
You can’t perform that action at this time.
0 commit comments