summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/binary-reader-ir.cc6
-rw-r--r--src/binary-reader-objdump.cc14
-rw-r--r--src/binary-reader.h3
3 files changed, 14 insertions, 9 deletions
diff --git a/src/binary-reader-ir.cc b/src/binary-reader-ir.cc
index 3c547dbe..b741244d 100644
--- a/src/binary-reader-ir.cc
+++ b/src/binary-reader-ir.cc
@@ -756,10 +756,10 @@ Result BinaryReaderIR::OnElemSegmentFunctionIndexCount(Index index,
return Result::Ok;
}
-Result BinaryReaderIR::OnElemSegmentFunctionIndex(Index index,
+Result BinaryReaderIR::OnElemSegmentFunctionIndex(Index segment_index,
Index func_index) {
- assert(index == module->elem_segments.size() - 1);
- ElemSegment* segment = module->elem_segments[index];
+ assert(segment_index == module->elem_segments.size() - 1);
+ ElemSegment* segment = module->elem_segments[segment_index];
segment->vars.emplace_back();
Var* var = &segment->vars.back();
var->type = VarType::Index;
diff --git a/src/binary-reader-objdump.cc b/src/binary-reader-objdump.cc
index 71c42961..f80248ba 100644
--- a/src/binary-reader-objdump.cc
+++ b/src/binary-reader-objdump.cc
@@ -463,8 +463,8 @@ class BinaryReaderObjdump : public BinaryReaderObjdumpBase {
Result OnElemSegmentCount(Index count) override;
Result BeginElemSegment(Index index, Index table_index) override;
- Result OnElemSegmentFunctionIndex(Index index,
- Index func_index) override;
+ Result OnElemSegmentFunctionIndex(Index segment_index,
+ Index func_index) override;
Result OnDataSegmentCount(Index count) override;
Result BeginDataSegment(Index index, Index memory_index) override;
@@ -498,6 +498,7 @@ class BinaryReaderObjdump : public BinaryReaderObjdumpBase {
Result OnCount(Index count);
std::unique_ptr<FileStream> out_stream_;
+ Index elem_index_ = 0;
};
BinaryReaderObjdump::BinaryReaderObjdump(const uint8_t* data,
@@ -601,7 +602,7 @@ Result BinaryReaderObjdump::OnType(Index index,
Type* result_types) {
if (!ShouldPrintDetails())
return Result::Ok;
- printf(" - [%" PRIindex "] (", index);
+ printf(" - type[%" PRIindex "] (", index);
for (Index i = 0; i < param_count; i++) {
if (i != 0) {
printf(", ");
@@ -747,12 +748,14 @@ Result BinaryReaderObjdump::OnExport(Index index,
return Result::Ok;
}
-Result BinaryReaderObjdump::OnElemSegmentFunctionIndex(Index index,
+Result BinaryReaderObjdump::OnElemSegmentFunctionIndex(Index segment_index,
Index func_index) {
- PrintDetails(" - func[%" PRIindex "]", func_index);
+ PrintDetails(" - elem[%" PRIindex "] = func[%" PRIindex "]", elem_index_,
+ func_index);
if (const char* name = GetFunctionName(func_index))
PrintDetails(" <%s>", name);
PrintDetails("\n");
+ elem_index_++;
return Result::Ok;
}
@@ -763,6 +766,7 @@ Result BinaryReaderObjdump::OnElemSegmentCount(Index count) {
Result BinaryReaderObjdump::BeginElemSegment(Index index, Index table_index) {
PrintDetails(" - segment[%" PRIindex "] table=%" PRIindex "\n", index,
table_index);
+ elem_index_ = 0;
return Result::Ok;
}
diff --git a/src/binary-reader.h b/src/binary-reader.h
index 63eb7153..2c72f6d8 100644
--- a/src/binary-reader.h
+++ b/src/binary-reader.h
@@ -212,7 +212,8 @@ class BinaryReaderDelegate {
virtual Result BeginElemSegmentInitExpr(Index index) = 0;
virtual Result EndElemSegmentInitExpr(Index index) = 0;
virtual Result OnElemSegmentFunctionIndexCount(Index index, Index count) = 0;
- virtual Result OnElemSegmentFunctionIndex(Index index, Index func_index) = 0;
+ virtual Result OnElemSegmentFunctionIndex(Index segment_index,
+ Index func_index) = 0;
virtual Result EndElemSegment(Index index) = 0;
virtual Result EndElemSection() = 0;