Skip to content
This repository was archived by the owner on Oct 28, 2022. It is now read-only.

Roadmap [proof of concept]

Vaivaswatha N edited this page May 6, 2020 · 1 revision

An end-to-end solution

This page lists the sub-tasks to have an end-to-end compiled backend for Scilla. Its goal is a working prototype rather than an optimized end product. Overall design is described here

The compiler

The compiler written in OCaml will translate Scilla to LLVM-IR

  • Explicitize type annotations - Make type annotations on the AST explicit. (commit)
  • Simple dead code elimination - (Issue, PR)
  • Monomorphize - Instantiate (specialize) polymorphic functions and types (Issue, PR).
  • Variable renaming pass for unique names in the global namespace (Issue, PR)
  • Match pattern simplification (Issue, PR)
  • Define AST with non-currying semantics and translate to it. (PR)
  • Closure conversion - Eliminate closures and separate them into top-level functions with an environment. (Issue, PR)
  • Setup LLVM OCaml interface - Link to LLVM from OCaml and make sure we can use it to generate LLVM-IR (Issue, PR)
  • Translate AST to LLVM-IR (Issue)
    • Design memory layout for Scilla literals (values) and translate them to LLVM-IR (commit)
    • Translate literals and Constr expressions to LLVM-IR (commit)
    • Support for building closures and translating functions and instructions that create/load/store environment (commit).
    • Translation of function application (commit)
    • Translation of match statements (commit)
    • Translation of more statements
      • field / map load (fetch) (commit)
      • field / map store (update) (commit)
      • procedure calls (commit)
    • Describe Scilla types (using structs defined in SRTL) in the generated LLVM-IR (commit1, commit2)
    • Translate Builtins. Initially only one or two builtins for demonstration. (commit)
    • Full contract translation
      • Library values (commit)
      • LLVM functions for procedures and transitions (commit)
      • Transition wrappers so that scilla-vm can pass all arguments in a memory buffer. (commit)

The virtual machine

The virtual machine, written in C++ as a library linked to the main blockchain, will JIT compile LLVM-IR (generated by the compiler) and execute it.

  • Setup a build system (commit)
  • Setup LLVM MC-JIT (or ORC-JIT) skeleton code (commit)
  • End-to-end execution:
  • A unit test framework:
    • to execute an expression, print the result and compare (commit).
    • to execute full contracts and compare output (commit).
  • Setup caching of compiled code (commit)

The Scilla runtime library

This library written in C++, provides utilities for operations that need not be part of the generated code, but can instead be just called.

Clone this wiki locally