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] Add wrapper info for native func wrappers. #55602

Merged
merged 1 commit into from
Jul 14, 2021
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions src/mono/mono/metadata/marshal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions src/mono/mono/metadata/marshal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/mono/mono/mini/aot-runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 2 additions & 3 deletions src/mono/mono/mini/interp/transform.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down