Zilliqa / scilla-compiler

Compile Scilla to LLVM-IR
GNU General Public License v3.0
8 stars 4 forks source link

Compiler gas accounting #40

Open vaivaswatha opened 4 years ago

vaivaswatha commented 4 years ago

The compiler itself must consume gas, like the type-checker does.

Of particular concern is the monomorphizer which specializes polymorphic code and must charge for each specialization. It also has a complex type-flow analysis that needs to charge gas as it progresses.

vaivaswatha commented 3 years ago

One way to do this is to run the compiler itself in a VM. For example using a custom version of the OCaml bytecode interpreter that charges gas per instruction. However, this was found to be ~10x slower than native OCaml code execution.