diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2021-09-21 23:43:26 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-21 23:43:26 +0300 |
commit | e23bcf2401a6c231a9ff960b4055cdf3f9a78648 (patch) | |
tree | 3f11256c55bd4ec1dc8ff6ffaab3cc0c18df2aa4 /src/mono | |
parent | 8e3a1fbb503a27f485029cee00d91e465a5472f5 (diff) |
[release/6.0-rc2] [MonoVM] Reduce P/Invoke GC transition asserts in release builds (#59269)
Backport of #59029
Profiling shows that large part of the GC transition overhead (~30%) in #58939 is caused by assert-style checks. Disabling them seems to be the best bang-for-the-buck option for reducing the overhead without fundamental changes to the code.
Co-authored-by: Filip Navara <navara@emclient.com>
Diffstat (limited to 'src/mono')
-rw-r--r-- | src/mono/mono/utils/mono-threads-coop.c | 11 | ||||
-rw-r--r-- | src/mono/mono/utils/mono-threads-state-machine.c | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/src/mono/mono/utils/mono-threads-coop.c b/src/mono/mono/utils/mono-threads-coop.c index 44d1ee8681d..970a7099e9e 100644 --- a/src/mono/mono/utils/mono-threads-coop.c +++ b/src/mono/mono/utils/mono-threads-coop.c @@ -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; diff --git a/src/mono/mono/utils/mono-threads-state-machine.c b/src/mono/mono/utils/mono-threads-state-machine.c index 2d9a06cd76f..927d86d619f 100644 --- a/src/mono/mono/utils/mono-threads-state-machine.c +++ b/src/mono/mono/utils/mono-threads-state-machine.c @@ -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); @@ -133,6 +134,7 @@ check_thread_state (MonoThreadInfo* info) default: g_error ("Invalid state %d", cur_state); } +#endif } static void |