-
Notifications
You must be signed in to change notification settings - Fork 5.5k
[MONO] Move Marshal-ilgen into a component #75542
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
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
30bd957
Move marshal_ilgen into a component.
b8c83de
Incorporated race condition fix from main.
edb009e
Fix wasm syntax error.
c41cb19
Added missing include.
33e3e4e
Fix merge errors.
f759a75
Removed unused variable.
df7530a
Removed duplicate initilization.
139f366
Always enable ilgen.
792c919
Moved install_callbacks_mono
1124885
Stop copying marshal-ilgen.a
14cecf9
Remove remaining mentions of libmono-ilgen.a
f4dd8b0
Made ilgen_init_internal static.
a1a4379
Made emit_marshal_ilgen static.
e503e01
Made ilgen_install_callbacks_mono static
16a6816
Put method builder callbacks in a nested struct.
3085b9e
Moved mono_install_marshal_callbacks_ilgen to marshal-ilgen-internals
b01b517
Added marshal-ilgen-internals.h
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| #ifndef __MARSHAL_ILGEN_INTERNALS_H__ | ||
| #define __MARSHAL_ILGEN_INTERNALS_H__ | ||
|
|
||
| #include "mono/component/marshal-ilgen.h" | ||
|
|
||
| void | ||
| mono_install_marshal_callbacks_ilgen (MonoMarshalILgenCallbacks *cb); | ||
|
|
||
| #endif // __MARSHAL_ILGEN_INTERNALS_H__ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,187 @@ | ||
| #include "mono/component/marshal-ilgen.h" | ||
| #include "mono/component/marshal-ilgen-internals.h" | ||
| #include "mono/component/marshal-ilgen-noilgen.h" | ||
|
|
||
| #ifndef ENABLE_ILGEN | ||
| static int | ||
| emit_marshal_array_noilgen (EmitMarshalContext *m, int argnum, MonoType *t, | ||
| MonoMarshalSpec *spec, | ||
| int conv_arg, MonoType **conv_arg_type, | ||
| MarshalAction action) | ||
| { | ||
| MonoType *int_type = mono_get_int_type (); | ||
| MonoType *object_type = mono_get_object_type (); | ||
| switch (action) { | ||
| case MARSHAL_ACTION_CONV_IN: | ||
| *conv_arg_type = object_type; | ||
| break; | ||
| case MARSHAL_ACTION_MANAGED_CONV_IN: | ||
| *conv_arg_type = int_type; | ||
| break; | ||
| } | ||
| return conv_arg; | ||
| } | ||
|
|
||
| static int | ||
| emit_marshal_ptr_noilgen (EmitMarshalContext *m, int argnum, MonoType *t, | ||
| MonoMarshalSpec *spec, int conv_arg, | ||
| MonoType **conv_arg_type, MarshalAction action) | ||
| { | ||
| return conv_arg; | ||
| } | ||
| #endif | ||
|
|
||
| #if !defined(ENABLE_ILGEN) || defined(DISABLE_NONBLITTABLE) | ||
| static int | ||
| emit_marshal_vtype_noilgen (EmitMarshalContext *m, int argnum, MonoType *t, | ||
| MonoMarshalSpec *spec, | ||
| int conv_arg, MonoType **conv_arg_type, | ||
| MarshalAction action) | ||
| { | ||
| return conv_arg; | ||
| } | ||
|
|
||
| static int | ||
| emit_marshal_string_noilgen (EmitMarshalContext *m, int argnum, MonoType *t, | ||
| MonoMarshalSpec *spec, | ||
| int conv_arg, MonoType **conv_arg_type, | ||
| MarshalAction action) | ||
| { | ||
| MonoType *int_type = mono_get_int_type (); | ||
| switch (action) { | ||
| case MARSHAL_ACTION_CONV_IN: | ||
| *conv_arg_type = int_type; | ||
| break; | ||
| case MARSHAL_ACTION_MANAGED_CONV_IN: | ||
| *conv_arg_type = int_type; | ||
| break; | ||
| } | ||
| return conv_arg; | ||
| } | ||
|
|
||
| static int | ||
| emit_marshal_safehandle_noilgen (EmitMarshalContext *m, int argnum, MonoType *t, | ||
| MonoMarshalSpec *spec, int conv_arg, | ||
| MonoType **conv_arg_type, MarshalAction action) | ||
| { | ||
| MonoType *int_type = mono_get_int_type (); | ||
| if (action == MARSHAL_ACTION_CONV_IN) | ||
| *conv_arg_type = int_type; | ||
| return conv_arg; | ||
| } | ||
|
|
||
| static int | ||
| emit_marshal_handleref_noilgen (EmitMarshalContext *m, int argnum, MonoType *t, | ||
| MonoMarshalSpec *spec, int conv_arg, | ||
| MonoType **conv_arg_type, MarshalAction action) | ||
| { | ||
| MonoType *int_type = mono_get_int_type (); | ||
| if (action == MARSHAL_ACTION_CONV_IN) | ||
| *conv_arg_type = int_type; | ||
| return conv_arg; | ||
| } | ||
|
|
||
| static int | ||
| emit_marshal_object_noilgen (EmitMarshalContext *m, int argnum, MonoType *t, | ||
| MonoMarshalSpec *spec, | ||
| int conv_arg, MonoType **conv_arg_type, | ||
| MarshalAction action) | ||
| { | ||
| MonoType *int_type = mono_get_int_type (); | ||
| if (action == MARSHAL_ACTION_CONV_IN) | ||
| *conv_arg_type = int_type; | ||
| return conv_arg; | ||
| } | ||
|
|
||
| static int | ||
| emit_marshal_variant_noilgen (EmitMarshalContext *m, int argnum, MonoType *t, | ||
| MonoMarshalSpec *spec, | ||
| int conv_arg, MonoType **conv_arg_type, | ||
| MarshalAction action) | ||
| { | ||
| g_assert_not_reached (); | ||
| } | ||
|
|
||
| static int | ||
| emit_marshal_asany_noilgen (EmitMarshalContext *m, int argnum, MonoType *t, | ||
| MonoMarshalSpec *spec, | ||
| int conv_arg, MonoType **conv_arg_type, | ||
| MarshalAction action) | ||
| { | ||
| return conv_arg; | ||
| } | ||
|
|
||
| static int | ||
| emit_marshal_boolean_noilgen (EmitMarshalContext *m, int argnum, MonoType *t, | ||
| MonoMarshalSpec *spec, | ||
| int conv_arg, MonoType **conv_arg_type, | ||
| MarshalAction action) | ||
| { | ||
| MonoType *int_type = mono_get_int_type (); | ||
| switch (action) { | ||
| case MARSHAL_ACTION_CONV_IN: | ||
| if (m_type_is_byref (t)) | ||
| *conv_arg_type = int_type; | ||
| else | ||
| *conv_arg_type = mono_marshal_boolean_conv_in_get_local_type (spec, NULL); | ||
| break; | ||
|
|
||
| case MARSHAL_ACTION_MANAGED_CONV_IN: { | ||
| MonoClass* conv_arg_class = mono_marshal_boolean_managed_conv_in_get_conv_arg_class (spec, NULL); | ||
| if (m_type_is_byref (t)) | ||
| *conv_arg_type = m_class_get_this_arg (conv_arg_class); | ||
| else | ||
| *conv_arg_type = m_class_get_byval_arg (conv_arg_class); | ||
| break; | ||
| } | ||
|
|
||
| } | ||
| return conv_arg; | ||
| } | ||
|
|
||
| static int | ||
| emit_marshal_char_noilgen (EmitMarshalContext *m, int argnum, MonoType *t, | ||
| MonoMarshalSpec *spec, int conv_arg, | ||
| MonoType **conv_arg_type, MarshalAction action) | ||
| { | ||
| return conv_arg; | ||
| } | ||
|
|
||
| static int | ||
| emit_marshal_custom_noilgen (EmitMarshalContext *m, int argnum, MonoType *t, | ||
| MonoMarshalSpec *spec, | ||
| int conv_arg, MonoType **conv_arg_type, | ||
| MarshalAction action) | ||
| { | ||
| MonoType *int_type = mono_get_int_type (); | ||
| if (action == MARSHAL_ACTION_CONV_IN && t->type == MONO_TYPE_VALUETYPE) | ||
| *conv_arg_type = int_type; | ||
| return conv_arg; | ||
| } | ||
| #endif | ||
|
|
||
| #ifndef ENABLE_ILGEN | ||
|
|
||
| void | ||
| mono_marshal_noilgen_init_heavyweight (void) | ||
| { | ||
| MonoMarshalILgenCallbacks ilgen_cb; | ||
|
|
||
| ilgen_cb.version = MONO_MARSHAL_CALLBACKS_VERSION; | ||
| ilgen_cb.emit_marshal_array = emit_marshal_array_noilgen; | ||
| ilgen_cb.emit_marshal_vtype = emit_marshal_vtype_noilgen; | ||
| ilgen_cb.emit_marshal_string = emit_marshal_string_noilgen; | ||
| ilgen_cb.emit_marshal_safehandle = emit_marshal_safehandle_noilgen; | ||
| ilgen_cb.emit_marshal_handleref = emit_marshal_handleref_noilgen; | ||
| ilgen_cb.emit_marshal_object = emit_marshal_object_noilgen; | ||
| ilgen_cb.emit_marshal_variant = emit_marshal_variant_noilgen; | ||
| ilgen_cb.emit_marshal_asany = emit_marshal_asany_noilgen; | ||
| ilgen_cb.emit_marshal_boolean = emit_marshal_boolean_noilgen; | ||
| ilgen_cb.emit_marshal_custom = emit_marshal_custom_noilgen; | ||
| ilgen_cb.emit_marshal_ptr = emit_marshal_ptr_noilgen; | ||
|
|
||
| ilgen_cb.emit_marshal_char = emit_marshal_char_noilgen; | ||
| mono_install_marshal_callbacks_ilgen(&ilgen_cb); | ||
| } | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| /** | ||
| * \file | ||
| * Copyright 2022 Microsoft | ||
| * Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
| */ | ||
| #ifndef __MARSHAL_ILGEN_NOILGEN_H__ | ||
| #define __MARSHAL_ILGEN_NOILGEN_H__ | ||
|
|
||
| void mono_marshal_noilgen_init_heavyweight (void); | ||
|
|
||
| #endif // __MARSHAL_ILGEN_NOILGEN_H__ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.