summaryrefslogtreecommitdiff
path: root/pthread_stop_world.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2022-01-17 23:51:47 +0300
committerIvan Maidanski <ivmai@mail.ru>2022-01-17 23:51:47 +0300
commit8c2f91a8065d9fb7b238d5c3709bc95dcc727566 (patch)
treeada5159396ddae00c8ad448457656f9617c78463 /pthread_stop_world.c
parentf2a2e55e4206529782cdad538adc260439cd9cd2 (diff)
downloadbdwgc-8c2f91a8065d9fb7b238d5c3709bc95dcc727566.tar.gz
Free E2K procedure stack in a single function
(refactoring) Issue #413 (bdwgc). * include/private/gc_priv.h [E2K] (GC_get_procedure_stack): Document that the function mgiht be called from a signal handler. * include/private/gc_priv.h [E2K] (GC_free_procedure_stack): New function prototype. * mach_dep.c [E2K] (GC_free_procedure_stack): Implement (just call free() for now). * mark_rts.c [!THREADS && !IA64 && E2K] (GC_push_current_stack): Call GC_free_procedure_stack() instead of free(). * pthread_stop_world.c [E2K] (GC_suspend_handler_inner): Likewise. * pthread_stop_world.c [E2K] (GC_push_all_stacks): Likewise. * pthread_support.c [E2K] (GC_do_blocking_inner, GC_call_with_gc_active): Likewise. * pthread_stop_world.c [E2K] (GC_push_all_stacks): Move stack_size local variable declaration to the innermost scope of its usage.
Diffstat (limited to 'pthread_stop_world.c')
-rw-r--r--pthread_stop_world.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/pthread_stop_world.c b/pthread_stop_world.c
index 941b92ed..a5a43ed4 100644
--- a/pthread_stop_world.c
+++ b/pthread_stop_world.c
@@ -402,7 +402,7 @@ STATIC void GC_suspend_handler_inner(ptr_t dummy GC_ATTR_UNUSED,
GC_log_printf("Continuing %p\n", (void *)self);
# endif
# ifdef E2K
- free(me -> backing_store_end);
+ GC_free_procedure_stack(me -> backing_store_end);
me -> backing_store_ptr = NULL;
me -> backing_store_end = NULL;
# endif
@@ -713,9 +713,6 @@ GC_INNER void GC_push_all_stacks(void)
# if defined(E2K) || defined(IA64)
/* We also need to scan the register backing store. */
ptr_t bs_lo, bs_hi;
-# ifdef E2K
- size_t stack_size;
-# endif
# endif
struct GC_traced_stack_sect_s *traced_stack_sect;
pthread_t self = pthread_self();
@@ -732,6 +729,10 @@ GC_INNER void GC_push_all_stacks(void)
++nthreads;
traced_stack_sect = p -> traced_stack_sect;
if (THREAD_EQUAL(p -> id, self)) {
+# ifdef E2K
+ size_t stack_size;
+# endif
+
GC_ASSERT(!p->thread_blocked);
# ifdef SPARC
lo = GC_save_regs_in_stack();
@@ -812,7 +813,7 @@ GC_INNER void GC_push_all_stacks(void)
# endif
# ifdef E2K
if (THREAD_EQUAL(p -> id, self))
- free(bs_lo);
+ GC_free_procedure_stack(bs_lo);
# endif
}
}