summaryrefslogtreecommitdiff
path: root/src/vm/generics.cpp
AgeCommit message (Collapse)AuthorFilesLines
2019-01-11Patch vtable slots and similar when tiering is enabled (#21292)Koundinya Veluri1-1/+2
Patch vtable slots and similar when tiering is enabled For a method eligible for code versioning and vtable slot backpatch: - It does not have a precode (`HasPrecode()` returns false) - It does not have a stable entry point (`HasStableEntryPoint()` returns false) - A call to the method may be: - An indirect call through the `MethodTable`'s backpatchable vtable slot - A direct call to a backpatchable `FuncPtrStub`, perhaps through a `JumpStub` - For interface methods, an indirect call through the virtual stub dispatch (VSD) indirection cell to a backpatchable `DispatchStub` or a `ResolveStub` that refers to a backpatchable `ResolveCacheEntry` - The purpose is that typical calls to the method have no additional overhead when code versioning is enabled Recording and backpatching slots: - In order for all vtable slots for the method to be backpatchable: - A vtable slot initially points to the `MethodDesc`'s temporary entry point, even when the method is inherited by a derived type (the slot's value is not copied from the parent) - The temporary entry point always points to the prestub and is never backpatched, in order to be able to discover new vtable slots through which the method may be called - The prestub, as part of `DoBackpatch()`, records any slots that are transitioned from the temporary entry point to the method's at-the-time current, non-prestub entry point - Any further changes to the method's entry point cause recorded slots to be backpatched in `BackpatchEntryPointSlots()` - In order for the `FuncPtrStub` to be backpatchable: - After the `FuncPtrStub` is created and exposed, it is patched to point to the method's at-the-time current entry point if necessary - Any further changes to the method's entry point cause the `FuncPtrStub` to be backpatched in `BackpatchEntryPointSlots()` - In order for VSD entities to be backpatchable: - A `DispatchStub`'s entry point target is aligned and recorded for backpatching in `BackpatchEntryPointSlots()` - The `DispatchStub` was modified on x86 and x64 such that the entry point target is aligned to a pointer to make it backpatchable - A `ResolveCacheEntry`'s entry point target is recorded for backpatching in `BackpatchEntryPointSlots()` Slot lifetime and management of recorded slots: - A slot is recorded in the `LoaderAllocator` in which the slot is allocated, see `RecordAndBackpatchEntryPointSlot()` - An inherited slot that has a shorter lifetime than the `MethodDesc`, when recorded, needs to be accessible by the `MethodDesc` for backpatching, so the dependent `LoaderAllocator` with the slot to backpatch is also recorded in the `MethodDesc`'s `LoaderAllocator`, see `MethodDescBackpatchInfo::AddDependentLoaderAllocator_Locked()` - At the end of a `LoaderAllocator`'s lifetime, the `LoaderAllocator` is unregistered from dependency `LoaderAllocators`, see `MethodDescBackpatchInfoTracker::ClearDependencyMethodDescEntryPointSlots()` - When a `MethodDesc`'s entry point changes, backpatching also includes iterating over recorded dependent `LoaderAllocators` to backpatch the relevant slots recorded there, see `BackpatchEntryPointSlots()` Synchronization between entry point changes and backpatching slots - A global lock is used to ensure that all recorded backpatchable slots corresponding to a `MethodDesc` point to the same entry point, see `DoBackpatch()` and `BackpatchEntryPointSlots()` for examples Due to startup time perf issues: - `IsEligibleForTieredCompilation()` is called more frequently with this change and in hotter paths. I chose to use a `MethodDesc` flag to store that information for fast retreival. The flag is initialized by `DetermineAndSetIsEligibleForTieredCompilation()`. - Initially, I experimented with allowing a method versionable with vtable slot backpatch to have a precode, and allocated a new precode that would also be the stable entry point when a direct call is necessary. That also allows recording a new slot to be optional - in the event of an OOM, the slot may just point to the stable entry point. There are a large number of such methods and the allocations were slowing down startup perf. So, I had to eliminate precodes for methods versionable with vtable slot backpatch and that in turn means that recording slots is necessary for versionability.
2018-12-03Remove IsNeutralDomain() (#21318)Steve MacLean1-1/+0
* Remove IsNeutralDomain() * PR feedback
2018-11-09Delete dead/unreachable code related to remoting (#20880)Jan Kotas1-17/+0
2018-10-07Remove some dead remoting and context static things (#20277)Austin Wise1-3/+0
* Remove IsRemotingIntercepted methods that always return false. * Remove GetOptionalMembersAllocationSize parameters that are always false. * Remove references to context static. Remove references in comments and methodnames. * Remove RemotingVtsInfo.
2018-10-05Remove context statics stuff (#20256)Jan Vorlicek1-6/+0
* Remove context statics stuff part 1 This change removes all context statics stuff from the runtime since context statics are not supported and this code was obsolete. * Remove context statics stuff from the debugger code
2018-10-04Enable thread statics for collectible classes (#19944)Jan Vorlicek1-3/+2
* Enable thread statics for collectible classes This change removes checks that were preventing usage of thread statics in collectible classes and also implements all the necessary changes. The handles that hold arrays with thread statics are allocated from LoaderAllocator for collectible classes instead of using the global strong handle like in the case of non-collectible classes. The change very much mimics what is done for regular statics. This change also adds ability to reuse freed handles to the LoaderAllocator handle table. Freed handle indexes are stored into a stack and when a new handle allocation is requested, the indices from this stack are used first. Due to the code path from which the FreeTLM that in turn frees the handles is called, I had to modify the critical section flags and also refactor the handle allocation so that the actual managed array representing the handle table is allocated out of the critical section. When I was touching the code, I have also moved the code that was dealing with handles that are not stored in the LoaderAllocator handle tables out of the critical section, since there is no point in having it inside of it.
2018-06-29Remove relocations for vtable chunks (#17147)Gleb Balykov1-2/+2
* Separate sections READONLY_VCHUNKS and READONLY_DICTIONARY * Remove relocations for second-level indirection of Vtable in case FEATURE_NGEN_RELOCS_OPTIMIZATIONS is enabled. Introduce FEATURE_NGEN_RELOCS_OPTIMIZATIONS, under which NGEN specific relocations optimizations are enabled * Replace push/pop of R11 in stubs with - str/ldr of R4 in space reserved in epilog for non-tail calls - usage of R4 with hybrid-tail calls (same as for EmitShuffleThunk) * Replace push/pop of R11 for function epilog with usage of LR as helper register right before its restore from stack
2018-02-22Remove relocations for MethodTable::m_pParentMethodTable for Linux ARM (#15915)gbalykov1-0/+1
2018-01-13Revert "Remove relocations for MethodTable::m_pParentMethodTable for Linux ARM"Jan Kotas1-1/+1
This reverts commit cf1fb9e17fc8b6ee849edab5a696d0ec5c6eadd2.
2017-07-10Remove relocations for MethodTable's vtable-1st-level-indirectionGleb Balykov1-2/+2
2017-07-10Remove relocations for MethodTable::m_pParentMethodTable for Linux ARMGleb Balykov1-1/+1
2017-07-10Remove relocations for MethodTable::m_pPerInstInfo for Linux ARMGleb Balykov1-2/+3
2017-06-12[Arm64/Unix] Add 64K page support (#10981)Steve MacLean1-2/+2
* [Arm64/Unix] Support 64K pages * GC move GCToOSInterface::Initialize() into InitializeGarbageCollector()
2017-05-22Delete default copy/move constructors and assignment operators of ↵Ruben Ayrapetyan1-2/+1
RelativePointer and RelativeFixupPointer. (#11745)
2017-02-14Remove never defined FEATURE_REMOTINGdanmosemsft1-44/+0
2016-06-13Refactor MethodTable::ContainsStackPtr (#5754)Jan Kotas1-1/+1
- 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-01-27Update license headersdotnet-bot1-4/+3
2015-01-30Initial commit to populate CoreCLR repo dotnet-bot1-0/+1146
[tfs-changeset: 1407945]