Maintain an explicit "reachable" flag when decoding wasm. Push placeholder
frames on the control-flow stack instead of just maintaining a count of
the stack depth in unreachable code, so that we can whether If blocks
have Elses, and whether block exits are branched to, in all contexts.
Fixes#217.
Rename the ArgumentType type to AbiParam since it describes the ABI
characteristics of a parameter or return value, not just the value type.
In Signature, rename members argument_types and return_types to "params"
and "returns". Again, they are not just types.
Fix a couple lingering references to "EBB arguments".
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.
The function environment is now expected to keep track of the function
signatures in the module, and it is asked to generate Cretonne
signatures to be used for indirect calls.
The combination of make_indirect_sig() and translate_call_indirect()
callbacks allow the runtime to insert additional function arguments for
indirect calls such as vmctx pointers and CFI-style signature identifiers.
This trait is used to provide the environment necessary to translate a
single WebAssembly function without having other global data structures
for the WebAssembly module.
The WasmRuntime trait extends the FuncEnvironment trait for those uses
that want to parse a whole WebAssembly module.
- Change the handling of WebAssembly globals to use the FuncEnvironment
trait as well as the new GlobalVar infrastructure in Cretonne. The
runtime is not consulted on the translation of each
get_global/get_global instruction. Instead it gets to create the
GlobalVar declaration in the function preamble the first time the
global is used.
- Change the handling of heap load/store instructions to use the new
Heap infrastructure in Cretonne. The runtime is called to create the
Heap declaration in the preamble. It is not involved in individual
load/store instructions.