예제 #1
0
 /// <summary>Adds a module to the JIT for lazy compilation using the engine's default symbol resolver</summary>
 /// <param name="jit">JIT engine to add the module to</param>
 /// <param name="module">module to add</param>
 /// <returns>Handle for the module in the engine</returns>
 public static ulong AddLazyCompiledModule([ValidatedNotNull] this ILazyCompileExecutionEngine jit, BitcodeModule module)
 {
     jit.ValidateNotNull(nameof(jit));
     return(jit.AddLazyCompiledModule(module, jit.DefaultSymbolResolver));
 }
예제 #2
0
 /// <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);
 }