Skip to content

Commit 7ac28e4

Browse files
committed
Merge branch 'main' into move-fuzzing
2 parents f725a88 + 21e44ae commit 7ac28e4

File tree

12 files changed

+342
-182
lines changed

12 files changed

+342
-182
lines changed

src/checker.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ use alloc::vec::Vec;
104104
use alloc::{format, vec};
105105
use core::default::Default;
106106
use core::hash::Hash;
107+
use core::ops::Range;
107108
use core::result::Result;
108109
use smallvec::{smallvec, SmallVec};
109110

@@ -166,6 +167,12 @@ pub enum CheckerError {
166167
into: Allocation,
167168
from: Allocation,
168169
},
170+
AllocationOutsideLimit {
171+
inst: Inst,
172+
op: Operand,
173+
alloc: Allocation,
174+
range: Range<usize>,
175+
},
169176
}
170177

171178
/// Abstract state for an allocation.
@@ -669,6 +676,18 @@ impl CheckerState {
669676
});
670677
}
671678
}
679+
OperandConstraint::Limit(max) => {
680+
if let Some(preg) = alloc.as_reg() {
681+
if preg.hw_enc() >= max {
682+
return Err(CheckerError::AllocationOutsideLimit {
683+
inst,
684+
op,
685+
alloc,
686+
range: (0..max),
687+
});
688+
}
689+
}
690+
}
672691
}
673692
Ok(())
674693
}

src/fastalloc/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,9 @@ impl<'a, F: Function> Env<'a, F> {
618618
}
619619

620620
OperandConstraint::Stack => self.edits.is_stack(alloc),
621+
OperandConstraint::Limit(_) => {
622+
todo!("limit constraints are not yet supported in fastalloc")
623+
}
621624
}
622625
}
623626

@@ -773,6 +776,9 @@ impl<'a, F: Function> Env<'a, F> {
773776
}
774777

775778
OperandConstraint::Stack => Allocation::stack(self.get_spillslot(op.vreg())),
779+
OperandConstraint::Limit(_) => {
780+
todo!("limit constraints are not yet supported in fastalloc")
781+
}
776782
};
777783
self.allocs[(inst.index(), op_idx)] = new_alloc;
778784
Ok(new_alloc)

0 commit comments

Comments
 (0)