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: redesign closures, then generic functions #13412

Merged
merged 46 commits into from
Jan 29, 2016
Merged

Commits on Jan 28, 2016

  1. more robust & simpler closure conversion

    now handles out-of-scope method adds more generally by just specializing
    captured values into the AST.
    
    also passes the keywordargs test
    
    fix capturing of static parameters. for now, treats them like normal variables
    
    bug fix: forgot to apply cl-convert to declared types in assignments
    
    more efficient closure conversion of some single-assigned variables
    
    don't generate constructor functions for closure types
    this is much more efficient in multiple respects. before, we spent
    too much time inserting into the Type method table.
    JeffBezanson committed Jan 28, 2016
    Configuration menu
    Copy the full SHA
    a1ee867 View commit details
    Browse the repository at this point in the history
  2. before saving system image, remove methods defined in replaced modules

    this eliminates a duplicate copy of inference0.ji that was ending up
    in inference.ji and sys.so.
    JeffBezanson committed Jan 28, 2016
    Configuration menu
    Copy the full SHA
    c99bcd6 View commit details
    Browse the repository at this point in the history
  3. repair inlining, restoring parity with master plus improvements on te…

    …st-perf
    
    give an error for trying to add a method to a function argument
    
    remove builtin definition of jl_box_type; can be moved to boot.jl
    
    don't allocate MethodTable for abstract types
    
    fix incorrect call to func_for_method/jl_instantiate_staged
    
    use os test macro instead of `if` in core tests
    JeffBezanson committed Jan 28, 2016
    Configuration menu
    Copy the full SHA
    6b1c6f3 View commit details
    Browse the repository at this point in the history
  4. fix binding-related method def errors

    - restore "must be imported to be extended" error
    - error for trying to add a method to a non-singleton
    
    deprecation warning for overloading `call`
    JeffBezanson committed Jan 28, 2016
    Configuration menu
    Copy the full SHA
    31d1a77 View commit details
    Browse the repository at this point in the history
  5. for constructors, use type as primary method cache key

    other functions continue to use first argument
    
    this seems to give generally better performance
    JeffBezanson committed Jan 28, 2016
    Configuration menu
    Copy the full SHA
    6455906 View commit details
    Browse the repository at this point in the history
  6. don't specialize on function arguments that aren't called

    this is a fairly effective heuristic for reducing unnecessary specialization
    on functions of many different types passed as arguments. higher-order functions
    that actually do work call their argument function(s), and so still get
    specialized.
    JeffBezanson committed Jan 28, 2016
    Configuration menu
    Copy the full SHA
    b79196d View commit details
    Browse the repository at this point in the history
  7. make jl_apply accept function and arguments contiguously, so the ar…

    …gument list
    
    doesn't need to be copied as often
    
    [ci skip]
    JeffBezanson committed Jan 28, 2016
    Configuration menu
    Copy the full SHA
    7a85e3b View commit details
    Browse the repository at this point in the history
  8. much more efficient jl_instantiate_staged

    more consistently use f+args type tuples in inference and reflection
    JeffBezanson committed Jan 28, 2016
    Configuration menu
    Copy the full SHA
    0314dd1 View commit details
    Browse the repository at this point in the history
  9. some developer docs for new function design

    manual and devdocs updates for function change
    
    document how I made this branch passably efficient
    
    [ci skip]
    JeffBezanson committed Jan 28, 2016
    Configuration menu
    Copy the full SHA
    2fbd67f View commit details
    Browse the repository at this point in the history
  10. 1 Configuration menu
    Copy the full SHA
    7882f35 View commit details
    Browse the repository at this point in the history
  11. fix to incremental serializer, get Distributions tests passing

    Precompile depended on kwsorter name
    JeffBezanson committed Jan 28, 2016
    Configuration menu
    Copy the full SHA
    1734836 View commit details
    Browse the repository at this point in the history
  12. remove "assignment to local function" error

    This error is not necessary.
    
    fix a regression (jb/functions) in macroexpand of global function defs
    
    improve error reporting in `functionloc`
    JeffBezanson committed Jan 28, 2016
    Configuration menu
    Copy the full SHA
    7c2f213 View commit details
    Browse the repository at this point in the history
  13. fix inference bug updating sv.vars after inlining

    this is applicable to master too, but seems much harder to trigger there
    JeffBezanson committed Jan 28, 2016
    Configuration menu
    Copy the full SHA
    6e03f9c View commit details
    Browse the repository at this point in the history
  14. update specialization heuristics to handle Callable

    this avoids blowup from the doc system
    JeffBezanson committed Jan 28, 2016
    Configuration menu
    Copy the full SHA
    51d3ee5 View commit details
    Browse the repository at this point in the history
  15. small fix to the front end; avoid excessive rearrangement during cl-c…

    …onvert
    
    this affects conditional definitions at the top level, e.g.
    
    if cond
    else
      type Foo; end
      g{T<:Foo}(x) = 0
    end
    
    we don't want to move the method def above the type def
    JeffBezanson committed Jan 28, 2016
    Configuration menu
    Copy the full SHA
    0b5e87a View commit details
    Browse the repository at this point in the history
  16. a fix to cfunction

    Some function-valued argument slots will now be specialized as `Any`,
    and we need to allow those to match Refs in cfunction.
    This was triggered by the Gtk.jl tests.
    
    undo some changes that aren't actually needed anymore
    
    restore some commented-out tests
    JeffBezanson committed Jan 28, 2016
    Configuration menu
    Copy the full SHA
    b43c5e0 View commit details
    Browse the repository at this point in the history
  17. refactor linfo.sparams

    Moves the sparam information from the AST to the LambdaInfo so that it
    is more accessible to method dispatch (among other uses)
    vtjnash authored and JeffBezanson committed Jan 28, 2016
    Configuration menu
    Copy the full SHA
    19e2d01 View commit details
    Browse the repository at this point in the history
  18. pass sparam_vals through to the jlcall if it wasn't known at compile-…

    …time
    
    this marks the low bit of the fptr to indicate to the frontend which jl_fptr_t calling convention should be used
    vtjnash authored and JeffBezanson committed Jan 28, 2016
    Configuration menu
    Copy the full SHA
    7a452a7 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    fe53d09 View commit details
    Browse the repository at this point in the history
  20. fix --compile=all

    and fix a method definition mistake in base which defined
    convert(T, Float64) where T could be a UnionType instead of a leaftype
    vtjnash authored and JeffBezanson committed Jan 28, 2016
    Configuration menu
    Copy the full SHA
    4c5add6 View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    3a31293 View commit details
    Browse the repository at this point in the history
  22. extend the --compile=all union splitting algorithm to handle unions t…

    …hat appear in the type signature directly
    vtjnash authored and JeffBezanson committed Jan 28, 2016
    Configuration menu
    Copy the full SHA
    3945d78 View commit details
    Browse the repository at this point in the history
  23. simplify linfo->unspecialized and staged function instantiation

    since the sparams env can now be passed directly into a function as an extra argument,
    linfo->unspecialized can (usually) be shared among all instances of a function
    (the only exception being the presence of intrinsics that are expecting to be able to call static_eval);
    the implementation of jl_instantiate_staged can be greatly simplified;
    and code_llvm can safely generate code for any function (via unspecialized), without corrupting the cached AST info
    vtjnash authored and JeffBezanson committed Jan 28, 2016
    Configuration menu
    Copy the full SHA
    062216a View commit details
    Browse the repository at this point in the history
  24. use explicit jlcall_api flag instead of stealing bits from the fptr

    x86 doesn't guarantee function-pointer alignment, and adding the gcc attribute to force it is probably not portable
    it shouldn' be particularly critical from a performace perspective anyhow
    vtjnash authored and JeffBezanson committed Jan 28, 2016
    Configuration menu
    Copy the full SHA
    0f62195 View commit details
    Browse the repository at this point in the history
  25. introduce a special symbol for ignored values

    Currently `#unused#`, but can be switched to `_` easily. Also only works
    for arguments so far; used for arguments marked `::T`.
    Also use the dedicated name `#self#` for the closure self argument.
    JeffBezanson committed Jan 28, 2016
    Configuration menu
    Copy the full SHA
    5c56746 View commit details
    Browse the repository at this point in the history
  26. capture static parameters as type parameters of closures

    fix #14610, closures inside argument type decls
    JeffBezanson committed Jan 28, 2016
    Configuration menu
    Copy the full SHA
    2845ca0 View commit details
    Browse the repository at this point in the history
  27. Configuration menu
    Copy the full SHA
    972bf21 View commit details
    Browse the repository at this point in the history
  28. fix large performance regression in remotecall on jb/functions

    This was mostly due to sending a fresh copy of a closure's type every
    time. Now reused using the same mechanism as LambdaStaticData.
    Also, toplevel named functions are assumed present on all processors.
    JeffBezanson committed Jan 28, 2016
    Configuration menu
    Copy the full SHA
    2da3347 View commit details
    Browse the repository at this point in the history
  29. Configuration menu
    Copy the full SHA
    1ddff75 View commit details
    Browse the repository at this point in the history
  30. Configuration menu
    Copy the full SHA
    40dd196 View commit details
    Browse the repository at this point in the history
  31. missing type cast

    JeffBezanson committed Jan 28, 2016
    Configuration menu
    Copy the full SHA
    f5a07fd View commit details
    Browse the repository at this point in the history
  32. Configuration menu
    Copy the full SHA
    d0aa902 View commit details
    Browse the repository at this point in the history
  33. fix performance regression in parallel loops

    also generally improve type serialization
    
    It turns out this requires the serializer to preserve the identity of
    TypeVars, since otherwise TypeName.primary doesn't have the right
    structure and field types don't get populated correctly when the
    type is instantiated. Since TypeVar identity does actually matter,
    we have to consider them mutable for now.
    JeffBezanson committed Jan 28, 2016
    1 Configuration menu
    Copy the full SHA
    d55c077 View commit details
    Browse the repository at this point in the history
  34. Configuration menu
    Copy the full SHA
    180ccc4 View commit details
    Browse the repository at this point in the history
  35. fix a type UID collision that was causing:

    ```
    MethodError: `setindex!` has no method matching setindex!(::Core.#typeof, ...
    ```
    JeffBezanson committed Jan 28, 2016
    Configuration menu
    Copy the full SHA
    157993e View commit details
    Browse the repository at this point in the history
  36. Configuration menu
    Copy the full SHA
    bdc87bc View commit details
    Browse the repository at this point in the history
  37. clean up after rebase

    JeffBezanson committed Jan 28, 2016
    Configuration menu
    Copy the full SHA
    98802a7 View commit details
    Browse the repository at this point in the history
  38. Configuration menu
    Copy the full SHA
    eb2ff4b View commit details
    Browse the repository at this point in the history
  39. fix kwsorter's type name

    JeffBezanson committed Jan 28, 2016
    Configuration menu
    Copy the full SHA
    d55c116 View commit details
    Browse the repository at this point in the history
  40. call deprecation needs to support keyword args

    this fixes Rif.jl tests
    JeffBezanson committed Jan 28, 2016
    Configuration menu
    Copy the full SHA
    75fc910 View commit details
    Browse the repository at this point in the history
  41. reduce method overwrite warning occurances

    this moves the lowest-level Array constructor to Core
    
    and refactors a bit of other code to remove some other constructors from
    the Core.Inference image
    
    the net result is that only a single method-overwritten warning remains
    from the process of building the sysimg.jl file:
    
        WARNING: Method definition (::Type{#T<:Any})(Any) in module Inference at essentials.jl:21 overwritten in module Base at essentials.jl:21.
    vtjnash authored and JeffBezanson committed Jan 28, 2016
    Configuration menu
    Copy the full SHA
    f66ecb3 View commit details
    Browse the repository at this point in the history
  42. small test updates for jb/functions

    longer timeout in sigint test
    
    `T()` should not be considered a `convert` call in replutil test.
    JeffBezanson committed Jan 28, 2016
    Configuration menu
    Copy the full SHA
    8acf064 View commit details
    Browse the repository at this point in the history
  43. NEWS update for jb/functions

    [ci skip]
    JeffBezanson committed Jan 28, 2016
    Configuration menu
    Copy the full SHA
    1b19245 View commit details
    Browse the repository at this point in the history
  44. Configuration menu
    Copy the full SHA
    e4eb1cf View commit details
    Browse the repository at this point in the history
  45. Configuration menu
    Copy the full SHA
    ac18e0e View commit details
    Browse the repository at this point in the history
  46. Configuration menu
    Copy the full SHA
    00f5248 View commit details
    Browse the repository at this point in the history