static void
jit_info_table_free (MonoJitInfoTable *table, gboolean duplicate)
{
+ MONO_REQ_GC_UNSAFE_MODE;
+
int i;
int num_chunks = table->num_chunks;
MonoDomain *domain = table->domain;
static void
conc_table_free (gpointer ptr)
{
+ MONO_REQ_GC_UNSAFE_MODE;
+
conc_table *table = (conc_table *)ptr;
if (table->gc_type & MONO_HASH_KEY_GC)
mono_gc_deregister_root ((char*)table->keys);
g_assert (mono_thread_info_is_current (info));
g_assert (mono_thread_info_is_live (info));
+ /* We only enter the GC unsafe region, as when exiting this function, the thread
+ * will be detached, and the current MonoThreadInfo* will be destroyed. */
+ mono_threads_enter_gc_unsafe_region_unbalanced_with_info (info, &gc_unsafe_stackdata);
+
+ /* Need to be in GC Unsafe to pump the HP queue - some of the cleanup
+ * methods need to use coop-aware locks. For example: jit_info_table_free_duplicate.
+ */
+
/* Pump the HP queue while the thread is alive.*/
mono_thread_hazardous_try_free_some ();
small_id = info->small_id;
- /* We only enter the GC unsafe region, as when exiting this function, the thread
- * will be detached, and the current MonoThreadInfo* will be destroyed. */
- mono_threads_enter_gc_unsafe_region_unbalanced_with_info (info, &gc_unsafe_stackdata);
-
THREADS_DEBUG ("unregistering info %p\n", info);
mono_native_tls_set_value (thread_exited_key, GUINT_TO_POINTER (1));