summaryrefslogtreecommitdiff
path: root/src/inc
AgeCommit message (Collapse)AuthorFilesLines
2019-02-14Replace multi-loaderallocator hash implementation in MethodDescBackpatchInfo ↵David Wrighton2-155/+155
(#22285) * GCHeapHash - Hashtable implementation for runtime use - Implementation written in C++ - Data storage in managed heap memory - Based on SHash design, but using managed memory CrossLoaderAllocatorHash - Hash for c++ Pointer to C++ pointer where the lifetimes are controlled by different loader allocators - Support for add/remove/visit all entries of 1 key/visit all entries/ remove all entries of 1 key - Supports holding data which is unmanaged, but data items themselves can be of any size (key/value are templated types) * Swap MethodDescBackpatchInfo to use the CrossLoaderAllocatorHash * The MethodDescBackpatchCrst needs to be around an allocation - Adjust the Crst so that it can safely be used around code which allocates - Required moving its use out from within the EESuspend logic used in rejit
2019-02-14Gnuport cleanup 3 (#22581)Sinan Kaya7-26/+25
* Reorder extern "C" and visibility statements In file included from coreclr/src/pal/inc/pal.h:70:0, coreclr/src/pal/inc/pal_mstypes.h:30:25: error: expected unqualified-id before string constant #define EXTERN_C extern "C" ^ coreclr/src/pal/inc/rt/palrt.h:216:30: note: in expansion of macro 'EXTERN_C' #define STDAPI_(type) EXTERN_C type STDAPICALLTYPE * Need double quotes around single quotes in error statements fix error statements Can't have ' character in error statement * Abstract __declspec(noinline) Generate compiler independent macros for noinline request. * Remove unused DBG_NOINLINE_X86__RET_INLINE * Abstract __declspec(nothrow)
2019-02-13Remove some CAS cruft (#22576)Aaron Robinson1-255/+0
* Update comment on SuppressUnmanagedCodeSecurityAttribute. * Remove unused declsec.h header.
2019-02-10Cleanup DLL exports (#22500)Jan Kotas2-53/+4
2019-02-09Set visibility option to hidden (#21924)Adeel Mujahid1-5/+4
2019-02-07Add config option to disable tier 0 JIT (#22370)Koundinya Veluri1-0/+1
Add config option to disable tier 0 JIT Fixes https://github.com/dotnet/coreclr/issues/21856 - For methods that don't have pregenerated code, using tier 0 JIT can improve startup perf, and disabling tier 0 JIT can be useful to sacrifice some startup time to avoid issues of running tier 0 code for too long. In some cases, it may also be desirable to avoid tiering up much later. - A fixed value for the call count indicates that tier 0 call counting is disabled. When disabled, the method starts at tier 1. - Also modified call counting to start from a predetermined threshold and count down to zero, as it simplifies some things, allows for methods to have different thresholds, and likely is what we would want eventually anyway - Took a small step towards eliminating knowledge of specific tier levels in code that should not care, though more is to be done there
2019-02-07Cleanup LLVM assumption (#22456)Sinan Kaya1-3/+3
We want to support GNU compilation for CoreCLR. Luckily both LLVM and GNU compilers define __GNUC__ and there are a lot of things they can share.
2019-02-03Throw the right exception when interface dispatch is ambiguous (#22295)Michal Strehovský1-0/+6
Throw the approved exception per dotnet/corefx#34124.
2019-02-01Coreclr gnuport (#22129)Sinan Kaya2-6/+20
* Abstract away NOINLINE statement MSVC and GNU compilers use different attributes for noinline. Abstract away compiler differences. * Replace __sync_swap with __atomic_exchange_n __sync_swap doesn't exist on GNU. Replacing with __atomic_exchange_n which is universally available. * Define CDECL for GNUC __cdecl is not defined by default on GNU compilers. * Define gcc version of __declspec(thread) * Correct pointer casting A pointer value is usually unsigned long on most platforms. Casting it to integer causes signedness issues. Use size_t to be efficient on all 32 and 64 bit architectures. * Put quotes around the error string Correct error statement. GNU G++ is picky about the string following the error statement with ' character in it. It needs to be enclosed with double quotes. * Fix casting problem Seeing these warnings with GNU G++ compiler src/pal/src/sync/cs.cpp: In function ‘void CorUnix::InternalInitializeCriticalSectionAndSpinCount(PCRITICAL_SECTION, DWORD, bool)’: src/pal/src/sync/cs.cpp:630:48: warning: converting to non-pointer type ‘SIZE_T {aka long unsigned int}’ from NULL [-Wconversion-null] pPalCriticalSection->OwningThread = NULL; ^ src/pal/src/sync/cs.cpp: In function ‘void CorUnix::InternalLeaveCriticalSection(CorUnix::CPalThread*, _CRITICAL_SECTION*)’: src/pal/src/sync/cs.cpp:880:43: warning: converting to non-pointer type ‘SIZE_T {aka long unsigned int}’ from NULL [-Wconversion-null] pPalCriticalSection->OwningThread = NULL; ^ * Abstract optnone compiler attribute GNU compiler doesn't support optnone attribute. pal/src/exception/seh-unwind.cpp:449:77: warning: ‘optnone’ attribute directive ignored [-Wattributes] * Set the aligned attribute for GNU compiler * Make __rotl and __rotr functions portable GNU compiler doesn't have an intrinsic for these. Open code them using the provided implementation. * Define deprecated attribute for gcc * Add throw specifier for GCC /usr/include/string.h:43:28: error: declaration of ‘void* memcpy(void*, const void*, size_t) throw ()’ has a different exception specifier size_t __n) __THROW __nonnull ((1, 2));
2019-01-30Fix CorError header file generation (#22294)Michal Strehovský1-1/+12
The checked in batch script was only usable if you have a Razzle environment and even then it didn't update the right files.
2019-01-29To support container scenario, 2 HardLimit configs are added - (#22180)Maoni Stephens1-0/+3
GCHeapHardLimit - specifies a hard limit for the GC heap GCHeapHardLimitPercent - specifies a percentage of the physical memory this process is allowed to use If both are specified, GCHeapHardLimit is checked first and only when it's not specified would we check GCHeapHardLimitPercent. If neither is specified but the process is running inside a container with a memory limit specified, we will take this as the hard limit: max (20mb, 75% of the memory limit on the container) If one of the HardLimit configs is specified, and the process is running inside a container with a memory limit, the GC heap usage will not exceed the HardLimit but the total memory is still the memory limit on the container so when we calculate the memory load it's based off the container memory limit. An example, process is running inside a container with 200mb limit user also specified GCHeapHardLimit as 100mb. if 50mb out of the 100mb is used for GC, and 100mb is used for other things, the memory load is (50 + 100)/200 = 75%. Some notes on these configs - + The limit is the commit size. + This is only supported on 64-bit. + For Server GC the minimum *reserved* segment size is 16mb per heap, this is to avoid the scenario where the hard limit is small but the process can use many procs and we end up with tiny segments which doesn't make sense. We then keep track of the committed on the segments so the total does not exceed the hard limit.
2019-01-26Cleanup stackoverflow handling leftovers (#22228)Jan Kotas3-73/+3
2019-01-24Remove no-op holder stack validation. (#22182)Filip Navara3-65/+22
2019-01-23Remove all traces of FEATURE_STACK_PROBE. (#22149)Filip Navara26-1274/+39
2019-01-18Add comments on headers that gets parsed by Mono linker for whoever touches ↵Sung Yoon Whang1-0/+8
this next (#22054) * Add comments on headers that gets parsed by Mono linker for whoever touches this next * add more comments to the targets file
2019-01-14Large version bubble Support (#21727)Andon Andonov4-2/+13
* Preliminary Changes * Module Index Resolution * Change infoModule encoding * Change referencing module in R2R * Pre-condition Check * Virtual Method Module Resolution * Remove Workarounds and add conditional import loading * Add signature kind module override * Add ELEMENT_TYPE_MODULE_ZAPSIG * Add switch to enable large version bubble * Cleanup * Change Native header check * Add large version bubble test * Add Large Version Bubble Checks * Cleanup * Revert unnecessary check * Change EncodeMethod Version Bubble Condition * Add Large Version Bubble asserts * Cleanup * Add default argument to runtests.py * Change test PreCommands * Revert whitespace changes * Change breaking conditional check * Streamline Version Bubble test * Address PR Feedback * Address PR Feedback #2 * Remove dead code * Add crossgen-time ifdef
2019-01-11Patch vtable slots and similar when tiering is enabled (#21292)Koundinya Veluri4-225/+245
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.
2019-01-10Normalize a few more spin-wait loops (#21586)Koundinya Veluri2-0/+223
Normalize a few more spin-wait loops - Fixed a few more spin-waits to normalize the spin-wait duration between processors - These spin-waits have so far not needed to be retuned to avoid unreasonably long spin-wait durations. They can be retuned as necessary in the future. - Added a version of YieldProcessorNormalized() that normalizes based on spin-wait counts tuned for pre-Skylake processors for spin-wait loops that have not been retuned. - Moved some files around to make YieldProcessorNormalized() and the like available in more places. Initialization is still only done in the VM. Uses outside the VM will use the defaults, where there would be no significant change from before. - Made YieldProcessor() private outside of the GC and added System_YieldProcessor() for when the system-defined implementation is intended to be used
2019-01-07Fix incorrect assignment of READYTORUN_HELPER_[Dbl|Flt][Rem/Round] (#21836)Tomáš Rylek1-4/+4
Turns out there's a long-standing typo in CoreCLR that reverses the helper enumeration values for DBL and FLT. This doesn't seem to be a problem in the CoreCLR repo as such because it solely uses the legacy identifiers CORINFO_HELP_DBLREM et al. We have however ported the incorrect helper enumeration values into R2RDump and ILCompiler. This change immediately fixes R2RDump as it resides in the same repo, I'll send out the ILCompiler change in a separate PR.
2018-12-26desktop port (#21523)Maoni Stephens2-2/+13
+alloc lock split into SOH and LOH +provisional mode to fix too many gen2 GCs triggered in low mem situation when the heap has heavy pinning fragmentation +better free list usage +premature OOM fixes +3 new configs: GCHeapAffinitizeMask, GCHighMemPercent, GCLOHThreshold (will be documented) YieldProcessor scaling factor is different on core due to the different implementation on core.
2018-12-21Improve removal of dead calls to allocator helpers.Eugene Rozenfeld1-6/+7
This change improves detection of allocators with side effects. Allocators can cause side effects if the allocated object may have a finalizer. This change adds a pHasSideEffects parameter to getNewHelper JitEE interface method. It's used by the jit to check for allocator side effects instead of guessing from helper ids. Fixes #21530.
2018-12-21Remove dead ICLRPrivBinder methods (#21637)Steve MacLean2-78/+0
* Remove dead FindAssemblyBySpec All paths returned E_FAIL * Remove dead BinderFlags * Remove dead VerifyBind
2018-12-18Fix stack walking and reporting of default interface methods (#21525)Michal Strehovský1-1/+2
Default interface methods in their unresolved state don't have a generic context. The generic context is only added once the method is resolved to its implementation.
2018-12-17Do not use CorHost2::m_fStarted to gate execution (#20953)Steve MacLean1-8/+3
* ExecuteInDefaultAppDomain w/o Start Do not require Start() call before calling ExecuteInDefaultAppDomain() * Remove unused variable * Move flags as needed to CorHost2
2018-12-17Add specialized allocation helpers (#21561)Michal Strehovský2-5/+11
This is to support dotnet/corert#6688. They don't exist in CoreCLR (yet).
2018-12-07Add support for loading registered TLBs (#21430)Aaron Robinson1-0/+6
* Add support for loading registered TLBs
2018-12-05Delete FEATURE_TREAT_NI_AS_MSIL_DURING_DIAGNOSTICS (#21387)Jan Kotas1-11/+0
Always defined in .NET Core
2018-12-03Refactor all FCalls out of AppDomain.cs (#21337)Jan Kotas1-1/+0
This saves the unmanaged->managed->unmanaged trip to initialize the assembly binder. Includes small bits of unrelated cleanup.
2018-12-03Merge pull request #21264 from fiigii/x64onlyCarol Eidt1-9/+11
Implement 64-bit-only hardware intrinsic
2018-12-03Remove IsNeutralDomain() (#21318)Steve MacLean1-2/+2
* Remove IsNeutralDomain() * PR feedback
2018-12-01Enable COM interop for collectible classes (#20919)Jan Vorlicek2-132/+138
* Enable COM interop for collectible classes * Modify DispatchInfo to use LoaderAllocator handles The DispatchMemberInfo was using global handles to refer to the managed MemberInfo instances. That doesn't work with unloadability. This change modifies it to use handles allocated from LoaderAllocator. * Disable COM interop for WinRT types * Remove collectible check from IsTypeVisibleFromCom. That fixes three new COM interop tests * Add collectible check to GetComClassFactory when we check for unsupported interop with WinRT * Add COM unloadability tests Add two tests to test COM unloadability: * One for using native COM server from managed COM client * One for using managed COM objects from native client * Add unloading test for IUnknownTest * Disable NETClientPrimitivesInALC on Win ARM The NETClientPrimitives is disabled there too.
2018-11-30Update how CoreDisTools is discovered (#21261)Aaron Robinson2-10/+3
* Update Disassembler logic to search for CoreDisTools next to binary _or_ under the path specified by CORE_ROOT * Update GCCover critical section
2018-11-29Update JIT/EE getMethodNameFromMetadata to get enclosing class nameFei Peng1-9/+11
2018-11-28Delete code related to LoaderOptimization and SharedDomain (#21031)Jan Kotas5-305/+138
2018-11-21Delete dead/unused code (#21138)Jan Kotas4-685/+0
2018-11-20Delete CORCOMPILE_IMPORT_TABLE_ENTRY (#21109)Jan Kotas2-16/+3
2018-11-19Make type comparisons more general purpose (#20940)Michal Strehovský2-13/+30
This has two parts: ## Part 1 CoreRT represents native type handles differently from CoreCLR - on CoreCLR, `RuntimeTypeHandle` is a wrapper over `RuntimeType` and RyuJIT is aware of that. On CoreRT, `RuntimeTypeHandle` wraps the native type handle, not a `RuntimeType`. The knowledge is hardcoded in importer when importing the sequence "ldtoken foo / call Type.GetTypeFromHandle" - importer just removes the call and bashes the result of ldtoken to be a reference type. CoreRT had to avoid reporting `Type.GetTypeFromHandle` as an intrinsic because of that. I'm adding another helper that lets RyuJIT avoid hardcoding that knowledge. Instead of just bashing the return type, we swap the helper call. ## Part 2 Native type handle equality checks need to go through a helper, unless the EE side says it's okay to compare native type handles directly.
2018-11-15Update CrstTypeTool to produce spaces (#21029)David Wrighton2-174/+178
2018-11-12Passing the CONTEXT in ICorDebugManagedCallback4::DataBreakpoint (#20960)Andrew Au1-3/+5
* Passing the CONTEXT in ICorDebugManagedCallback4::DataBreakpoint * ifdef out the message sending on configurations that does not support data breakpoint
2018-11-12LoadLibrary refactoring (#20841)Swaroop Sridhar1-0/+6
* Refactor LoadLibrary Methods This change refactors the code in DllImport in preparation for implementing the new NativeLibrary API here: dotnet/corefx#32015 The two main changes are: 1) A change in the semantics of the internal LoadLibrary helper functions. When a native library is loaded, there are two categories of callers expecting different return values: External callers like AssemblyNative::InternalLoadUnmanagedDllFromPath() and the upcoming System.Runtime.Interop.Marshall.LoadLibrary() need the raw system handle Internal callers like LoadLibraryModule() need the PAL registered handle This change modifies the internal LoadLibraryModule* methods to work in terms of native system handles, so that external callers can obrain them directly. Methods requiring PAL-handles can register them explicitly. There is no change in external signature of DllImport class, or the native Dll cache in AppDomain class. 2) Differentiate HMODULE and NATIVE_LIBRARY_HANDLE This change defines NATIVE_LIBRARY_HANDLE type to represent raw system handles to native libraries that are not registered with the PAL (On Unix systems). The types on PAL and DlImport methods are adjusted to make this semantic distinction explicit. * Fix loading LibC via PAL_LoadLibraryDirect()
2018-11-12Allow jit to examine type of initonly static ref typed fields (#20886)Andy Ayers1-5/+21
The jit incorporates the value of integer and float typed initonly static fields into its codegen, if the class initializer has already run. The jit can't incorporate the values of ref typed initonly static fields, but the types of those values can't change, and the jit can use this knowledge to enable type based optimizations like devirtualization. In particular for static fields initialized by complex class factory logic the jit can now see the end result of that logic instead of having to try and deduce the type of object that will initialize or did initialize the field. Examples of this factory pattern in include `EqualityComparer<T>.Default` and `Comparer<T>.Default`. The former is already optimized in some cases by via special-purpose modelling in the framework, jit, and runtime (see #14125) but the latter is not. With this change calls through `Comparer<T>.Default` may now also devirtualize (though won't yet inline as the devirtualization happens late). Also update the reflection code to throw an exception instead of changing the value of a fully initialized static readonly field. Closes #4108.
2018-11-09Delete dead/unreachable code related to remoting (#20880)Jan Kotas2-34/+0
2018-11-08Revert "Passing the CONTEXT in ICorDebugManagedCallback4::DataBreakpoint"Jan Kotas1-5/+3
This reverts commit 9dd2a3688320fa197a3a2a412523416f10e7fa3b.
2018-11-08Passing the CONTEXT in ICorDebugManagedCallback4::DataBreakpointAndrew Au1-3/+5
2018-11-08EventPipe support for "Parameters" (#20796)José Rivero1-25/+27
These changes enable passing "arguments" to an EventSource.
2018-11-06Pull out GetContainingObjectAndrew Au1-22/+0
2018-11-06GetContainingObject should be a method of ICorDebugValueAndrew Au1-15/+22
2018-11-06Change GetContainingObject APIAndrew Au1-4/+4
2018-11-06Fix ARM compilation issueAndrew Au1-0/+1
2018-11-06Fix a couple bugs in GetContainingObjectAndrew Au1-4/+5