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

Improve impPopCallArgs #68736

Merged
merged 6 commits into from
May 6, 2022
Merged

Conversation

jakobbotsch
Copy link
Member

@jakobbotsch jakobbotsch commented Apr 30, 2022

Today impPopCallArgs works in the following way:

  1. We first loop for the number of args to pop, popping each arg from the top of the stack
  2. As part of this loop we call impNormStructVal with CHECK_SPILL_ALL, which is necessary because we are normalizing the arguments in reverse order
  3. We finally insert the argument at the front of the arg list and then proceed to the next arg

When this is done, we loop through the arg list in order and walk the signature at the same time. We check that the implicit type coercions between the arg types and signature types are ok, and we insert some implicit casts and GT_PUTARG_TYPE.

This PR changes the loop to always walk the arguments on the stack in order. That means instead of popping arguments from the top of the stack and thus walking the arguments backwards, we start from the beginning. The benefit is that we can then walk the signature at the same time. Furthermore, when calling impNormStructVal we now only check interference with the stack entries that are not arguments since we now know that arguments will be normalized and kept in order.

While the fewer interference checks result in only small diffs, the main benefit of this change is that it will help the logic for an upcoming change where I want to consistently store signature types and class handles in CallArg. Having access to the signature when we create the args in the first place simplifies things.

Furthermore, I have cleaned things up a little bit by removing the possibility of sig being null. There was only one caller passing this, for a helper, and it can simply pop the arguments on its own.

@ghost ghost assigned jakobbotsch Apr 30, 2022
@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 Apr 30, 2022
@ghost
Copy link

ghost commented Apr 30, 2022

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

Issue Details

null

Author: jakobbotsch
Assignees: jakobbotsch
Labels:

area-CodeGen-coreclr

Milestone: -

@jakobbotsch jakobbotsch marked this pull request as ready for review May 1, 2022 10:27
@jakobbotsch
Copy link
Member Author

cc @dotnet/jit-contrib

@jakobbotsch
Copy link
Member Author

/azp run runtime-coreclr jitstress, runtime-coreclr libraries-jitstress

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@jakobbotsch
Copy link
Member Author

Failures are #68690, #68510, #68669, #68756 and #68513

@jakobbotsch
Copy link
Member Author

PTAL @AndyAyersMS

And use it from impPopCallArgs to avoid O(n^2) in checked builds
@jakobbotsch jakobbotsch merged commit 067e694 into dotnet:main May 6, 2022
@jakobbotsch jakobbotsch deleted the improve-impPopCallArgs branch May 6, 2022 08:15
@ghost ghost locked as resolved and limited conversation to collaborators Jun 5, 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.

2 participants