Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Conversation

@AndyAyersMS
Copy link
Member

Consolidate various compiler globals used when setting local var ref
counts by folding them into the visitor:

  • lvaMarkRefsCurBlock
  • lvaMarkRefsCurStmt
  • lvaMarkRefsWeight

Remove the largely vestigial lvPrefReg and associated methods to set
or modify this field. Haven't verified but this is likely a remmant of
the legacy backend.

In the one remaning use (lcl var sorting predicates), swap in lvIsRegArg
instead, which gets most of the same cases.

Consolidate various compiler globals used when setting local var ref
counts by folding them into the visitor:
* lvaMarkRefsCurBlock
* lvaMarkRefsCurStmt
* lvaMarkRefsWeight

Remove the largely vestigial `lvPrefReg` and associated methods to set
or modify this field. Haven't verified but this is likely a remmant of
the legacy backend.

In the one remaning use (lcl var sorting predicates), swap in `lvIsRegArg`
instead, which gets most of the same cases.
@AndyAyersMS
Copy link
Member Author

@dotnet/jit-contrib PTAL

Some minimal diffs:

PMI Diffs for System.Private.CoreLib.dll, framework assemblies for x64 default jit
Summary:
(Lower is better)
Total bytes of diff: 4 (0.00% of base)
    diff is a regression.
Top file regressions by size (bytes):
           9 : System.Private.DataContractSerialization.dasm (0.00% of base)
Top file improvements by size (bytes):
          -5 : Microsoft.CodeAnalysis.CSharp.dasm (0.00% of base)
2 total files with size differences (1 improved, 1 regressed), 128 unchanged.
Top method regressions by size (bytes):
           9 : System.Private.DataContractSerialization.dasm - XmlBufferReader:Equals2(int,int,ref):bool:this (3 methods)
Top method improvements by size (bytes):
          -5 : Microsoft.CodeAnalysis.CSharp.dasm - DataFlowPass:UseNonFieldSymbolUnsafely(ref):ref:this
2 total methods with size differences (1 improved, 1 regressed), 170552 unchanged.

Total bytes of diff: 13 (0.00% of base)
    diff is a regression.
Top file regressions by size (bytes):
           9 : System.Private.DataContractSerialization.dasm (0.00% of base)
           4 : Microsoft.CodeAnalysis.CSharp.dasm (0.00% of base)
2 total files with size differences (0 improved, 2 regressed), 128 unchanged.
Top method regressions by size (bytes):
           9 : System.Private.DataContractSerialization.dasm - XmlBufferReader:Equals2(int,int,ref):bool:this (3 methods)
           4 : Microsoft.CodeAnalysis.CSharp.dasm - Binder:BindConditionalLogicalOperator(ref,ref,ref,ref):ref:this
2 total methods with size differences (0 improved, 2 regressed), 142656 unchanged.

Copy link

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

Nice! I'm loving all this cleanup. I just had one comment suggestion.

// stmt - stmt that the tree node belongs to
//
// Notes:
// Invoked via the MarkLocalVarsVisitor

Choose a reason for hiding this comment

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

Might be nice to add a bit more detail here about what the "and more" is - e.g. "In addition to increment local var reference counts, it identifies additional local var properties such as those used by assertion prop."

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks. I was surprised how much it did and never got back to filling it all in.

Ok if I do this in my next change? I need to make sure that the only required part for minopts is having nonzero ref counts.

Choose a reason for hiding this comment

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

Fine with me, this is already way better than what was there!

@AndyAyersMS
Copy link
Member Author

OSX failures look like the somewhat typical IO pal test failures:

file_io.GetFileSize.test1
file_io.GetFileSizeEx.test1
file_io.SetFilePointer.test5
file_io.SetFilePointer.test6
file_io.SetFilePointer.test7

@dotnet-bot retest OSX10.12 x64 Checked Innerloop Build and Test

Copy link

@briansull briansull 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


// This fires when an uninitialize value for 'weight' is used (see lvaMarkRefsWeight)
// This fires when an uninitialize value for 'weight' is used
assert(weight != 0xdddddddd);

Choose a reason for hiding this comment

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

The value here '0xdddddddd' depends upon the value JitDefaultFill, we should fix this to call the method:
T UninitializedWord(Compiler* comp)
so that it compares with the correct value when JitDefaultFill isn't 0xdd.
Also code like this cause problems if we try to set JitDefaultFill to the value of 0x00 and sometimes 0x01 causes problems.

Copy link
Member Author

Choose a reason for hiding this comment

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

Now that the weight always comes in via a parameter and not a field on the compiler instance this check seems much less useful anyways.

So I'd suggest we just remove it. Will do this in my next round of cleanups.

@AndyAyersMS AndyAyersMS merged commit 456d227 into dotnet:master Jul 23, 2018
@AndyAyersMS AndyAyersMS deleted the LclVarsCleanup branch July 23, 2018 18:47
jashook pushed a commit to jashook/coreclr that referenced this pull request Aug 14, 2018
Consolidate various compiler globals used when setting local var ref
counts by folding them into the visitor:
* lvaMarkRefsCurBlock
* lvaMarkRefsCurStmt
* lvaMarkRefsWeight

Remove the largely vestigial `lvPrefReg` and associated methods to set
or modify this field. Haven't verified but this is likely a remmant of
the legacy backend.

In the one remaning use (lcl var sorting predicates), swap in `lvIsRegArg`
instead, which gets most of the same cases.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants