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

JIT: use explicit cast away GC when passing byref to unmanaged callees #107811

Merged
merged 2 commits into from
Sep 17, 2024

Conversation

AndyAyersMS
Copy link
Member

Revise the fix done in #39105 to make the cast from byref to native int via an explicit cast, rather than retyping the node.

Fixes #107045.

Revise the fix done in dotnet#39105 to make the cast from byref to native int via
an explicit cast, rather than retyping the node.

Fixes dotnet#107045.
@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 Sep 13, 2024
@AndyAyersMS
Copy link
Member Author

@EgorBo PTAL
cc @dotnet/jit-contrib

Two diffs expected (in Tier0 code). This IL comes from C++/CLI in wpf, so not planning on adding a test case.

@AndyAyersMS
Copy link
Member Author

ILC failing with

    X64Avx2 -> /__w/1/s/artifacts/tests/coreclr/linux.x64.Debug/nativeaot/SmokeTests/HardwareIntrinsics/X64Avx2/X64Avx2.dll
    Generating native code
    Unhandled exception: System.AggregateException: One or more errors occurred. (Object synchronization method was called from an unsynchronized block of code.)
     ---> System.Threading.SynchronizationLockException: Object synchronization method was called from an unsynchronized block of code.
       at System.Threading.ObjectHeader.Release(Object) + 0x14a
       at System.Threading.Monitor.Exit(Object) + 0x17
       at System.Resources.ResourceReader.GetValueForNameIndex(Int32) + 0x253
       at System.Resources.ResourceReader.ResourceEnumerator.get_Value() + 0xdd
       at ILCompiler.SubstitutionProvider.AssemblyFeatureInfo..ctor(EcmaModule, Logger, IReadOnlyDictionary`2, BodyAndFieldSubstitutions) + 0x5eb

Seems like it is unrelated... possibly #104340?

@AndyAyersMS
Copy link
Member Author

The other failure is similar (but maybe not the same) as #103525

    System.Numerics.Tensors.Tests.TensorSpanTests.TensorExtensionsSpanInTOut<Single>(tensorPrimitivesOperation: TensorPrimitivesSpanInTOut`1 { Method = Single Max(System.ReadOnlySpan`1[System.Single]), Target = null }, tensorOperation: TensorSpanInTOut`1 { Method = Single Max[Single](System.Numerics.Tensors.ReadOnlyTensorSpan`1[System.Single] ByRef), Target = null }) [FAIL]
      Assert.All() Failure: 1 out of 12 items in the collection did not pass.
      [11]: Item:  [1, 2, 3, 4, 5, ���]
            Error: Index was outside the bounds of the array.
      Stack Trace:
        /_/src/libraries/System.Numerics.Tensors/tests/TensorSpanTests.cs(236,0): at System.Numerics.Tensors.Tests.TensorSpanTests.TensorExtensionsSpanInTOut[T](TensorPrimitivesSpanInTOut`1 tensorPrimitivesOperation, TensorSpanInTOut`1 tensorOperation)

@AndyAyersMS AndyAyersMS merged commit f5acabe into dotnet:main Sep 17, 2024
108 checks passed
jtschuster pushed a commit to jtschuster/runtime that referenced this pull request Sep 17, 2024
dotnet#107811)

Revise the fix done in dotnet#39105 to make the cast from byref to native int via
an explicit cast, rather than retyping the node.

Fixes dotnet#107045.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JIT: Assertion failed 'tree->TypeIs(varDsc->TypeGet(), genActualType(varDsc)) ...
2 participants