Commit Graph

24 Commits

Author SHA1 Message Date
Nick Lewycky
2e68b04e24 Make this match return a CompileError instead of use unimplemented!. 2020-06-02 15:54:22 -07:00
Nick Lewycky
870f241fb7 cargo clippy 2020-06-02 15:46:18 -07:00
Nick Lewycky
a03a5e1775 Also make type_to_llvm_ptr return a CompileError instead of using unimplemented!. 2020-06-02 15:46:18 -07:00
Nick Lewycky
7bdd387474 Use blocktype_params_results in lieu of blocktype_to_types.
Remove read_info.rs entirely.

Add `to_compile_error` that converts a WasmResult into a Result<_, CompileError>, use it with `wptype_to_type`. This is a candidate for being moved into shared code.

Many functions had to change to deal with propagating CompileError.
2020-06-02 15:46:16 -07:00
Nick Lewycky
ba8a6d6db6 Update trampoline code and use get_vmctx_ptr_param. 2020-06-02 15:44:39 -07:00
Nick Lewycky
83195a1498 Use abi::func_type_to_llvm when producing an LLVM function type from wasm types.
This renames `func_sig_to_llvm` to `func_type_to_llvm` and deletes the old version in intrinsics::. The new version returns a list of attributes along with the type. Update callers to set these attributes on the function or call site.
2020-06-02 15:44:39 -07:00
Syrus Akbary
1b84525921 Update lib/compiler-llvm/src/trampoline/wasm.rs
Co-authored-by: nlewycky <nick@wasmer.io>
2020-06-01 14:12:50 -07:00
Syrus
2a9ce436f9 Added LLVM callbacks 2020-06-01 13:54:26 -07:00
Nick Lewycky
45e80dec7b Add support for dynamic trampolines in compiler-llvm. 2020-05-29 16:56:41 -07:00
Nick Lewycky
b035ebada2 Code cleanup. Remove reimplementation of type_to_llvm_ptr, use the one in intrinsics instead. 2020-05-26 15:22:24 -07:00
Nick Lewycky
c02cd76623 Refactor trampoline generation to use load_object_file. 2020-05-21 13:53:48 -07:00
Nick Lewycky
11cfe08919 Factor common string out to a constant. 2020-05-20 17:42:30 -07:00
Nick Lewycky
a47a3068f4 Remove #![allow(unused_imports, dead_code)] and fix resulting issues.
Fix nearly-all issues found by clippy too.
2020-05-20 17:18:23 -07:00
Syrus
c76a3d83db Make LLVM work with one-vmctx imported functions 2020-05-19 21:38:10 -07:00
Nick Lewycky
fe42749002 Implement support for imported function calls. They need to be looked up from the vmctx at runtime.
In order to work with spectests, we need to change our function types to include a second fixed parameter, there are now two vmctx's (callee and caller) before any other arguments. Because we have a uniform call sequence for imported and local function calls (which we must have because we store both in the table and don't store what kind it is), we need to change the llvm function types for all our own functions and update how we call them and how we find our own arguments.
2020-05-13 12:49:26 -07:00
Syrus
1363b98e47 Moved Unwind info a bit to make refactor easier 2020-05-04 20:37:28 -07:00
Syrus
2997be7d88 Renamed FuncType to FunctionType 2020-05-04 13:34:05 -07:00
Syrus
20ad3d608f Fixed LLVM with new compiler structure 2020-05-01 22:04:33 -07:00
Nick Lewycky
71eeb135bc Parse a relocation to a different user function out of the object file.
This updates to a newer inkwell to pick up a fix to Section::get_contents. Picking that up changed builder.build_struct_gep to return a Result, and there's many API updates scattered around to support that.

Compute the function names for all local and imported functions in the module in advance and pass that mapping to the function code generation.

debug_trap is added to Intrinsics, though all users are commented out.
2020-04-29 17:41:30 -07:00
Nick Lewycky
944c3d0f2f Fix trampoline generation.
Updates to new API for trampolines, taking two vmctx pointers and reusing the input space to write the returns.

Wasm values are padded to 128-bits.

Removes a pile of dead code.
2020-04-27 16:01:16 -07:00
Nick Lewycky
502e5badf4 Finish emitting and loading the trampoline code.
Turning an LLVM module into a CompiledFunction should be refactored.

Bump to latest inkwell so that we can make use of object_file with the fixes.

Comment out accidentally committed debug code that writes to my home directory.
2020-04-24 17:07:54 -07:00
Nick Lewycky
1de21f0c33 Make translator::intrinsics accessible to trampoline.
Start filling in the code to generate trampolines. Move func_type_to_llvm and type_to_llvm from code.rs to intrinsics.rs so that trampoline code can reuse them.
2020-04-24 16:42:14 -07:00
Nick Lewycky
a6bde15ce5 Connect trampoline code to trampoline module. Still unimplemented. 2020-04-24 16:31:31 -07:00
Syrus
a402691303 First iteration of wasmer-reborn 2020-04-21 21:37:33 -07:00