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

Fix laziness closurization bug, add support for ADTs #1789

Merged
merged 1 commit into from
Jan 30, 2024

Conversation

yannham
Copy link
Member

@yannham yannham commented Jan 29, 2024

Depends on #1787
Closes #1788

This PR started as a small follow-up of #1770 adding closurization to ADTs, such that in an expression 'Foo exp (in the ideal final syntax), exp is properly shared and not recomputed many times, as for other datastructures (arrays and records).

Testing this unveiled #1788 which is related and rather simple to fix, so this PR does both: fixing other datastructure subexpressions being sometimes unduly re-evaluated, and add missing sharing (and thus avoid re-evaluation) for ADTs.

@yannham yannham requested review from jneem and vkleen January 29, 2024 14:16
@github-actions github-actions bot temporarily deployed to pull request January 29, 2024 14:20 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 29, 2024 15:19 Inactive
core/src/eval/mod.rs Outdated Show resolved Hide resolved
core/src/eval/mod.rs Outdated Show resolved Hide resolved
@github-actions github-actions bot temporarily deployed to pull request January 30, 2024 09:49 Inactive
@yannham yannham force-pushed the fix/adt-equality branch 2 times, most recently from 2bc3311 to 834f285 Compare January 30, 2024 16:28
@github-actions github-actions bot temporarily deployed to pull request January 30, 2024 16:46 Inactive
Base automatically changed from fix/adt-equality to master January 30, 2024 16:48
Copy link

dpulls bot commented Jan 30, 2024

🎉 All dependencies have been resolved !

This commit fixes an issue that has been introduced by the removal of
generated variables, together with the `should_update` optimization,
which tries to avoid thunk update that are unnecessary.

However, as detailed in the added documentation for should_update, this
didn't work well with the removal of generated variables, which would
materialize by not sharing inner expressions for variables whose value
was already a data structure in weak head normal form (arrays, records
or now enum variants). Inner expressions would be recomputed.

This commit fixes the issue by adding a condition that datastructure
that aren't yet closurized shouldn't eschew thunk update.

Doing so, this commit also adds the missing closurization of ADTs, which
caused enum variant's arguments to also be potentially re-evaluated many
time.

Co-authored-by: Viktor Kleen <viktor.kleen@tweag.io>
@github-actions github-actions bot temporarily deployed to pull request January 30, 2024 16:59 Inactive
@yannham yannham added this pull request to the merge queue Jan 30, 2024
Merged via the queue into master with commit d8c7456 Jan 30, 2024
5 checks passed
@yannham yannham deleted the fix/laziness-closurization branch January 30, 2024 17:07
@yannham yannham mentioned this pull request Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Some sub-expressions of thunks are re-evaluated several times
3 participants