diff options
author | Ben Smith <binjimin@gmail.com> | 2017-08-16 10:12:03 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-16 10:12:03 -0700 |
commit | bc3deb3288252866d9b571cd28c4104b9ffffd56 (patch) | |
tree | d39d5056d954240f541b11f7c3a2d80b7c31d256 /src/binary-reader-objdump.cc | |
parent | 3d3920f6d9388c46af6725dabb34d98752958d8d (diff) | |
download | wabt-bc3deb3288252866d9b571cd28c4104b9ffffd56.tar.gz wabt-bc3deb3288252866d9b571cd28c4104b9ffffd56.tar.bz2 wabt-bc3deb3288252866d9b571cd28c4104b9ffffd56.zip |
Add saturating float truncation operators (#573)
Add saturating truncation operators as described here:
https://github.com/webassembly/nontrapping-float-to-int-conversions.
This change also codifies the mechanism for enabling new WebAssembly features
by passing the `Features` object. Opcode now has a `IsEnabled(const Features&)`
member function to query if the opcode is enabled. This means that the
`--future-exceptions` flag has been renamed to `--enable-exceptions` for
consistency. Checking whether the feature is enabled always happens at input;
either WastParser or BinaryReader.
Diffstat (limited to 'src/binary-reader-objdump.cc')
-rw-r--r-- | src/binary-reader-objdump.cc | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/binary-reader-objdump.cc b/src/binary-reader-objdump.cc index f295a020..ad8f600f 100644 --- a/src/binary-reader-objdump.cc +++ b/src/binary-reader-objdump.cc @@ -70,7 +70,6 @@ BinaryReaderObjdumpBase::BinaryReaderObjdumpBase(const uint8_t* data, data(data), size(size) { ZeroMemory(section_starts); - BinaryReaderNop::allow_future_exceptions = options->allow_future_exceptions; } Result BinaryReaderObjdumpBase::BeginSection(BinarySection section_code, @@ -211,7 +210,7 @@ class BinaryReaderObjdumpDisassemble : public BinaryReaderObjdumpBase { Opcode current_opcode = Opcode::Unreachable; Offset current_opcode_offset = 0; - size_t last_opcode_end = 0; + Offset last_opcode_end = 0; int indent_level = 0; Index next_reloc = 0; }; @@ -223,7 +222,7 @@ Result BinaryReaderObjdumpDisassemble::OnOpcode(Opcode opcode) { } if (last_opcode_end) { - if (state->offset != last_opcode_end + 1) { + if (state->offset != last_opcode_end + opcode.GetLength()) { Opcode missing_opcode = Opcode::FromCode(data[last_opcode_end]); const char* opcode_name = missing_opcode.GetName(); fprintf(stderr, @@ -249,12 +248,16 @@ void BinaryReaderObjdumpDisassemble::LogOpcode(const uint8_t* data, Offset offset = current_opcode_offset; // Print binary data - printf(" %06" PRIzx ": %02x", offset - 1, current_opcode.GetCode()); + printf(" %06" PRIzx ":", offset - 1); + if (current_opcode.HasPrefix()) + printf(" %02x", current_opcode.GetPrefix()); + printf(" %02x", current_opcode.GetCode()); for (size_t i = 0; i < data_size && i < IMMEDIATE_OCTET_COUNT; i++, offset++) { printf(" %02x", data[offset]); } - for (size_t i = data_size + 1; i < IMMEDIATE_OCTET_COUNT; i++) { + for (size_t i = data_size + current_opcode.GetLength(); + i < IMMEDIATE_OCTET_COUNT; i++) { printf(" "); } printf(" | "); @@ -1102,7 +1105,7 @@ Result ReadBinaryObjdump(const uint8_t* data, ReadBinaryOptions read_options; read_options.read_debug_names = true; read_options.log_stream = options->log_stream; - read_options.allow_future_exceptions = options->allow_future_exceptions; + read_options.features = options->features; switch (options->mode) { case ObjdumpMode::Prepass: { |