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] Tweaks to x86 call convention handling #88466

Merged
merged 1 commit into from
Jul 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/mono/mono/mini/interp/transform.c
Original file line number Diff line number Diff line change
Expand Up @@ -3787,10 +3787,20 @@ interp_transform_call (TransformData *td, MonoMethod *method, MonoMethod *target
if (native && !method->dynamic)
icall_sig = interp_get_icall_sig (csignature);
#endif
gboolean default_cconv = TRUE;
#ifdef TARGET_X86
#ifdef TARGET_WIN32
// Platform that we don't actively support ?
default_cconv = csignature->call_convention == MONO_CALL_C;
#else
default_cconv = csignature->call_convention == MONO_CALL_DEFAULT || csignature->call_convention == MONO_CALL_C;
#endif
#endif

// FIXME calli receives both the args offset and sometimes another arg for the frame pointer,
// therefore some args are in the param area, while the fp is not. We should differentiate for
// this, probably once we will have an explicit param area where we copy arguments.
if (icall_sig != MINT_ICALLSIG_MAX) {
if (icall_sig != MINT_ICALLSIG_MAX && default_cconv) {
interp_add_ins (td, MINT_CALLI_NAT_FAST);
interp_ins_set_dreg (td->last_ins, dreg);
interp_ins_set_sregs2 (td->last_ins, fp_sreg, MINT_CALL_ARGS_SREG);
Expand All @@ -3804,10 +3814,6 @@ interp_transform_call (TransformData *td, MonoMethod *method, MonoMethod *target
td->last_ins->data [0] = get_data_item_index (td, (void *)csignature);
} else if (native) {
interp_add_ins (td, MINT_CALLI_NAT);
#ifdef TARGET_X86
/* Windows not tested/supported yet */
g_assertf (csignature->call_convention == MONO_CALL_DEFAULT || csignature->call_convention == MONO_CALL_C, "Interpreter supports only cdecl pinvoke on x86");
#endif

InterpMethod *imethod = NULL;
/*
Expand Down
Loading