summaryrefslogtreecommitdiff
path: root/src/vm/vars.cpp
AgeCommit message (Collapse)AuthorFilesLines
2019-03-18Add Utf8String skeleton (#23209)Levi Broderick1-0/+3
Utf8String is an experimental type that is string-like (heap-allocated, immutable, variable-length, null-terminated) but whose inner representation is UTF-8, not UTF-16. This is a skeleton implementation of the basic API shape. The ecosystem of APIs has not yet been built around it. All Utf8String-related code is currently surrounded by ifdefs to allow easy identification and removal from release branches.
2018-11-22Delete System.AppDomainSetup (#21157)Jan Kotas1-5/+0
* Delete System.AppDomainSetup Contributes to #21028 * Add test hook for null entry assembly * Validate that the binder paths are absolute
2018-10-31Clean up string literal implicit const casting and some two-phase lookup ↵Jeremy Koritzinsky1-1/+1
nits on Windows (#20730) * Remove implicit c-string const casting and clean up some C++ standards conformance bugs. * Fix const string conversion in FCSigCheck.
2018-07-31Delete FEATURE_IPCMAN (#19212)Jan Kotas1-5/+0
2018-03-31Delete dead code to support OSes prior to Windows 7 (#17367)Jan Kotas1-7/+0
2018-02-26Fixed mixed mode attach/JIT debugging. (#16552)Mike McLaughlin1-0/+3
Fixed mixed mode attach/JIT debugging. The mixed mode debugging attach uses TLS slot to communicate between debugger break-in thread and the right side. Unfortunately, the __thread static variables cannot be used on debugger breakin thread because of it does not have storage allocated for them. The fix is to switch the storage for debugger word to classic TlsAlloc allocated slot that works fine on debugger break-in thread. There was also problem (that is also in 2.0) where the WINNT_OFFSETOF__TEB__ThreadLocalStoragePointer was using the define for 64/32 bit and ended up always the 32 bit Windows value. This caused the right side GetEEThreadValue, GetEETlsDataBlock unmanaged thread functions to always fail.
2018-01-31[local gc] Enable eventing (#16120)David Mason1-4/+0
* move GC etw enums to gcinterface.ee.h * add GetActiveSyncBlockCount * refactor reference to ETW::GCLog::ShouldTrackMovementForEtw() * mov g_dwHandles to gc side * enable FEATURE_EVENT_TRACE for gc
2017-11-27Improve Monitor scaling (#14216)Koundinya Veluri1-1/+2
Improve Monitor scaling and reduce spinning Part 1: Improve Monitor scaling Fixes https://github.com/dotnet/coreclr/issues/13978 - Refactored AwareLock::m_MonitorHeld into a class LockState with operations to mutate the state - Allowed the lock to be taken by a non-waiter when there is a waiter to prevent creating lock convoys - Added a bit to LockState to indicate that a waiter is signaled to wake, to avoid waking more than one waiter at a time. A waiter that wakes by observing the signal unsets this bit. See AwareLock::EnterEpilogHelper(). - Added a spinner count to LockState. Spinners now register and unregister themselves and lock releasers don't wake a waiter when there is a registered spinner (the spinner guarantees to take the lock if it's available when unregistering itself) - This was necessary mostly on Windows to reduce CPU usage to the expected level in contended cases with several threads. I believe it's the priority boost Windows gives to signaled threads, which seems to cause waiters to much more frequently succeed in acquiring the lock. This causes a CPU usage problem because once the woken waiter releases the lock, on the next lock attempt it will become a spinner. This keeps repeating, converting several waiters into spinners unnecessarily. Before registering spinners, I saw typically 4-6 spinners under contention (with delays inside and outside the lock) when I expected to have only 1-2 spinners at most. - It costs an interlocked operation before and after the spin loop, doesn't seem to be too significant since spinning is a relatively slow path anyway, and the reduction in CPU usage in turn reduces contention on the lock and lets more useful work get done - Updated waiters to spin a bit before going back to waiting, reasons are explained in AwareLock::EnterEpilogHelper() - Removed AwareLock::Contention() and any references (this removes the 10 repeats of the entire spin loop in that function). With the lock convoy issue gone, this appears to no longer be necessary. Perf - On Windows, throughput has increased significantly starting at slightly lower than proc count threads. On Linux, latency and throughput have increased more significantly at similar proc counts. - Most of the larger regressions are in the unlocked fast paths. The code there hasn't changed and is almost identical (minor layout differences), I'm just considering this noise until we figure out how to get consistently faster code generated. - The smaller regressions are within noise range Part 2: Reduce Monitor spinning Fixes https://github.com/dotnet/coreclr/issues/13980 - Added new config value Monitor_SpinCount and Monitor spins for that many iterations, default is 30 (0x1e). This seems to give a somewhat decent balance between latency, fairness, and throughput. Lower spin counts improve latency and fairness significantly and regress throughput slightly, and higher spin counts improve throughput slightly and regress latency and fairness significantly. - The other constants can still be used to disable spinning but otherwise they are no longer used by Monitor - Decreased the number of bits used for tracking spinner count to 3. This seems to be more than enough since only one thread can take a lock at a time, and prevents spikes of unnecessary CPU usage. Tried some things that didn't pan out: - Sleep(0) doesn't seem to add anything to the spin loop, so left it out. Instead of Sleep(0) it can just proceed to waiting. Waiting is more expensive than Sleep(0), but I didn't see that benefit in the tests. Omitting Sleep(0) also keeps the spin loop very short (a few microseconds max). - Increasing the average YieldProcessor() duration per spin iteration improved thorughput slightly but regressed latency and fairness very quickly. Given that fairness is generally worse with part 1 of this change above, it felt like a better compromise to take a small reduction in throughput for larger improvements in latency and fairness. - Tried adding a very small % of lock releases by random wake a waiter despite there being spinners to improve fairness. This improved fairness noticeably but not as much as decreasing the spin count slightly, and it was making latency and throughput worse more quickly. After reducing the % to a point where I was hardly seeing fairness improvements, there were still noticeable latency and throughput regressions. Miscellaneous - Moved YieldProcessorNormalized code into separate files so that they can be included earlier and where needed - Added a max for "optimal max normalized yields per spin iteration" since it has a potential to be very large on machines where YieldProcessor may be implemented as no-op, in which case it's probably not worth spinning for the full duration - Refactored duplicate code in portable versions of MonEnterWorker, MonEnter, and MonReliableEnter. MonTryEnter has a slightly different structure, did not refactor that. Perf - Throughput is a bit lower than before at lower thread counts and better at medium-high thread counts. It's a bit lower at lower thread counts because of two reasons: - Shorter spin loop means the lock will be polled more frequently because the exponential backoff does not get as high, making it more likely for a spinner to steal the lock from another thread, causing the other thread to sometimes wait early - The duration of YieldProcessor() calls per spin iteration has decreased and a spinner or spinning waiter are more likely to take the lock, the rest is similar to above - For the same reasons as above, latency is better than before. Fairness is better on Windows and worse on Linux compared to baseline due to the baseline having differences between these platforms. Latency also has differences between Windows/Linux in the baseline, I suspect those are due to differences in scheduling. - Performance now scales appropriately on processors with different pause delays Part 3: Add mitigation for waiter starvation Normally, threads are allowed to preempt waiters to acquire the lock. There are cases where waiters can be easily starved as a result. For example, a thread that holds a lock for a significant amount of time (much longer than the time it takes to do a context switch), then releases and reacquires the lock in quick succession, and repeats. Though a waiter would be woken upon lock release, usually it will not have enough time to context-switch-in and take the lock, and can be starved for an unreasonably long duration. In order to prevent such starvation and force a bit of fair forward progress, it is sometimes necessary to change the normal policy and disallow threads from preempting waiters. A new bit was added to LockState and ShouldNotPreemptWaiters() indicates the current state of the policy. - When the first waiter begins waiting, it records the current time as a "waiter starvation start time". That is a point in time after which no forward progress has occurred for waiters. When a waiter acquires the lock, the time is updated to the current time. - Before a spinner begins spinning, and when a waiter is signaled to wake, it checks whether the starvation duration has crossed a threshold (currently 100 ms) and if so, sets ShouldNotPreemptWaiters() When unreasonable starvation is occurring, the lock will be released occasionally and if caused by spinners, spinners will be starting to spin. - Before starting to spin, if ShouldNotPreemptWaiters() is set, the spinner will skip spinning and wait instead. Spinners that are already registered at the time ShouldNotPreemptWaiters() is set will stop spinning as necessary. Eventually, all spinners will drain and no new ones will be registered. - After spinners have drained, only a waiter will be able to acquire the lock. When a waiter acquires the lock, or when the last waiter unregisters itself, ShouldNotPreemptWaiters() is cleared to restore the normal policy.
2017-10-24Delete dead code (#14673)Jan Kotas1-45/+0
- assemblyusagelog - compatibilityflags - xmlparser
2017-10-11Delete !FEATURE_IMPLICIT_TLS (#14398)Jan Kotas1-4/+1
Linux and Windows arm64 are using the regular C/C++ thread local statics. This change unifies the remaining Windows architectures to be on the same plan.
2017-08-07Cleanup code access security from the unmanaged runtime (#13241)Jan Kotas1-1/+0
2017-05-17Finish deleting dead CAS code from CoreLib (#11436)Jan Kotas1-17/+0
Fixes #9321 and deletes CleanupToDoList.cs Delete unmanaged security implementation
2017-02-12Remove never defined FEATURE_CER and headerdanmosemsft1-6/+0
2017-02-12Remove always defined FEATURE_SPAN_OF_Tdanmosemsft1-2/+0
2017-02-10Remove always defined FEATURE_CORECLRdanmosemsft1-6/+0
2017-02-06CAS Security cleanup (#9355)Jan Kotas1-4/+0
2017-01-23[Local GC] Add three finalization-related operations to GCToEEInterface (#9029)Sean Gillespie1-1/+0
* Add three finalization-related operations to GCToEEInterface and utilize them from the GC * Code review feedback * Code review feedback * Fix standalone GC build break * Repair the standalone GC build
2016-12-07Refactor Span<T> to ease implementation of JIT intrinsics (#8497)Jan Kotas1-2/+1
- Introduce internal ByReference<T> type for byref fields and change Span to use it - Generalize handling of byref-like types in the type loader - Make DangerousGetPinnableReference public while I was on it
2016-11-29Disable CER feature as it is not used (#8218)John Chen1-0/+4
Use FEATURE_CER to scope CER code, and disable CER feature in CoreCLR.
2016-10-30Span support in VMJan Kotas1-0/+4
2016-10-28Copy CoreFX FileStream to CoreLibJeremy Kuhne1-0/+2
This copies FileStream to CoreLib and uses it in place of the legacy FileStream. Code is mostly a direct copy with the addition of a few internal constructor overloads. Adds a simple Debug wrapper for BCLDebug to allow keeping the code the same. Also follows the same pattern for SR wrapping. Needed to bring down PreAllocatedOverlapped. - Expose FileStream in model.xml - Remove native usage of FileStreamAsyncResult - #ifdef SafeFileHandle creation in existing code (to avoid mismatched PAL/CoreFX usage)
2016-06-30GC ETW fixes. The code for getting data for ETW and perf counter was written ↵Maoni01-0/+4
by different folks and was very intertwined. For full CLR we always have both defined but for coreclr perf counters are not enabled so some things for ETW were just 0. Need to make sure when one is not defined the rest are still getting the data they need.
2016-06-13Refactor MethodTable::ContainsStackPtr (#5754)Jan Kotas1-2/+0
- Rename ContainsStackPtr to IsByRefLike. It is the term used for this kind of types in ECMA spec. - Change the check to be based on flag instead of hard coded list of types - Remove redundant unused method of the same name on EEClass
2016-05-16Initial change to support System.Private.CoreLib.dll as Core Library.Gaurav Khanna1-7/+7
2016-02-10Add a fast path for byte[] to Buffer.BlockCopyJan Kotas1-0/+2
2016-01-27Update license headersdotnet-bot1-4/+3
2015-03-18Implement runtime support for ICastable interfaceEugene Zemtsov1-0/+5
The goal of this change is to facilitate an alternative (MCG based) way of doing COM interop, we're going to use it on Unix platforms. New ICastable interface allows objects to pretend at runtime that they support an interface and to provide an alternative type that is used to resolve actual calls to interface methods. BE VERY CAREFUL: This is a very dangerous feature, and at this stage it can easily lead to memory corruption without any native code involved. Reviewers: Yi Zhang, Noah Falk, Jan Kotas. DDR clean. [tfs-changeset: 1435198]
2015-01-30Initial commit to populate CoreCLR repo dotnet-bot1-0/+363
[tfs-changeset: 1407945]