jit works yay
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
use clap::Parser;
|
||||
use codespan_reporting::files::SimpleFiles;
|
||||
use ngr::backend::Backend;
|
||||
use ngr::eval::Value;
|
||||
use ngr::syntax;
|
||||
use ngr::type_infer::TypeInferenceResult;
|
||||
@@ -70,5 +71,12 @@ fn main() -> Result<(), anyhow::Error> {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
unimplemented!();
|
||||
}
|
||||
let mut backend = Backend::jit(None)?;
|
||||
let function_id = backend.compile_program("gogogo", ir)?;
|
||||
backend.module.finalize_definitions()?;
|
||||
let compiled_bytes = backend.bytes(function_id);
|
||||
let compiled_function = unsafe { std::mem::transmute::<_, fn() -> ()>(compiled_bytes) };
|
||||
compiled_function();
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user