Age | Commit message (Collapse) | Author |
|
These function couldn't be inlined before because the compiler would've
started flagging invalid paths in Variant as maybe-uninitialized.
|
|
With these, the only remaining unimplemented instructions are the
following:
- memory.init
- data.drop
- memory.copy
- memory.fill
- table.init
- elem.drop
- table.copy
- table.grow
- table.size
- table.fill
|
|
|
|
|
|
|
|
Against my better judgement, this change is mandated by the project code
style rules, even if it's not actually enforced.
|
|
This commit is a fairly large refactor, mainly because it unified the
two different ways that existed to represent references.
Now Reference values are also a kind of value.
It also implements a printer for values/references instead of copying
the implementation everywhere.
|
|
Unlike its name, this instruction has nothing to do with tables, it's
just a very simple switch-case instruction.
|
|
The spec says so, we must do so.
|
|
|
|
|
|
Checking for this (and get()'ing it) is always invalid, so let's just
disallow it.
This also finds two bugs where the code is checking for types that can
never actually be in the variant (which was actually a refactor
artifact).
|
|
Also makes normal arithmetic operations more spec-compliant by actually
ignoring overflow on them.
|
|
|
|
|
|
This should allow running modules with their imports stubbed out
in wasm, to debug them.
|
|
|
|
Previously ByteBuffer::grow() behaved like Vector<T>::resize().
However the function name was somewhat ambiguous - and so this patch
updates ByteBuffer to behave more like Vector<T> by replacing grow()
with resize() and adding an ensure_capacity() method.
This also lets the user change the buffer's capacity without affecting
the size which was not previously possible.
Additionally this patch makes the capacity() method public (again).
|
|
Instead of applying a unary operator to the ToS.
This alone fixes 4% of the spec test issues.
|
|
Just trap instead of crashing.
|
|
The check was negated, and it errored out when the read actually
succeeded.
|
|
Also make the stack a lot bigger, since we now have only one of these
instead of one per function call.
|
|
|
|
|
|
This allows multiply different kinds of interpreters to be used by the
runtime; currently a BytecodeInterpreter and a
DebuggerBytecodeInterpreter is provided.
|
|
This should make it easier to implement multiple types of interpreters
on top of a configuration, and also give a small speed boost in not
initialising as many Stack objects.
|
|
This means stack operations will no longer do extra allocations.
|
|
Doing that was causing a lot of malloc/free traffic, but since there's
no need to have a stable pointer to them, we can just store them by
value.
This makes execution significantly faster :^)
|
|
This is useful for debugging *our* implementation of wasm :P
|
|
|
|
|
|
This finally works correctly. :tm:
|
|
Prior to this commit, we would be dropping an extra frame.
|
|
This implements the 8 i<n>.truncate.f<n>_<s> instructions.
|
|
This allows the JS side to access the wasm memory, assuming it's
exported by the module.
This can be used to draw stuff on the wasm side and display them from
the js side, for example :^)
|
|
These limits are in units of page size, not bytes.
Also fixes incorrect debug logs.
|
|
This allows Wasm code to call javascript functions.
|
|
|
|
Previously, the ip would not be propagated correctly, and we would
produce invalid jumps when more than one level of nesting was involved.
This makes loops work :P
|
|
Otherwise "label index 0" would be the first ever created label, not the
last one (as the spec wants) :^(
|
|
This will simply "link" any given module instances and produce a list of
external values that can be used to instantiate a module.
Note that this is extremely basic and cannot resolve circular
dependencies, and depends on the instance order.
|
|
Managing the instantiated modules becomes a pain if they're on the
stack, since an instantiated module will eventually reference itself.
To make using this simpler, just avoid copying the instance.
|
|
This fixes a FIXME and will allow linking only select modules together,
instead of linking every instantiated module into a big mess of exported
entities :P
|
|
...unless something really is an assertion.
|
|
This only tests "can it be parsed", but the goal of this commit is to
provide a test framework that can be built upon :)
The conformance tests are downloaded, compiled* and installed only if
the INCLUDE_WASM_SPEC_TESTS cmake option is enabled.
(*) Since we do not yet have a wast parser, the compilation is delegated
to an external tool from binaryen, `wasm-as`, which is required for the
test suite download/install to succeed.
This *does* run the tests in CI, but it currently does not include the
spec conformance tests.
|
|
These aren't actually an extra set, without them the fold operation
would be syntactically invalid.
Also remove possible cast of float->double/double->float in Value::to()
|
|
These allow a very basic memory-using program to work.
|
|
|
|
This commit is a bit of a mixed bag, but most of the changes are
repetitive enough to just include in a single commit.
The following instructions remain unimplemented:
- br.table
- table.init
- table.get
- table.set
- table.copy
- table.size
- table.grow
- table.fill
- ref.null
- ref.func
- ref.is_null
- drop
- i32/i64.clz
- i32/i64.ctz
- i32/i64.popcnt
- i32/i64.rotl
- i32/i64.rotr
- X.trunc.Y
- X.trunc_sat.Y
- memory.size
- memory.grow
- memory.init
- memory.copy
- memory.fill
- elem.drop
- data.drop
|
|
As the parser now flattens out the instructions and inserts synthetic
nesting/structured instructions where needed, we can treat the whole
thing as a simple parsed bytecode stream.
This currently knows how to execute the following instructions:
- unreachable
- nop
- local.get
- local.set
- {i,f}{32,64}.const
- block
- loop
- if/else
- branch / branch_if
- i32_add
- i32_and/or/xor
- i32_ne
This also extends the 'wasm' utility to optionally execute the first
function in the module with optionally user-supplied arguments.
|