X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmini%2Ftasklets.c;h=cdd2117aceacf51710bc8067e646a91657e0144c;hb=b273a6b2b560f8c6d5b975be86827064a140a3ea;hp=2c0bf5e37aaed46933c860ef479d387159fc5962;hpb=e7951e6ee0786855af92d677d5fb20fe14f5ecdf;p=mono.git diff --git a/mono/mini/tasklets.c b/mono/mini/tasklets.c index 2c0bf5e37aa..cdd2117acea 100644 --- a/mono/mini/tasklets.c +++ b/mono/mini/tasklets.c @@ -8,10 +8,10 @@ #if defined(MONO_SUPPORT_TASKLETS) /* keepalive_stacks could be a per-stack var to avoid locking overhead */ -static MonoGHashTable *keepalive_stacks = NULL; -static CRITICAL_SECTION tasklets_mutex; -#define tasklets_lock() EnterCriticalSection(&tasklets_mutex) -#define tasklets_unlock() LeaveCriticalSection(&tasklets_mutex) +static MonoGHashTable *keepalive_stacks; +static mono_mutex_t tasklets_mutex; +#define tasklets_lock() mono_mutex_lock(&tasklets_mutex) +#define tasklets_unlock() mono_mutex_unlock(&tasklets_mutex) /* LOCKING: tasklets_mutex is assumed to e taken */ static void @@ -19,8 +19,8 @@ internal_init (void) { if (keepalive_stacks) return; - MONO_GC_REGISTER_ROOT (keepalive_stacks); - keepalive_stacks = mono_g_hash_table_new (NULL, NULL); + MONO_GC_REGISTER_ROOT_PINNING (keepalive_stacks); + keepalive_stacks = mono_g_hash_table_new_type (NULL, NULL, MONO_HASH_CONSERVATIVE_GC); } static void* @@ -69,12 +69,12 @@ continuation_mark_frame (MonoContinuation *cont) ctx = new_ctx; if (endloop) break; - if (strcmp (ji->method->name, "Mark") == 0) + if (!ji->is_trampoline && strcmp (jinfo_get_method (ji)->name, "Mark") == 0) endloop = TRUE; } while (1); cont->top_sp = MONO_CONTEXT_GET_SP (&ctx); - /*g_print ("method: %s, sp: %p\n", ji->method->name, cont->top_sp);*/ + /*g_print ("method: %s, sp: %p\n", jinfo_get_method (ji)->name, cont->top_sp);*/ return NULL; } @@ -95,7 +95,7 @@ continuation_store (MonoContinuation *cont, int state, MonoException **e) } cont->lmf = lmf; - cont->return_ip = __builtin_return_address (0); + cont->return_ip = __builtin_extract_return_addr (__builtin_return_address (0)); cont->return_sp = __builtin_frame_address (0); num_bytes = (char*)cont->top_sp - (char*)cont->return_sp; @@ -106,8 +106,8 @@ continuation_store (MonoContinuation *cont, int state, MonoException **e) /* clear to avoid GC retention */ if (num_bytes < cont->stack_used_size) { memset ((char*)cont->saved_stack + num_bytes, 0, cont->stack_used_size - num_bytes); - cont->stack_used_size = num_bytes; } + cont->stack_used_size = num_bytes; } else { tasklets_lock (); internal_init (); @@ -146,7 +146,7 @@ continuation_restore (MonoContinuation *cont, int state) void mono_tasklets_init (void) { - InitializeCriticalSection (&tasklets_mutex); + mono_mutex_init_recursive (&tasklets_mutex); mono_add_internal_call ("Mono.Tasklets.Continuation::alloc", continuation_alloc); mono_add_internal_call ("Mono.Tasklets.Continuation::free", continuation_free);