Skip to content

JIT: consider phase to clean up mixed byref/native int uses #12122

Closed as not planned

Description

@AndyAyersMS

There are a number of examples of cases now where the jit has difficulty with mixed byref/native int uses of some resource. These come about from pointer reinterpretation methods like Unsafe.AsRef and other places.

Some examples: #10821, #11492

The idea here is to run a phase after inlining to build a globally consistent view of the type of a local, possibly introducing casts where appropriate (like morph's "cast out of gc") so that later phases can reason about type correctness in a strictly local fashion.

category:implementation
theme:ir
skill-level:expert
cost:large

Activity

  1. transferred this issue fromdotnet/coreclron Jan 31, 2020
  2. added this to the Future milestone on Jan 31, 2020
  3. added
    JitUntriaged
    on Oct 28, 2020
  4. AndyAyersMS commented on Jun 7, 2026

    @AndyAyersMS
    MemberAuthor

    Note

    This comment was drafted with assistance from GitHub Copilot.

    Closing as a duplicate of #10821, which has the richer discussion of repros, prior fix attempts (#48675, #56192), and current state. The "rewriter / cleanup phase for mixed byref / native int" work described here is the same fix being tracked there.

  5. locked and limited conversation to collaborators on Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    JitUntriagedarea-CodeGen-coreclr

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions