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

Change subtrace_len computation algo in FoldFSM #138

Merged
merged 8 commits into from
Sep 20, 2021

Conversation

mikevoronov
Copy link
Member

@mikevoronov mikevoronov commented Sep 19, 2021

Previously, to handle scripts like this

(fold
   (par
      (next
       ...

there was a temporary solution based on additional field called total_subtrace_len. This solution is needed because of Par and Fold decribe their subtree lens differently with respect to next instruction: Par includes states that next brings, while Fold not.

The new algo changes this scheme and does a convolution of a Fold subtrace_len. Let's it on examples, imagine a fold on stream with 3 elements that have the same generation, in this case convolution will look like this:

[1, 1] [2, 2] [3, 3] => [6, 1] [5, 3] [3, 6]
  g0     g0     g0

here a number before comma represents count of elements before next, and after the comma - after

For fold with 5 elements of two generations:

[1, 1] [2, 2] [3, 3] [4, 4] [5, 5] [1, 1] => [6, 1] [5, 3] [3, 6] [9, 4] [5, 9] [1, 1]
  g0     g0     g0     g1     g1     g2

This algo allows us to get rid of total_subtrace_len and all code that supports it.

Resolves #135.

@mikevoronov mikevoronov self-assigned this Sep 19, 2021
@mikevoronov mikevoronov merged commit d772787 into master Sep 20, 2021
@mikevoronov mikevoronov deleted the fix_total_subtrace_len branch September 20, 2021 11:49
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.

Bug: fix total_subtrace_len behaviour
2 participants