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

Make ref.cast succeed on null #161

Merged
merged 1 commit into from
Nov 19, 2020
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
6 changes: 4 additions & 2 deletions proposals/gc/MVP.md
Original file line number Diff line number Diff line change
Expand Up @@ -382,10 +382,12 @@ RTT-based casts can only be performed with respect to concrete types, and requir
- returns 1 if the first operand is not null and its runtime type is a sub-RTT of the RTT operand, 0 otherwise

* `ref.cast <typeidx>` casts a reference value down to a type given by a RTT representation
- `ref.cast $t : [(ref null ht) (rtt n? $t)] -> [(ref $t)]`
- `ref.cast $t : [(ref null1? ht) (rtt n? $t)] -> [(ref null2? $t)]`
- iff `ht <: data` or `ht <: func`
- and `(type $t) <: ht`
- traps if the first operand is null or its runtime type is not a sub-RTT of the RTT operand
- and `null1? = null2?`
- returns null if the first operand is null
- 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> <typeidx>` branches if a value can be cast down to a given reference type
- `br_on_cast $l $t : [(ref null ht) (rtt n? $t)] -> [(ref null ht)]`
Expand Down