forked from AbleOS/holey-bytes
fixing nightly breaking changes
Signed-off-by: Jakub Doka <jakub.doka2@gmail.com>
This commit is contained in:
parent
18e8a831ab
commit
b6d72dbc69
|
@ -340,7 +340,7 @@ impl FuncBuilder<'_, '_> {
|
||||||
let mut arg_vals = &self.bl.block_params(entry).to_vec()[..];
|
let mut arg_vals = &self.bl.block_params(entry).to_vec()[..];
|
||||||
|
|
||||||
if self.stack_ret {
|
if self.stack_ret {
|
||||||
let ret_ptr = *arg_vals.take_first().unwrap();
|
let ret_ptr = *arg_vals.split_off_first().unwrap();
|
||||||
self.values[hbnodes::MEM as usize] = Some(Ok(ret_ptr));
|
self.values[hbnodes::MEM as usize] = Some(Ok(ret_ptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,7 +359,7 @@ impl FuncBuilder<'_, '_> {
|
||||||
size: self.tys.size_of(ty),
|
size: self.tys.size_of(ty),
|
||||||
align_shift: self.tys.align_of(ty).ilog2() as _,
|
align_shift: self.tys.align_of(ty).ilog2() as _,
|
||||||
});
|
});
|
||||||
let loc = arg_vals.take(..abi_meta.arg_count).unwrap();
|
let loc = arg_vals.split_off(..abi_meta.arg_count).unwrap();
|
||||||
assert!(loc.len() <= 2, "NEED handling");
|
assert!(loc.len() <= 2, "NEED handling");
|
||||||
let align =
|
let align =
|
||||||
loc.iter().map(|&p| self.bl.func.dfg.value_type(p).bytes()).max().unwrap();
|
loc.iter().map(|&p| self.bl.func.dfg.value_type(p).bytes()).max().unwrap();
|
||||||
|
@ -371,7 +371,7 @@ impl FuncBuilder<'_, '_> {
|
||||||
self.values[arg as usize] =
|
self.values[arg as usize] =
|
||||||
Some(Ok(self.bl.ins().stack_addr(cir::types::I64, slot, 0)))
|
Some(Ok(self.bl.ins().stack_addr(cir::types::I64, slot, 0)))
|
||||||
} else {
|
} else {
|
||||||
let loc = arg_vals.take(..abi_meta.arg_count).unwrap();
|
let loc = arg_vals.split_off(..abi_meta.arg_count).unwrap();
|
||||||
debug_assert_eq!(loc.len(), 1);
|
debug_assert_eq!(loc.len(), 1);
|
||||||
self.values[arg as usize] = Some(Ok(loc[0]));
|
self.values[arg as usize] = Some(Ok(loc[0]));
|
||||||
}
|
}
|
||||||
|
@ -608,7 +608,7 @@ impl FuncBuilder<'_, '_> {
|
||||||
}
|
}
|
||||||
let &arg = args.next().unwrap();
|
let &arg = args.next().unwrap();
|
||||||
if !abi_meta.trough_mem && ty.is_aggregate(self.tys) {
|
if !abi_meta.trough_mem && ty.is_aggregate(self.tys) {
|
||||||
let loc = params.take(..abi_meta.arg_count).unwrap();
|
let loc = params.split_off(..abi_meta.arg_count).unwrap();
|
||||||
assert!(loc.len() <= 2, "NEED handling");
|
assert!(loc.len() <= 2, "NEED handling");
|
||||||
let align = loc.iter().map(|&p| p.value_type.bytes()).max().unwrap();
|
let align = loc.iter().map(|&p| p.value_type.bytes()).max().unwrap();
|
||||||
let mut offset = 0i32;
|
let mut offset = 0i32;
|
||||||
|
@ -624,7 +624,7 @@ impl FuncBuilder<'_, '_> {
|
||||||
offset += align as i32;
|
offset += align as i32;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let loc = params.take(..abi_meta.arg_count).unwrap();
|
let loc = params.split_off(..abi_meta.arg_count).unwrap();
|
||||||
debug_assert_eq!(loc.len(), 1);
|
debug_assert_eq!(loc.len(), 1);
|
||||||
ir_args.push(self.value_of(arg));
|
ir_args.push(self.value_of(arg));
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,7 +138,7 @@ fn classify_arg(
|
||||||
}
|
}
|
||||||
|
|
||||||
let size = cx.size_of(arg);
|
let size = cx.size_of(arg);
|
||||||
let n = ((size + 7) / 8) as usize;
|
let n = size.div_ceil(8) as usize;
|
||||||
if n > MAX_EIGHTBYTES {
|
if n > MAX_EIGHTBYTES {
|
||||||
return Err(Memory);
|
return Err(Memory);
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,7 +152,7 @@ pub struct Write<'a>(pub &'a mut [u8]);
|
||||||
|
|
||||||
impl core::fmt::Write for Write<'_> {
|
impl core::fmt::Write for Write<'_> {
|
||||||
fn write_str(&mut self, s: &str) -> core::fmt::Result {
|
fn write_str(&mut self, s: &str) -> core::fmt::Result {
|
||||||
if let Some(m) = self.0.take_mut(..s.len()) {
|
if let Some(m) = self.0.split_off_mut(..s.len()) {
|
||||||
m.copy_from_slice(s.as_bytes());
|
m.copy_from_slice(s.as_bytes());
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -447,7 +447,7 @@ impl Nodes {
|
||||||
|| (matches!(self[n].kind, Kind::BinOp { op: TokenKind::Add })
|
|| (matches!(self[n].kind, Kind::BinOp { op: TokenKind::Add })
|
||||||
&& self.is_never_used(n, tys))
|
&& self.is_never_used(n, tys))
|
||||||
}),
|
}),
|
||||||
Kind::Load { .. } => node.ty.loc(tys) == Loc::Stack,
|
Kind::Load => node.ty.loc(tys) == Loc::Stack,
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ impl HbvmBackend {
|
||||||
let tail = FunctionBuilder::build(nodes, tys, &mut self.ralloc, sig);
|
let tail = FunctionBuilder::build(nodes, tys, &mut self.ralloc, sig);
|
||||||
|
|
||||||
let strip_load = |value| match nodes[value].kind {
|
let strip_load = |value| match nodes[value].kind {
|
||||||
Kind::Load { .. } if nodes[value].ty.loc(tys) == Loc::Stack => nodes[value].inputs[1],
|
Kind::Load if nodes[value].ty.loc(tys) == Loc::Stack => nodes[value].inputs[1],
|
||||||
_ => value,
|
_ => value,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -701,7 +701,7 @@ impl<'a> FunctionBuilder<'a> {
|
||||||
| Kind::BinOp { .. }
|
| Kind::BinOp { .. }
|
||||||
| Kind::UnOp { .. }
|
| Kind::UnOp { .. }
|
||||||
| Kind::Global { .. }
|
| Kind::Global { .. }
|
||||||
| Kind::Load { .. }
|
| Kind::Load
|
||||||
| Kind::Stre
|
| Kind::Stre
|
||||||
| Kind::RetVal
|
| Kind::RetVal
|
||||||
| Kind::Stck => self.add_instr(nid),
|
| Kind::Stck => self.add_instr(nid),
|
||||||
|
|
|
@ -424,7 +424,7 @@ fn endoce_string(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn quad_sort<T>(mut slice: &mut [T], mut cmp: impl FnMut(&T, &T) -> core::cmp::Ordering) {
|
pub fn quad_sort<T>(mut slice: &mut [T], mut cmp: impl FnMut(&T, &T) -> core::cmp::Ordering) {
|
||||||
while let Some(it) = slice.take_first_mut() {
|
while let Some(it) = slice.split_off_first_mut() {
|
||||||
for ot in &mut *slice {
|
for ot in &mut *slice {
|
||||||
if cmp(it, ot) == core::cmp::Ordering::Greater {
|
if cmp(it, ot) == core::cmp::Ordering::Greater {
|
||||||
core::mem::swap(it, ot);
|
core::mem::swap(it, ot);
|
||||||
|
|
|
@ -1070,7 +1070,7 @@ impl Types {
|
||||||
self.ins.unions[union].size.set(size);
|
self.ins.unions[union].size.set(size);
|
||||||
size
|
size
|
||||||
}
|
}
|
||||||
Kind::Enum(enm) => (self.enum_field_range(enm).len().ilog2() + 7) / 8,
|
Kind::Enum(enm) => self.enum_field_range(enm).len().ilog2().div_ceil(8),
|
||||||
Kind::Opt(opt) => {
|
Kind::Opt(opt) => {
|
||||||
let base = self.ins.opts[opt].base;
|
let base = self.ins.opts[opt].base;
|
||||||
if self.nieche_of(base).is_some() {
|
if self.nieche_of(base).is_some() {
|
||||||
|
|
|
@ -277,7 +277,7 @@ impl Iterator for BitSetIter<'_> {
|
||||||
|
|
||||||
fn next(&mut self) -> Option<Self::Item> {
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
while self.current == 0 {
|
while self.current == 0 {
|
||||||
self.current = *self.remining.take_first()?;
|
self.current = *self.remining.split_off_first()?;
|
||||||
self.index += 1;
|
self.index += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue