From 5c0a1faf8fc3c8e9d4596b31ac0fbc3173a1915e Mon Sep 17 00:00:00 2001 From: Zoltan Varga Date: Mon, 7 Jun 2021 04:23:05 -0400 Subject: [PATCH] [mono] Disable null checks in ghsaredvt wrappers, they are not needed, (#53775) and they take up a lot of space since these wrappers are very common. --- src/mono/mono/mini/mini.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mono/mono/mini/mini.c b/src/mono/mono/mini/mini.c index a8fb86c..3135f85 100644 --- a/src/mono/mono/mini/mini.c +++ b/src/mono/mono/mini/mini.c @@ -3213,6 +3213,12 @@ mini_method_compile (MonoMethod *method, guint32 opts, JitFlags flags, int parts if (cfg->compile_llvm) cfg->explicit_null_checks = TRUE; + if (cfg->explicit_null_checks && method->wrapper_type == MONO_WRAPPER_OTHER && + (mono_marshal_get_wrapper_info (method)->subtype == WRAPPER_SUBTYPE_GSHAREDVT_IN_SIG || + mono_marshal_get_wrapper_info (method)->subtype == WRAPPER_SUBTYPE_GSHAREDVT_OUT_SIG)) { + /* These wrappers contain loads/stores which can't fail */ + cfg->explicit_null_checks = FALSE; + } /* if (!mono_debug_count ()) -- 2.7.4