| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
| |
This matches the wording preferred by llvm.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The class stores just one enum, so should be optimized to be passed as a
register. Since it is an object, the get_opcode_* accessors can now be
members:
get_opcode_name(opcode) => opcode.GetName()
One side-effect of this change is that the opcode enumeration does not
match its binary encoding. This is a potential source of errors, but
will allows us to use a contiguous set of values for the enumeration, so
Opcode::GetInfo is an O(1) lookup. It will also be beneficial when
adding operators with prefixed encodings.
|
| |
|
| |
|
|
|
|
|
| |
Also, use C++ constructor inheritance to avoid some
boilerplate constructors.
|
| |
|
|
|
|
|
|
|
| |
Also, have wasmdump list debug names for function table
elements.
These changes make it easier to interpret the wasm-link
test outputs.
|
|
|
|
|
|
| |
Also change formatting of uint32_t operands (`i32.const`, `grow_memory`, `current_memory`) to `%u`.
Fixes #445.
|
| |
|
|
|
|
| |
Also print Index types as decimal rather than hex
since this seems to be the convention elsewhere.
|
|
|
|
|
|
|
|
|
|
|
|
| |
An `Index` is an index into one of the WebAssembly index spaces. It also
is used for counts for these spaces, as well as parameter counts and
result counts.
An `Address` is an index into linear memory, or the size of a data
region in linear memory.
An `Offset` is an offset into the host's file or memory buffer.
This fixes issue #322.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
This mimick how objdump behaves. Also makes the code more
readable.
|
|
|
|
|
|
|
|
| |
For data segments, print the file offsets so they match
the file offsets shown when dumping relocations.
For relocations, only show the addend when one is present
and correctly display negative addends in the same way that
objdump does (e.g. symbol_foo-0x10 and symbol_foo+0x10)
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes issue #326.
* Install target installs all executables; this is required because we don't
actually know where MSVC builds its targets to
* Use absolute paths when running all executables
* Set `PYTHONPATH` to test directory; for some reason the Windows `sys.path`
doesn't include the current script's directory
* In `wasmdump`, strip the directory up to the last slash or backslash
* In `wasm-interp`, Use round-to-nearest-ties-to-even when converting from
uint64 to float or double
* Check for backslash or slash in `get_dirname` in `wasm-interp`, when looking
for modules alongside the JSON file
* print floats in `wasm-interp` using `%f` not `%g`, since MSVC prints using 3
digits for exponent instead of 2
* In `run-wasm-link.py`, remove file before renaming on top of it
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This adds a few new classes:
* BinaryReader: the abstract base class
* BinaryReaderNop: implements all of BinaryReader, but does nothing
* BinaryReaderLogging: logs calls through BinaryReader, and forwards to
another BinaryReader
Typically this means we can remove the Context structs from these
implementations, since that data can just move into the BinaryReader
subclasses.
I also took the opportunity to rename the new member functions to
MixedCase instead of snake_case, since that's more common in C++.
|
|
|
|
|
| |
Previously we could nest the local names inside the
function names, but in the new names sections the locals
all come later on.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This propagates through a lot of code since std::vector will call
constructors and destructors. In particular, this CL adds many default
constructors and destructors to previously POD types. Many of them are
only there to construct `Var` and `StringSlice` types, so they likely
can be removed when those have their own constructors.
Since unions members cannot contain constructors or destructors
(without additional implementation), this CL changes those members to
pointers instead. (Perhaps in a future CL these will be std::variant
instead of union, so the members can be value types again.)
|
|
|
|
| |
Print the addend and make it more clear what the
different offsets mean.
|
|
|
|
|
| |
Without this objdump doesn't show the final byte/opcode
of each function.
|
|
|
|
|
|
|
|
| |
Context is the most common potential problem here, but I noticed that
wasm-link.h had some others too (DataSegment and Export).
These probably aren't an issue yet, since they all have trivial
constructors. As soon as we add non-trivial types to these they break
though.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When the binary logging is turned on, it can't use the
`reader->on_error` directly since that function expects that the
user_data is the BinaryReaderInterpreter context (for example), but it
is actually the LoggingContext.
To make it easier for users to use the default error handler, now they
return a bool saying whether the error was handled.
Some additional changes:
* Add a test that uses logging and succeeds
* Add a test that uses logging and has an error
* Change the `run-*-interp.py` scripts to use `-t` for tracing and `-v`
for logging
|
|
|
|
|
|
|
|
|
|
|
| |
This brings wabt into line with what llvm is now
producing and what is soon that land in the
tool-conventions "spec" for static linking.
Adds 'index' and (options) 'addend' to relocations.
Define Reloc in common.h rather than once for each
tool.
|
|
|
|
|
|
|
|
|
| |
* pass module/field names to on_import_*
simplify some code that no longer needs to store the field name in a
context.
* remove nop method
|
| |
|
|
|
|
|
| |
Enable logging in the binary reader when the --debug
flag is passed to wasmdump and wasm-link
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* support the new extensible "name" section
as specified in https://github.com/WebAssembly/design/commit/cd2af4d8149b23be87cc9eabbc4a97c7029178ad
* robustness, use enum class for name section subsections
* fix tests to expect actual output
* fix linker to parse and emit extensible name section
* remove duplicated code
* don't skip functions without locals when writing the local subsection
* use wabt_snprintf; remove duplicated code
|
| |
|
| |
|
| |
|
| |
|
|
|
| |
Also switch to using C++11.
|
|
Mostly this involves adding additional casts. Though there are a few
more substantial changes:
* The default method for relocating parser stacks no longer works
because Bison assumes that C++ values can't be memcpy'd. Ours can, but
there's no easy way to make the generated code do the right thing, so
we do it manually
* Removed all uses of WabtBool and replaced with bool
* Renamed all uses of export and mutable -> export_ and mutable_
* Casting an invalid value to an enum triggers ubsan, so we have to be a
little more careful about when we do it (see binary-reader.c:read_sections())
* It's illegal to forward-declare enums, so we just #include instead.
* Designated initializers are not allowed in g++, so we have to switch
them to lazily initialized structures instead. Pretty horrible, so it
will be nice to have a better solution for C++.
|