Skip to content

Commit

Permalink
Repair merge damage
Browse files Browse the repository at this point in the history
  • Loading branch information
kg committed Nov 21, 2023
1 parent 6dd24f7 commit 86b5cdd
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 17 deletions.
8 changes: 4 additions & 4 deletions src/mono/mono/mini/aot-runtime-wasm.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

#ifdef HOST_WASM

MonoType *
mini_wasm_get_scalar_vtype (MonoType *type);
gboolean
mini_wasm_is_scalar_vtype (MonoType *type, MonoType **etype);

static char
type_to_c (MonoType *t)
Expand Down Expand Up @@ -61,8 +61,8 @@ type_to_c (MonoType *t)
// Any struct or union that recursively (including through nested structs, unions, and arrays)
// contains just a single scalar value and is not specified to have greater than natural alignment.
// FIXME: Handle the scenario where there are fields of struct types that contain no members
MonoType *scalar_vtype = mini_wasm_get_scalar_vtype (t);
if (scalar_vtype)
MonoType *scalar_vtype;
if (mini_wasm_is_scalar_vtype (t, &scalar_vtype))
return type_to_c (scalar_vtype);

return 'I';
Expand Down
4 changes: 2 additions & 2 deletions src/mono/mono/mini/interp/interp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1340,8 +1340,8 @@ filter_type_for_build_args_from_sig (MonoType *type)
#ifdef HOST_WASM
// If the parameter type is scalarized according to WASM C ABI, treat it as the
// scalarized type. Otherwise the MONO_TYPE_VALUETYPE case will treat it as int32.
MonoType *scalar = mini_wasm_get_scalar_vtype (type);
if (scalar)
MonoType *scalar;
if (mini_wasm_is_scalar_vtype (type, &scalar))
return scalar;
#endif

Expand Down
11 changes: 3 additions & 8 deletions src/mono/mono/mini/mini-wasm.c
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,6 @@ mono_wasm_get_debug_level (void)
gboolean
mini_wasm_is_scalar_vtype (MonoType *type, MonoType **etype)
{
MonoType *result = NULL;
MonoClass *klass;
MonoClassField *field;
gpointer iter;
Expand All @@ -752,7 +751,7 @@ mini_wasm_is_scalar_vtype (MonoType *type, MonoType **etype)
*etype = NULL;

if (!MONO_TYPE_ISSTRUCT (type))
return NULL;
return FALSE;
klass = mono_class_from_mono_type_internal (type);
mono_class_init_internal (klass);

Expand All @@ -767,12 +766,8 @@ mini_wasm_is_scalar_vtype (MonoType *type, MonoType **etype)
if (field->type->attrs & FIELD_ATTRIBUTE_STATIC)
continue;
nfields ++;
if (nfields > 1) {
/*
g_fprintf (stderr, "Struct %s has too many fields to be scalar vtype\n", m_class_get_name (klass));
*/
return NULL;
}
if (nfields > 1)
return FALSE;
MonoType *t = mini_get_underlying_type (field->type);
if (MONO_TYPE_ISSTRUCT (t)) {
if (!mini_wasm_is_scalar_vtype (t, etype))
Expand Down
3 changes: 0 additions & 3 deletions src/mono/mono/mini/mini-wasm.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,6 @@ void mono_wasm_main_thread_schedule_timer (void *timerHandler, int shortestDueTi

void mono_wasm_print_stack_trace (void);

MonoType *
mini_wasm_get_scalar_vtype (MonoType *type);

gboolean
mini_wasm_is_scalar_vtype (MonoType *type, MonoType **etype);

Expand Down

0 comments on commit 86b5cdd

Please sign in to comment.