Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type memory maps with placeholders #61933

Conversation

SingleAccretion
Copy link
Contributor

@SingleAccretion SingleAccretion commented Nov 22, 2021

Use TYP_UNDEF (as TYP_MEM) for "first field"-like maps and TYP_UNKNOWN (as TYP_HEAP) for the heaps themselves.

This will enable the type validation logic to be more precise. For now though, just assert that the heap is always updated with the properly typed VNs.

Sample from the new dump showcasing the now-more-apparent hierarchy of maps:

***** BB01, STMT00000(before)
N006 (  6,  6) [000010] -A-XG-------              *  ASG       long  
N004 (  4,  4) [000009] *--XG--N----              +--*  IND       long  
N003 (  2,  2) [000016] -------N----              |  \--*  ADD       byref 
N001 (  1,  1) [000000] ------------              |     +--*  LCL_VAR   ref    V00 arg0         u:1 (last use)
N002 (  1,  1) [000015] ------------              |     \--*  CNS_INT   long   56 field offset Fseq[LargeStruct, SmallerStruct1, MultiRegStruct2, FirstLngValue]
N005 (  1,  1) [000008] ------------              \--*  CNS_INT   long   2

N001 [000000]   LCL_VAR   V00 arg0         u:1 (last use) => $80 {InitVal($40)}
N002 [000015]   CNS_INT   56 field offset Fseq[LargeStruct, SmallerStruct1, MultiRegStruct2, FirstLngValue] => $100 {LngCns:  56}
N003 [000016]   ADD       => $140 {ADD($80, $100)}
N005 [000008]   CNS_INT   2 => $101 {LngCns:  2}
    VNForHandle(LargeStruct) is $180, fieldType is struct, size = 96
    VNForMapSelect($c0, $180):mem returns $1c0 {$c0[$180]}
    VNForMapSelect($1c0, $80):struct returns $200 {$1c0[$80]}
    VNForHandle(SmallerStruct1) is $181, fieldType is struct, size = 48
    VNForMapSelect($200, $181):struct returns $201 {$200[$181]}
    VNForHandle(MultiRegStruct2) is $182, fieldType is struct, size = 16
    VNForMapSelect($201, $182):struct returns $202 {$201[$182]}
  VNApplySelectorsAssign:
    VNForHandle(FirstLngValue) is $183, fieldType is long
    VNForMapStore($202, $183, $101):struct in BB01 returns $240 {$202[$183 := $101]}
    VNForMapStore($201, $182, $240):struct in BB01 returns $241 {$201[$182 := $240]}
    VNForMapStore($200, $181, $241):struct in BB01 returns $242 {$200[$181 := $241]}
    VNForMapStore($1c0, $80, $242):mem in BB01 returns $280 {$1c0[$80 := $242]}
    VNForMapStore($c0, $180, $280):heap in BB01 returns $2c0 {$c0[$180 := $280]}
  fgCurMemoryVN[GcHeap] assigned for StoreField at [000010] to VN: $2c0.
N006 [000010]   ASG       => $VN.Void

No diffs.

Part of #58312.

Use TYP_UNDEF (as TYP_MEM) for "first field"-like maps and
TYP_UNKNOWN (as TYP_HEAP) for the heaps themselves.

This will enable the type validation logic to be more precise.
For now, just assert that the heap is always updated with the
properly typed VNs.
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Nov 22, 2021
@ghost ghost added the community-contribution Indicates that the PR has been added by a community member label Nov 22, 2021
@ghost
Copy link

ghost commented Nov 22, 2021

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

Issue Details

Use TYP_UNDEF (as TYP_MEM) for "first field"-like maps and TYP_UNKNOWN (as TYP_HEAP) for the heaps themselves.

This will enable the type validation logic to be more precise. For now though, just assert that the heap is always updated with the properly typed VNs.

No diffs are expected...

Author: SingleAccretion
Assignees: -
Labels:

area-CodeGen-coreclr

Milestone: -

@SingleAccretion
Copy link
Contributor Author

@dotnet/jit-contrib

@jakobbotsch jakobbotsch self-assigned this Nov 29, 2021
Copy link
Member

@jakobbotsch jakobbotsch left a comment

Choose a reason for hiding this comment

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

Looks good.

@jakobbotsch jakobbotsch merged commit d5f85c7 into dotnet:main Dec 1, 2021
@SingleAccretion SingleAccretion deleted the Improve-Handling-Of-Type-Mismatch-In-VN-Part-Five branch December 1, 2021 12:09
SingleAccretion added a commit to SingleAccretion/runtime that referenced this pull request Dec 29, 2021
Use TYP_UNDEF (as TYP_MEM) for "first field"-like maps and
TYP_UNKNOWN (as TYP_HEAP) for the heaps themselves.

This will enable the type validation logic to be more precise.
For now, just assert that the heap is always updated with the
properly typed VNs.
@ghost ghost locked as resolved and limited conversation to collaborators Jan 1, 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 community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants