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/sm | |
parent | 0e875c3f1d7373812ddae9962edfc9538465d2ed (diff) | |
download | haskell-f6e366c058b136f0789a42222b8189510a3693d1.tar.gz |
rts: Drop allocateExec and friends
All uses of these now use ExecPage.
Diffstat (limited to 'rts/sm')
-rw-r--r-- | rts/sm/Storage.c | 92 |
1 files changed, 0 insertions, 92 deletions
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. |