`Version..ctor(string)` is implemented by calling `Version.Parse`, which
allocates an intermediate `Version` instance. Avoid the unnecessary
intermediate allocation by using `Version.Parse` directly.
Also took the opportunity to make the IsByRefLike flag not be a property
of the field layout (but use the newly approved custom attribute that
everyone else uses).
Fixes#4220.
* Added value pop for switch instruction.
* Added switch instruction tests and todos for jump target verification.
* Added branch target verification with test cases.
* Moved switch test cases into seperate file.
* Refactored switch/branch tests to use meaningful labels and not use locals.
* Add Span-based {Try}Parse methods to primitive types
Adds Parse and TryParse methods to Boolean, Byte, Double, Int16, Int32, Int64, SByte, Single, UInt16, UInt32, UInt64, and Decimal.
* Address PR feedback
- Make delegation between overloads as consistent as possible across the primitive types: Boolean, SByte/Byte, Int16/UInt16, and Single/Double were doing it one way, whereas Decimal, Int32/UInt32, and Int64/UInt64 were doing it another way (most of this inconsistency was preexisting this PR, but my previous commit doubled-down on the inconsistency). Changed the former to be like the latter.
Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
• Fix binder/ILCompiler/typeloader to correctly handle vtable entries for dynamic types in the partial canonical case where a call converter thunk is not needed, or where it's needed but need to use the generic context of a base type.
• Add new tests to PX dynamic generics
• Minor refactoring to genericdictinoarycell.cs to make log easier to read (grouping logging of dictionary cells together)
[tfs-changeset: 1670506]
I changed AsyncValueTaskMethodBuilder.Create to avoid calling the nop AsyncTaskMethodBuilder.Create, but it turns out on corert that AsyncTaskMethodBuilder.Create actually does additional work if the debugger is attached, so we should still call it there.
Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
The Debug.Assert(obj == null || obj is __ComObject) is Unnecessary and incorrect:
Unnecessary: There is another Debug.Assert(!typeHnd.IsNull()) later, which will do similar(or better) check. since Debug.Assert(!typeHnd.IsNull()) also handle managed winmdobject case.
Incorrect: it miss a case such as obj itself is a managed winmd object case.
so it should be Debug.Assert(obj == null || obj is __ComObject || obj is managed winmd object);
[tfs-changeset: 1670398]
• Generic methods/fields invoke map entries are only emitted to the tables if the method/field is considered reflectable by the DR. Not all methods/fields are reflectable.
• Generic methods/fields invoke map entries are only added based on their canonical uniqueness to avoid canonically equivalent duplicate entries in the tables.
These changes get us closer to getting rid of the nutc/STS analysis, and using the CoreRT compiler only.
[tfs-changeset: 1670279]
`FastAllocateString` (the choke point through which all string allocations go through) wasn't as fast as it could be and we were 30% slower than CLR on allocating strings. We were leaving a lot of perf on the table.
Before this change, string allocation was using the same allocator as arrays. Since there's a subtle difference between the failure modes on overflow (string allocation throws OOM, array allocation throws OverflowException), `FastAllocateString` required a try/catch block to handle the corner case. This was inhibiting codegen optimizations around this code path - to fix that problem, we needed a separate allocator. And since we now had a separate allocator for strings, I also took the liberty of inlining some details around strings (component size and base size) into the helper. It turns out runtime already hardcodes the details around strings (the component size) in a couple places anyway, so this is not that big of a "separation of concerns" violation as it looks like.
[tfs-changeset: 1670224]
This adds a unit test for `ILCompiler.Compiler` so that we can no longer
use this as an excuse not to write unit tests for this assembly.
The first test is a generalized framework to write tests for dependency
graph. The test runs ILScanner on a method from the test assembly, and
validates various invariants that the method declares. This will let us
e.g. write targeted unit tests that check that the various size on disk
features within the compiler do the right thing (e.g. make sure we don't
unnecessarily expand variant interfaces, GVMs, etc.).
When I added this overload I didn't account for a null WaitHandle array. Now it will pass through successfully to the other overload, where it will throw the ArgumentNullException it is supposed to.
* Pull updated gate thread implementation out of EnableClrThreadPool. Make gate thread go to sleep when unneeded and be created using lock-free code
* PR Feedback