Conversation
On x86 linux, double doesn't guarantee 8 byte alignment, which we need since all objects on the vt stack need to be 8 byte aligned. Use padding instead to achieve this.
This mainly consists of a trampoline that is used when calling from interp into native code, as well as the call convention logic that initializes the CallContext structure (which is passed to the trampoline). On other platforms we also have a single trampoline used when entering interpreter code. That trampoline works in a similar way and its purpose is to avoid compilation of all possible interp entry signatures, which is problematic on full aot scenarios. Given the interp x86 support is currently provided for android, we can avoid using that trampoline for now and use the per signature jit compiled interp_in_wrappers instead. The few disabled interp tests are the same as on amd64. We only support pinvoke into cdecl functions.
| #if SIZEOF_VOID_P == 4 | ||
| /* Align data field to MINT_VT_ALIGNMENT */ | ||
| gint32 pad; | ||
| #endif |
There was a problem hiding this comment.
I assume this is because double is 4 byte aligned on x86 ?
There was a problem hiding this comment.
yes. And mono_64bitaligned_t doesn't work. We probably get alignment correctly with it by chance
| void | ||
| mono_arch_set_native_call_context_args (CallContext *ccontext, gpointer frame, MonoMethodSignature *sig) | ||
| { | ||
| CallInfo *cinfo = get_call_info (NULL, sig); |
There was a problem hiding this comment.
Would be nice to add some kind of per-signature caching for this stuff, this looks very expensive.
There was a problem hiding this comment.
That is a pending optimization for a while now. This pinvoke path is only used when having weird signatures (like ones receiving value types), and we have fastpaths using do_icall for most common signatures (interp_icall_op_for_sig). Given these special signatures didn't really show up yet in a real application, the improvement still remains pending ...
|
@monojenkins build failed |
This mainly consists of a trampoline that is used when calling from interp into native code, as well as the call convention logic that initializes the CallContext structure (which is passed to the trampoline). On other platforms we also have a single trampoline used when entering interpreter code. That trampoline works in a similar way and its purpose is to avoid compilation of all possible interp entry signatures, which is problematic on full aot scenarios. Given the interp x86 support is currently provided for android, we can avoid using that trampoline for now and use the per signature jit compiled interp_in_wrappers instead.
The few disabled interp tests are the same as on amd64.
We only support pinvoke into cdecl functions.