From 74db07537ddc3c4100f2db3967c10ee726fbe670 Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Wed, 7 Sep 2016 23:30:46 +0300 Subject: [PATCH] Fix bugs with memory operations --- .../java/org/teavm/backend/wasm/WasmRuntime.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/org/teavm/backend/wasm/WasmRuntime.java b/core/src/main/java/org/teavm/backend/wasm/WasmRuntime.java index 69e20f493..5ac7ae698 100644 --- a/core/src/main/java/org/teavm/backend/wasm/WasmRuntime.java +++ b/core/src/main/java/org/teavm/backend/wasm/WasmRuntime.java @@ -84,14 +84,14 @@ public final class WasmRuntime { address.putInt(0); break; case 1: - address.add(3).putByte((byte) 0); + address.add(1).putByte((byte) 0); + address.add(2).putShort((short) 0); break; case 2: address.add(2).putShort((short) 0); break; case 3: - address.add(1).putByte((byte) 0); - address.add(2).putShort((short) 0); + address.add(3).putByte((byte) 0); break; } @@ -204,14 +204,14 @@ public final class WasmRuntime { alignedTargetStart.putInt(alignedSourceStart.getInt()); break; case 1: - alignedTargetStart.add(3).putByte(alignedSourceStart.add(3).getByte()); + alignedTargetStart.add(2).putShort(alignedSourceStart.add(2).getShort()); + alignedTargetStart.add(1).putByte(alignedSourceStart.add(1).getByte()); break; case 2: alignedTargetStart.add(2).putShort(alignedSourceStart.add(2).getShort()); break; case 3: - alignedTargetStart.add(2).putShort(alignedSourceStart.add(2).getShort()); - alignedTargetStart.add(1).putByte(alignedSourceStart.add(1).getByte()); + alignedTargetStart.add(3).putByte(alignedSourceStart.add(3).getByte()); break; } }