Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mono][interp] Fix arg alignment issues when mixing with compiled code #85153

Merged
merged 10 commits into from
May 8, 2023
71 changes: 11 additions & 60 deletions src/mono/mono/mini/interp/interp-internals.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,12 @@ mono_interp_jit_call_supported (MonoMethod *method, MonoMethodSignature *sig);
void
mono_interp_error_cleanup (MonoError *error);

int
mono_mint_type (MonoType *type);

int
mono_interp_type_size (MonoType *type, int mt, int *align_p);

#if HOST_BROWSER

gboolean
Expand All @@ -333,12 +339,15 @@ mono_jiterp_overflow_check_u4 (guint32 lhs, guint32 rhs, int opcode);
void
mono_jiterp_ld_delegate_method_ptr (gpointer *destination, MonoDelegate **source);

int
void
mono_jiterp_stackval_to_data (MonoType *type, stackval *val, void *data);

int
void
mono_jiterp_stackval_from_data (MonoType *type, stackval *result, const void *data);

int
mono_jiterp_get_arg_offset (InterpMethod *imethod, MonoMethodSignature *sig, int index);

gpointer
mono_jiterp_frame_data_allocator_alloc (FrameDataAllocator *stack, InterpFrame *frame, int size);

Expand All @@ -350,62 +359,4 @@ mono_jiterp_get_simd_opcode (int arity, int index);

#endif

static inline int
mint_type(MonoType *type)
{
if (m_type_is_byref (type))
return MINT_TYPE_I;
enum_type:
switch (type->type) {
case MONO_TYPE_I1:
return MINT_TYPE_I1;
case MONO_TYPE_U1:
case MONO_TYPE_BOOLEAN:
return MINT_TYPE_U1;
case MONO_TYPE_I2:
return MINT_TYPE_I2;
case MONO_TYPE_U2:
case MONO_TYPE_CHAR:
return MINT_TYPE_U2;
case MONO_TYPE_I4:
case MONO_TYPE_U4:
return MINT_TYPE_I4;
case MONO_TYPE_I:
case MONO_TYPE_U:
case MONO_TYPE_PTR:
case MONO_TYPE_FNPTR:
return MINT_TYPE_I;
case MONO_TYPE_R4:
return MINT_TYPE_R4;
case MONO_TYPE_I8:
case MONO_TYPE_U8:
return MINT_TYPE_I8;
case MONO_TYPE_R8:
return MINT_TYPE_R8;
case MONO_TYPE_STRING:
case MONO_TYPE_SZARRAY:
case MONO_TYPE_CLASS:
case MONO_TYPE_OBJECT:
case MONO_TYPE_ARRAY:
return MINT_TYPE_O;
case MONO_TYPE_VALUETYPE:
if (m_class_is_enumtype (type->data.klass)) {
type = mono_class_enum_basetype_internal (type->data.klass);
goto enum_type;
} else
return MINT_TYPE_VT;
case MONO_TYPE_TYPEDBYREF:
return MINT_TYPE_VT;
case MONO_TYPE_GENERICINST:
type = m_class_get_byval_arg (type->data.generic_class->container_class);
goto enum_type;
case MONO_TYPE_VOID:
return MINT_TYPE_VOID;
default:
g_warning ("got type 0x%02x", type->type);
g_assert_not_reached ();
}
return -1;
}

#endif /* __MONO_MINI_INTERPRETER_INTERNALS_H__ */
Loading