-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[marshal] Use MonoClass getters in marshal.c #7253
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
Conversation
mono/metadata/class-accessors.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be assume that the caller holds the loader lock.
These look like:
```c
intptr_t
m_class_offsetof_someField (void) {
return MONO_STRUCT_OFFSET (MonoClass, someField);
}
```
When Mono is compiled with the definition of MonoClass
hidden (--enable-checked-build=private_types),
only the function prototypes are available via
mono/metadata/class-abi-details.h
When Mono is compiled without the checked build flag,
the functions are inlined into that header.
This is needed by mono_marshal_load_type_info ()
420d47d to
613a28c
Compare
|
Changed |
|
I am wondering if I can ask some question about this particular pull here . I am finally spending some time to get my own hand dirty try to get an old mixed-mode assembly application to work ( #10268 ) and is somewhat pleasantly surprised that with mono 5.12 or below, it asserts at the The only important difference within So my question is, why would switching to getter/setter from direct access fixes problem with that particular assertion? Or, if this is not the fix for the assertion, what other changes around that time might be? I just like to understanding more about this pull. I see the purpose of |
|
@HinTak it's unlikely that switching from direct access to It's more likely a result of #7012 - I think part of what that PR did was to correct which |
|
Thanks for taking the time to reply. I'll try hacking around those lines to see if I can learn more about how it all works (and why it failed and now it gotten a bit further).
If you have time, can you have a look at my hack to get the mixed mode app to work? ( #10268 (comment) ) and I'd appreciate any comments, e.g. if I am doing something obviously wrong. - before 5.12, it gaves a 300k log on --verbose, after 5.14, it gives a 500k one - and gotten further. With my hack, it seems to finish parsing metadata and gives a 1.5M log with --verbose, but P/Invoke seem to have completely broke :-).
|
* [runtime] Use getters in IS_MONOTYPE()
* [metadata] Add m_class_offsetof_fieldName accessors
These look like:
```c
intptr_t
m_class_offsetof_someField (void) {
return MONO_STRUCT_OFFSET (MonoClass, someField);
}
```
When Mono is compiled with the definition of MonoClass
hidden (--enable-checked-build=private_types),
only the function prototypes are available via
mono/metadata/class-abi-details.h
When Mono is compiled without the checked build flag,
the functions are inlined into that header.
* [metadata] Add accessor function mono_class_set_nonblittable
This is needed by mono_marshal_load_type_info ()
* [marshal] Use m_class_get_ getters to access MonoClass fields
Commit migrated from mono/mono@b8da973
m_class_offsetof_fieldNamefunctionsThey just call
MONO_STRUCT_OFFSET (MonoClass, fieldName). If theMonoClassdefinition is hidden, you get prototypes frommono/metadata/class-abi-details.h, otherwise the functions are inlined in that header.mono_class_set_nonblittableaccessor function.I don't really understand why, but
mono_marshal_load_type_infowants to overwrite theMonoClass:blittableflag sometimes.marshal.cto usem_class_get_fieldgetters. No functional change.#6925