diff options
68 files changed, 297 insertions, 179 deletions
diff --git a/auto_update_tests.py b/auto_update_tests.py index 2e325ed94..c3b9742b5 100755 --- a/auto_update_tests.py +++ b/auto_update_tests.py @@ -29,7 +29,7 @@ for t in sorted(os.listdir('test')): for s in sorted(os.listdir(os.path.join('test', 'dot_s'))) + sorted(os.listdir(os.path.join('test', 'experimental', 'prototype-wasmate', 'test'))): if not s.endswith('.s'): continue - if s in ['inline-asm.s', 'userstack.s']: continue + if s in ['inline-asm.s', 'userstack.s', 'offset-folding.s']: continue print '..', s wasm = s.replace('.s', '.wast') full = os.path.join('test', 'dot_s', s) @@ -236,7 +236,7 @@ print '\n[ checking .s testcases... ]\n' for s in sorted(os.listdir(os.path.join('test', 'dot_s'))) + sorted(os.listdir(os.path.join('test', 'experimental', 'prototype-wasmate', 'test'))): if not s.endswith('.s'): continue - if s in ['inline-asm.s', 'userstack.s']: continue + if s in ['inline-asm.s', 'userstack.s', 'offset-folding.s']: continue print '..', s wasm = s.replace('.s', '.wast') full = os.path.join('test', 'dot_s', s) @@ -273,7 +273,7 @@ if has_emcc: command += ['-s', 'BINARYEN_METHOD="' + method + '"'] else: method = 'wasm-s-parser' # this is the default - print method, ' : ', command, ' => ', success + print method, ' : ', ' '.join(command), ' => ', success subprocess.check_call(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) def break_cashew(): asm = open('a.wasm.asm.js').read() @@ -307,7 +307,7 @@ if has_emcc: print '\n[ checking emcc WASM_BACKEND testcases... ]\n' - for c in ['hello_world.cpp', 'hello_num.cpp']: + for c in ['hello_world.cpp', 'hello_num.cpp', 'globals.cpp']: print '..', c base = c.replace('.cpp', '').replace('.c', '') expected = open(os.path.join('test', 'wasm_backend', base + '.txt')).read() diff --git a/src/command-line.h b/src/command-line.h index 63cf09d9f..4b8b12b4c 100644 --- a/src/command-line.h +++ b/src/command-line.h @@ -26,9 +26,12 @@ namespace wasm { struct Options { + // standard options bool debug; std::string infile; std::string outfile; + // extra options + std::map<std::string, const char*> extra; Options() : debug(false) {} }; @@ -37,17 +40,11 @@ bool optionIs(const char *arg, const char *LongOpt, const char *ShortOpt) { } // TODO(jfb) Make this configurable: callers should pass in option handlers. -void processCommandLine(int argc, const char *argv[], Options *options) { +void processCommandLine(int argc, const char *argv[], Options *options, const char *help) { assert(argc > 0 && "expect at least program name as an argument"); for (size_t i = 1, e = argc; i != e; ++i) { if (optionIs(argv[i], "--help", "-h")) { - std::cerr << "s2wasm INFILE\n\n" - "Link .s file into .wast\n\n" - "Optional arguments:\n" - " -n, --help Show this help message and exit\n" - " -d, --debug Print debug information to stderr\n" - " -o, --output Output file (stdout if not specified)\n" - << std::endl; + std::cerr << help; exit(EXIT_SUCCESS); } else if (optionIs(argv[i], "--debug", "-d")) { options->debug = true; @@ -62,6 +59,14 @@ void processCommandLine(int argc, const char *argv[], Options *options) { exit(EXIT_FAILURE); } options->outfile = argv[++i]; + } else if (argv[i][0] == '-' && argv[i][1] == '-') { + size_t j = 2; + std::string name; + while (argv[i][j] && argv[i][j] != '=') { + name += argv[i][j]; + j++; + } + options->extra[name] = argv[i][j] == '=' ? &argv[i][j+1] : "(no value)"; } else { if (options->infile.size()) { std::cerr << "Expected only one input file, got '" << options->infile diff --git a/src/js/wasm.js-post.js b/src/js/wasm.js-post.js index f886076a9..bdb825573 100644 --- a/src/js/wasm.js-post.js +++ b/src/js/wasm.js-post.js @@ -51,6 +51,25 @@ function integrateWasmJS(Module) { return ret; } + function mergeMemory(newBuffer) { + // The wasm instance creates its memory. But static init code might have written to + // buffer already, and we must copy it over in a proper merge. + // TODO: avoid this copy, by avoiding such static init writes + // TODO: in shorter term, just copy up to the last static init write + var oldBuffer = Module['buffer']; + assert(newBuffer.byteLength >= oldBuffer.byteLength, 'we might fail if we allocated more than TOTAL_MEMORY'); + // the wasm module does write out the memory initialization, in range STATIC_BASE..STATIC_BUMP, so avoid that + (new Int8Array(newBuffer).subarray(0, STATIC_BASE)).set(new Int8Array(oldBuffer).subarray(0, STATIC_BASE)); + (new Int8Array(newBuffer).subarray(STATIC_BASE + STATIC_BUMP)).set(new Int8Array(oldBuffer).subarray(STATIC_BASE + STATIC_BUMP)); + updateGlobalBuffer(newBuffer); + updateGlobalBufferViews(); + Module['reallocBuffer'] = function(size) { + var old = Module['buffer']; + wasmJS['asmExports']['__growWasmMemory'](size); // tiny wasm method that just does grow_memory + return Module['buffer'] !== old ? Module['buffer'] : null; // if it was reallocated, it changed + }; + } + // wasm lacks globals, so asm2wasm maps them into locations in memory. that information cannot // be present in the wasm output of asm2wasm, so we store it in a side file. If we load asm2wasm // output, either generated ahead of time or on the client, we need to apply those mapped @@ -86,23 +105,7 @@ function integrateWasmJS(Module) { "asm2wasm": asm2wasmImports })); - // The wasm instance creates its memory. But static init code might have written to - // buffer already, and we must copy it over. - // TODO: avoid this copy, by avoiding such static init writes - // TODO: in shorter term, just copy up to the last static init write - var oldBuffer = Module['buffer']; - var newBuffer = instance.memory; - assert(newBuffer.byteLength >= oldBuffer.byteLength, 'we might fail if we allocated more than TOTAL_MEMORY'); - // the wasm module does write out the memory initialization, in range STATIC_BASE..STATIC_BUMP, so avoid that - (new Int8Array(newBuffer).subarray(0, STATIC_BASE)).set(new Int8Array(oldBuffer).subarray(0, STATIC_BASE)); - (new Int8Array(newBuffer).subarray(STATIC_BASE + STATIC_BUMP)).set(new Int8Array(oldBuffer).subarray(STATIC_BASE + STATIC_BUMP)); - updateGlobalBuffer(newBuffer); - updateGlobalBufferViews(); - Module['reallocBuffer'] = function(size) { - var old = Module['buffer']; - wasmJS['asmExports']['__growWasmMemory'](size); // tiny wasm method that just does grow_memory - return Module['buffer'] !== old ? Module['buffer'] : null; // if it was reallocated, it changed - }; + mergeMemory(instance.memory); applyMappedGlobals(); @@ -158,19 +161,6 @@ function integrateWasmJS(Module) { info.global = global; info.env = env; - // wasm code would create its own buffer, at this time. But static init code might have - // written to the buffer already, and we must copy it over. We could just avoid - // this copy in wasm.js polyfilling, but to be as close as possible to real wasm, - // we do what wasm would do. - // TODO: avoid this copy, by avoiding such static init writes - // TODO: in shorter term, just copy up to the last static init write - var oldBuffer = Module['buffer']; - var newBuffer = new ArrayBuffer(oldBuffer.byteLength); - (new Int8Array(newBuffer)).set(new Int8Array(oldBuffer)); - updateGlobalBuffer(newBuffer); - updateGlobalBufferViews(); - wasmJS['providedTotalMemory'] = Module['buffer'].byteLength; - Module['reallocBuffer'] = function(size) { var old = Module['buffer']; wasmJS['asmExports']['__growWasmMemory'](size); // tiny wasm method that just does grow_memory @@ -185,12 +175,22 @@ function integrateWasmJS(Module) { wasmJS['_load_asm2wasm'](temp); } else { wasmJS['_load_s_expr2wasm'](temp); - applyMappedGlobals(); } wasmJS['_free'](temp); + wasmJS['providedTotalMemory'] = Module['buffer'].byteLength; + wasmJS['_instantiate'](temp); + if (Module['newBuffer']) { + mergeMemory(Module['newBuffer']); + Module['newBuffer'] = null; + } + + if (method == 'wasm-s-parser') { + applyMappedGlobals(); + } + return wasmJS['asmExports']; }; } diff --git a/src/s2wasm-main.cpp b/src/s2wasm-main.cpp index cb60d2a57..86a9737a7 100644 --- a/src/s2wasm-main.cpp +++ b/src/s2wasm-main.cpp @@ -26,7 +26,14 @@ using namespace wasm; int main(int argc, const char *argv[]) { Options options; - processCommandLine(argc, argv, &options); + processCommandLine(argc, argv, &options, + "s2wasm INFILE\n\n" + "Link .s file into .wast\n\n" + "Optional arguments:\n" + " -n, --help Show this help message and exit\n" + " -d, --debug Print debug information to stderr\n" + " -o, --output Output file (stdout if not specified)\n" + " --global-base=N Where to start to place globals\n"); std::string input; { @@ -62,7 +69,8 @@ int main(int argc, const char *argv[]) { if (options.debug) std::cerr << "Parsing and wasming..." << std::endl; AllocatingModule wasm; - S2WasmBuilder s2wasm(wasm, input.c_str(), options.debug); + size_t globalBase = options.extra["global-base"] ? atoi(options.extra["global-base"]) : 1; + S2WasmBuilder s2wasm(wasm, input.c_str(), options.debug, globalBase); if (options.debug) std::cerr << "Emscripten gluing..." << std::endl; std::stringstream meta; diff --git a/src/s2wasm.h b/src/s2wasm.h index 02fc37cfe..74387859e 100644 --- a/src/s2wasm.h +++ b/src/s2wasm.h @@ -40,8 +40,8 @@ class S2WasmBuilder { bool debug; public: - S2WasmBuilder(AllocatingModule& wasm, const char* input, bool debug) - : wasm(wasm), allocator(wasm.allocator), debug(debug) { + S2WasmBuilder(AllocatingModule& wasm, const char* input, bool debug, size_t globalBase) + : wasm(wasm), allocator(wasm.allocator), debug(debug), globalBase(globalBase), nextStatic(globalBase) { s = input; scan(); s = input; @@ -52,10 +52,16 @@ public: private: // state - size_t nextStatic = 1; // location of next static allocation, i.e., the data segment + size_t globalBase, // where globals can start to be statically allocated, i.e., the data segment + nextStatic; // location of next static allocation std::map<Name, int32_t> staticAddresses; // name => address - typedef std::pair<Const*, Name> Addressing; + struct Addressing { + Const* value; + Name name; + int32_t offset; + Addressing(Const* value, Name name, int32_t offset) : value(value), name(name), offset(offset) {} + }; std::vector<Addressing> addressings; // we fix these up struct Relocation { @@ -70,6 +76,8 @@ private: std::map<size_t, size_t> addressSegments; // address => segment index + std::map<Name, size_t> functionIndexes; + // utilities void skipWhitespace() { @@ -588,12 +596,14 @@ private: if (match("const")) { Name assign = getAssign(); char start = *s; - cashew::IString str = getStr(); - if (start == '.' || (isalpha(start) && str != NAN_ && str != INFINITY_)) { + cashew::IString str = getStrToSep(); + if (start == '.' || (isalpha(start) && str != NAN__ && str != INFINITY__)) { // global address + int32_t offset = 0; + if (match("+")) offset = getInt(); auto curr = allocator.alloc<Const>(); curr->type = i32; - addressings.emplace_back(curr, str); + addressings.emplace_back(curr, str, offset); setOutput(curr, assign); } else { // constant @@ -881,12 +891,17 @@ private: bool zero = true; while (1) { skipWhitespace(); - if (match(".asciz")) { - *raw = getQuoted(); - raw->push_back(0); - zero = false; - } else if (match(".ascii")) { - *raw = getQuoted(); + if (match(".asci")) { + bool z; + if (match("i")) { + z = false; + } else { + mustMatch("z"); + z = true; + } + auto quoted = getQuoted(); + raw->insert(raw->end(), quoted.begin(), quoted.end()); + if (z) raw->push_back(0); zero = false; } else if (match(".zero")) { int32_t size = getInt(); @@ -926,7 +941,11 @@ private: mustMatch(name.str); mustMatch(","); size_t seenSize = atoi(getStr().str); // TODO: optimize - assert(seenSize == size); + assert(seenSize >= size); + while (raw->size() < seenSize) { + raw->push_back(0); + } + size = seenSize; } while (nextStatic % align) nextStatic++; // assign the address, add to memory @@ -950,10 +969,25 @@ private: } void fix() { - for (auto& pair : addressings) { - Const* curr = pair.first; - Name name = pair.second; - curr->value = Literal(staticAddresses[name]); + for (auto& triple : addressings) { + Const* curr = triple.value; + Name name = triple.name; + size_t offset = triple.offset; + const auto &symbolAddress = staticAddresses.find(name); + if (symbolAddress != staticAddresses.end()) { + curr->value = Literal(symbolAddress->second + offset); + } else { + // must be a function address + if (wasm.functionsMap.count(name) == 0) { + std::cerr << "Unknown symbol: " << name << '\n'; + abort_on("Unknown symbol"); + } + if (functionIndexes.count(name) == 0) { + functionIndexes[name] = functionIndexes.size(); + wasm.table.names.push_back(name); + } + curr->value = Literal(functionIndexes[name] + offset); + } assert(curr->value.i32 > 0); curr->type = i32; } @@ -1056,6 +1090,8 @@ public: o << "]"; } o << "}"; + o << ","; + o << "\"staticBump\": " << (nextStatic - globalBase); o << " }"; } diff --git a/src/shared-constants.h b/src/shared-constants.h index ea8980fa2..a928756da 100644 --- a/src/shared-constants.h +++ b/src/shared-constants.h @@ -24,6 +24,8 @@ namespace wasm { cashew::IString GLOBAL("global"), NAN_("NaN"), INFINITY_("Infinity"), + NAN__("nan"), + INFINITY__("infinity"), TOPMOST("topmost"), INT8ARRAY("Int8Array"), INT16ARRAY("Int16Array"), diff --git a/src/wasm-js.cpp b/src/wasm-js.cpp index 477c772ec..760f00c46 100644 --- a/src/wasm-js.cpp +++ b/src/wasm-js.cpp @@ -146,6 +146,23 @@ extern "C" void EMSCRIPTEN_KEEPALIVE instantiate() { if (wasmJSDebug) std::cerr << "creating instance...\n"; struct JSExternalInterface : ModuleInstance::ExternalInterface { + void init(Module& wasm) override { + // if we have memory segments, create a new buffer here, just like native wasm support would. + // otherwise, no need to. + if (wasm.memory.segments.size() > 0) { + EM_ASM_({ + Module['outside']['newBuffer'] = new ArrayBuffer($0); + }, wasm.memory.initial); + for (auto segment : wasm.memory.segments) { + EM_ASM_({ + var source = Module['HEAP8'].subarray($1, $1 + $2); + var target = new Int8Array(Module['outside']['newBuffer']); + target.set(source, $0); + }, segment.offset, segment.data, segment.size); + } + } + } + Literal callImport(Import *import, ModuleInstance::LiteralList& arguments) override { if (wasmJSDebug) std::cout << "calling import " << import->name.str << '\n'; EM_ASM({ diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h index 55b4a20aa..4817fdf48 100644 --- a/src/wasm-s-parser.h +++ b/src/wasm-s-parser.h @@ -187,34 +187,16 @@ private: } char *start = input; if (input[0] == '"') { - // parse escaping \", and \a7 into 0xa7 the character code + // parse escaping \", but leave code escaped - we'll handle escaping in memory segments specifically input++; std::string str; while (1) { if (input[0] == '"') break; if (input[0] == '\\') { - if (input[1] == '"') { - str += '"'; - input += 2; - continue; - } else if (input[1] == '\'') { - str += '\''; - input += 2; - continue; - } else if (input[1] == '\\') { - str += '\\'; - input += 2; - } else if (input[1] == 'n') { - str += '\n'; - input += 2; - } else if (input[1] == 't') { - str += '\t'; - input += 2; - } else { - str += (char)(unhex(input[1])*16 + unhex(input[2])); - input += 3; - continue; - } + str += input[0]; + str += input[1]; + input += 2; + continue; } str += input[0]; input++; @@ -965,8 +947,39 @@ private: while (i < s.size()) { Element& curr = *s[i]; assert(curr[0]->str() == SEGMENT); - char *data = strdup(curr[2]->c_str()); // TODO: handle non-null-terminated? - wasm.memory.segments.emplace_back(atoi(curr[1]->c_str()), data, strlen(data)); + const char *input = curr[2]->c_str(); + char *data = (char*)malloc(strlen(input)); // over-allocated, since escaping collapses, but whatever + char *write = data; + while (1) { + if (input[0] == 0) break; + if (input[0] == '\\') { + if (input[1] == '"') { + *write++ = '"'; + input += 2; + continue; + } else if (input[1] == '\'') { + *write++ = '\''; + input += 2; + continue; + } else if (input[1] == '\\') { + *write++ = '\\'; + input += 2; + } else if (input[1] == 'n') { + *write++ = '\n'; + input += 2; + } else if (input[1] == 't') { + *write++ = '\t'; + input += 2; + } else { + *write++ = (char)(unhex(input[1])*16 + unhex(input[2])); + input += 3; + continue; + } + } + *write++ = input[0]; + input++; + } + wasm.memory.segments.emplace_back(atoi(curr[1]->c_str()), data, write - data); i++; } } diff --git a/test/dot_s/alternate-lcomm.wast b/test/dot_s/alternate-lcomm.wast index 0d3c48333..955ce11ea 100644 --- a/test/dot_s/alternate-lcomm.wast +++ b/test/dot_s/alternate-lcomm.wast @@ -1,4 +1,4 @@ (module (memory 0 4294967295) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/asm_const.wast b/test/dot_s/asm_const.wast index e800f8893..99fe21995 100644 --- a/test/dot_s/asm_const.wast +++ b/test/dot_s/asm_const.wast @@ -15,4 +15,4 @@ ) ) ) -;; METADATA: { "asmConsts": {"0": ["{ Module.print(\"hello, world!\"); }", ["vi"]]} } +;; METADATA: { "asmConsts": {"0": ["{ Module.print(\"hello, world!\"); }", ["vi"]]},"staticBump": 50 } diff --git a/test/dot_s/basics.s b/test/dot_s/basics.s index b9c3baeed..c4f6776d6 100644 --- a/test/dot_s/basics.s +++ b/test/dot_s/basics.s @@ -47,6 +47,7 @@ BB0_3: # in Loop: Header=BB0_1 Depth=1 BB0_4: i32.const $push11=, -12 i32.add $0=, $0, $pop11 + i32.const $discard=, main # just take address for testing BB0_5: # %.loopexit return $0 func_end0: @@ -58,4 +59,10 @@ func_end0: .asciz "hello, world!\n" .size .str, 15 + .type a2,@object # @a2 + .globl a2 +a2: + .int8 118 # 0x76 + .ascii "cq" + .size a2, 3 # surprisingly large size diff --git a/test/dot_s/basics.wast b/test/dot_s/basics.wast index 7ac7ecc6e..7e59854d8 100644 --- a/test/dot_s/basics.wast +++ b/test/dot_s/basics.wast @@ -1,7 +1,8 @@ (module - (memory 0 4294967295 (segment 16 "hello, world!\n\00")) + (memory 0 4294967295 (segment 16 "hello, world!\n\00") (segment 32 "vcq")) (import $puts "env" "puts") (export "main" $main) + (table $main) (func $main (param $$0 i32) (param $$1 i32) (result i32) (block $fake_return_waka123 (block @@ -84,6 +85,7 @@ (i32.const -12) ) ) + (i32.const 1) ) (br $fake_return_waka123 (get_local $$0) @@ -92,4 +94,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 34 } diff --git a/test/dot_s/call.wast b/test/dot_s/call.wast index e7fa949cc..40ab83553 100644 --- a/test/dot_s/call.wast +++ b/test/dot_s/call.wast @@ -134,4 +134,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/cfg-stackify.wast b/test/dot_s/cfg-stackify.wast index e170415cf..82fe8789b 100644 --- a/test/dot_s/cfg-stackify.wast +++ b/test/dot_s/cfg-stackify.wast @@ -1048,7 +1048,7 @@ (loop $BB21_8 $BB21_1 (block (set_local $$1 - (i32.load align=8 + (i32.load8_u align=1 (get_local $$0) ) ) @@ -1150,4 +1150,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/comparisons_f32.wast b/test/dot_s/comparisons_f32.wast index 83574f9b4..6a050b39f 100644 --- a/test/dot_s/comparisons_f32.wast +++ b/test/dot_s/comparisons_f32.wast @@ -267,4 +267,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/comparisons_f64.wast b/test/dot_s/comparisons_f64.wast index ea85676da..29fb60481 100644 --- a/test/dot_s/comparisons_f64.wast +++ b/test/dot_s/comparisons_f64.wast @@ -267,4 +267,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/comparisons_i32.wast b/test/dot_s/comparisons_i32.wast index c821cfad7..65fc3bad2 100644 --- a/test/dot_s/comparisons_i32.wast +++ b/test/dot_s/comparisons_i32.wast @@ -131,4 +131,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/comparisons_i64.wast b/test/dot_s/comparisons_i64.wast index 16da05ef5..63166a543 100644 --- a/test/dot_s/comparisons_i64.wast +++ b/test/dot_s/comparisons_i64.wast @@ -131,4 +131,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/conv.wast b/test/dot_s/conv.wast index d5933fd7e..0fe9776ff 100644 --- a/test/dot_s/conv.wast +++ b/test/dot_s/conv.wast @@ -316,4 +316,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/copysign-casts.wast b/test/dot_s/copysign-casts.wast index 31f6145b4..0bee77732 100644 --- a/test/dot_s/copysign-casts.wast +++ b/test/dot_s/copysign-casts.wast @@ -31,4 +31,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/cpus.wast b/test/dot_s/cpus.wast index aed7f5870..736a887bd 100644 --- a/test/dot_s/cpus.wast +++ b/test/dot_s/cpus.wast @@ -11,4 +11,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/data-offset-folding.wast b/test/dot_s/data-offset-folding.wast index e0a60c70e..059d0e41c 100644 --- a/test/dot_s/data-offset-folding.wast +++ b/test/dot_s/data-offset-folding.wast @@ -1,4 +1,4 @@ (module - (memory 0 4294967295 (segment 2 "\00\00\00\00") (segment 408 "X\00\00\00")) + (memory 0 4294967295 (segment 4 "\00\00\00\00") (segment 416 "`\00\00\00")) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 419 } diff --git a/test/dot_s/dead-vreg.wast b/test/dot_s/dead-vreg.wast index ced7413ab..ad270b31a 100644 --- a/test/dot_s/dead-vreg.wast +++ b/test/dot_s/dead-vreg.wast @@ -111,4 +111,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/exit.wast b/test/dot_s/exit.wast index c0af5a734..6b7d22bf3 100644 --- a/test/dot_s/exit.wast +++ b/test/dot_s/exit.wast @@ -11,4 +11,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/f32.wast b/test/dot_s/f32.wast index e9e9a649e..aa0ec5920 100644 --- a/test/dot_s/f32.wast +++ b/test/dot_s/f32.wast @@ -203,4 +203,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/f64.wast b/test/dot_s/f64.wast index 6541b20b8..5b8de4546 100644 --- a/test/dot_s/f64.wast +++ b/test/dot_s/f64.wast @@ -203,4 +203,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/fast-isel.wast b/test/dot_s/fast-isel.wast index 0981fbe79..a172ea5e2 100644 --- a/test/dot_s/fast-isel.wast +++ b/test/dot_s/fast-isel.wast @@ -21,4 +21,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/frem.wast b/test/dot_s/frem.wast index 6592622d0..8ba5ad97d 100644 --- a/test/dot_s/frem.wast +++ b/test/dot_s/frem.wast @@ -29,4 +29,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/func.wast b/test/dot_s/func.wast index 0090df642..18402d018 100644 --- a/test/dot_s/func.wast +++ b/test/dot_s/func.wast @@ -72,4 +72,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/global.wast b/test/dot_s/global.wast index 255b35617..63cec281a 100644 --- a/test/dot_s/global.wast +++ b/test/dot_s/global.wast @@ -1,5 +1,5 @@ (module - (memory 0 4294967295 (segment 2 "9\05\00\00")) + (memory 0 4294967295 (segment 4 "9\05\00\00")) (import $memcpy "env" "memcpy") (export "foo" $foo) (export "call_memcpy" $call_memcpy) @@ -29,4 +29,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 11 } diff --git a/test/dot_s/globl.wast b/test/dot_s/globl.wast index 874d99a2b..b36657b8f 100644 --- a/test/dot_s/globl.wast +++ b/test/dot_s/globl.wast @@ -9,4 +9,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/i32.wast b/test/dot_s/i32.wast index 6025fedd7..7466c5b6c 100644 --- a/test/dot_s/i32.wast +++ b/test/dot_s/i32.wast @@ -230,4 +230,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/i64.wast b/test/dot_s/i64.wast index ace3135f3..d193b2cb5 100644 --- a/test/dot_s/i64.wast +++ b/test/dot_s/i64.wast @@ -230,4 +230,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/ident.wast b/test/dot_s/ident.wast index 0d3c48333..955ce11ea 100644 --- a/test/dot_s/ident.wast +++ b/test/dot_s/ident.wast @@ -1,4 +1,4 @@ (module (memory 0 4294967295) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/immediates.wast b/test/dot_s/immediates.wast index ce9b8520f..257421fd9 100644 --- a/test/dot_s/immediates.wast +++ b/test/dot_s/immediates.wast @@ -241,4 +241,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/lcomm-in-text-segment.wast b/test/dot_s/lcomm-in-text-segment.wast index 0d3c48333..955ce11ea 100644 --- a/test/dot_s/lcomm-in-text-segment.wast +++ b/test/dot_s/lcomm-in-text-segment.wast @@ -1,4 +1,4 @@ (module (memory 0 4294967295) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/legalize.wast b/test/dot_s/legalize.wast index 2fcc9aeac..72230965a 100644 --- a/test/dot_s/legalize.wast +++ b/test/dot_s/legalize.wast @@ -3972,4 +3972,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/load-ext.wast b/test/dot_s/load-ext.wast index e569cfd33..422828010 100644 --- a/test/dot_s/load-ext.wast +++ b/test/dot_s/load-ext.wast @@ -14,7 +14,7 @@ (block $fake_return_waka123 (block (br $fake_return_waka123 - (i32.load align=8 + (i32.load8_s align=1 (get_local $$0) ) ) @@ -25,7 +25,7 @@ (block $fake_return_waka123 (block (br $fake_return_waka123 - (i32.load align=8 + (i32.load8_u align=1 (get_local $$0) ) ) @@ -36,7 +36,7 @@ (block $fake_return_waka123 (block (br $fake_return_waka123 - (i32.load align=16 + (i32.load16_s align=2 (get_local $$0) ) ) @@ -47,7 +47,7 @@ (block $fake_return_waka123 (block (br $fake_return_waka123 - (i32.load align=16 + (i32.load16_u align=2 (get_local $$0) ) ) @@ -58,7 +58,7 @@ (block $fake_return_waka123 (block (br $fake_return_waka123 - (i64.load align=8 + (i64.load8_s align=1 (get_local $$0) ) ) @@ -69,7 +69,7 @@ (block $fake_return_waka123 (block (br $fake_return_waka123 - (i64.load align=8 + (i64.load8_u align=1 (get_local $$0) ) ) @@ -80,7 +80,7 @@ (block $fake_return_waka123 (block (br $fake_return_waka123 - (i64.load align=16 + (i64.load16_s align=2 (get_local $$0) ) ) @@ -91,7 +91,7 @@ (block $fake_return_waka123 (block (br $fake_return_waka123 - (i64.load align=16 + (i64.load16_u align=2 (get_local $$0) ) ) @@ -102,7 +102,7 @@ (block $fake_return_waka123 (block (br $fake_return_waka123 - (i64.load align=32 + (i64.load align=4 (get_local $$0) ) ) @@ -113,7 +113,7 @@ (block $fake_return_waka123 (block (br $fake_return_waka123 - (i64.load align=32 + (i64.load align=4 (get_local $$0) ) ) @@ -121,4 +121,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/load-store-i1.wast b/test/dot_s/load-store-i1.wast index 644fe798b..d9b67382b 100644 --- a/test/dot_s/load-store-i1.wast +++ b/test/dot_s/load-store-i1.wast @@ -10,7 +10,7 @@ (block $fake_return_waka123 (block (br $fake_return_waka123 - (i32.load align=8 + (i32.load8_u align=1 (get_local $$0) ) ) @@ -27,7 +27,7 @@ (br $fake_return_waka123 (i32.shr_s (i32.shl - (i32.load align=8 + (i32.load8_u align=1 (get_local $$0) ) (get_local $$1) @@ -42,7 +42,7 @@ (block $fake_return_waka123 (block (br $fake_return_waka123 - (i64.load align=8 + (i64.load8_u align=1 (get_local $$0) ) ) @@ -59,7 +59,7 @@ (br $fake_return_waka123 (i64.shr_s (i64.shl - (i64.load align=8 + (i64.load8_u align=1 (get_local $$0) ) (get_local $$1) @@ -99,4 +99,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/load.wast b/test/dot_s/load.wast index 4d2071d41..ac52dcda0 100644 --- a/test/dot_s/load.wast +++ b/test/dot_s/load.wast @@ -49,4 +49,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/memops.wast b/test/dot_s/memops.wast index 4f23804b7..6f0c884f4 100644 --- a/test/dot_s/memops.wast +++ b/test/dot_s/memops.wast @@ -132,7 +132,7 @@ (set_local $$6 (i32.add (i32.and - (i32.load align=8 + (i32.load8_u align=1 (i32.add (get_local $$11) (get_local $$5) @@ -219,4 +219,4 @@ ) ) ) -;; METADATA: { "asmConsts": {"0": ["{ Module.print(\"hello, world! \" + HEAP32[8>>2]); }", ["vi"]]} } +;; METADATA: { "asmConsts": {"0": ["{ Module.print(\"hello, world! \" + HEAP32[8>>2]); }", ["vi"]]},"staticBump": 66 } diff --git a/test/dot_s/memory-addr32.wast b/test/dot_s/memory-addr32.wast index bd182046b..c056c10d9 100644 --- a/test/dot_s/memory-addr32.wast +++ b/test/dot_s/memory-addr32.wast @@ -20,4 +20,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/memory-addr64.wast b/test/dot_s/memory-addr64.wast index 03a27c8ed..49c56ea9b 100644 --- a/test/dot_s/memory-addr64.wast +++ b/test/dot_s/memory-addr64.wast @@ -20,4 +20,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/minimal.wast b/test/dot_s/minimal.wast index ef408ea14..67e714d3f 100644 --- a/test/dot_s/minimal.wast +++ b/test/dot_s/minimal.wast @@ -11,4 +11,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/offset.wast b/test/dot_s/offset.wast index d8a1a4a7a..432216519 100644 --- a/test/dot_s/offset.wast +++ b/test/dot_s/offset.wast @@ -1,5 +1,5 @@ (module - (memory 0 4294967295 (segment 2 "\00\00\00\00")) + (memory 0 4294967295 (segment 4 "\00\00\00\00")) (export "load_i32_with_folded_offset" $load_i32_with_folded_offset) (export "load_i32_with_unfolded_offset" $load_i32_with_unfolded_offset) (export "load_i64_with_folded_offset" $load_i64_with_folded_offset) @@ -130,7 +130,7 @@ (block $fake_return_waka123 (block (br $fake_return_waka123 - (i32.load align=4 offset=2 + (i32.load align=4 offset=4 (i32.const 0) ) ) @@ -159,7 +159,7 @@ (set_local $$0 (i32.const 0) ) - (i32.store align=4 offset=2 + (i32.store align=4 offset=4 (get_local $$0) (get_local $$0) ) @@ -171,7 +171,7 @@ (block $fake_return_waka123 (block (br $fake_return_waka123 - (i32.load align=8 offset=24 + (i32.load8_s align=1 offset=24 (get_local $$0) ) ) @@ -182,7 +182,7 @@ (block $fake_return_waka123 (block (br $fake_return_waka123 - (i32.load align=8 offset=24 + (i32.load8_u align=1 offset=24 (get_local $$0) ) ) @@ -201,4 +201,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 7 } diff --git a/test/dot_s/permute.wast b/test/dot_s/permute.wast index e535422c9..2af67ec99 100644 --- a/test/dot_s/permute.wast +++ b/test/dot_s/permute.wast @@ -1,4 +1,4 @@ (module - (memory 0 4294967295 (segment 4 "hE?\8ds\0e7\db[g\8f\955it\c4k\0b\e2\ef\bcld\e0\fd\8c\9e\86&~\d8\94\89+\c8\a4\c2\f2\fb\12\1cej\d99\b7\b3W\c6w\af\ae\caM>\92ub\96\84\b6\b0N\ec;q\11\f7\bf\e31\e6\a7\90\fc\03\e4\aa\d7\cc- \15\83DH\80r\fa\01X\eb:_\00A\cd\e9o`n\ac(\ad\ba0\dcyS#\f4$\"\82\7f}\8e\f6\93L\'\bb\bdZ\ed4\18\f3\c0\cf\ff\a3\f8\07\05\9c\d3\0f\a0\06m%\\\f9^B<\e7\b1\17\98]\0c\dd\c5\f5p\e5\fezJ\ab,F\a5@\08R\85!\b8\1a\ce\d5\04\nI\a6\d1\9f\8a\c9\a9|\97\9aG\be8Y\8b\c1\1b\d4\ea\b9\19\14\9b\9163\d0\1d\d2\df=C\1f\0dc\e1\c7QUv\02\b5aK\b4\tV\c3x\e8\a1\1e\81\de/{\da\d6Pf\10T\f0)\88\16\ee\a8\9d\f1\cbO*\b2\99\132\87.\a2")) + (memory 0 4294967295 (segment 16 "hE?\8ds\0e7\db[g\8f\955it\c4k\0b\e2\ef\bcld\e0\fd\8c\9e\86&~\d8\94\89+\c8\a4\c2\f2\fb\12\1cej\d99\b7\b3W\c6w\af\ae\caM>\92ub\96\84\b6\b0N\ec;q\11\f7\bf\e31\e6\a7\90\fc\03\e4\aa\d7\cc- \15\83DH\80r\fa\01X\eb:_\00A\cd\e9o`n\ac(\ad\ba0\dcyS#\f4$\"\82\7f}\8e\f6\93L\'\bb\bdZ\ed4\18\f3\c0\cf\ff\a3\f8\07\05\9c\d3\0f\a0\06m%\\\f9^B<\e7\b1\17\98]\0c\dd\c5\f5p\e5\fezJ\ab,F\a5@\08R\85!\b8\1a\ce\d5\04\nI\a6\d1\9f\8a\c9\a9|\97\9aG\be8Y\8b\c1\1b\d4\ea\b9\19\14\9b\9163\d0\1d\d2\df=C\1f\0dc\e1\c7QUv\02\b5aK\b4\tV\c3x\e8\a1\1e\81\de/{\da\d6Pf\10T\f0)\88\16\ee\a8\9d\f1\cbO*\b2\99\132\87.\a2")) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 271 } diff --git a/test/dot_s/phi.wast b/test/dot_s/phi.wast index e5690e69d..9d61cfa77 100644 --- a/test/dot_s/phi.wast +++ b/test/dot_s/phi.wast @@ -79,4 +79,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/reg-stackify.wast b/test/dot_s/reg-stackify.wast index 8306dfc8f..434e704b2 100644 --- a/test/dot_s/reg-stackify.wast +++ b/test/dot_s/reg-stackify.wast @@ -118,4 +118,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/relocation.wast b/test/dot_s/relocation.wast index 2bddedb89..3f667f823 100644 --- a/test/dot_s/relocation.wast +++ b/test/dot_s/relocation.wast @@ -1,5 +1,5 @@ (module - (memory 0 4294967295 (segment 2 "\06\00\00\00") (segment 6 "\02\00\00\00")) + (memory 0 4294967295 (segment 4 "\08\00\00\00") (segment 8 "\04\00\00\00")) (export "main" $main) (func $main (result i32) (local $$0 i32) @@ -7,11 +7,11 @@ (block (br $fake_return_waka123 (i32.load align=4 - (i32.const 0) + (i32.const 8) ) ) ) ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 11 } diff --git a/test/dot_s/return-int32.wast b/test/dot_s/return-int32.wast index e9e4e8250..57bf9538b 100644 --- a/test/dot_s/return-int32.wast +++ b/test/dot_s/return-int32.wast @@ -11,4 +11,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/return-void.wast b/test/dot_s/return-void.wast index 0f0c72a49..8cfa247b0 100644 --- a/test/dot_s/return-void.wast +++ b/test/dot_s/return-void.wast @@ -9,4 +9,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/returned.wast b/test/dot_s/returned.wast index 0d73621e3..e63c40964 100644 --- a/test/dot_s/returned.wast +++ b/test/dot_s/returned.wast @@ -32,4 +32,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/select.wast b/test/dot_s/select.wast index 4877c7057..bb5a4e575 100644 --- a/test/dot_s/select.wast +++ b/test/dot_s/select.wast @@ -169,4 +169,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/signext-zeroext.wast b/test/dot_s/signext-zeroext.wast index f4c6ba47f..480223851 100644 --- a/test/dot_s/signext-zeroext.wast +++ b/test/dot_s/signext-zeroext.wast @@ -77,4 +77,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/store-results.wast b/test/dot_s/store-results.wast index 5f801cd3b..7001cd0e7 100644 --- a/test/dot_s/store-results.wast +++ b/test/dot_s/store-results.wast @@ -34,7 +34,7 @@ (i32.const 1) ) ) - (i32.store align=4 offset=2 + (i32.store align=4 offset=4 (get_local $$0) (get_local $$0) ) @@ -70,7 +70,7 @@ (f32.const 1) ) ) - (i32.store align=4 offset=2 + (i32.store align=4 offset=4 (get_local $$0) (get_local $$0) ) @@ -88,4 +88,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 15 } diff --git a/test/dot_s/store-trunc.wast b/test/dot_s/store-trunc.wast index 07807cd19..44b400534 100644 --- a/test/dot_s/store-trunc.wast +++ b/test/dot_s/store-trunc.wast @@ -61,4 +61,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/store.wast b/test/dot_s/store.wast index 256b86fd1..d3a89a131 100644 --- a/test/dot_s/store.wast +++ b/test/dot_s/store.wast @@ -49,4 +49,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/switch.wast b/test/dot_s/switch.wast index ba55e42f3..7be3d417e 100644 --- a/test/dot_s/switch.wast +++ b/test/dot_s/switch.wast @@ -97,4 +97,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/symbolic-offset.wast b/test/dot_s/symbolic-offset.wast index 5b4904529..4dc52e77f 100644 --- a/test/dot_s/symbolic-offset.wast +++ b/test/dot_s/symbolic-offset.wast @@ -1,10 +1,10 @@ (module - (memory 0 4294967295 (segment 2 "\01\00\00\00\00\00\00\00\00\00\00\00")) + (memory 0 4294967295 (segment 4 "\01\00\00\00\00\00\00\00\00\00\00\00")) (export "f" $f) (func $f (param $$0 i32) (param $$1 i32) (block $fake_return_waka123 (block - (i32.store align=4 offset=6 + (i32.store align=4 offset=8 (get_local $$0) (get_local $$1) ) @@ -13,4 +13,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 15 } diff --git a/test/dot_s/unreachable.wast b/test/dot_s/unreachable.wast index ec31d0395..d760ef119 100644 --- a/test/dot_s/unreachable.wast +++ b/test/dot_s/unreachable.wast @@ -27,4 +27,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/unused-argument.wast b/test/dot_s/unused-argument.wast index 3d18cee7d..29ebad529 100644 --- a/test/dot_s/unused-argument.wast +++ b/test/dot_s/unused-argument.wast @@ -31,4 +31,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/varargs.wast b/test/dot_s/varargs.wast index f502d0d91..7f5e0cb7e 100644 --- a/test/dot_s/varargs.wast +++ b/test/dot_s/varargs.wast @@ -157,4 +157,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 0 } diff --git a/test/dot_s/vtable.wast b/test/dot_s/vtable.wast index 0ad2840c6..bf4a08a54 100644 --- a/test/dot_s/vtable.wast +++ b/test/dot_s/vtable.wast @@ -1,5 +1,5 @@ (module - (memory 0 4294967295 (segment 16 "1A\00") (segment 32 "1B\00") (segment 48 "1C\00") (segment 64 "1D\00") (segment 68 "\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") (segment 88 "\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") (segment 108 "\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") (segment 128 "\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") (segment 150 "\00\00\00\00\10\00\00\00") (segment 159 "\00\00\00\00\00\00\00\00\96\00\00\00") (segment 171 "\00\00\00\00\00\00\00\00\96\00\00\00") (segment 183 "\00\00\00\00\00\00\00\00\9f\00\00\00") (segment 196 "\00\00\00\00")) + (memory 0 4294967295 (segment 16 "1A\00") (segment 32 "1B\00") (segment 48 "1C\00") (segment 64 "1D\00") (segment 68 "\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") (segment 88 "\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") (segment 108 "\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") (segment 128 "\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") (segment 152 "\00\00\00\00\10\00\00\00") (segment 160 "\00\00\00\00\00\00\00\00\98\00\00\00") (segment 176 "\00\00\00\00\00\00\00\00\98\00\00\00") (segment 192 "\00\00\00\00\00\00\00\00\a0\00\00\00") (segment 204 "\00\00\00\00")) (import $_ZdlPv "env" "_ZdlPv") (export "_ZN1A3fooEv" $_ZN1A3fooEv) (export "_ZN1B3fooEv" $_ZN1B3fooEv) @@ -13,7 +13,7 @@ (func $_ZN1A3fooEv (param $$0 i32) (block $fake_return_waka123 (block - (i32.store align=4 offset=196 + (i32.store align=4 offset=204 (i32.const 0) (i32.const 2) ) @@ -24,7 +24,7 @@ (func $_ZN1B3fooEv (param $$0 i32) (block $fake_return_waka123 (block - (i32.store align=4 offset=196 + (i32.store align=4 offset=204 (i32.const 0) (i32.const 4) ) @@ -35,7 +35,7 @@ (func $_ZN1C3fooEv (param $$0 i32) (block $fake_return_waka123 (block - (i32.store align=4 offset=196 + (i32.store align=4 offset=204 (i32.const 0) (i32.const 6) ) @@ -46,7 +46,7 @@ (func $_ZN1D3fooEv (param $$0 i32) (block $fake_return_waka123 (block - (i32.store align=4 offset=196 + (i32.store align=4 offset=204 (i32.const 0) (i32.const 8) ) @@ -104,4 +104,4 @@ ) ) ) -;; METADATA: { "asmConsts": {} } +;; METADATA: { "asmConsts": {},"staticBump": 207 } diff --git a/test/unit.2asm.js b/test/unit.2asm.js index 72eb53461..953437f63 100644 --- a/test/unit.2asm.js +++ b/test/unit.2asm.js @@ -12,6 +12,7 @@ function asmFunc(global, env, buffer) { var Math_fround = global.Math.fround; var Math_abs = global.Math.abs; var Math_clz32 = global.Math.clz32; + var _emscripten_asm_const_vi = env._emscripten_asm_const_vi; var f64_to_int = env.f64_to_int; var f64_rem = env.f64_rem; function big_negative() { diff --git a/test/unit.wast b/test/unit.wast index 488e1de99..4311a2a33 100644 --- a/test/unit.wast +++ b/test/unit.wast @@ -1,6 +1,7 @@ (module - (memory 16777216 16777216) + (memory 4096 4096 (segment 1026 "\14\00")) (type $FUNCSIG$vf (func (param f32))) + (import $_emscripten_asm_const_vi "env" "_emscripten_asm_const_vi") (import $f64-to-int "asm2wasm" "f64-to-int" (param f64) (result i32)) (import $f64-rem "asm2wasm" "f64-rem" (param f64 f64) (result f64)) (export "big_negative" $big_negative) diff --git a/test/wasm_backend/globals.cpp b/test/wasm_backend/globals.cpp new file mode 100644 index 000000000..9a2f1bcc8 --- /dev/null +++ b/test/wasm_backend/globals.cpp @@ -0,0 +1,21 @@ +#include <emscripten.h> + +char c = 10; +short s = 20; +int i = 55; + +void print(int v) { + int *x = (int*)8; + *x = v; + EM_ASM({ + Module.print("print: " + HEAP32[8>>2]); + }); +} + +int main() { + print(1); + print(c); + print(s); + print(i); +} + diff --git a/test/wasm_backend/globals.txt b/test/wasm_backend/globals.txt new file mode 100644 index 000000000..56248691d --- /dev/null +++ b/test/wasm_backend/globals.txt @@ -0,0 +1,5 @@ +print: 1 +print: 10 +print: 20 +print: 55 + |