diff --git a/src/mono/mono/mini/mini-wasm.c b/src/mono/mono/mini/mini-wasm.c index a0587570fe2bdf..55d9fceba4cbf2 100644 --- a/src/mono/mono/mini/mini-wasm.c +++ b/src/mono/mono/mini/mini-wasm.c @@ -798,7 +798,7 @@ mini_wasm_is_scalar_vtype (MonoType *type, MonoType **etype) } else if (MONO_TYPE_ISSTRUCT (t)) { if (!mini_wasm_is_scalar_vtype (t, etype)) return FALSE; - } else if (!((MONO_TYPE_IS_PRIMITIVE (t) || MONO_TYPE_IS_REFERENCE (t) || MONO_TYPE_IS_POINTER (t)))) { + } else if (!(MONO_TYPE_IS_PRIMITIVE (t) || MONO_TYPE_IS_REFERENCE (t) || MONO_TYPE_IS_POINTER (t))) { return FALSE; } else { if (etype) @@ -806,10 +806,12 @@ mini_wasm_is_scalar_vtype (MonoType *type, MonoType **etype) } } - if (etype) { - if (!(*etype)) - *etype = mono_get_int32_type (); + // empty struct + if (nfields == 0 && etype) { + *etype = m_class_get_byval_arg (mono_defaults.sbyte_class); } + g_assert (!etype || *etype); + return TRUE; }