mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-19 01:59:48 +00:00
wasm_interp: rename ValueStack::len -> depth
This commit is contained in:
parent
76341c7611
commit
ed18bf7709
4 changed files with 11 additions and 11 deletions
|
@ -62,7 +62,7 @@ impl<'a> CallStack<'a> {
|
|||
self.set_local_help(i as u32, arg);
|
||||
}
|
||||
|
||||
self.value_stack_bases.push(value_stack.len() as u32);
|
||||
self.value_stack_bases.push(value_stack.depth() as u32);
|
||||
|
||||
// Parse local variable declarations in the function header. They're grouped by type.
|
||||
let local_group_count = u32::parse((), code_bytes, pc).unwrap();
|
||||
|
@ -209,7 +209,7 @@ impl<'a> CallStack<'a> {
|
|||
let frame_value_count = {
|
||||
let value_stack_base = self.value_stack_bases[frame];
|
||||
let next_value_stack_base = if frame == self.frame_offsets.len() - 1 {
|
||||
value_stack.len() as u32
|
||||
value_stack.depth() as u32
|
||||
} else {
|
||||
self.value_stack_bases[frame + 1]
|
||||
};
|
||||
|
|
|
@ -469,13 +469,13 @@ impl<'a, I: ImportDispatcher> Instance<'a, I> {
|
|||
BLOCK => {
|
||||
self.fetch_immediate_u32(module); // blocktype (ignored)
|
||||
self.blocks.push(Block::Normal {
|
||||
vstack: self.value_stack.len(),
|
||||
vstack: self.value_stack.depth(),
|
||||
});
|
||||
}
|
||||
LOOP => {
|
||||
self.fetch_immediate_u32(module); // blocktype (ignored)
|
||||
self.blocks.push(Block::Loop {
|
||||
vstack: self.value_stack.len(),
|
||||
vstack: self.value_stack.depth(),
|
||||
start_addr: self.program_counter,
|
||||
});
|
||||
}
|
||||
|
@ -483,7 +483,7 @@ impl<'a, I: ImportDispatcher> Instance<'a, I> {
|
|||
self.fetch_immediate_u32(module); // blocktype (ignored)
|
||||
let condition = self.value_stack.pop_i32()?;
|
||||
self.blocks.push(Block::Normal {
|
||||
vstack: self.value_stack.len(),
|
||||
vstack: self.value_stack.depth(),
|
||||
});
|
||||
if condition == 0 {
|
||||
let mut depth = self.blocks.len();
|
||||
|
|
|
@ -840,7 +840,7 @@ fn test_set_get_local() {
|
|||
state.execute_next_instruction(&module).unwrap();
|
||||
state.execute_next_instruction(&module).unwrap();
|
||||
state.execute_next_instruction(&module).unwrap();
|
||||
assert_eq!(state.value_stack.len(), 1);
|
||||
assert_eq!(state.value_stack.depth(), 1);
|
||||
assert_eq!(state.value_stack.pop(), Value::I32(12345));
|
||||
}
|
||||
|
||||
|
@ -876,7 +876,7 @@ fn test_tee_get_local() {
|
|||
state.execute_next_instruction(&module).unwrap();
|
||||
state.execute_next_instruction(&module).unwrap();
|
||||
state.execute_next_instruction(&module).unwrap();
|
||||
assert_eq!(state.value_stack.len(), 2);
|
||||
assert_eq!(state.value_stack.depth(), 2);
|
||||
assert_eq!(state.value_stack.pop(), Value::I32(12345));
|
||||
assert_eq!(state.value_stack.pop(), Value::I32(12345));
|
||||
}
|
||||
|
@ -903,7 +903,7 @@ fn test_global() {
|
|||
state.execute_next_instruction(&module).unwrap();
|
||||
state.execute_next_instruction(&module).unwrap();
|
||||
state.execute_next_instruction(&module).unwrap();
|
||||
assert_eq!(state.value_stack.len(), 2);
|
||||
assert_eq!(state.value_stack.depth(), 2);
|
||||
assert_eq!(state.value_stack.pop(), Value::I32(555));
|
||||
assert_eq!(state.value_stack.pop(), Value::I32(222));
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ impl<'a> ValueStack<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn len(&self) -> usize {
|
||||
pub(crate) fn depth(&self) -> usize {
|
||||
self.values.len()
|
||||
}
|
||||
|
||||
|
@ -91,8 +91,8 @@ impl<'a> ValueStack<'a> {
|
|||
self.values.iter()
|
||||
}
|
||||
|
||||
pub(crate) fn truncate(&mut self, len: usize) {
|
||||
self.values.truncate(len)
|
||||
pub(crate) fn truncate(&mut self, depth: usize) {
|
||||
self.values.truncate(depth)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue