Use emulator options' memory_size to determine size of wasm buffer, allowing for

dynamically sized emulator memory sizes.

Note: This may not always work due to browser limitations.
This commit is contained in:
Amaan Cheval 2017-11-14 17:44:14 +05:30 committed by Fabian
parent 8b5dd87671
commit c8cfffc880
2 changed files with 4 additions and 4 deletions

View file

@ -243,7 +243,7 @@ function V86Starter(options)
v86util.load_wasm(
wasm_file,
{ "env": wasm_shared_funcs },
WASM_MEMORY_SIZE * 1024 * 1024,
options["memory_size"] + INTERNAL_MEM_SIZE,
WASM_TABLE_SIZE,
wm => {
wm.instance.exports["__post_instantiate"]();

View file

@ -357,9 +357,9 @@ const P_DO_MANY_CYCLES = 2;
var WASM_TABLE_SIZE = 0x10000;
// XXX: This should not be fixed
// in M
const WASM_MEMORY_SIZE = 256;
/** @const */
// The space we need for misc internal state before the beginning of mem8; see global_pointers.h
const INTERNAL_MEM_SIZE = 4096 + 0x100000 * 6;
/** @const */
const WASM_PAGE_SIZE = 64 * 1024;