Skip to content

Commit ef01f2b

Browse files
authored
fix: remove non-zero check before __visit (#2933)
1 parent 3defefd commit ef01f2b

File tree

169 files changed

+1058
-1963
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

169 files changed

+1058
-1963
lines changed

src/builtins.ts

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10808,20 +10808,14 @@ function ensureVisitMembersOf(compiler: Compiler, instance: Class): void {
1080810808
assert(fieldOffset >= 0);
1080910809
needsTempValue = true;
1081010810
body.push(
10811-
// if ($2 = value) __visit($2, $1)
10812-
module.if(
10813-
module.local_tee(2,
10814-
module.load(sizeTypeSize, false,
10815-
module.local_get(0, sizeTypeRef),
10816-
sizeTypeRef, fieldOffset
10817-
),
10818-
false // internal
10819-
),
10820-
module.call(visitInstance.internalName, [
10821-
module.local_get(2, sizeTypeRef), // value
10822-
module.local_get(1, TypeRef.I32) // cookie
10823-
], TypeRef.None)
10824-
)
10811+
// __visit(load<usize>($this, fieldOffset), $cookie)
10812+
module.call(visitInstance.internalName, [
10813+
module.load(sizeTypeSize, false,
10814+
module.local_get(0, sizeTypeRef),
10815+
sizeTypeRef, fieldOffset
10816+
), // value
10817+
module.local_get(1, TypeRef.I32) // cookie
10818+
], TypeRef.None)
1082510819
);
1082610820
}
1082710821
}

tests/compiler/assignment-chain.debug.wat

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2349,12 +2349,8 @@
23492349
call $~lib/object/Object~visit
23502350
local.get $0
23512351
i32.load
2352-
local.tee $2
2353-
if
2354-
local.get $2
2355-
local.get $1
2356-
call $~lib/rt/itcms/__visit
2357-
end
2352+
local.get $1
2353+
call $~lib/rt/itcms/__visit
23582354
)
23592355
(func $~lib/object/Object~visit (param $0 i32) (param $1 i32)
23602356
)

tests/compiler/assignment-chain.release.wat

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1570,11 +1570,7 @@
15701570
end
15711571
local.get $0
15721572
i32.load
1573-
local.tee $0
1574-
if
1575-
local.get $0
1576-
call $~lib/rt/itcms/__visit
1577-
end
1573+
call $~lib/rt/itcms/__visit
15781574
return
15791575
end
15801576
return

tests/compiler/bindings/esm.debug.wat

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2874,12 +2874,8 @@
28742874
call $~lib/object/Object~visit
28752875
local.get $0
28762876
i32.load
2877-
local.tee $2
2878-
if
2879-
local.get $2
2880-
local.get $1
2881-
call $~lib/rt/itcms/__visit
2882-
end
2877+
local.get $1
2878+
call $~lib/rt/itcms/__visit
28832879
)
28842880
(func $~lib/object/Object~visit (param $0 i32) (param $1 i32)
28852881
)
@@ -2941,28 +2937,16 @@
29412937
call $~lib/object/Object~visit
29422938
local.get $0
29432939
i32.load offset=56
2944-
local.tee $2
2945-
if
2946-
local.get $2
2947-
local.get $1
2948-
call $~lib/rt/itcms/__visit
2949-
end
2940+
local.get $1
2941+
call $~lib/rt/itcms/__visit
29502942
local.get $0
29512943
i32.load offset=60
2952-
local.tee $2
2953-
if
2954-
local.get $2
2955-
local.get $1
2956-
call $~lib/rt/itcms/__visit
2957-
end
2944+
local.get $1
2945+
call $~lib/rt/itcms/__visit
29582946
local.get $0
29592947
i32.load offset=64
2960-
local.tee $2
2961-
if
2962-
local.get $2
2963-
local.get $1
2964-
call $~lib/rt/itcms/__visit
2965-
end
2948+
local.get $1
2949+
call $~lib/rt/itcms/__visit
29662950
)
29672951
(func $~lib/typedarray/Uint8Array~visit (param $0 i32) (param $1 i32)
29682952
local.get $0

tests/compiler/bindings/esm.release.wat

Lines changed: 14 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2006,25 +2006,13 @@
20062006
end
20072007
local.get $0
20082008
i32.load offset=56
2009-
local.tee $1
2010-
if
2011-
local.get $1
2012-
call $~lib/rt/itcms/__visit
2013-
end
2009+
call $~lib/rt/itcms/__visit
20142010
local.get $0
20152011
i32.load offset=60
2016-
local.tee $1
2017-
if
2018-
local.get $1
2019-
call $~lib/rt/itcms/__visit
2020-
end
2012+
call $~lib/rt/itcms/__visit
20212013
local.get $0
20222014
i32.load offset=64
2023-
local.tee $0
2024-
if
2025-
local.get $0
2026-
call $~lib/rt/itcms/__visit
2027-
end
2015+
call $~lib/rt/itcms/__visit
20282016
return
20292017
end
20302018
return
@@ -2040,11 +2028,7 @@
20402028
end
20412029
local.get $0
20422030
i32.load
2043-
local.tee $0
2044-
if
2045-
local.get $0
2046-
call $~lib/rt/itcms/__visit
2047-
end
2031+
call $~lib/rt/itcms/__visit
20482032
return
20492033
end
20502034
global.get $~lib/memory/__stack_pointer
@@ -2208,7 +2192,7 @@
22082192
global.get $~lib/memory/__stack_pointer
22092193
local.get $1
22102194
i32.store
2211-
block $__inlined_func$~lib/string/String#concat$280
2195+
block $__inlined_func$~lib/string/String#concat$285
22122196
local.get $1
22132197
i32.const 20
22142198
i32.sub
@@ -2227,7 +2211,7 @@
22272211
global.set $~lib/memory/__stack_pointer
22282212
i32.const 1760
22292213
local.set $2
2230-
br $__inlined_func$~lib/string/String#concat$280
2214+
br $__inlined_func$~lib/string/String#concat$285
22312215
end
22322216
global.get $~lib/memory/__stack_pointer
22332217
local.get $2
@@ -2414,7 +2398,7 @@
24142398
global.get $~lib/memory/__stack_pointer
24152399
local.get $1
24162400
i32.store
2417-
block $__inlined_func$~lib/typedarray/Uint64Array#constructor$1 (result i32)
2401+
block $__inlined_func$~lib/typedarray/Uint64Array#constructor (result i32)
24182402
local.get $1
24192403
call $~lib/typedarray/Float32Array#get:length
24202404
local.get $5
@@ -2544,7 +2528,7 @@
25442528
i32.add
25452529
global.set $~lib/memory/__stack_pointer
25462530
local.get $2
2547-
br $__inlined_func$~lib/typedarray/Uint64Array#constructor$1
2531+
br $__inlined_func$~lib/typedarray/Uint64Array#constructor
25482532
end
25492533
br $folding-inner1
25502534
end
@@ -2941,7 +2925,7 @@
29412925
global.get $~lib/memory/__stack_pointer
29422926
local.get $0
29432927
i32.store
2944-
block $__inlined_func$~lib/rt/itcms/__renew$265
2928+
block $__inlined_func$~lib/rt/itcms/__renew$270
29452929
i32.const 1073741820
29462930
local.get $2
29472931
i32.const 1
@@ -2984,7 +2968,7 @@
29842968
i32.store offset=16
29852969
local.get $2
29862970
local.set $1
2987-
br $__inlined_func$~lib/rt/itcms/__renew$265
2971+
br $__inlined_func$~lib/rt/itcms/__renew$270
29882972
end
29892973
local.get $3
29902974
local.get $4
@@ -3493,7 +3477,7 @@
34933477
global.get $~lib/memory/__stack_pointer
34943478
local.get $1
34953479
i32.store offset=4
3496-
block $__inlined_func$bindings/esm/staticarrayFunction$2 (result i32)
3480+
block $__inlined_func$bindings/esm/staticarrayFunction$1 (result i32)
34973481
global.get $~lib/memory/__stack_pointer
34983482
i32.const 12
34993483
i32.sub
@@ -3649,7 +3633,7 @@
36493633
i32.add
36503634
global.set $~lib/memory/__stack_pointer
36513635
local.get $4
3652-
br $__inlined_func$bindings/esm/staticarrayFunction$2
3636+
br $__inlined_func$bindings/esm/staticarrayFunction$1
36533637
end
36543638
br $folding-inner1
36553639
end
@@ -4222,7 +4206,7 @@
42224206
i32.const 0
42234207
i32.store offset=8
42244208
global.get $~lib/memory/__stack_pointer
4225-
block $__inlined_func$bindings/esm/PlainObject#constructor$5 (result i32)
4209+
block $__inlined_func$bindings/esm/PlainObject#constructor$4 (result i32)
42264210
global.get $~lib/memory/__stack_pointer
42274211
i32.const 8
42284212
i32.sub
@@ -4385,7 +4369,7 @@
43854369
i32.add
43864370
global.set $~lib/memory/__stack_pointer
43874371
local.get $2
4388-
br $__inlined_func$bindings/esm/PlainObject#constructor$5
4372+
br $__inlined_func$bindings/esm/PlainObject#constructor$4
43894373
end
43904374
br $folding-inner1
43914375
end

tests/compiler/bindings/noExportRuntime.debug.wat

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2469,12 +2469,8 @@
24692469
call $~lib/object/Object~visit
24702470
local.get $0
24712471
i32.load
2472-
local.tee $2
2473-
if
2474-
local.get $2
2475-
local.get $1
2476-
call $~lib/rt/itcms/__visit
2477-
end
2472+
local.get $1
2473+
call $~lib/rt/itcms/__visit
24782474
)
24792475
(func $~lib/object/Object~visit (param $0 i32) (param $1 i32)
24802476
)

0 commit comments

Comments
 (0)