Commit Graph

10 Commits

Author SHA1 Message Date
Lachlan Sneff
66a150e67a lib/wasm works with no_std 2018-02-23 20:56:30 -08:00
Dan Gohman
ee0f061ee8 Rename "runtime" to "environment". 2017-10-18 16:55:32 -07:00
Dan Gohman
733870aee4 Make FuncEnvironment independent from ModuleEnvironment (formerly WasmRuntime).
This renames WasmRuntime to ModuleEnvironment, and makes several changes
to allow for more flexible compilation.

ModuleEnvironment no longer derives from FuncEnvironment, and no longer
has the `begin_translation` and `next_translation` functions, so that
independent `FuncEnvironment` instances can operate within the same
module.

Also, this obviates the rest of TranslationResult, as it moves processing
of function bodies into the environment. The DummyEnvironment implementation
gives an example of decoding the function bodies as they are parsed, however
other implementation strategies are now possible.
2017-10-10 15:50:24 -07:00
Jakob Stoklund Olesen
439a40e5e4 Add a WebAssembly function translator.
The new FuncTranslator type can be used to translate binary WebAssembly
functions to Cretonne IL one at a time. It is independent of the
module-level parser also present in the cretonne-wasm crate.
2017-09-07 16:12:48 -07:00
Dan Gohman
c0f3eaafbc Publically declare GlobalValue.
It's used in the publically declared FuncEnvironment trait, so library
users should be able to name it.
2017-09-07 10:36:37 -07:00
Jakob Stoklund Olesen
062dd41c93 Don't export the 'Local' type from cton_wasm.
This type is not longer used in any public interface, it has become an
internal implementation detail.

Also remove some unused exported types from the crate.
2017-09-06 15:56:39 -07:00
Jakob Stoklund Olesen
dc2bee9cef Add a FuncEnvironment::make_direct_func() callback.
This allows the environment to control the signatures used for direct
function calls. The signature and calling convention may depend on
whether the function is imported or local.

Also add WasmRuntime::declare_func_{import,type} to notify the runtime
about imported and local functions. This is necessary so the runtime
knows what function indexes are referring to .

Since imported and local functions are now declared to the runtime, it
is no longer necessary to return hashes mapping between WebAssembly
indexes and Cretonne entities.

Also stop return null entries for the imported functions in the
TranslationResult. Just return a vector of local functions.
2017-09-06 12:36:19 -07:00
Jakob Stoklund Olesen
03939e4f9f Move TranslationState into its own module.
Add some convenience methods for common state access patterns.
2017-09-01 15:55:02 -07:00
Dan Gohman
f905dc914b Enable missing_docs errors in the wasm crate.
This adds `#![deny(missing_docs)]` to the wasm crate, and adds documentation
to several struct and enum fields, as needed.
2017-08-28 17:07:28 -07:00
Denis Merigoux
ee9989c4b9 Dumped code from the wasm2cretonne repo.
Integrated wasm test suite translation as cretonne test

Fixes #146.
Fixes #143.
2017-08-28 15:57:43 -07:00