diff options
author | Ben Gamari <ben@smart-cactus.org> | 2019-10-28 13:37:39 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2019-10-30 21:47:05 -0400 |
commit | 4ac51fb9d7ac9120adee88aeb510973d47017e93 (patch) | |
tree | e7468d5861aefcab85fc0dfd2119f3be6a0f9d6d /rts/linker/M32Alloc.h | |
parent | 5f7b29694f4658519f09cbfcaafcadce6a0a1cc7 (diff) | |
download | haskell-wip/linker-per-oc-m32.tar.gz |
rts: Make m32 allocator per-ObjectCodewip/linker-per-oc-m32
MacOS Catalina is finally going to force our hand in forbidden writable
exeutable mappings. Unfortunately, this is quite incompatible with the
current global m32 allocator, which mixes symbols from various objects
in a single page. The problem here is that some of these symbols may not
yet be resolved (e.g. had relocations performed) as this happens lazily
(and therefore we can't yet make the section read-only and therefore
executable).
The easiest way around this is to simply create one m32 allocator per
ObjectCode. This may slightly increase fragmentation for short-running
programs but I suspect will actually improve fragmentation for programs
doing lots of loading/unloading since we can always free all of the
pages allocated to an object when it is unloaded (although this ability
will only be implemented in a later patch).
Diffstat (limited to 'rts/linker/M32Alloc.h')
-rw-r--r-- | rts/linker/M32Alloc.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/rts/linker/M32Alloc.h b/rts/linker/M32Alloc.h index 645f6b2422..8af9235921 100644 --- a/rts/linker/M32Alloc.h +++ b/rts/linker/M32Alloc.h @@ -26,12 +26,17 @@ #define M32_NO_RETURN GNUC3_ATTRIBUTE(__noreturn__) #endif -void m32_allocator_init(void) M32_NO_RETURN; +struct m32_allocator_t; +typedef struct m32_allocator_t m32_allocator; -void m32_allocator_flush(void) M32_NO_RETURN; +m32_allocator *m32_allocator_new(void) M32_NO_RETURN; + +void m32_allocator_free(m32_allocator *alloc) M32_NO_RETURN; + +void m32_allocator_flush(m32_allocator *alloc) M32_NO_RETURN; void m32_free(void *addr, size_t size) M32_NO_RETURN; -void * m32_alloc(size_t size, size_t alignment) M32_NO_RETURN; +void * m32_alloc(m32_allocator *alloc, size_t size, size_t alignment) M32_NO_RETURN; #include "EndPrivate.h" |