diff --git a/spectests/align.wast b/spectests/align.wast new file mode 100644 index 000000000..82ff87e1e --- /dev/null +++ b/spectests/align.wast @@ -0,0 +1,866 @@ +;; Test alignment annotation rules + +(module (memory 0) (func (drop (i32.load8_s align=1 (i32.const 0))))) +(module (memory 0) (func (drop (i32.load8_u align=1 (i32.const 0))))) +(module (memory 0) (func (drop (i32.load16_s align=2 (i32.const 0))))) +(module (memory 0) (func (drop (i32.load16_u align=2 (i32.const 0))))) +(module (memory 0) (func (drop (i32.load align=4 (i32.const 0))))) +(module (memory 0) (func (drop (i64.load8_s align=1 (i32.const 0))))) +(module (memory 0) (func (drop (i64.load8_u align=1 (i32.const 0))))) +(module (memory 0) (func (drop (i64.load16_s align=2 (i32.const 0))))) +(module (memory 0) (func (drop (i64.load16_u align=2 (i32.const 0))))) +(module (memory 0) (func (drop (i64.load32_s align=4 (i32.const 0))))) +(module (memory 0) (func (drop (i64.load32_u align=4 (i32.const 0))))) +(module (memory 0) (func (drop (i64.load align=8 (i32.const 0))))) +(module (memory 0) (func (drop (f32.load align=4 (i32.const 0))))) +(module (memory 0) (func (drop (f64.load align=8 (i32.const 0))))) +(module (memory 0) (func (i32.store8 align=1 (i32.const 0) (i32.const 1)))) +(module (memory 0) (func (i32.store16 align=2 (i32.const 0) (i32.const 1)))) +(module (memory 0) (func (i32.store align=4 (i32.const 0) (i32.const 1)))) +(module (memory 0) (func (i64.store8 align=1 (i32.const 0) (i64.const 1)))) +(module (memory 0) (func (i64.store16 align=2 (i32.const 0) (i64.const 1)))) +(module (memory 0) (func (i64.store32 align=4 (i32.const 0) (i64.const 1)))) +(module (memory 0) (func (i64.store align=8 (i32.const 0) (i64.const 1)))) +(module (memory 0) (func (f32.store align=4 (i32.const 0) (f32.const 1.0)))) +(module (memory 0) (func (f64.store align=8 (i32.const 0) (f64.const 1.0)))) + +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i32.load8_s align=0 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i32.load8_s align=7 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i32.load8_u align=0 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i32.load8_u align=7 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i32.load16_s align=0 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i32.load16_s align=7 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i32.load16_u align=0 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i32.load16_u align=7 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i32.load align=0 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i32.load align=7 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i64.load8_s align=0 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i64.load8_s align=7 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i64.load8_u align=0 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i64.load8_u align=7 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i64.load16_s align=0 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i64.load16_s align=7 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i64.load16_u align=0 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i64.load16_u align=7 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i64.load32_s align=0 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i64.load32_s align=7 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i64.load32_u align=0 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i64.load32_u align=7 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i64.load align=0 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i64.load align=7 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (f32.load align=0 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (f32.load align=7 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (f64.load align=0 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (f64.load align=7 (i32.const 0)))))" + ) + "alignment" +) + +(assert_malformed + (module quote + "(module (memory 0) (func (i32.store8 align=0 (i32.const 0) (i32.const 0))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (i32.store8 align=7 (i32.const 0) (i32.const 0))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (i32.store16 align=0 (i32.const 0) (i32.const 0))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (i32.store16 align=7 (i32.const 0) (i32.const 0))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (i32.store align=0 (i32.const 0) (i32.const 0))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (i32.store align=7 (i32.const 0) (i32.const 0))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (i64.store8 align=0 (i32.const 0) (i64.const 0))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (i64.store8 align=7 (i32.const 0) (i64.const 0))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (i64.store16 align=0 (i32.const 0) (i64.const 0))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (i64.store16 align=7 (i32.const 0) (i64.const 0))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (i64.store32 align=0 (i32.const 0) (i64.const 0))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (i64.store32 align=7 (i32.const 0) (i64.const 0))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (i64.store align=0 (i32.const 0) (i64.const 0))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (i64.store align=7 (i32.const 0) (i64.const 0))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (f32.store align=0 (i32.const 0) (f32.const 0))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (f32.store align=7 (i32.const 0) (f32.const 0))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (f64.store align=0 (i32.const 0) (f32.const 0))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (f64.store align=7 (i32.const 0) (f32.const 0))))" + ) + "alignment" +) + +(assert_invalid + (module (memory 0) (func (drop (i32.load8_s align=2 (i32.const 0))))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (drop (i32.load8_u align=2 (i32.const 0))))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (drop (i32.load16_s align=4 (i32.const 0))))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (drop (i32.load16_u align=4 (i32.const 0))))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (drop (i32.load align=8 (i32.const 0))))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (drop (i64.load8_s align=2 (i32.const 0))))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (drop (i64.load8_u align=2 (i32.const 0))))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (drop (i64.load16_s align=4 (i32.const 0))))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (drop (i64.load16_u align=4 (i32.const 0))))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (drop (i64.load32_s align=8 (i32.const 0))))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (drop (i64.load32_u align=8 (i32.const 0))))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (drop (i64.load align=16 (i32.const 0))))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (drop (f32.load align=8 (i32.const 0))))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (drop (f64.load align=16 (i32.const 0))))) + "alignment must not be larger than natural" +) + +(assert_invalid + (module (memory 0) (func (i32.load8_s align=2 (i32.const 0)))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (i32.load8_u align=2 (i32.const 0)))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (i32.load16_s align=4 (i32.const 0)))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (i32.load16_u align=4 (i32.const 0)))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (i32.load align=8 (i32.const 0)))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (i64.load8_s align=2 (i32.const 0)))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (i64.load8_u align=2 (i32.const 0)))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (i64.load16_s align=4 (i32.const 0)))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (i64.load16_u align=4 (i32.const 0)))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (i64.load32_s align=8 (i32.const 0)))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (i64.load32_u align=8 (i32.const 0)))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (i64.load align=16 (i32.const 0)))) + "alignment" +) +(assert_invalid + (module (memory 0) (func (f32.load align=8 (i32.const 0)))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (f64.load align=16 (i32.const 0)))) + "alignment must not be larger than natural" +) + +(assert_invalid + (module (memory 0) (func (i32.store8 align=2 (i32.const 0) (i32.const 0)))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (i32.store16 align=4 (i32.const 0) (i32.const 0)))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (i32.store align=8 (i32.const 0) (i32.const 0)))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (i64.store8 align=2 (i32.const 0) (i64.const 0)))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (i64.store16 align=4 (i32.const 0) (i64.const 0)))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (i64.store32 align=8 (i32.const 0) (i64.const 0)))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (i64.store align=16 (i32.const 0) (i64.const 0)))) + "alignment" +) +(assert_invalid + (module (memory 0) (func (f32.store align=8 (i32.const 0) (f32.const 0)))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (f64.store align=16 (i32.const 0) (f32.const 0)))) + "alignment must not be larger than natural" +) + +;; Test aligned and unaligned read/write + +(module + (memory 1) + + ;; $default: natural alignment, $1: align=1, $2: align=2, $4: align=4, $8: align=8 + + (func (export "f32_align_switch") (param i32) (result f32) + (local f32 f32) + (set_local 1 (f32.const 10.0)) + (block $4 + (block $2 + (block $1 + (block $default + (block $0 + (br_table $0 $default $1 $2 $4 (get_local 0)) + ) ;; 0 + (f32.store (i32.const 0) (get_local 1)) + (set_local 2 (f32.load (i32.const 0))) + (br $4) + ) ;; default + (f32.store align=1 (i32.const 0) (get_local 1)) + (set_local 2 (f32.load align=1 (i32.const 0))) + (br $4) + ) ;; 1 + (f32.store align=2 (i32.const 0) (get_local 1)) + (set_local 2 (f32.load align=2 (i32.const 0))) + (br $4) + ) ;; 2 + (f32.store align=4 (i32.const 0) (get_local 1)) + (set_local 2 (f32.load align=4 (i32.const 0))) + ) ;; 4 + (get_local 2) + ) + + (func (export "f64_align_switch") (param i32) (result f64) + (local f64 f64) + (set_local 1 (f64.const 10.0)) + (block $8 + (block $4 + (block $2 + (block $1 + (block $default + (block $0 + (br_table $0 $default $1 $2 $4 $8 (get_local 0)) + ) ;; 0 + (f64.store (i32.const 0) (get_local 1)) + (set_local 2 (f64.load (i32.const 0))) + (br $8) + ) ;; default + (f64.store align=1 (i32.const 0) (get_local 1)) + (set_local 2 (f64.load align=1 (i32.const 0))) + (br $8) + ) ;; 1 + (f64.store align=2 (i32.const 0) (get_local 1)) + (set_local 2 (f64.load align=2 (i32.const 0))) + (br $8) + ) ;; 2 + (f64.store align=4 (i32.const 0) (get_local 1)) + (set_local 2 (f64.load align=4 (i32.const 0))) + (br $8) + ) ;; 4 + (f64.store align=8 (i32.const 0) (get_local 1)) + (set_local 2 (f64.load align=8 (i32.const 0))) + ) ;; 8 + (get_local 2) + ) + + ;; $8s: i32/i64.load8_s, $8u: i32/i64.load8_u, $16s: i32/i64.load16_s, $16u: i32/i64.load16_u, $32: i32.load + ;; $32s: i64.load32_s, $32u: i64.load32_u, $64: i64.load + + (func (export "i32_align_switch") (param i32 i32) (result i32) + (local i32 i32) + (set_local 2 (i32.const 10)) + (block $32 + (block $16u + (block $16s + (block $8u + (block $8s + (block $0 + (br_table $0 $8s $8u $16s $16u $32 (get_local 0)) + ) ;; 0 + (if (i32.eq (get_local 1) (i32.const 0)) + (then + (i32.store8 (i32.const 0) (get_local 2)) + (set_local 3 (i32.load8_s (i32.const 0))) + ) + ) + (if (i32.eq (get_local 1) (i32.const 1)) + (then + (i32.store8 align=1 (i32.const 0) (get_local 2)) + (set_local 3 (i32.load8_s align=1 (i32.const 0))) + ) + ) + (br $32) + ) ;; 8s + (if (i32.eq (get_local 1) (i32.const 0)) + (then + (i32.store8 (i32.const 0) (get_local 2)) + (set_local 3 (i32.load8_u (i32.const 0))) + ) + ) + (if (i32.eq (get_local 1) (i32.const 1)) + (then + (i32.store8 align=1 (i32.const 0) (get_local 2)) + (set_local 3 (i32.load8_u align=1 (i32.const 0))) + ) + ) + (br $32) + ) ;; 8u + (if (i32.eq (get_local 1) (i32.const 0)) + (then + (i32.store16 (i32.const 0) (get_local 2)) + (set_local 3 (i32.load16_s (i32.const 0))) + ) + ) + (if (i32.eq (get_local 1) (i32.const 1)) + (then + (i32.store16 align=1 (i32.const 0) (get_local 2)) + (set_local 3 (i32.load16_s align=1 (i32.const 0))) + ) + ) + (if (i32.eq (get_local 1) (i32.const 2)) + (then + (i32.store16 align=2 (i32.const 0) (get_local 2)) + (set_local 3 (i32.load16_s align=2 (i32.const 0))) + ) + ) + (br $32) + ) ;; 16s + (if (i32.eq (get_local 1) (i32.const 0)) + (then + (i32.store16 (i32.const 0) (get_local 2)) + (set_local 3 (i32.load16_u (i32.const 0))) + ) + ) + (if (i32.eq (get_local 1) (i32.const 1)) + (then + (i32.store16 align=1 (i32.const 0) (get_local 2)) + (set_local 3 (i32.load16_u align=1 (i32.const 0))) + ) + ) + (if (i32.eq (get_local 1) (i32.const 2)) + (then + (i32.store16 align=2 (i32.const 0) (get_local 2)) + (set_local 3 (i32.load16_u align=2 (i32.const 0))) + ) + ) + (br $32) + ) ;; 16u + (if (i32.eq (get_local 1) (i32.const 0)) + (then + (i32.store (i32.const 0) (get_local 2)) + (set_local 3 (i32.load (i32.const 0))) + ) + ) + (if (i32.eq (get_local 1) (i32.const 1)) + (then + (i32.store align=1 (i32.const 0) (get_local 2)) + (set_local 3 (i32.load align=1 (i32.const 0))) + ) + ) + (if (i32.eq (get_local 1) (i32.const 2)) + (then + (i32.store align=2 (i32.const 0) (get_local 2)) + (set_local 3 (i32.load align=2 (i32.const 0))) + ) + ) + (if (i32.eq (get_local 1) (i32.const 4)) + (then + (i32.store align=4 (i32.const 0) (get_local 2)) + (set_local 3 (i32.load align=4 (i32.const 0))) + ) + ) + ) ;; 32 + (get_local 3) + ) + + (func (export "i64_align_switch") (param i32 i32) (result i64) + (local i64 i64) + (set_local 2 (i64.const 10)) + (block $64 + (block $32u + (block $32s + (block $16u + (block $16s + (block $8u + (block $8s + (block $0 + (br_table $0 $8s $8u $16s $16u $32s $32u $64 (get_local 0)) + ) ;; 0 + (if (i32.eq (get_local 1) (i32.const 0)) + (then + (i64.store8 (i32.const 0) (get_local 2)) + (set_local 3 (i64.load8_s (i32.const 0))) + ) + ) + (if (i32.eq (get_local 1) (i32.const 1)) + (then + (i64.store8 align=1 (i32.const 0) (get_local 2)) + (set_local 3 (i64.load8_s align=1 (i32.const 0))) + ) + ) + (br $64) + ) ;; 8s + (if (i32.eq (get_local 1) (i32.const 0)) + (then + (i64.store8 (i32.const 0) (get_local 2)) + (set_local 3 (i64.load8_u (i32.const 0))) + ) + ) + (if (i32.eq (get_local 1) (i32.const 1)) + (then + (i64.store8 align=1 (i32.const 0) (get_local 2)) + (set_local 3 (i64.load8_u align=1 (i32.const 0))) + ) + ) + (br $64) + ) ;; 8u + (if (i32.eq (get_local 1) (i32.const 0)) + (then + (i64.store16 (i32.const 0) (get_local 2)) + (set_local 3 (i64.load16_s (i32.const 0))) + ) + ) + (if (i32.eq (get_local 1) (i32.const 1)) + (then + (i64.store16 align=1 (i32.const 0) (get_local 2)) + (set_local 3 (i64.load16_s align=1 (i32.const 0))) + ) + ) + (if (i32.eq (get_local 1) (i32.const 2)) + (then + (i64.store16 align=2 (i32.const 0) (get_local 2)) + (set_local 3 (i64.load16_s align=2 (i32.const 0))) + ) + ) + (br $64) + ) ;; 16s + (if (i32.eq (get_local 1) (i32.const 0)) + (then + (i64.store16 (i32.const 0) (get_local 2)) + (set_local 3 (i64.load16_u (i32.const 0))) + ) + ) + (if (i32.eq (get_local 1) (i32.const 1)) + (then + (i64.store16 align=1 (i32.const 0) (get_local 2)) + (set_local 3 (i64.load16_u align=1 (i32.const 0))) + ) + ) + (if (i32.eq (get_local 1) (i32.const 2)) + (then + (i64.store16 align=2 (i32.const 0) (get_local 2)) + (set_local 3 (i64.load16_u align=2 (i32.const 0))) + ) + ) + (br $64) + ) ;; 16u + (if (i32.eq (get_local 1) (i32.const 0)) + (then + (i64.store32 (i32.const 0) (get_local 2)) + (set_local 3 (i64.load32_s (i32.const 0))) + ) + ) + (if (i32.eq (get_local 1) (i32.const 1)) + (then + (i64.store32 align=1 (i32.const 0) (get_local 2)) + (set_local 3 (i64.load32_s align=1 (i32.const 0))) + ) + ) + (if (i32.eq (get_local 1) (i32.const 2)) + (then + (i64.store32 align=2 (i32.const 0) (get_local 2)) + (set_local 3 (i64.load32_s align=2 (i32.const 0))) + ) + ) + (if (i32.eq (get_local 1) (i32.const 4)) + (then + (i64.store32 align=4 (i32.const 0) (get_local 2)) + (set_local 3 (i64.load32_s align=4 (i32.const 0))) + ) + ) + (br $64) + ) ;; 32s + (if (i32.eq (get_local 1) (i32.const 0)) + (then + (i64.store32 (i32.const 0) (get_local 2)) + (set_local 3 (i64.load32_u (i32.const 0))) + ) + ) + (if (i32.eq (get_local 1) (i32.const 1)) + (then + (i64.store32 align=1 (i32.const 0) (get_local 2)) + (set_local 3 (i64.load32_u align=1 (i32.const 0))) + ) + ) + (if (i32.eq (get_local 1) (i32.const 2)) + (then + (i64.store32 align=2 (i32.const 0) (get_local 2)) + (set_local 3 (i64.load32_u align=2 (i32.const 0))) + ) + ) + (if (i32.eq (get_local 1) (i32.const 4)) + (then + (i64.store32 align=4 (i32.const 0) (get_local 2)) + (set_local 3 (i64.load32_u align=4 (i32.const 0))) + ) + ) + (br $64) + ) ;; 32u + (if (i32.eq (get_local 1) (i32.const 0)) + (then + (i64.store (i32.const 0) (get_local 2)) + (set_local 3 (i64.load (i32.const 0))) + ) + ) + (if (i32.eq (get_local 1) (i32.const 1)) + (then + (i64.store align=1 (i32.const 0) (get_local 2)) + (set_local 3 (i64.load align=1 (i32.const 0))) + ) + ) + (if (i32.eq (get_local 1) (i32.const 2)) + (then + (i64.store align=2 (i32.const 0) (get_local 2)) + (set_local 3 (i64.load align=2 (i32.const 0))) + ) + ) + (if (i32.eq (get_local 1) (i32.const 4)) + (then + (i64.store align=4 (i32.const 0) (get_local 2)) + (set_local 3 (i64.load align=4 (i32.const 0))) + ) + ) + (if (i32.eq (get_local 1) (i32.const 8)) + (then + (i64.store align=8 (i32.const 0) (get_local 2)) + (set_local 3 (i64.load align=8 (i32.const 0))) + ) + ) + ) ;; 64 + (get_local 3) + ) +) + +(assert_return (invoke "f32_align_switch" (i32.const 0)) (f32.const 10.0)) +(assert_return (invoke "f32_align_switch" (i32.const 1)) (f32.const 10.0)) +(assert_return (invoke "f32_align_switch" (i32.const 2)) (f32.const 10.0)) +(assert_return (invoke "f32_align_switch" (i32.const 3)) (f32.const 10.0)) + +(assert_return (invoke "f64_align_switch" (i32.const 0)) (f64.const 10.0)) +(assert_return (invoke "f64_align_switch" (i32.const 1)) (f64.const 10.0)) +(assert_return (invoke "f64_align_switch" (i32.const 2)) (f64.const 10.0)) +(assert_return (invoke "f64_align_switch" (i32.const 3)) (f64.const 10.0)) +(assert_return (invoke "f64_align_switch" (i32.const 4)) (f64.const 10.0)) + +(assert_return (invoke "i32_align_switch" (i32.const 0) (i32.const 0)) (i32.const 10)) +(assert_return (invoke "i32_align_switch" (i32.const 0) (i32.const 1)) (i32.const 10)) +(assert_return (invoke "i32_align_switch" (i32.const 1) (i32.const 0)) (i32.const 10)) +(assert_return (invoke "i32_align_switch" (i32.const 1) (i32.const 1)) (i32.const 10)) +(assert_return (invoke "i32_align_switch" (i32.const 2) (i32.const 0)) (i32.const 10)) +(assert_return (invoke "i32_align_switch" (i32.const 2) (i32.const 1)) (i32.const 10)) +(assert_return (invoke "i32_align_switch" (i32.const 2) (i32.const 2)) (i32.const 10)) +(assert_return (invoke "i32_align_switch" (i32.const 3) (i32.const 0)) (i32.const 10)) +(assert_return (invoke "i32_align_switch" (i32.const 3) (i32.const 1)) (i32.const 10)) +(assert_return (invoke "i32_align_switch" (i32.const 3) (i32.const 2)) (i32.const 10)) +(assert_return (invoke "i32_align_switch" (i32.const 4) (i32.const 0)) (i32.const 10)) +(assert_return (invoke "i32_align_switch" (i32.const 4) (i32.const 1)) (i32.const 10)) +(assert_return (invoke "i32_align_switch" (i32.const 4) (i32.const 2)) (i32.const 10)) +(assert_return (invoke "i32_align_switch" (i32.const 4) (i32.const 4)) (i32.const 10)) + +(assert_return (invoke "i64_align_switch" (i32.const 0) (i32.const 0)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 0) (i32.const 1)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 1) (i32.const 0)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 1) (i32.const 1)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 2) (i32.const 0)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 2) (i32.const 1)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 2) (i32.const 2)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 3) (i32.const 0)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 3) (i32.const 1)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 3) (i32.const 2)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 4) (i32.const 0)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 4) (i32.const 1)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 4) (i32.const 2)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 4) (i32.const 4)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 5) (i32.const 0)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 5) (i32.const 1)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 5) (i32.const 2)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 5) (i32.const 4)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 6) (i32.const 0)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 6) (i32.const 1)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 6) (i32.const 2)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 6) (i32.const 4)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 6) (i32.const 8)) (i64.const 10)) + +;; ;; Test that an i64 store with 4-byte alignment that's 4 bytes out of bounds traps without storing anything + +;; (module +;; (memory 1) +;; (func (export "store") (param i32 i64) +;; (i64.store align=4 (get_local 0) (get_local 1)) +;; ) +;; (func (export "load") (param i32) (result i32) +;; (i32.load (get_local 0)) +;; ) +;; ) + +;; (assert_trap (invoke "store" (i32.const 65532) (i64.const -1)) "out of bounds memory access") +;; ;; No memory was changed +;; (assert_return (invoke "load" (i32.const 65532)) (i32.const 0)) diff --git a/src/build_spectests.rs b/src/build_spectests.rs index c4ca2b647..eb7d18a8c 100644 --- a/src/build_spectests.rs +++ b/src/build_spectests.rs @@ -15,7 +15,8 @@ static ENV_VAR: &str = "WASM_GENERATE_SPECTESTS"; static BANNER: &str = "// Rust test file autogenerated with cargo build (src/build_spectests.rs). // Please do NOT modify it by hand, as it will be reseted on next build.\n"; -const TESTS: [&str; 23] = [ +const TESTS: [&str; 24] = [ + "spectests/align.wast", "spectests/block.wast", "spectests/br.wast", "spectests/br_if.wast", diff --git a/src/spectests/align.rs b/src/spectests/align.rs new file mode 100644 index 000000000..7237da83d --- /dev/null +++ b/src/spectests/align.rs @@ -0,0 +1,2175 @@ +// Rust test file autogenerated with cargo build (src/build_spectests.rs). +// Please do NOT modify it by hand, as it will be reseted on next build. +// Test based on spectests/align.wast +#![allow( + warnings, + dead_code +)] +use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export}; +use super::_common::spectest_importobject; +use wabt::wat2wasm; + + +// Line 3 +fn create_module_1() -> ResultObject { + let module_str = "(module + (type (;0;) (func)) + (func (;0;) (type 0) + i32.const 0 + i32.load8_s + drop) + (memory (;0;) 0)) + "; + let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); + instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") +} + +// Line 4 +fn create_module_2() -> ResultObject { + let module_str = "(module + (type (;0;) (func)) + (func (;0;) (type 0) + i32.const 0 + i32.load8_u + drop) + (memory (;0;) 0)) + "; + let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); + instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") +} + +// Line 5 +fn create_module_3() -> ResultObject { + let module_str = "(module + (type (;0;) (func)) + (func (;0;) (type 0) + i32.const 0 + i32.load16_s + drop) + (memory (;0;) 0)) + "; + let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); + instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") +} + +// Line 6 +fn create_module_4() -> ResultObject { + let module_str = "(module + (type (;0;) (func)) + (func (;0;) (type 0) + i32.const 0 + i32.load16_u + drop) + (memory (;0;) 0)) + "; + let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); + instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") +} + +// Line 7 +fn create_module_5() -> ResultObject { + let module_str = "(module + (type (;0;) (func)) + (func (;0;) (type 0) + i32.const 0 + i32.load + drop) + (memory (;0;) 0)) + "; + let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); + instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") +} + +// Line 8 +fn create_module_6() -> ResultObject { + let module_str = "(module + (type (;0;) (func)) + (func (;0;) (type 0) + i32.const 0 + i64.load8_s + drop) + (memory (;0;) 0)) + "; + let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); + instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") +} + +// Line 9 +fn create_module_7() -> ResultObject { + let module_str = "(module + (type (;0;) (func)) + (func (;0;) (type 0) + i32.const 0 + i64.load8_u + drop) + (memory (;0;) 0)) + "; + let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); + instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") +} + +// Line 10 +fn create_module_8() -> ResultObject { + let module_str = "(module + (type (;0;) (func)) + (func (;0;) (type 0) + i32.const 0 + i64.load16_s + drop) + (memory (;0;) 0)) + "; + let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); + instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") +} + +// Line 11 +fn create_module_9() -> ResultObject { + let module_str = "(module + (type (;0;) (func)) + (func (;0;) (type 0) + i32.const 0 + i64.load16_u + drop) + (memory (;0;) 0)) + "; + let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); + instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") +} + +// Line 12 +fn create_module_10() -> ResultObject { + let module_str = "(module + (type (;0;) (func)) + (func (;0;) (type 0) + i32.const 0 + i64.load32_s + drop) + (memory (;0;) 0)) + "; + let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); + instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") +} + +// Line 13 +fn create_module_11() -> ResultObject { + let module_str = "(module + (type (;0;) (func)) + (func (;0;) (type 0) + i32.const 0 + i64.load32_u + drop) + (memory (;0;) 0)) + "; + let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); + instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") +} + +// Line 14 +fn create_module_12() -> ResultObject { + let module_str = "(module + (type (;0;) (func)) + (func (;0;) (type 0) + i32.const 0 + i64.load + drop) + (memory (;0;) 0)) + "; + let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); + instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") +} + +// Line 15 +fn create_module_13() -> ResultObject { + let module_str = "(module + (type (;0;) (func)) + (func (;0;) (type 0) + i32.const 0 + f32.load + drop) + (memory (;0;) 0)) + "; + let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); + instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") +} + +// Line 16 +fn create_module_14() -> ResultObject { + let module_str = "(module + (type (;0;) (func)) + (func (;0;) (type 0) + i32.const 0 + f64.load + drop) + (memory (;0;) 0)) + "; + let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); + instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") +} + +// Line 17 +fn create_module_15() -> ResultObject { + let module_str = "(module + (type (;0;) (func)) + (func (;0;) (type 0) + i32.const 0 + i32.const 1 + i32.store8) + (memory (;0;) 0)) + "; + let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); + instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") +} + +// Line 18 +fn create_module_16() -> ResultObject { + let module_str = "(module + (type (;0;) (func)) + (func (;0;) (type 0) + i32.const 0 + i32.const 1 + i32.store16) + (memory (;0;) 0)) + "; + let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); + instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") +} + +// Line 19 +fn create_module_17() -> ResultObject { + let module_str = "(module + (type (;0;) (func)) + (func (;0;) (type 0) + i32.const 0 + i32.const 1 + i32.store) + (memory (;0;) 0)) + "; + let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); + instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") +} + +// Line 20 +fn create_module_18() -> ResultObject { + let module_str = "(module + (type (;0;) (func)) + (func (;0;) (type 0) + i32.const 0 + i64.const 1 + i64.store8) + (memory (;0;) 0)) + "; + let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); + instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") +} + +// Line 21 +fn create_module_19() -> ResultObject { + let module_str = "(module + (type (;0;) (func)) + (func (;0;) (type 0) + i32.const 0 + i64.const 1 + i64.store16) + (memory (;0;) 0)) + "; + let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); + instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") +} + +// Line 22 +fn create_module_20() -> ResultObject { + let module_str = "(module + (type (;0;) (func)) + (func (;0;) (type 0) + i32.const 0 + i64.const 1 + i64.store32) + (memory (;0;) 0)) + "; + let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); + instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") +} + +// Line 23 +fn create_module_21() -> ResultObject { + let module_str = "(module + (type (;0;) (func)) + (func (;0;) (type 0) + i32.const 0 + i64.const 1 + i64.store) + (memory (;0;) 0)) + "; + let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); + instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") +} + +// Line 24 +fn create_module_22() -> ResultObject { + let module_str = "(module + (type (;0;) (func)) + (func (;0;) (type 0) + i32.const 0 + f32.const 0x1p+0 (;=1;) + f32.store) + (memory (;0;) 0)) + "; + let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); + instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") +} + +// Line 25 +fn create_module_23() -> ResultObject { + let module_str = "(module + (type (;0;) (func)) + (func (;0;) (type 0) + i32.const 0 + f64.const 0x1p+0 (;=1;) + f64.store) + (memory (;0;) 0)) + "; + let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); + instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") +} + +// Line 28 +#[test] +fn l28_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 100, 114, 111, 112, 32, 40, 105, 51, 50, 46, 108, 111, 97, 100, 56, 95, 115, 32, 97, 108, 105, 103, 110, 61, 48, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 34 +#[test] +fn l34_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 100, 114, 111, 112, 32, 40, 105, 51, 50, 46, 108, 111, 97, 100, 56, 95, 115, 32, 97, 108, 105, 103, 110, 61, 55, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 40 +#[test] +fn l40_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 100, 114, 111, 112, 32, 40, 105, 51, 50, 46, 108, 111, 97, 100, 56, 95, 117, 32, 97, 108, 105, 103, 110, 61, 48, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 46 +#[test] +fn l46_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 100, 114, 111, 112, 32, 40, 105, 51, 50, 46, 108, 111, 97, 100, 56, 95, 117, 32, 97, 108, 105, 103, 110, 61, 55, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 52 +#[test] +fn l52_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 100, 114, 111, 112, 32, 40, 105, 51, 50, 46, 108, 111, 97, 100, 49, 54, 95, 115, 32, 97, 108, 105, 103, 110, 61, 48, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 58 +#[test] +fn l58_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 100, 114, 111, 112, 32, 40, 105, 51, 50, 46, 108, 111, 97, 100, 49, 54, 95, 115, 32, 97, 108, 105, 103, 110, 61, 55, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 64 +#[test] +fn l64_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 100, 114, 111, 112, 32, 40, 105, 51, 50, 46, 108, 111, 97, 100, 49, 54, 95, 117, 32, 97, 108, 105, 103, 110, 61, 48, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 70 +#[test] +fn l70_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 100, 114, 111, 112, 32, 40, 105, 51, 50, 46, 108, 111, 97, 100, 49, 54, 95, 117, 32, 97, 108, 105, 103, 110, 61, 55, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 76 +#[test] +fn l76_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 100, 114, 111, 112, 32, 40, 105, 51, 50, 46, 108, 111, 97, 100, 32, 97, 108, 105, 103, 110, 61, 48, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 82 +#[test] +fn l82_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 100, 114, 111, 112, 32, 40, 105, 51, 50, 46, 108, 111, 97, 100, 32, 97, 108, 105, 103, 110, 61, 55, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 88 +#[test] +fn l88_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 100, 114, 111, 112, 32, 40, 105, 54, 52, 46, 108, 111, 97, 100, 56, 95, 115, 32, 97, 108, 105, 103, 110, 61, 48, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 94 +#[test] +fn l94_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 100, 114, 111, 112, 32, 40, 105, 54, 52, 46, 108, 111, 97, 100, 56, 95, 115, 32, 97, 108, 105, 103, 110, 61, 55, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 100 +#[test] +fn l100_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 100, 114, 111, 112, 32, 40, 105, 54, 52, 46, 108, 111, 97, 100, 56, 95, 117, 32, 97, 108, 105, 103, 110, 61, 48, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 106 +#[test] +fn l106_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 100, 114, 111, 112, 32, 40, 105, 54, 52, 46, 108, 111, 97, 100, 56, 95, 117, 32, 97, 108, 105, 103, 110, 61, 55, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 112 +#[test] +fn l112_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 100, 114, 111, 112, 32, 40, 105, 54, 52, 46, 108, 111, 97, 100, 49, 54, 95, 115, 32, 97, 108, 105, 103, 110, 61, 48, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 118 +#[test] +fn l118_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 100, 114, 111, 112, 32, 40, 105, 54, 52, 46, 108, 111, 97, 100, 49, 54, 95, 115, 32, 97, 108, 105, 103, 110, 61, 55, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 124 +#[test] +fn l124_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 100, 114, 111, 112, 32, 40, 105, 54, 52, 46, 108, 111, 97, 100, 49, 54, 95, 117, 32, 97, 108, 105, 103, 110, 61, 48, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 130 +#[test] +fn l130_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 100, 114, 111, 112, 32, 40, 105, 54, 52, 46, 108, 111, 97, 100, 49, 54, 95, 117, 32, 97, 108, 105, 103, 110, 61, 55, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 136 +#[test] +fn l136_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 100, 114, 111, 112, 32, 40, 105, 54, 52, 46, 108, 111, 97, 100, 51, 50, 95, 115, 32, 97, 108, 105, 103, 110, 61, 48, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 142 +#[test] +fn l142_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 100, 114, 111, 112, 32, 40, 105, 54, 52, 46, 108, 111, 97, 100, 51, 50, 95, 115, 32, 97, 108, 105, 103, 110, 61, 55, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 148 +#[test] +fn l148_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 100, 114, 111, 112, 32, 40, 105, 54, 52, 46, 108, 111, 97, 100, 51, 50, 95, 117, 32, 97, 108, 105, 103, 110, 61, 48, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 154 +#[test] +fn l154_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 100, 114, 111, 112, 32, 40, 105, 54, 52, 46, 108, 111, 97, 100, 51, 50, 95, 117, 32, 97, 108, 105, 103, 110, 61, 55, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 160 +#[test] +fn l160_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 100, 114, 111, 112, 32, 40, 105, 54, 52, 46, 108, 111, 97, 100, 32, 97, 108, 105, 103, 110, 61, 48, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 166 +#[test] +fn l166_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 100, 114, 111, 112, 32, 40, 105, 54, 52, 46, 108, 111, 97, 100, 32, 97, 108, 105, 103, 110, 61, 55, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 172 +#[test] +fn l172_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 100, 114, 111, 112, 32, 40, 102, 51, 50, 46, 108, 111, 97, 100, 32, 97, 108, 105, 103, 110, 61, 48, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 178 +#[test] +fn l178_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 100, 114, 111, 112, 32, 40, 102, 51, 50, 46, 108, 111, 97, 100, 32, 97, 108, 105, 103, 110, 61, 55, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 184 +#[test] +fn l184_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 100, 114, 111, 112, 32, 40, 102, 54, 52, 46, 108, 111, 97, 100, 32, 97, 108, 105, 103, 110, 61, 48, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 190 +#[test] +fn l190_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 100, 114, 111, 112, 32, 40, 102, 54, 52, 46, 108, 111, 97, 100, 32, 97, 108, 105, 103, 110, 61, 55, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 197 +#[test] +fn l197_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 105, 51, 50, 46, 115, 116, 111, 114, 101, 56, 32, 97, 108, 105, 103, 110, 61, 48, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 203 +#[test] +fn l203_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 105, 51, 50, 46, 115, 116, 111, 114, 101, 56, 32, 97, 108, 105, 103, 110, 61, 55, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 209 +#[test] +fn l209_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 105, 51, 50, 46, 115, 116, 111, 114, 101, 49, 54, 32, 97, 108, 105, 103, 110, 61, 48, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 215 +#[test] +fn l215_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 105, 51, 50, 46, 115, 116, 111, 114, 101, 49, 54, 32, 97, 108, 105, 103, 110, 61, 55, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 221 +#[test] +fn l221_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 105, 51, 50, 46, 115, 116, 111, 114, 101, 32, 97, 108, 105, 103, 110, 61, 48, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 227 +#[test] +fn l227_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 105, 51, 50, 46, 115, 116, 111, 114, 101, 32, 97, 108, 105, 103, 110, 61, 55, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 233 +#[test] +fn l233_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 105, 54, 52, 46, 115, 116, 111, 114, 101, 56, 32, 97, 108, 105, 103, 110, 61, 48, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 32, 40, 105, 54, 52, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 239 +#[test] +fn l239_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 105, 54, 52, 46, 115, 116, 111, 114, 101, 56, 32, 97, 108, 105, 103, 110, 61, 55, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 32, 40, 105, 54, 52, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 245 +#[test] +fn l245_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 105, 54, 52, 46, 115, 116, 111, 114, 101, 49, 54, 32, 97, 108, 105, 103, 110, 61, 48, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 32, 40, 105, 54, 52, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 251 +#[test] +fn l251_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 105, 54, 52, 46, 115, 116, 111, 114, 101, 49, 54, 32, 97, 108, 105, 103, 110, 61, 55, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 32, 40, 105, 54, 52, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 257 +#[test] +fn l257_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 105, 54, 52, 46, 115, 116, 111, 114, 101, 51, 50, 32, 97, 108, 105, 103, 110, 61, 48, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 32, 40, 105, 54, 52, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 263 +#[test] +fn l263_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 105, 54, 52, 46, 115, 116, 111, 114, 101, 51, 50, 32, 97, 108, 105, 103, 110, 61, 55, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 32, 40, 105, 54, 52, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 269 +#[test] +fn l269_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 105, 54, 52, 46, 115, 116, 111, 114, 101, 32, 97, 108, 105, 103, 110, 61, 48, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 32, 40, 105, 54, 52, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 275 +#[test] +fn l275_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 105, 54, 52, 46, 115, 116, 111, 114, 101, 32, 97, 108, 105, 103, 110, 61, 55, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 32, 40, 105, 54, 52, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 281 +#[test] +fn l281_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 102, 51, 50, 46, 115, 116, 111, 114, 101, 32, 97, 108, 105, 103, 110, 61, 48, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 32, 40, 102, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 287 +#[test] +fn l287_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 102, 51, 50, 46, 115, 116, 111, 114, 101, 32, 97, 108, 105, 103, 110, 61, 55, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 32, 40, 102, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 293 +#[test] +fn l293_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 102, 54, 52, 46, 115, 116, 111, 114, 101, 32, 97, 108, 105, 103, 110, 61, 48, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 32, 40, 102, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 299 +#[test] +fn l299_assert_malformed() { + let wasm_binary = [40, 109, 111, 100, 117, 108, 101, 32, 40, 109, 101, 109, 111, 114, 121, 32, 48, 41, 32, 40, 102, 117, 110, 99, 32, 40, 102, 54, 52, 46, 115, 116, 111, 114, 101, 32, 97, 108, 105, 103, 110, 61, 55, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 32, 40, 102, 51, 50, 46, 99, 111, 110, 115, 116, 32, 48, 41, 41, 41, 41]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is malformed"); +} + +// Line 306 +#[test] +fn l306_assert_invalid() { + let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 0, 10, 10, 1, 8, 0, 65, 0, 44, 1, 0, 26, 11]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is invalid"); +} + +// Line 310 +#[test] +fn l310_assert_invalid() { + let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 0, 10, 10, 1, 8, 0, 65, 0, 45, 1, 0, 26, 11]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is invalid"); +} + +// Line 314 +#[test] +fn l314_assert_invalid() { + let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 0, 10, 10, 1, 8, 0, 65, 0, 46, 2, 0, 26, 11]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is invalid"); +} + +// Line 318 +#[test] +fn l318_assert_invalid() { + let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 0, 10, 10, 1, 8, 0, 65, 0, 47, 2, 0, 26, 11]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is invalid"); +} + +// Line 322 +#[test] +fn l322_assert_invalid() { + let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 0, 10, 10, 1, 8, 0, 65, 0, 40, 3, 0, 26, 11]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is invalid"); +} + +// Line 326 +#[test] +fn l326_assert_invalid() { + let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 0, 10, 10, 1, 8, 0, 65, 0, 48, 1, 0, 26, 11]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is invalid"); +} + +// Line 330 +#[test] +fn l330_assert_invalid() { + let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 0, 10, 10, 1, 8, 0, 65, 0, 49, 1, 0, 26, 11]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is invalid"); +} + +// Line 334 +#[test] +fn l334_assert_invalid() { + let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 0, 10, 10, 1, 8, 0, 65, 0, 50, 2, 0, 26, 11]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is invalid"); +} + +// Line 338 +#[test] +fn l338_assert_invalid() { + let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 0, 10, 10, 1, 8, 0, 65, 0, 51, 2, 0, 26, 11]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is invalid"); +} + +// Line 342 +#[test] +fn l342_assert_invalid() { + let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 0, 10, 10, 1, 8, 0, 65, 0, 52, 3, 0, 26, 11]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is invalid"); +} + +// Line 346 +#[test] +fn l346_assert_invalid() { + let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 0, 10, 10, 1, 8, 0, 65, 0, 53, 3, 0, 26, 11]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is invalid"); +} + +// Line 350 +#[test] +fn l350_assert_invalid() { + let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 0, 10, 10, 1, 8, 0, 65, 0, 41, 4, 0, 26, 11]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is invalid"); +} + +// Line 354 +#[test] +fn l354_assert_invalid() { + let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 0, 10, 10, 1, 8, 0, 65, 0, 42, 3, 0, 26, 11]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is invalid"); +} + +// Line 358 +#[test] +fn l358_assert_invalid() { + let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 0, 10, 10, 1, 8, 0, 65, 0, 43, 4, 0, 26, 11]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is invalid"); +} + +// Line 363 +#[test] +fn l363_assert_invalid() { + let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 0, 10, 9, 1, 7, 0, 65, 0, 44, 1, 0, 11]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is invalid"); +} + +// Line 367 +#[test] +fn l367_assert_invalid() { + let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 0, 10, 9, 1, 7, 0, 65, 0, 45, 1, 0, 11]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is invalid"); +} + +// Line 371 +#[test] +fn l371_assert_invalid() { + let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 0, 10, 9, 1, 7, 0, 65, 0, 46, 2, 0, 11]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is invalid"); +} + +// Line 375 +#[test] +fn l375_assert_invalid() { + let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 0, 10, 9, 1, 7, 0, 65, 0, 47, 2, 0, 11]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is invalid"); +} + +// Line 379 +#[test] +fn l379_assert_invalid() { + let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 0, 10, 9, 1, 7, 0, 65, 0, 40, 3, 0, 11]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is invalid"); +} + +// Line 383 +#[test] +fn l383_assert_invalid() { + let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 0, 10, 9, 1, 7, 0, 65, 0, 48, 1, 0, 11]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is invalid"); +} + +// Line 387 +#[test] +fn l387_assert_invalid() { + let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 0, 10, 9, 1, 7, 0, 65, 0, 49, 1, 0, 11]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is invalid"); +} + +// Line 391 +#[test] +fn l391_assert_invalid() { + let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 0, 10, 9, 1, 7, 0, 65, 0, 50, 2, 0, 11]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is invalid"); +} + +// Line 395 +#[test] +fn l395_assert_invalid() { + let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 0, 10, 9, 1, 7, 0, 65, 0, 51, 2, 0, 11]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is invalid"); +} + +// Line 399 +#[test] +fn l399_assert_invalid() { + let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 0, 10, 9, 1, 7, 0, 65, 0, 52, 3, 0, 11]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is invalid"); +} + +// Line 403 +#[test] +fn l403_assert_invalid() { + let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 0, 10, 9, 1, 7, 0, 65, 0, 53, 3, 0, 11]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is invalid"); +} + +// Line 407 +#[test] +fn l407_assert_invalid() { + let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 0, 10, 9, 1, 7, 0, 65, 0, 41, 4, 0, 11]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is invalid"); +} + +// Line 411 +#[test] +fn l411_assert_invalid() { + let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 0, 10, 9, 1, 7, 0, 65, 0, 42, 3, 0, 11]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is invalid"); +} + +// Line 415 +#[test] +fn l415_assert_invalid() { + let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 0, 10, 9, 1, 7, 0, 65, 0, 43, 4, 0, 11]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is invalid"); +} + +// Line 420 +#[test] +fn l420_assert_invalid() { + let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 0, 10, 11, 1, 9, 0, 65, 0, 65, 0, 58, 1, 0, 11]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is invalid"); +} + +// Line 424 +#[test] +fn l424_assert_invalid() { + let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 0, 10, 11, 1, 9, 0, 65, 0, 65, 0, 59, 2, 0, 11]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is invalid"); +} + +// Line 428 +#[test] +fn l428_assert_invalid() { + let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 0, 10, 11, 1, 9, 0, 65, 0, 65, 0, 54, 3, 0, 11]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is invalid"); +} + +// Line 432 +#[test] +fn l432_assert_invalid() { + let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 0, 10, 11, 1, 9, 0, 65, 0, 66, 0, 60, 1, 0, 11]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is invalid"); +} + +// Line 436 +#[test] +fn l436_assert_invalid() { + let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 0, 10, 11, 1, 9, 0, 65, 0, 66, 0, 61, 2, 0, 11]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is invalid"); +} + +// Line 440 +#[test] +fn l440_assert_invalid() { + let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 0, 10, 11, 1, 9, 0, 65, 0, 66, 0, 62, 3, 0, 11]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is invalid"); +} + +// Line 444 +#[test] +fn l444_assert_invalid() { + let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 0, 10, 11, 1, 9, 0, 65, 0, 66, 0, 55, 4, 0, 11]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is invalid"); +} + +// Line 448 +#[test] +fn l448_assert_invalid() { + let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 0, 10, 14, 1, 12, 0, 65, 0, 67, 0, 0, 0, 0, 56, 3, 0, 11]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is invalid"); +} + +// Line 452 +#[test] +fn l452_assert_invalid() { + let wasm_binary = [0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 0, 10, 14, 1, 12, 0, 65, 0, 67, 0, 0, 0, 0, 57, 4, 0, 11]; + let compilation = compile(wasm_binary.to_vec()); + assert!(compilation.is_err(), "WASM should not compile as is invalid"); +} + +// Line 458 +fn create_module_24() -> ResultObject { + let module_str = "(module + (type (;0;) (func (param i32) (result f32))) + (type (;1;) (func (param i32) (result f64))) + (type (;2;) (func (param i32 i32) (result i32))) + (type (;3;) (func (param i32 i32) (result i64))) + (func (;0;) (type 0) (param i32) (result f32) + (local f32 f32) + f32.const 0x1.4p+3 (;=10;) + set_local 1 + block ;; label = @1 + block ;; label = @2 + block ;; label = @3 + block ;; label = @4 + block ;; label = @5 + get_local 0 + br_table 0 (;@5;) 1 (;@4;) 2 (;@3;) 3 (;@2;) 4 (;@1;) + end + i32.const 0 + get_local 1 + f32.store + i32.const 0 + f32.load + set_local 2 + br 3 (;@1;) + end + i32.const 0 + get_local 1 + f32.store align=1 + i32.const 0 + f32.load align=1 + set_local 2 + br 2 (;@1;) + end + i32.const 0 + get_local 1 + f32.store align=2 + i32.const 0 + f32.load align=2 + set_local 2 + br 1 (;@1;) + end + i32.const 0 + get_local 1 + f32.store + i32.const 0 + f32.load + set_local 2 + end + get_local 2) + (func (;1;) (type 1) (param i32) (result f64) + (local f64 f64) + f64.const 0x1.4p+3 (;=10;) + set_local 1 + block ;; label = @1 + block ;; label = @2 + block ;; label = @3 + block ;; label = @4 + block ;; label = @5 + block ;; label = @6 + get_local 0 + br_table 0 (;@6;) 1 (;@5;) 2 (;@4;) 3 (;@3;) 4 (;@2;) 5 (;@1;) + end + i32.const 0 + get_local 1 + f64.store + i32.const 0 + f64.load + set_local 2 + br 4 (;@1;) + end + i32.const 0 + get_local 1 + f64.store align=1 + i32.const 0 + f64.load align=1 + set_local 2 + br 3 (;@1;) + end + i32.const 0 + get_local 1 + f64.store align=2 + i32.const 0 + f64.load align=2 + set_local 2 + br 2 (;@1;) + end + i32.const 0 + get_local 1 + f64.store align=4 + i32.const 0 + f64.load align=4 + set_local 2 + br 1 (;@1;) + end + i32.const 0 + get_local 1 + f64.store + i32.const 0 + f64.load + set_local 2 + end + get_local 2) + (func (;2;) (type 2) (param i32 i32) (result i32) + (local i32 i32) + i32.const 10 + set_local 2 + block ;; label = @1 + block ;; label = @2 + block ;; label = @3 + block ;; label = @4 + block ;; label = @5 + block ;; label = @6 + get_local 0 + br_table 0 (;@6;) 1 (;@5;) 2 (;@4;) 3 (;@3;) 4 (;@2;) 5 (;@1;) + end + get_local 1 + i32.const 0 + i32.eq + if ;; label = @6 + i32.const 0 + get_local 2 + i32.store8 + i32.const 0 + i32.load8_s + set_local 3 + end + get_local 1 + i32.const 1 + i32.eq + if ;; label = @6 + i32.const 0 + get_local 2 + i32.store8 + i32.const 0 + i32.load8_s + set_local 3 + end + br 4 (;@1;) + end + get_local 1 + i32.const 0 + i32.eq + if ;; label = @5 + i32.const 0 + get_local 2 + i32.store8 + i32.const 0 + i32.load8_u + set_local 3 + end + get_local 1 + i32.const 1 + i32.eq + if ;; label = @5 + i32.const 0 + get_local 2 + i32.store8 + i32.const 0 + i32.load8_u + set_local 3 + end + br 3 (;@1;) + end + get_local 1 + i32.const 0 + i32.eq + if ;; label = @4 + i32.const 0 + get_local 2 + i32.store16 + i32.const 0 + i32.load16_s + set_local 3 + end + get_local 1 + i32.const 1 + i32.eq + if ;; label = @4 + i32.const 0 + get_local 2 + i32.store16 align=1 + i32.const 0 + i32.load16_s align=1 + set_local 3 + end + get_local 1 + i32.const 2 + i32.eq + if ;; label = @4 + i32.const 0 + get_local 2 + i32.store16 + i32.const 0 + i32.load16_s + set_local 3 + end + br 2 (;@1;) + end + get_local 1 + i32.const 0 + i32.eq + if ;; label = @3 + i32.const 0 + get_local 2 + i32.store16 + i32.const 0 + i32.load16_u + set_local 3 + end + get_local 1 + i32.const 1 + i32.eq + if ;; label = @3 + i32.const 0 + get_local 2 + i32.store16 align=1 + i32.const 0 + i32.load16_u align=1 + set_local 3 + end + get_local 1 + i32.const 2 + i32.eq + if ;; label = @3 + i32.const 0 + get_local 2 + i32.store16 + i32.const 0 + i32.load16_u + set_local 3 + end + br 1 (;@1;) + end + get_local 1 + i32.const 0 + i32.eq + if ;; label = @2 + i32.const 0 + get_local 2 + i32.store + i32.const 0 + i32.load + set_local 3 + end + get_local 1 + i32.const 1 + i32.eq + if ;; label = @2 + i32.const 0 + get_local 2 + i32.store align=1 + i32.const 0 + i32.load align=1 + set_local 3 + end + get_local 1 + i32.const 2 + i32.eq + if ;; label = @2 + i32.const 0 + get_local 2 + i32.store align=2 + i32.const 0 + i32.load align=2 + set_local 3 + end + get_local 1 + i32.const 4 + i32.eq + if ;; label = @2 + i32.const 0 + get_local 2 + i32.store + i32.const 0 + i32.load + set_local 3 + end + end + get_local 3) + (func (;3;) (type 3) (param i32 i32) (result i64) + (local i64 i64) + i64.const 10 + set_local 2 + block ;; label = @1 + block ;; label = @2 + block ;; label = @3 + block ;; label = @4 + block ;; label = @5 + block ;; label = @6 + block ;; label = @7 + block ;; label = @8 + get_local 0 + br_table 0 (;@8;) 1 (;@7;) 2 (;@6;) 3 (;@5;) 4 (;@4;) 5 (;@3;) 6 (;@2;) 7 (;@1;) + end + get_local 1 + i32.const 0 + i32.eq + if ;; label = @8 + i32.const 0 + get_local 2 + i64.store8 + i32.const 0 + i64.load8_s + set_local 3 + end + get_local 1 + i32.const 1 + i32.eq + if ;; label = @8 + i32.const 0 + get_local 2 + i64.store8 + i32.const 0 + i64.load8_s + set_local 3 + end + br 6 (;@1;) + end + get_local 1 + i32.const 0 + i32.eq + if ;; label = @7 + i32.const 0 + get_local 2 + i64.store8 + i32.const 0 + i64.load8_u + set_local 3 + end + get_local 1 + i32.const 1 + i32.eq + if ;; label = @7 + i32.const 0 + get_local 2 + i64.store8 + i32.const 0 + i64.load8_u + set_local 3 + end + br 5 (;@1;) + end + get_local 1 + i32.const 0 + i32.eq + if ;; label = @6 + i32.const 0 + get_local 2 + i64.store16 + i32.const 0 + i64.load16_s + set_local 3 + end + get_local 1 + i32.const 1 + i32.eq + if ;; label = @6 + i32.const 0 + get_local 2 + i64.store16 align=1 + i32.const 0 + i64.load16_s align=1 + set_local 3 + end + get_local 1 + i32.const 2 + i32.eq + if ;; label = @6 + i32.const 0 + get_local 2 + i64.store16 + i32.const 0 + i64.load16_s + set_local 3 + end + br 4 (;@1;) + end + get_local 1 + i32.const 0 + i32.eq + if ;; label = @5 + i32.const 0 + get_local 2 + i64.store16 + i32.const 0 + i64.load16_u + set_local 3 + end + get_local 1 + i32.const 1 + i32.eq + if ;; label = @5 + i32.const 0 + get_local 2 + i64.store16 align=1 + i32.const 0 + i64.load16_u align=1 + set_local 3 + end + get_local 1 + i32.const 2 + i32.eq + if ;; label = @5 + i32.const 0 + get_local 2 + i64.store16 + i32.const 0 + i64.load16_u + set_local 3 + end + br 3 (;@1;) + end + get_local 1 + i32.const 0 + i32.eq + if ;; label = @4 + i32.const 0 + get_local 2 + i64.store32 + i32.const 0 + i64.load32_s + set_local 3 + end + get_local 1 + i32.const 1 + i32.eq + if ;; label = @4 + i32.const 0 + get_local 2 + i64.store32 align=1 + i32.const 0 + i64.load32_s align=1 + set_local 3 + end + get_local 1 + i32.const 2 + i32.eq + if ;; label = @4 + i32.const 0 + get_local 2 + i64.store32 align=2 + i32.const 0 + i64.load32_s align=2 + set_local 3 + end + get_local 1 + i32.const 4 + i32.eq + if ;; label = @4 + i32.const 0 + get_local 2 + i64.store32 + i32.const 0 + i64.load32_s + set_local 3 + end + br 2 (;@1;) + end + get_local 1 + i32.const 0 + i32.eq + if ;; label = @3 + i32.const 0 + get_local 2 + i64.store32 + i32.const 0 + i64.load32_u + set_local 3 + end + get_local 1 + i32.const 1 + i32.eq + if ;; label = @3 + i32.const 0 + get_local 2 + i64.store32 align=1 + i32.const 0 + i64.load32_u align=1 + set_local 3 + end + get_local 1 + i32.const 2 + i32.eq + if ;; label = @3 + i32.const 0 + get_local 2 + i64.store32 align=2 + i32.const 0 + i64.load32_u align=2 + set_local 3 + end + get_local 1 + i32.const 4 + i32.eq + if ;; label = @3 + i32.const 0 + get_local 2 + i64.store32 + i32.const 0 + i64.load32_u + set_local 3 + end + br 1 (;@1;) + end + get_local 1 + i32.const 0 + i32.eq + if ;; label = @2 + i32.const 0 + get_local 2 + i64.store + i32.const 0 + i64.load + set_local 3 + end + get_local 1 + i32.const 1 + i32.eq + if ;; label = @2 + i32.const 0 + get_local 2 + i64.store align=1 + i32.const 0 + i64.load align=1 + set_local 3 + end + get_local 1 + i32.const 2 + i32.eq + if ;; label = @2 + i32.const 0 + get_local 2 + i64.store align=2 + i32.const 0 + i64.load align=2 + set_local 3 + end + get_local 1 + i32.const 4 + i32.eq + if ;; label = @2 + i32.const 0 + get_local 2 + i64.store align=4 + i32.const 0 + i64.load align=4 + set_local 3 + end + get_local 1 + i32.const 8 + i32.eq + if ;; label = @2 + i32.const 0 + get_local 2 + i64.store + i32.const 0 + i64.load + set_local 3 + end + end + get_local 3) + (memory (;0;) 1) + (export \"f32_align_switch\" (func 0)) + (export \"f64_align_switch\" (func 1)) + (export \"i32_align_switch\" (func 2)) + (export \"i64_align_switch\" (func 3))) + "; + let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); + instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") +} + +// Line 802 +fn l802_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l802_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("f32_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &VmCtx) -> f32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(0 as i32, &vm_context); + assert_eq!(result, 10.0 as f32); +} + +// Line 803 +fn l803_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l803_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("f32_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &VmCtx) -> f32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(1 as i32, &vm_context); + assert_eq!(result, 10.0 as f32); +} + +// Line 804 +fn l804_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l804_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("f32_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &VmCtx) -> f32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(2 as i32, &vm_context); + assert_eq!(result, 10.0 as f32); +} + +// Line 805 +fn l805_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l805_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("f32_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &VmCtx) -> f32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(3 as i32, &vm_context); + assert_eq!(result, 10.0 as f32); +} + +// Line 807 +fn l807_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l807_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("f64_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &VmCtx) -> f64 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(0 as i32, &vm_context); + assert_eq!(result, 10.0 as f64); +} + +// Line 808 +fn l808_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l808_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("f64_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &VmCtx) -> f64 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(1 as i32, &vm_context); + assert_eq!(result, 10.0 as f64); +} + +// Line 809 +fn l809_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l809_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("f64_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &VmCtx) -> f64 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(2 as i32, &vm_context); + assert_eq!(result, 10.0 as f64); +} + +// Line 810 +fn l810_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l810_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("f64_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &VmCtx) -> f64 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(3 as i32, &vm_context); + assert_eq!(result, 10.0 as f64); +} + +// Line 811 +fn l811_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l811_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("f64_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &VmCtx) -> f64 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(4 as i32, &vm_context); + assert_eq!(result, 10.0 as f64); +} + +// Line 813 +fn l813_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l813_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("i32_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(0 as i32, 0 as i32, &vm_context); + assert_eq!(result, 10 as i32); +} + +// Line 814 +fn l814_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l814_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("i32_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(0 as i32, 1 as i32, &vm_context); + assert_eq!(result, 10 as i32); +} + +// Line 815 +fn l815_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l815_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("i32_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(1 as i32, 0 as i32, &vm_context); + assert_eq!(result, 10 as i32); +} + +// Line 816 +fn l816_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l816_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("i32_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(1 as i32, 1 as i32, &vm_context); + assert_eq!(result, 10 as i32); +} + +// Line 817 +fn l817_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l817_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("i32_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(2 as i32, 0 as i32, &vm_context); + assert_eq!(result, 10 as i32); +} + +// Line 818 +fn l818_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l818_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("i32_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(2 as i32, 1 as i32, &vm_context); + assert_eq!(result, 10 as i32); +} + +// Line 819 +fn l819_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l819_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("i32_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(2 as i32, 2 as i32, &vm_context); + assert_eq!(result, 10 as i32); +} + +// Line 820 +fn l820_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l820_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("i32_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(3 as i32, 0 as i32, &vm_context); + assert_eq!(result, 10 as i32); +} + +// Line 821 +fn l821_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l821_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("i32_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(3 as i32, 1 as i32, &vm_context); + assert_eq!(result, 10 as i32); +} + +// Line 822 +fn l822_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l822_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("i32_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(3 as i32, 2 as i32, &vm_context); + assert_eq!(result, 10 as i32); +} + +// Line 823 +fn l823_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l823_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("i32_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(4 as i32, 0 as i32, &vm_context); + assert_eq!(result, 10 as i32); +} + +// Line 824 +fn l824_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l824_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("i32_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(4 as i32, 1 as i32, &vm_context); + assert_eq!(result, 10 as i32); +} + +// Line 825 +fn l825_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l825_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("i32_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(4 as i32, 2 as i32, &vm_context); + assert_eq!(result, 10 as i32); +} + +// Line 826 +fn l826_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l826_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("i32_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &VmCtx) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(4 as i32, 4 as i32, &vm_context); + assert_eq!(result, 10 as i32); +} + +// Line 828 +fn l828_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l828_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("i64_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &VmCtx) -> i64 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(0 as i32, 0 as i32, &vm_context); + assert_eq!(result, 10 as i64); +} + +// Line 829 +fn l829_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l829_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("i64_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &VmCtx) -> i64 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(0 as i32, 1 as i32, &vm_context); + assert_eq!(result, 10 as i64); +} + +// Line 830 +fn l830_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l830_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("i64_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &VmCtx) -> i64 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(1 as i32, 0 as i32, &vm_context); + assert_eq!(result, 10 as i64); +} + +// Line 831 +fn l831_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l831_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("i64_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &VmCtx) -> i64 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(1 as i32, 1 as i32, &vm_context); + assert_eq!(result, 10 as i64); +} + +// Line 832 +fn l832_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l832_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("i64_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &VmCtx) -> i64 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(2 as i32, 0 as i32, &vm_context); + assert_eq!(result, 10 as i64); +} + +// Line 833 +fn l833_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l833_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("i64_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &VmCtx) -> i64 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(2 as i32, 1 as i32, &vm_context); + assert_eq!(result, 10 as i64); +} + +// Line 834 +fn l834_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l834_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("i64_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &VmCtx) -> i64 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(2 as i32, 2 as i32, &vm_context); + assert_eq!(result, 10 as i64); +} + +// Line 835 +fn l835_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l835_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("i64_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &VmCtx) -> i64 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(3 as i32, 0 as i32, &vm_context); + assert_eq!(result, 10 as i64); +} + +// Line 836 +fn l836_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l836_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("i64_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &VmCtx) -> i64 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(3 as i32, 1 as i32, &vm_context); + assert_eq!(result, 10 as i64); +} + +// Line 837 +fn l837_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l837_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("i64_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &VmCtx) -> i64 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(3 as i32, 2 as i32, &vm_context); + assert_eq!(result, 10 as i64); +} + +// Line 838 +fn l838_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l838_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("i64_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &VmCtx) -> i64 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(4 as i32, 0 as i32, &vm_context); + assert_eq!(result, 10 as i64); +} + +// Line 839 +fn l839_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l839_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("i64_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &VmCtx) -> i64 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(4 as i32, 1 as i32, &vm_context); + assert_eq!(result, 10 as i64); +} + +// Line 840 +fn l840_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l840_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("i64_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &VmCtx) -> i64 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(4 as i32, 2 as i32, &vm_context); + assert_eq!(result, 10 as i64); +} + +// Line 841 +fn l841_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l841_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("i64_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &VmCtx) -> i64 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(4 as i32, 4 as i32, &vm_context); + assert_eq!(result, 10 as i64); +} + +// Line 842 +fn l842_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l842_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("i64_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &VmCtx) -> i64 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(5 as i32, 0 as i32, &vm_context); + assert_eq!(result, 10 as i64); +} + +// Line 843 +fn l843_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l843_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("i64_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &VmCtx) -> i64 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(5 as i32, 1 as i32, &vm_context); + assert_eq!(result, 10 as i64); +} + +// Line 844 +fn l844_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l844_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("i64_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &VmCtx) -> i64 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(5 as i32, 2 as i32, &vm_context); + assert_eq!(result, 10 as i64); +} + +// Line 845 +fn l845_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l845_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("i64_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &VmCtx) -> i64 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(5 as i32, 4 as i32, &vm_context); + assert_eq!(result, 10 as i64); +} + +// Line 846 +fn l846_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l846_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("i64_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &VmCtx) -> i64 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(6 as i32, 0 as i32, &vm_context); + assert_eq!(result, 10 as i64); +} + +// Line 847 +fn l847_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l847_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("i64_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &VmCtx) -> i64 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(6 as i32, 1 as i32, &vm_context); + assert_eq!(result, 10 as i64); +} + +// Line 848 +fn l848_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l848_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("i64_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &VmCtx) -> i64 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(6 as i32, 2 as i32, &vm_context); + assert_eq!(result, 10 as i64); +} + +// Line 849 +fn l849_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l849_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("i64_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &VmCtx) -> i64 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(6 as i32, 4 as i32, &vm_context); + assert_eq!(result, 10 as i64); +} + +// Line 850 +fn l850_assert_return_invoke(result_object: &ResultObject, vm_context: &VmCtx) { + println!("Executing function {}", "l850_assert_return_invoke"); + let func_index = match result_object.module.info.exports.get("i64_align_switch") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &VmCtx) -> i64 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(6 as i32, 8 as i32, &vm_context); + assert_eq!(result, 10 as i64); +} + +#[test] +fn test_module_24() { + let result_object = create_module_24(); + let vm_context = result_object.instance.generate_context(); + // We group the calls together + l802_assert_return_invoke(&result_object, &vm_context); + l803_assert_return_invoke(&result_object, &vm_context); + l804_assert_return_invoke(&result_object, &vm_context); + l805_assert_return_invoke(&result_object, &vm_context); + l807_assert_return_invoke(&result_object, &vm_context); + l808_assert_return_invoke(&result_object, &vm_context); + l809_assert_return_invoke(&result_object, &vm_context); + l810_assert_return_invoke(&result_object, &vm_context); + l811_assert_return_invoke(&result_object, &vm_context); + l813_assert_return_invoke(&result_object, &vm_context); + l814_assert_return_invoke(&result_object, &vm_context); + l815_assert_return_invoke(&result_object, &vm_context); + l816_assert_return_invoke(&result_object, &vm_context); + l817_assert_return_invoke(&result_object, &vm_context); + l818_assert_return_invoke(&result_object, &vm_context); + l819_assert_return_invoke(&result_object, &vm_context); + l820_assert_return_invoke(&result_object, &vm_context); + l821_assert_return_invoke(&result_object, &vm_context); + l822_assert_return_invoke(&result_object, &vm_context); + l823_assert_return_invoke(&result_object, &vm_context); + l824_assert_return_invoke(&result_object, &vm_context); + l825_assert_return_invoke(&result_object, &vm_context); + l826_assert_return_invoke(&result_object, &vm_context); + l828_assert_return_invoke(&result_object, &vm_context); + l829_assert_return_invoke(&result_object, &vm_context); + l830_assert_return_invoke(&result_object, &vm_context); + l831_assert_return_invoke(&result_object, &vm_context); + l832_assert_return_invoke(&result_object, &vm_context); + l833_assert_return_invoke(&result_object, &vm_context); + l834_assert_return_invoke(&result_object, &vm_context); + l835_assert_return_invoke(&result_object, &vm_context); + l836_assert_return_invoke(&result_object, &vm_context); + l837_assert_return_invoke(&result_object, &vm_context); + l838_assert_return_invoke(&result_object, &vm_context); + l839_assert_return_invoke(&result_object, &vm_context); + l840_assert_return_invoke(&result_object, &vm_context); + l841_assert_return_invoke(&result_object, &vm_context); + l842_assert_return_invoke(&result_object, &vm_context); + l843_assert_return_invoke(&result_object, &vm_context); + l844_assert_return_invoke(&result_object, &vm_context); + l845_assert_return_invoke(&result_object, &vm_context); + l846_assert_return_invoke(&result_object, &vm_context); + l847_assert_return_invoke(&result_object, &vm_context); + l848_assert_return_invoke(&result_object, &vm_context); + l849_assert_return_invoke(&result_object, &vm_context); + l850_assert_return_invoke(&result_object, &vm_context); +} diff --git a/src/spectests/mod.rs b/src/spectests/mod.rs index 0e4c9a7a5..9df5dd42b 100644 --- a/src/spectests/mod.rs +++ b/src/spectests/mod.rs @@ -3,6 +3,7 @@ // The _common module is not autogenerated, as it provides common functions for the spectests mod _common; +mod align; mod block; mod br; mod br_if; diff --git a/src/webassembly/memory.rs b/src/webassembly/memory.rs index 978cc43ab..0dac6aaf3 100644 --- a/src/webassembly/memory.rs +++ b/src/webassembly/memory.rs @@ -30,6 +30,11 @@ pub struct LinearMemory { /// It holds the raw bytes of memory accessed by a WebAssembly Instance impl LinearMemory { + pub const WASM_PAGE_SIZE: usize = 1 << 16; // 64 KiB + pub const DEFAULT_HEAP_SIZE: usize = 1 << 32; // 4 GiB + pub const DEFAULT_GUARD_SIZE: usize = 1 << 31; // 2 GiB + pub const DEFAULT_SIZE: usize = Self::DEFAULT_HEAP_SIZE + Self::DEFAULT_GUARD_SIZE; // 8GiB + /// Create a new linear memory instance with specified initial and maximum number of pages. /// /// `maximum` cannot be set to more than `65536` pages. diff --git a/src/webassembly/module.rs b/src/webassembly/module.rs index b9f535ff5..ee9c3e05f 100644 --- a/src/webassembly/module.rs +++ b/src/webassembly/module.rs @@ -37,6 +37,7 @@ use cranelift_wasm::{ }; use super::errors::ErrorKind; +use super::memory::LinearMemory; /// Compute a `ir::ExternalName` for a given wasm function index. fn get_func_name(func_index: FuncIndex) -> ir::ExternalName { @@ -356,9 +357,9 @@ impl<'environment> FuncEnvironmentTrait for FuncEnvironment<'environment> { func.create_heap(ir::HeapData { base: base, min_size: Imm64::new(0), - guard_size: Imm64::new(0x8000_0000), + guard_size: Imm64::new(LinearMemory::DEFAULT_GUARD_SIZE as i64), style: ir::HeapStyle::Static { - bound: Imm64::new(0x1_0000_0000), + bound: Imm64::new(LinearMemory::DEFAULT_HEAP_SIZE as i64), }, index_type: I32, })