@@ -878,6 +878,8 @@ impl std::fmt::Debug for RefType {
878
878
( false , HeapType :: Func ) => write ! ( f, "(ref func)" ) ,
879
879
( true , HeapType :: Exn ) => write ! ( f, "exnref" ) ,
880
880
( false , HeapType :: Exn ) => write ! ( f, "(ref exn)" ) ,
881
+ ( true , HeapType :: NoExn ) => write ! ( f, "nullexnref" ) ,
882
+ ( false , HeapType :: NoExn ) => write ! ( f, "(ref noexn)" ) ,
881
883
( true , HeapType :: Concrete ( idx) ) => write ! ( f, "(ref null {idx})" ) ,
882
884
( false , HeapType :: Concrete ( idx) ) => write ! ( f, "(ref {idx})" ) ,
883
885
}
@@ -928,6 +930,7 @@ impl RefType {
928
930
const EXTERN_ABSTYPE : u32 = 0b0011 << 18 ;
929
931
const NOEXTERN_ABSTYPE : u32 = 0b0010 << 18 ;
930
932
const EXN_ABSTYPE : u32 = 0b0001 << 18 ;
933
+ const NOEXN_ABSTYPE : u32 = 0b1110 << 18 ;
931
934
const NONE_ABSTYPE : u32 = 0b0000 << 18 ;
932
935
933
936
// The `index` is valid only when `concrete == 1`.
@@ -972,6 +975,10 @@ impl RefType {
972
975
/// `exnref`.
973
976
pub const EXNREF : Self = RefType :: EXN . nullable ( ) ;
974
977
978
+ /// A nullable reference to a noexn object aka `(ref null noexn)` aka
979
+ /// `nullexnref`.
980
+ pub const NULLEXNREF : Self = RefType :: NOEXN . nullable ( ) ;
981
+
975
982
/// A non-nullable untyped function reference aka `(ref func)`.
976
983
pub const FUNC : Self = RefType :: from_u32 ( Self :: FUNC_ABSTYPE ) ;
977
984
@@ -1005,6 +1012,9 @@ impl RefType {
1005
1012
/// A non-nullable reference to an exn object aka `(ref exn)`.
1006
1013
pub const EXN : Self = RefType :: from_u32 ( Self :: EXN_ABSTYPE ) ;
1007
1014
1015
+ /// A non-nullable reference to a noexn object aka `(ref noexn)`.
1016
+ pub const NOEXN : Self = RefType :: from_u32 ( Self :: NOEXN_ABSTYPE ) ;
1017
+
1008
1018
const fn can_represent_type_index ( index : u32 ) -> bool {
1009
1019
index & Self :: INDEX_MASK == index
1010
1020
}
@@ -1045,6 +1055,7 @@ impl RefType {
1045
1055
| Self :: NOEXTERN_ABSTYPE
1046
1056
| Self :: NONE_ABSTYPE
1047
1057
| Self :: EXN_ABSTYPE
1058
+ | Self :: NOEXN_ABSTYPE
1048
1059
)
1049
1060
) ;
1050
1061
@@ -1083,6 +1094,7 @@ impl RefType {
1083
1094
HeapType :: Array => Some ( Self :: from_u32 ( nullable32 | Self :: ARRAY_ABSTYPE ) ) ,
1084
1095
HeapType :: I31 => Some ( Self :: from_u32 ( nullable32 | Self :: I31_ABSTYPE ) ) ,
1085
1096
HeapType :: Exn => Some ( Self :: from_u32 ( nullable32 | Self :: EXN_ABSTYPE ) ) ,
1097
+ HeapType :: NoExn => Some ( Self :: from_u32 ( nullable32 | Self :: NOEXN_ABSTYPE ) ) ,
1086
1098
}
1087
1099
}
1088
1100
@@ -1179,6 +1191,7 @@ impl RefType {
1179
1191
Self :: ARRAY_ABSTYPE => HeapType :: Array ,
1180
1192
Self :: I31_ABSTYPE => HeapType :: I31 ,
1181
1193
Self :: EXN_ABSTYPE => HeapType :: Exn ,
1194
+ Self :: NOEXN_ABSTYPE => HeapType :: NoExn ,
1182
1195
_ => unreachable ! ( ) ,
1183
1196
}
1184
1197
}
@@ -1200,6 +1213,7 @@ impl RefType {
1200
1213
( true , HeapType :: Array ) => "arrayref" ,
1201
1214
( true , HeapType :: I31 ) => "i31ref" ,
1202
1215
( true , HeapType :: Exn ) => "exnref" ,
1216
+ ( true , HeapType :: NoExn ) => "nullexnref" ,
1203
1217
( false , HeapType :: Func ) => "(ref func)" ,
1204
1218
( false , HeapType :: Extern ) => "(ref extern)" ,
1205
1219
( false , HeapType :: Concrete ( _) ) => "(ref $type)" ,
@@ -1212,6 +1226,7 @@ impl RefType {
1212
1226
( false , HeapType :: Array ) => "(ref array)" ,
1213
1227
( false , HeapType :: I31 ) => "(ref i31)" ,
1214
1228
( false , HeapType :: Exn ) => "(ref exn)" ,
1229
+ ( false , HeapType :: NoExn ) => "(ref noexn)" ,
1215
1230
}
1216
1231
}
1217
1232
}
@@ -1297,13 +1312,20 @@ pub enum HeapType {
1297
1312
///
1298
1313
/// Introduced in the exception-handling proposal.
1299
1314
Exn ,
1315
+
1316
+ /// The abstract `noexn` heap type.
1317
+ ///
1318
+ /// The common subtype (a.k.a. bottom) of all exception types.
1319
+ ///
1320
+ /// Introduced in the exception-handling proposal.
1321
+ NoExn ,
1300
1322
}
1301
1323
1302
1324
impl ValType {
1303
1325
pub ( crate ) fn is_valtype_byte ( byte : u8 ) -> bool {
1304
1326
match byte {
1305
1327
0x7F | 0x7E | 0x7D | 0x7C | 0x7B | 0x70 | 0x6F | 0x64 | 0x63 | 0x6E | 0x71 | 0x72
1306
- | 0x73 | 0x6D | 0x6B | 0x6A | 0x6C | 0x69 => true ,
1328
+ | 0x74 | 0x73 | 0x6D | 0x6B | 0x6A | 0x6C | 0x69 => true ,
1307
1329
_ => false ,
1308
1330
}
1309
1331
}
@@ -1348,8 +1370,8 @@ impl<'a> FromReader<'a> for ValType {
1348
1370
reader. position += 1 ;
1349
1371
Ok ( ValType :: V128 )
1350
1372
}
1351
- 0x70 | 0x6F | 0x64 | 0x63 | 0x6E | 0x71 | 0x72 | 0x73 | 0x6D | 0x6B | 0x6A | 0x6C
1352
- | 0x69 => Ok ( ValType :: Ref ( reader. read ( ) ?) ) ,
1373
+ 0x70 | 0x6F | 0x64 | 0x63 | 0x6E | 0x71 | 0x72 | 0x73 | 0x74 | 0x6D | 0x6B | 0x6A
1374
+ | 0x6C | 0x69 => Ok ( ValType :: Ref ( reader. read ( ) ?) ) ,
1353
1375
_ => bail ! ( reader. original_position( ) , "invalid value type" ) ,
1354
1376
}
1355
1377
}
@@ -1369,6 +1391,7 @@ impl<'a> FromReader<'a> for RefType {
1369
1391
0x6A => Ok ( RefType :: ARRAY . nullable ( ) ) ,
1370
1392
0x6C => Ok ( RefType :: I31 . nullable ( ) ) ,
1371
1393
0x69 => Ok ( RefType :: EXN . nullable ( ) ) ,
1394
+ 0x74 => Ok ( RefType :: NOEXN . nullable ( ) ) ,
1372
1395
byte @ ( 0x63 | 0x64 ) => {
1373
1396
let nullable = byte == 0x63 ;
1374
1397
let pos = reader. original_position ( ) ;
@@ -1427,6 +1450,10 @@ impl<'a> FromReader<'a> for HeapType {
1427
1450
reader. position += 1 ;
1428
1451
Ok ( HeapType :: Exn )
1429
1452
}
1453
+ 0x74 => {
1454
+ reader. position += 1 ;
1455
+ Ok ( HeapType :: NoExn )
1456
+ }
1430
1457
_ => {
1431
1458
let idx = match u32:: try_from ( reader. read_var_s33 ( ) ?) {
1432
1459
Ok ( idx) => idx,
0 commit comments