chore: cargo fmt
This commit is contained in:
@@ -130,7 +130,10 @@ pub unsafe extern "C" fn helper_push_attr(
|
||||
}
|
||||
}
|
||||
|
||||
pub unsafe extern "C" fn helper_finalize_attrs(attrs: NonNull<HashMap<String, Value>>, ret: &mut MaybeUninit<Value>) {
|
||||
pub unsafe extern "C" fn helper_finalize_attrs(
|
||||
attrs: NonNull<HashMap<String, Value>>,
|
||||
ret: &mut MaybeUninit<Value>,
|
||||
) {
|
||||
ret.write(Value::AttrSet(Rc::new(unsafe { attrs.read() }.into())));
|
||||
}
|
||||
|
||||
@@ -139,6 +142,5 @@ pub unsafe extern "C" fn helper_alloc_array(len: usize) -> *mut u8 {
|
||||
}
|
||||
|
||||
pub extern "C" fn helper_dbg(value: &Value) {
|
||||
// dbg!(value);
|
||||
println!("{value:?}")
|
||||
}
|
||||
|
||||
@@ -139,9 +139,7 @@ impl<'comp, 'ctx> JITContext<'comp, 'ctx> {
|
||||
self.free_slot(val);
|
||||
let attrs = self.builder.ins().stack_addr(types::I64, attrs, 0);
|
||||
let val = self.builder.ins().stack_addr(types::I64, val, 0);
|
||||
let sym = self
|
||||
.strings
|
||||
.get_or_insert_with(sym, |_| sym.to_owned());
|
||||
let sym = self.strings.get_or_insert_with(sym, |_| sym.to_owned());
|
||||
let ptr = self
|
||||
.builder
|
||||
.ins()
|
||||
@@ -566,7 +564,11 @@ impl JITCompiler {
|
||||
}; 2],
|
||||
);
|
||||
let finalize_attrs = module
|
||||
.declare_function("helper_finalize_attrs", Linkage::Import, &finalize_attrs_sig)
|
||||
.declare_function(
|
||||
"helper_finalize_attrs",
|
||||
Linkage::Import,
|
||||
&finalize_attrs_sig,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let mut dbg_sig = module.make_signature();
|
||||
@@ -647,9 +649,10 @@ impl JITCompiler {
|
||||
ctx.builder.finalize();
|
||||
|
||||
let strings = ctx.strings;
|
||||
|
||||
if cfg!(debug_assertions) {
|
||||
println!("{:?}", ir);
|
||||
println!("{}", func.display());
|
||||
}
|
||||
self.ctx.func = func;
|
||||
self.module.define_function(func_id, &mut self.ctx).unwrap();
|
||||
self.module.finalize_definitions().unwrap();
|
||||
@@ -658,8 +661,10 @@ impl JITCompiler {
|
||||
let _ = self.builder_ctx.insert(builder_ctx);
|
||||
unsafe {
|
||||
JITFunc {
|
||||
func: std::mem::transmute::<*const u8, F>(self.module.get_finalized_function(func_id)),
|
||||
strings
|
||||
func: std::mem::transmute::<*const u8, F>(
|
||||
self.module.get_finalized_function(func_id),
|
||||
),
|
||||
strings,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user