From 1bfe16b17b0e924fce4c0fe28fc2587b88ba68e8 Mon Sep 17 00:00:00 2001 From: Volker Berlin Date: Sun, 29 Aug 2021 15:10:05 +0200 Subject: [PATCH] [EH] Replace event with tag https://github.com/WebAssembly/exception-handling/pull/161 --- .../jwebassembly/binary/BinaryModuleWriter.java | 16 ++++++++-------- .../jwebassembly/binary/ExternalKind.java | 2 +- .../jwebassembly/binary/SectionType.java | 2 +- .../jwebassembly/text/TextModuleWriter.java | 8 ++++---- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/de/inetsoftware/jwebassembly/binary/BinaryModuleWriter.java b/src/de/inetsoftware/jwebassembly/binary/BinaryModuleWriter.java index 865275f..629656d 100644 --- a/src/de/inetsoftware/jwebassembly/binary/BinaryModuleWriter.java +++ b/src/de/inetsoftware/jwebassembly/binary/BinaryModuleWriter.java @@ -132,7 +132,7 @@ public class BinaryModuleWriter extends ModuleWriter implements InstructionOpcod writeSection( SectionType.Function, functions.values() ); writeTableSection(); writeMemorySection(); - writeEventSection(); + writeTagSection(); writeSection( SectionType.Global, globals.values() ); writeSection( SectionType.Export, exports ); writeStartSection(); @@ -238,21 +238,21 @@ public class BinaryModuleWriter extends ModuleWriter implements InstructionOpcod } /** - * Write the event section if needed. + * Write the tag section if needed. * * @throws IOException * if any I/O error occur */ - private void writeEventSection() throws IOException { + private void writeTagSection() throws IOException { if( exceptionSignatureIndex >= 0 ) { WasmOutputStream stream = new WasmOutputStream( options ); stream.writeVaruint32( 1 ); - // event declaration - stream.writeVaruint32( 0 ); // event type: exception = 0 + // tag declaration + stream.writeVaruint32( 0 ); // tag type: exception = 0 stream.writeVaruint32( exceptionSignatureIndex ); - wasm.writeSection( SectionType.Event, stream ); + wasm.writeSection( SectionType.Tag, stream ); } } @@ -1351,7 +1351,7 @@ public class BinaryModuleWriter extends ModuleWriter implements InstructionOpcod case THROW: if( options.useEH() ) { codeStream.writeOpCode( THROW ); - codeStream.writeVaruint32( 0 ); // event/exception ever 0 because currently there is only one with signature anyref + codeStream.writeVaruint32( 0 ); // tag/exception ever 0 because currently there is only one with signature anyref } else { codeStream.writeOpCode( UNREACHABLE ); } @@ -1363,7 +1363,7 @@ public class BinaryModuleWriter extends ModuleWriter implements InstructionOpcod if( options.useEH() ) { codeStream.writeOpCode( BR_ON_EXN ); codeStream.writeVaruint32( (Integer)data ); // break depth - codeStream.writeVaruint32( 0 ); // event/exception ever 0 because currently there is only one with signature anyref + codeStream.writeVaruint32( 0 ); // tag/exception ever 0 because currently there is only one with signature anyref } else { codeStream.writeOpCode( UNREACHABLE ); } diff --git a/src/de/inetsoftware/jwebassembly/binary/ExternalKind.java b/src/de/inetsoftware/jwebassembly/binary/ExternalKind.java index efa898b..805542f 100644 --- a/src/de/inetsoftware/jwebassembly/binary/ExternalKind.java +++ b/src/de/inetsoftware/jwebassembly/binary/ExternalKind.java @@ -26,5 +26,5 @@ enum ExternalKind { Table, Memory, Global, - Event, + Tag, } diff --git a/src/de/inetsoftware/jwebassembly/binary/SectionType.java b/src/de/inetsoftware/jwebassembly/binary/SectionType.java index e954ef5..64d5b9e 100644 --- a/src/de/inetsoftware/jwebassembly/binary/SectionType.java +++ b/src/de/inetsoftware/jwebassembly/binary/SectionType.java @@ -32,5 +32,5 @@ enum SectionType { Code, // 10 Function bodies (code) Data, // 11 Data segments DataCount,//12 Count of data segments https://github.com/WebAssembly/bulk-memory-operations/blob/master/proposals/bulk-memory-operations/Overview.md - Event, // 13 Event declarations, Exceptions + Tag, // 13 Tag declarations, Exceptions } diff --git a/src/de/inetsoftware/jwebassembly/text/TextModuleWriter.java b/src/de/inetsoftware/jwebassembly/text/TextModuleWriter.java index d333eb8..5b41d14 100644 --- a/src/de/inetsoftware/jwebassembly/text/TextModuleWriter.java +++ b/src/de/inetsoftware/jwebassembly/text/TextModuleWriter.java @@ -277,9 +277,9 @@ public class TextModuleWriter extends ModuleWriter { inset = 1; newline( output ); if( options.useGC() ) { - output.append( "(event (param (ref null $java/lang/Throwable)))" ); + output.append( "(tag (param (ref null $java/lang/Throwable)))" ); } else { - output.append( "(event (param externref))" ); + output.append( "(tag (param externref))" ); } inset = oldInset; } @@ -851,13 +851,13 @@ public class TextModuleWriter extends ModuleWriter { insetAfter++; break; case THROW: - name = options.useEH() ? "throw 0" : "unreachable"; // currently there is only one event/exception with externref + name = options.useEH() ? "throw 0" : "unreachable"; // currently there is only one tag/exception with externref break; case RETHROW: name = "rethrow"; break; case BR_ON_EXN: - name = options.useEH() ? "br_on_exn " + data + " 0" : "unreachable"; // br_on_exn, break depth, event; // currently there is only one event/exception with externref + name = options.useEH() ? "br_on_exn " + data + " 0" : "unreachable"; // br_on_exn, break depth, tag; // currently there is only one tag/exception with externref break; case MONITOR_ENTER: case MONITOR_EXIT: