diff --git a/README.md b/README.md index c739cd31..e9f08673 100644 --- a/README.md +++ b/README.md @@ -58,8 +58,8 @@ PYTHONPATH=~/local2/lib:$PYTHONPATH python create a jit from within python ``` ->>> jit=Jit.make() ->>> jit.dump_execution_sesion() +>>> mp=MachPipeline.make() +>>> mp.dump_execution_sesion() JITDylib "
" (ES: 0x0000000000446ee0, State = Open) Link order: [ ("
", MatchAllSymbols) ] Symbol table: @@ -79,7 +79,7 @@ build an AST from within python generate llvm IR for our AST ``` ->>> code=jit.codegen(lm) +>>> code=mp.codegen(lm) >>> print(code.print()) define double @foo(double %x) { entry: @@ -91,15 +91,15 @@ entry: generate machine code for our AST, lookup compiled function so we can invoke it directly ``` ->>> jit.machgen_current_module() ->>> jit.dump_execution_session() +>>> mp.machgen_current_module() +>>> mp.dump_execution_session() JITDylib "
" (ES: 0x0000000000446ee0, State = Open) Link order: [ ("
", MatchAllSymbols) ] Symbol table: "foo": [Callable] Never-Searched (Materializer 0x646fe0, xojit) ->>> fn=jit.lookup_dbl_dbl_fn('foo') +>>> fn=mp.lookup_dbl_dbl_fn('foo') ->>> jit.dump_execution_session() +>>> mp.dump_execution_session() JITDylib "
" (ES: 0x0000000000446ee0, State = Open) Link order: [ ("
", MatchAllSymbols) ] Symbol table: diff --git a/src/pyjit/pyjit.cpp b/src/pyjit/pyjit.cpp index 69defaec..624f8882 100644 --- a/src/pyjit/pyjit.cpp +++ b/src/pyjit/pyjit.cpp @@ -2,7 +2,7 @@ #include "pyjit.hpp" #include "xo/pyexpression/pyexpression.hpp" -#include "xo/jit/Jit.hpp" +#include "xo/jit/MachPipeline.hpp" #include "xo/pyutil/pyutil.hpp" #include @@ -29,19 +29,20 @@ namespace xo { m.doc() = "pybind11 plugin for xo-jit"; - py::class_>(m, "Jit") - .def_static("make", &Jit::make, - py::doc("create Jit instance. Not threadsafe," - " but does not share resources with any other Jit instance")) + py::class_>(m, "MachPipeline") + .def_static("make", &MachPipeline::make, + py::doc("Create machine pipeline for in-process code generation" + " and execution. Not threadsafe.\n" + "Does not share resources with any other instance")) - .def_property_readonly("target_triple", &Jit::target_triple, + .def_property_readonly("target_triple", &MachPipeline::target_triple, py::doc("string describing target host for code generation")) - .def("get_function_name_v", &Jit::get_function_name_v, + .def("get_function_name_v", &MachPipeline::get_function_name_v, py::doc("get vector of function names defined in jit module")) - .def("dump_execution_session", &Jit::dump_execution_session, + .def("dump_execution_session", &MachPipeline::dump_execution_session, py::doc("write to console with state of all jit-owned dynamic libraries")) .def("codegen", - [](Jit & jit, const rp & expr) { + [](MachPipeline & jit, const rp & expr) { return jit.codegen(expr.borrow()); }, py::arg("x"), @@ -52,11 +53,11 @@ namespace xo { * RC 14jun2024 - I think this is true, modulo use of llvm resource trackers. */ py::return_value_policy::reference_internal) - .def("machgen_current_module", &Jit::machgen_current_module, + .def("machgen_current_module", &MachPipeline::machgen_current_module, py::doc("Make current module available for execution via the jit.\n" "Adds all functions generated since last call to this method.")) .def("lookup_dbl_dbl_fn", - [](Jit & jit, const std::string & symbol) { + [](MachPipeline & jit, const std::string & symbol) { auto llvm_addr = jit.lookup_symbol(symbol); auto fn_addr = llvm_addr.toPtr();