Version 8 (modified by cotto, 5 years ago)

incorporate suggestions from plobsing++

There is a lack of clarity about the path that we plan on taking to implement and use Lorito. This page exists as a roadmap to document what we Parrot developers plan on doing with Lorito and how we expect to get there.

I'm dividing the road to Lorito into several stages. Most of the tasks during a given stage can happen independently, making it easy to parallelize.

Stage 0: Preparation

opsc (C mangling)

  • Implement an nqp-based ops compiler ("opsc") capable of generating C code equivalent to what the perl-based ops2c generates.
  • Check the generated C code for ops into version control to allow bootstrapping and reduce the need for rebuilding ops.

Lorito Design

  • Define Lorito ops and semantics (ffi, arg format, binary format, registers, ops, syscalls, text format, etc).
    • Discuss the eventual PBC format and how to allow Lorito-based dynops and PIR ops while avoiding excessive bytecode bloat.
    • If it's agreed that PBC should not store Lorito ops directly, a separate Lorito format should be discussed.
    • Decide whether Lorito bytecode is something we expect to distribute or if it will exist only as a local caching optimization.
  • Implement some PMCs, ops and library bindings in Lorito to demonstrate that Lorito is sufficiently powerful.
    • Because Lorito is not intended to be written directly, this stage may involve some annoyance on the part of the implementors.
    • An HLL may be suitable if it can be shown without excessive hand-waving how its code could be compiled to Lorito.
  • Identify and deal with blockers to implementing core PMCs and systems in Lorito.
  • Get a rough idea of how PIR -> Lorito translation will work. The same goes for Lorito -> C code and Lorito -> C functions.

Stage 1: Prototype

Lorito Prototype

  • Implement Lorito as PIR dynops, allowing them to be processed by the imcc and other existing tools.
  • Modify nqp-based compilers to emit Lorito dynops. Once these are usable, start running them.
  • Figure out how to make user-defined ops (i.e. ops defined in Lorito) work.
  • Define PIR -> Lorito translation.
  • Define Lorito -> C code translation (this is a JIT, among other things)
  • Define Lorito -> C function translation (similar to the current function-based runcore).

Lorito Field Testing

  • Make opsc able to process HLLs and spit out Lorito ops. Implement some ops in terms of an HLL, such as NQP, that compiles down to Lorito.
  • Start implementing core PMCs in something that compiles to Lorito.
  • Make it possible to implement core functionality in Lorito.

Stage 2: Implement and Bootstrap

Pervasive Lorito

  • Modify the current PIR compiler (ideally  PIRATE, possibly imcc or pirc) to emit Lorito.
  • Implement core PIR ops in Lorito.
  • Switch to a Lorito-centric PBC format. (maybe)
    • If we want to change the PBC format, this would be a good time to do it.
  • Make the final switch. All ops and PMCs get compiled down to Lorito during the normal build process (possibly using a bootstrapping step).
  • Start rewriting core systems in Lorito (strings, mmd, packfiles, pcc, whatever's feasible).

Stage 3: Convert and Optimize

Lorito Translations

  • Implement translation from Lorito to LLVM IR, libjit, GNU Lightning, LOLCODE, etc.
  • Lorito to C will be the default fallback.
  • Work in earnest on Lorito-level optimizations.

See also