Skip to content
This repository has been archived by the owner on Dec 6, 2019. It is now read-only.

Towards a semi-performant recursive interpreter #37

Merged
merged 40 commits into from
Jan 27, 2019
Merged

Towards a semi-performant recursive interpreter #37

merged 40 commits into from
Jan 27, 2019

Commits on Jan 27, 2019

  1. Cosmetic changes

    timholy authored and KristofferC committed Jan 27, 2019
    Configuration menu
    Copy the full SHA
    786f2bc View commit details
    Browse the repository at this point in the history
  2. Fix construction from a method

    timholy authored and KristofferC committed Jan 27, 2019
    Configuration menu
    Copy the full SHA
    24a0cce View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    5b27660 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    e0feed2 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    4ccad0b View commit details
    Browse the repository at this point in the history
  6. Temporarily disable UI tests

    timholy authored and KristofferC committed Jan 27, 2019
    Configuration menu
    Copy the full SHA
    c4789ce View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    971a61e View commit details
    Browse the repository at this point in the history
  8. Add enter_call(meth, args...; kwargs...)

    This is essentially the new implementation of JuliaStackFrame(meth, ...).
    It fixes what was broken and adds keyword arg support.
    timholy authored and KristofferC committed Jan 27, 2019
    Configuration menu
    Copy the full SHA
    265c3a6 View commit details
    Browse the repository at this point in the history
  9. Improve the performance of the interpreter

    This almost entirely eliminates dynamic dispatch during execution of
    the interpreter. On a simple sum-the-elements-of-an-array test,
    this results in a 2x speedup. This also eliminates lookup_var_if_var.
    timholy authored and KristofferC committed Jan 27, 2019
    Configuration menu
    Copy the full SHA
    a43f96c View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    5218791 View commit details
    Browse the repository at this point in the history
  11. Split JuliaStackFrame into two pieces, with code being a singleton

    This avoids the need for fetching the AST and copying the CodeInfo
    repeatedly for the same method.
    
    This also stashes an updated pc for each frame.
    This seems more consistent with the notion that the state of all
    the locals, ssavalues, etc, is dependent on the pc, so allowing
    these two to diverge seems inconsistent.
    timholy authored and KristofferC committed Jan 27, 2019
    Configuration menu
    Copy the full SHA
    1f112b0 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    d85058a View commit details
    Browse the repository at this point in the history
  13. Switch interpreter/compiler decision to a trait-or-stack-based approach

    This is more flexible if we want to do a wider variety of
    things with the stack.
    timholy authored and KristofferC committed Jan 27, 2019
    Configuration menu
    Copy the full SHA
    8449d24 View commit details
    Browse the repository at this point in the history
  14. Add call-site method tables

    These are used when running in fully-interpreted mode to reduce the
    number of calls to `which`. Recently-called methods are maintained
    in a LRU cache at each call site; if the types match one of the cached
    methods, the framecode is looked up in the cache thus bypassing the need
    to call `which`.
    
    Building the frame itself is the biggest remaining bottleneck, in
    particular the allocation of storage for local variables.
    While this results in an order-of-magnitude improvement,
    the interpreter is still pretty slow, requiring of order 32us per
    iteration in a simple sum-a-Vector{Float64} demo.
    (With `--compile=no` it is more like 4us per iteration.
    Though I am not sure that nothing is compiled under those circumstances---
    what about methods already built into the system image?)
    timholy authored and KristofferC committed Jan 27, 2019
    Configuration menu
    Copy the full SHA
    5c1cc58 View commit details
    Browse the repository at this point in the history
  15. Switch local method tables to a "parallel" TypeMapEntry lookup

    Adding an unsupported type to the CodeInfo source breaks too many things
    (e.g., basic-block computation, SSA usage analysis, etc.). We
    circumvent that by storing the local method table in a parallel structure.
    Some day, however, we may want to consider adding LocalMethodTable
    as a supported AST component; basing it on TypeMapEntry, as done
    here, is nevertheless a better approach than using arrays.
    timholy authored and KristofferC committed Jan 27, 2019
    Configuration menu
    Copy the full SHA
    c80d4eb View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    ccb034d View commit details
    Browse the repository at this point in the history
  17. Re-use old JuliaStackFrames

    Memory allocation is a significant bottleneck; this reduces the burden.
    Cuts the execution time almost in half.
    timholy authored and KristofferC committed Jan 27, 2019
    Configuration menu
    Copy the full SHA
    b72ae86 View commit details
    Browse the repository at this point in the history
  18. A few more performance optimizations

    timholy authored and KristofferC committed Jan 27, 2019
    Configuration menu
    Copy the full SHA
    0fc6936 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    1887ac9 View commit details
    Browse the repository at this point in the history
  20. Add an interpret macro

    timholy authored and KristofferC committed Jan 27, 2019
    Configuration menu
    Copy the full SHA
    aeddf77 View commit details
    Browse the repository at this point in the history
  21. Check for explicit calls to Builtins

    timholy authored and KristofferC committed Jan 27, 2019
    Configuration menu
    Copy the full SHA
    7268b36 View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    5d28f90 View commit details
    Browse the repository at this point in the history
  23. Work around some bugs in difficult cases

    It's difficult stepping into inference because it uses some of the same types
    used here to mark slots/ssas, and as a consequence `lookup_var` and others can
    get confused. There also seem to be some issue wrt generated functions and/or
    keyword args. So these changes just prevent recursion in known-bad cases.
    timholy authored and KristofferC committed Jan 27, 2019
    Configuration menu
    Copy the full SHA
    993bc8a View commit details
    Browse the repository at this point in the history
  24. Improve module-detection for builtins

    timholy authored and KristofferC committed Jan 27, 2019
    Configuration menu
    Copy the full SHA
    e28bb0f View commit details
    Browse the repository at this point in the history
  25. Lookup GlobalRefs during optimize!

    This also necessitates changing how Builtins are handled, but this is
    more robust than the previous module/symbol check.
    timholy authored and KristofferC committed Jan 27, 2019
    Configuration menu
    Copy the full SHA
    670ed65 View commit details
    Browse the repository at this point in the history
  26. Record position prior to entering new frame

    This is needed for debugging
    timholy authored and KristofferC committed Jan 27, 2019
    Configuration menu
    Copy the full SHA
    5b3695d View commit details
    Browse the repository at this point in the history
  27. For generators, index by argtypes when caching lowered code

    The generator can in principle return arbitrary expressions depending
    on the exact type.
    timholy authored and KristofferC committed Jan 27, 2019
    Configuration menu
    Copy the full SHA
    925ec77 View commit details
    Browse the repository at this point in the history
  28. Update the project dependencies

    timholy authored and KristofferC committed Jan 27, 2019
    Configuration menu
    Copy the full SHA
    a8610c9 View commit details
    Browse the repository at this point in the history
  29. Configuration menu
    Copy the full SHA
    2672537 View commit details
    Browse the repository at this point in the history
  30. Configuration menu
    Copy the full SHA
    9663bf7 View commit details
    Browse the repository at this point in the history
  31. Configuration menu
    Copy the full SHA
    e1983f8 View commit details
    Browse the repository at this point in the history
  32. update ui tests

    KristofferC committed Jan 27, 2019
    Configuration menu
    Copy the full SHA
    7317756 View commit details
    Browse the repository at this point in the history
  33. Configuration menu
    Copy the full SHA
    ab0775a View commit details
    Browse the repository at this point in the history
  34. Add docstrings for key interpreter methods.

    This also makes minor code cleanups.
    timholy authored and KristofferC committed Jan 27, 2019
    Configuration menu
    Copy the full SHA
    cdac1e9 View commit details
    Browse the repository at this point in the history
  35. Add Documenter documentation

    timholy authored and KristofferC committed Jan 27, 2019
    Configuration menu
    Copy the full SHA
    0be3c37 View commit details
    Browse the repository at this point in the history
  36. Don't offset the SSAValues

    timholy authored and KristofferC committed Jan 27, 2019
    Configuration menu
    Copy the full SHA
    265ae94 View commit details
    Browse the repository at this point in the history
  37. Fix line numbers in optimize!

    At least module-scope code can use Ints for :gotoifnot expressions.
    timholy authored and KristofferC committed Jan 27, 2019
    Configuration menu
    Copy the full SHA
    2f2ca9f View commit details
    Browse the repository at this point in the history
  38. Actually copy the code in copy_codeinfo

    Because we run the optimizer we don't want to contaminate the
    original.
    timholy authored and KristofferC committed Jan 27, 2019
    Configuration menu
    Copy the full SHA
    7d45fbe View commit details
    Browse the repository at this point in the history
  39. A few improvements useful for external callers

    Separates out the `JuliaFrameCode` constructor, generalizes
    `moduleof`, adds pc utilities
    timholy authored and KristofferC committed Jan 27, 2019
    Configuration menu
    Copy the full SHA
    0480577 View commit details
    Browse the repository at this point in the history
  40. checkout untagged test-deps in travis script

    fixup some toml files and .travis
    KristofferC committed Jan 27, 2019
    Configuration menu
    Copy the full SHA
    d03e44e View commit details
    Browse the repository at this point in the history