Skip to content

Commit 1bfe16b

Browse files
committed
[EH] Replace event with tag WebAssembly/exception-handling#161
1 parent 0ef00ba commit 1bfe16b

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

src/de/inetsoftware/jwebassembly/binary/BinaryModuleWriter.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public void close() throws IOException {
132132
writeSection( SectionType.Function, functions.values() );
133133
writeTableSection();
134134
writeMemorySection();
135-
writeEventSection();
135+
writeTagSection();
136136
writeSection( SectionType.Global, globals.values() );
137137
writeSection( SectionType.Export, exports );
138138
writeStartSection();
@@ -238,21 +238,21 @@ private void writeMemorySection() throws IOException {
238238
}
239239

240240
/**
241-
* Write the event section if needed.
241+
* Write the tag section if needed.
242242
*
243243
* @throws IOException
244244
* if any I/O error occur
245245
*/
246-
private void writeEventSection() throws IOException {
246+
private void writeTagSection() throws IOException {
247247
if( exceptionSignatureIndex >= 0 ) {
248248
WasmOutputStream stream = new WasmOutputStream( options );
249249
stream.writeVaruint32( 1 );
250250

251-
// event declaration
252-
stream.writeVaruint32( 0 ); // event type: exception = 0
251+
// tag declaration
252+
stream.writeVaruint32( 0 ); // tag type: exception = 0
253253
stream.writeVaruint32( exceptionSignatureIndex );
254254

255-
wasm.writeSection( SectionType.Event, stream );
255+
wasm.writeSection( SectionType.Tag, stream );
256256
}
257257
}
258258

@@ -1351,7 +1351,7 @@ protected void writeBlockCode( @Nonnull WasmBlockOperator op, @Nullable Object d
13511351
case THROW:
13521352
if( options.useEH() ) {
13531353
codeStream.writeOpCode( THROW );
1354-
codeStream.writeVaruint32( 0 ); // event/exception ever 0 because currently there is only one with signature anyref
1354+
codeStream.writeVaruint32( 0 ); // tag/exception ever 0 because currently there is only one with signature anyref
13551355
} else {
13561356
codeStream.writeOpCode( UNREACHABLE );
13571357
}
@@ -1363,7 +1363,7 @@ protected void writeBlockCode( @Nonnull WasmBlockOperator op, @Nullable Object d
13631363
if( options.useEH() ) {
13641364
codeStream.writeOpCode( BR_ON_EXN );
13651365
codeStream.writeVaruint32( (Integer)data ); // break depth
1366-
codeStream.writeVaruint32( 0 ); // event/exception ever 0 because currently there is only one with signature anyref
1366+
codeStream.writeVaruint32( 0 ); // tag/exception ever 0 because currently there is only one with signature anyref
13671367
} else {
13681368
codeStream.writeOpCode( UNREACHABLE );
13691369
}

src/de/inetsoftware/jwebassembly/binary/ExternalKind.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ enum ExternalKind {
2626
Table,
2727
Memory,
2828
Global,
29-
Event,
29+
Tag,
3030
}

src/de/inetsoftware/jwebassembly/binary/SectionType.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ enum SectionType {
3232
Code, // 10 Function bodies (code)
3333
Data, // 11 Data segments
3434
DataCount,//12 Count of data segments https://github.com/WebAssembly/bulk-memory-operations/blob/master/proposals/bulk-memory-operations/Overview.md
35-
Event, // 13 Event declarations, Exceptions
35+
Tag, // 13 Tag declarations, Exceptions
3636
}

src/de/inetsoftware/jwebassembly/text/TextModuleWriter.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -277,9 +277,9 @@ protected void writeException() throws IOException {
277277
inset = 1;
278278
newline( output );
279279
if( options.useGC() ) {
280-
output.append( "(event (param (ref null $java/lang/Throwable)))" );
280+
output.append( "(tag (param (ref null $java/lang/Throwable)))" );
281281
} else {
282-
output.append( "(event (param externref))" );
282+
output.append( "(tag (param externref))" );
283283
}
284284
inset = oldInset;
285285
}
@@ -851,13 +851,13 @@ protected void writeBlockCode( @Nonnull WasmBlockOperator op, @Nullable Object d
851851
insetAfter++;
852852
break;
853853
case THROW:
854-
name = options.useEH() ? "throw 0" : "unreachable"; // currently there is only one event/exception with externref
854+
name = options.useEH() ? "throw 0" : "unreachable"; // currently there is only one tag/exception with externref
855855
break;
856856
case RETHROW:
857857
name = "rethrow";
858858
break;
859859
case BR_ON_EXN:
860-
name = options.useEH() ? "br_on_exn " + data + " 0" : "unreachable"; // br_on_exn, break depth, event; // currently there is only one event/exception with externref
860+
name = options.useEH() ? "br_on_exn " + data + " 0" : "unreachable"; // br_on_exn, break depth, tag; // currently there is only one tag/exception with externref
861861
break;
862862
case MONITOR_ENTER:
863863
case MONITOR_EXIT:

0 commit comments

Comments
 (0)