diff options
author | Sam Clegg <sbc@chromium.org> | 2021-12-02 17:30:09 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-02 17:30:09 -0800 |
commit | 0dfa83c1bc645eaa65d8e6ee51f42f8578931ecc (patch) | |
tree | 976045d56346480584f4c91eea47e7bd808db2a1 /src/binary-reader-logging.cc | |
parent | 952560950f176913c1f54525f250e30d26c2b49a (diff) | |
download | wabt-0dfa83c1bc645eaa65d8e6ee51f42f8578931ecc.tar.gz wabt-0dfa83c1bc645eaa65d8e6ee51f42f8578931ecc.tar.bz2 wabt-0dfa83c1bc645eaa65d8e6ee51f42f8578931ecc.zip |
Perform init expression validation outside of the binary reader. NFC (#1770)
Rather than spocial casing them in the reader we now use the same
instruction callbacks for instruction that appear in init expressions as
instructions that appear in normal functions.
The result of this change is the validation of init expressions is pushed
further up the stack. For example, objdump will now quite happily dump
modules that use arbitrary instructions in thier init expressions even
though they are not valid. To me, this makes sense since objdump does
not do instruction validation elsewhere.
The change is pre-cursor to allowing a wider variety of instruction
to be present in init expressions.
See https://github.com/WebAssembly/extended-const
Diffstat (limited to 'src/binary-reader-logging.cc')
-rw-r--r-- | src/binary-reader-logging.cc | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/src/binary-reader-logging.cc b/src/binary-reader-logging.cc index 6e0779a5..d9ae7dd7 100644 --- a/src/binary-reader-logging.cc +++ b/src/binary-reader-logging.cc @@ -491,48 +491,6 @@ Result BinaryReaderLogging::OnNameEntry(NameSectionSubsection type, return reader_->OnNameEntry(type, index, name); } -Result BinaryReaderLogging::OnInitExprF32ConstExpr(Index index, - uint32_t value_bits) { - float value; - memcpy(&value, &value_bits, sizeof(value)); - LOGF("OnInitExprF32ConstExpr(index: %" PRIindex ", value: %g (0x04%x))\n", - index, value, value_bits); - return reader_->OnInitExprF32ConstExpr(index, value_bits); -} - -Result BinaryReaderLogging::OnInitExprF64ConstExpr(Index index, - uint64_t value_bits) { - double value; - memcpy(&value, &value_bits, sizeof(value)); - LOGF("OnInitExprF64ConstExpr(index: %" PRIindex " value: %g (0x08%" PRIx64 - "))\n", - index, value, value_bits); - return reader_->OnInitExprF64ConstExpr(index, value_bits); -} - -Result BinaryReaderLogging::OnInitExprV128ConstExpr(Index index, - v128 value_bits) { - LOGF("OnInitExprV128ConstExpr(index: %" PRIindex - " value: ( 0x%08x 0x%08x 0x%08x 0x%08x))\n", - index, value_bits.u32(0), value_bits.u32(1), value_bits.u32(2), - value_bits.u32(3)); - return reader_->OnInitExprV128ConstExpr(index, value_bits); -} - -Result BinaryReaderLogging::OnInitExprI32ConstExpr(Index index, - uint32_t value) { - LOGF("OnInitExprI32ConstExpr(index: %" PRIindex ", value: %u)\n", index, - value); - return reader_->OnInitExprI32ConstExpr(index, value); -} - -Result BinaryReaderLogging::OnInitExprI64ConstExpr(Index index, - uint64_t value) { - LOGF("OnInitExprI64ConstExpr(index: %" PRIindex ", value: %" PRIu64 ")\n", - index, value); - return reader_->OnInitExprI64ConstExpr(index, value); -} - Result BinaryReaderLogging::OnDylinkInfo(uint32_t mem_size, uint32_t mem_align, uint32_t table_size, @@ -907,10 +865,6 @@ DEFINE_END(EndNamesSection) DEFINE_BEGIN(BeginRelocSection) DEFINE_END(EndRelocSection) -DEFINE_INDEX_INDEX(OnInitExprGlobalGetExpr, "index", "global_index") -DEFINE_INDEX_TYPE(OnInitExprRefNull) -DEFINE_INDEX_INDEX(OnInitExprRefFunc, "index", "func_index") - DEFINE_BEGIN(BeginDylinkSection) DEFINE_INDEX(OnDylinkNeededCount) DEFINE_INDEX(OnDylinkExportCount) |