Skip to content

JIT: reconsider how to express managed pointer creation null checks #7882

Closed

Description

@AndyAyersMS

The JIT must track when managed pointer creation (via ldflda) will need an explicit null check. In most cases the check can be left implicit since the pointer is immediately dereferenced with a sufficiently small offset from the base object that no explicit check on the base is needed.

We may want to reconsider how the jit does this.

This tracking is currently done in Morph using the MorphAddressContext to model whether a dereference is imminent and what is known about the cumulative offset.

Relevant discussion in dotnet/coreclr#10956.
category:implementation
theme:morph
skill-level:expert
cost:medium

Activity

  1. changed the title [-]JIT: reconsider how to express byref creation null checks[/-] [+]JIT: reconsider how to express manged pointer creation null checks[/+] on Apr 15, 2017
  2. changed the title [-]JIT: reconsider how to express manged pointer creation null checks[/-] [+]JIT: reconsider how to express managed pointer creation null checks[/+] on Apr 15, 2017
  3. transferred this issue fromdotnet/coreclron Jan 31, 2020
  4. added this to the Future milestone on Jan 31, 2020
  5. TIHan commented on Nov 1, 2023

    @TIHan
    Contributor

    May be worth investigating for .NET 9.

  6. modified the milestones: Future, 9.0.0 on Nov 1, 2023
  7. removed
    JitUntriagedCLR JIT issues needing additional triage
    on Nov 1, 2023
  8. modified the milestones: 9.0.0, Future on Apr 14, 2024
  9. AndyAyersMS commented on Apr 14, 2024

    @AndyAyersMS
    MemberAuthor

    May be worth investigating for .NET 9.

    Perhaps but without specific examples to study, it's hard to know if there's still a problem. I will leave this open for now but likely we'll just end up closing it.

  10. AndyAyersMS commented on Jun 7, 2026

    @AndyAyersMS
    MemberAuthor

    Morph Address Context is gone: #127684

  11. 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

Labels

area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIenhancementProduct code improvement that does NOT require public API changes/additions

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions