diff options
author | Ben Gamari <ben@smart-cactus.org> | 2021-07-12 20:33:16 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-07-27 04:47:51 -0400 |
commit | f6e366c058b136f0789a42222b8189510a3693d1 (patch) | |
tree | f62d8706954e40fa6f40d3271f92ae84aeeff7cc /rts | |
parent | 0e875c3f1d7373812ddae9962edfc9538465d2ed (diff) | |
download | haskell-f6e366c058b136f0789a42222b8189510a3693d1.tar.gz |
rts: Drop allocateExec and friends
All uses of these now use ExecPage.
Diffstat (limited to 'rts')
-rw-r--r-- | rts/RtsSymbols.c | 11 | ||||
-rw-r--r-- | rts/sm/Storage.c | 92 |
2 files changed, 0 insertions, 103 deletions
diff --git a/rts/RtsSymbols.c b/rts/RtsSymbols.c index 170655a48c..678527e328 100644 --- a/rts/RtsSymbols.c +++ b/rts/RtsSymbols.c @@ -548,21 +548,11 @@ #define RTS_PROF_SYMBOLS /* empty */ #endif -#if RTS_LINKER_USE_MMAP -#define RTS_LINKER_USE_MMAP_SYMBOLS \ - SymI_HasProto(allocateWrite) \ - SymI_HasProto(freeWrite) \ - SymI_HasProto(markExec) -#else -#define RTS_LINKER_USE_MMAP_SYMBOLS /* empty */ -#endif - #define RTS_SYMBOLS \ Maybe_Stable_Names \ RTS_TICKY_SYMBOLS \ RTS_PROF_SYMBOLS \ RTS_LIBDW_SYMBOLS \ - RTS_LINKER_USE_MMAP_SYMBOLS \ SymI_HasProto(StgReturn) \ SymI_HasProto(stg_gc_noregs) \ SymI_HasProto(stg_ret_v_info) \ @@ -1020,7 +1010,6 @@ SymI_HasProto(registerInfoProvList) \ SymI_HasProto(lookupIPE) \ RTS_USER_SIGNALS_SYMBOLS \ - RTS_LINKER_USE_MMAP_SYMBOLS \ RTS_INTCHAR_SYMBOLS diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c index fd55570354..7d450a8931 100644 --- a/rts/sm/Storage.c +++ b/rts/sm/Storage.c @@ -1807,98 +1807,6 @@ void flushExec (W_ len, AdjustorExecutable exec_addr) #endif } -#if RTS_LINKER_USE_MMAP -AdjustorWritable allocateWrite(W_ bytes) { - return mmapForLinker(bytes, PROT_READ | PROT_WRITE, MAP_ANONYMOUS, -1, 0); -} - -void markExec(W_ bytes, AdjustorWritable writ) { - mmapForLinkerMarkExecutable(writ, bytes); -} - -void freeWrite(W_ bytes, AdjustorWritable writ) { - munmap(writ, bytes); -} -#endif /* RTS_LINKER_USE_MMAP */ - -#if !defined(USE_LIBFFI_FOR_ADJUSTORS) - -AdjustorWritable allocateExec (W_ bytes, AdjustorExecutable *exec_ret) -{ - void *ret; - W_ n; - - ACQUIRE_SM_LOCK; - - // round up to words. - n = (bytes + sizeof(W_) + 1) / sizeof(W_); - - if (n+1 > BLOCK_SIZE_W) { - barf("allocateExec: can't handle large objects"); - } - - if (exec_block == NULL || - exec_block->free + n + 1 > exec_block->start + BLOCK_SIZE_W) { - bdescr *bd; - W_ pagesize = getPageSize(); - bd = allocGroup(stg_max(1, pagesize / BLOCK_SIZE)); - debugTrace(DEBUG_gc, "allocate exec block %p", bd->start); - bd->gen_no = 0; - bd->flags = BF_EXEC; - bd->link = exec_block; - if (exec_block != NULL) { - exec_block->u.back = bd; - } - bd->u.back = NULL; - setExecutable(bd->start, bd->blocks * BLOCK_SIZE, true); - exec_block = bd; - } - *(exec_block->free) = n; // store the size of this chunk - exec_block->gen_no += n; // gen_no stores the number of words allocated - ret = exec_block->free + 1; - exec_block->free += n + 1; - - RELEASE_SM_LOCK - *exec_ret = ret; - return ret; -} - -void freeExec (void *addr) -{ - StgPtr p = (StgPtr)addr - 1; - bdescr *bd = Bdescr((StgPtr)p); - - if ((bd->flags & BF_EXEC) == 0) { - barf("freeExec: not executable"); - } - - if (*(StgPtr)p == 0) { - barf("freeExec: already free?"); - } - - ACQUIRE_SM_LOCK; - - bd->gen_no -= *(StgPtr)p; - *(StgPtr)p = 0; - - if (bd->gen_no == 0) { - // Free the block if it is empty, but not if it is the block at - // the head of the queue. - if (bd != exec_block) { - debugTrace(DEBUG_gc, "free exec block %p", bd->start); - dbl_link_remove(bd, &exec_block); - setExecutable(bd->start, bd->blocks * BLOCK_SIZE, false); - freeGroup(bd); - } else { - bd->free = bd->start; - } - } - - RELEASE_SM_LOCK -} - -#endif /* switch(HOST_OS) */ - #if defined(DEBUG) // handy function for use in gdb, because Bdescr() is inlined. |