Fix memory size leaking behavior
This commit is contained in:
parent
5037ab1ff8
commit
9a2b52fde5
@ -213,8 +213,7 @@ impl StatList {
|
||||
|
||||
leak_with_predicate!(leak_local_write, is_local_read);
|
||||
leak_with_predicate!(leak_global_write, is_global_read);
|
||||
leak_with_predicate!(leak_memory_size, is_memory_size);
|
||||
leak_with_predicate!(leak_memory_write, is_memory_ref);
|
||||
leak_with_predicate!(leak_memory_write, is_memory_read);
|
||||
|
||||
fn leak_all(&mut self) {
|
||||
self.leak_with(|_| true);
|
||||
@ -740,7 +739,6 @@ impl<'a> Builder<'a> {
|
||||
let memory = i.try_into().unwrap();
|
||||
let data = Expression::MemorySize(MemorySize { memory });
|
||||
|
||||
self.target.leak_memory_write(memory);
|
||||
self.target.push_tracked(data);
|
||||
}
|
||||
Inst::GrowMemory(i) => {
|
||||
@ -750,9 +748,8 @@ impl<'a> Builder<'a> {
|
||||
value: self.target.pop_required().into(),
|
||||
});
|
||||
|
||||
self.target.leak_memory_size(memory);
|
||||
self.target.leak_memory_write(memory);
|
||||
self.target.push_tracked(data);
|
||||
self.target.leak_all();
|
||||
}
|
||||
Inst::I32Const(v) => self.target.push_constant(v),
|
||||
Inst::I64Const(v) => self.target.push_constant(v),
|
||||
|
@ -649,14 +649,8 @@ impl Expression {
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn is_memory_size(&self, id: usize) -> bool {
|
||||
matches!(self, Expression::MemorySize(v) if v.memory == id)
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn is_memory_ref(&self, id: usize) -> bool {
|
||||
matches!(self, Expression::MemoryGrow(v) if v.memory == id)
|
||||
|| (id == 0 && matches!(self, Expression::LoadAt(_)))
|
||||
pub fn is_memory_read(&self, id: usize) -> bool {
|
||||
id == 0 && matches!(self, Expression::LoadAt(_))
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user