File tree Expand file tree Collapse file tree 3 files changed +30
-6
lines changed Expand file tree Collapse file tree 3 files changed +30
-6
lines changed Original file line number Diff line number Diff line change 28
28
(global $~lib/rt/itcms/fromSpace (mut i32 ) (i32.const 0 ))
29
29
(global $~lib/rt/tlsf/ROOT (mut i32 ) (i32.const 0 ))
30
30
(global $~lib/native/ASC_LOW_MEMORY_LIMIT i32 (i32.const 0 ))
31
+ (global $logical/foo (mut i32 ) (i32.const 456 ))
32
+ (global $logical/bar (mut f64 ) (f64.const -0 ))
33
+ (global $logical/baz (mut i32 ) (i32.const 321 ))
34
+ (global $logical/qux (mut f64 ) (f64.const 2.718 ))
31
35
(global $logical/b (mut i32 ) (i32.const 0 ))
32
36
(global $logical/c (mut i32 ) (i32.const 0 ))
33
37
(global $~lib/rt/__rtti_base i32 (i32.const 464 ))
47
51
(data $9 (i32.const 464 ) " \08\00\00\00 \00\00\00 \00\00\00 \00\00\00\00\00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 " )
48
52
(table $0 1 1 funcref )
49
53
(elem $0 (i32.const 1 ))
54
+ (export " foo" (global $logical/foo ))
55
+ (export " bar" (global $logical/bar ))
56
+ (export " baz" (global $logical/baz ))
57
+ (export " qux" (global $logical/qux ))
50
58
(export " memory" (memory $0 ))
51
59
(start $~start )
52
60
(func $logical/testShortcutAnd (param $a i64 ) (param $b i32 ) (result i32 )
2926
2934
if
2927
2935
i32.const 0
2928
2936
i32.const 32
2929
- i32.const 106
2937
+ i32.const 114
2930
2938
i32.const 1
2931
2939
call $~lib/builtins/abort
2932
2940
unreachable
2939
2947
if
2940
2948
i32.const 0
2941
2949
i32.const 32
2942
- i32.const 107
2950
+ i32.const 115
2943
2951
i32.const 1
2944
2952
call $~lib/builtins/abort
2945
2953
unreachable
2957
2965
if
2958
2966
i32.const 0
2959
2967
i32.const 32
2960
- i32.const 112
2968
+ i32.const 120
2961
2969
i32.const 1
2962
2970
call $~lib/builtins/abort
2963
2971
unreachable
2970
2978
if
2971
2979
i32.const 0
2972
2980
i32.const 32
2973
- i32.const 113
2981
+ i32.const 121
2974
2982
i32.const 1
2975
2983
call $~lib/builtins/abort
2976
2984
unreachable
Original file line number Diff line number Diff line change 17
17
(global $~lib/rt/itcms/white (mut i32 ) (i32.const 0 ))
18
18
(global $~lib/rt/itcms/fromSpace (mut i32 ) (i32.const 0 ))
19
19
(global $~lib/rt/tlsf/ROOT (mut i32 ) (i32.const 0 ))
20
+ (global $logical/foo (mut i32 ) (i32.const 456 ))
21
+ (global $logical/bar (mut f64 ) (f64.const -0 ))
22
+ (global $logical/baz (mut i32 ) (i32.const 321 ))
23
+ (global $logical/qux (mut f64 ) (f64.const 2.718 ))
20
24
(global $logical/b (mut i32 ) (i32.const 0 ))
21
25
(global $logical/c (mut i32 ) (i32.const 0 ))
22
26
(global $~lib/memory/__stack_pointer (mut i32 ) (i32.const 34292 ))
34
38
(data $8 (i32.const 1420 ) " <" )
35
39
(data $8.1 (i32.const 1432 ) " \02\00\00\00\1e\00\00\00 ~\00 l\00 i\00 b\00 /\00 r\00 t\00 /\00 t\00 l\00 s\00 f\00 .\00 t\00 s" )
36
40
(data $9 (i32.const 1488 ) " \08\00\00\00 \00\00\00 \00\00\00 \00\00\00\00\00\00\00 \00\00\00 \00\00\00 \00\00\00 " )
41
+ (export " foo" (global $logical/foo ))
42
+ (export " bar" (global $logical/bar ))
43
+ (export " baz" (global $logical/baz ))
44
+ (export " qux" (global $logical/qux ))
37
45
(export " memory" (memory $0 ))
38
46
(start $~start )
39
47
(func $~lib/rt/itcms/visitRoots
1568
1576
if
1569
1577
i32.const 0
1570
1578
i32.const 1056
1571
- i32.const 106
1579
+ i32.const 114
1572
1580
i32.const 1
1573
1581
call $~lib/builtins/abort
1574
1582
unreachable
1586
1594
if
1587
1595
i32.const 0
1588
1596
i32.const 1056
1589
- i32.const 112
1597
+ i32.const 120
1590
1598
i32.const 1
1591
1599
call $~lib/builtins/abort
1592
1600
unreachable
Original file line number Diff line number Diff line change @@ -91,6 +91,14 @@ function testContextualBoolOr(someObj: Obj, someInt: i32): bool {
91
91
}
92
92
assert ( testContextualBoolOr ( new Obj ( ) , 0 ) ) ;
93
93
94
+ // Test simplification with precomputable LHS operands
95
+ // see: https://github.com/AssemblyScript/assemblyscript/issues/2946
96
+
97
+ export let foo = 123 && 456 ;
98
+ export let bar = - 0.0 && 1.23 ;
99
+ export let baz = 321 || 654 ;
100
+ export let qux = NaN || 2.718 ;
101
+
94
102
// Common type
95
103
96
104
class A { }
You can’t perform that action at this time.
0 commit comments