|
1 | 1 | use std::fmt;
|
2 | 2 |
|
3 | 3 | use cranelift::prelude::*;
|
| 4 | +use cranelift_jit::{JITBuilder, JITModule}; |
4 | 5 | use cranelift_module::{FuncId, Linkage, Module, ModuleError};
|
5 |
| -use cranelift_simplejit::{SimpleJITBuilder, SimpleJITModule, SimpleJITProduct}; |
6 | 6 |
|
7 | 7 | use rustpython_bytecode as bytecode;
|
8 | 8 |
|
@@ -32,13 +32,13 @@ pub enum JitArgumentError {
|
32 | 32 | struct Jit {
|
33 | 33 | builder_context: FunctionBuilderContext,
|
34 | 34 | ctx: codegen::Context,
|
35 |
| - module: SimpleJITModule, |
| 35 | + module: JITModule, |
36 | 36 | }
|
37 | 37 |
|
38 | 38 | impl Jit {
|
39 | 39 | fn new() -> Self {
|
40 |
| - let builder = SimpleJITBuilder::new(cranelift_module::default_libcall_names()); |
41 |
| - let module = SimpleJITModule::new(builder); |
| 40 | + let builder = JITBuilder::new(cranelift_module::default_libcall_names()); |
| 41 | + let module = JITModule::new(builder); |
42 | 42 | Self {
|
43 | 43 | builder_context: FunctionBuilderContext::new(),
|
44 | 44 | ctx: module.make_context(),
|
@@ -105,14 +105,14 @@ pub fn compile<C: bytecode::Constant>(
|
105 | 105 | Ok(CompiledCode {
|
106 | 106 | sig,
|
107 | 107 | code,
|
108 |
| - memory: jit.module.finish(), |
| 108 | + module: jit.module, |
109 | 109 | })
|
110 | 110 | }
|
111 | 111 |
|
112 | 112 | pub struct CompiledCode {
|
113 | 113 | sig: JitSig,
|
114 | 114 | code: *const u8,
|
115 |
| - memory: SimpleJITProduct, |
| 115 | + module: JITModule, |
116 | 116 | }
|
117 | 117 |
|
118 | 118 | impl CompiledCode {
|
@@ -287,7 +287,7 @@ unsafe impl Sync for CompiledCode {}
|
287 | 287 | impl Drop for CompiledCode {
|
288 | 288 | fn drop(&mut self) {
|
289 | 289 | // SAFETY: The only pointer that this memory will also be dropped now
|
290 |
| - unsafe { self.memory.free_memory() } |
| 290 | + unsafe { self.module.free_memory() } |
291 | 291 | }
|
292 | 292 | }
|
293 | 293 |
|
|
0 commit comments