diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2019-09-10 11:09:42 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2019-09-10 18:32:05 +0300 |
commit | e5321a993a768ba78edc2fd39387edb360480c83 (patch) | |
tree | 162bb06a01f6dbce3b19f46cc82ab0ef36767662 /win32_threads.c | |
parent | 912ec408d9acd4adc529f202cd67fde0ab5e23a7 (diff) | |
download | bdwgc-e5321a993a768ba78edc2fd39387edb360480c83.tar.gz |
Replace push_one calls with push_many_regs one for Win32 thread context
(code refactoring)
Also, do not define GC_push_one except for Darwin (and some ancient
targets that use the function).
* include/private/gc_priv.h [MSWIN32 || MSWINCE] (GC_push_one): Do not
declare.
* include/private/gc_priv.h [!MSWIN32 && !MSWINCE] (GC_push_one):
Declare only if AMIGA or MACOS or GC_DARWIN_THREADS.
* include/private/gc_priv.h [GC_WIN32_THREADS] (GC_push_many_regs):
Declare function; add comment.
* mark.c (GC_push_one): Define only if AMIGA or MACOS or
GC_DARWIN_THREADS.
* mark.c [GC_WIN32_THREADS] (GC_push_many_regs): New GC_INNER function.
* win32_threads.c (GC_push_stack_for): Remove i local variable; call
GC_push_many_regs() instead of a loop with GC_push_one() calls (ignore
2 first registers if WOW64_THREAD_CONTEXT_WORKAROUND).
Diffstat (limited to 'win32_threads.c')
-rw-r--r-- | win32_threads.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/win32_threads.c b/win32_threads.c index 10bf6511..5a35e70d 100644 --- a/win32_threads.c +++ b/win32_threads.c @@ -1585,7 +1585,6 @@ STATIC word GC_push_stack_for(GC_thread thread, DWORD me) sp = GC_approx_sp(); } else if ((sp = thread -> thread_blocked_sp) == NULL) { /* Use saved sp value for blocked threads. */ - int i = 0; # ifdef RETRY_GET_THREAD_CONTEXT /* We cache context when suspending the thread since it may */ /* require looping. */ @@ -1605,13 +1604,12 @@ STATIC word GC_push_stack_for(GC_thread thread, DWORD me) } # endif -# ifdef WOW64_THREAD_CONTEXT_WORKAROUND - i += 2; /* skip ContextFlags and SegFs */ -# endif - for (; i < PUSHED_REGS_COUNT; i++) - GC_push_one(regs[i]); +# ifndef WOW64_THREAD_CONTEXT_WORKAROUND + GC_push_many_regs(regs, PUSHED_REGS_COUNT); +# else + GC_push_many_regs(regs + 2, PUSHED_REGS_COUNT - 2); + /* skip ContextFlags and SegFs */ -# ifdef WOW64_THREAD_CONTEXT_WORKAROUND /* WoW64 workaround. */ if (isWow64) { DWORD ContextFlags = (DWORD)regs[0]; |