mirror of
https://github.com/fluencelabs/parity-wasm
synced 2025-05-31 00:21:35 +00:00
Merge pull request #73 from NikVolf/fix-membase
Add memoryBase to emscripten env-module
This commit is contained in:
commit
b70cf744f2
@ -22,6 +22,8 @@ const DEFAULT_TOTAL_MEMORY: u32 = 16 * 1024 * 1024;
|
|||||||
const DEFAULT_ALLOW_MEMORY_GROWTH: bool = false;
|
const DEFAULT_ALLOW_MEMORY_GROWTH: bool = false;
|
||||||
/// Default tableBase variable value.
|
/// Default tableBase variable value.
|
||||||
const DEFAULT_TABLE_BASE: u32 = 0;
|
const DEFAULT_TABLE_BASE: u32 = 0;
|
||||||
|
/// Default tableBase variable value.
|
||||||
|
const DEFAULT_MEMORY_BASE: u32 = 0;
|
||||||
|
|
||||||
/// Defaul table size.
|
/// Defaul table size.
|
||||||
const DEFAULT_TABLE_SIZE: u32 = 16;
|
const DEFAULT_TABLE_SIZE: u32 = 16;
|
||||||
@ -50,6 +52,8 @@ const INDEX_GLOBAL_ABORT: u32 = 6;
|
|||||||
const INDEX_GLOBAL_EXIT_STATUS: u32 = 7;
|
const INDEX_GLOBAL_EXIT_STATUS: u32 = 7;
|
||||||
/// Index of tableBase global variable.
|
/// Index of tableBase global variable.
|
||||||
const INDEX_GLOBAL_TABLE_BASE: u32 = 8;
|
const INDEX_GLOBAL_TABLE_BASE: u32 = 8;
|
||||||
|
/// Index of memoryBase global.
|
||||||
|
const INDEX_GLOBAL_MEMORY_BASE: u32 = 9;
|
||||||
|
|
||||||
/// Index of abort function.
|
/// Index of abort function.
|
||||||
const INDEX_FUNC_ABORT: u32 = 0;
|
const INDEX_FUNC_ABORT: u32 = 0;
|
||||||
@ -195,6 +199,8 @@ pub fn env_module(params: EnvParams) -> Result<EnvModuleInstance, Error> {
|
|||||||
.with_export(ExportEntry::new("EXITSTATUS".into(), Internal::Global(INDEX_GLOBAL_EXIT_STATUS)))
|
.with_export(ExportEntry::new("EXITSTATUS".into(), Internal::Global(INDEX_GLOBAL_EXIT_STATUS)))
|
||||||
.with_global(GlobalEntry::new(GlobalType::new(ValueType::I32, false), InitExpr::new(vec![Opcode::I32Const(DEFAULT_TABLE_BASE as i32)]))) // TODO: what is this?
|
.with_global(GlobalEntry::new(GlobalType::new(ValueType::I32, false), InitExpr::new(vec![Opcode::I32Const(DEFAULT_TABLE_BASE as i32)]))) // TODO: what is this?
|
||||||
.with_export(ExportEntry::new("tableBase".into(), Internal::Global(INDEX_GLOBAL_TABLE_BASE)))
|
.with_export(ExportEntry::new("tableBase".into(), Internal::Global(INDEX_GLOBAL_TABLE_BASE)))
|
||||||
|
.with_global(GlobalEntry::new(GlobalType::new(ValueType::I32, false), InitExpr::new(vec![Opcode::I32Const(DEFAULT_MEMORY_BASE as i32)]))) // TODO: what is this?
|
||||||
|
.with_export(ExportEntry::new("memoryBase".into(), Internal::Global(INDEX_GLOBAL_MEMORY_BASE)))
|
||||||
// functions
|
// functions
|
||||||
.function()
|
.function()
|
||||||
.signature().build()
|
.signature().build()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user