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

Bytecode to bir #1472

Merged
merged 47 commits into from
Jul 31, 2023
Merged

Bytecode to bir #1472

merged 47 commits into from
Jul 31, 2023

Commits on Jul 31, 2023

  1. bytecode compiler: compile 0-receiving calls as such

    rather than as calls that futz with MV. This can be used as a
    correctness condition, and it makes compiling to IR easier.
    Bike committed Jul 31, 2023
    Configuration menu
    Copy the full SHA
    4d097a5 View commit details
    Browse the repository at this point in the history
  2. Don't try to print unbound structure slots

    The unbound objects still cause all kinds of bad problems like
    segffaults that we absolutely do not want to be user-exposed.
    Bike committed Jul 31, 2023
    Configuration menu
    Copy the full SHA
    e0b162d View commit details
    Browse the repository at this point in the history
  3. Change VM MV call semantics to skip a copy

    This uniformly puts arguments on the VM stack before a call, VM or
    not, and saves a copy for multi-argument-form mv calls (the copy
    into the mv vector by pop-values).
    
    But my actual impetus is this structure makes the compilation to
    BIR easier, as all mv-calls are preceded by push/append-values,
    like how BIR requires a value-collect for any mv call.
    
    I had to increase the VM stack size to keep the build working,
    though. Bit worrying. The failure was when compiling the package
    definition for closer-mop, of all things.
    Bike committed Jul 31, 2023
    Configuration menu
    Copy the full SHA
    fad16ca View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    621fa41 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    5137396 View commit details
    Browse the repository at this point in the history
  6. Refactor clasp-cleavir translate

    This localizes the LLVM stuff in an entry point that accepts BIR,
    so if we produce BIR by some other means (e.g. from bytecode) we
    can reuse said stuff.
    Bike committed Jul 31, 2023
    Configuration menu
    Copy the full SHA
    11b2ee1 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    e7a791d View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    f5eeb50 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    1b88df4 View commit details
    Browse the repository at this point in the history
  10. Integrate bytecode-to-bir into clasp

    Still needs work, but it's functional.
    Bike committed Jul 31, 2023
    Configuration menu
    Copy the full SHA
    9f66ac3 View commit details
    Browse the repository at this point in the history
  11. Remove unused Closure_O field

    If we need to test bytecodeness, we can just look at the type of
    the simple fun.
    Bike committed Jul 31, 2023
    Configuration menu
    Copy the full SHA
    c77c0cb View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    0ee844d View commit details
    Browse the repository at this point in the history
  13. bytecode: add&use DUP opcode

    this makes setq a little less ridiculous to generate - we just use
    a stack spot instead of a local variable. This will reduce the
    number of local variables needed by some functions.
    
    Also makes things a little easier on bytecode-to-bir. It was
    screwing things up in that the temporary variable was conflated
    with earlier bound variables, which caused problems when the
    variable was closed over.
    Bike committed Jul 31, 2023
    Configuration menu
    Copy the full SHA
    0ce7eae View commit details
    Browse the repository at this point in the history
  14. bytecode FASLs: more extensible debug info representation

    I will be adding more for the sake of further compilation, and
    this will make that easier. It also makes it possible to assert
    that the debug infos are in order (i.e. their START indices are
    nondecreasing) which is very convenient for the compiler and
    debugger.
    Bike committed Jul 31, 2023
    Configuration menu
    Copy the full SHA
    7cc74c8 View commit details
    Browse the repository at this point in the history
  15. Add missing IGNORE declarations

    Bike committed Jul 31, 2023
    Configuration menu
    Copy the full SHA
    b97ef86 View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    b1cf063 View commit details
    Browse the repository at this point in the history
  17. bytecode compiler: preserve some variable declarations

    Doing optional variables etc is going to be annoying
    Bike committed Jul 31, 2023
    Configuration menu
    Copy the full SHA
    e883bb1 View commit details
    Browse the repository at this point in the history
  18. Delete obsolete function

    Bike committed Jul 31, 2023
    Configuration menu
    Copy the full SHA
    807f579 View commit details
    Browse the repository at this point in the history
  19. bytecode compiler: more precise source locations for functions

    FLET might need a little more work
    Bike committed Jul 31, 2023
    Configuration menu
    Copy the full SHA
    5029037 View commit details
    Browse the repository at this point in the history
  20. Oops, left in debugging code

    Bike committed Jul 31, 2023
    Configuration menu
    Copy the full SHA
    96f6646 View commit details
    Browse the repository at this point in the history
  21. b-t-b compiler: more annotations

    Bike committed Jul 31, 2023
    Configuration menu
    Copy the full SHA
    a4815b0 View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    6e8b10f View commit details
    Browse the repository at this point in the history
  23. Configuration menu
    Copy the full SHA
    1a291ef View commit details
    Browse the repository at this point in the history
  24. Make cmp:*optimize* primitive

    The bytecode compiler will have to keep track of optimize
    declarations for the btb compiler.
    Bike committed Jul 31, 2023
    Configuration menu
    Copy the full SHA
    6a76f41 View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    7728800 View commit details
    Browse the repository at this point in the history
  26. bytecode compiler: actually use passed source info

    christ, i am stupid sometimes
    Bike committed Jul 31, 2023
    Configuration menu
    Copy the full SHA
    6fe4be8 View commit details
    Browse the repository at this point in the history
  27. bytecode compiler: don't record declarations redundantly

    This cuts down on pointless annotations.
    Bike committed Jul 31, 2023
    Configuration menu
    Copy the full SHA
    5f4783e View commit details
    Browse the repository at this point in the history
  28. Configuration menu
    Copy the full SHA
    bcdb93e View commit details
    Browse the repository at this point in the history
  29. btb compiler: annotations are sorted already

    By generation, and also in LTV FASLs
    Bike committed Jul 31, 2023
    Configuration menu
    Copy the full SHA
    67cf907 View commit details
    Browse the repository at this point in the history
  30. btb compiler: first stab at THE

    Bike committed Jul 31, 2023
    Configuration menu
    Copy the full SHA
    2192509 View commit details
    Browse the repository at this point in the history
  31. btb compiler: track optimization policy

    not gonna lie, this code is kind of ugly.
    Bike committed Jul 31, 2023
    Configuration menu
    Copy the full SHA
    caea7c6 View commit details
    Browse the repository at this point in the history
  32. btb compiler: type checks

    Bike committed Jul 31, 2023
    Configuration menu
    Copy the full SHA
    09d306a View commit details
    Browse the repository at this point in the history
  33. Configuration menu
    Copy the full SHA
    dd84ea3 View commit details
    Browse the repository at this point in the history
  34. btb compiler: handle IGNORE

    Bike committed Jul 31, 2023
    Configuration menu
    Copy the full SHA
    aef6a8f View commit details
    Browse the repository at this point in the history
  35. btb compiler: remove old kludge

    No longer necessary given the variable annotations and DUP.
    Bike committed Jul 31, 2023
    Configuration menu
    Copy the full SHA
    413b6d7 View commit details
    Browse the repository at this point in the history
  36. btb compiler: type declarations

    Bike committed Jul 31, 2023
    Configuration menu
    Copy the full SHA
    e9d8573 View commit details
    Browse the repository at this point in the history
  37. Configuration menu
    Copy the full SHA
    e90c789 View commit details
    Browse the repository at this point in the history
  38. bytecode compiler: ensure debug infos are generated ordered

    Functions being relocated means that just generating the debug
    infos all in the same module vector as you go can result in
    non monotonic positions.
    Bike committed Jul 31, 2023
    Configuration menu
    Copy the full SHA
    fda6203 View commit details
    Browse the repository at this point in the history
  39. bytecode compiler: maintain mv/stack state in unreachable code

    This is a pretty messy solution. drop-mv never actually needs to
    be executed, but it lets the compiler treat unconditional jumps as
    not happening for the purpose of compiling unreachable code
    correctly. FIX ME
    Bike committed Jul 31, 2023
    Configuration menu
    Copy the full SHA
    542a438 View commit details
    Browse the repository at this point in the history
  40. bytecode compiler: fix memberEq usage

    without the notnilp it always returns true, which screws a few
    things up. durr
    Bike committed Jul 31, 2023
    Configuration menu
    Copy the full SHA
    89a4720 View commit details
    Browse the repository at this point in the history
  41. Configuration menu
    Copy the full SHA
    b73ed52 View commit details
    Browse the repository at this point in the history
  42. Configuration menu
    Copy the full SHA
    74492f8 View commit details
    Browse the repository at this point in the history
  43. Function names for early defun

    Bike committed Jul 31, 2023
    Configuration menu
    Copy the full SHA
    feb8589 View commit details
    Browse the repository at this point in the history
  44. record and use bytecode block names from tagbody

    The more important intent of this is to store information about
    PHIs to simplify the btb compiler.
    Bike committed Jul 31, 2023
    Configuration menu
    Copy the full SHA
    218e305 View commit details
    Browse the repository at this point in the history
  45. Remove ThreadLocalState from snapshot workers

    It does not seem to be used anywhere. It adds extra memory to the
    threads which is then never used, since those threads never even
    run Lisp code. Running the constructors can also be complicated
    and is again unnecessary.
    Bike committed Jul 31, 2023
    Configuration menu
    Copy the full SHA
    65723f8 View commit details
    Browse the repository at this point in the history
  46. Allocate VM stack outside of ThreadLocalState

    Having a large array inside the VirtualMachine (and thus the
    ThreadLocalState) seems to crash the linker on Mac. It's also just
    sort of wonky.
    
    Probably ideally we'd have a more sophisticated setup here with
    mmap and guard pages and growth and yada yada, but this works ok.
    There is a definite suboptimality in allocating the entire max
    stack size all at once, but it's not _too_ big so maybe it's ok.
    It also means that the GC will walk the entire stack for pointers,
    including the inactive part, but Boehm is probably not capable
    of doing something more complex anyway. Or if it is it's wizardry.
    Bike committed Jul 31, 2023
    Configuration menu
    Copy the full SHA
    3b4fc09 View commit details
    Browse the repository at this point in the history
  47. Delete global_thread_pool

    This was apparently used for parallel linking at some point but was
    dummied out for mysterious reasons. Even without that, I suspect
    that the thread pool wouldn't need to be global.
    Bike committed Jul 31, 2023
    Configuration menu
    Copy the full SHA
    5c14773 View commit details
    Browse the repository at this point in the history