summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2019-01-19Fix CoreCLR build for changes in shared partitionJan Kotas7-165/+84
2019-01-19Fix build for ProjectN/WinRTInterop Delete superfluous AsyncCausalityTracer ↵Jan Kotas5-51/+49
arguments Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
2019-01-19Fix buildMarek Safar2-2/+2
Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
2019-01-19Cleanup: Remove MethodDesc::GetLoaderAllocatorForCode (#22067)Jan Vorlicek12-30/+16
This function was recently changed to just return the MethodDesc::GetLoaderAllocator. This is a cleanup that removes the function completely and replaces all of its usages.
2019-01-19Removed unused 'Stack Walking' code (#22039)Matt Warren1-43/+0
As fair as I can tell `ECWGCFCrawlCallBack(..)` is not wired-up anywhere (I've successfully compiled CoreCLR locally with this change under `x86` and `x64`)
2019-01-18Fix calling conventions on reverse PInvoke callbacks. (#22044)Jeremy Koritzinsky1-2/+3
2019-01-18SuperPMI Collect/Replay/AsmDiff tool (#21252)Jarret Shook2-3/+11
This change adds superpmi.py. The tool feature three modes, collection, replay, and asmdiffs. Collection The collection logic is very similar to the logic in our superpmi-collect test. Mostly it just allows running a script which will run managed code and it will produce a .mch which is clean to be run against. See superpmi.md for more information on specific usage and problems. Replay Replay will take an existing .mch file and run the current jit over the collection. If there is no .mch file on disk, the script will download the latest collection and run against that. AsmDiffs superpmi.md has the latest information on what platforms support asmdiffs. So far, I have an updated OSX and Windows collection that I have run against. If there are binary diffs, the tool will automatically generate base & diff folders with the asm under each one. Future work would include automatically running jit-analyze over those locations. In addition, the tool has the option to automatically run and diff jit dumps, I have found this to be useful to looking into diffs created, as re-running superpmi with different jits to collect this same information is somewhat tedious. Future work This change is in no way the end of the work needed to leverage superpmi effectively. Instead, it is a good first step. Below are some suggestions for future superpmi work: Automated collections Add pmi collection support Leverage some of the new corefx work to use superpmi shim for collections of corefx runs To be added/changed I will unset zapdisable being set by default, it creates too much data, although it is useful it should be opt in Will include example usage in superpmi.md.
2019-01-18Move AsyncCausality to shared partition (#22062)Marek Safar6-74/+87
* Move AsyncCausality to shared partition * Set FeatureAsyncCausalityTracer property
2019-01-18Add Per-assembly Load Native Library callbacks (#21555)Swaroop Sridhar9-70/+256
Add Per-assembly Load Native Library callbacks This Change implements the Native Library resolution Call-backs proposed in https://github.com/dotnet/corefx/issues/32015
2019-01-18Enable detection of HW intrinsics (dotnet/corert#6836)Michal Strehovský25-4/+81
I took the liberty of marking the types containing the hardware intrinsics as [Intrinsic] to avoid doing a name check on everything in the system module. It feels like we should take advantage of this attribute in CoreCLR too. This doesn't actually enable the support because RyuJIT unconditionally disables HW intrinsics for prejit (both CoreRT and CPAOT are considered prejit). We might want to do something about this on the RyuJIT side to address that (for CPAOT, to be able to pregenerate best code possible ahead of time, assuming a fixed ISA; and for CoreRT without JIT, where the concerns about AVX-SSE penalty don't apply). See conversation in dotnet/coreclr#21603 Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
2019-01-18Fix defines in TaskAwaiter (dotnet/corert#6846)Marek Safar1-34/+34
Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
2019-01-18Handle complex constrained calls with default interface methods (#21978)Michal Strehovský3-0/+33
This adds handling for the interface dispatch corner case where: * We have a constrained callsite to a method on a generic interface in shared code * The callsite cannot be statically resolved because the result of dispatch depends on the generic context * At runtime, the dispatch resolves to a default interface method This would require us to have infrastructure to build "boxing thunks" - thunks that would box their first argument before dispatching to the default interface method implementation. Since this is a corner case and the fix is actually quite involved, we're making the runtime just throw in this situation. The test is written so that it should pass both if the runtime chooses to throw, or if the runtime makes the boxing thunk (we're not hardcoding the implementation limitation).
2019-01-18Use correct resolution scope when checking default implementations (#22036)Michal Strehovský1-3/+5
We need to use the module of the interface. Fixes #22021.
2019-01-18Add comments on headers that gets parsed by Mono linker for whoever touches ↵Sung Yoon Whang5-1/+34
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-17Move Environment to shared CoreLib (dotnet/corefx#34654)Stephen Toub41-0/+2737
Rather than having Environment partially live in corefx and call into an EnvironmentAugments type in CoreLib that in turn calls into an Environment type in CoreLib, we're just moving Environment to live in CoreLib. To start that, this PR moves Environment and its dependencies from their current locations into the shared CoreLib. Those changes will mirror over to coreclr. After that, I'll fix it up to work in CoreLib. And once those changes are built and available back to corefx, I'll update System.Runtime.Extensions to just use the functionality from CoreLib and delete remaining unnecessary code from corefx. Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
2019-01-17Remove ToString from RuntimeAssembly.GetManifestResourceStream (#22012)Stephen Toub2-4/+10
* Remove ToString from RuntimeAssembly.GetManifestResourceStream A small allocation we can avoid with the span-based string.Concat. * Address PR feedback
2019-01-17Split ContractsBCL into separate classes and move them to shared CoreLib ↵Filip Navara9-407/+368
(#22006) * Split up ContractsBCL into separate classes. * Move remaining Contract, ContractHelper code to shared partition. * Split ContractHelper to allow custom debugging experience in CoreRT. * Simplify ContractHelper.InternalContractFailed. * Use resource loading code from CoreRT. * Remove unused parameter.
2019-01-17Clean up a few minor Span-related uses (#22038)Stephen Toub6-10/+10
Some unnecessary Span to ReadOnlySpan casts. Some places where new Span(...).Slice(...) can be replaced with AsSpan(...). Etc.
2019-01-17Remove a few stale resource strings for ConcurrentStack (#22037)Stephen Toub1-9/+0
2019-01-17Avoid allocations in Utf8Formatter.TryFormat(float/double, ...) (#22011)Stephen Toub2-41/+81
* Avoid allocations in Utf8Formatter.TryFormat(float/double, ...) Currently every call to Utf8Formatter.TryFormat for a float or a double allocates two strings, one for the format string and one for the resulting number. This avoids those in the common case where we can use float/double.TryFormat and format directly into a stack buffer. Also removes some unsafe code; the performance of StandardFormat.ToString isn't currently worth the extra nanoseconds gained by using unsafe code. * Delete assert There's a test that uses unsafe code to cause this to fail and validate that no exception is thrown.
2019-01-17Fix AsyncMethodBuilder build on Mono (#22034)Marek Safar1-1/+1
2019-01-17Fix CoreCLR build of AsyncMethodBuilder.Filip Navara1-5/+9
2019-01-17Add new members to AsyncCausalitySupport.Filip Navara3-1089/+13
Remove file moved to shared partition. Fix builds without FeatureCominterop.
2019-01-17Move AsyncMethodBuilder to shared. (dotnet/corert#6832)Filip Navara3-0/+1140
* Move AsyncMethodBuilder to shared. * Bring back PROJECTN. * #if-out TrackAsyncMethodCompletion for CoreRT. Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
2019-01-16Merge pull request #21997 from BruceForstall/FixFpRelativeInstructionsBruce Forstall1-7/+12
Fix two cases of FP-relative immediate offsets possibly not encodable
2019-01-16Reduce steps for string.Contains(string value) (#22008)Ben Adams1-3/+8
2019-01-16 Fix imm-operand encoding for SSE/AVX instructions (#21999)Fei Peng1-8/+24
* Move more SSE2 tests to the template * Improve Insert test template to involve more codegen situations * Fix imm-operand encoding for SSE/AVX instructions
2019-01-15String -> stringJan Kotas8-16/+16
2019-01-15Delete files moved to shared partitionJan Kotas6-224/+0
2019-01-15Move more COM exceptions to shared partition (dotnet/corert#6829)Marek Safar6-0/+212
Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
2019-01-15Fix two cases of FP-relative immediate offsets not being checked for ↵Bruce Forstall1-7/+12
encodability For ARM32/ARM64, the immediate offsets in addressing modes have limited range that varies by instruction. A couple cases were not checking for that range, leading to generating potentially un-encodable instruction. In particular, the test case shows a case where a very large frame in a function with a stored generic context would fail on ARM64. There are no code diffs from this change for ARM64, except we sometimes get better assembly comments where the local variable referenced is annotated on the store instruction. For ARM32, the "secret stub param" is now stored using SP-relative addressing, not FP-relative, if possible (which we generally prefer in main function bodies).
2019-01-15On SIGTERM default to a non-zero exit code (#21300)Tom Deseyn6-91/+130
* On SIGTERM default to a non-zero exit code * Fix Windows builds * Improve SIG_DFL/SIG_IGN handling * Remove PAL_GetTerminationExitCode * Use sa_handler/sa_sigaction based on SA_SIGINFO; remove HAVE_SIGINFO_T. * configure.cmake: remove siginfo_t check * Move restore_signal_and_resend so OSX can use it; add function documentation * Fix OSX build: include pal/process.h for gPID * Check SIG_IGN and SIG_DFL against sa_handler * Don't use sa_handler when SA_SIGINFO is set * Fix equality check * Swap order of checking SA_SIGINFO and SIG_IGN/SIG_DFL
2019-01-15Merge pull request #21963 from BrianBohe/masterJuan Hoyos1-8/+1
Remove unreachable code
2019-01-15allocate the right number of slots for the handle table when number of ↵David Mason1-1/+1
processors > 64 (#21992)
2019-01-14Large version bubble Support (#21727)Andon Andonov21-31/+139
* 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-14Finding Standalone GC and CoreDisTools in non-standard host testing (#21983)Aaron Robinson2-57/+24
* Use GetInternalSystemDirectory() as the directory for standalone GC * Use GetInternalSystemDirectory() as the directory for coredistools
2019-01-14Improvements for object stack allocation.Eugene Rozenfeld9-78/+320
This change enables object stack allocation for more cases. 1. Objects with gc fields can now be stack-allocated. 2. Object stack allocation is enabled for x86. ObjectAllocator updates the types of trees containing references to possibly-stack-allocated objects to TYP_BYREF or TYP_I_IMPL as appropriate. That allows us to remove the hacks in gcencode.cpp and refine reporting of pointers: the pointer is not reported when we can prove that it always points to a stack-allocated object or is null (typed as TYP_I_IMPL); the pointer is reported as an interior pointer when it may point to either a stack-allocated object or a heap-allocated object (typed as TYP_BYREF); the pointer is reported as a normal pointer when it points to a heap-allocated object (typed as TYP_REF). ObjectAllocator also adds flags to indirections: GTF_IND_TGTANYWHERE when the indirection may be the heap or the stack (that results in checked write barriers used for writes) or the new GTF_IND_TGT_NOT_HEAP when the indirection is null or stack memory (that results in no barrier used for writes).
2019-01-14Removing noisy R2R compilation outputs, and putting them under the /verbose ↵Fadi Hanna2-17/+34
switch (#21987)
2019-01-14Custom Marshalers in custom-ALC-loaded assemblies results in types loaded ↵Jeremy Koritzinsky15-142/+157
from crossing ALCs (#21606) * Create repro for dotnet/coreclr#19654 * Update ICustomMarshaler.csproj * Update ICustomMarshaler.csproj * Clean up repro per feedback. * Add test case for different assemblies with the same CustomMarshaler name. * Move EEMarshalingData cache from AppDomain to LoaderAllocator. This fixes the custom-marshaler conflict when using unloadable assembly contexts. * Internalize the LoaderHeap* parameter. * Add the pointer to the requesting assembly to the hashtable key. * Fix linux-musl build break. * Move Crst out of FEATURE_COMINTEROP block. * Make sure to copy over the assembly pointer to the key that's actually stored in the hash table. * Add comment for m_invokingAssembly. * Move all usages of EEMarshallingData to hang off the correct loader allocator instead of always the global one. * Change to m_InteropDataCrst since this EEMarshallingData can be used in preemptive GC mode. * Always init m_InteropDataCrst (since it's used by EEMarshallingData as well as COM). * PR Feedback. * Remove extraneous inlines.
2019-01-14Fix TimeSpan parsing (#21968)Tarek Mahmoud Sayed1-39/+46
* Fix TimeSpan parsing * Temporary disabling the failed CI tests
2019-01-14Fix TaskCompletionSource to avoid capturing ExecutionContext (#21981)Stephen Toub1-4/+4
When a TaskCompletionSource is constructed without any arguments, it simply creates a Task using a simple Task constructor that sets a few fields and is done. When it's constructed with options, though, those options are validated, and then it calls into a shared routine that configures based on those options. A previous set of changes resulted in erroneously doing the ExecutionContext.Capture for the task inside of that shared routine, rather than only doing it for tasks that actually have a delegate to be executed. The net effect of this is that, while TaskCompletionSources created with the parameterless constructor correctly did not capture ExecutionContext, TaskCompletionSources created with options erroneously did; this doesn't have a functional impact, because that ExecutionContext isn't used for anything, but it can have a performance impact, in particular for memory, if the resulting Task is cached, and if the captured ExecutionContext holds onto some expensive object from an AsyncLocal, such that the cached Task then does so, too. The fix is simply to move the capture from the shared routine that's invoked in two places to instead be done only in the one caller that's for tasks with delegates.
2019-01-14Making sure the nativeCodeVersion flowing change works with Rejit and EnC ↵Andrew Au1-1/+11
(#21961)
2019-01-12Add NativeLibrary Resolve Event (#21929)Swaroop Sridhar5-29/+152
This change adds the Native library resolving event, to be raised as the last attempt to resolve a native DLL in an AssemblyLoadContext. With this change, the DllImport resolution sequence is as follows (stopping at any step with successful resolution): * If the invoking-assembly is not in the default load context, call AssemblyLoadContext.LoadUnmanagedDll() * Run the default load logic, try loading from: * AppDomain cache * NATIVE_DLL_SEARCH_DIRECTORIES * Invoking-assembly directory, System32, etc. based on DllImportSearchPaths * Raise the ResolvingUnmanagedDll event API Review: https://github.com/dotnet/corefx/issues/32850 The ResolveEventTests triggered a pre-existing bug in the exception handling code (#21964). Disabling the test on ARM64 Windows until the issue is fixed.
2019-01-12Add System.Reflection.Emit.DynamicILInfo (#21945)Maryam Ariyan2-1/+108
* Making DynamicILInfo and its API impls public * Remove DynamicScope input from ctor args
2019-01-11Fix x64 CFI generation (#21955)Andrey Kvochko1-0/+3
2019-01-11Patch vtable slots and similar when tiering is enabled (#21292)Koundinya Veluri41-524/+2002
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-11Merge pull request #21795 from fiigii/fixGenericCarol Eidt4-87/+54
Remove unnecessary ThrowIfUnsupportedType calls and definitions
2019-01-11Generate non-null assertion for byrefs if we can't find corresponding refs.Eugene Rozenfeld1-2/+3
When we have a non-null fact about a byref, we try to find the corresponding ref and generate an assertion about the ref. Then it can be used on byrefs if the offset is not too big. We use both trees and value numbers to find the ref. When the ref wasn't found we bailed on generating the assertion. I found that we get a number of good diffs if we generate assertions for byrefs when refs can't be found so this change enables that.
2019-01-11Add missing overrides to SyncTextWriter (#21956)Stephen Toub1-6/+54
Several recently added virtuals to TextWriter were missing overrides on SyncTextWriter. We were missing overrides of the synchronous `Write(ReadOnlySpan<char>)` and `WriteLine(ReadOnlySpan<char>)` overloads. The impact here is primarily performance, though it'll still be an observable change in corner-case scenarios: rather than using the base implementation which would copy the span to an array and then invoke the properly overridden array-based Write{Line} methods, it'll now just delegate to the wrapped span methods. So it calls the correct overload now on the wrapped instance, and saves some cost in the process. We were also missing overrides for the async `WriteLineAsync()`, `WriteAsync(ReadOnlyMemory<char>, CancellationToken)`, WriteLineAsync(ReadOnlyMemory<char>, CancellationToken)` overloads. Fixing these doesn't change the overload that's invoked on the wrapped writer, but it does cause the calls to become synchronous rather than queue a task that in turn calls the synchronized overload. Whether the new behavior is better is arguable, but it keeps it consistent with every other XxAsync method on SyncTextWriter, which in my opinion is more important... if we wanted to alter the behavior for all of the XxAsync methods, we should do it for all of them. Also, in the StringBuilder-based overrides, we were ignoring cancellation. And in the recently added DisposeAsync, we should follow-suit with the rest of the async APIs and make it synchronous.
2019-01-11Remove unreachable codeBrian Bohe1-8/+1