diff options
author | Alon Zakai <alonzakai@gmail.com> | 2015-12-14 19:31:37 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2015-12-14 19:31:44 -0800 |
commit | 2ce78b61261357ce1c9391e318ed87e992a02587 (patch) | |
tree | 08b061093da13e50d2c8c170d5e529d53145b3a6 /src | |
parent | bd3a35d28606220000b160cbd4494242542d0502 (diff) | |
download | binaryen-2ce78b61261357ce1c9391e318ed87e992a02587.tar.gz binaryen-2ce78b61261357ce1c9391e318ed87e992a02587.tar.bz2 binaryen-2ce78b61261357ce1c9391e318ed87e992a02587.zip |
fix asm const arg
Diffstat (limited to 'src')
-rw-r--r-- | src/s2wasm.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/s2wasm.h b/src/s2wasm.h index f7597b460..20cdce0c4 100644 --- a/src/s2wasm.h +++ b/src/s2wasm.h @@ -882,15 +882,19 @@ public: auto arg = curr->operands[0]->cast<Const>(); size_t segmentIndex = parent->addressSegments[arg->value.geti32()]; std::string code = escape(parent->wasm.memory.segments[segmentIndex].data); + int32_t id; if (ids.count(code) == 0) { - size_t id = ids.size(); + id = ids.size(); ids[code] = id; + } else { + id = ids[code]; } std::string sig = getSig(curr); sigsForCode[code].insert(sig); std::string fixedTarget = EMSCRIPTEN_ASM_CONST.str; fixedTarget += '_' + sig; curr->target = cashew::IString(fixedTarget.c_str(), false); + arg->value = Literal(id); } } |