Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/6.0-rc2] [MonoVM] Reduce P/Invoke GC transition asserts in release builds #59269

Merged
merged 4 commits into from
Sep 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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