[RyuJit/WASW] Insert temporaries when needed in the stackifier#125146
Open
SingleAccretion wants to merge 1 commit intodotnet:mainfrom
Open
[RyuJit/WASW] Insert temporaries when needed in the stackifier#125146SingleAccretion wants to merge 1 commit intodotnet:mainfrom
SingleAccretion wants to merge 1 commit intodotnet:mainfrom
Conversation
8488681 to
d962722
Compare
Contributor
|
Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara |
To do this we need to maintain some more state, so convert the stackifier into a full walk over all blocks so that we can encapsulate this state better.
d962722 to
2bb75f5
Compare
This was referenced Mar 4, 2026
Open
Contributor
Author
|
@dotnet/jit-contrib |
Member
|
LGTM, thanks! Will defer the green check to Andy. |
AndyAyersMS
reviewed
Mar 5, 2026
Member
AndyAyersMS
left a comment
There was a problem hiding this comment.
Looks good overall; just left some questions on implementation details.
| lclNum = m_compiler->lvaGrabTemp(true DEBUGARG("Stackifier temporary")); | ||
| LclVarDsc* varDsc = m_compiler->lvaGetDesc(lclNum); | ||
| varDsc->lvType = genActualType(type); | ||
| assert(lclNum >= m_minimumTempLclNum); |
Member
There was a problem hiding this comment.
Seems a bit odd to me to defer creating a Temporary here and append it to the m_unusedTemps.
| void ReleaseTemporariesDefinedBy(GenTree* node) | ||
| { | ||
| assert(IsDataFlowRoot(node)); // We rely on the node not moving after this call. | ||
| if (!node->OperIs(GT_STORE_LCL_VAR)) |
Member
There was a problem hiding this comment.
I don't understand this check. Can't we see reordering under other top level node types?
| } | ||
|
|
||
| unsigned index = static_cast<unsigned>(ActualTypeToWasmValueType(node->TypeGet())); | ||
| Temporary* local = Remove(&m_unusedTemps[index]); |
Member
There was a problem hiding this comment.
If we didn't defer above we could assert here instead of allocating a new temporary.
| ArrayStack<GenTree**> m_stack; | ||
| unsigned m_minimumTempLclNum; | ||
| Temporary* m_availableTemps[static_cast<unsigned>(WasmValueType::Count)] = {}; | ||
| Temporary* m_unusedTemps[static_cast<unsigned>(WasmValueType::Count)] = {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
To do this we need to maintain some more state, so convert the stackifier into a full walk over all blocks so that we can encapsulate this state better.
Depends on #125073.