-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[mono] Make some icalls pass/return object references using ObjectHandleOnStack/QCallTypeHandle #62141
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] Make some icalls pass/return object references using ObjectHandleOnStack/QCallTypeHandle #62141
Changes from all commits
2d3c940
068fa6e
15e68e9
245b0eb
0e94781
2c76dfd
895fec5
deec453
6c98dff
972a3cf
d1dd227
225ef62
89b1c72
09ba1b7
5f3408b
c4191dc
eb87411
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,24 +9,44 @@ namespace System | |
| public partial class Enum | ||
| { | ||
| [MethodImpl(MethodImplOptions.InternalCall)] | ||
| private static extern bool GetEnumValuesAndNames(RuntimeType enumType, out ulong[] values, out string[] names); | ||
| private static extern bool GetEnumValuesAndNames(QCallTypeHandle enumType, out ulong[] values, out string[] names); | ||
|
|
||
| [MethodImpl(MethodImplOptions.InternalCall)] | ||
| private static extern object InternalBoxEnum(RuntimeType enumType, long value); | ||
| private static extern void InternalBoxEnum(QCallTypeHandle enumType, ObjectHandleOnStack res, long value); | ||
|
|
||
| [MethodImpl(MethodImplOptions.InternalCall)] | ||
| private extern CorElementType InternalGetCorElementType(); | ||
| private static extern CorElementType InternalGetCorElementType(QCallTypeHandle enumType); | ||
|
|
||
| [MethodImpl(MethodImplOptions.InternalCall)] | ||
| internal static extern RuntimeType InternalGetUnderlyingType(RuntimeType enumType); | ||
| private static extern void InternalGetUnderlyingType(QCallTypeHandle enumType, ObjectHandleOnStack res); | ||
|
|
||
| private static object InternalBoxEnum(RuntimeType enumType, long value) | ||
| { | ||
| object? res = null; | ||
|
||
| InternalBoxEnum(new QCallTypeHandle(ref enumType), ObjectHandleOnStack.Create(ref res), value); | ||
| return res!; | ||
| } | ||
|
|
||
| private CorElementType InternalGetCorElementType() | ||
| { | ||
| RuntimeType this_type = (RuntimeType)GetType(); | ||
| return InternalGetCorElementType(new QCallTypeHandle(ref this_type)); | ||
| } | ||
|
|
||
| internal static RuntimeType InternalGetUnderlyingType(RuntimeType enumType) | ||
| { | ||
| RuntimeType? res = null; | ||
| InternalGetUnderlyingType(new QCallTypeHandle(ref enumType), ObjectHandleOnStack.Create(ref res)); | ||
| return res!; | ||
| } | ||
|
|
||
| private static EnumInfo GetEnumInfo(RuntimeType enumType, bool getNames = true) | ||
| { | ||
| EnumInfo? entry = enumType.Cache.EnumInfo; | ||
|
|
||
| if (entry == null || (getNames && entry.Names == null)) | ||
| { | ||
| if (!GetEnumValuesAndNames(enumType, out ulong[]? values, out string[]? names)) | ||
| if (!GetEnumValuesAndNames(new QCallTypeHandle(ref enumType), out ulong[]? values, out string[]? names)) | ||
| Array.Sort(values, names, Collections.Generic.Comparer<ulong>.Default); | ||
|
|
||
| bool hasFlagsAttribute = enumType.IsDefined(typeof(FlagsAttribute), inherit: false); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.