mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-12 13:28:49 +00:00
Removed Memory plans in favor of direct styles
This commit is contained in:
@@ -18,7 +18,7 @@ use wasm_common::{FunctionIndex, GlobalIndex, MemoryIndex, SignatureIndex, Table
|
||||
use wasmer_compiler::{WasmError, WasmResult};
|
||||
use wasmer_runtime::VMBuiltinFunctionIndex;
|
||||
use wasmer_runtime::VMOffsets;
|
||||
use wasmer_runtime::{MemoryPlan, MemoryStyle, ModuleInfo, TableStyle};
|
||||
use wasmer_runtime::{MemoryStyle, ModuleInfo, TableStyle};
|
||||
|
||||
/// Compute an `ir::ExternalName` for a given wasm function index.
|
||||
pub fn get_func_name(func_index: FunctionIndex) -> ir::ExternalName {
|
||||
@@ -84,10 +84,10 @@ pub struct FuncEnvironment<'module_environment> {
|
||||
/// Offsets to struct fields accessed by JIT code.
|
||||
offsets: VMOffsets,
|
||||
|
||||
/// The memory plans
|
||||
memory_plans: &'module_environment PrimaryMap<MemoryIndex, MemoryPlan>,
|
||||
/// The memory styles
|
||||
memory_styles: &'module_environment PrimaryMap<MemoryIndex, MemoryStyle>,
|
||||
|
||||
/// The table plans
|
||||
/// The table styles
|
||||
table_styles: &'module_environment PrimaryMap<TableIndex, TableStyle>,
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ impl<'module_environment> FuncEnvironment<'module_environment> {
|
||||
target_config: TargetFrontendConfig,
|
||||
module: &'module_environment ModuleInfo,
|
||||
signatures: &'module_environment PrimaryMap<SignatureIndex, ir::Signature>,
|
||||
memory_plans: &'module_environment PrimaryMap<MemoryIndex, MemoryPlan>,
|
||||
memory_styles: &'module_environment PrimaryMap<MemoryIndex, MemoryStyle>,
|
||||
table_styles: &'module_environment PrimaryMap<TableIndex, TableStyle>,
|
||||
) -> Self {
|
||||
Self {
|
||||
@@ -114,7 +114,7 @@ impl<'module_environment> FuncEnvironment<'module_environment> {
|
||||
memory_init_sig: None,
|
||||
data_drop_sig: None,
|
||||
offsets: VMOffsets::new(target_config.pointer_bytes(), module),
|
||||
memory_plans,
|
||||
memory_styles,
|
||||
table_styles,
|
||||
}
|
||||
}
|
||||
@@ -642,13 +642,8 @@ impl<'module_environment> BaseFuncEnvironment for FuncEnvironment<'module_enviro
|
||||
|
||||
// If we have a declared maximum, we can make this a "static" heap, which is
|
||||
// allocated up front and never moved.
|
||||
let (offset_guard_size, heap_style, readonly_base) = match self.memory_plans[index] {
|
||||
MemoryPlan {
|
||||
style: MemoryStyle::Dynamic {
|
||||
offset_guard_size
|
||||
},
|
||||
memory: _,
|
||||
} => {
|
||||
let (offset_guard_size, heap_style, readonly_base) = match self.memory_styles[index] {
|
||||
MemoryStyle::Dynamic { offset_guard_size } => {
|
||||
let heap_bound = func.create_global_value(ir::GlobalValueData::Load {
|
||||
base: ptr,
|
||||
offset: Offset32::new(current_length_offset),
|
||||
@@ -663,9 +658,9 @@ impl<'module_environment> BaseFuncEnvironment for FuncEnvironment<'module_enviro
|
||||
false,
|
||||
)
|
||||
}
|
||||
MemoryPlan {
|
||||
style: MemoryStyle::Static { bound, offset_guard_size },
|
||||
memory: _,
|
||||
MemoryStyle::Static {
|
||||
bound,
|
||||
offset_guard_size,
|
||||
} => (
|
||||
Uimm64::new(offset_guard_size),
|
||||
ir::HeapStyle::Static {
|
||||
|
||||
Reference in New Issue
Block a user