Open vaivaswatha opened 4 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.
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.