Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Allow extra args on branches #192

Merged
merged 1 commit into from
Feb 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions proposals/gc/MVP.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,25 +325,25 @@ Tentatively, support a type of guaranteed unboxed scalars.
- `ref.is_i31 : [anyref] -> [i32]`

* `br_on_func <labelidx>` branches if a reference is a function
- `br_on_func $l : [t] -> [t]`
- iff `$l : [t']`
- `br_on_func $l : [t0* t] -> [t0* t]`
- iff `$l : [t0* t']`
- and `t <: anyref`
- and `(ref func) <: t'`
- passes operand along with branch as a function
- passes operand along with branch as a function, plus possible extra args

* `br_on_data <labelidx>` branches if a reference is compound data
- `br_on_data $l : [t] -> [t]`
- iff `$l : [t']`
- `br_on_data $l : [t0* t] -> [t0* t]`
- iff `$l : [t0* t']`
- and `t <: anyref`
- and `(ref data) <: t'`
- passes operand along with branch as data
- passes operand along with branch as data, plus possible extra args

* `br_on_i31 <labelidx>` branches if a reference is an integer
- `br_on_i31 $l : [t] -> [t]`
- iff `$l : [t']`
- `br_on_i31 $l : [t0* t] -> [t0* t]`
- iff `$l : [t0* t']`
- and `t <: anyref`
- and `(ref i31) <: t'`
- passes operand along with branch as a scalar
- passes operand along with branch as a scalar, plus possible extra args

* `ref.as_func` converts to a function reference
- `ref.as_func : [anyref] -> [(ref func)]`
Expand Down Expand Up @@ -400,12 +400,12 @@ RTT-based casts can only be performed with respect to concrete types, and requir
- traps if the first operand is not null and its runtime type is not a sub-RTT of the RTT operand

* `br_on_cast <labelidx>` branches if a value can be cast down to a given reference type
- `br_on_cast $l : [t (rtt n? $t')] -> [t]`
- iff `$l : [t']`
- `br_on_cast $l : [t0* t (rtt n? $t')] -> [t0* t]`
- iff `$l : [t0* t']`
- and `t <: (ref null data)` or `t <: (ref null func)`
- and `(ref $t') <: t'`
- branches iff the first operand is not null and its runtime type is a sub-RTT of the RTT operand
- passes cast operand along with branch
- passes cast operand along with branch, plus possible extra args

Note: These instructions allow an operand of unrelated reference type, even though this cannot possibly succeed. The reasoning is the same as for classification instructions.

Expand Down