• Kevin Modzelewski's avatar
    Allow changing the number of default arguments · df2808da
    Kevin Modzelewski authored
    We already supported changing the values, but not the number
    of them.  The main trickiness here is
    - We had been assuming that the number of defaults was immutable,
      so I had to find the places that we used it and add invalidation.
    - We assumed that all functions based on the same source function would
      have the same number of defaults.
    
    For the first one, I found all the places that looked at the defaults array,
    which should hopefully be all the places that need invalidation.
    
    One tricky part is that we will embed the num_defaults data into code produced
    by the LLVM tier, and we currently don't have any mechanism for invalidating
    those functions.  This commit side-steps around that since the only functions that
    we can inline are the builtins, and those you aren't allowed to change the defaults
    anyway.  So I added a "can_change_defaults" flag.
    
    For the second part, I moved "num_defaults" from the CLFunction (our "code" object)
    to the BoxedFunction (our "function" object), and then changed the users to pull
    it from there.
    df2808da
set.cpp 20.4 KB