GC only ever needs to look at the top dispatcher frame as other
dispatchers cannot have live arg buffers, so it is not necessary to keep
these linked together. We can save a bit of stack this way.
Also update design document that was a bit outdated.
* Refactoring GenTreeJitIntrinsic to expose SimdSize and SimdBaseType via methods
* Updating the JIT to pass through the CORINFO_TYPE for hardware intrinsics
* Adding support for Vector<nint> and Vector<nuint> to managed code
* Updating the vector tests to cover nint and nuint
* Recognize Vector<nint> and Vector<nuint> in the JIT
* Updating Vector64/128/256<T> NotSupportedTest metadata to include type name
* Updating the Vector64/128/256<T> tests to have NotSupported validation for nint/nuint
* Splitting ThrowHelper.ThrowForUnsupportedVectorBaseType into separate functions for Numerics vs Intrinsics
* Updating Utf16Utility.Validation to directly use Vector<nuint>
* Don't use the auxiliary type to hold a SIMD type, since it can be trivially pulled from the operand instead
* Split the mono handling for ThrowForUnsupportedVectorBaseType into ThrowForUnsupportedNumericsVectorBaseType and ThrowForUnsupportedIntrinsicsVectorBaseType
* Add basic handling for MONO_TYPE_I and MONO_TYPE_U to simd-intrinsics.c
* Ensure simd-intrinsics.c in Mono handles `MONO_TYPE_I` and `MONO_TYPE_U` on relevant code paths
* Ensure we don't assert when encountering synthesized Vector128<nint> handles
* Applying formatting patch
* Fix the handling for Crc32 and Crc32C on ARM64
* Updating Mono mini-amd64 to handle MONO_TYPE_I and MONO_TYPE_U for SIMD operations
* Handle OP_XCOMPARE.CMP_GE_UN for MONO_TYPE_U
* Handle MONO_TYPE_I and MONO_TYPE_U for Vector types in mini-llvm
- Add merge command as designed earlier
- Add new typesystem variant that works based exclusively on the typerefs in existing mibc files and can operate without references to implementation binaries
- Re-use ibc reader/merger from crossgen2 codebase
- Increase usability of the tool
- Set default verbosity to normal
- Normal verbosity prints a relatively limited amount of output
- Add a document describing the behavior and how it is expected to be used.
- Rework the existing command line handling to implement the proposed create-mibc command. (the merge command is still entirely TBD).
* Trim trailing whitespaces
* Match raw with rendered
* Delete extra asterisks and |
* Update ELT Hooks - tail calls.md
Co-authored-by: Jan Kotas <[email protected]>
Add support for loading composite R2R images utilizing huge pages on Linux
Support is broken into 3 major portions
- Changes to the compiler to add a switch which can compile the composite image with higher than normal alignment
- Changes to the runtime to make some slight tweaks to PE file loading on Linux to support these images correctly
- Documentation on how to tie these various features together to achieve large page loading on Linux
* Add ability for hostfxr_get_runtime_delegate to block on invalid delegate types.
This is required so that the runtime isn't loaded if the request has no chance of succeeding.
Fix spelling of initialization_options_t.
Add context_contract_version_set flag to initialization_options_t.
This allows hostpolicy to know whether it can rely on the version field of corehost_context_contract to be valid.
Also always initialize corehost_context_contract to {}.
* Allow app-based context to call hostfxr_get_runtime_delegate.
Currently, it may only request the load_assembly_and_get_function_pointer delegate.
Fix discrepancy in design doc.
Add error code HostApiUnsupportedScenario for blocks that might be removed. This gives the native host better information on why the request failed.
Add tests for running a component from an app context.
Describe the long-term vision for the hosting components in terms of ability exposed through APIs.
Removes the limitation of `hostfxr_get_runtime_delegate` to make it work on app host context as well.
Defines a new runtime delegate which operates on default load context only.
Some cleanup of the document.
Co-authored-by: Elinor Fung <[email protected]>
* Covariant Returns Feature: Allowing return types on MethodImpl to be derived types of the return type on the MethodDecl.
Feature limitations:
- Only supports MethodImpls and MethodDecls on classes (no interfaces/valuetypes).
- MethodImpl and MethodDecl cannot be on the same type.
- Interface/valuetypes not supported as covariant return types.
Changes are mostly a boolean flag being passed around to allow for covariant type checking in method signatures.
Generics are handled by correctly keeping track of the substitution chain while traversing the base type hierarchy for type comparison.
All method signature comparisons uses metadata for checking, without loading any type (with some exceptions).
Validation for the `ValidateMethodImplRemainsInEffectAttribute` is performed at the very last step of `CLASS_LOAD_EXACTPARENTS`.
Includes unit tests to cover positive/negative scenarios:
- Non-generics
- Generics, with various levels of complexities on generic instantiations and substitutions
- GVMs
- Delegates
- Tests for validation of the existance/absence of the ValidateMethodImplRemainsInEffectAttribute
- Interface and valuetype scenarios (negative scenarios)
* Adding the missing .ctor methods to the various types
* Perform covariant return signature matching only after an exact match fails
* Add test coverage for implicit override with less derived return type
* Change ValidateMethodImplRemainsInEffect attribute to apply to methods
* Moving covariant return type checking to the final stage of type loading, and use CanCastTo instead of signature-based checking, to be allow for type compatibility based on ECMA I.8.7.1.
* Rename attribute and reference it from System.Runtime instead of S.P.C
* Add test coverage for interface cases.
* Handling for struct cases, and adding test coverage for it.
* Small test fixes
* Fix consistency issue with the way the RequireMethodImplToRemainInEffectAttribute is declared
* Support covariant returns and slot unifications in crossgen2
These changes fix the behavior of the devirtualization algorithm to not incorrectly devirtualize covariant return methods that have the slot unification attribute
* Add unit test coverage for delegates
* Fix handling of covariant and contravariant generic interfaces
Also add tests for those.
* Added test cases to interfaces unit test
Based on PR feedback, I've added test cases to verify the load level
asserts change.
* Fix Nullable handling and add more tests
The attempt to overload method with int32 return value by a method with
Nullable<int32> was asserting in CanCastTo. This change fixes it by
pre-checking this case before calling into CanCastTo.
I've also slightly refactored the
ValidateMethodsWithCovariantReturnTypes by extracting the
compatible-with stuff into IsCompatibleWith method.
Added tests to test various compatible-with differences from the
originally used CanCastTo
- Change the CompatibleWithTest to call virtual methods on test
classes instead of just instantiating the classes.
- Update crossgen2 similar to the runtime to have IsCompatibleWith
method doing the same pre-filtering before calling CanCastTo.
* Rename the attribute to PreserveBaseOverridesAttribute
* Disable covariant returns tests on Mono for now
The mono doesn't implement the feature yet
Co-authored-by: Fadi Hanna <[email protected]>
Co-authored-by: Jan Vorlicek <[email protected]>
* Implement portable tailcall helpers
This implements tailcall-via-help support for all platforms supported by
the runtime. In this new mechanism the JIT asks the runtime for help
whenever it realizes it will need a helper to perform a tailcall, i.e.
when it sees an explicit tail. prefixed call that it cannot make into a
fast jump-based tailcall.
The runtime created two important IL stubs to help the JIT in performing
the necessary tailcalls. One IL stub is used to store the args for the
tailcall, while the other is used to dispatch the actual tailcall
itself. The JIT will then transform the call from
return tail. F(a1, ..., an);
to
IL_STUB_StoreTailCallArgs(a1, ..., an);
T result;
IL_STUB_DispatchTailCalls(..., &result);
return result;
The dispatcher is written in such a way that it is able to dispatch
multiple tailcalls in a row when tailcalled functions also perform
tailcalls. To do this, the JIT helps the dispatcher detect if the
caller's caller is also a dispatcher. When this is the case the
dispatcher returns to let the previous dispatcher perform the tailcall
with the currently stored args. This allows the frame to unwind and
ensures that sequences of tailcalls do not grow the stack more than by a
constant factor.
Due to this unwinding the args cannot be stored on the stack and are
instead stored in TLS. The GC is made specially of this buffer as the
args can be anything, including interior pointers.
The control-flow when performing the new tailcalls is nonstandard, so
this also changes the debugger to support proper stepping into/over/out
of tailcalled functions when they go through the new dispatcher.
x86's tailcalling mechanism does not change.
This commit also includes the following changes:
* Update design doc for helper-based tailcalls
* Change lowering of GT_LABEL on arm.
Generate movw/movt instead of adr on arm. adr on arm allows offsets
up to 4k, which may not be enough. In particular,
IL_STUB_CallTailCallTarget uses GT_LABEL before argument setup code
and it can be more than 4k.
* Add COMPlus_FastTailCalls environment variable.
COMPlus_FastTailCalls controls whether fast tail calls are allowed.
If COMPlus_FastTailCalls is 0, fast tail calls are not allowed even for
tail-prefixed calls. Only helper-based calls are allowed. This is useful
for testing helper-based calls.
Co-authored-by: Eugene Rozenfeld <[email protected]>
The management of the handle that native runtime keeps to
AssemblyLoadContext has changed to fix a race recently, so I am updating
the doc according to the change.
Add support to runtime and jit to allow switching from unoptimized to
optimized code for a method while the method has active stack frames.
Details in the included document.
- Commit 1
- Reverts commit f954c6bb80, which reverted PR https://github.com/dotnet/runtime/pull/1457 due to issues
- Commit 2
- Fixes crashes and assertion failures seen by the original change, fixes https://github.com/dotnet/runtime/issues/29934
- The crashes were caused by commit https://github.com/dotnet/runtime/pull/1457/commits/6aa3c7083735895c2e687a77e3636080edb366c3 in the original PR
- Call counting infos cannot be deleted when the corresponding call counting stubs may still run, because:
- The remaining call count decremented by the stub is in the call counting info
- The only way to get a code version / method desc from a stub is to go through the call counting info
- Got one repro of the assertion failure in https://github.com/dotnet/runtime/issues/22786 and it is most likely caused by the same issue, following heap corruption from modifying a deleted call counting info where the memory is reused for a `NativeCodeVersionNode`, messing up the method desc pointer
- Fixed with a partial revert of the above commit. Added back the `Complete` stage and then call counting infos are deleted only after it's ensured that call counting stubs won't be used (shortly before deleting them).
- Commit 3
- Public static functions of `CallCountingManager` that may be called through the debugger may occur before static initialization, added a check for null as suggested in https://github.com/dotnet/runtime/pull/29892