Skip to content

Commit

Permalink
Merge pull request #527 from tanishiking/fix-ref-cast-mvp
Browse files Browse the repository at this point in the history
Fix an example code for ref.cast in MVP.md
  • Loading branch information
rossberg authored Feb 26, 2024
2 parents 0ba84fb + c2e70ce commit 60edc79
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion proposals/gc/MVP.md
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ Then, `$rttA` would carry supertype vector `[$rttA]`, `$rttB` has `[$rttA, $rttB
Now consider a function that casts a `$B` to a `$C`:
```
(func $castBtoC (param $x (ref $B)) (result (ref $C))
(ref.cast $C (local.get $x))
(ref.cast (ref $C) (local.get $x))
)
```
This can compile to machine code that (1) reads the RTT from `$x`, (2) checks that the length of its supertype table is >= 3, and (3) pointer-compares table[2] against `$rttC`.
Expand Down

0 comments on commit 60edc79

Please sign in to comment.