Skip to content

Commit

Permalink
[mono] Handle enum return type when inlining CreateInstance
Browse files Browse the repository at this point in the history
Use underlying base type when deciding how to inline a
CreateInstance invocation in mini_emit_inst_for_method.

Fixes dotnet#90292
(Mono abort causing .NET 8 msbuild regression).
  • Loading branch information
uweigand committed Aug 23, 2023
1 parent 0b6fe08 commit a73b8ba
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/mono/mono/mini/intrinsics.c
Original file line number Diff line number Diff line change
Expand Up @@ -2079,7 +2079,9 @@ mini_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSign
MonoType *t = method_context->method_inst->type_argv [0];
MonoClass *arg0 = mono_class_from_mono_type_internal (t);
if (m_class_is_valuetype (arg0) && !mono_class_has_default_constructor (arg0, FALSE)) {
if (m_class_is_primitive (arg0)) {
if (m_class_is_primitive (arg0) || m_class_is_enumtype (arg0)) {
if (m_class_is_enumtype (arg0))
t = mono_class_enum_basetype_internal (arg0);
int dreg = alloc_dreg (cfg, mini_type_to_stack_type (cfg, t));
mini_emit_init_rvar (cfg, dreg, t);
ins = cfg->cbb->last_ins;
Expand Down

0 comments on commit a73b8ba

Please sign in to comment.