show match
This commit is contained in:
parent
e8cc132972
commit
29c771cf70
|
@ -3,3 +3,4 @@
|
|||
**/*.rs.bk
|
||||
Cargo.lock
|
||||
spec/target
|
||||
.idea
|
||||
|
|
|
@ -1012,14 +1012,23 @@ fn compute_drop_keep(
|
|||
start_value_stack_height,
|
||||
)));
|
||||
}
|
||||
if (actual_value_stack_height as u32 - start_value_stack_height as u32) < keep as u32 {
|
||||
return Err(Error(format!(
|
||||
"Stack underflow detected: asked to keep {:?} values, but there are only {}",
|
||||
keep,
|
||||
actual_value_stack_height as u32 - start_value_stack_height as u32,
|
||||
)));
|
||||
|
||||
match keep {
|
||||
isa::Keep::Single => {
|
||||
if actual_value_stack_height < start_value_stack_height + 1 {
|
||||
return Err(Error(format!(
|
||||
"Stack underflow detected: asked to keep {:?} values, but there are only {}",
|
||||
keep,
|
||||
actual_value_stack_height as u32 - start_value_stack_height as u32,
|
||||
)));
|
||||
}
|
||||
|
||||
(actual_value_stack_height - start_value_stack_height - 1) as u32
|
||||
},
|
||||
isa::Keep::None => {
|
||||
(actual_value_stack_height - start_value_stack_height) as u32
|
||||
}
|
||||
}
|
||||
(actual_value_stack_height as u32 - start_value_stack_height as u32) - keep as u32
|
||||
};
|
||||
|
||||
Ok(isa::DropKeep { drop, keep })
|
||||
|
|
Loading…
Reference in New Issue