Method AddLazyFunctionGenerator
AddLazyFunctionGenerator(String, LazyFunctionCompiler, IntPtr)
Add a lazy function generator
Declaration
void AddLazyFunctionGenerator(string name, LazyFunctionCompiler generator, IntPtr context)
Parameters
void AddLazyFunctionGenerator(string name, LazyFunctionCompiler generator, IntPtr context)
String | name | name of the function |
LazyFunctionCompiler | generator | Generator that will generate the bit-code module for the function on demand |
IntPtr | context | Opaque context to pass to |
Remarks
A lazy function generator is an engine callback that is called when the JIT engine first encounters a symbol name during execution. If the function is never called, then the code is never generated (e.g. this is the real "JIT" part of a JIT engine.)
The generator
generates the IR module for the function. Typically, the generator
is a closure that captured the AST for the language and generates the IR from that state. However, the
context is available as a means to identify the function to generate.