@@ -878,6 +878,8 @@ impl std::fmt::Debug for RefType {
878878 ( false , HeapType :: Func ) => write ! ( f, "(ref func)" ) ,
879879 ( true , HeapType :: Exn ) => write ! ( f, "exnref" ) ,
880880 ( false , HeapType :: Exn ) => write ! ( f, "(ref exn)" ) ,
881+ ( true , HeapType :: NoExn ) => write ! ( f, "nullexnref" ) ,
882+ ( false , HeapType :: NoExn ) => write ! ( f, "(ref noexn)" ) ,
881883 ( true , HeapType :: Concrete ( idx) ) => write ! ( f, "(ref null {idx})" ) ,
882884 ( false , HeapType :: Concrete ( idx) ) => write ! ( f, "(ref {idx})" ) ,
883885 }
@@ -928,6 +930,7 @@ impl RefType {
928930 const EXTERN_ABSTYPE : u32 = 0b0011 << 18 ;
929931 const NOEXTERN_ABSTYPE : u32 = 0b0010 << 18 ;
930932 const EXN_ABSTYPE : u32 = 0b0001 << 18 ;
933+ const NOEXN_ABSTYPE : u32 = 0b1110 << 18 ;
931934 const NONE_ABSTYPE : u32 = 0b0000 << 18 ;
932935
933936 // The `index` is valid only when `concrete == 1`.
@@ -972,6 +975,10 @@ impl RefType {
972975 /// `exnref`.
973976 pub const EXNREF : Self = RefType :: EXN . nullable ( ) ;
974977
978+ /// A nullable reference to a noexn object aka `(ref null noexn)` aka
979+ /// `nullexnref`.
980+ pub const NULLEXNREF : Self = RefType :: NOEXN . nullable ( ) ;
981+
975982 /// A non-nullable untyped function reference aka `(ref func)`.
976983 pub const FUNC : Self = RefType :: from_u32 ( Self :: FUNC_ABSTYPE ) ;
977984
@@ -1005,6 +1012,9 @@ impl RefType {
10051012 /// A non-nullable reference to an exn object aka `(ref exn)`.
10061013 pub const EXN : Self = RefType :: from_u32 ( Self :: EXN_ABSTYPE ) ;
10071014
1015+ /// A non-nullable reference to a noexn object aka `(ref noexn)`.
1016+ pub const NOEXN : Self = RefType :: from_u32 ( Self :: NOEXN_ABSTYPE ) ;
1017+
10081018 const fn can_represent_type_index ( index : u32 ) -> bool {
10091019 index & Self :: INDEX_MASK == index
10101020 }
@@ -1045,6 +1055,7 @@ impl RefType {
10451055 | Self :: NOEXTERN_ABSTYPE
10461056 | Self :: NONE_ABSTYPE
10471057 | Self :: EXN_ABSTYPE
1058+ | Self :: NOEXN_ABSTYPE
10481059 )
10491060 ) ;
10501061
@@ -1083,6 +1094,7 @@ impl RefType {
10831094 HeapType :: Array => Some ( Self :: from_u32 ( nullable32 | Self :: ARRAY_ABSTYPE ) ) ,
10841095 HeapType :: I31 => Some ( Self :: from_u32 ( nullable32 | Self :: I31_ABSTYPE ) ) ,
10851096 HeapType :: Exn => Some ( Self :: from_u32 ( nullable32 | Self :: EXN_ABSTYPE ) ) ,
1097+ HeapType :: NoExn => Some ( Self :: from_u32 ( nullable32 | Self :: NOEXN_ABSTYPE ) ) ,
10861098 }
10871099 }
10881100
@@ -1179,6 +1191,7 @@ impl RefType {
11791191 Self :: ARRAY_ABSTYPE => HeapType :: Array ,
11801192 Self :: I31_ABSTYPE => HeapType :: I31 ,
11811193 Self :: EXN_ABSTYPE => HeapType :: Exn ,
1194+ Self :: NOEXN_ABSTYPE => HeapType :: NoExn ,
11821195 _ => unreachable ! ( ) ,
11831196 }
11841197 }
@@ -1200,6 +1213,7 @@ impl RefType {
12001213 ( true , HeapType :: Array ) => "arrayref" ,
12011214 ( true , HeapType :: I31 ) => "i31ref" ,
12021215 ( true , HeapType :: Exn ) => "exnref" ,
1216+ ( true , HeapType :: NoExn ) => "nullexnref" ,
12031217 ( false , HeapType :: Func ) => "(ref func)" ,
12041218 ( false , HeapType :: Extern ) => "(ref extern)" ,
12051219 ( false , HeapType :: Concrete ( _) ) => "(ref $type)" ,
@@ -1212,6 +1226,7 @@ impl RefType {
12121226 ( false , HeapType :: Array ) => "(ref array)" ,
12131227 ( false , HeapType :: I31 ) => "(ref i31)" ,
12141228 ( false , HeapType :: Exn ) => "(ref exn)" ,
1229+ ( false , HeapType :: NoExn ) => "(ref noexn)" ,
12151230 }
12161231 }
12171232}
@@ -1297,13 +1312,20 @@ pub enum HeapType {
12971312 ///
12981313 /// Introduced in the exception-handling proposal.
12991314 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 ,
13001322}
13011323
13021324impl ValType {
13031325 pub ( crate ) fn is_valtype_byte ( byte : u8 ) -> bool {
13041326 match byte {
13051327 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 ,
13071329 _ => false ,
13081330 }
13091331 }
@@ -1348,8 +1370,8 @@ impl<'a> FromReader<'a> for ValType {
13481370 reader. position += 1 ;
13491371 Ok ( ValType :: V128 )
13501372 }
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 ( ) ?) ) ,
13531375 _ => bail ! ( reader. original_position( ) , "invalid value type" ) ,
13541376 }
13551377 }
@@ -1369,6 +1391,7 @@ impl<'a> FromReader<'a> for RefType {
13691391 0x6A => Ok ( RefType :: ARRAY . nullable ( ) ) ,
13701392 0x6C => Ok ( RefType :: I31 . nullable ( ) ) ,
13711393 0x69 => Ok ( RefType :: EXN . nullable ( ) ) ,
1394+ 0x74 => Ok ( RefType :: NOEXN . nullable ( ) ) ,
13721395 byte @ ( 0x63 | 0x64 ) => {
13731396 let nullable = byte == 0x63 ;
13741397 let pos = reader. original_position ( ) ;
@@ -1427,6 +1450,10 @@ impl<'a> FromReader<'a> for HeapType {
14271450 reader. position += 1 ;
14281451 Ok ( HeapType :: Exn )
14291452 }
1453+ 0x74 => {
1454+ reader. position += 1 ;
1455+ Ok ( HeapType :: NoExn )
1456+ }
14301457 _ => {
14311458 let idx = match u32:: try_from ( reader. read_var_s33 ( ) ?) {
14321459 Ok ( idx) => idx,
0 commit comments