Commit Graph

25 Commits

Author SHA1 Message Date
Dan Gohman
f44fe25f9c Rewrite linear memory handling in terms of simple mmap/VirtualAlloc.
The memmap crate doesn't make it straightforward to have part of the
region be writeable and part readonly. Since this is a fairly boutique
use case, and we don't need all that much code, just use the low-level
APIs directly.

Also, introduce a concept of "tunables" for adjusting the parameters of
the runtime.
2018-12-05 02:25:34 -05:00
Dan Gohman
35627cf37f Implement wasm trap handlers. (#27)
* Implement wasm trap handlers.

This adds signal handlers based on SpiderMonkey's signal-handler code.
The functionality for looking up the trap code and wasm bytecode offset
isn't yet implemented, but this is a start.

I considered rewriting this code in Rust, but decided against it for now
as C++ allows us to talk to the relevant OS APIs more directly.

Fixes #15.

* Compile with -std=c++11.

* Refactor InstallState initialization.

* Compile with -fPIC.

* Factor out the code for calling a wasm function with a given index.

* Fix unclear wording in a comment.
2018-11-27 06:05:58 -08:00
Geoffroy Couprie
bf5a06bc95 separate the context intialization from the function execution (#21)
the start function is called from the initialization phase
2018-11-27 05:33:56 -08:00
Dan Gohman
e8201d0f93 Begin work on no_std support.
This adds no_std support to a bunch of things, but more work is needed.
2018-11-26 04:52:39 -08:00
Dan Gohman
5a96e022db Update to the rustfmt in rust 1.29, which is now stable. 2018-10-09 14:36:48 -07:00
Dan Gohman
fb7153ccf4 Update to cranelift 0.20.0.
The biggest change is the split from FunctionIndex to
DefinedFuncIndex to FuncIndex. Take better advantage of this by
converting several Vecs to PrimaryMaps.

Also, table_addr can now handle indices of the table index type,
so we don't need to explicitly uextend them anymore.
2018-08-28 20:56:58 -07:00
Sergey Pepyakin
e7c8d23a42 Implement memory.grow and memory.current (#9)
* Implement.

* Clean and doc

* Collect base addresses instead of leaking them

* Fix code for 1.25.

* Simplify $assert

* Use AbiParam::special.

* Use &mut self in base_addr
2018-08-11 06:52:43 -07:00
Dan Gohman
548c45c604 Rename wasmtime-runtime to wasmtime-environ.
This mirrors changes in cranelift.
2018-08-03 15:20:19 -07:00
Dan Gohman
ef5254c0da More code reorganization and cleanups. 2018-08-03 15:06:59 -07:00
Dan Gohman
831b481f13 More code reorganization. 2018-08-03 14:18:23 -07:00
Dan Gohman
6659ef7018 More code reorganization. 2018-08-03 13:35:25 -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
c612d48b33 Rename to wasmtime. It's wasmtime!
Also, update to Cretonne 0.13.0.
2018-07-02 16:20:22 -07:00
Dan Gohman
99ee96ca16 Update to latest stable rustfmt-preview. 2018-06-07 14:17:56 -07:00
Dan Gohman
46a772ba67 Add a TODO about avoiding ReadWriteExecute mappings. 2018-05-17 23:59:40 -07:00
Dan Gohman
52f1171485 Make all the function bodies executable, not just the start function. 2018-05-17 23:56:05 -07:00
Dan Gohman
d162f8bc59 Implement Abs8 relocations, and fix X86PCRel4 relocations.
With new versions of cretonne-codegen:

 - Non-colocated calls are emitted as a movabs with an indirect call.
   This uses an Abs8 relocation.

 - Colocated calls are emitted as direct calls, but the "+ 4"
   adjustment is now folded into the addend, so we don't need to
   handle it explicitly in the X86PCRel4 code anymore.
2018-05-17 23:32:31 -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
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
Dan Gohman
3d6f0f7045 Update for Cretonne API changes. 2017-10-10 10:24:15 -07:00
Dan Gohman
142b17a3f0 Delete an unused settings builder. 2017-10-10 09:47:04 -07:00
Dan Gohman
6dea25ee9f Store relocs in a Vec rather than in a HashMap. 2017-10-10 09:45:32 -07:00
Dan Gohman
23bafd1218 Split the runtime and execution code into separate crates. 2017-10-03 14:57:52 -07:00