This repository was archived by the owner on Nov 3, 2021. It is now read-only.
This repository was archived by the owner on Nov 3, 2021. It is now read-only.
Should local.tee / br_if preserve subtypes? #55
Closed
Description
Currently, local.tee
validation requires C.locals[x] = t
and br_if
validation requires C.labels[l] = [t?]
. This causes the following two examples to fail validation in the spec interpreter when intuitively they seem valid:
(module
(func (param $p funcref)
(local $x anyref)
(local $y funcref)
local.get $p
local.tee $x
local.set $y
)
)
(module
(func (param $p funcref)
(block $b (result anyref)
(block $c (result funcref)
local.get $p
(br_if $b (i32.const 1))
br $c
)
)
drop
)
)
If instead the =
was replaced with <:
in the abovementioned validation rules, then I think these examples would validate.
Trying to think if this actually matters, you could imagine that it would be useful to have the property that:
(local.set $local1 (local.get $x))
(local.set $local2 (local.get $x))
was always equivalent to:
(local.tee $local1 (local.get $x))
local.set $local2
so that a size-optimizer could simply recognize and replace this pattern.
Metadata
Metadata
Assignees
Labels
No labels