Skip to content

Commit

Permalink
[MonoVM] Reduce P/Invoke GC transition asserts in release builds (dot…
Browse files Browse the repository at this point in the history
  • Loading branch information
filipnavara authored Sep 16, 2021
1 parent b7b8ef8 commit 3904758
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/mono/mono/utils/mono-threads-coop.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,11 @@ coop_tls_pop (gpointer received_cookie)
static void
check_info (MonoThreadInfo *info, const gchar *action, const gchar *state, const char *func)
{
if (!info)
g_error ("%s Cannot %s GC %s region if the thread is not attached", func, action, state);
if (!mono_thread_info_is_current (info))
g_error ("%s [%p] Cannot %s GC %s region on a different thread", func, mono_thread_info_get_tid (info), action, state);
if (!mono_thread_info_is_live (info))
g_error ("%s [%p] Cannot %s GC %s region if the thread is not live", func, mono_thread_info_get_tid (info), action, state);
#ifdef ENABLE_CHECKED_BUILD
g_assertf (info, "%s Cannot %s GC %s region if the thread is not attached", func, action, state);
g_assertf (mono_thread_info_is_current (info), "%s [%p] Cannot %s GC %s region on a different thread", func, mono_thread_info_get_tid (info), action, state);
g_assertf (mono_thread_info_is_live (info), "%s [%p] Cannot %s GC %s region if the thread is not live", func, mono_thread_info_get_tid (info), action, state);
#endif
}

static int coop_reset_blocking_count;
Expand Down
2 changes: 2 additions & 0 deletions src/mono/mono/utils/mono-threads-state-machine.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ unwrap_thread_state (MonoThreadInfo* info,
static void
check_thread_state (MonoThreadInfo* info)
{
#ifdef ENABLE_CHECKED_BUILD
int raw_state, cur_state, suspend_count;
gboolean no_safepoints;
UNWRAP_THREAD_STATE (raw_state, cur_state, suspend_count, no_safepoints, info);
Expand Down Expand Up @@ -133,6 +134,7 @@ check_thread_state (MonoThreadInfo* info)
default:
g_error ("Invalid state %d", cur_state);
}
#endif
}

static void
Expand Down

0 comments on commit 3904758

Please sign in to comment.