Age | Commit message (Collapse) | Author |
|
|
|
|
|
[tfs-changeset: 1670032]
|
|
This change enables hijacking loops for GC poll. A loop needs a GC poll if it's not proved to have other GC hijack points, such as function calls.
Unlike the current table-based approach adopted in ProjectN, a piece of hijack code is injected to the loop to lead the control flow to the runtime for GC. For example, a loop usually has a conditional or unconditional branch at each of its back edge.
$LN10:
// loop body
test eax, eax
jne $LN10,
With this change the branch code will be changed to
cmp LoopHijackFlag, 0
jne $LNStub
$LNsource:
test eax, eax
jne $LN10
LNStub: (at the end of function)
call RhpLoopHijackX
jmp $LNsource;
A compare-and-jump is injected directly to the loop body while the hijacking code is placed at the end of the function since it's considered "cold code" assuming GC does not happened very often.
The global variable LoopHijackFlag is per module since we don't want to occupy or trash a register for it inside the loop.
The runtime helper RhpLoopHijackX is designed the preserve every register including callee-save registers and scratch registers so that no register used in the loop is trashed.
The transform happens very late in UTC in order not to affect the register allocation and to catch lower-introduced loops.
The change only works for Od mode for now. In Ox mode, a liveness analysis of up-exposed CC flag register use is needed so that the LoopHijackFlag check doesn't trash the CC register.
Testing:
The Nutc\BugFixes\BusyWait.proj test which is specifically designed to test this feature passed
No regression to other ToF tests
[tfs-changeset: 1669432]
|
|
Merge nmirror to master
|
|
|
|
FuncEvalCrossThreadDependency event
[tfs-changeset: 1667285]
|
|
[tfs-changeset: 1666575]
|
|
[tfs-changeset: 1664997]
|
|
- Fix initialization of stress log, cleaned up the overall initialization sequence
- Remove spurious NO_STRESSLOG definion that disabled some of the stresslogging
|
|
Currently, the threads that are detaching from or attaching to the runtime
can end up spinning for a long time in the ThreadStore lock for the entire
duration of a GC because the lock is held while GC is in progress. This
problem becomes quite visible when Windows thread pool injects a couple
hundreds of worker threads into a process.
This change fixes the problem by adding an option to the lock to block
spinning threads on the GC event if GC is in progress.
With this change, I see a couple percent improvement on micro-benchmarks.
|
|
Delete assert to verify asm get current thread implementation because it was not detecting potential bugs soon enough, required extra platform-specific asm code, and there are number of other asserts that will detect potential mismatch between C++ and asm current thread implementation (e.g. in RhpReversePInvokeAttachOrTrapThread2).
[tfs-changeset: 1622722]
|
|
|
|
- Reduce amount of assembly code in PInvoke helpers by moving all slow paths to C++
- Share code between the slow paths of assembly and portable helpers
- Improve performance of the portable helpers by making the access to current thread and the trap thread statics inlineable (e.g. the portable RhpReversePInvoke2 helper has only two extra instructions compared to what the hand-optimized assembly helper would have)
[tfs-changeset: 1605153]
|
|
1) Perf fix for thread attach during GC. The runtime holds the ThreadStore's ReaderWriterLock for the entire duration of a suspend-for-GC. This causes new threads to spin in the RWL code waiting on the GC to finish. I have added a check that shortcuts to the proper wait-on-an-event in this case.
2) Fix RhpCheckCctor2__SlowPath to properly preserve stack alignment on AMD64. This was found while experimenting with a PGO instrumented build of the runtime.
[tfs-changeset: 1602614]
|
|
This avoids hardcoded offsets that are incompatible with static linking and otherwise fragile.
[tfs-changeset: 1600424]
|
|
This checkin is an adaptation of a cache used in the type loader. It is applied to our type casting APIs and brings a significant performance improvement to any type-cast-heavy workload.
The cache has an initial tuning that looks reasonable, but should still be considered provisional as we gather more data on its behavior across various workloads.
[tfs-changeset: 1600411]
|
|
Fixing TODOs about collisions with the system assert.h header
[tfs-changeset: 1589045]
|
|
This change replaces usages of the uint thread id by EEThreadId at
places where we use it for thread matching. It also adds new
PAL function GetPalThreadIdForLogging that returns a numeric thread
id for logging purposes if the target platform supports it.
The reason for this change is that in pthreads, thread id is an
opaque struct and numeric id existence is platform specific.
|
|
The inline TLS access in Windows assembly code depends on hardcoded TLS offset. The hardcoded offset does not work well for static linking used by CoreRT because of it can be anything depending on what other thread local variables got linked in. I have changed the TLS access in ExceptionHandling.asm where it is causing problem right now to call the RhpGetThread instead.
|
|
This change abstracts the FLS usage for thread shutdown notification in PAL into a
general thread shutdown callback registration mechanism. It also implements its
Unix version.
|
|
|
|
- Add lookup of all RyuJIT intrinsics
- Update manage implementations of the intrinsics to fit with what RyuJIT is capable of
- Make intrinsic expansions by the codegen to be optional by providing fallback paths
- Fix USE_PORTABLE_HELPERS to be defined for portable runtime only
These changes are under CORERT ifdefs as necessary to be reconciled with .NET Native for UWP later.
|
|
Switched all uses of STATIC_ASSERT to static_assert and removed
the static_check.h header, since it wasn't very useful.
Removed orphaned method from Module class.
|
|
|
|
|
|
- Put back the RhpBulkWriteBarrier to the Windows asm files, but under ifndef CORERT
to keep them in for other projects.
- Moved the C++ implementation of the RhpBulkWriteBarrier to a new header file and
made it FORCEINLINE.
- Added VolatileLoadNoBarrier to to RhpBulkWriteBarrier
|
|
|
|
|
|
|
|
This change implements the Linux PAL for MRT, using mostly stubbed out functions.
|
|
This change enables compilation of the runtime excluding the PAL
layer on Linux.
Most of the changes are just to make it build with clang that's
more strict w.r.t. the C++11 standard.
In addition to that, I have removed our implementation of the
new / delete operators and replaced all calls to new in the
runtime by new (nothrow).
|
|
|
|
Provide specialized gcenv.h for CoreRT.
Some refactoring of related gcenv stuff.
Wire up finalizer code.
Add runtime-specific scanning code.
|
|
yet hooked up.
|
|
|