diff --git a/src/mono/mono/metadata/marshal.c b/src/mono/mono/metadata/marshal.c index 0b5cdf06407980..0a9d8f8ff1abd0 100644 --- a/src/mono/mono/metadata/marshal.c +++ b/src/mono/mono/metadata/marshal.c @@ -3443,7 +3443,7 @@ mono_marshal_get_native_func_wrapper (MonoImage *image, MonoMethodSignature *sig MonoMethodPInvoke *piinfo, MonoMarshalSpec **mspecs, gpointer func) { MonoMethodSignature *csig; - + WrapperInfo *info; SignaturePointerPair key, *new_key; MonoMethodBuilder *mb; MonoMethod *res; @@ -3474,14 +3474,14 @@ mono_marshal_get_native_func_wrapper (MonoImage *image, MonoMethodSignature *sig new_key->sig = csig; new_key->pointer = func; - res = mono_mb_create_and_cache_full (cache, new_key, mb, csig, csig->param_count + 16, NULL, &found); + info = mono_wrapper_info_create (mb, WRAPPER_SUBTYPE_NATIVE_FUNC); + + res = mono_mb_create_and_cache_full (cache, new_key, mb, csig, csig->param_count + 16, info, &found); if (found) g_free (new_key); mono_mb_free (mb); - mono_marshal_set_wrapper_info (res, NULL); - return res; } diff --git a/src/mono/mono/metadata/marshal.h b/src/mono/mono/metadata/marshal.h index 08300a001efd59..d56f30e0f9d7bc 100644 --- a/src/mono/mono/metadata/marshal.h +++ b/src/mono/mono/metadata/marshal.h @@ -113,6 +113,7 @@ typedef enum { WRAPPER_SUBTYPE_RUNTIME_INVOKE_VIRTUAL, /* Subtypes of MONO_WRAPPER_MANAGED_TO_NATIVE */ WRAPPER_SUBTYPE_ICALL_WRAPPER, // specifically JIT icalls + WRAPPER_SUBTYPE_NATIVE_FUNC, WRAPPER_SUBTYPE_NATIVE_FUNC_AOT, WRAPPER_SUBTYPE_NATIVE_FUNC_INDIRECT, WRAPPER_SUBTYPE_PINVOKE, diff --git a/src/mono/mono/mini/aot-runtime.h b/src/mono/mono/mini/aot-runtime.h index af40e8bbb12f4e..dff55a92563faa 100644 --- a/src/mono/mono/mini/aot-runtime.h +++ b/src/mono/mono/mini/aot-runtime.h @@ -11,7 +11,7 @@ #include "mini.h" /* Version number of the AOT file format */ -#define MONO_AOT_FILE_VERSION 181 +#define MONO_AOT_FILE_VERSION 182 #define MONO_AOT_TRAMP_PAGE_SIZE 16384 diff --git a/src/mono/mono/mini/interp/transform.c b/src/mono/mono/mini/interp/transform.c index 0eed6c7146e012..a65b51b5df8d83 100644 --- a/src/mono/mono/mini/interp/transform.c +++ b/src/mono/mono/mini/interp/transform.c @@ -3458,9 +3458,8 @@ interp_transform_call (TransformData *td, MonoMethod *method, MonoMethod *target * every time based on the signature. */ if (method->wrapper_type == MONO_WRAPPER_MANAGED_TO_NATIVE) { - WrapperInfo *info = mono_marshal_get_wrapper_info (method); - if (info) { - MonoMethod *pinvoke_method = info->d.managed_to_native.method; + MonoMethod *pinvoke_method = mono_marshal_method_from_wrapper (method); + if (pinvoke_method) { imethod = mono_interp_get_imethod (pinvoke_method, error); return_val_if_nok (error, FALSE); }