Posts

Posts uit september, 2018 tonen

Template Compiler Update

Hi everybody. After samcv++ released MoarVM again, it was finally time to introduce some updates to the expression template compiler. As you may or may not know, the expression JIT backend maps MoarVM opcodes to its internal representation via expression templates . At runtime (during the JIT compilation phase), these templates are combined to form an expression tree. The expression template language remains somewhat underdocumented, but quite a few brave developers have still ventured to add templates. With the new template compiler, a few things will change: Template syntax and type checking is much stricter. This means that, for example, it is no longer possible to place a C-macro expression (which evaluates to a constant value) where an expression operand (i.e. code) would be expected. Templates can contain references to MoarVM opcode operands (written as $0, $1 , $2 etc.) At runtime, read operand references are substituted with the value of the operand, and write operand