Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ wasmi = "0.31"
default = ["std"]
std = ["parity-wasm/std"]
sign_ext = ["parity-wasm/sign_ext"]
bulk = ["parity-wasm/bulk"]

[lib]
bench = false
16 changes: 16 additions & 0 deletions src/stack_limiter/max_height.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ use parity_wasm::elements::{self, BlockType, Type};
#[cfg(feature = "sign_ext")]
use parity_wasm::elements::SignExtInstruction;

#[cfg(feature = "bulk")]
use parity_wasm::elements::BulkInstruction;

// The cost in stack items that should be charged per call of a function. This is
// is a static cost that is added to each function call. This makes sense because even
// if a function does not use any parameters or locals some stack space on the host
Expand Down Expand Up @@ -402,6 +405,19 @@ pub fn compute(func_idx: u32, module: &elements::Module) -> Result<u32, &'static
stack.pop_values(1)?;
stack.push_values(1)?;
},

#[cfg(feature = "bulk")]
Bulk(BulkInstruction::MemoryInit(_)) |
Bulk(BulkInstruction::MemoryCopy) |
Bulk(BulkInstruction::MemoryFill) |
Bulk(BulkInstruction::TableInit(_)) |
Bulk(BulkInstruction::TableCopy) => {
stack.pop_values(3)?;
},

#[cfg(feature = "bulk")]
Bulk(BulkInstruction::MemoryDrop(_)) |
Bulk(BulkInstruction::TableDrop(_)) => {},
}
pc += 1;
}
Expand Down