Register memory before calling constructor

As the constructor might call wasm code, which in turn uses memory to
pass strings
This commit is contained in:
Fabian 2018-06-03 20:37:59 -05:00
parent 9d4b5cff2f
commit 9964040583

View file

@ -277,12 +277,12 @@ function V86Starter(options)
options["memory_size"] + GUEST_MEMORY_START,
WASM_TABLE_SIZE,
wm => {
mem = wm.memory.buffer;
mem8 = new Uint8Array(mem);
wm.instance.exports["__post_instantiate"]();
coverage_logger.init(wm);
emulator = this.v86 = new v86(this.emulator_bus, wm, new Codegen(wm), coverage_logger);
cpu = emulator.cpu;
mem = wm.memory.buffer;
mem8 = new Uint8Array(mem);
// XXX: Leaving unindented to minimize diff; still a part of the cb to load_wasm!
this.bus.register("emulator-stopped", function()