diff options
author | Ben Smith <binji@chromium.org> | 2020-02-21 14:11:44 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-21 14:11:44 -0800 |
commit | 24a12ecfdde0246527506c87bd82460beb761c57 (patch) | |
tree | 242550e84d516926a71bef00342f4f57d011d4f6 /test/interp/atomic-load.txt | |
parent | bb4b65186668ff3ebd2f088778337608969a9567 (diff) | |
download | wabt-24a12ecfdde0246527506c87bd82460beb761c57.tar.gz wabt-24a12ecfdde0246527506c87bd82460beb761c57.tar.bz2 wabt-24a12ecfdde0246527506c87bd82460beb761c57.zip |
New interpreter (#1330)
It's modeled closely on the wasm-c-api. All runtime objects are
garbage-collected. The GC'd objects are subclasses of `Object` and all
stored in the `Store`. GC roots can be created using a RefPtr<T> struct.
The `Module` stores no runtime objects, only description structs (named
`*Desc`, e.g. `FuncDesc`). Instantiation takes these descriptors and
turns them into runtime objects (e.g. `FuncDesc` is used to create a
`Func`). Only import-matching occurs during instantiation; all other
validation is assumed to have occurred during Module compilation.
As with the previous interpreter, the wasm instructions are not executed
directly, and instead compiled to an instruction stream that is easier
to interpret (e.g. all branches become gotos). It's still a stack
machine, though.
The previous interpreter would always compile and instantiate in one
step, which means that it was always known whether an imported function
is a host function or wasm function. As a result, calls between modules
that stayed in wasm could be very cheap (just update PC). Now that the
module is compiled before instantiation, an imported function call
always has to check first, which may be a slight performance hit.
One major difference to the structure of the interpreter is that
floating-point values are passed directly, instead of using their
equivalent bit pattern. This is more convenient in general, but requires
annotating all functions with WABT_VECTORCALL so Visual Studio x86 works
properly (otherwise floats are passed in the x87 FP stack).
Instruction stream decoding/tracing/disassembling is now all handled in
the `Istream` class. This reduces a lot of duplication between the
three, which makes the logging-all-opcodes and tracing-all-opcodes less
valuable, so I've removed them.
Here are the changes to files:
binary-reader-metadata.{h,cc} -> [removed]
interp-{disassemble.trace}.cc -> istream.{h,cc}
There are new helper files:
interp-util.{h,cc}: Primarily print debugging functions
interp-math.h: Templates used for handling wasm math
Diffstat (limited to 'test/interp/atomic-load.txt')
-rw-r--r-- | test/interp/atomic-load.txt | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/test/interp/atomic-load.txt b/test/interp/atomic-load.txt index fb244cab..b450f236 100644 --- a/test/interp/atomic-load.txt +++ b/test/interp/atomic-load.txt @@ -46,9 +46,9 @@ i64.atomic.load8_u() => i64:255 i64.atomic.load16_u() => i64:65535 i64.atomic.load32_u() => i64:1104019456 i64.atomic.load() => i64:4741727461962678271 -bad.align-i32.atomic.load16_u() => error: atomic memory access is unaligned -bad.align-i32.atomic.load() => error: atomic memory access is unaligned -bad.align-i64.atomic.load16_u() => error: atomic memory access is unaligned -bad.align-i64.atomic.load32_u() => error: atomic memory access is unaligned -bad.align-i64.atomic.load() => error: atomic memory access is unaligned +bad.align-i32.atomic.load16_u() => error: invalid atomic access at 1+0 +bad.align-i32.atomic.load() => error: invalid atomic access at 2+0 +bad.align-i64.atomic.load16_u() => error: invalid atomic access at 1+0 +bad.align-i64.atomic.load32_u() => error: invalid atomic access at 2+0 +bad.align-i64.atomic.load() => error: invalid atomic access at 4+0 ;;; STDOUT ;;) |