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

CG2-specific failure in JIT/Intrinsics/TypeIntrinsics_r.csproj and TypeIntrinsics_ro.csproj #96336

Closed
trylek opened this issue Dec 27, 2023 · 2 comments · Fixed by #96358
Closed

Comments

@trylek
Copy link
Member

trylek commented Dec 27, 2023

OS: all
Architecture: all
Example log: https://dev.azure.com/dnceng-public/public/_build/results?buildId=509643&view=results

These two tests have apparently been failing in Crossgen2 mode for quite some time but it remained unnoticed because the somewhat hacky implementation of the helixpublishwitharcade.proj script suppressed the tests in the JIT/Intrinsics folder after the JIT/SIMD tests were converted to the merged test model, for more detailed explanation please see:

#96333

The problematic check is the following one:

        IsTrue(typeof(GenericEnumClass<>).GetGenericArguments()[0].IsEnum);

The test refers to the following class declaration:

public class GenericEnumClass<T> where T : Enum
{
    public T field;
}

Without CG2, runtime JIT optimizes the call to typeof(GenericEnumClass<>).GetGenericArguments into a plain

mov rax, [<MethodTablePtr>+0x70]

that apparently has the IsEnum flag set for the type representing the constrained parameter T; in CG2 mode without JIT optimizations, we use the combination of the helper

GET_RUNTIME_TYPE_HANDLE

and the managed method

System.Type System.Type.GetTypeFromHandle(System.RuntimeTypeHandle)

In CG2 mode with JIT optimizations turned on, we end up calling

GET_RUNTIME_TYPE_HANDLE

immediately followed by the call to GetGenericArguments i.o.w. we optimize out the call to Type.GetTypeFromHandle. In either case the IsEnum check on the first generic argument doesn't hold. At the first glance it seems to me that this is a bug in the implementation of the runtime helper but I may be mistaken.

Thanks

Tomas

/cc @dotnet/jit-contrib

@ghost ghost added the untriaged New issue has not been triaged by the area owner label Dec 27, 2023
@trylek trylek added this to the 9.0.0 milestone Dec 27, 2023
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Dec 27, 2023
@trylek
Copy link
Member Author

trylek commented Dec 27, 2023

Possibly related to: #54867

@jkotas
Copy link
Member

jkotas commented Dec 28, 2023

If this is CG2 specific failure, the problem is most likely in a wrong fixup signature produced by CG2.

jkotas added a commit to jkotas/runtime that referenced this issue Dec 31, 2023
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Dec 31, 2023
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Jan 1, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Feb 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants