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

Enhances stack safety for Eval. #1888

Merged
merged 5 commits into from
Sep 28, 2017
Merged

Commits on Sep 2, 2017

  1. Add a stack safety stress test for Eval.

    The basic idea is to create very deep chains of operations to try to expose any
    stack problems. We know that for things like map/flatMap Eval seems to work, so
    let's just randomly construct deeply-nested Eval expressions to see what
    happens.
    
    This test exposed a weakness with .memoize which is fixed.
    
    As part of this commit, I noticed that our Arbitrary[Eval[A]] instances were
    somewhat weak, so I upgraded them.
    non committed Sep 2, 2017
    Configuration menu
    Copy the full SHA
    045b195 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    cebeb4e View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    52ca2ca View commit details
    Browse the repository at this point in the history

Commits on Sep 3, 2017

  1. Better memoization support for flatMap.

    This fix was proposed by @johnynek and fixes a bug I introduced with
    how memoization was handled during flatMap evaluation. Our old
    implementation did memoize intermediate values correctly (which meant
    that three different evals mapped from the same source shared a
    memoized value). However, it was not stack-safe. My fix introduced
    stack-safety but broke this intermediate memoization.
    
    The new approach uses a new node (Eval.Memoize) which can be
    mutably-updated (much like Later). It's confirmed to be stack-safe and
    to handle intermediate values correctly.
    
    While it was unlikely that anyone was doing enough intermediate
    memoization to cause actual stack overflows, it's nice to know that
    this is now impossible.
    erik-stripe committed Sep 3, 2017
    Configuration menu
    Copy the full SHA
    12d6fd0 View commit details
    Browse the repository at this point in the history
  2. 1 Configuration menu
    Copy the full SHA
    c9572b2 View commit details
    Browse the repository at this point in the history