Commit Graph

553 Commits

Author SHA1 Message Date
480ecd2cda Apply various fixes to get the C API working
24% of tests are passing now!
2020-05-07 14:02:13 -07:00
91411aefe8 Implement support for memory.grow and memory.size. 2020-05-06 19:11:11 -07:00
9e4550d4bc Add missing TODO. 2020-05-06 15:25:44 -07:00
13e9bd6c11 Implement global.get and global.set.
`global.get` of const globals is not cached.
2020-05-06 15:08:42 -07:00
187324b3d3 Add support for a function referring to its own bytes. 2020-05-05 14:15:39 -07:00
50664f9aaa Produce a correct but minimal FunctionAddressMap.
Fixes debug_assert! firing in lookup_frame_info.
2020-05-05 13:57:47 -07:00
fbeedbd3ac Wire up llvm code generated traps to the new runtime trap handler function. 2020-05-05 13:42:11 -07:00
9d44735347 Fix function calls to themselves.
Previously fac-rec-named was emitting a call to fac-rec-named.1 due to LLVM auto-renaming the function.
2020-05-05 12:31:59 -07:00
7465430868 Add support for relocations to other functions defined in the same module. 2020-05-05 11:47:17 -07:00
fdfb74abc2 Merge pull request #15 from wasmerio/rust-goblin
Replace llvm objectfile reader with goblin.
2020-05-04 20:52:57 -07:00
830cebc91b Remove LLVM Object library-based .o reader. 2020-05-04 20:40:51 -07:00
72899ccd47 Add support for libcalls. 2020-05-04 20:39:16 -07:00
1363b98e47 Moved Unwind info a bit to make refactor easier 2020-05-04 20:37:28 -07:00
df9e056b5b Replace object file loading code with an implementation based on top of goblin. 2020-05-04 19:57:23 -07:00
0bd6a0dd6b Renamed FuncIndex to FunctionIndex 2020-05-04 13:39:12 -07:00
2997be7d88 Renamed FuncType to FunctionType 2020-05-04 13:34:05 -07:00
359f89878f Add the correct number of locals when the same type is repeated. 2020-05-04 10:51:59 -07:00
759561e0c5 Expose Compiler and CompilerConfig only on translator mode 2020-05-03 21:28:35 -07:00
3a004b3e82 Fix build of compiler-llvm by growing the interface to SectionBody. 2020-05-03 16:08:05 -07:00
45e2e210ea Imporved author names 2020-05-03 10:57:25 -07:00
6a06af1b1b Simplified compiler config removing mutable features and target 2020-05-02 15:22:05 -07:00
4e36cf987b Make compilers feature-configurable 2020-05-02 15:17:18 -07:00
14061b9171 Fixed LLVM compilation 2020-05-02 14:51:51 -07:00
deace5beb0 Renamed back into LocalFunc 2020-05-02 04:43:31 -07:00
fdef870e5a Renamed UserFunc to ImportedFunc 2020-05-02 04:19:11 -07:00
fd96c4080e Merge branch 'master' into frame-info
# Conflicts:
#	lib/compiler-llvm/src/compiler.rs
#	lib/compiler-llvm/src/translator/code.rs
2020-05-01 22:09:26 -07:00
20ad3d608f Fixed LLVM with new compiler structure 2020-05-01 22:04:33 -07:00
4827434eef Build up list of per-function custom sections and build local relocations into them. 2020-05-01 16:31:26 -07:00
cf70a297d8 Fixed compilation 2020-05-01 15:57:18 -07:00
1227d50e9b Initial commit for support of custom sections. 2020-05-01 15:46:45 -07:00
c33a368ff8 Added custom sections
Based on this document:

https://www.notion.so/wasmer/Compiler-Refactor-Proposal-c678a73b0e2c4572834d2dba21263916
2020-05-01 11:23:22 -07:00
b5d9b448ae Add support for libcalls as relocation targets. 2020-04-30 20:54:29 -07:00
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
39550bc469 Simplified wasmparser dependencies 2020-04-28 14:26:31 -07:00
3d2bb43a93 Updated dependent crate versions 2020-04-27 20:03:44 -07:00
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
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
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
a6bde15ce5 Connect trampoline code to trampoline module. Still unimplemented. 2020-04-24 16:31:31 -07:00
474b3eb2f2 Fill in CompiledFunction::body with the instructions.
Use a bit of a hack to find the function, we ask LLVM to emit it to a non-standard section with a name of our choosing, and that entire section should have our function body and nothing else.
2020-04-24 16:06:03 -07:00
8b7da22a1a Make vmctx an i8* so that we can use byte addressing.
Implement dynamic_sigindex.
2020-04-24 15:37:45 -07:00
56fe08ad00 Assorted fixes:
Fix creation of the target machine. Fix CPU features, architecture and target name.

Function names are not mandatory. Support unnamed functions.

Include parameters and local variables in the list of local variables for LLVMFunctionCodeGenerator.

Run the tests single-threaded, using a Mutex in the rayon code. This means that only the first error is real, subsequent errors are just picking up the panic across threads.

Add TODOs about attributes on vmctx.
2020-04-23 23:32:17 -07:00
7f4fa66a23 Fix build of compiler-llvm. 2020-04-22 16:30:55 -07:00
4e6371c3ce Fix most compile issues in compiler-llvm.
Still to be fixed are MemoryPlan, MemoryStyle, TablePlan, and TableStyle.
2020-04-22 16:30:55 -07:00
5eef30c7fa Added Singlepass backend 2020-04-22 14:25:27 -07:00
502011685a Simplified cranelift and llvm compiler dependencies 2020-04-22 13:29:06 -07:00
f62f475309 Return Features & Target by reference in Compiler 2020-04-22 11:07:45 -07:00
57af68df13 Use module instead of module.local 2020-04-21 23:27:43 -07:00
5e59eb895b Renamed defined_ to local_ 2020-04-21 23:26:17 -07:00
feef35364b Renamed *Defined into *Local for better clarity 2020-04-21 23:19:33 -07:00