You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been trying to get the size of a MethodDesc for 3 hours, still can't figure out how to get it to work.
These are my MethodDesc structure fields:
CodeFlags codeFlags; // ushort enumubyte chunkIndex; // equivalent to byte in C#ubyte methodIndex; // equivalent to byte in C#ushort slotNumber;
mixin(bitfields!(
MethodClassification, "classification", 3,
MethodFlags, "flags", 13,
));
And this is the code I'm trying to use to get the size of a MethodDesc:
if (classification == MethodClassification.IL)
return MethodDesc.sizeof + (hasNonVtableSlot() ? ptrdiff_t.sizeof : 0) // ptrdiff_t is equivalent to nint in C#+ (hasNativeCodeSlot() ? ptrdiff_t.sizeof : 0)
+ (hasMethodImpl() ? MethodImpl.sizeof : 0);
...this repeats for each MethodClassification
I'm getting a size of 24 for a MethodDesc that has the classification IL and has a native and non-vtable slot, when adding this to the pointer of the first MethodDesc in the MethodDescChunk I get a pointer to a constructor descriptor. The size of the new MethodDesc returns 40. When adding 40 to the new pointer I get an invalid pointer, so obviously I'm doing something wrong.
Also, every MethodDesc returns IL as its classification, so I didn't find it relevant to post the other structures.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I've been trying to get the size of a
MethodDesc
for 3 hours, still can't figure out how to get it to work.These are my
MethodDesc
structure fields:And this is the code I'm trying to use to get the size of a
MethodDesc
:I'm getting a size of 24 for a
MethodDesc
that has the classification IL and has a native and non-vtable slot, when adding this to the pointer of the firstMethodDesc
in theMethodDescChunk
I get a pointer to a constructor descriptor. The size of the newMethodDesc
returns 40. When adding 40 to the new pointer I get an invalid pointer, so obviously I'm doing something wrong.Also, every MethodDesc returns IL as its classification, so I didn't find it relevant to post the other structures.
Beta Was this translation helpful? Give feedback.
All reactions