From fa72c754c513e1a681e3df59c87573af59656afd Mon Sep 17 00:00:00 2001 From: Zoltan Varga Date: Mon, 27 Jul 2020 20:20:28 -0400 Subject: [PATCH] [jit] Add a intrinsic for ThrowForUnsupportedVectorBaseType. (#39965) Part of https://github.com/dotnet/runtime/issues/38718. --- src/mono/mono/mini/intrinsics.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/mono/mono/mini/intrinsics.c b/src/mono/mono/mini/intrinsics.c index 6f6d93b..cf8bcc9 100644 --- a/src/mono/mono/mini/intrinsics.c +++ b/src/mono/mono/mini/intrinsics.c @@ -1948,6 +1948,34 @@ mini_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSign } } + if (in_corlib && + !strcmp ("System", cmethod_klass_name_space) && + !strcmp ("ThrowHelper", cmethod_klass_name) && + !strcmp ("ThrowForUnsupportedVectorBaseType", cmethod->name)) { + /* The mono JIT can't optimize the body of this method away */ + MonoGenericContext *ctx = mono_method_get_context (cmethod); + g_assert (ctx); + g_assert (ctx->method_inst); + + MonoType *t = ctx->method_inst->type_argv [0]; + switch (t->type) { + case MONO_TYPE_I1: + case MONO_TYPE_U1: + case MONO_TYPE_I2: + case MONO_TYPE_U2: + case MONO_TYPE_I4: + case MONO_TYPE_U4: + case MONO_TYPE_I8: + case MONO_TYPE_U8: + case MONO_TYPE_R4: + case MONO_TYPE_R8: + MONO_INST_NEW (cfg, ins, OP_NOP); + MONO_ADD_INS (cfg->cbb, ins); + return ins; + default: + break; + } + } #endif ins = mono_emit_native_types_intrinsics (cfg, cmethod, fsig, args); -- 2.7.4