summaryrefslogtreecommitdiff
path: root/src/binary-writer.cc
diff options
context:
space:
mode:
authorHeejin Ahn <aheejin@gmail.com>2020-03-25 10:02:42 -0700
committerGitHub <noreply@github.com>2020-03-25 10:02:42 -0700
commitd8771ed54edc85ee71e69b835cdaab57bd2722f4 (patch)
tree7d0d31e411b9327513828cfaaade8850c0bf1115 /src/binary-writer.cc
parent7898e57f28c89565b99e894e764e058346e28fbe (diff)
downloadwabt-d8771ed54edc85ee71e69b835cdaab57bd2722f4.tar.gz
wabt-d8771ed54edc85ee71e69b835cdaab57bd2722f4.tar.bz2
wabt-d8771ed54edc85ee71e69b835cdaab57bd2722f4.zip
Move event section before global section (#1374)
We decided move the event section before the global section in WebAssembly/exception-handling#98.
Diffstat (limited to 'src/binary-writer.cc')
-rw-r--r--src/binary-writer.cc26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/binary-writer.cc b/src/binary-writer.cc
index 6c0a73db..e5c9c4d2 100644
--- a/src/binary-writer.cc
+++ b/src/binary-writer.cc
@@ -1011,6 +1011,19 @@ Result BinaryWriter::WriteModule() {
EndSection();
}
+ assert(module_->events.size() >= module_->num_event_imports);
+ Index num_events = module_->events.size() - module_->num_event_imports;
+ if (num_events) {
+ BeginKnownSection(BinarySection::Event);
+ WriteU32Leb128(stream_, num_events, "event count");
+ for (size_t i = 0; i < num_events; ++i) {
+ WriteHeader("event", i);
+ const Event* event = module_->events[i + module_->num_event_imports];
+ WriteEventType(event);
+ }
+ EndSection();
+ }
+
assert(module_->globals.size() >= module_->num_global_imports);
Index num_globals = module_->globals.size() - module_->num_global_imports;
if (num_globals) {
@@ -1025,19 +1038,6 @@ Result BinaryWriter::WriteModule() {
EndSection();
}
- assert(module_->events.size() >= module_->num_event_imports);
- Index num_events = module_->events.size() - module_->num_event_imports;
- if (num_events) {
- BeginKnownSection(BinarySection::Event);
- WriteU32Leb128(stream_, num_events, "event count");
- for (size_t i = 0; i < num_events; ++i) {
- WriteHeader("event", i);
- const Event* event = module_->events[i + module_->num_event_imports];
- WriteEventType(event);
- }
- EndSection();
- }
-
if (module_->exports.size()) {
BeginKnownSection(BinarySection::Export);
WriteU32Leb128(stream_, module_->exports.size(), "num exports");