summaryrefslogtreecommitdiff
path: root/src/wasm-js.cpp
diff options
context:
space:
mode:
authorjgravelle-google <jgravelle@google.com>2016-10-19 16:49:36 -0700
committerAlon Zakai <alonzakai@gmail.com>2016-10-19 16:49:36 -0700
commit00354666afcc5c9fa489c446e23febe7efbcd311 (patch)
tree536247b027b8383c669ca8fb60deb7709072d664 /src/wasm-js.cpp
parentf08f75cf2fe1b6b8275f7f7fd4356919616ba95c (diff)
downloadbinaryen-00354666afcc5c9fa489c446e23febe7efbcd311.tar.gz
binaryen-00354666afcc5c9fa489c446e23febe7efbcd311.tar.bz2
binaryen-00354666afcc5c9fa489c446e23febe7efbcd311.zip
Add support for i64.store[N] (#789)
* Add support for i64.store[N] Previously storing i64 in the interpreter assumed an 8byte store. Stores like i64.store8 would then use the special-case i64 storing code, when they could just use the i32.store8 code. * Add printf test for interpreter * Update wasm.js
Diffstat (limited to 'src/wasm-js.cpp')
-rw-r--r--src/wasm-js.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/wasm-js.cpp b/src/wasm-js.cpp
index 635c83d73..c99e35b76 100644
--- a/src/wasm-js.cpp
+++ b/src/wasm-js.cpp
@@ -417,7 +417,7 @@ extern "C" void EMSCRIPTEN_KEEPALIVE instantiate() {
void store(Store* store_, Address address, Literal value) override {
uint32_t addr = address;
// support int64 stores
- if (value.type == WasmType::i64) {
+ if (value.type == WasmType::i64 && store_->bytes == 8) {
Store fake = *store_;
fake.bytes = 4;
fake.type = i32;
@@ -456,11 +456,11 @@ extern "C" void EMSCRIPTEN_KEEPALIVE instantiate() {
// nicely aligned
if (!isWasmTypeFloat(store_->valueType)) {
if (store_->bytes == 1) {
- EM_ASM_INT({ Module['info'].parent['HEAP8'][$0] = $1 }, addr, value.geti32());
+ EM_ASM_INT({ Module['info'].parent['HEAP8'][$0] = $1 }, addr, (uint32_t)value.getInteger());
} else if (store_->bytes == 2) {
- EM_ASM_INT({ Module['info'].parent['HEAP16'][$0 >> 1] = $1 }, addr, value.geti32());
+ EM_ASM_INT({ Module['info'].parent['HEAP16'][$0 >> 1] = $1 }, addr, (uint32_t)value.getInteger());
} else if (store_->bytes == 4) {
- EM_ASM_INT({ Module['info'].parent['HEAP32'][$0 >> 2] = $1 }, addr, value.geti32());
+ EM_ASM_INT({ Module['info'].parent['HEAP32'][$0 >> 2] = $1 }, addr, (uint32_t)value.getInteger());
} else {
abort();
}