- Notifications
You must be signed in to change notification settings - Fork5.3k
Move unboxing helpers to managed code#109135
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes from1 commit
Commits
Show all changes
19 commits Select commitHold shift + click to select a range
c70a57c Move unboxing helpers to managed code
davidwrightonf1258a4 Add boxinghelpers.cs
davidwrighton02636f8 Fix issues noted in CI/Review
davidwrightond8e01e3 Fix more issues found in CI
davidwrightonb2c6991 Fix issue where UnboxNoCheck writes too many bytes when unboxing a tr…
davidwrighton12d17e5 Move unboxing helpers to CastHelpers class
davidwrighton3f281b9 Before conversion to ref byte everywhere
davidwrighton8dfaedc It should all work now, and be fast
davidwrightonbe624da Cleanup dead code
davidwrightondec085f Update src/coreclr/System.Private.CoreLib/src/System/Runtime/Compiler…
davidwrightone22038b Merge branch 'main' of https://github.com/dotnet/runtime into Unboxin…
davidwrightone44fab4 Fix build break
davidwrighton2964105 And finish up the details around optimizing for the fastest case in U…
davidwrighton6469fbb Merge branch 'UnboxingHelpers' of https://github.com/davidwrighton/ru…
davidwrighton1e51dd2 - Remove unused helper functions InitValueClass and InitValueClassPtr
davidwrightonee6d42d Performance seeking behavior has finished. The perf is amazing
davidwrighton7761ad8 Create GetNumInstanceFieldBytesIfContainsGCPointers helper and use it…
davidwrighton55e0df9 Last minute changes
davidwrighton6a8d1ae Update wording
davidwrightonFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
NextNext commit
Move unboxing helpers to managed code
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
commitc70a57c15b60052fde84daf20ff3f86ee239908a
There are no files selected for viewing
1 change: 1 addition & 0 deletionssrc/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj
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
4 changes: 2 additions & 2 deletionssrc/coreclr/System.Private.CoreLib/src/System/Array.CoreCLR.cs
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
17 changes: 11 additions & 6 deletionssrc/coreclr/System.Private.CoreLib/src/System/Runtime/CompilerServices/CastHelpers.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -8,20 +8,25 @@ namespace System.Runtime.CompilerServices | ||
| { | ||
| [StackTraceHidden] | ||
| [DebuggerStepThrough] | ||
| internal static unsafepartialclass CastHelpers | ||
| { | ||
| // In coreclr the table is allocated and written to on the native side. | ||
| internal static int[]? s_table; | ||
| [LibraryImport(RuntimeHelpers.QCall)] | ||
| internal static partial void ThrowInvalidCastException(void* fromTypeHnd, void* toTypeHnd); | ||
| internal static void ThrowInvalidCastException(object fromTypeHnd, void* toTypeHnd) | ||
| { | ||
| ThrowInvalidCastException(RuntimeHelpers.GetMethodTable(fromTypeHnd), toTypeHnd); | ||
davidwrighton marked this conversation as resolved. OutdatedShow resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| } | ||
jkotas marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| [MethodImpl(MethodImplOptions.InternalCall)] | ||
| private static extern object IsInstanceOfAny_NoCacheLookup(void* toTypeHnd, object obj); | ||
| [MethodImpl(MethodImplOptions.InternalCall)] | ||
| private static extern object ChkCastAny_NoCacheLookup(void* toTypeHnd, object obj); | ||
| [MethodImpl(MethodImplOptions.InternalCall)] | ||
| private static extern void WriteBarrier(ref object? dst, object? obj); | ||
| @@ -365,13 +370,13 @@ internal static unsafe class CastHelpers | ||
| } | ||
| [DebuggerHidden] | ||
| private static ref byte Unbox(MethodTable* toTypeHnd, object obj) | ||
| { | ||
| // This will throw NullReferenceException if obj is null. | ||
| if (RuntimeHelpers.GetMethodTable(obj) == toTypeHnd) | ||
| return ref obj.GetRawData(); | ||
| return refBoxingHelpers.Unbox_Helper(toTypeHnd, obj); | ||
| } | ||
| [DebuggerHidden] | ||
9 changes: 6 additions & 3 deletions...eclr/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.CoreCLR.cs
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
4 changes: 2 additions & 2 deletionssrc/coreclr/inc/jithelpers.h
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
1 change: 1 addition & 0 deletionssrc/coreclr/vm/JitQCallHelpers.h
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
19 changes: 19 additions & 0 deletionssrc/coreclr/vm/comutilnative.cpp
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
2 changes: 2 additions & 0 deletionssrc/coreclr/vm/comutilnative.h
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
6 changes: 5 additions & 1 deletionsrc/coreclr/vm/corelib.h
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
4 changes: 1 addition & 3 deletionssrc/coreclr/vm/ecalllist.h
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
179 changes: 13 additions & 166 deletionssrc/coreclr/vm/jithelpers.cpp
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
3 changes: 0 additions & 3 deletionssrc/coreclr/vm/jitinterface.h
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
1 change: 0 additions & 1 deletionsrc/coreclr/vm/methodtable.h
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
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
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.