Skip to content

Commit a7bf0d6

Browse files
authored
Relax branching cast type constraints (#38)
Closes #37.
1 parent db4b02d commit a7bf0d6

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

proposals/custom-descriptors/Overview.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,9 @@ br_on_cast_desc labelidx reftype reftype
388388
C |- br_on_cast_desc l rt_1 rt_2 : t* rt_1 (ref null (exact_1 y)) -> t* (rt_1 \ rt_2)
389389
-- C.labels[l] = t* rt
390390
-- C |- rt_2 <: rt
391-
-- C |- rt_2 <: rt_1
391+
-- C |- rt_1 <: rt'
392+
-- C |- rt_2 <: rt'
393+
-- C |- rt' : ok
392394
-- rt_2 = (ref null? (exact_1 x))
393395
-- C.types[x] ~ descriptor y ct
394396
```
@@ -399,11 +401,19 @@ br_on_cast_desc_fail labelidx reftype reftype
399401
C |- br_on_cast_desc_fail l rt_1 rt_2 : t* rt_1 (ref null (exact_1 y)) -> t* rt_2
400402
-- C.labels[l] = t* rt
401403
-- C |- rt_1 \ rt_2 <: rt
402-
-- C |- rt_2 <: rt_1
404+
-- C |- rt_1 <: rt'
405+
-- C |- rt_2 <: rt'
406+
-- C |- rt' : ok
403407
-- rt_2 = (ref null? (exact_1 x))
404408
-- C.types[x] ~ descriptor y ct
405409
```
406410

411+
Note that the constraint `C |- rt_2 <: rt_1` on branching cast instructions before this proposal
412+
is relaxed to the constraint that `rt_1` and `rt_2` share some arbitrary valid supertype `rt'`,
413+
i.e. that `rt_1` and `rt_2` must be in the same heap type hierarchy.
414+
This relaxation is applied not only to the new `br_on_cast_desc` and `br_on_cast_desc_fail` instructions,
415+
but also the existing `br_on_cast` and `br_on_cast_fail` instructions.
416+
407417
## JS Prototypes
408418

409419
In JS engines,

0 commit comments

Comments
 (0)