Skip to content

JIT: Control-flow guard checked interface calls should not materialize cell addresses twice #65076

@jakobbotsch

Description

@jakobbotsch

Description

We currently materialize indirection cell addresses twice for CFG checked interface calls on arm64:

Reproduction Steps

$env:COMPlus_TieredCompilation=0
$env:COMPlus_JitForceControlFlowGuard=1
[MethodImpl(MethodImplOptions.NoInlining)]
public static void M(I i)
{
    i.Foo();
}

We produce the following code:

G_M6547_IG02:              ;; offset=0008H
        D280010F          movz    x15, #8
        F2B9218F          movk    x15, #0xc90c LSL #16
        F2CFFFCF          movk    x15, #0x7ffe LSL #32
        F94001EF          ldr     x15, [x15]
        94000000          bl      CORINFO_HELP_VALIDATE_INDIRECT_CALL
        AA0F03E1          mov     x1, x15
        D280010B          movz    x11, #8
        F2B9218B          movk    x11, #0xc90c LSL #16
        F2CFFFCB          movk    x11, #0x7ffe LSL #32
        D63F0020          blr     x1

Expected behavior

We should only load the indirection cell address once.

Actual behavior

We load it twice.

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions