You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This brings back code that was removed in #6019, but now for repeated loads rather than trivial stores. When analyzing instructions we check whether the last instruction was an inc_rc or a dec_rc. If it was, we do not remove the repeated load.
Needing to bring this back is very strange to me. Repeat loads are essentially "trivial loads" and an extra inc rc instruction as in #6674 (comment)should just cause our array to be copied rather than mutated. We should continue to try and get a small reproduction of the issue to understand it better and bring it into our test suite.
Needing to bring this back is very strange to me. Repeat loads are essentially "trivial loads" and an extra inc rc instruction should just cause our array to be copied rather than mutated.
This is strange to me as well. Of course copying versus mutating can be a breaking change but in the linked issue the two inc_rc instructions should be to the same array in either case. Agreed on needing to investigate further with getting a reproduceable example as well.
I was testing something locally with the array_refcount intrinsic and found an interesting case where the equivalent of
Was returning 0 somehow. The actual example had another inc_rc after a printout of the first, and the second was zero as well. I wonder if these cases are related to something odd going on with ref counts behind the scenes.
Was returning 0 somehow. The actual example had another inc_rc after a printout of the first, and the second was zero as well. I wonder if these cases are related to something odd going on with ref counts behind the scenes.
Sorry, I forgot the context of what I was looking at. The issue there was that DIE was removing RCs it shouldn't be, specifically the very first one. It's probably not related to this issue after all.
Sanity check: do we still need this at all after #6585 ?
If so, I'm happy merging this now and creating an issue for later to investigate why the extra load is needed.
It isn't needed after #6585. We probably can close it, as this PR is a bit of a hack and shouldn't be necessary if we are laying down the correct instructions. It looks to provide an ~10% improvement in the uhashmap execution trace, but with slight increases in bytecode size and execution trace for every other program it affects.
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
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.
Description
Problem*
Resolves #6674
Summary*
This brings back code that was removed in #6019, but now for repeated loads rather than trivial stores. When analyzing instructions we check whether the last instruction was an inc_rc or a dec_rc. If it was, we do not remove the repeated load.
Needing to bring this back is very strange to me. Repeat loads are essentially "trivial loads" and an extra inc rc instruction as in #6674 (comment) should just cause our array to be copied rather than mutated. We should continue to try and get a small reproduction of the issue to understand it better and bring it into our test suite.
Another option is to simply revert #6088
Additional Context
Important information from the issue (#6674 (comment))
Documentation*
Check one:
PR Checklist*
cargo fmton default settings.