Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 8 additions & 14 deletions src/builtins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10808,20 +10808,14 @@ function ensureVisitMembersOf(compiler: Compiler, instance: Class): void {
assert(fieldOffset >= 0);
needsTempValue = true;
body.push(
// if ($2 = value) __visit($2, $1)
module.if(
module.local_tee(2,
module.load(sizeTypeSize, false,
module.local_get(0, sizeTypeRef),
sizeTypeRef, fieldOffset
),
false // internal
),
module.call(visitInstance.internalName, [
module.local_get(2, sizeTypeRef), // value
module.local_get(1, TypeRef.I32) // cookie
], TypeRef.None)
)
// __visit(load<uszie>($0), $1)
module.call(visitInstance.internalName, [
module.load(sizeTypeSize, false,
module.local_get(0, sizeTypeRef),
sizeTypeRef, fieldOffset
), // value
module.local_get(1, TypeRef.I32) // cookie
], TypeRef.None)
);
}
}
Expand Down
8 changes: 2 additions & 6 deletions tests/compiler/assignment-chain.debug.wat
Original file line number Diff line number Diff line change
Expand Up @@ -2349,12 +2349,8 @@
call $~lib/object/Object~visit
local.get $0
i32.load
local.tee $2
if
local.get $2
local.get $1
call $~lib/rt/itcms/__visit
end
local.get $1
call $~lib/rt/itcms/__visit
)
(func $~lib/object/Object~visit (param $0 i32) (param $1 i32)
)
Expand Down
6 changes: 1 addition & 5 deletions tests/compiler/assignment-chain.release.wat
Original file line number Diff line number Diff line change
Expand Up @@ -1570,11 +1570,7 @@
end
local.get $0
i32.load
local.tee $0
if
local.get $0
call $~lib/rt/itcms/__visit
end
call $~lib/rt/itcms/__visit
return
end
return
Expand Down
32 changes: 8 additions & 24 deletions tests/compiler/bindings/esm.debug.wat
Original file line number Diff line number Diff line change
Expand Up @@ -2874,12 +2874,8 @@
call $~lib/object/Object~visit
local.get $0
i32.load
local.tee $2
if
local.get $2
local.get $1
call $~lib/rt/itcms/__visit
end
local.get $1
call $~lib/rt/itcms/__visit
)
(func $~lib/object/Object~visit (param $0 i32) (param $1 i32)
)
Expand Down Expand Up @@ -2941,28 +2937,16 @@
call $~lib/object/Object~visit
local.get $0
i32.load offset=56
local.tee $2
if
local.get $2
local.get $1
call $~lib/rt/itcms/__visit
end
local.get $1
call $~lib/rt/itcms/__visit
local.get $0
i32.load offset=60
local.tee $2
if
local.get $2
local.get $1
call $~lib/rt/itcms/__visit
end
local.get $1
call $~lib/rt/itcms/__visit
local.get $0
i32.load offset=64
local.tee $2
if
local.get $2
local.get $1
call $~lib/rt/itcms/__visit
end
local.get $1
call $~lib/rt/itcms/__visit
)
(func $~lib/typedarray/Uint8Array~visit (param $0 i32) (param $1 i32)
local.get $0
Expand Down
44 changes: 14 additions & 30 deletions tests/compiler/bindings/esm.release.wat
Original file line number Diff line number Diff line change
Expand Up @@ -2006,25 +2006,13 @@
end
local.get $0
i32.load offset=56
local.tee $1
if
local.get $1
call $~lib/rt/itcms/__visit
end
call $~lib/rt/itcms/__visit
local.get $0
i32.load offset=60
local.tee $1
if
local.get $1
call $~lib/rt/itcms/__visit
end
call $~lib/rt/itcms/__visit
local.get $0
i32.load offset=64
local.tee $0
if
local.get $0
call $~lib/rt/itcms/__visit
end
call $~lib/rt/itcms/__visit
return
end
return
Expand All @@ -2040,11 +2028,7 @@
end
local.get $0
i32.load
local.tee $0
if
local.get $0
call $~lib/rt/itcms/__visit
end
call $~lib/rt/itcms/__visit
return
end
global.get $~lib/memory/__stack_pointer
Expand Down Expand Up @@ -2208,7 +2192,7 @@
global.get $~lib/memory/__stack_pointer
local.get $1
i32.store
block $__inlined_func$~lib/string/String#concat$280
block $__inlined_func$~lib/string/String#concat$285
local.get $1
i32.const 20
i32.sub
Expand All @@ -2227,7 +2211,7 @@
global.set $~lib/memory/__stack_pointer
i32.const 1760
local.set $2
br $__inlined_func$~lib/string/String#concat$280
br $__inlined_func$~lib/string/String#concat$285
end
global.get $~lib/memory/__stack_pointer
local.get $2
Expand Down Expand Up @@ -2414,7 +2398,7 @@
global.get $~lib/memory/__stack_pointer
local.get $1
i32.store
block $__inlined_func$~lib/typedarray/Uint64Array#constructor$1 (result i32)
block $__inlined_func$~lib/typedarray/Uint64Array#constructor (result i32)
local.get $1
call $~lib/typedarray/Float32Array#get:length
local.get $5
Expand Down Expand Up @@ -2544,7 +2528,7 @@
i32.add
global.set $~lib/memory/__stack_pointer
local.get $2
br $__inlined_func$~lib/typedarray/Uint64Array#constructor$1
br $__inlined_func$~lib/typedarray/Uint64Array#constructor
end
br $folding-inner1
end
Expand Down Expand Up @@ -2941,7 +2925,7 @@
global.get $~lib/memory/__stack_pointer
local.get $0
i32.store
block $__inlined_func$~lib/rt/itcms/__renew$265
block $__inlined_func$~lib/rt/itcms/__renew$270
i32.const 1073741820
local.get $2
i32.const 1
Expand Down Expand Up @@ -2984,7 +2968,7 @@
i32.store offset=16
local.get $2
local.set $1
br $__inlined_func$~lib/rt/itcms/__renew$265
br $__inlined_func$~lib/rt/itcms/__renew$270
end
local.get $3
local.get $4
Expand Down Expand Up @@ -3493,7 +3477,7 @@
global.get $~lib/memory/__stack_pointer
local.get $1
i32.store offset=4
block $__inlined_func$bindings/esm/staticarrayFunction$2 (result i32)
block $__inlined_func$bindings/esm/staticarrayFunction$1 (result i32)
global.get $~lib/memory/__stack_pointer
i32.const 12
i32.sub
Expand Down Expand Up @@ -3649,7 +3633,7 @@
i32.add
global.set $~lib/memory/__stack_pointer
local.get $4
br $__inlined_func$bindings/esm/staticarrayFunction$2
br $__inlined_func$bindings/esm/staticarrayFunction$1
end
br $folding-inner1
end
Expand Down Expand Up @@ -4222,7 +4206,7 @@
i32.const 0
i32.store offset=8
global.get $~lib/memory/__stack_pointer
block $__inlined_func$bindings/esm/PlainObject#constructor$5 (result i32)
block $__inlined_func$bindings/esm/PlainObject#constructor$4 (result i32)
global.get $~lib/memory/__stack_pointer
i32.const 8
i32.sub
Expand Down Expand Up @@ -4385,7 +4369,7 @@
i32.add
global.set $~lib/memory/__stack_pointer
local.get $2
br $__inlined_func$bindings/esm/PlainObject#constructor$5
br $__inlined_func$bindings/esm/PlainObject#constructor$4
end
br $folding-inner1
end
Expand Down
8 changes: 2 additions & 6 deletions tests/compiler/bindings/noExportRuntime.debug.wat
Original file line number Diff line number Diff line change
Expand Up @@ -2469,12 +2469,8 @@
call $~lib/object/Object~visit
local.get $0
i32.load
local.tee $2
if
local.get $2
local.get $1
call $~lib/rt/itcms/__visit
end
local.get $1
call $~lib/rt/itcms/__visit
)
(func $~lib/object/Object~visit (param $0 i32) (param $1 i32)
)
Expand Down
Loading