summaryrefslogtreecommitdiff
path: root/src/vm/jitinterface.cpp
AgeCommit message (Collapse)AuthorFilesLines
2019-11-22Non virtual calls to instance methods non-virtual dispatch on instance ↵David Wrighton1-1/+1
interface methods (#27756) (#27868) * est for non_virtual_calls_to_instance_methods * Fix handling of callvirt to instance methods on interface types that are not virtual - Use call type to indicate if its non-virtual or not, instead of opcode * Use ilproj to protect against future C# compiler changes - This test needs to test the use of specific opcodes, and so an IL proj is required
2019-07-11Fix GS cookie check on ARM in functions with stackalloc (#25628)Jan Vorlicek1-0/+3
* Fix GS cookie check on ARM in functions with stackalloc The GC cookie check was failing during GC stack walking on ARM for frames of functions using stackalloc and pinvoke. The InlinedCallFrame stores only the SP after the stackalloc adjustment and unwinder needs R9 that contains SP before the stackalloc to be able to unwind the frame to get caller SP. The caller SP is used as a base for getting the GS cookie address. We were incorrectly setting the R9 in the CONTEXT to the same value as SP and so the unwinding was getting an incorrect caller SP. The fix is to store R9 in the InlinedCallFrame for ARM.
2019-07-03Fix GCStress modes that do code instrumentation to work with code versioning ↵Koundinya Veluri1-0/+24
(#25261) - SOS changes are in https://github.com/dotnet/diagnostics/pull/369 - Fixes https://github.com/dotnet/coreclr/issues/17646
2019-06-24Throw platform unsupported error for windows arm32 varargs (#25320)Jarret Shook1-2/+2
* Throw unsupported platform for native vcarargs on Arm32 Windows * Re-enable baseservices vararg test
2019-06-20Fix eventpipe filtering (#25221)Sung Yoon Whang1-2/+2
* Add DOTNET_TRACE_CONTEXT and change macros to use DOTNET_TRACE_CONTEXT instead of MCGEN_TRACE_CONTEXT * Fixing macro definitions * eventing codegen scripts now generates EventPipe trace contexts * Fix macros to use the EVENTPIPE_TRACE_Context * Fix linux build * Fix windows build * Update Eventpipe provider context at EtwCallbackComon * break in switch * Update rundown provider context manually * PR feedback * Eventpipe->EventPipe * cleanup in codegen script
2019-06-14Optimize Activator.CreateInstance (#25145)Jan Kotas1-25/+53
* Optimize Activator.CreateInstance - Short-circuit Activator.CreateInstance<T>() for value types without default constructor - Cache default constructor delegate on RuntimeType instead of fixed-size singleton cache
2019-05-24Remove dependency on IEEMemoryManager (#24755)Jan Kotas1-15/+2
2019-05-23Add some perf events/data for tiered compilation (#24607)Koundinya Veluri1-5/+19
Add some perf events/data for tiered compilation New events: - `Settings` - Sent when TC is enabled - `Flags` - Currently indicates whether QuickJit and QuickJitForLoops are enabled - `Pause` - Sent when TC is paused (due to a new method being called for the first time) - `Resume` - Sent when TC resumes - `NewMethodCount` - Number of methods called for the first time while tiering was paused - `BackgroundJitStart` - Sent when starting to JIT methods in the background - `PendingMethodCount` - Number of methods currently scheduled for background JIT - `BackgroundJitStop` - Sent when background jitting stops - `PendingMethodCount` - Same as above. When 0, background jitting has completed. - `JittedMethodCount` - Number of methods jitted in the background since the previous BackgroundJitStart event on the same thread Miscellaneous: - Updated method JIT events to include the optimization tier - Added a couple more cases where tiered compilation is disabled for methods that have JIT optimization disabled for some reason - Renamed `Duration` field of the new version of the `ContentionEnd` to `DurationNs` to indicate the units of time - Added `OptimizationTierOptimized` to `NativeCodeVersion::OptimizationTier` to distinguish it from `OptimizationTier1`. `OptimizationTierOptimized` is now used for methods that QuickJit is disabled for, and does not send the tier 1 flag. - For info about the code being generated by the JIT, added info to `PrepareCodeConfig` and stored a pointer to it on the thread object for the current JIT invocation. Info is updated in `PrepareCodeConfig` and used for updating the tier on the code version and for sending the ETL event. - If the JIT decides to use MinOpt when `MethodDesc::IsJitOptimizationDisabled()` is false, the info is not stored. The runtime method event will reflect the JIT's choice, the rundown event will not. - Updated to show optimization tiers in SOS similarly to PerfView
2019-05-22Track debug info for DynamicMethods for Profiler API (#24139)Mukul Sabharwal1-2/+2
2019-05-13Profiler API to request ReJIT with inliners (#24461)David Mason1-2/+46
This API is necessary for attaching profilers to be able to ReJIT methods and replace everything that uses the old IL.
2019-05-09Merge pull request #24456 from briansull/ibc-workBrian Sullivan1-18/+18
IBC refactor - Zero Diff, rename types and methods
2019-05-08Fix 23317. (#24383)Fadi Hanna1-13/+22
The issue is that a LDVIRTFTN operation becomes a dictionary lookup to a direct call to an abstract function with no code. We AV later when executing the PreStub of that direct call. Fixed by making this a dictionary lookup to a MethodDescSlot lookup, followed by the call to the JIT_VirtualFunctionPointer helper to resolve the target code (Same logic executing in jitted IL mode)
2019-05-08Remove more MDA support code (#24457)Steve MacLean1-2/+0
* Remove more MDA support code * PR Feedback
2019-05-08Prefer UINT32 over DWORD in the IBC BlockCount API'sBrian Sullivan1-6/+6
2019-05-07Rename struct ICorJitInfo::ProfileBuffer to ICorJitInfo::BlockCountsBrian Sullivan1-18/+18
Rename method ICorJitInfo::allocBBProfileBuffer to ICorJitInfo::allocMethodBlockCounts Rename method ICorJitInfo::getBBProfileData to ICorJitInfo:"getMethodBlockCounts Rename args and use DWORD instead of ULONG for ICorJitInfo:allocMethodBlockCounts and ICorJitInfo:getMethodBlockCounts Rename Compiler::fgProfileBuffer to Compiler::fgBlockCounts Use an #ifdef FEATURE_CORECLR to fix the missing CORINFO_FLG_DISABLE_TIER0_FOR_LOOPS flag on the desktop. Make fgBlockCountsCount and fgNumProfileRuns DWORDs instead of ULONGs Rename local var bbCurrentBlockProfileBuffer to currentBlockCounts Rename local var bbProfileBufferStart to profileBlockCountsStart Use DWORD when iterating over BlockCounts instead of ULONG Rename ZapImage::hashBBProfileData to ZapImage::hashMethodBlockCounts SuperPMI - Fixed all references to allocBBProfileBuffer => allocMethodBlockCounts SuperPMI - fixed all reference to getBBProfileBuffer => getMethodBlockCounts
2019-05-03Fix incorrect tier reported by SOS (#24374)Koundinya Veluri1-1/+1
Fix incorrect tier reported by SOS - The tier of the initial code version was being assumed to be 0 - Whether call counting is enabled for a method needed to be available to the DAC - Some small renames / cleanup to simplify code
2019-05-02When QuickJit is enabled, disable it for methods that contain loops by ↵Koundinya Veluri1-0/+15
default (#24252) When QuickJit is enabled, disable it for methods that contain loops by default Fixes https://github.com/dotnet/coreclr/issues/19751 by default when QuickJit is enabled - Added config variable TC_QuickJitForLoops. When disabled (the default), the JIT identifies loops and explicit tail calls and switches to tier 1 JIT. - This would prevent the possibility of spending too long in QuickJit code, but may decrease startup time a bit when QuickJit is enabled - Removed TC_StartupTier_OptimizeCode, as now that there is TC_QuickJit, I didn't see a good use for it - Removed references to "StartupTier" in config variables because we had previously decided not to call it that. - When QuickJit is disabled, avoid creating native code slots for methods in non-R2R'ed modules, as tiering would be disabled for those anyway - Marked TC_QuickJit config var as external
2019-04-18Move R2R-specific code to be outside FEATURE_PREJIT (#24075)Jan Kotas1-1/+1
This refactoring is preparation for disabling fragile NGen support in the runtime. It keeps fragile-NGen specific code under FEATURE_PREJIT and moves the code required to support R2R to be outside FEATURE_PREJIT. The eventual goal is to compile the runtime without FEATURE_PREJIT defined to avoid fragile-NGen specific overhead.
2019-04-02Fix arm altjit asm diffsBruce Forstall1-2/+1
At shutdown, the VM iterates over generated code as part of ETW "rundown". This currently includes altjit generated code. It calls functions which interprets the code as native code, e.g., arm32 GC info as x86 GC info. The fix is to make a call to BackoutJitData(), which was already suggested in the comments. This removes the altjit generated code from the "nibble map", and hence from the iteration. Fixes #23393
2019-04-01Enable R2R compilation/inlining of PInvoke stubs where no marshalling is ↵Fadi Hanna1-3/+19
required (#22560) * These changes enable the inlining of some PInvokes that do not require any marshalling. With inlined pinvokes, R2R performance should become slightly better, since we'll avoid jitting some of the pinvoke IL stubs that we jit today for S.P.CoreLib. Performance gains not yet measured. * Added JIT_PInvokeBegin/End helpers for all architectures. Linux stubs not yet implemented * Add INLINE_GETTHREAD for arm/arm64 * Set CORJIT_FLAG_USE_PINVOKE_HELPERS jit flag for ReadyToRun compilations * Updating R2RDump tool to handle pinvokes
2019-04-01Enable negative type-check results in CoreLib version bubble (#23549)Jan Kotas1-2/+4
This negative type-check results are necessary to generate good code for AsyncTaskMethodBuilder.AwaitUnsafeOnCompleted
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.
2019-03-17Make more types eligible for vectorized code paths in MemoryExtensions (#20855)Levi Broderick1-0/+47
Types like sbyte, ushort, and other 8-bit / 16-bit elemental types are now directed down the fast vectorized code paths that previously only byte and char were eligible for.
2019-03-07Fix signed compare warningsSinan Kaya1-1/+1
warning: comparison between signed and unsigned integer expressions [-Wsign-compare] conversions Update src/ToolBox/superpmi/mcs/verbdumptoc.cpp Co-Authored-By: franksinankaya <41809318+franksinankaya@users.noreply.github.com>
2019-03-06Remove legacy behavior around non-virtual interface calls (#23032)Michal Strehovský1-9/+11
* Throw BadImageFormat for direct calls to abstract methods * Remove legacy behavior around non-virtual interface calls * Try fixing failing tests The test we inherited from the default interface method prototype branch is doing exactly the thing it shouldn't do (rely on the bad behavior) for unexplained reasons.
2019-02-21Remove unused perfcounter code (#22742)Sung Yoon Whang1-32/+0
* removing references to COUNTER_ONLY, ENABLE_PERF_COUNTERS in src/vm directory * removing perfcounters* files * Fix build * Remove PerfCounterSupportedBuild * Some more cleanup on the GC side
2019-02-18Fix constrained call corner cases (#22464)Michal Strehovský1-1/+5
Fixes #22423. I'm still unclear on how JitStress manages to get itself into that situation, but I was able to write a repro that triggers the `!pMDAfterConstraintResolution->IsInterface()` assert using regular IL, so we need to handle that either way. The repro for that is constrained3.il. While figuring out the repro, I wrote a bunch of other test code and found another bug (constrained2), where we would box in a situations that doesn't require boxing (canonically ambiguous situation where there's a suitable default interface implementation and a valuetype implementation of the constrained method that does not requires boxing once we no longer deal with __Canon).
2019-02-15JIT: modify how jit determines when to update a type (#22618)Andy Ayers1-1/+63
For single-def locals, the type of a reference seen at the assignment to the local may be a more specific type than the local's declared type. If so the jit would prefer to use the assignment type to describe the local's value, as this will lead to better optimization. For instance in ``` object x = "a string"; // only assignment to x ``` the jit can optimize better if it models the type of `x` as `string`. Instead of relying on `mergeClasses` plus some jit-side screening to decide if the assignment type is a more specific type, implement a new jit interface method `isMoreSpecificType` that tries to answer this question more directly. Added a test case with type equivalence that hit asserts. Closes #22583.
2019-01-23Remove all traces of FEATURE_STACK_PROBE. (#22149)Filip Navara1-183/+0
2019-01-19Cleanup: Remove MethodDesc::GetLoaderAllocatorForCode (#22067)Jan Vorlicek1-1/+1
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-14Large version bubble Support (#21727)Andon Andonov1-1/+1
* 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-11Flowing the nativeCodeVersion to DebuggerJitInfo (#21925)Andrew Au1-4/+8
2018-12-23Fix warning causing error in warning as error (Windows) (#21656)Ben Adams1-3/+3
2018-12-21Improve removal of dead calls to allocator helpers.Eugene Rozenfeld1-5/+25
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-21Streamline default EqualityComparer and Comparer for Enums (#21604)Jan Kotas1-18/+43
This borrows the implementation strategy for these from CoreRT. It makes it both simpler (fewer types and lines of code) and faster in some cases since we always use the exact right underlying type. E.g. The following micro-benchmark is 25% faster with this change: ``` enum MyEnum : byte { x, y }; var comparer = Comparer<MyEnum>.Default; for (int i = 0; i < 100000000; i++) { comparer.Compare(MyEnum.x, MyEnum.y); comparer.Compare(MyEnum.y, MyEnum.x); } ```
2018-12-20Replace more of JitHelpers with S.R.CS.Unsafe (#21598)Jan Kotas1-17/+6
- Replace JitHelpers.UnsafeCastToStackPtr with Unsafe.AsPointer - Delete PinningHelper that was duplicate of RawData helper class
2018-12-10Add support for RVA fields to crossgen/R2R (#21463)Jan Kotas1-3/+27
* Add support for RVA fields to crossgen/R2R RVA fields are became more common with pre-inititialized ReadOnlySpan<byte>. Fix crossgen to deal with them for R2R. * Fix tests, map new JIT helper for R2R
2018-12-03Merge pull request #21264 from fiigii/x64onlyCarol Eidt1-4/+16
Implement 64-bit-only hardware intrinsic
2018-12-03Remove IsNeutralDomain() (#21318)Steve MacLean1-5/+4
* Remove IsNeutralDomain() * PR feedback
2018-11-29Update JIT/EE getMethodNameFromMetadata to get enclosing class nameFei Peng1-4/+16
2018-11-28Delete code related to LoaderOptimization and SharedDomain (#21031)Jan Kotas1-17/+1
2018-11-19Make type comparisons more general purpose (#20940)Michal Strehovský1-1/+37
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-15Allow supressing exceptions in diamond inheritance cases (#20458)Michal Strehovský1-20/+2
2018-11-13Optimize vtable calls (#20696)Fadi Hanna1-6/+11
* Implementation of R2R vtable call thunks. These thunks will fetch the target code pointer from the vtable of the input thisPtr, and jump to that address. This is especially helpful with generics, since we can avoid a generic dictionary lookup cost for a simple vtable call. Overall, these thunks cause the CPU to have less branch mispredictions, and give a small performance boost to vtable calls. These stubs are under VirtualCallStubManager so that the managed debugger can handle stepping through them.
2018-11-12Allow jit to examine type of initonly static ref typed fields (#20886)Andy Ayers1-0/+98
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 Kotas1-72/+1
2018-11-08Make getClassGClayout work with with class types.Eugene Rozenfeld1-3/+15
Also add an assert to getHeapClassSize to ensure it's not called in R2R cross-version-bubble.
2018-10-11JitEE interface additions to support object stack allocation. (#20283)Eugene Rozenfeld1-0/+66
Add two methods to JitEE interface: getHeapClassSize and canAllocateOnStack. Change JITEEVersionIdentifier.
2018-10-07Remove some dead remoting and context static things (#20277)Austin Wise1-20/+3
* 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-05Report instantiation argument in non-virtual interface calls (#20257)Michal Strehovský1-5/+10
The existing code would incorrectly inhibit codegen from generating instantiation argument in non-virtual calls to default interface methods (i.e. those that can happen with the `base` syntax in C#). Fixes #16775.