30 lines
1.4 KiB
Diff
30 lines
1.4 KiB
Diff
|
From a73b8bacfcc5819926bc05173ab2f7850eb00da3 Mon Sep 17 00:00:00 2001
|
||
|
From: Ulrich Weigand <ulrich.weigand@de.ibm.com>
|
||
|
Date: Wed, 23 Aug 2023 21:11:37 +0200
|
||
|
Subject: [PATCH] [mono] Handle enum return type when inlining CreateInstance
|
||
|
|
||
|
Use underlying base type when deciding how to inline a
|
||
|
CreateInstance invocation in mini_emit_inst_for_method.
|
||
|
|
||
|
Fixes https://github.com/dotnet/runtime/issues/90292
|
||
|
(Mono abort causing .NET 8 msbuild regression).
|
||
|
---
|
||
|
src/mono/mono/mini/intrinsics.c | 4 +++-
|
||
|
1 file changed, 3 insertions(+), 1 deletion(-)
|
||
|
|
||
|
diff --git a/src/runtime/src/mono/mono/mini/intrinsics.c b/src/runtime/src/mono/mono/mini/intrinsics.c
|
||
|
index b1e5e76723147..ef77b7dc89f2e 100644
|
||
|
--- a/src/runtime/src/mono/mono/mini/intrinsics.c
|
||
|
+++ b//src/runtimesrc/mono/mono/mini/intrinsics.c
|
||
|
@@ -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;
|