Skip to content

JIT: fix spill logic for local structs#797

Merged
AndyAyersMS merged 1 commit intodotnet:masterfrom
AndyAyersMS:FixRuntime764
Dec 13, 2019
Merged

JIT: fix spill logic for local structs#797
AndyAyersMS merged 1 commit intodotnet:masterfrom
AndyAyersMS:FixRuntime764

Conversation

@AndyAyersMS
Copy link
Copy Markdown
Member

If we're appending an assignment whose LHS is is a location within a local
struct, we need to spill all references to that struct from the eval stack.

Update the existing logic for this to handle the case where the LHS is a field
of a local struct, and the field is updated by unusual means (here, initobj).

Fixes #764.

If we're appending an assignment whose LHS is is a location within a local
struct, we need to spill all references to that struct from the eval stack.

Update the existing logic for this to handle the case where the LHS is a field
of a local struct, and the field is updated by unusual means (here, `initobj`).

Fixes dotnet#764.
@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Dec 12, 2019
@AndyAyersMS
Copy link
Copy Markdown
Member Author

@CarolEidt PTAL
cc @dotnet/jit-contrib

No diffs on x64 Fx + Tests (other than for this new test case).

Copy link
Copy Markdown
Contributor

@CarolEidt CarolEidt left a comment

Choose a reason for hiding this comment

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

LGTM - thanks!

@AndyAyersMS AndyAyersMS merged commit b16cb60 into dotnet:master Dec 13, 2019
AndyAyersMS added a commit to AndyAyersMS/coreclr that referenced this pull request Dec 14, 2019
Release/3.1 port of dotnet/runtime#797.
Fixes dotnet/runtime#764

The jit might incorrectly order a read from a struct field with an operation
that modifies the field, so that the read returns the wrong value.

Silent bad code; program behaves incorrectly.

Yes, introduced in the 3.0 cycle.

Verified the user's test case now passes; no diffs seen in any existing framework
or test code.

**Low**: the jit is now spilling the eval stack entries to temps in cases where it
did not before; this should be conservatively safe.

cc: @Brucefo

____

If we're appending an assignment whose LHS is is a location within a local
struct, we need to spill all references to that struct from the eval stack.

Update the existing logic for this to handle the case where the LHS is a field
of a local struct, and the field is updated by unusual means (here, `initobj`).

Fixes dotnet/runtime#764.
Anipik pushed a commit to dotnet/coreclr that referenced this pull request Jan 14, 2020
* [release/3.1] Port fix for JIT silent bad code

Release/3.1 port of dotnet/runtime#797.
Fixes dotnet/runtime#764

The jit might incorrectly order a read from a struct field with an operation
that modifies the field, so that the read returns the wrong value.

Silent bad code; program behaves incorrectly.

Yes, introduced in the 3.0 cycle.

Verified the user's test case now passes; no diffs seen in any existing framework
or test code.

**Low**: the jit is now spilling the eval stack entries to temps in cases where it
did not before; this should be conservatively safe.

cc: @Brucefo

____

If we're appending an assignment whose LHS is is a location within a local
struct, we need to spill all references to that struct from the eval stack.

Update the existing logic for this to handle the case where the LHS is a field
of a local struct, and the field is updated by unusual means (here, `initobj`).

Fixes dotnet/runtime#764.

* Fix test
@ghost ghost locked as resolved and limited conversation to collaborators Dec 11, 2020
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.

JIT optimization removes some necessary code in .NET Core 3.0/3.1

4 participants