Index: src/thread_native_suspend.c =================================================================== --- src/thread_native_suspend.c (revision 509753) +++ src/thread_native_suspend.c (working copy) @@ -53,36 +53,29 @@ * to denote a safe region of code. It may also call safe_point() method to denote a selected * point where safe suspension is possible. */ -void VMCALL hythread_suspend_enable() { - register hythread_t thread; - assert(!hythread_is_suspend_enabled()); +//RDG #ifdef FS14_TLS_USE - __asm { +void __declspec(naked) hythread_suspend_enable() { + assert(!hythread_is_suspend_enabled()); + __asm { mov eax, fs:[0x14] dec [eax]HyThread.suspend_disable_count - mov eax, [eax]HyThread.suspend_request - test eax, eax - jnz suspended - - } - return; + ret + } +} +#else +void VMCALL hythread_suspend_enable() { + register hythread_t thread; + assert(!hythread_is_suspend_enabled()); -suspended: thread=tm_self_tls; - -#else - thread=tm_self_tls; thread->suspend_disable_count--; - +} #endif - // if (!thread->suspend_request || thread->suspend_disable_count!=0) { - // return; - // } - - // hylatch_count_down(thread->safe_region_event); -} + + /** * Denotes the end of the code region where safe suspension was possible. * @@ -93,42 +86,54 @@ * to denote a safe region of code. It may also call safe_point() method to denote a selected * point where safe suspension is possible. */ -void VMCALL hythread_suspend_disable() +#ifdef FS14_TLS_USE +__declspec(naked) void hythread_suspend_disable() { - register hythread_t thread; #ifndef NDEBUG // Check that current thread is in default thread group. // Justification: GC suspends and enumerates threads from default group only. assert(tm_self_tls->group == TM_DEFAULT_GROUP); #endif -#ifdef FS14_TLS_USE __asm { - mov eax, fs:[0x14] - inc [eax]HyThread.suspend_disable_count - mov eax, [eax]HyThread.suspend_request + push ebp + mov ebp, esp + mov edx, fs:[0x14] + inc [edx]HyThread.suspend_disable_count + mov eax, [edx]HyThread.suspend_request test eax, eax - jnz suspended - + jz endpoint + mov ax, [edx]HyThread.suspend_disable_count + dec eax + test eax, eax + jnz endpoint + push edx + call thread_safe_point_impl + //pop edx +endpoint: + mov esp, ebp + pop ebp + ret } - return; - -suspended: - thread=tm_self_tls; - +} #else +void VMCALL hythread_suspend_disable(){ +#ifndef NDEBUG + // Check that current thread is in default thread group. + // Justification: GC suspends and enumerates threads from default group only. + assert(tm_self_tls->group == TM_DEFAULT_GROUP); +#endif + register hythread_t thread; thread=tm_self_tls; thread->suspend_disable_count++; -#endif - if (!thread->suspend_request || thread->suspend_disable_count!=1) { - return; - } - thread_safe_point_impl(thread); + if ((thread->suspend_request) & (thread->suspend_disable_count==1)) { + thread_safe_point_impl(thread); + } } +#endif - /** * Denotes a single point where safe suspension is possible. *