@@ -65,7 +65,7 @@ let kElementSectionCode = 9; // Elements section
65
65
let kCodeSectionCode = 10 ; // Function code
66
66
let kDataSectionCode = 11 ; // Data segments
67
67
let kDataCountSectionCode = 12 ; // Data segment count (between Element & Code)
68
- let kExceptionSectionCode = 13 ; // Exception section (between Global & Export )
68
+ let kTagSectionCode = 13 ; // Tag section (between Memory & Global )
69
69
70
70
// Name section types
71
71
let kModuleNameCode = 0 ;
@@ -104,13 +104,13 @@ let kExternalFunction = 0;
104
104
let kExternalTable = 1 ;
105
105
let kExternalMemory = 2 ;
106
106
let kExternalGlobal = 3 ;
107
- let kExternalException = 4 ;
107
+ let kExternalTag = 4 ;
108
108
109
109
let kTableZero = 0 ;
110
110
let kMemoryZero = 0 ;
111
111
let kSegmentZero = 0 ;
112
112
113
- let kExceptionAttribute = 0 ;
113
+ let kTagAttribute = 0 ;
114
114
115
115
// Useful signatures
116
116
let kSig_i_i = makeSig ( [ kWasmI32 ] , [ kWasmI32 ] ) ;
@@ -681,15 +681,15 @@ class WasmModuleBuilder {
681
681
this . exports = [ ] ;
682
682
this . globals = [ ] ;
683
683
this . tables = [ ] ;
684
- this . exceptions = [ ] ;
684
+ this . tags = [ ] ;
685
685
this . functions = [ ] ;
686
686
this . element_segments = [ ] ;
687
687
this . data_segments = [ ] ;
688
688
this . explicit = [ ] ;
689
689
this . num_imported_funcs = 0 ;
690
690
this . num_imported_globals = 0 ;
691
691
this . num_imported_tables = 0 ;
692
- this . num_imported_exceptions = 0 ;
692
+ this . num_imported_tags = 0 ;
693
693
return this ;
694
694
}
695
695
@@ -752,10 +752,10 @@ class WasmModuleBuilder {
752
752
return table ;
753
753
}
754
754
755
- addException ( type ) {
755
+ addTag ( type ) {
756
756
let type_index = ( typeof type ) == "number" ? type : this . addType ( type ) ;
757
- let except_index = this . exceptions . length + this . num_imported_exceptions ;
758
- this . exceptions . push ( type_index ) ;
757
+ let except_index = this . tags . length + this . num_imported_tags ;
758
+ this . tags . push ( type_index ) ;
759
759
return except_index ;
760
760
}
761
761
@@ -804,14 +804,14 @@ class WasmModuleBuilder {
804
804
return this . num_imported_tables ++ ;
805
805
}
806
806
807
- addImportedException ( module , name , type ) {
808
- if ( this . exceptions . length != 0 ) {
809
- throw new Error ( 'Imported exceptions must be declared before local ones' ) ;
807
+ addImportedTag ( module , name , type ) {
808
+ if ( this . tags . length != 0 ) {
809
+ throw new Error ( 'Imported tags must be declared before local ones' ) ;
810
810
}
811
811
let type_index = ( typeof type ) == "number" ? type : this . addType ( type ) ;
812
- let o = { module : module , name : name , kind : kExternalException , type : type_index } ;
812
+ let o = { module : module , name : name , kind : kExternalTag , type : type_index } ;
813
813
this . imports . push ( o ) ;
814
- return this . num_imported_exceptions ++ ;
814
+ return this . num_imported_tags ++ ;
815
815
}
816
816
817
817
addExport ( name , index ) {
@@ -938,8 +938,8 @@ class WasmModuleBuilder {
938
938
section . emit_u8 ( has_max ? 1 : 0 ) ; // flags
939
939
section . emit_u32v ( imp . initial ) ; // initial
940
940
if ( has_max ) section . emit_u32v ( imp . maximum ) ; // maximum
941
- } else if ( imp . kind == kExternalException ) {
942
- section . emit_u32v ( kExceptionAttribute ) ;
941
+ } else if ( imp . kind == kExternalTag ) {
942
+ section . emit_u32v ( kTagAttribute ) ;
943
943
section . emit_u32v ( imp . type ) ;
944
944
} else {
945
945
throw new Error ( "unknown/unsupported import kind " + imp . kind ) ;
@@ -1036,13 +1036,13 @@ class WasmModuleBuilder {
1036
1036
} ) ;
1037
1037
}
1038
1038
1039
- // Add exceptions .
1040
- if ( wasm . exceptions . length > 0 ) {
1041
- if ( debug ) print ( "emitting exceptions @ " + binary . length ) ;
1042
- binary . emit_section ( kExceptionSectionCode , section => {
1043
- section . emit_u32v ( wasm . exceptions . length ) ;
1044
- for ( let type of wasm . exceptions ) {
1045
- section . emit_u32v ( kExceptionAttribute ) ;
1039
+ // Add tags .
1040
+ if ( wasm . tags . length > 0 ) {
1041
+ if ( debug ) print ( "emitting tags @ " + binary . length ) ;
1042
+ binary . emit_section ( kTagSectionCode , section => {
1043
+ section . emit_u32v ( wasm . tags . length ) ;
1044
+ for ( let type of wasm . tags ) {
1045
+ section . emit_u32v ( kTagAttribute ) ;
1046
1046
section . emit_u32v ( type ) ;
1047
1047
}
1048
1048
} ) ;
0 commit comments