Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intrinsify typeof(T).IsGenericType #99555

Merged

Conversation

Sergio0694
Copy link
Contributor

Contributes to #96898

public static bool Test<T>() => typeof(T).IsGenericType;

Codegen diffs:

; Assembly listing for method Methods:Test[int]():ubyte (FullOpts)
-   sub      rsp, 40
-   mov      rcx, 0x1D980105580      ; 'System.Int32'
-   call     [System.RuntimeType:get_IsGenericType():ubyte:this]
-   add      rsp, 40
+   xor      eax, eax
    ret

; Assembly listing for method Methods:Test[System.Nullable`1[int]]():ubyte (FullOpts)
-   sub      rsp, 40
-   mov      rcx, 0x1D980109298 
-   call     [System.RuntimeType:get_IsGenericType():ubyte:this]
-   nop 
-   add      rsp, 40
+   mov      eax, 1
    ret      

; Assembly listing for method Methods:Test[System.Collections.Generic.KeyValuePair`2[System.__Canon,System.__Canon]]():ubyte (FullOpts)
-   sub      rsp, 40
-   mov      qword ptr [rsp+0x20], rcx
-   mov      rcx, qword ptr [rcx+0x38]
-   mov      rcx, qword ptr [rcx]
-   call     CORINFO_HELP_TYPEHANDLE_TO_RUNTIMETYPE
-   mov      rcx, rax
-   call     [System.RuntimeType:get_IsGenericType():ubyte:this]
-   nop      
-   add      rsp, 40
+   mov      eax, 1
    ret

Note

Reopening from #97148 because I force pushed while that was closed 😅

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Mar 11, 2024
@Sergio0694 Sergio0694 force-pushed the user/sergiopedri/is-generic-type-intrinsic branch from 95c36b3 to 721ad3f Compare March 11, 2024 19:00
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Mar 11, 2024
@Sergio0694 Sergio0694 requested a review from EgorBo March 11, 2024 19:01
@AaronRobinsonMSFT
Copy link
Member

/cc @davidwrighton

@Sergio0694 Sergio0694 force-pushed the user/sergiopedri/is-generic-type-intrinsic branch from 721ad3f to 5489ea9 Compare March 11, 2024 20:43
@Sergio0694
Copy link
Contributor Author

@MihuBot

src/coreclr/inc/corinfo.h Outdated Show resolved Hide resolved
@AaronRobinsonMSFT AaronRobinsonMSFT added the needs-author-action An issue or pull request that requires more info or actions from the author. label Mar 12, 2024
@dotnet-policy-service dotnet-policy-service bot removed the needs-author-action An issue or pull request that requires more info or actions from the author. label Mar 12, 2024
@Sergio0694 Sergio0694 force-pushed the user/sergiopedri/is-generic-type-intrinsic branch 2 times, most recently from c2452c0 to 5412512 Compare March 12, 2024 21:02
@Sergio0694
Copy link
Contributor Author

@MihuBot

@Sergio0694
Copy link
Contributor Author

@MihuBot

@Sergio0694 Sergio0694 force-pushed the user/sergiopedri/is-generic-type-intrinsic branch from 0ff7827 to 75967c2 Compare June 16, 2024 16:16
@Sergio0694
Copy link
Contributor Author

Only non-well-known failing test seems to be:

LibraryImportGenerator.UnitTests.Compiles.ValidateNoGeneratedOutputForNoImport

NuGet.Protocol.Core.Types.FatalProtocolException : An error occurred while retrieving package metadata for 'Microsoft.NETFramework.ReferenceAssemblies.net48.1.0.2' from source 'nuget.org'.
---- System.Net.Http.HttpRequestException : A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (api.nuget.org:443)
-------- System.Net.Sockets.SocketException : A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

Seems unrelated?

@MihaZupan MihaZupan merged commit f4fd3ea into dotnet:main Jun 16, 2024
149 of 153 checks passed
@Sergio0694 Sergio0694 deleted the user/sergiopedri/is-generic-type-intrinsic branch June 16, 2024 18:49
@github-actions github-actions bot locked and limited conversation to collaborators Jul 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants