Skip to content

Commit

Permalink
[jit] Add a intrinsic for ThrowForUnsupportedVectorBaseType<T>. (dotn…
Browse files Browse the repository at this point in the history
  • Loading branch information
vargaz authored and Jacksondr5 committed Aug 10, 2020
1 parent 3ced690 commit 7d405b9
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/mono/mono/mini/intrinsics.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7d405b9

Please sign in to comment.