diff options
author | Alon Zakai <alonzakai@gmail.com> | 2015-12-23 14:40:44 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2015-12-23 14:40:44 -0800 |
commit | b6214708e08fe8cc894bfd4ace866beb6bb3606f (patch) | |
tree | dc1ab2cc9de08d589a748d3c081f83826e372d08 /src | |
parent | 6f573309b3ee704eff76068297511934ca13009f (diff) | |
download | binaryen-b6214708e08fe8cc894bfd4ace866beb6bb3606f.tar.gz binaryen-b6214708e08fe8cc894bfd4ace866beb6bb3606f.tar.bz2 binaryen-b6214708e08fe8cc894bfd4ace866beb6bb3606f.zip |
handle combined globals better in s2wasm
Diffstat (limited to 'src')
-rw-r--r-- | src/s2wasm.h | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/s2wasm.h b/src/s2wasm.h index 5f2a0d75d..57d5768b8 100644 --- a/src/s2wasm.h +++ b/src/s2wasm.h @@ -889,12 +889,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(); @@ -934,7 +939,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 |