/// <summary>Add a lazy function generator</summary> /// <param name="jit">JIT to add the module to</param> /// <param name="name">name of the function</param> /// <param name="generator">Generator that will generate the bit-code module for the function on demand</param> /// <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.) /// <para>The <paramref name="generator"/> generates the IR module for the function. For this overload, the generator /// must contain everything necessary to generate the <see cref="BitcodeModule"/> for the function. Typically, this is /// a closure that captured the AST for the language and generates the IR from that state.</para> /// </remarks> public static void AddLazyFunctionGenerator([ValidatedNotNull] this ILazyCompileExecutionEngine jit, string name, LazyFunctionCompiler generator) { jit.ValidateNotNull(nameof(jit)); jit.AddLazyFunctionGenerator(name, generator, IntPtr.Zero); }
/// <summary>Add a lazy function generator</summary> /// <param name="jit">JIT to add the module to</param> /// <param name="name">name of the function</param> /// <param name="generator">Generator that will generate the bit-code module for the function on demand</param> /// <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.) /// <para>The <paramref name="generator"/> generates the IR module for the function. For this overload, the generator /// must contain everything necessary to generate the <see cref="BitcodeModule"/> for the function. Typically, this is /// a closure that captured the AST for the language and generates the IR from that state.</para> /// </remarks> public static void AddLazyFunctionGenerator(this ILazyCompileExecutionEngine jit, string name, LazyFunctionCompiler generator) { jit.AddLazyFunctionGenerator(name, generator, IntPtr.Zero); }