diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2022-02-02 01:12:43 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2022-02-04 00:29:23 +0300 |
commit | 73b67bab7ecc943abd2e3253a26127212442833a (patch) | |
tree | 75de90140f8c78edb5637ebb38a73e4bf74705d0 /mark_rts.c | |
parent | 6c8923eef141c0de98d369af5ab270caa7d51b67 (diff) | |
download | bdwgc-73b67bab7ecc943abd2e3253a26127212442833a.tar.gz |
Use mmap to allocate procedure stack buffers on E2K
(fix of commit 990dcdba1)
Issue #411 (bdwgc).
This commit prevents stack overflow in case of a big procedure stack
to be saved.
If a procedure stack requires less than 1 memory page for the buffer,
then the buffer is still allocated on the local stack.
* include/private/gc_priv.h [E2K] (PS_ALLOCA_BUF, ALLOCA_SAFE_LIMIT,
FREE_PROCEDURE_STACK_LOCAL): Define macro.
* include/private/gc_priv.h [E2K] (PROCEDURE_STACK_ALLOCA_AND_STORE):
Rename to GET_PROCEDURE_STACK_LOCAL; update comment; modify
implementation to call GC_mmap_procedure_stack_buf (and
GC_unmap_procedure_stack_buf) if size > ALLOCA_SAFE_LIMIT.
* include/private/gc_priv.h [E2K] (GC_mmap_procedure_stack_buf,
GC_unmap_procedure_stack_buf): Declare function.
* include/private/gc_priv.h [E2K && THREADS]
(GC_alloc_and_get_procedure_stack): Refine comment.
* mach_dep.c [E2K]: Include sys/mman.h.
* mach_dep.c [E2K] (GC_mmap_procedure_stack_buf,
GC_unmap_procedure_stack_buf): Implement.
* mark_rts.c [E2K && !THREADS] (GC_push_current_stack): Rename
PROCEDURE_STACK_ALLOCA_AND_STORE to GET_PROCEDURE_STACK_LOCAL; call
FREE_PROCEDURE_STACK_LOCAL() when bs_lo is not needed.
* pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL && E2K]
(GC_suspend_handler_inner, GC_push_all_stacks): Likewise.
Diffstat (limited to 'mark_rts.c')
-rw-r--r-- | mark_rts.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -840,10 +840,11 @@ STATIC void GC_push_current_stack(ptr_t cold_gc_frame, ptr_t bs_lo; size_t stack_size; - PROCEDURE_STACK_ALLOCA_AND_STORE(&bs_lo, &stack_size); + GET_PROCEDURE_STACK_LOCAL(&bs_lo, &stack_size); GC_push_all_register_sections(bs_lo, bs_lo + stack_size, TRUE /* eager */, GC_traced_stack_sect); + FREE_PROCEDURE_STACK_LOCAL(bs_lo, stack_size); } # endif # endif /* !THREADS */ |