]> granicus.if.org Git - gc/commit
Add API functions to get and set the stack bottom of each thread
authorBrian J. Cardiff <bcardiff@gmail.com>
Mon, 6 May 2019 09:06:12 +0000 (12:06 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Mon, 6 May 2019 09:06:12 +0000 (12:06 +0300)
commit5668de71107022a316ee967162bc16c10754b9ce
tree7867c8c9a20e1a5f42c931fec5f431886e8318a8
parent757fcad526d4d1520142c4ab60f86902a36d0caf
Add API functions to get and set the stack bottom of each thread

Issue #277 (bdwgc).

This API is useful to support coroutines.

* include/gc.h (GC_get_my_stackbottom, GC_set_stackbottom): New API
function declaration.
* misc.c [!THREADS] (GC_set_stackbottom, GC_get_my_stackbottom): New
function definition.
* pthread_support.c [GC_PTHREADS && !GC_WIN32_THREADS]
(GC_set_stackbottom, GC_get_my_stackbottom): Likewise.
* win32_threads.c [GC_WIN32_THREADS] (GC_set_stackbottom,
GC_get_my_stackbottom): Likewise.
* tests/test.c (struct thr_hndl_sb_s): Define.
* tests/test.c (set_stackbottom): New function (which calls
GC_set_stackbottom).
* tests/test.c (run_one_test): Define thr_hndl_sb local variable;
call GC_get_my_stackbottom() and set_stackbottom().
* win32_threads.c [GC_WIN32_THREADS && I386] (struct GC_Thread_Rep):
Add initial_stack_base field.
* win32_threads.c [GC_WIN32_THREADS && I386] (GC_record_stack_base,
GC_call_with_gc_active): Set initial_stack_base field.
* win32_threads.c [GC_WIN32_THREADS && I386] (GC_push_stack_for): Handle
the case when GetThreadContext() might return stale register values,
thread stack_base != initial_stack_base but the stack is not inside
the TIB stack (use context.Esp but call WARN); add TODO.
include/gc.h
misc.c
pthread_support.c
tests/test.c
win32_threads.c