Fix bug in fillZero function

This commit is contained in:
Alexey Andreev 2016-08-25 19:29:48 +03:00
parent 375506e875
commit c5c453d95b
2 changed files with 4 additions and 6 deletions

View File

@ -203,14 +203,14 @@ public final class WasmRuntime {
address.putInt(0); address.putInt(0);
break; break;
case 1: case 1:
address.add(1).putByte((byte) 0); address.add(3).putByte((byte) 0);
address.add(2).putShort((short) 0);
break; break;
case 2: case 2:
address.add(2).putShort((short) 0); address.add(2).putShort((short) 0);
break; break;
case 3: case 3:
address.add(3).putByte((byte) 0); address.add(1).putByte((byte) 0);
address.add(2).putShort((short) 0);
break; break;
} }
@ -232,7 +232,7 @@ public final class WasmRuntime {
break; 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); address.putInt(0);
} }
} }

View File

@ -129,7 +129,6 @@ class WasmGenerationVisitor implements StatementVisitor, ExprVisitor {
private Map<IdentifiedStatement, WasmBlock> continueTargets = new HashMap<>(); private Map<IdentifiedStatement, WasmBlock> continueTargets = new HashMap<>();
private Set<WasmBlock> usedBlocks = new HashSet<>(); private Set<WasmBlock> usedBlocks = new HashSet<>();
private List<Deque<WasmLocal>> temporaryVariablesByType = new ArrayList<>(); private List<Deque<WasmLocal>> temporaryVariablesByType = new ArrayList<>();
private List<WasmLocal> currentTemporaries = new ArrayList<>();
WasmExpression result; WasmExpression result;
WasmGenerationVisitor(WasmGenerationContext context, WasmClassGenerator classGenerator, WasmGenerationVisitor(WasmGenerationContext context, WasmClassGenerator classGenerator,
@ -1275,7 +1274,6 @@ class WasmGenerationVisitor implements StatementVisitor, ExprVisitor {
variable = new WasmLocal(type); variable = new WasmLocal(type);
function.add(variable); function.add(variable);
} }
currentTemporaries.add(variable);
return variable; return variable;
} }