-
Notifications
You must be signed in to change notification settings - Fork 5.2k
JIT: Use jitstd::utility::scoped_code to unmark trees during lowering
#106046
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
JIT: Use jitstd::utility::scoped_code to unmark trees during lowering
#106046
Conversation
|
/azp run runtime-coreclr superpmi-asmdiffs-checked-release |
|
Azure Pipelines successfully started running 1 pipeline(s). |
gtLIRFlags state on Debug path in Lowering::TryMakeIndirsAdjacentjitstd::utility::scoped_code to unmark trees during lowering
|
/azp run runtime-coreclr superpmi-asmdiffs-checked-release |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
cc @dotnet/jit-contrib, @jakobbotsch PTAL. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a chance (I'm not 100% sure, I haven't tried it) that C++ can deduce the template argument, which can enable inlining the auto code = variable.
| auto code = [this, indir] { | ||
| UnmarkTree(indir); | ||
| }; | ||
| jitstd::utility::scoped_code<decltype(code)> finally(code); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| auto code = [this, indir] { | |
| UnmarkTree(indir); | |
| }; | |
| jitstd::utility::scoped_code<decltype(code)> finally(code); | |
| jitstd::utility::scoped_code finally([this, indir] { | |
| UnmarkTree(indir); | |
| }); |
| auto code = [this, store] { | ||
| UnmarkTree(store); | ||
| }; | ||
| jitstd::utility::scoped_code<decltype(code)> finally(code); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| auto code = [this, store] { | |
| UnmarkTree(store); | |
| }; | |
| jitstd::utility::scoped_code<decltype(code)> finally(code); | |
| jitstd::utility::scoped_code finally([this, store] { | |
| UnmarkTree(store); | |
| }); |
Thank you for the suggestion! I tried this, and it didn't compile... I don't think this type deduction works when it's used on a templated class, at least in C++11. |
|
Oh you are on C++11, this feature was added in C++17. 😔 |
Yeah, I'm not sure if we have any plans to upgrade in the near future, though it's helpful to know this is another pattern we could clean up if we did upgrade. |
Fixes #105971.
Lowering::TryMakeIndirsAdjacentandLowering::TryMakeIndirAndStoreAdjacentrequire that noGenTreenodes are marked upon entry, and that marked nodes are cleared upon exit, but in the case of the first method, not every exit path was unmarking the tree.jitstd::utility::scoped_codemakes this invariant clear.