From c5c453d95b53997a71d890aea61b703664ec41f3 Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Thu, 25 Aug 2016 19:29:48 +0300 Subject: [PATCH] Fix bug in fillZero function --- .../src/main/java/org/teavm/backend/wasm/WasmRuntime.java | 8 ++++---- .../backend/wasm/generate/WasmGenerationVisitor.java | 2 -- 2 files changed, 4 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 6b4252926..8c90cf5ef 100644 --- a/core/src/main/java/org/teavm/backend/wasm/WasmRuntime.java +++ b/core/src/main/java/org/teavm/backend/wasm/WasmRuntime.java @@ -203,14 +203,14 @@ public final class WasmRuntime { address.putInt(0); break; case 1: - address.add(1).putByte((byte) 0); - address.add(2).putShort((short) 0); + address.add(3).putByte((byte) 0); break; case 2: address.add(2).putShort((short) 0); break; case 3: - address.add(3).putByte((byte) 0); + address.add(1).putByte((byte) 0); + address.add(2).putShort((short) 0); break; } @@ -232,7 +232,7 @@ public final class WasmRuntime { break; } - for (address = Address.fromInt(alignedStart); address.toInt() < alignedEnd; address = address.add(4)) { + for (address = Address.fromInt(alignedStart + 1); address.toInt() < alignedEnd; address = address.add(4)) { address.putInt(0); } } diff --git a/core/src/main/java/org/teavm/backend/wasm/generate/WasmGenerationVisitor.java b/core/src/main/java/org/teavm/backend/wasm/generate/WasmGenerationVisitor.java index 61195ee52..0caf3b8f8 100644 --- a/core/src/main/java/org/teavm/backend/wasm/generate/WasmGenerationVisitor.java +++ b/core/src/main/java/org/teavm/backend/wasm/generate/WasmGenerationVisitor.java @@ -129,7 +129,6 @@ class WasmGenerationVisitor implements StatementVisitor, ExprVisitor { private Map continueTargets = new HashMap<>(); private Set usedBlocks = new HashSet<>(); private List> temporaryVariablesByType = new ArrayList<>(); - private List currentTemporaries = new ArrayList<>(); WasmExpression result; WasmGenerationVisitor(WasmGenerationContext context, WasmClassGenerator classGenerator, @@ -1275,7 +1274,6 @@ class WasmGenerationVisitor implements StatementVisitor, ExprVisitor { variable = new WasmLocal(type); function.add(variable); } - currentTemporaries.add(variable); return variable; }