Commit Graph

48 Commits

Author SHA1 Message Date
Nick Lewycky
5d40787856 Add a compiler-llvm CompilerFunctionKind for the whole module which can occur with the experimental API for engine-native.
Since it's no longer per-function, rename CompilerFunctionKind to CompilerKind.
2020-08-20 23:28:07 -07:00
Nick Lewycky
91414df670 NFC. Import the inkwell::DLLStorageClass name. 2020-08-18 14:20:45 -07:00
Nick Lewycky
36850d6230 Set the DLL storage class to export. 2020-08-17 23:23:39 -07:00
Mark McCaskey
6e974b92cd Run cargo fmt 2020-08-13 18:12:43 -07:00
Mark McCaskey
5049c543dc Rename wasm-common crate to wasmer-types 2020-08-13 17:59:26 -07:00
Nick Lewycky
8daeff8bc8 Fix section names for MachO. 2020-08-07 17:19:55 -07:00
Syrus
f445cc73dd Fixed trampoline section name. 2020-08-06 18:20:17 -07:00
Nick Lewycky
b027949914 Pick section names that are valid in ELF and Macho. 2020-08-06 17:50:22 -07:00
Nick Lewycky
c68e7da972 Emit dynamic trampoline for each function index, not just each signature.
Emit names for trampolines when building through that experimental native pipeline.
2020-08-06 13:39:41 -07:00
Nick Lewycky
9ca46f4f2d Include trampolines in the generated object file. 2020-08-05 14:20:47 -07:00
Nick Lewycky
3d649abe95 Fix trampoline generation with V128 parameter.
Params used to be packed into 64-bit chunks so we'd need to skip one space after processing a V128. We changed to packing them to 128-bit spaces but didn't remove the skipping.
2020-07-30 15:47:42 -07:00
Nick Lewycky
2017acf99e Some clippy cleanup. 2020-06-20 13:43:46 -07:00
Nick Lewycky
c0b2f968e2 more formatting 2020-06-18 16:50:56 -07:00
Nick Lewycky
914da3266b cargo fmt 2020-06-18 16:48:44 -07:00
Nick Lewycky
b527127d0f load_object_file is returning an increasingly complex object.
Group the data from compilation of a function into its own struct and return that.
2020-06-18 16:43:43 -07:00
Nick Lewycky
54c7b6f876 In trampoline generation, ensure all custom sections are eh frames.
.eh_frames may refer to the trampoline, but it is impossible to encode such a relocation. The optional relocation "self-referential" target is replaced with a better named mandatory argument. The value will be discarded in trampoline generation with the rest of the .eh_frame.
2020-06-18 15:37:08 -07:00
Nick Lewycky
e9d5c7896c Merge .eh_frame without interpretation. Add a 0-CIE to the end.
Add unfinished attempt at using gimli, to be deleted but recorded in case we need it in the future.
2020-06-18 15:35:37 -07:00
Nick Lewycky
52eae576fc Record the .eh_frame sections from each .o file. 2020-06-18 15:34:23 -07:00
Syrus
422051ebe5 Simplified compiler config names 2020-06-18 01:36:25 -07:00
Syrus
8649f2eb79 Remove target from CompilerConfig 2020-06-17 20:26:50 -07:00
Nick Lewycky
1c3ea9f867 Fix bug packing return values in dynamic function trampoline. 2020-06-06 22:39:52 -07:00
Nick Lewycky
51007692d6 Factor out value expensive to compute value. 2020-06-06 21:02:10 -07:00
Nick Lewycky
cbc7dc8454 Add multi-value-import tests.
Also fix implementation of trampolines in LLVM.
2020-06-06 21:02:10 -07:00
Nick Lewycky
1990e83ca9 Add two new functions to abi.rs, is_sret and pack_values_for_register_return.
Pull the implementations out of wasm.rs and code.rs respectively, and simplify them.
2020-06-02 16:50:46 -07:00
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