Commit Graph

47 Commits

Author SHA1 Message Date
Yury Delendik
ddbc00752e Generate debug info for LLDB/GDB (#50)
* Transform DWARF sections into native format for wasm2obj and wasmtime.

Generate DWARF sections based on WASM DWARF.
Ignore some of debug_info/debug_line for dead code.

* Fix test
2019-03-06 16:03:32 -08:00
Dan Gohman
04d4b20df4 Fix clippy.toml paths and a few clippy lints. 2019-03-01 15:49:29 -08:00
Dan Gohman
3827bc7a04 Avoid struct name repetitions. 2019-02-26 08:54:36 -08:00
Dan Gohman
601057ec42 Tidy up a redundant field name. 2019-02-26 08:54:36 -08:00
Dan Gohman
3cc113482d Rename InstanceContents to Instance. 2019-02-26 08:54:36 -08:00
Dan Gohman
5f201f6d73 Rename Instance to InstanceHandle. 2019-02-26 08:54:36 -08:00
Dan Gohman
077ee717a8 Make Instance a refcounting handle around InstanceContents. 2019-02-26 08:54:36 -08:00
Dan Gohman
a8cd5ef613 Refactor Instance's methods to just be wrappers around InstanceContents methods. 2019-02-26 08:54:36 -08:00
Dan Gohman
1ab9e17517 Move Instance's module field into InstanceContents. 2019-02-26 08:54:36 -08:00
Dan Gohman
8b140cc748 Create a Context class to group together various state objects. 2019-02-01 18:20:59 -08:00
Dan Gohman
4675948c2a Switch to passing the vmctx hidden argument at the beginning.
This switches to passing the vmctx hidden argument at the beginning of
the argument list, rather than the end.
2019-02-01 18:20:28 -08:00
Joel Martin
fdcb2184a8 Support 32-bit build. (#44)
* Support 32-bit build.

Signatures/functions/imports/exports etc are defined as varuint32 in
the WebAssembly specification so use u32 rather than u64.

Decrease the static memory constants for 32-bit addressing mode so
that they fit within 32-bit memory constraints.

Conditionalize cmake compile of SignalHandlers.cpp so that -m32 is
passed when building 32-bit.

Add a no-op match for Reloc::X86CallPCRel4 during linking. This is
probably the wrong thing, but it allows the tests to pass. Using the
same logic from the Reloc::X86PCRel4 case did not work.
2019-01-24 13:40:25 -08:00
Dan Gohman
00a4e93bcd Add a concept of "global exports".
This adds a feature which allows one to look up an export by name
without knowing what module it's in -- `lookup_global_export` on an
`InstanceContents`.

The main expected use for this is to support APIs where module A
imports a function from module B, and module B needs to access module
A's memory. B can't import it from A in the normal way, because that
would create a dependency cycle. So for now, allow B to look up A's
exported memory dynamically with `lookup_global_export`.

In the future, with reference types and possibly host bindings, we'll be
able to pass references to memory as arguments, which will obviate the
need for this mechanism.
2019-01-22 16:32:07 -08:00
Dan Gohman
9fe08c9341 Tidy up pointer casting to avoid casts that change mutability. 2019-01-08 10:31:58 -08:00
Dan Gohman
0a2b0ee9b0 Mmap API tidying.
Establish more clear expectations for who is expected to page-align what
and when.
2019-01-06 10:08:40 -08:00
Dan Gohman
0826e32c9a Tidy up unnecessary return statements. 2019-01-05 16:23:04 -08:00
Dan Gohman
3ac4269dc5 Add host_state() accessors to InstanceContents and VMContext too. 2019-01-04 17:24:14 -08:00
Dan Gohman
73b2c45313 Add a host_state field to Instance.
This allows hosts to embed arbitrary state along with instances.
2019-01-04 17:15:22 -08:00
Dan Gohman
3aef763046 Delete an unneeded comment. 2019-01-03 15:50:04 -08:00
Dan Gohman
6661228c86 Tidy up whitespace. 2019-01-03 14:44:30 -08:00
Dan Gohman
ca2fdc5ccb Update no_std support.
This `no_std` support isn't complete though, as some dependencies
don't support it.
2019-01-03 14:16:48 -08:00
Dan Gohman
f6c2fe7d2d Update to Rust 2018 Edition. 2019-01-03 12:58:11 -08:00
Dan Gohman
39770ec72c Minor code tidying. 2019-01-03 12:05:26 -08:00
Dan Gohman
8a5429ce74 Factor out functions for working with table and memory initializers. 2019-01-03 12:04:58 -08:00
Dan Gohman
2f04b78ecf Use cast::usize rather than as usize to avoid silent overflow. 2019-01-03 12:04:24 -08:00
Dan Gohman
529de7ca60 Tidy up unneeded '&'s. 2019-01-03 12:03:52 -08:00
Dan Gohman
c66a3c23f3 Tidy up some documentation comments. 2019-01-03 12:03:43 -08:00
Dan Gohman
3ce2127bfa Eliminate the intermediate "base" global variables. 2019-01-03 12:03:33 -08:00
Dan Gohman
3270369a69 Restructure VMContext to eliminate a level of indirection. 2019-01-03 12:02:35 -08:00
Dan Gohman
ff6776fe10 Refactor instance accessor routines.
This helps localize the unsafe code needed to access these fields.
2019-01-03 11:49:25 -08:00
Dan Gohman
087b5b4dff Implement cross-instance indirect calls. 2019-01-03 11:48:53 -08:00
Dan Gohman
9d73123e3e Reformat a comment to fit within 100 columns. 2019-01-03 11:48:34 -08:00
Dan Gohman
7592c99f3b Refactor the compilation and instantiation pipeline.
wasmtime-execute is now wasmtime-jit. Move `JITCode` and the TargetIsa
into a new `Compiler` type. `InstancePlus` is no more, with trampoline
functionality now handled by `Compiler`.
2019-01-03 11:47:55 -08:00
Dan Gohman
71c0142cd4 Rename the address field of Table/Memory/Global exports to definition.
For functions, `address` makes sense because it's the address of the
function. Bt for Table/Memory/Global, it points to a `VM*Definition` field.
2018-12-24 18:20:15 -08:00
Dan Gohman
0c0ccc5d09 Add unsigned access methods to VMGlobalDefinition. 2018-12-13 15:50:58 -08:00
Dan Gohman
26eb8131da Avoid unnecessary clone() calls. 2018-12-13 09:13:04 -08:00
Dan Gohman
3f24098edc Implement the remaining valid spec tests.
And lots of other miscellaneous changes. Rename InstanceWorld to
InstancePlus and reorganize its contents. This still isn't a great name,
but at least now it has a clear purpose.
2018-12-12 11:49:02 -08:00
Dan Gohman
56850d481d Initial support for function, table, memory, and global imports. 2018-12-11 12:49:14 -08:00
Dan Gohman
831b481f13 More code reorganization. 2018-08-03 14:18:23 -07:00
Dan Gohman
779128d14d Factor out FuncEnvironment and ModuleEnvironment into a separate file. 2018-08-03 13:04:05 -07:00
Dan Gohman
dd3a9dab6e Make an initial pass through clippy warnings. 2018-07-21 06:46:53 -07:00
Dan Gohman
2608dd0c47 Update to cranelift 0.16.1, target-lexicon 0.0.3, faerie 0.4.4. 2018-07-21 06:46:19 -07:00
Dan Gohman
99ee96ca16 Update to latest stable rustfmt-preview. 2018-06-07 14:17:56 -07:00
Dan Gohman
b5e794a584 Update to Cretonne 0.8.0. 2018-05-14 12:58:28 -10:00
Dan Gohman
f276a021cb Update wasmstandalone for API changes.
This updates to the latest faerie and cretonne API changes.
2018-02-22 09:44:02 -08:00
Dan Gohman
29db33e7f8 Replace reserve with reserve_exact when applicable. 2017-11-17 11:14:45 -08:00
Dan Gohman
ca1b461375 Begin internal reorganization.
This begins reorganizing how translation and compilation occur, and
setting up infrastructure for imports/exports and relocations. It
splits parts out of StandaloneRuntime, forming Module, Compilation,
and Instance structs, which can be used more independently.

It also simplifies the command-line interface, in a step towards
making simple tools that just expose the functionality of the
libraries.
2017-10-13 14:47:01 -07:00