summaryrefslogtreecommitdiff
path: root/src/binary-reader-objdump.cc
diff options
context:
space:
mode:
authorBen Smith <binjimin@gmail.com>2019-02-12 14:41:34 -0800
committerGitHub <noreply@github.com>2019-02-12 14:41:34 -0800
commite448ac7cbd74f7a048b1de15ce1a2716340a57c8 (patch)
tree2cdbf9372eabfb2584d26279beee84062036c348 /src/binary-reader-objdump.cc
parent35ee613d4f8e65e730aaa6d519ee39ce581d4f24 (diff)
downloadwabt-e448ac7cbd74f7a048b1de15ce1a2716340a57c8.tar.gz
wabt-e448ac7cbd74f7a048b1de15ce1a2716340a57c8.tar.bz2
wabt-e448ac7cbd74f7a048b1de15ce1a2716340a57c8.zip
Parse updated event text and binary format (#1014)
An event has a type-section index, like a function definition. The current proposal doesn't specify the text format, so I assumed that it would match the format of the other sections that reference function types. This means that the following declaration styles are allowed: ``` (type $t (func (param i32))) (event $e1 (type $t)) (event $e2 (param f32)) ```
Diffstat (limited to 'src/binary-reader-objdump.cc')
-rw-r--r--src/binary-reader-objdump.cc28
1 files changed, 8 insertions, 20 deletions
diff --git a/src/binary-reader-objdump.cc b/src/binary-reader-objdump.cc
index 04716afc..8996f67c 100644
--- a/src/binary-reader-objdump.cc
+++ b/src/binary-reader-objdump.cc
@@ -680,7 +680,7 @@ class BinaryReaderObjdump : public BinaryReaderObjdumpBase {
string_view module_name,
string_view field_name,
Index event_index,
- TypeVector& sig) override;
+ Index sig_index) override;
Result OnFunctionCount(Index count) override;
Result OnFunction(Index index, Index sig_index) override;
@@ -792,7 +792,7 @@ class BinaryReaderObjdump : public BinaryReaderObjdumpBase {
Result OnInitFunction(uint32_t priority, Index function_index) override;
Result OnEventCount(Index count) override;
- Result OnEventType(Index index, TypeVector& sig) override;
+ Result OnEventType(Index index, Index sig_index) override;
private:
Result HandleInitExpr(const InitExpr& expr);
@@ -1060,15 +1060,10 @@ Result BinaryReaderObjdump::OnImportEvent(Index import_index,
string_view module_name,
string_view field_name,
Index event_index,
- TypeVector& sig) {
- PrintDetails(" - event[%" PRIindex "] (", event_index);
- for (Index i = 0; i < sig.size(); ++i) {
- if (i != 0) {
- PrintDetails(", ");
- }
- PrintDetails("%s", GetTypeName(sig[i]));
- }
- PrintDetails(") <- " PRIstringview "." PRIstringview "\n",
+ Index sig_index) {
+ PrintDetails(" - event[%" PRIindex "] sig=%" PRIindex, event_index,
+ sig_index);
+ PrintDetails(" <- " PRIstringview "." PRIstringview "\n",
WABT_PRINTF_STRING_VIEW_ARG(module_name),
WABT_PRINTF_STRING_VIEW_ARG(field_name));
return Result::Ok;
@@ -1531,18 +1526,11 @@ Result BinaryReaderObjdump::OnEventCount(Index count) {
return OnCount(count);
}
-Result BinaryReaderObjdump::OnEventType(Index index, TypeVector& sig) {
+Result BinaryReaderObjdump::OnEventType(Index index, Index sig_index) {
if (!ShouldPrintDetails()) {
return Result::Ok;
}
- printf(" - event[%" PRIindex "] (", index);
- for (Index i = 0; i < sig.size(); ++i) {
- if (i != 0) {
- printf(", ");
- }
- printf("%s", GetTypeName(sig[i]));
- }
- printf(")\n");
+ printf(" - event[%" PRIindex "] sig=%" PRIindex "\n", index, sig_index);
return Result::Ok;
}