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

[WIP] Lazy attribute names #4154

Draft
wants to merge 29 commits into
base: master
Choose a base branch
from

Commits on Oct 19, 2020

  1. Configuration menu
    Copy the full SHA
    5ddfd1a View commit details
    Browse the repository at this point in the history
  2. Introduce Expr::evalAttr

    This is a version of Expr::eval that doesn't necessarily have to
    evaluate the value into a non-thunk, while returning a specific
    attribute
    
    The evalAttr of expressions that evaluate to a subexpression should call
    evalAttr on that subexpression, therefore bubbling up any potential
    thunks
    infinisil committed Oct 19, 2020
    Configuration menu
    Copy the full SHA
    e8fbaf6 View commit details
    Browse the repository at this point in the history

Commits on Oct 21, 2020

  1. Configuration menu
    Copy the full SHA
    48511ea View commit details
    Browse the repository at this point in the history
  2. Introduce ExprLazyBinOp and tLazyBinOp

    This introduces an expression base class that can be used for lazy
    binary operations, along with a value type for storing partial results
    of such expressions
    infinisil committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    35d5be4 View commit details
    Browse the repository at this point in the history
  3. Make ExprOpUpdate be an ExprLazyBinOp

    This makes the // operator lazy in attribute names, only evaluates what
    is necessary to get a specific attribute.
    infinisil committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    5b1ef7b View commit details
    Browse the repository at this point in the history
  4. Allocate LazyBinOp values separately from Value

    So as to not increase the sizeof(Value) from 24 bytes to 40 bytes
    infinisil committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    152048d View commit details
    Browse the repository at this point in the history
  5. Evaluate ExprOpUpdate sides with maybeThunk

    I think this is needed so that any variables on the sides get updated
    properly
    
    Without this,
    
      bin/nix-instantiate ~/src/nixpkgs/nixos --arg configuration ~/src/nixpkgs/nixos/modules/profiles/demo.nix -A vm
    
    fails with a segfault
    
    Not sure why this doesn't happen with the commit that makes // lazy
    though
    infinisil committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    f7c3553 View commit details
    Browse the repository at this point in the history

Commits on Oct 23, 2020

  1. Pass left/right lazyBinOp to update functions directly

    The previous implementation relied on uninitialized memory not being a
    certain value for it to work
    infinisil committed Oct 23, 2020
    Configuration menu
    Copy the full SHA
    7b947a7 View commit details
    Browse the repository at this point in the history

Commits on Oct 24, 2020

  1. Configuration menu
    Copy the full SHA
    4a2c47a View commit details
    Browse the repository at this point in the history

Commits on Oct 27, 2020

  1. Disable all inf rec checking for now

    Since it throws inf rec when it doesn't have to sometimes
    infinisil committed Oct 27, 2020
    Configuration menu
    Copy the full SHA
    e8a7a5b View commit details
    Browse the repository at this point in the history

Commits on Dec 1, 2020

  1. Implement infinite recursion detection again

    This time it also works with lazy binops
    
    The previous optimizations for prevention of allocation had to be undone
    
    Code still needs cleanup, but it should be sound
    infinisil committed Dec 1, 2020
    Configuration menu
    Copy the full SHA
    f99249d View commit details
    Browse the repository at this point in the history

Commits on Dec 2, 2020

  1. Simplify lazyBinOp handling a bit

    With the previous commit, passing left/right is now unnecessary
    infinisil committed Dec 2, 2020
    Configuration menu
    Copy the full SHA
    0edad24 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    d1d9f1e View commit details
    Browse the repository at this point in the history

Commits on Dec 4, 2020

  1. Remove duplicated methods by implementing evaluation handlers

    Every evaluation can now pass a handler, which is called once the
    resulting value is either a tAttrs or a tLazyAttrs
    
    There are two handlers:
    - One for weak head normal form (changes tLazyAttrs into tAttrs)
    - One for getting an attribute (lazily gets attributes from tLazyAttrs,
      strictly from tAttrs)
    infinisil committed Dec 4, 2020
    Configuration menu
    Copy the full SHA
    d89a995 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    1642440 View commit details
    Browse the repository at this point in the history
  3. Better EvalHandler design

    infinisil committed Dec 4, 2020
    Configuration menu
    Copy the full SHA
    272c728 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    b86bd8a View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    3584b83 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    ca1201f View commit details
    Browse the repository at this point in the history

Commits on Dec 5, 2020

  1. Fix __curPos test

    infinisil committed Dec 5, 2020
    Configuration menu
    Copy the full SHA
    42a8ff1 View commit details
    Browse the repository at this point in the history
  2. More position info

    infinisil committed Dec 5, 2020
    Configuration menu
    Copy the full SHA
    e291fc6 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    b97295e View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    a5add93 View commit details
    Browse the repository at this point in the history
  5. Embed LazyBinOp values into Value

    By using bitfields to encode the left/right blackhole for infinite
    recursion detection
    infinisil committed Dec 5, 2020
    Configuration menu
    Copy the full SHA
    acecc9d View commit details
    Browse the repository at this point in the history
  6. bitfield union magic

    infinisil committed Dec 5, 2020
    Configuration menu
    Copy the full SHA
    e5a3b04 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    5af84e6 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    ba195b7 View commit details
    Browse the repository at this point in the history
  9. Revert "Implement noAllocationValue for Expr's and use it to avoid so…

    …me allocs"
    
    This reverts commit 4a2c47a.
    infinisil committed Dec 5, 2020
    Configuration menu
    Copy the full SHA
    cff6f8f View commit details
    Browse the repository at this point in the history
  10. Remove Expr::getPos again

    infinisil committed Dec 5, 2020
    1 Configuration menu
    Copy the full SHA
    c3bbb4d View commit details
    Browse the repository at this point in the history