Skip to content

JIT: verify containment safety before forming address modes#65048

Merged
AndyAyersMS merged 1 commit intodotnet:mainfrom
AndyAyersMS:Fix64936
Feb 10, 2022
Merged

JIT: verify containment safety before forming address modes#65048
AndyAyersMS merged 1 commit intodotnet:mainfrom
AndyAyersMS:Fix64936

Conversation

@AndyAyersMS
Copy link
Member

At least on arm64, where LEAs must be contained.

Fixes #64936.

At least on arm64, where LEAs must be contained.

Fixes dotnet#64936.
@ghost ghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Feb 9, 2022
@ghost ghost assigned AndyAyersMS Feb 9, 2022
@ghost
Copy link

ghost commented Feb 9, 2022

Tagging subscribers to this area: @JulieLeeMSFT
See info in area-owners.md if you want to be subscribed.

Issue Details

At least on arm64, where LEAs must be contained.

Fixes #64936.

Author: AndyAyersMS
Assignees: -
Labels:

area-CodeGen-coreclr

Milestone: -

@AndyAyersMS
Copy link
Member Author

@EgorBo PTAL
cc @dotnet/jit-contrib

My local jit-format runs insist this is how things should format. Seems odd.

@AndyAyersMS
Copy link
Member Author

/azp run runtime-coreclr libraries-jitstress

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

#else
const bool isContainable = true;
#endif
TryCreateAddrMode(ind->Addr(), isContainable, ind);
Copy link
Member

@EgorBo EgorBo Feb 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TryCreateAddrMode is called with true from other places too so I wonder if those need this check as well (or maybe TryCreateAddrMode should just check it inside by itself

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be doing the "right" safety checks later when we actually mark the node contained.

So the issue is whether the target can handle a non-contained LEA. arm64 can't handle a non-contained LEA but xarch/arm32 can.

@AndyAyersMS
Copy link
Member Author

AndyAyersMS commented Feb 9, 2022

Handful of diffs, all regressions (not surprisingly). Many look to be gratuitous, perhaps spurious flags.

;; libraries.pmi

;; Internal.TypeSystem.Interop.ArrayMarshaller:GetElementMarshaller(int):Internal.TypeSystem.Interop.Marshaller:this

;; BEFORE
            ldr     w14, [x19,#96]
            str     w14, [x0,#88]

;; AFTER
            add     x14, x0, #88
            ldr     w15, [x19,#96]
            str     w15, [x14]

;; BEFORE
            ldrb    w14, [x19,#110]
            strb    w14, [x0,#110]

;; AFTER
            add     x14, x0, #110
            ldrb    w15, [x19,#110]
            strb    w15, [x14]

;; Number:NumberToString(byref,byref,ushort,int,System.Globalization.NumberFormatInfo,bool)

;; BEFORE
            ldrh    w1, [x1,#12]
            strh    w1, [x2, w0, UXTW #2]

;; AFTER
            ubfiz   x3, x0, #1, #32
            add     x2, x2, x3
            ldrh    w1, [x1,#12]
            strh    w1, [x2]

Let me look at a few of these in more detail.

@AndyAyersMS
Copy link
Member Author

AndyAyersMS commented Feb 9, 2022

Not clear to me if the failure this issue is addressing is still happening.

Looks like it is: https://dev.azure.com/dnceng/public/_build/results?buildId=1602009&view=results

@AndyAyersMS
Copy link
Member Author

/azp run runtime-coreclr outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@AndyAyersMS
Copy link
Member Author

AndyAyersMS commented Feb 9, 2022

Outerloop had two failures -- one looks like an OOM while jitting that we see from time to time (crossgen2, x86, hugeexpr1). The other looks like a flaky CI issue. Retrying the latter.

.dotnet/sdk/6.0.100/NuGet.RestoreEx.targets(19,5): error : (NETCORE_ENGINEERING_TELEMETRY=Restore) Failed to retrieve information about 'System.DirectoryServices.Protocols' from remote source 'https://pkgs.dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_packaging/45bacae2-5efb-47c8-91e5-8ec20c22b4f8/nuget/v3/flat2/system.directoryservices.protocols/index.json'.

@AndyAyersMS AndyAyersMS merged commit 2210b74 into dotnet:main Feb 10, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Mar 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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.

Assertion failed 'isGeneralRegister(reg3)' on R2R_CG2 linux-arm64 outerloop

2 participants