From 11367d77abc4e6d664c3e0ad656b73e262c91ffe Mon Sep 17 00:00:00 2001 From: Rodrigo Kumpera Date: Thu, 27 Aug 2015 15:10:10 -0400 Subject: [PATCH] [coop] Blacklist two more wrappers when generating safepoints. A GC Safepoint require the thread to be in GC unsafe mode to run properly. Both mono_threads_finish_blocking and mono_threads_reset_blocking_start are called in GC Safe mode, which would cause them to assert in checked-build. mono_threads_finish_blocking is called after a pinvoke finished, which means the thread will still be in blocking mode. mono_threads_reset_blocking_start is called by reverse pinvoke wrappers before calling managed code, so it will be in blocking mode too. This looks like something checked-build should catch by setting the polling variable more frequently. --- mono/mini/mini.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mono/mini/mini.c b/mono/mini/mini.c index 8bd3d9fd54b..607c627462d 100644 --- a/mono/mini/mini.c +++ b/mono/mini/mini.c @@ -3130,10 +3130,13 @@ mono_insert_safepoints (MonoCompile *cfg) if (cfg->method->wrapper_type == MONO_WRAPPER_MANAGED_TO_NATIVE) { WrapperInfo *info = mono_marshal_get_wrapper_info (cfg->method); - if (info && info->subtype == WRAPPER_SUBTYPE_ICALL_WRAPPER && info->d.icall.func == mono_thread_interruption_checkpoint) { + if (info && info->subtype == WRAPPER_SUBTYPE_ICALL_WRAPPER && + (info->d.icall.func == mono_thread_interruption_checkpoint || + info->d.icall.func == mono_threads_finish_blocking || + info->d.icall.func == mono_threads_reset_blocking_start)) { /* These wrappers are called from the wrapper for the polling function, leading to potential stack overflow */ if (cfg->verbose_level > 1) - printf ("SKIPPING SAFEPOINTS for the interruption checkpoint icall\n"); + printf ("SKIPPING SAFEPOINTS for wrapper %s\n", cfg->method->name); return; } } -- 2.25.1