Skip to content

Commit 0ce54a5

Browse files
pavelsavaralewing
andauthored
[wasm][AOT] fix codegen for small structs on stack (#118355)
* fix * testing Larry's feedback * another attempt * more * Update src/mono/mono/mini/mini-wasm.c Co-authored-by: Larry Ewing <[email protected]> --------- Co-authored-by: Larry Ewing <[email protected]>
1 parent 1dd74ea commit 0ce54a5

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/mono/mono/mini/mini-wasm.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -799,18 +799,20 @@ mini_wasm_is_scalar_vtype (MonoType *type, MonoType **etype)
799799
} else if (MONO_TYPE_ISSTRUCT (t)) {
800800
if (!mini_wasm_is_scalar_vtype (t, etype))
801801
return FALSE;
802-
} else if (!((MONO_TYPE_IS_PRIMITIVE (t) || MONO_TYPE_IS_REFERENCE (t) || MONO_TYPE_IS_POINTER (t)))) {
802+
} else if (!(MONO_TYPE_IS_PRIMITIVE (t) || MONO_TYPE_IS_REFERENCE (t) || MONO_TYPE_IS_POINTER (t))) {
803803
return FALSE;
804804
} else {
805805
if (etype)
806806
*etype = t;
807807
}
808808
}
809809

810-
if (etype) {
811-
if (!(*etype))
812-
*etype = mono_get_int32_type ();
810+
// empty struct
811+
if (nfields == 0 && etype) {
812+
*etype = m_class_get_byval_arg (mono_defaults.sbyte_class);
813813
}
814814

815+
g_assert (!etype || *etype);
816+
815817
return TRUE;
816818
}

0 commit comments

Comments
 (0)