Add a comment documenting fuel consumption rates. (#2711)

This commit is contained in:
Dan Gohman
2021-03-08 07:03:08 -08:00
committed by GitHub
parent e41d882144
commit 8bd1c33fec

View File

@@ -574,6 +574,11 @@ impl Store {
/// immediately trap). This function must be called for the store to have /// immediately trap). This function must be called for the store to have
/// some fuel to allow WebAssembly to execute. /// some fuel to allow WebAssembly to execute.
/// ///
/// Most WebAssembly instructions consume 1 unit of fuel. Some
/// instructions, such as `nop`, `drop`, `block`, and `loop`, consume 0
/// units, as any execution cost associated with them involves other
/// instructions which do consume fuel.
///
/// Note that at this time when fuel is entirely consumed it will cause /// Note that at this time when fuel is entirely consumed it will cause
/// wasm to trap. More usages of fuel are planned for the future. /// wasm to trap. More usages of fuel are planned for the future.
/// ///