-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[RISC-V] Fix struct info value in crossgen2 #99602
Conversation
Asserts in `./Interop/StructMarshalling/PInvoke/MarshalStructAsLayoutExp/MarshalStructAsLayoutExp.sh` Error message is `Assertion failed 'roundUp(structSize, TARGET_POINTER_SIZE) == roundUp(loadExtent, TARGET_POINTER_SIZE)' in 'Managed:MarshalStructAsParam_AsExpByVal(int)' during 'Morph - Global' (IL size 2208; hash 0x9fd9734a; MinOpts)` Copied missed codes of GetRiscV64PassStructInRegiste in vm to crossgen2
Checked the same assertions in coreclr tests (with crossgened test dll) and fixed. |
Could you please highlight the equivalent code in |
@jkotas runtime/src/coreclr/vm/methodtable.cpp Lines 3759 to 3762 in f0117c9
and runtime/src/coreclr/vm/methodtable.cpp Lines 3920 to 3930 in f0117c9
Right. These looks so different. And @bartlomiejko Today, I am off. Could you refactor both codes to make to be more similar and simpler in your team (including this patch)? If then, I will close this PR. If no one in your team is available, I will handle from tomorrow. Thank you. |
I'll take this, I worked on these flags recently. |
@tomeksowi Thank you. |
Speaking of simpler, I noticed TypeHandle::IsBlittable always returns true for native value types: runtime/src/coreclr/vm/typehandle.cpp Lines 483 to 492 in 589beb0
So given blittable types have the same layout as managed, I think we could remove the whole NativeLayoutInfo branch from MethodTable::GetRiscV64PassStructInRegisterFlags. If anyone sees a fault in this reasoning, let me know. |
NativeValueType is unmanaged marshalled view of the managed type. For example, if you have The NativeLayoutInfo branch is only needed for built-in runtime marshalling that we have been moving away from. If you were to remove the NativeLayoutInfo branch, you would be effectively forcing |
OK, for the time being I'll keep support for NativeLayoutInfo. |
Fixed assertions in
fgMorphMultiregStructArg
when crossgen2 compiles in Debug build with--verify-type-and-field-layout
optionError messages
System.Private.CoreLib.dll
: ValueType which contains two double fields./Interop/StructMarshalling/PInvoke/MarshalStructAsLayoutExp/MarshalStructAsLayoutExp
: ValueType which containsFieldOffset
.Part of #84834
cc @dotnet/samsung