diff options
author | Ben Smith <binjimin@gmail.com> | 2019-04-18 16:37:58 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-18 16:37:58 -0700 |
commit | e7a3802b6e8bb1ab88d9b0bc97d7f5a20ffe0ab9 (patch) | |
tree | a10f021e6eeefe1fa5cca343156adc328913b115 /src/interp/binary-reader-interp.cc | |
parent | 791896866ee26621ba806d03c69b64ece0992c66 (diff) | |
download | wabt-e7a3802b6e8bb1ab88d9b0bc97d7f5a20ffe0ab9.tar.gz wabt-e7a3802b6e8bb1ab88d9b0bc97d7f5a20ffe0ab9.tar.bz2 wabt-e7a3802b6e8bb1ab88d9b0bc97d7f5a20ffe0ab9.zip |
Proper encoding of passive element segments (#1066)
* Store element segments as a vector of `ElemExpr`, instead of func index
* Read/write binary format for each element expression
* Read/write text format for each element expression
Diffstat (limited to 'src/interp/binary-reader-interp.cc')
-rw-r--r-- | src/interp/binary-reader-interp.cc | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/interp/binary-reader-interp.cc b/src/interp/binary-reader-interp.cc index 94cf479c..7a5ecc00 100644 --- a/src/interp/binary-reader-interp.cc +++ b/src/interp/binary-reader-interp.cc @@ -203,10 +203,10 @@ class BinaryReaderInterp : public BinaryReaderNop { wabt::Result OnSimdShuffleOpExpr(wabt::Opcode opcode, v128 value) override; wabt::Result EndElemSegmentInitExpr(Index index) override; - wabt::Result OnElemSegmentFunctionIndexCount(Index index, - Index count) override; - wabt::Result OnElemSegmentFunctionIndex(Index index, - Index func_index) override; + wabt::Result OnElemSegmentElemExprCount(Index index, Index count) override; + wabt::Result OnElemSegmentElemExpr_RefNull(Index segment_index) override; + wabt::Result OnElemSegmentElemExpr_RefFunc(Index segment_index, + Index func_index) override; wabt::Result OnDataSegmentData(Index index, const void* data, @@ -976,8 +976,8 @@ wabt::Result BinaryReaderInterp::EndElemSegmentInitExpr(Index index) { return wabt::Result::Ok; } -wabt::Result BinaryReaderInterp::OnElemSegmentFunctionIndexCount(Index index, - Index count) { +wabt::Result BinaryReaderInterp::OnElemSegmentElemExprCount(Index index, + Index count) { assert(module_->table_index != kInvalidIndex); Table* table = env_->GetTable(module_->table_index); // Check both cases, as table_offset_ + count may overflow. @@ -991,8 +991,15 @@ wabt::Result BinaryReaderInterp::OnElemSegmentFunctionIndexCount(Index index, return wabt::Result::Ok; } -wabt::Result BinaryReaderInterp::OnElemSegmentFunctionIndex(Index index, - Index func_index) { +wabt::Result BinaryReaderInterp::OnElemSegmentElemExpr_RefNull( + Index segment_index) { + // TODO(binji): implement + return wabt::Result::Error; +} + +wabt::Result BinaryReaderInterp::OnElemSegmentElemExpr_RefFunc( + Index index, + Index func_index) { Index max_func_index = func_index_mapping_.size(); if (func_index >= max_func_index) { PrintError("invalid func_index: %" PRIindex " (max %" PRIindex ")", |