Use TablePlan::for_table and MemoryPlan::for_memory instead of manual code.
This commit is contained in:
@@ -3,9 +3,7 @@ use cranelift_codegen::{ir, isa};
|
|||||||
use cranelift_entity::PrimaryMap;
|
use cranelift_entity::PrimaryMap;
|
||||||
use cranelift_wasm::{DefinedFuncIndex, Global, GlobalInit, Memory, Table, TableElementType};
|
use cranelift_wasm::{DefinedFuncIndex, Global, GlobalInit, Memory, Table, TableElementType};
|
||||||
use target_lexicon::HOST;
|
use target_lexicon::HOST;
|
||||||
use wasmtime_environ::{
|
use wasmtime_environ::{translate_signature, Export, MemoryPlan, Module, TablePlan};
|
||||||
translate_signature, Export, MemoryPlan, MemoryStyle, Module, TablePlan, TableStyle,
|
|
||||||
};
|
|
||||||
use wasmtime_jit::{target_tunables, CompiledModule};
|
use wasmtime_jit::{target_tunables, CompiledModule};
|
||||||
use wasmtime_runtime::{Imports, Instance, InstantiationError, VMFunctionBody};
|
use wasmtime_runtime::{Imports, Instance, InstantiationError, VMFunctionBody};
|
||||||
|
|
||||||
@@ -186,30 +184,27 @@ pub fn instantiate_spectest() -> Result<Instance, InstantiationError> {
|
|||||||
.exports
|
.exports
|
||||||
.insert("global_f64".to_owned(), Export::Global(global));
|
.insert("global_f64".to_owned(), Export::Global(global));
|
||||||
|
|
||||||
let table = module.table_plans.push(TablePlan {
|
let tunables = target_tunables(&HOST);
|
||||||
table: Table {
|
let table = module.table_plans.push(TablePlan::for_table(
|
||||||
|
Table {
|
||||||
ty: TableElementType::Func,
|
ty: TableElementType::Func,
|
||||||
minimum: 10,
|
minimum: 10,
|
||||||
maximum: Some(20),
|
maximum: Some(20),
|
||||||
},
|
},
|
||||||
style: TableStyle::CallerChecksSignature,
|
&tunables,
|
||||||
});
|
));
|
||||||
module
|
module
|
||||||
.exports
|
.exports
|
||||||
.insert("table".to_owned(), Export::Table(table));
|
.insert("table".to_owned(), Export::Table(table));
|
||||||
|
|
||||||
let tunables = target_tunables(&HOST);
|
let memory = module.memory_plans.push(MemoryPlan::for_memory(
|
||||||
let memory = module.memory_plans.push(MemoryPlan {
|
Memory {
|
||||||
memory: Memory {
|
|
||||||
minimum: 1,
|
minimum: 1,
|
||||||
maximum: Some(2),
|
maximum: Some(2),
|
||||||
shared: false,
|
shared: false,
|
||||||
},
|
},
|
||||||
style: MemoryStyle::Static {
|
&tunables,
|
||||||
bound: tunables.static_memory_bound,
|
));
|
||||||
},
|
|
||||||
offset_guard_size: tunables.static_memory_offset_guard_size,
|
|
||||||
});
|
|
||||||
module
|
module
|
||||||
.exports
|
.exports
|
||||||
.insert("memory".to_owned(), Export::Memory(memory));
|
.insert("memory".to_owned(), Export::Memory(memory));
|
||||||
|
|||||||
Reference in New Issue
Block a user