Allow instance allocators control over module compilation.

This commit introduces two new methods on `InstanceAllocator`:

* `validate_module` - this method is used to validate a module after
  translation but before compilation. It will be used for the upcoming pooling
  allocator to ensure a module being compiled adheres to the limits of the
  allocator.

* `adjust_tunables` - this method is used to adjust the `Tunables` given the
  JIT compiler.  The pooling allocator will use this to force all memories to
  be static during compilation.
This commit is contained in:
Peter Huene
2020-12-07 22:12:33 -08:00
parent b58afbf849
commit c8871ee1e6
9 changed files with 112 additions and 45 deletions

View File

@@ -27,6 +27,9 @@ pub struct Tunables {
/// Whether or not fuel is enabled for generated code, meaning that fuel
/// will be consumed every time a wasm instruction is executed.
pub consume_fuel: bool,
/// Whether or not to treat the static memory bound as the maximum for unbounded heaps.
pub static_memory_bound_is_maximum: bool,
}
impl Default for Tunables {
@@ -62,6 +65,7 @@ impl Default for Tunables {
parse_wasm_debuginfo: true,
interruptable: false,
consume_fuel: false,
static_memory_bound_is_maximum: false,
}
}
}