Browse Source

merge updates to last_op_size and flags_changed

Fabian 1 year ago
parent
commit
58f9902057

+ 3 - 3
src/cpu.js

@@ -85,13 +85,13 @@ function CPU(bus, wm, next_tick_immediately)
      * bitmap of flags which are not updated in the flags variable
      * changed by arithmetic instructions, so only relevant to arithmetic flags
      */
-    this.flags_changed = v86util.view(Int32Array, memory, 116, 1);
+    this.flags_changed = v86util.view(Int32Array, memory, 100, 1);
 
     /**
      * enough infos about the last arithmetic operation to compute eflags
      */
-    this.last_op1 = v86util.view(Int32Array, memory, 96, 1);
-    this.last_op_size = v86util.view(Int32Array, memory, 104, 1);
+    this.last_op_size = v86util.view(Int32Array, memory, 96, 1);
+    this.last_op1 = v86util.view(Int32Array, memory, 104, 1);
     this.last_result = v86util.view(Int32Array, memory, 112, 1);
 
     this.current_tsc = v86util.view(Uint32Array, memory, 960, 2); // 64 bit

+ 13 - 11
src/rust/codegen.rs

@@ -1518,17 +1518,6 @@ pub fn gen_set_last_result(builder: &mut WasmBuilder, source: &WasmLocal) {
     builder.store_aligned_i32(0);
 }
 
-pub fn gen_set_last_op_size(builder: &mut WasmBuilder, value: i32) {
-    builder.const_i32(global_pointers::last_op_size as i32);
-    builder.const_i32(value);
-    builder.store_aligned_i32(0);
-}
-
-pub fn gen_set_flags_changed(builder: &mut WasmBuilder, value: i32) {
-    builder.const_i32(global_pointers::flags_changed as i32);
-    builder.const_i32(value);
-    builder.store_aligned_i32(0);
-}
 pub fn gen_clear_flags_changed_bits(builder: &mut WasmBuilder, bits_to_clear: i32) {
     builder.const_i32(global_pointers::flags_changed as i32);
     gen_get_flags_changed(builder);
@@ -1537,6 +1526,19 @@ pub fn gen_clear_flags_changed_bits(builder: &mut WasmBuilder, bits_to_clear: i3
     builder.store_aligned_i32(0);
 }
 
+pub fn gen_set_last_op_size_and_flags_changed(
+    builder: &mut WasmBuilder,
+    last_op_size: i32,
+    flags_changed: i32,
+) {
+    dbg_assert!(last_op_size == OPSIZE_8 || last_op_size == OPSIZE_16 || last_op_size == OPSIZE_32);
+    dbg_assert!(global_pointers::last_op_size as i32 % 8 == 0);
+    dbg_assert!(global_pointers::last_op_size as i32 + 4 == global_pointers::flags_changed as i32);
+    builder.const_i32(global_pointers::last_op_size as i32);
+    builder.const_i64(last_op_size as u32 as i64 | (flags_changed as u32 as i64) << 32);
+    builder.store_aligned_i64(0);
+}
+
 pub fn gen_set_flags_bits(builder: &mut WasmBuilder, bits_to_set: i32) {
     builder.const_i32(global_pointers::flags as i32);
     gen_get_flags(builder);

+ 3 - 5
src/rust/cpu/global_pointers.rs

@@ -8,13 +8,11 @@ pub const reg8: *mut u8 = 64 as *mut u8;
 pub const reg16: *mut u16 = 64 as *mut u16;
 pub const reg32: *mut i32 = 64 as *mut i32;
 
-pub const last_op1: *mut i32 = 96 as *mut i32;
-
-pub const last_op_size: *mut i32 = 104 as *mut i32;
+pub const last_op_size: *mut i32 = 96 as *mut i32;
+pub const flags_changed: *mut i32 = 100 as *mut i32;
+pub const last_op1: *mut i32 = 104 as *mut i32;
 pub const state_flags: *mut CachedStateFlags = 108 as *mut CachedStateFlags;
-
 pub const last_result: *mut i32 = 112 as *mut i32;
-pub const flags_changed: *mut i32 = 116 as *mut i32;
 pub const flags: *mut i32 = 120 as *mut i32;
 
 pub const page_fault: *mut bool = 540 as *mut bool;

+ 57 - 48
src/rust/jit_instructions.rs

@@ -968,8 +968,7 @@ fn gen_add8(ctx: &mut JitContext, dest_operand: &WasmLocal, source_operand: &Loc
     ctx.builder.and_i32();
     ctx.builder.store_aligned_i32(0);
 
-    codegen::gen_set_last_op_size(ctx.builder, OPSIZE_8);
-    codegen::gen_set_flags_changed(ctx.builder, FLAGS_ALL);
+    codegen::gen_set_last_op_size_and_flags_changed(ctx.builder, OPSIZE_8, FLAGS_ALL);
 
     ctx.builder
         .load_fixed_u8(global_pointers::last_result as u32);
@@ -985,8 +984,7 @@ fn gen_add32(ctx: &mut JitContext, dest_operand: &WasmLocal, source_operand: &Lo
     ctx.builder.set_local(dest_operand);
 
     codegen::gen_set_last_result(ctx.builder, &dest_operand);
-    codegen::gen_set_last_op_size(ctx.builder, OPSIZE_32);
-    codegen::gen_set_flags_changed(ctx.builder, FLAGS_ALL);
+    codegen::gen_set_last_op_size_and_flags_changed(ctx.builder, OPSIZE_32, FLAGS_ALL);
 }
 
 fn gen_sub8(ctx: &mut JitContext, dest_operand: &WasmLocal, source_operand: &LocalOrImmediate) {
@@ -1006,8 +1004,7 @@ fn gen_sub8(ctx: &mut JitContext, dest_operand: &WasmLocal, source_operand: &Loc
     ctx.builder.and_i32();
     ctx.builder.store_aligned_i32(0);
 
-    codegen::gen_set_last_op_size(ctx.builder, OPSIZE_8);
-    codegen::gen_set_flags_changed(ctx.builder, FLAGS_ALL | FLAG_SUB);
+    codegen::gen_set_last_op_size_and_flags_changed(ctx.builder, OPSIZE_8, FLAGS_ALL | FLAG_SUB);
 
     ctx.builder
         .load_fixed_u8(global_pointers::last_result as u32);
@@ -1023,8 +1020,7 @@ fn gen_sub32(ctx: &mut JitContext, dest_operand: &WasmLocal, source_operand: &Lo
     ctx.builder.set_local(dest_operand);
 
     codegen::gen_set_last_result(ctx.builder, &dest_operand);
-    codegen::gen_set_last_op_size(ctx.builder, OPSIZE_32);
-    codegen::gen_set_flags_changed(ctx.builder, FLAGS_ALL | FLAG_SUB);
+    codegen::gen_set_last_op_size_and_flags_changed(ctx.builder, OPSIZE_32, FLAGS_ALL | FLAG_SUB);
 }
 
 fn gen_cmp(
@@ -1063,8 +1059,7 @@ fn gen_cmp(
         ctx.builder.and_i32();
     }
     ctx.builder.store_aligned_i32(0);
-    codegen::gen_set_last_op_size(ctx.builder, size);
-    codegen::gen_set_flags_changed(ctx.builder, FLAGS_ALL | FLAG_SUB);
+    codegen::gen_set_last_op_size_and_flags_changed(ctx.builder, size, FLAGS_ALL | FLAG_SUB);
 }
 fn gen_cmp8(ctx: &mut JitContext, dest: &WasmLocal, source: &LocalOrImmediate) {
     gen_cmp(ctx, dest, source, OPSIZE_8)
@@ -1094,9 +1089,9 @@ fn gen_adc32(ctx: &mut JitContext, dest_operand: &WasmLocal, source_operand: &Lo
     let res = ctx.builder.set_new_local();
 
     codegen::gen_set_last_result(ctx.builder, &res);
-    codegen::gen_set_last_op_size(ctx.builder, OPSIZE_32);
-    codegen::gen_set_flags_changed(
+    codegen::gen_set_last_op_size_and_flags_changed(
         ctx.builder,
+        OPSIZE_32,
         FLAGS_ALL & !FLAG_CARRY & !FLAG_OVERFLOW & !FLAG_ADJUST,
     );
 
@@ -1171,9 +1166,9 @@ fn gen_sbb32(ctx: &mut JitContext, dest_operand: &WasmLocal, source_operand: &Lo
     let res = ctx.builder.set_new_local();
 
     codegen::gen_set_last_result(ctx.builder, &res);
-    codegen::gen_set_last_op_size(ctx.builder, OPSIZE_32);
-    codegen::gen_set_flags_changed(
+    codegen::gen_set_last_op_size_and_flags_changed(
         ctx.builder,
+        OPSIZE_32,
         FLAGS_ALL & !FLAG_CARRY & !FLAG_OVERFLOW & !FLAG_ADJUST,
     );
 
@@ -1239,9 +1234,9 @@ fn gen_and8(ctx: &mut JitContext, dest_operand: &WasmLocal, source_operand: &Loc
     ctx.builder.and_i32();
     ctx.builder.store_aligned_i32(0);
 
-    codegen::gen_set_last_op_size(ctx.builder, OPSIZE_8);
-    codegen::gen_set_flags_changed(
+    codegen::gen_set_last_op_size_and_flags_changed(
         ctx.builder,
+        OPSIZE_8,
         FLAGS_ALL & !FLAG_CARRY & !FLAG_OVERFLOW & !FLAG_ADJUST,
     );
     codegen::gen_clear_flags_bits(ctx.builder, FLAG_CARRY | FLAG_OVERFLOW | FLAG_ADJUST);
@@ -1258,9 +1253,9 @@ fn gen_and32(ctx: &mut JitContext, dest_operand: &WasmLocal, source_operand: &Lo
     ctx.builder.set_local(dest_operand);
 
     codegen::gen_set_last_result(ctx.builder, &dest_operand);
-    codegen::gen_set_last_op_size(ctx.builder, OPSIZE_32);
-    codegen::gen_set_flags_changed(
+    codegen::gen_set_last_op_size_and_flags_changed(
         ctx.builder,
+        OPSIZE_32,
         FLAGS_ALL & !FLAG_CARRY & !FLAG_OVERFLOW & !FLAG_ADJUST,
     );
     codegen::gen_clear_flags_bits(ctx.builder, FLAG_CARRY | FLAG_OVERFLOW | FLAG_ADJUST);
@@ -1285,9 +1280,9 @@ fn gen_test(
     }
     ctx.builder.store_aligned_i32(0);
 
-    codegen::gen_set_last_op_size(ctx.builder, size);
-    codegen::gen_set_flags_changed(
+    codegen::gen_set_last_op_size_and_flags_changed(
         ctx.builder,
+        size,
         FLAGS_ALL & !FLAG_CARRY & !FLAG_OVERFLOW & !FLAG_ADJUST,
     );
     codegen::gen_clear_flags_bits(ctx.builder, FLAG_CARRY | FLAG_OVERFLOW | FLAG_ADJUST);
@@ -1311,9 +1306,9 @@ fn gen_or8(ctx: &mut JitContext, dest_operand: &WasmLocal, source_operand: &Loca
     ctx.builder.or_i32();
     ctx.builder.store_aligned_i32(0);
 
-    codegen::gen_set_last_op_size(ctx.builder, OPSIZE_8);
-    codegen::gen_set_flags_changed(
+    codegen::gen_set_last_op_size_and_flags_changed(
         ctx.builder,
+        OPSIZE_8,
         FLAGS_ALL & !FLAG_CARRY & !FLAG_OVERFLOW & !FLAG_ADJUST,
     );
     codegen::gen_clear_flags_bits(ctx.builder, FLAG_CARRY | FLAG_OVERFLOW | FLAG_ADJUST);
@@ -1330,9 +1325,9 @@ fn gen_or32(ctx: &mut JitContext, dest_operand: &WasmLocal, source_operand: &Loc
     ctx.builder.set_local(dest_operand);
 
     codegen::gen_set_last_result(ctx.builder, &dest_operand);
-    codegen::gen_set_last_op_size(ctx.builder, OPSIZE_32);
-    codegen::gen_set_flags_changed(
+    codegen::gen_set_last_op_size_and_flags_changed(
         ctx.builder,
+        OPSIZE_32,
         FLAGS_ALL & !FLAG_CARRY & !FLAG_OVERFLOW & !FLAG_ADJUST,
     );
     codegen::gen_clear_flags_bits(ctx.builder, FLAG_CARRY | FLAG_OVERFLOW | FLAG_ADJUST);
@@ -1347,9 +1342,9 @@ fn gen_xor8(ctx: &mut JitContext, dest_operand: &WasmLocal, source_operand: &Loc
     ctx.builder.xor_i32();
     ctx.builder.store_aligned_i32(0);
 
-    codegen::gen_set_last_op_size(ctx.builder, OPSIZE_8);
-    codegen::gen_set_flags_changed(
+    codegen::gen_set_last_op_size_and_flags_changed(
         ctx.builder,
+        OPSIZE_8,
         FLAGS_ALL & !FLAG_CARRY & !FLAG_OVERFLOW & !FLAG_ADJUST,
     );
     codegen::gen_clear_flags_bits(ctx.builder, FLAG_CARRY | FLAG_OVERFLOW | FLAG_ADJUST);
@@ -1375,9 +1370,9 @@ fn gen_xor32(ctx: &mut JitContext, dest_operand: &WasmLocal, source_operand: &Lo
     }
 
     codegen::gen_set_last_result(ctx.builder, &dest_operand);
-    codegen::gen_set_last_op_size(ctx.builder, OPSIZE_32);
-    codegen::gen_set_flags_changed(
+    codegen::gen_set_last_op_size_and_flags_changed(
         ctx.builder,
+        OPSIZE_32,
         FLAGS_ALL & !FLAG_CARRY & !FLAG_OVERFLOW & !FLAG_ADJUST,
     );
     codegen::gen_clear_flags_bits(ctx.builder, FLAG_CARRY | FLAG_OVERFLOW | FLAG_ADJUST);
@@ -1524,8 +1519,11 @@ fn gen_shl32(ctx: &mut JitContext, dest_operand: &WasmLocal, source_operand: &Lo
     builder.set_local(dest_operand);
 
     codegen::gen_set_last_result(builder, dest_operand);
-    codegen::gen_set_last_op_size(builder, OPSIZE_32);
-    codegen::gen_set_flags_changed(builder, FLAGS_ALL & !FLAG_CARRY & !FLAG_OVERFLOW);
+    codegen::gen_set_last_op_size_and_flags_changed(
+        builder,
+        OPSIZE_32,
+        FLAGS_ALL & !FLAG_CARRY & !FLAG_OVERFLOW,
+    );
 
     builder.const_i32(global_pointers::flags as i32);
     codegen::gen_get_flags(builder);
@@ -1603,8 +1601,11 @@ fn gen_shr32(ctx: &mut JitContext, dest_operand: &WasmLocal, source_operand: &Lo
     builder.set_local(dest_operand);
 
     codegen::gen_set_last_result(builder, dest_operand);
-    codegen::gen_set_last_op_size(builder, OPSIZE_32);
-    codegen::gen_set_flags_changed(builder, FLAGS_ALL & !FLAG_CARRY & !FLAG_OVERFLOW);
+    codegen::gen_set_last_op_size_and_flags_changed(
+        builder,
+        OPSIZE_32,
+        FLAGS_ALL & !FLAG_CARRY & !FLAG_OVERFLOW,
+    );
 
     if let ShiftCount::Local(l) = count {
         builder.block_end();
@@ -1652,8 +1653,11 @@ fn gen_sar32(ctx: &mut JitContext, dest_operand: &WasmLocal, source_operand: &Lo
     builder.set_local(dest_operand);
 
     codegen::gen_set_last_result(builder, dest_operand);
-    codegen::gen_set_last_op_size(builder, OPSIZE_32);
-    codegen::gen_set_flags_changed(builder, FLAGS_ALL & !FLAG_CARRY & !FLAG_OVERFLOW);
+    codegen::gen_set_last_op_size_and_flags_changed(
+        builder,
+        OPSIZE_32,
+        FLAGS_ALL & !FLAG_CARRY & !FLAG_OVERFLOW,
+    );
 
     if let ShiftCount::Local(l) = count {
         builder.block_end();
@@ -1685,8 +1689,7 @@ fn gen_cmpxchg32(ctx: &mut JitContext, r: u32) {
     ctx.builder.const_i32(global_pointers::last_op1 as i32);
     codegen::gen_get_reg32(ctx, regs::EAX);
     ctx.builder.store_aligned_i32(0);
-    codegen::gen_set_last_op_size(ctx.builder, OPSIZE_32);
-    codegen::gen_set_flags_changed(ctx.builder, FLAGS_ALL | FLAG_SUB);
+    codegen::gen_set_last_op_size_and_flags_changed(ctx.builder, OPSIZE_32, FLAGS_ALL | FLAG_SUB);
 
     codegen::gen_get_reg32(ctx, regs::EAX);
     ctx.builder.get_local(&source);
@@ -1728,8 +1731,11 @@ fn gen_mul32(ctx: &mut JitContext) {
     ctx.builder.block_end();
 
     codegen::gen_set_last_result(ctx.builder, &ctx.register_locals[regs::EAX as usize]);
-    codegen::gen_set_last_op_size(ctx.builder, OPSIZE_32);
-    codegen::gen_set_flags_changed(ctx.builder, FLAGS_ALL & !1 & !FLAG_OVERFLOW);
+    codegen::gen_set_last_op_size_and_flags_changed(
+        ctx.builder,
+        OPSIZE_32,
+        FLAGS_ALL & !1 & !FLAG_OVERFLOW,
+    );
 }
 
 fn gen_imul32(ctx: &mut JitContext) {
@@ -1762,8 +1768,11 @@ fn gen_imul32(ctx: &mut JitContext) {
     ctx.builder.block_end();
 
     codegen::gen_set_last_result(ctx.builder, &ctx.register_locals[regs::EAX as usize]);
-    codegen::gen_set_last_op_size(ctx.builder, OPSIZE_32);
-    codegen::gen_set_flags_changed(ctx.builder, FLAGS_ALL & !1 & !FLAG_OVERFLOW);
+    codegen::gen_set_last_op_size_and_flags_changed(
+        ctx.builder,
+        OPSIZE_32,
+        FLAGS_ALL & !1 & !FLAG_OVERFLOW,
+    );
 }
 
 fn gen_imul_reg32(
@@ -1791,8 +1800,11 @@ fn gen_imul3_reg32(
     builder.set_local(&dest_operand);
 
     codegen::gen_set_last_result(builder, &dest_operand);
-    codegen::gen_set_last_op_size(builder, OPSIZE_32);
-    codegen::gen_set_flags_changed(builder, FLAGS_ALL & !1 & !FLAG_OVERFLOW);
+    codegen::gen_set_last_op_size_and_flags_changed(
+        builder,
+        OPSIZE_32,
+        FLAGS_ALL & !1 & !FLAG_OVERFLOW,
+    );
 
     builder.const_i32(global_pointers::flags as i32);
     builder.get_local_i64(&result);
@@ -2252,8 +2264,7 @@ fn gen_inc(ctx: &mut JitContext, dest_operand: &WasmLocal, size: i32) {
         ctx.builder.and_i32();
     }
     ctx.builder.store_aligned_i32(0);
-    codegen::gen_set_last_op_size(ctx.builder, size);
-    codegen::gen_set_flags_changed(ctx.builder, FLAGS_ALL & !1);
+    codegen::gen_set_last_op_size_and_flags_changed(ctx.builder, size, FLAGS_ALL & !1);
     ctx.current_instruction = Instruction::Arithmetic { opsize: size };
 }
 fn gen_inc16(ctx: &mut JitContext, dest_operand: &WasmLocal) {
@@ -2298,8 +2309,7 @@ fn gen_dec(ctx: &mut JitContext, dest_operand: &WasmLocal, size: i32) {
         ctx.builder.and_i32();
     }
     ctx.builder.store_aligned_i32(0);
-    codegen::gen_set_last_op_size(ctx.builder, size);
-    codegen::gen_set_flags_changed(ctx.builder, FLAGS_ALL & !1 | FLAG_SUB);
+    codegen::gen_set_last_op_size_and_flags_changed(ctx.builder, size, FLAGS_ALL & !1 | FLAG_SUB);
     ctx.current_instruction = Instruction::Arithmetic { opsize: size };
 }
 fn gen_dec16(ctx: &mut JitContext, dest_operand: &WasmLocal) {
@@ -2347,8 +2357,7 @@ fn gen_neg32(ctx: &mut JitContext, dest_operand: &WasmLocal) {
     builder.set_local(dest_operand);
 
     codegen::gen_set_last_result(builder, &dest_operand);
-    codegen::gen_set_last_op_size(builder, OPSIZE_32);
-    codegen::gen_set_flags_changed(builder, FLAGS_ALL | FLAG_SUB);
+    codegen::gen_set_last_op_size_and_flags_changed(builder, OPSIZE_32, FLAGS_ALL | FLAG_SUB);
 }
 
 pub fn instr16_06_jit(ctx: &mut JitContext) {

+ 4 - 7
tests/expect/tests/add.wast

@@ -66,7 +66,7 @@
                 (get_local $l8)
                 (i32.const 2)))
             (i32.store
-              (i32.const 96)
+              (i32.const 104)
               (get_local $l3))
             (set_local $l3
               (i32.add
@@ -75,12 +75,9 @@
             (i32.store
               (i32.const 112)
               (get_local $l3))
-            (i32.store
-              (i32.const 104)
-              (i32.const 31))
-            (i32.store
-              (i32.const 116)
-              (i32.const 2261))
+            (i64.store
+              (i32.const 96)
+              (i64.const 9710921056287))
             (i32.store
               (i32.const 560)
               (i32.or

+ 6 - 9
tests/expect/tests/call-ret.wast

@@ -141,7 +141,7 @@
                     (i32.and
                       (tee_local $l9
                         (i32.load
-                          (i32.const 116)))
+                          (i32.const 100)))
                       (i32.const 1))
                     (then
                       (set_local $l9
@@ -155,7 +155,7 @@
                           (get_local $l9))
                         (i32.xor
                           (i32.load
-                            (i32.const 96))
+                            (i32.const 104))
                           (get_local $l9))))
                     (else
                       (i32.and
@@ -163,7 +163,7 @@
                           (i32.const 120))
                         (i32.const 1))))))
               (i32.store
-                (i32.const 96)
+                (i32.const 104)
                 (get_local $l0))
               (set_local $l0
                 (i32.add
@@ -172,12 +172,9 @@
               (i32.store
                 (i32.const 112)
                 (get_local $l0))
-              (i32.store
-                (i32.const 104)
-                (i32.const 31))
-              (i32.store
-                (i32.const 116)
-                (i32.const 2260))
+              (i64.store
+                (i32.const 96)
+                (i64.const 9706626088991))
               (i32.const 0)
               (set_local $l9
                 (i32.add

+ 13 - 18
tests/expect/tests/do-while.wast

@@ -90,7 +90,7 @@
                       (i32.and
                         (tee_local $l9
                           (i32.load
-                            (i32.const 116)))
+                            (i32.const 100)))
                         (i32.const 1))
                       (then
                         (set_local $l9
@@ -104,7 +104,7 @@
                             (get_local $l9))
                           (i32.xor
                             (i32.load
-                              (i32.const 96))
+                              (i32.const 104))
                             (get_local $l9))))
                       (else
                         (i32.and
@@ -112,7 +112,7 @@
                             (i32.const 120))
                           (i32.const 1))))))
                 (i32.store
-                  (i32.const 96)
+                  (i32.const 104)
                   (get_local $l3))
                 (set_local $l3
                   (i32.add
@@ -121,29 +121,24 @@
                 (i32.store
                   (i32.const 112)
                   (get_local $l3))
-                (i32.store
-                  (i32.const 104)
-                  (i32.const 31))
-                (i32.store
-                  (i32.const 116)
-                  (i32.const 2260))
+                (i64.store
+                  (i32.const 96)
+                  (i64.const 9706626088991))
                 (i32.store
                   (i32.const 112)
                   (i32.sub
                     (get_local $l0)
                     (i32.const 10)))
-                (i32.store
-                  (i32.const 96)
-                  (get_local $l0))
                 (i32.store
                   (i32.const 104)
-                  (i32.const 31))
-                (i32.store
-                  (i32.const 116)
-                  (i32.const -2147481387))
+                  (get_local $l0))
+                (i64.store
+                  (i32.const 96)
+                  (i64.const -9223362325933719521))
                 (br_if $L6
-                  (i32.load
-                    (i32.const 112)))))
+                  (i32.ne
+                    (get_local $l0)
+                    (i32.const 10)))))
             (set_local $l8
               (i32.add
                 (get_local $l8)

+ 16 - 25
tests/expect/tests/if.wast

@@ -71,15 +71,12 @@
                 (i32.sub
                   (get_local $l0)
                   (i32.const 5)))
-              (i32.store
-                (i32.const 96)
-                (get_local $l0))
               (i32.store
                 (i32.const 104)
-                (i32.const 31))
-              (i32.store
-                (i32.const 116)
-                (i32.const -2147481387))
+                (get_local $l0))
+              (i64.store
+                (i32.const 96)
+                (i64.const -9223362325933719521))
               (br_if $B5
                 (i32.gt_s
                   (get_local $l0)
@@ -99,7 +96,7 @@
                     (i32.and
                       (tee_local $l9
                         (i32.load
-                          (i32.const 116)))
+                          (i32.const 100)))
                       (i32.const 1))
                     (then
                       (set_local $l9
@@ -113,7 +110,7 @@
                           (get_local $l9))
                         (i32.xor
                           (i32.load
-                            (i32.const 96))
+                            (i32.const 104))
                           (get_local $l9))))
                     (else
                       (i32.and
@@ -121,7 +118,7 @@
                           (i32.const 120))
                         (i32.const 1))))))
               (i32.store
-                (i32.const 96)
+                (i32.const 104)
                 (get_local $l1))
               (set_local $l1
                 (i32.add
@@ -130,12 +127,9 @@
               (i32.store
                 (i32.const 112)
                 (get_local $l1))
-              (i32.store
-                (i32.const 104)
-                (i32.const 31))
-              (i32.store
-                (i32.const 116)
-                (i32.const 2260)))
+              (i64.store
+                (i32.const 96)
+                (i64.const 9706626088991)))
             (set_local $l8
               (i32.add
                 (get_local $l8)
@@ -151,7 +145,7 @@
                   (i32.and
                     (tee_local $l9
                       (i32.load
-                        (i32.const 116)))
+                        (i32.const 100)))
                     (i32.const 1))
                   (then
                     (set_local $l9
@@ -165,7 +159,7 @@
                         (get_local $l9))
                       (i32.xor
                         (i32.load
-                          (i32.const 96))
+                          (i32.const 104))
                         (get_local $l9))))
                   (else
                     (i32.and
@@ -173,7 +167,7 @@
                         (i32.const 120))
                       (i32.const 1))))))
             (i32.store
-              (i32.const 96)
+              (i32.const 104)
               (get_local $l3))
             (set_local $l3
               (i32.add
@@ -182,12 +176,9 @@
             (i32.store
               (i32.const 112)
               (get_local $l3))
-            (i32.store
-              (i32.const 104)
-              (i32.const 31))
-            (i32.store
-              (i32.const 116)
-              (i32.const 2260))
+            (i64.store
+              (i32.const 96)
+              (i64.const 9706626088991))
             (i32.store
               (i32.const 560)
               (i32.or

+ 6 - 9
tests/expect/tests/inc.wast

@@ -76,7 +76,7 @@
                   (i32.and
                     (tee_local $l9
                       (i32.load
-                        (i32.const 116)))
+                        (i32.const 100)))
                     (i32.const 1))
                   (then
                     (set_local $l9
@@ -90,7 +90,7 @@
                         (get_local $l9))
                       (i32.xor
                         (i32.load
-                          (i32.const 96))
+                          (i32.const 104))
                         (get_local $l9))))
                   (else
                     (i32.and
@@ -98,7 +98,7 @@
                         (i32.const 120))
                       (i32.const 1))))))
             (i32.store
-              (i32.const 96)
+              (i32.const 104)
               (get_local $l0))
             (set_local $l0
               (i32.add
@@ -107,12 +107,9 @@
             (i32.store
               (i32.const 112)
               (get_local $l0))
-            (i32.store
-              (i32.const 104)
-              (i32.const 31))
-            (i32.store
-              (i32.const 116)
-              (i32.const 2260))
+            (i64.store
+              (i32.const 96)
+              (i64.const 9706626088991))
             (i32.store
               (i32.const 560)
               (i32.or

+ 6 - 9
tests/expect/tests/mem32rmw.wast

@@ -130,7 +130,7 @@
                   (i32.and
                     (tee_local $l13
                       (i32.load
-                        (i32.const 116)))
+                        (i32.const 100)))
                     (i32.const 1))
                   (then
                     (set_local $l13
@@ -144,7 +144,7 @@
                         (get_local $l13))
                       (i32.xor
                         (i32.load
-                          (i32.const 96))
+                          (i32.const 104))
                         (get_local $l13))))
                   (else
                     (i32.and
@@ -152,7 +152,7 @@
                         (i32.const 120))
                       (i32.const 1))))))
             (i32.store
-              (i32.const 96)
+              (i32.const 104)
               (get_local $l12))
             (set_local $l12
               (i32.add
@@ -161,12 +161,9 @@
             (i32.store
               (i32.const 112)
               (get_local $l12))
-            (i32.store
-              (i32.const 104)
-              (i32.const 31))
-            (i32.store
-              (i32.const 116)
-              (i32.const 2260))
+            (i64.store
+              (i32.const 96)
+              (i64.const 9706626088991))
             (set_local $l12
               (get_local $l12))
             (if $I8

+ 11 - 17
tests/expect/tests/while-do.wast

@@ -84,25 +84,22 @@
                   (i32.sub
                     (get_local $l0)
                     (i32.const 10)))
-                (i32.store
-                  (i32.const 96)
-                  (get_local $l0))
                 (i32.store
                   (i32.const 104)
-                  (i32.const 31))
-                (i32.store
-                  (i32.const 116)
-                  (i32.const -2147481387))
+                  (get_local $l0))
+                (i64.store
+                  (i32.const 96)
+                  (i64.const -9223362325933719521))
                 (br_if $B5
-                  (i32.eqz
-                    (i32.load
-                      (i32.const 112))))
+                  (i32.eq
+                    (get_local $l0)
+                    (i32.const 10)))
                 (set_local $l8
                   (i32.add
                     (get_local $l8)
                     (i32.const 2)))
                 (i32.store
-                  (i32.const 96)
+                  (i32.const 104)
                   (get_local $l3))
                 (set_local $l3
                   (i32.add
@@ -111,12 +108,9 @@
                 (i32.store
                   (i32.const 112)
                   (get_local $l3))
-                (i32.store
-                  (i32.const 104)
-                  (i32.const 31))
-                (i32.store
-                  (i32.const 116)
-                  (i32.const 2261))
+                (i64.store
+                  (i32.const 96)
+                  (i64.const 9710921056287))
                 (br $L6)))
             (set_local $l8
               (i32.add