Skip to content

Conversation

@ericstj
Copy link
Member

@ericstj ericstj commented Jul 14, 2020

MaximLipnin and others added 30 commits July 1, 2020 16:41
* Make Common.Tests pass

* Remove Common test project from the exclusion list
* add TargetHostName to SslStream

* fix unit tests

* feedback from review
* move the interface check to be before versionbubble

* updating fix to check for TypicalMethod of the target

* Adding a comment to clarify the check

* uncoditinoally invoke GetTypicalMethodDef

* Add a smoke test.

* moving the interface check to before version bubble

Also adding a cross module test.
- Mimic the alignment and other algorithms present in coreclr
- Add tests to crossgen2smoke to cover these scenarios
- Update type system unit tests so that they can run in VS
- Fix issue #38450
* Add platform-specific attributes

Spec dotnet/runtime#33331

* Convert to xml doc

* Update src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/MinimumOSAttribute.cs

Co-authored-by: Jeremy Barton <[email protected]>

* Update src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/ObsoletedInPlatformAttribute.cs

Co-authored-by: Jeff Handley <[email protected]>

* Address code review

* Add to ref assembly, test and fix build errors

* Fix spacing, revert unwanted changes

* Namespace was wrong, updated

Co-authored-by: Jeremy Barton <[email protected]>
Co-authored-by: Jeff Handley <[email protected]>
Co-authored-by: Buyaa Namnan <[email protected]>
* add two SslStream tests for custom validation

* use BuildPrivatePki

* feedback from review

* disable on windows
* Align SpecializeComparer with ComparerHelpers

* Align SpecializeEqualityComparer with ComparerHelpers
…38578)

* Turn on argument exception analyzer on runtime, fix failures found
Fix interpreter build
Add PAL_GetApplicationGroupId() that returns null for Linux.
* initial support for SslStreamCertificateContext

* update openssl pal

* feedback from review

* fix unit tests

* fix platforms

* update ref
…… (#38655)

* [browser][wasm][bindings] Handle case where AsyncStateMachineBox`1 is returned

- There are cases where AsyncStateMachineBox`1 is returned instead of instead of Task`1 within the bindings.  This was causing exceptions with Promise processing.

* Use `is_subclass_of` instead of strings to recognize Tasks
This can by used by the xharness xunit runner to make sure async tasks are executed.

We also need to tweak how `ThreadPoolTaskScheduler` handles `TaskCreationOptions.LongRunning` since the usual mode of starting a new thread doesn't work, instead we treat it like the option wasn't set and queue the task on the threadpool.
…tAndInsert (#38680)

* Implements InsertScalar 

* Uses InsertScalar to implement Vector128<T>.WithLower() and Vector128<T>.WithUpper()

* Renames ShiftLeftLogicalAndInsert to ShiftLeftAndInsert and ShiftRightLogicalAndInsert to ShiftRightAndInsert
+ When allocating in UOH free list we should do >= (min_obj_size) instead of >.
+ Renamed loh_a_fit_segment_end_p to uoh_a_fit_segment_end_p (should have been part of the refactoring work)
* [browser][wasm] Initial addition of WebSockets support

* Clean up usings

* Create and use a WebSocketHandle.Browser.cs module

* Add conditional TARGETS_BROWSER so as not to throw Proxy PNSE during ClientWebSocket creation.

* Update WebSockets code

* Removing debug line

* Remove `ThrowIfReadOnly` method to address review comments

* Address review comments

- change accessor of _requestedSubProtocols to private
- condition more code in WebSocketHandle.Managed.cs to not access _requestedSubProtocols

* Address review comments

* Address review comments

* Change to be PlatformNotSupportedException

* Add ConnectAsync implementation to create a new instance of the BrowserWebSocket implementation.

* Address review comments

* Address subprotocols comments

* Remove internal custom class ActionQueue class in favor of using a Channel.

* Fix object leak.

- Lambdas are not being released automatically.

* Add doc for the constant that is being used.

- Address review comment

* Clean up SendAsync method.

- Validate the message type.
- Validate the array segment that is passed as the message.

* Add validation to ReceiveAsync for invalid buffer.

- remove unnecessary null checks from message buffering.

* Address review comments

* Address review comments about TCS

* Address camel case by using enum

* Address abort request

* Handle nullable

* Address review comment for removing cancellationtoken registration to the connect source.

* Use non-generic TaskCompletionSource

* Cleanup var usage

* Add string to .resx

* Inline dispose

* Fix WebSocket opening exception

* Remove the asynchronous completion from SendAsync.

* Fix object leak, exception on close and address review comments

* Handle race condition

* Address 	TaskCompletionSource on connect review comments

* Update src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/BrowserWebSockets/BrowserWebSocket.cs

Co-authored-by: campersau <[email protected]>

* Update src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/BrowserWebSockets/BrowserWebSocket.cs

Co-authored-by: campersau <[email protected]>

* Fix Connect not completing task on error.

* Cleanup reference

* Remove redundant error check of memorystream buffer.

* cleanup

* Update src/libraries/System.Net.WebSockets.Client/src/System.Net.WebSockets.Client.csproj

Co-authored-by: Maxim Lipnin <[email protected]>

* Update src/libraries/System.Net.WebSockets.Client/src/System.Net.WebSockets.Client.csproj

Co-authored-by: Maxim Lipnin <[email protected]>

* Update src/libraries/System.Net.WebSockets.Client/src/System.Net.WebSockets.Client.csproj

Co-authored-by: Maxim Lipnin <[email protected]>

* Update src/libraries/System.Net.WebSockets.Client/src/System.Net.WebSockets.Client.csproj

Co-authored-by: Maxim Lipnin <[email protected]>

* Fix typo

* clean up buffer code

* Modify callbacks to use lambda function.

- These are now released properly after reference counting went in.

* Fix object leak of delegate and clean up deprecated code.

* extract lambda into method

* Update src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/BrowserWebSockets/BrowserWebSocket.cs

Co-authored-by: Stephen Toub <[email protected]>

* Update src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/BrowserWebSockets/BrowserWebSocket.cs

Co-authored-by: Stephen Toub <[email protected]>

* Update src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/BrowserWebSockets/BrowserWebSocket.cs

Co-authored-by: Stephen Toub <[email protected]>

* Review comments addressed

Co-authored-by: campersau <[email protected]>
Co-authored-by: Maxim Lipnin <[email protected]>
Co-authored-by: Stephen Toub <[email protected]>
…(#38695)

* Added doc with instructions on running basic ASP.NET Benchmarks with crossgen2.

* Shortened clr+libs command in Asp.Net Benchmarks doc.
…H segments and objects in ICorDebug (#38146)
* Respect new MD bit in runtime

* Throw "not implemented".

* Update parser for ILAsm
Add text based grammar file for IL tooling

* Update ILDasm

* Add disabled test project for function pointers.

* Add feature detection.
* Enable ilasm/ildasm round trip testing in new AzDO pipeline

Pipeline is `runtime-coreclr ilasm`.

Also, add an optional `IlasmRoundTripIncompatible` msbuild
property to allow disabling tests for the IlasmRoundTrip test.

* Disable tests for ilasm round-trip testing

Tracking issues:
dotnet/runtime#11412
dotnet/runtime#38515
dotnet/runtime#38506
dotnet/runtime#38507
dotnet/runtime#38508
dotnet/runtime#38529
With the recent async Tasks fix we can now skip just a handful of tests to get the testsuite to passing: `Tests run: 317, Errors: 0, Failures: 0, Skipped: 18. Time: 18.780363s`
@joperezr
Copy link
Member

I tried changing something on the pipeline, let me see if Closong and reopening will cause CI to get triggered

@joperezr joperezr closed this Jul 14, 2020
@joperezr joperezr reopened this Jul 14, 2020
@joperezr
Copy link
Member

/azp run runtimelab

@ericstj
Copy link
Member Author

ericstj commented Jul 14, 2020

Its possible a recent change in runtime broke your CI support. There were some changes to yml

@joperezr
Copy link
Member

I see, in theory the way we setup the runtime yml we shouldn’t be too dependent on changes in the runtime ymls but that is totally possible. I’ll do some digging tomorrow and figure out what the problem is and fix it.

@safern
Copy link
Member

safern commented Jul 14, 2020

There's merge conflicts. When there are merge conflicts CI doesn't run.

@joperezr joperezr force-pushed the runtime-ingestion branch from 2f4effb to 854ce47 Compare July 14, 2020 18:17
@joperezr
Copy link
Member

We didn't have merge conflicts yesterday and CI didn't trigger, I just fixed the ones on this PR and it still doesn't trigger, I'm sure that this must be because the yml got broken by runtime changes, I'll investigate now.

@safern
Copy link
Member

safern commented Jul 14, 2020

/azp list

@safern
Copy link
Member

safern commented Jul 14, 2020

/azp help

@safern
Copy link
Member

safern commented Jul 14, 2020

It seems like not even /azp comments are working, maybe the size of the PR is messing up AzDo?

@joperezr
Copy link
Member

After some investigation between @safern and myself, we noticed that it does seem to be a bug with Azure Pipelines where they can't handle PRs with that many changes. I opened another PR with only 300 changes and that one did seem to work, so I'll split this PR into two ingestions in order to get CI coverage of both ingestions and get into latest runtime.

@joperezr
Copy link
Member

Closing this one in favor of #13

@joperezr joperezr closed this Jul 14, 2020
@ericstj
Copy link
Member Author

ericstj commented Jul 14, 2020

a bug with Azure Pipelines where they can't handle PRs with that many changes

Interesting. Have we filed this bug with AzDo?

@safern
Copy link
Member

safern commented Jul 14, 2020

Interesting. Have we filed this bug with AzDo?

Not yet, but we do plan to do it.

@ericstj
Copy link
Member Author

ericstj commented Jul 14, 2020

I had another random idea. Is there an off-chance that someone used a key-phrase in a commit that was merged over that suppressed validation? If you isolated the bug to commit / file count already then ignore me.

@joperezr
Copy link
Member

We haven't validated it, we just feel that to be the case because of the more detailed error you and I saw last night plus the fact that a PR with fewer commits did work. Once we merge that we'll be able to validate by trying to merge the remaining commits to see if this is indeed an issue with the number of commits or instead with one particular one.

scalablecory pushed a commit that referenced this pull request Sep 22, 2020
This PR adds some initial high level API documentation.
@ericstj ericstj deleted the runtime-ingestion branch March 12, 2021 19:50
runtimelab-bot pushed a commit that referenced this pull request May 18, 2021
…2769)

Transition to GC Unsafe mode on every MONO_RT_EXTERNAL_ONLY function in
reflection.c

In particular, fix mono_reflection_type_from_name which is used in
https://github.com/xamarin/xamarin-android/blob/681887ebdbd192ce7ce1cd02221d4939599ba762/src/monodroid/jni/embedded-assemblies.cc#L350

Fixes stack traces like

```
05-14 08:06:12.848 31274 31274 F DEBUG   :       #00 pc 00000b99  [vdso] (__kernel_vsyscall+9)
05-14 08:06:12.848 31274 31274 F DEBUG   :       #1 pc 0005ad68  /apex/com.android.runtime/lib/bionic/libc.so (syscall+40) (BuildId: 6e3a0180fa6637b68c0d181c343e6806)
05-14 08:06:12.848 31274 31274 F DEBUG   :       #2 pc 00076511  /apex/com.android.runtime/lib/bionic/libc.so (abort+209) (BuildId: 6e3a0180fa6637b68c0d181c343e6806)
05-14 08:06:12.848 31274 31274 F DEBUG   :       #3 pc 0002afcd  /data/app/~~rMrkpKmVPaBpM5jKb8fPAg==/com.microsoft.maui-JfRo8RWSDJaNtJuBa0y7_Q==/lib/x86/libmonodroid.so (xamarin::android::internal::MonodroidRuntime::mono_log_handler(char const*, char const*, char const*, int, void*)+141) (BuildId: 9726f32ad5f8fa5e7c5762baf2f6e3294da41cc1)
05-14 08:06:12.848 31274 31274 F DEBUG   :       #4 pc 00112c5d  /data/app/~~rMrkpKmVPaBpM5jKb8fPAg==/com.microsoft.maui-JfRo8RWSDJaNtJuBa0y7_Q==/lib/x86/libmonosgen-2.0.so (eglib_log_adapter+141) (BuildId: b67e93dd750dafdd6f65f408b021b6a3a74868ac)
05-14 08:06:12.849 31274 31274 F DEBUG   :       #5 pc 00020fdf  /data/app/~~rMrkpKmVPaBpM5jKb8fPAg==/com.microsoft.maui-JfRo8RWSDJaNtJuBa0y7_Q==/lib/x86/libmonosgen-2.0.so (monoeg_g_logv+175) (BuildId: b67e93dd750dafdd6f65f408b021b6a3a74868ac)
05-14 08:06:12.849 31274 31274 F DEBUG   :       #6 pc 0002113a  /data/app/~~rMrkpKmVPaBpM5jKb8fPAg==/com.microsoft.maui-JfRo8RWSDJaNtJuBa0y7_Q==/lib/x86/libmonosgen-2.0.so (monoeg_g_log+42) (BuildId: b67e93dd750dafdd6f65f408b021b6a3a74868ac)
05-14 08:06:12.849 31274 31274 F DEBUG   :       #7 pc 00128892  /data/app/~~rMrkpKmVPaBpM5jKb8fPAg==/com.microsoft.maui-JfRo8RWSDJaNtJuBa0y7_Q==/lib/x86/libmonosgen-2.0.so (mono_threads_transition_do_blocking+258) (BuildId: b67e93dd750dafdd6f65f408b021b6a3a74868ac)
05-14 08:06:12.849 31274 31274 F DEBUG   :       #8 pc 0012a406  /data/app/~~rMrkpKmVPaBpM5jKb8fPAg==/com.microsoft.maui-JfRo8RWSDJaNtJuBa0y7_Q==/lib/x86/libmonosgen-2.0.so (mono_threads_enter_gc_safe_region_unbalanced_with_info+134) (BuildId: b67e93dd750dafdd6f65f408b021b6a3a74868ac)
05-14 08:06:12.849 31274 31274 F DEBUG   :       #9 pc 0012a27e  /data/app/~~rMrkpKmVPaBpM5jKb8fPAg==/com.microsoft.maui-JfRo8RWSDJaNtJuBa0y7_Q==/lib/x86/libmonosgen-2.0.so (mono_threads_enter_gc_safe_region_internal+46) (BuildId: b67e93dd750dafdd6f65f408b021b6a3a74868ac)
05-14 08:06:12.849 31274 31274 F DEBUG   :       #10 pc 000799a7  /data/app/~~rMrkpKmVPaBpM5jKb8fPAg==/com.microsoft.maui-JfRo8RWSDJaNtJuBa0y7_Q==/lib/x86/libmonosgen-2.0.so (mono_loader_lock+71) (BuildId: b67e93dd750dafdd6f65f408b021b6a3a74868ac)
05-14 08:06:12.849 31274 31274 F DEBUG   :       #11 pc 000447a1  /data/app/~~rMrkpKmVPaBpM5jKb8fPAg==/com.microsoft.maui-JfRo8RWSDJaNtJuBa0y7_Q==/lib/x86/libmonosgen-2.0.so (mono_class_create_from_typedef+129) (BuildId: b67e93dd750dafdd6f65f408b021b6a3a74868ac)
05-14 08:06:12.849 31274 31274 F DEBUG   :       #12 pc 0003c073  /data/app/~~rMrkpKmVPaBpM5jKb8fPAg==/com.microsoft.maui-JfRo8RWSDJaNtJuBa0y7_Q==/lib/x86/libmonosgen-2.0.so (mono_class_get_checked+99) (BuildId: b67e93dd750dafdd6f65f408b021b6a3a74868ac)
05-14 08:06:12.849 31274 31274 F DEBUG   :       #13 pc 0003cc0f  /data/app/~~rMrkpKmVPaBpM5jKb8fPAg==/com.microsoft.maui-JfRo8RWSDJaNtJuBa0y7_Q==/lib/x86/libmonosgen-2.0.so (mono_class_from_name_checked_aux+735) (BuildId: b67e93dd750dafdd6f65f408b021b6a3a74868ac)
05-14 08:06:12.849 31274 31274 F DEBUG   :       #14 pc 00037989  /data/app/~~rMrkpKmVPaBpM5jKb8fPAg==/com.microsoft.maui-JfRo8RWSDJaNtJuBa0y7_Q==/lib/x86/libmonosgen-2.0.so (mono_class_from_name_checked+73) (BuildId: b67e93dd750dafdd6f65f408b021b6a3a74868ac)
05-14 08:06:12.849 31274 31274 F DEBUG   :       #15 pc 000cc5f4  /data/app/~~rMrkpKmVPaBpM5jKb8fPAg==/com.microsoft.maui-JfRo8RWSDJaNtJuBa0y7_Q==/lib/x86/libmonosgen-2.0.so (mono_reflection_get_type_internal+132) (BuildId: b67e93dd750dafdd6f65f408b021b6a3a74868ac)
05-14 08:06:12.849 31274 31274 F DEBUG   :       #16 pc 000c9bce  /data/app/~~rMrkpKmVPaBpM5jKb8fPAg==/com.microsoft.maui-JfRo8RWSDJaNtJuBa0y7_Q==/lib/x86/libmonosgen-2.0.so (mono_reflection_get_type_with_rootimage+126) (BuildId: b67e93dd750dafdd6f65f408b021b6a3a74868ac)
05-14 08:06:12.849 31274 31274 F DEBUG   :       #17 pc 000ca204  /data/app/~~rMrkpKmVPaBpM5jKb8fPAg==/com.microsoft.maui-JfRo8RWSDJaNtJuBa0y7_Q==/lib/x86/libmonosgen-2.0.so (_mono_reflection_get_type_from_info+292) (BuildId: b67e93dd750dafdd6f65f408b021b6a3a74868ac)
05-14 08:06:12.849 31274 31274 F DEBUG   :       #18 pc 000ca06e  /data/app/~~rMrkpKmVPaBpM5jKb8fPAg==/com.microsoft.maui-JfRo8RWSDJaNtJuBa0y7_Q==/lib/x86/libmonosgen-2.0.so (mono_reflection_type_from_name_checked+334) (BuildId: b67e93dd750dafdd6f65f408b021b6a3a74868ac)
05-14 08:06:12.849 31274 31274 F DEBUG   :       #19 pc 000c9f01  /data/app/~~rMrkpKmVPaBpM5jKb8fPAg==/com.microsoft.maui-JfRo8RWSDJaNtJuBa0y7_Q==/lib/x86/libmonosgen-2.0.so (mono_reflection_type_from_name+49) (BuildId: b67e93dd750dafdd6f65f408b021b6a3a74868ac)
05-14 08:06:12.849 31274 31274 F DEBUG   :       #20 pc 0001b40b  /data/app/~~rMrkpKmVPaBpM5jKb8fPAg==/com.microsoft.maui-JfRo8RWSDJaNtJuBa0y7_Q==/lib/x86/libmonodroid.so (xamarin::android::internal::EmbeddedAssemblies::typemap_java_to_managed(char const*)+427) (BuildId: 9726f32ad5f8fa5e7c5762baf2f6e3294da41cc1)
05-14 08:06:12.849 31274 31274 F DEBUG   :       #21 pc 0001b551  /data/app/~~rMrkpKmVPaBpM5jKb8fPAg==/com.microsoft.maui-JfRo8RWSDJaNtJuBa0y7_Q==/lib/x86/libmonodroid.so (xamarin::android::internal::EmbeddedAssemblies::typemap_java_to_managed(_MonoString*)+113) (BuildId: 9726f32ad5f8fa5e7c5762baf2f6e3294da41cc1)
05-14 08:06:12.849 31274 31274 F DEBUG   :       #22 pc 000211a7  /data/app/~~rMrkpKmVPaBpM5jKb8fPAg==/com.microsoft.maui-JfRo8RWSDJaNtJuBa0y7_Q==/lib/x86/libmonodroid.so (xamarin::android::internal::MonodroidRuntime::typemap_java_to_managed(_MonoString*)+39) (BuildId: 9726f32ad5f8fa5e7c5762baf2f6e3294da41cc1)
```
MichalStrehovsky pushed a commit to MichalStrehovsky/runtimelab that referenced this pull request Oct 15, 2021
runtimelab-bot pushed a commit that referenced this pull request Jun 22, 2022
* Initial implementation for contract customization

fix build errors

Move converter rooting to DefaultJsonTypeInfoResolver so that it can be used standalone

Fix ConfigurationList.IsReadOnly

Minor refactorings (#1)

* Makes the following changes:

* Move singleton initialization for DefaultTypeInfoResolver behind a static property.
* Consolidate JsonSerializerContext & IJsonTypeInfoResolver values to a single field.
* Move reflection fallback logic away from JsonSerializerContext and into JsonSerializerOptions

* Update src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.cs

* remove testing of removed field

Simplify the JsonTypeInfo.CreateObject implemenetation (#2)

* Simplify the JsonTypeInfo.CreateObject implemenetation

* Update src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonTypeInfoOfT.cs

* Update src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonTypeInfoOfT.cs

Co-authored-by: Krzysztof Wicher <[email protected]>

Co-authored-by: Krzysztof Wicher <[email protected]>

Tests and fixes for JsonTypeInfoKind.None

TypeInfo type mismatch tests

Allow setting NumberHandling on JsonTypeInfoKind.None

test resolver returning wrong type of options

JsonTypeInfo/JsonPropertyInfo mutability tests

rename test file

Move default converter rooting responsibility behind DefaultJsonTypeInfoResolver (#3)

* Move default converter rooting responsibility behind DefaultJsonTypeInfoResolver

* address feedback

Add simple test for using JsonTypeInfo<T> with APIs directly taking it

fix and tests for untyped/typed CreateObject

uncomment test cases, remove todo

More tests and tiny fixes

Add a JsonTypeInfoResolver.Combine test for JsonSerializerContext (#4)

* Fix JsonTypeInfoResolver.Combine for JsonSerializerContext

* Break up failing test

Fix simple scenarios for combining contexts (#6)

* Fix simple scenarios for combining contexts

* feedback

JsonSerializerContext combine test with different camel casing

Remove unneeded virtual calls & branching when accessing Get & Set delegates (#7)

JsonPropertyInfo tests everything minus ShouldSerialize & NumberHandling

Update src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonConverterOfT.cs

Update src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonConverterOfT.cs

throw InvalidOperationException rather than ArgumentNullException for source gen when PropertyInfo.Name is assigned through JsonPropertyInfoValues

tests for duplicated property names and JsonPropertyInfo.NumberHandling

Add tests for NumberHandling and failing tests for ShouldSerialize

disable the failing test and add extra checks

disable remainder of the failing ShouldSerialize tests, fix working one

Fix ShouldSerialize and IgnoreCondition interop

Add failing tests for CreateObject + parametrized constructors

Fix CreateObject support for JsonConstructor types (#10)

* Fix CreateObject support for JsonConstructor types

* address feedback

Make contexts more combinator friendly (#9)

* Make contexts more combinator friendly

* remove converter cache

* redesign test to account for JsonConstructorAttribute

* Combine unit tests

* address feedback

* Add acceptance tests for DataContract attributes & Specified pattern (#11)

* Add private field serialization acceptance test (#13)

* tests, PR feedback (#14)

* PR feedback and extra tests

* Shorten class name, remove incorrect check (not true for polimorphic cases)

* Make parameter matching for custom properties map property Name with parameter (#16)

* Test static initialization with JsonTypeInfo (#17)

* Fix test failures and proper fix this time (#18)

* Fix test failures and proper fix this time

* reinstate ActiveIssueAttribute

* PR feedback and adjust couple of tests which don't set TypeInfoResolver

* fix IAsyncEnumerable tests

* Lock JsonSerializerOptions in JsonTypeInfo.EnsureConfigured()

Co-authored-by: Eirik Tsarpalis <[email protected]>

Co-authored-by: Eirik Tsarpalis <[email protected]>
yowl pushed a commit to yowl/runtimelab that referenced this pull request Nov 8, 2025
…740)

Recent work now allows us to finally add support for the backend to
extract fields out of parameters without spilling them to stack.
Previously this was only supported when the fields mapped cleanly to
registers.

A win-x64 example:
```csharp
static int Foo(int? foo)
{
    return foo.HasValue ? foo.Value : 0;
}
```
```diff
 ; Method Program:Foo(System.Nullable`1[int]):int (FullOpts)
 G_M19236_IG01:  ;; offset=0x0000
-       mov      qword ptr [rsp+0x08], rcx
-						;; size=5 bbWeight=0.50 PerfScore 0.50
+						;; size=0 bbWeight=0.50 PerfScore 0.00

-G_M19236_IG02:  ;; offset=0x0005
-       movzx    rcx, cl
-       xor      eax, eax
-       test     ecx, ecx
-       cmovne   eax, dword ptr [rsp+0x0C]
-						;; size=12 bbWeight=0.50 PerfScore 1.38
+G_M19236_IG02:  ;; offset=0x0000
+       movzx    rax, cl
+       shr      rcx, 32
+       xor      edx, edx
+       test     eax, eax
+       mov      eax, edx
+       cmovne   eax, ecx
+						;; size=16 bbWeight=0.50 PerfScore 0.88

-G_M19236_IG03:  ;; offset=0x0011
+G_M19236_IG03:  ;; offset=0x0010
        ret
 						;; size=1 bbWeight=0.50 PerfScore 0.50
-; Total bytes of code: 18
-
+; Total bytes of code: 17
```

Another win-x64 example:
```csharp
static float Sum(PointF p)
{
    return p.X + p.Y;
}
```

```diff
 ; Method Program:Sum(System.Drawing.PointF):float (FullOpts)
 G_M48891_IG01:  ;; offset=0x0000
-       mov      qword ptr [rsp+0x08], rcx
-						;; size=5 bbWeight=1 PerfScore 1.00
+						;; size=0 bbWeight=1 PerfScore 0.00

-G_M48891_IG02:  ;; offset=0x0005
-       vmovss   xmm0, dword ptr [rsp+0x08]
-       vaddss   xmm0, xmm0, dword ptr [rsp+0x0C]
-						;; size=12 bbWeight=1 PerfScore 8.00
+G_M48891_IG02:  ;; offset=0x0000
+       vmovd    xmm0, ecx
+       shr      rcx, 32
+       vmovd    xmm1, ecx
+       vaddss   xmm0, xmm0, xmm1
+						;; size=16 bbWeight=1 PerfScore 7.50

-G_M48891_IG03:  ;; offset=0x0011
+G_M48891_IG03:  ;; offset=0x0010
        ret
 						;; size=1 bbWeight=1 PerfScore 1.00
-; Total bytes of code: 18
+; Total bytes of code: 17
```

An arm64 example:
```csharp
static bool Test(Memory<int> mem)
{
    return mem.Length > 10;
}
```

```diff
 ; Method Program:Test(System.Memory`1[int]):ubyte (FullOpts)
 G_M53448_IG01:  ;; offset=0x0000
-            stp     fp, lr, [sp, #-0x20]!
+            stp     fp, lr, [sp, #-0x10]!
             mov     fp, sp
-            stp     x0, x1, [fp, #0x10]	// [V00 arg0], [V00 arg0+0x08]
-						;; size=12 bbWeight=1 PerfScore 2.50
+						;; size=8 bbWeight=1 PerfScore 1.50

-G_M53448_IG02:  ;; offset=0x000C
-            ldr     w0, [fp, #0x1C]	// [V00 arg0+0x0c]
+G_M53448_IG02:  ;; offset=0x0008
+            lsr     x0, x1, dotnet#32
             cmp     w0, dotnet#10
             cset    x0, gt
-						;; size=12 bbWeight=1 PerfScore 3.00
+						;; size=12 bbWeight=1 PerfScore 2.00

-G_M53448_IG03:  ;; offset=0x0018
-            ldp     fp, lr, [sp], #0x20
+G_M53448_IG03:  ;; offset=0x0014
+            ldp     fp, lr, [sp], #0x10
             ret     lr
 						;; size=8 bbWeight=1 PerfScore 2.00
-; Total bytes of code: 32
+; Total bytes of code: 28
```

Float -> float extractions that do not map cleanly is still not supported, but
should be doable (via vector register extractions). Float -> int extractions are
not supported, but I'm not sure we see these.

This is often not a code size improvement, but typically a perfscore
improvement. Also this seems to have some bad interactions with call arguments
since they do not yet support something similar, but hopefully that can be
improved separately.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.