This repository was archived by the owner on Nov 13, 2026. It is now read-only.
Repository navigation
Merge nmirror to master - #1337
Merged
Merged
Conversation
After un-marshaling the object reset the stream to the beginning. This addresses an issue causing the Threading\FirstParty\FTMThreadingTests to fail. What I suspect is happening although I can't verify this in the debugger is that when we create the stream we don't zero it out so it may contain contents of a previous stream that has already been released. So if we don't reset the stream after we have un-marshaled the object and call CoReleaseMarshalData from the finalizer the stream may be positioned at another object and CoReleaseMarshalData may be releasing that object instead of the actual one that was written to the beginning of the stream. Updating QueryInterface to call AddRef on the instance. Updating Read and Write to use Buffer.MemoryCopy which should be faster. Updating CopyTo to check the return value of Read and Write. [tfs-changeset: 1607790]
Merge changes from TFS
… from another thread, the exception serialization logic missed the exception object and therefore is inaccessible in the final crash dump. [tfs-changeset: 1608493]
[tfs-changeset: 1608493]
[tfs-changeset: 1608916]
Merge changes from TFS
[tfs-changeset: 1608925]
Merge changes from TFS
[tfs-changeset: 1608951]
Merge changes from TFS
We have like 2 managed copies of EEType readers and there is a need to read EETypes from CoreLib and CoreRT compiler tests now (as a perf optimization/maintentance improvement). Time to consolidate everything into one thing instead of creating a new thing. EEType.cs in the type loader is in the best position to become the ultimate EEType reader, so I'm cleaning it up a little (making it use the shared enums we use in the compiler and Runtime.Base). ***Next steps after this*** 1. Mechanically remove the "m_" field prefixes 2. Put all the setters under #if TYPE_LOADER_IMPLEMENTATION 3. Move the file out next to EEType.Constants.cs (mirrors it to Github) 4. Profit 5. Make Runtime.Base use the common EEType.cs and delete the inferior EEType.cs 6. Make System.Private.CoreLib use the common EEType.cs and delete RuntimeImports for all of the trivial EEType sniffing 7. Delete RuntimeExports from Runtime.Base that provide EEType sniffing 8. Write unit tests for EEType emission in the CoreRT compiler and use EEType.cs to validate the structures look as expected [tfs-changeset: 1608978]
CR: JKotas, DavidWr
The generic ConditionalWeakTable class uses the non-generic DependentHandle struct to store GC handles for keys and values. Runtime type casts from objects back to TKey and TValue types are relatively expensive as they involve extracting the corresponding EETypePtr from the generic dictionary and calling the runtime casting routine. The main change here is skipping certainly safe type casts in ConditionalWeakTable code by using RuntimeHelpers.UncheckedCast intrinsic. One alternative approach would be making the DependentHandle struct generic; however, that would emit extra EETypes into SharedLibrary.dll.
Details:
* Move LockHolder.cs file from TypeLoader to Common and add it to System.Private.CoreLib assembly.
* Monitor.cs: Move ConditionalWeakTable and delegate initialization to the class constructor so that we do not need to check whether they have been initialized on each GetLock or GetCondition call.
* ClassConstructorRunner.cs:
- Use the LockHolder pattern to avoid potential reentrancy issues with Monitor..cctor after the change in Monitor.cs.
- Use raw EETypePtr equality when checking for the Lock type in the GetLock method to improve its performance. This check is temporary and will be removed after we fix Framework code to directly use Lock.Acquire/Release methods instead of the lock statement on Lock objects.
* ConditionalWeakTable.cs: Use the LockHolder pattern for update operations. Replace certainly safe type casts with RuntimeHelpers.UncheckedCast intrinsic calls.
With these changes I am observing ~28% throughput improvement for locking on normal types, and ~21% throughput improvement for locking on the special System.Threading.Lock type for x86ret build with SharedLibrary.dll. These numbers should be taken with a grain of salt as they depend on inlining decisions and binary code layout.
[tfs-changeset: 1608989]
We have like 2 managed copies of EEType readers and there is a need to read EETypes from CoreLib and CoreRT compiler tests now (as a perf optimization/maintentance improvement). Time to consolidate everything into one thing instead of creating a new thing. EEType.cs in the type loader is in the best position to become the ultimate EEType reader, so I'm cleaning it up a little (making it use the shared enums we use in the compiler and Runtime.Base). ***Next steps after this*** 1. Mechanically remove the "m_" field prefixes 2. Put all the setters under #if TYPE_LOADER_IMPLEMENTATION 3. Move the file out next to EEType.Constants.cs (mirrors it to Github) 4. Profit 5. Make Runtime.Base use the common EEType.cs and delete the inferior EEType.cs 6. Make System.Private.CoreLib use the common EEType.cs and delete RuntimeImports for all of the trivial EEType sniffing 7. Delete RuntimeExports from Runtime.Base that provide EEType sniffing 8. Write unit tests for EEType emission in the CoreRT compiler and use EEType.cs to validate the structures look as expected [tfs-changeset: 1608978]
Merge changes from TFS
[tfs-changeset: 1609001]
Merge changes from TFS
Conflicts: src/System.Private.CoreLib/src/System/Threading/Monitor.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
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.
No description provided.