From 4d2f441cba93a728345254a44ed2b0e6443f6759 Mon Sep 17 00:00:00 2001 From: Tim Lander Date: Thu, 23 May 2019 14:09:48 +0800 Subject: [PATCH] Revert "Flesh out emscripten metadata (#8519)" This reverts commit c25f8bcbaa35a63fa0bdf8e4a93b59b3b22cf1e3. --- tools/shared.py | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/tools/shared.py b/tools/shared.py index b7bbbb2c5cef..b5e6ecdd59de 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -518,7 +518,7 @@ def get_emscripten_version(path): # For the Emscripten-specific WASM metadata section, follows semver, changes # whenever metadata section changes structure # NB: major version 0 implies no compatibility -(EMSCRIPTEN_METADATA_MAJOR, EMSCRIPTEN_METADATA_MINOR) = (0, 1) +(EMSCRIPTEN_METADATA_MAJOR, EMSCRIPTEN_METADATA_MINOR) = (0, 0) # For the JS/WASM ABI, specifies the minimum ABI version required of # the WASM runtime implementation by the generated WASM binary. It follows # semver and changes whenever C types change size/signedness or @@ -2979,20 +2979,8 @@ def delebify(buf, offset): @staticmethod def add_emscripten_metadata(js_file, wasm_file): - WASM_PAGE_SIZE = 65536 - - mem_size = Settings.TOTAL_MEMORY // WASM_PAGE_SIZE + mem_size = Settings.STATIC_BUMP table_size = Settings.WASM_TABLE_SIZE - global_base = Settings.GLOBAL_BASE - - js = open(js_file).read() - m = re.search(r"(^|\s)tempDoublePtr\s+=\s+(\d+)", js) - tempdouble_ptr = int(m.group(2)) - m = re.search(r"(^|\s)DYNAMIC_BASE\s+=\s+(\d+)", js) - dynamic_base = int(m.group(2)) - m = re.search(r"(^|\s)DYNAMICTOP_PTR\s+=\s+(\d+)", js) - dynamictop_ptr = int(m.group(2)) - logger.debug('creating wasm emscripten metadata section with mem size %d, table size %d' % (mem_size, table_size,)) name = b'\x13emscripten_metadata' # section name, including prefixed size contents = ( @@ -3006,13 +2994,11 @@ def add_emscripten_metadata(js_file, wasm_file): WebAssembly.lebify(EMSCRIPTEN_ABI_MAJOR) + WebAssembly.lebify(EMSCRIPTEN_ABI_MINOR) + + # static bump WebAssembly.lebify(mem_size) + - WebAssembly.lebify(table_size) + - WebAssembly.lebify(global_base) + - WebAssembly.lebify(dynamic_base) + - WebAssembly.lebify(dynamictop_ptr) + - WebAssembly.lebify(tempdouble_ptr) + # table size + WebAssembly.lebify(table_size) # NB: more data can be appended here as long as you increase # the EMSCRIPTEN_METADATA_MINOR )