Wasm: load platform object file in tests and pass the bytes to the backend

This commit is contained in:
Brian Carroll 2022-01-09 07:48:48 +00:00
parent 5d5e0eca96
commit fd79613f0d
2 changed files with 20 additions and 5 deletions

View file

@ -38,9 +38,10 @@ pub struct Env<'a> {
pub fn build_module<'a>(
env: &'a Env<'a>,
interns: &'a mut Interns,
platform_bytes: &[u8],
procedures: MutMap<(Symbol, ProcLayout<'a>), Proc<'a>>,
) -> Result<std::vec::Vec<u8>, String> {
let (wasm_module, _) = build_module_help(env, interns, procedures)?;
let (wasm_module, _) = build_module_help(env, interns, platform_bytes, procedures)?;
let mut buffer = std::vec::Vec::with_capacity(4096);
wasm_module.serialize(&mut buffer);
Ok(buffer)
@ -49,6 +50,7 @@ pub fn build_module<'a>(
pub fn build_module_help<'a>(
env: &'a Env<'a>,
interns: &'a mut Interns,
platform_bytes: &[u8],
procedures: MutMap<(Symbol, ProcLayout<'a>), Proc<'a>>,
) -> Result<(WasmModule<'a>, u32), String> {
let mut layout_ids = LayoutIds::default();