Implement RuntimeHelpers.SizeOf#100618
Merged
jkoritzinsky merged 17 commits intodotnet:mainfrom Apr 9, 2024
Merged
Conversation
|
Note regarding the |
jkotas
reviewed
Apr 3, 2024
...em.Runtime/tests/System.Runtime.Tests/System/Runtime/CompilerServices/RuntimeHelpersTests.cs
Outdated
Show resolved
Hide resolved
jkotas
reviewed
Apr 3, 2024
jkotas
reviewed
Apr 3, 2024
jkotas
reviewed
Apr 3, 2024
...coreclr/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.CoreCLR.cs
Outdated
Show resolved
Hide resolved
...veaot/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.NativeAot.cs
Outdated
Show resolved
Hide resolved
src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
jkotas
reviewed
Apr 4, 2024
...em.Runtime/tests/System.Runtime.Tests/System/Runtime/CompilerServices/RuntimeHelpersTests.cs
Show resolved
Hide resolved
jkotas
reviewed
Apr 4, 2024
...em.Runtime/tests/System.Runtime.Tests/System/Runtime/CompilerServices/RuntimeHelpersTests.cs
Outdated
Show resolved
Hide resolved
…/Runtime/CompilerServices/RuntimeHelpersTests.cs Co-authored-by: Jan Kotas <jkotas@microsoft.com>
jkotas
reviewed
Apr 4, 2024
jkotas
approved these changes
Apr 4, 2024
jkotas
reviewed
Apr 4, 2024
...coreclr/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.CoreCLR.cs
Outdated
Show resolved
Hide resolved
jkotas
reviewed
Apr 4, 2024
...coreclr/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.CoreCLR.cs
Outdated
Show resolved
Hide resolved
jkotas
reviewed
Apr 4, 2024
...em.Runtime/tests/System.Runtime.Tests/System/Runtime/CompilerServices/RuntimeHelpersTests.cs
Show resolved
Hide resolved
jkotas
reviewed
Apr 5, 2024
...veaot/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.NativeAot.cs
Outdated
Show resolved
Hide resolved
jkotas
reviewed
Apr 5, 2024
...coreclr/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.CoreCLR.cs
Show resolved
Hide resolved
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
This was referenced Apr 5, 2024
jkotas
reviewed
Apr 5, 2024
| /// <returns>The size of instances of the type.</returns> | ||
| /// <exception cref="ArgumentException">The passed-in type is not a valid type to get the size of.</exception> | ||
| /// <remarks> | ||
| /// This API has the same behavior as if you were to use the IL sizeof instruction with the passed in type as the operand. |
Member
There was a problem hiding this comment.
Suggested change
| /// This API has the same behavior as if you were to use the IL sizeof instruction with the passed in type as the operand. | |
| /// This API returns the same value as the IL sizeof instruction with the passed in type as the operand. |
Nit: It does not have the same behavior for error cases.
Member
There was a problem hiding this comment.
Or maybe even link to https://learn.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.unsafe.sizeof that has more details.
This was referenced Apr 5, 2024
# Conflicts: # src/coreclr/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.CoreCLR.cs # src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.NativeAot.cs # src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Runtime/CompilerServices/RuntimeHelpersTests.cs # src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs # src/mono/mono/metadata/icall.c
am11
reviewed
Apr 8, 2024
|
|
||
| Type typeObj = Type.GetTypeFromHandle(type)!; | ||
| if (typeObj.ContainsGenericParameters || typeObj.IsGenericParameter || typeObj == typeof(void)) | ||
| throw new ArgumentException(SR.Arg_TypeNotSupported); |
Member
There was a problem hiding this comment.
Is this a limitation of mono runtime (which doesn't exist in coreclr)?
Member
Author
There was a problem hiding this comment.
No, this is the same limitation in CoreCLR and NativeAOT (though the implementations are slightly different due to how the different type systems are implemented).
This was referenced Apr 8, 2024
Member
Author
|
/ba-g Slow mac timeout |
matouskozak
pushed a commit
to matouskozak/runtime
that referenced
this pull request
Apr 30, 2024
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes #97344
Implement the SizeOf API with the same behavior as the
sizeofIL instruction.