wasm: add stack_bytes field to Env

This commit is contained in:
Brian Carroll 2022-08-08 21:41:25 +01:00
parent 11929a7b6d
commit dd040d5f73
No known key found for this signature in database
GPG key ID: 9CF4E3BF9C4722C7
6 changed files with 10 additions and 3 deletions

View file

@ -272,9 +272,7 @@ impl<'a> WasmBackend<'a> {
}
pub fn finalize(mut self) -> (WasmModule<'a>, BitVec<usize>) {
// TODO: get this from a CLI parameter with some default
const STACK_SIZE: u32 = 1024 * 1024;
self.set_memory_layout(STACK_SIZE);
self.set_memory_layout(self.env.stack_bytes);
self.export_globals();
self.maybe_call_host_main();

View file

@ -45,6 +45,11 @@ pub struct Env<'a> {
pub arena: &'a Bump,
pub module_id: ModuleId,
pub exposed_to_host: MutSet<Symbol>,
pub stack_bytes: u32,
}
impl Env<'_> {
pub const DEFAULT_STACK_BYTES: u32 = 1024 * 1024;
}
/// Parse the preprocessed host binary