Skip to content

Commit f77648e

Browse files
committed
[mono] Add wrapper info for native func wrappers.
Fixes #55567.
1 parent 69d6739 commit f77648e

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

src/mono/mono/metadata/marshal.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3443,7 +3443,7 @@ mono_marshal_get_native_func_wrapper (MonoImage *image, MonoMethodSignature *sig
34433443
MonoMethodPInvoke *piinfo, MonoMarshalSpec **mspecs, gpointer func)
34443444
{
34453445
MonoMethodSignature *csig;
3446-
3446+
WrapperInfo *info;
34473447
SignaturePointerPair key, *new_key;
34483448
MonoMethodBuilder *mb;
34493449
MonoMethod *res;
@@ -3474,14 +3474,14 @@ mono_marshal_get_native_func_wrapper (MonoImage *image, MonoMethodSignature *sig
34743474
new_key->sig = csig;
34753475
new_key->pointer = func;
34763476

3477-
res = mono_mb_create_and_cache_full (cache, new_key, mb, csig, csig->param_count + 16, NULL, &found);
3477+
info = mono_wrapper_info_create (mb, WRAPPER_SUBTYPE_NATIVE_FUNC);
3478+
3479+
res = mono_mb_create_and_cache_full (cache, new_key, mb, csig, csig->param_count + 16, info, &found);
34783480
if (found)
34793481
g_free (new_key);
34803482

34813483
mono_mb_free (mb);
34823484

3483-
mono_marshal_set_wrapper_info (res, NULL);
3484-
34853485
return res;
34863486
}
34873487

src/mono/mono/metadata/marshal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ typedef enum {
113113
WRAPPER_SUBTYPE_RUNTIME_INVOKE_VIRTUAL,
114114
/* Subtypes of MONO_WRAPPER_MANAGED_TO_NATIVE */
115115
WRAPPER_SUBTYPE_ICALL_WRAPPER, // specifically JIT icalls
116+
WRAPPER_SUBTYPE_NATIVE_FUNC,
116117
WRAPPER_SUBTYPE_NATIVE_FUNC_AOT,
117118
WRAPPER_SUBTYPE_NATIVE_FUNC_INDIRECT,
118119
WRAPPER_SUBTYPE_PINVOKE,

src/mono/mono/mini/aot-runtime.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include "mini.h"
1212

1313
/* Version number of the AOT file format */
14-
#define MONO_AOT_FILE_VERSION 181
14+
#define MONO_AOT_FILE_VERSION 182
1515

1616
#define MONO_AOT_TRAMP_PAGE_SIZE 16384
1717

src/mono/mono/mini/interp/transform.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3458,9 +3458,8 @@ interp_transform_call (TransformData *td, MonoMethod *method, MonoMethod *target
34583458
* every time based on the signature.
34593459
*/
34603460
if (method->wrapper_type == MONO_WRAPPER_MANAGED_TO_NATIVE) {
3461-
WrapperInfo *info = mono_marshal_get_wrapper_info (method);
3462-
if (info) {
3463-
MonoMethod *pinvoke_method = info->d.managed_to_native.method;
3461+
MonoMethod *pinvoke_method = mono_marshal_method_from_wrapper (method);
3462+
if (pinvoke_method) {
34643463
imethod = mono_interp_get_imethod (pinvoke_method, error);
34653464
return_val_if_nok (error, FALSE);
34663465
}

0 commit comments

Comments
 (0)