Skip to content

Commit e462bb3

Browse files
committed
add doc for check_align
1 parent b3a5af8 commit e462bb3

File tree

1 file changed

+3
-4
lines changed
  • winch/codegen/src/codegen

1 file changed

+3
-4
lines changed

winch/codegen/src/codegen/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -845,12 +845,12 @@ where
845845
Ok(addr)
846846
}
847847

848+
/// Emit checks to ensure that the address at `memarg` is correctly aligned for `size`.
848849
fn check_align(&mut self, memarg: &MemArg, size: OperandSize) -> Result<()> {
849850
if size.bytes() > 1 {
850851
let addr = *self.context.stack.peek().unwrap();
851852
let tmp = self.context.any_gpr(self.masm)?;
852-
self.context
853-
.move_val_to_reg(&addr, tmp, self.masm)?;
853+
self.context.move_val_to_reg(&addr, tmp, self.masm)?;
854854
if memarg.offset != 0 {
855855
self.masm.add(
856856
writable!(tmp),
@@ -866,8 +866,7 @@ where
866866
size,
867867
)?;
868868

869-
self.masm
870-
.cmp(tmp, RegImm::Imm(Imm::i64(0)), size)?;
869+
self.masm.cmp(tmp, RegImm::Imm(Imm::i64(0)), size)?;
871870
self.masm.trapif(IntCmpKind::Ne, TRAP_HEAP_MISALIGNED)?;
872871

873872
self.context.free_reg(tmp);

0 commit comments

Comments
 (0)