Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-07-11W^X support (#54954)Jan Vorlicek
* W^X support This change is the last part of enabling the W^X support. It adds the actual executable allocator that handles all double mapped memory allocations and creating the writeable mappings. The platform specific functionality is placed in a new minipal that is going to be a basis for future removal of Windows APIs usage from the native runtime. The last state of the change was tested on all the platforms that we support using coreclr pri 1 tests with both the W^X enabled and disabled using the COMPlus_EnableWriteXorExecute variable. The debugger changes were tested using the managed debugger testing suite on Windows x64, x86 and on Apple Silicon so far. Further testing on other platforms is in progress. * Replace LeafLock in UMEntryThunkFreeList by a new lock * Also allocate LoaderHeapFreeBlock from regular heap. * Set the W^X default to disabled
2021-06-28Faster type load for scenarios made more common by generic math (#54588)David Wrighton
Change interface map layout in two interesting ways 1. For interface maps defined in System.Private.CoreLib, rely on the C# compiler to prevent any ambiguous duplicates, and to find the full interface expansion, instead of expanding it within the type loader See code marked with #SpecialCorelibInterfaceExpansionAlgorithm - Note that this optimization is only applied for ValueTypes as the presence of inheritance makes the optimization much more complex in many cases, and isn't needed. - This optimization reduces the amount of parsing of the interface implementation table must be done for valuetypes in CoreLib. In particular, with the new interfaces that are added as part of #54650 there is a very deep interface hierarchy that requires a great deal of scanning. As those interfaces are added to all the primitive types, the impact on startup performance is significant and measurable. 2. For interface map expansion that follows the curiously recurring generic pattern, place the open instantiation of the type in the interface map instead of the the exact instantiation, and update all places in the runtime which consider the interface map to deal with that change (Mostly by adding special purpose logic to work with the special marker type in the interface map, but there is also logic to simply force the exact interface type to be loaded, when working with the partially loaded type is not quite good enough, or excessively complex) - This optimization reduces the set of interface types that need to be loaded if they are unused. Of particular benefit are the numerous interfaces associated with the primitive types that are added as part of #54650. Performance of launching an extremely simple .NET process (process with empty main method). Results acquired using local testing on my developer machine, using a simple script that launches the process 500 times in a row. | Before #54650 | After #54650 | After #54650 and #54588 (this pr) | | :-: | :-: | :-: | | 14.1ms | 16.5ms |14.3ms |
2021-06-10Add writeable holders for executable memory (#53934)Jan Vorlicek
* Add writeable holders for executable memory This change adds holders for writeable mappings for executable memory. It is the largest part of the W^X support. The ExecutableWriterHolder implementation is dummy in this change, but it was fully tested with coreclr / libraries tests on Windows arm, arm64, x64 and x86 with the real double memory mapping. There are few concepts / conventions used: * When the writeable pointer isn't known at a place where it is needed and also not at the caller, the ExecutableWriterHolder instance is created. * When a callee needs writeable pointer to executable memory and caller knows RW and RX, the argument is doubled with RX and RW suffixes. For constructors and member methods when "this" is the RW one, we pass just extra RX argument. * Locals holding RW pointer use RW suffix. * Locals holding RX pointer usually have no suffix to minimize number of changes, but in some cases they have a RX suffix where I felt like it was better to make things clear.
2021-05-13Low level API support for Objective-C interop. (#52146)Aaron Robinson
* Add Objective-C interop support. * Include handling of HNDTYPE_REFCOUNTED when FEATURE_OBJCMARSHAL is defined (#47534) * Allow overriding of Objective-C message send P/Invokes (#47721) * Add new flag to MethodTable for types with ObjectiveCTrackedTypeAttribute. Discover attribute during type load and set bit. Update EagerFinalizer callout to query bit. * Add testing for API * Bridge API for propagating managed exception to native. * Update GCEE interface to support GCServer scenario for Objective-C. The new callbacks now fire when before the GC scans handles and is non-concurrent. * Comment added for ExceptionTracker non-NULL condition. Co-authored-by: Jeremy Koritzinsky <jekoritz@microsoft.com> Co-authored-by: Elinor Fung <elfung@microsoft.com> Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-04-28Add an implementation of `RestoreContext` for Windows/amd64 for use with ↵Koundinya Veluri
shadow stacks (#51887) * Add an implementation of `RestoreContext` for Windows/amd64 for use with shadow stacks - Added `ClrRestoreNonvolatileContext` to Windows/amd64 similar to the PAL's `RtlRestoreContext` but allowing for example continuing from exception in managed code when shadow stacks are enabled - Updated to use the new implementation for cases that don't need the volatile register state restored. The two remaining cases that still use `RtlRestoreContext` would have to be changed later to use a different mechanism. - For other targets, forwarded `ClrRestoreNonvolatileContext` to `RtlRestoreContext` for now
2021-04-04Remove code that references resolved issues (#50698)Aaron Robinson
2021-03-26Remove GETTHREAD_ALLOWED tracking (#50080)Vladimir Sadov
* Remove GETTHREAD_ALLOWED tracking * removed EE_THREAD_NOT_REQUIRED * removed EE_THREAD_REQUIRED * step1 * more changes * fix Unix build * more changes * GetThread in pinvokestubs.S * build fix for dac * PInvokeGetThreadHelper * more changes (dac) * more (cordbe) * more (nearly all?) * Couple places that were mistakengly set to use `GetThreaNotOk` (should use `GetThreadNULLOk`) * Renamed GetThread() -> GetThreadDoNotUse() * Missed a few uses of GetThread() * One more case of GetThread * Bring GetThread() back - now with an assert in it. * Renamed PInvokeGetThreadHelper -> JitGetThreadHelper * One place that should use GetThreadNULLOk (otherwise there are asserts) * Apply suggestions from code review Jan's 74 suggestions. Co-authored-by: Jan Kotas <jkotas@microsoft.com> * remove SetFiberMode - it is dead code * Make `EE_THREAD_NOT_REQUIRED` a noop and revert its removal. * `GetThreadNULLOk()` should be used here. * PR review suggestion Co-authored-by: Jan Kotas <jkotas@microsoft.com> * renamed JitGetThreadHelper -> GetThreadHelper * One more place that should use `GetThreadNULLOk()`. Co-authored-by: Jan Kotas <jkotas@microsoft.com>
2021-02-27Separate refactoring changes in 43250 (#48199)Egor Chesakov
2021-02-03unwindLazyState: initialize ContextFlags (#47760)Tom Deseyn
2021-01-29Fix some valgrind warnings about jumps based on uninitialized values. (#47620)Tom Deseyn
2021-01-22Arm64 apple vm fixes for arg alignment. (#46665)Sergey Andreenko
* Add `MarshalInfo::IsValueClass`. * Add `TypeHandle* pTypeHandle` to `SizeOf`. * Add a few asserts/start using inline function instead of macro. * use TARGET_POINTER_SIZE instead of STACK_ELEM_SIZE. * Use `m_curOfs` instead of `m_idxStack` in `ArgIteratorBase` on all platforms. Before some platforms were using stackSlots, some curOfs in bytes. * Use byte sizes and offsets in `ArgLocDesc`. Fix arm32. x86 fixes. use StackSize on ArgSizes Add `GetStackArgumentByteIndexFromOffset` and return back the old values for asserts. another fix * Stop using `#define STACK_ELEM_SIZE` * Add `isFloatHfa`. * delete checking code. because it won't pass on arm64 apple. * arm64 apple fixes. * roundUp the stack size. * Add a reflection test. * Return byte offset from `GetNextOfs`. It is not a complete fix for arm64 apple, but covers most cases. * Add `FLOAT_REGISTER_SIZE` * Use StackElemSize for ` pLoc->m_byteStackSize`. * replace `assert` with `_ASSERTE`. * Use `ALIGN_UP` in the code that I have changed. * rename `m_curOfs` as `m_ofsStack`. * delete "ceremony " from `StackElemSize`. * Delete `cSlots` and don't call `StackElemSize` on `GetArgSize`. * Fix an assert. * Fix nit. * fix wrong return for hfa<float>. * fix nit. * Fix crossgen job.
2020-12-15Enable non-blittable struct returns on UnmanagedCallersOnly (#45625)Jeremy Koritzinsky
* Allow non-primitive struct returns to not require a stub. Fixes #35928. * Support propagating the UnmanagedCallersOnly calling convention to the JIT. Block UnmanagedCallersOnly in crossgen1 since the attribute parsing code isn't included. * Support passing through the calling convention for UnmanagedCallersOnly in crossgen2 * Fix clang errors. * Fix stack calculation. * Fix usings * Clean up jitinterface. * Remove invalid assert. * Fix up stdcall name mangling lookup. * Fix flag condition. * Use the register var type when copying from the register to the stack. * Change flag check for readability. * Rename variables to remove shadowing. * Fix formatting. * Create new getEntryPointCallConv method on the EE-JIT interface to handle all calling convention resolution and support extensible calling conventions. * Remove unreachable code. * Remove now unused getUnmanagedCallConv jitinterface method (replaced by getEntryPointCallConv). * Fix formatting. * Rename getEntryPointCallConv and only call it with a method when it's a P/Invoke or Reverse P/Invoke. * Pass SuppressGCTransition through the getUnmanagedCallConv JIT-EE interface API. * Refactor callconv handling so we can handle reverse P/Invokes with the callconv in the signature (and not in an UnmanagedCallersOnly attribute). * Clean up whitespace. * Pass MethodIL as the scope for the signature to enable propagating down annotations for calli's in P/Invokes. * Remove usages of CORINFO_CALLCONV_FOO where FOO is an unmanaged callconv. move the definitions of those ones to the interpreter since that's the only place they're used. * SuppressGC cleanup. * Rename superpmi struct * Add default condition to make clang happy. * change enums to make clang happy. * Remove CORINFO_CALLCONV_C and family from interpreter. * Fix up handling of managed function pointers and remove invalid assert. * Continue to use sigflag for suppressgc workaround. * Clean up comment wording. Signed-off-by: Jeremy Koritzinsky <jekoritz@microsoft.com> * Remove more MethodIL passing we don't need any more * Update src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs Co-authored-by: Jan Kotas <jkotas@microsoft.com> * Fix SigTypeContext creation. * Pass context by ptr. * Fix formatting. * Clear the Reverse P/Invoke flag when compiling inlinees. It's only needed on the entry-point functions. Co-authored-by: Jan Kotas <jkotas@microsoft.com>
2020-12-08December infra rollout - remove duplicated 'src' from coreclr subrepo ↵Tomáš Rylek
(src/coreclr/src becomes src/coreclr) (#44973) * Move src/coreclr/src/Directory.Build.targets to src/coreclr Merge src/coreclr/src/CMakeLists.txt into src/coreclr/CMakeLists.txt * Mechanical move of src/coreclr/src to src/coreclr * Scripts adjustments to reflect the changed paths