976493c756
Merge pull request #31 from wasmerio/llvm-memorydefinition-cache
...
Cache lookup of VMMemoryDefinition.
2020-05-18 20:03:48 -07:00
0df99b5dbc
Cache lookup of VMMemoryDefinition.
...
To add to the cache, mutability is required, so now `resolve_memory_ptr` must be `&mut self` which means that `translate_operator` may not hold those convenient immutable references across the whole function.
The search and replace to implement the above changes affected some commented out code, that code is removed.
MemoryStyle grows PartialEq and Eq so that we can check what the memory style is without a match expression.
2020-05-18 19:59:50 -07:00
363dbb3b08
Fixed lint issues
2020-05-18 14:55:55 -07:00
dff7cf28c9
Fix invalid LLVM IR for global.get/set of imported globals.
...
In passing, refactor global accesses and cache the address computations and values of const globals.
Also includes some cargo fmt fixes.
2020-05-18 14:35:23 -07:00
288cb46715
Give the main loop a big comment explaining it.
...
Remove some commented out duplicate code.
2020-05-18 11:08:33 -07:00
cac3246b2e
Improve error handling around ElfSectionIndex a little.
2020-05-18 10:56:44 -07:00
7e1f19eafe
Add an ElfSectionIndex type for type safety and code clarity.
2020-05-18 09:51:00 -07:00
7e62e1f59b
Factor out building and pushing the Relocation. This if-else just computes the relocation target.
2020-05-18 09:21:09 -07:00
a79a9b19f7
Remove name for unused variable.
2020-05-18 09:13:51 -07:00
aa4aa65d0c
Remove some calls to clone() by using into_iter().
2020-05-18 09:08:33 -07:00
fce8e32cf6
Don't make SectionBody's internal Vec public.
...
Add a new method to create a new section body. Remove unused methods. Improve implementation of is_empty().
2020-05-18 09:08:33 -07:00
1ee5f27a3a
Simplify sort expression.
2020-05-18 09:08:33 -07:00
ea05e16b6d
Parse relocations that apply to custom relocations.
...
This rewrites the whole relocation parsing to work properly.
* we no longer use LocalRelocation and simply assign a new SectionIndex as new sections are encountered.
* we no longer use string matching to determine what function applies relocations to what, instead we use the field in the elf section header that tells us
* we no longer merge sections, each section from every function is preserved as an independent custom section in the module.
* we now discover any new sections that need to be pulled in recursively as we parse each section
* many error cases are either handled, or report CompileErrors.
2020-05-18 09:08:33 -07:00
9a0c2a76a3
Add a list of relocations to custom sections.
2020-05-14 12:22:32 -07:00
73e97d95d7
Fix vmctx passed to direct calls of imported functions.
2020-05-14 11:53:10 -07:00
bddc174327
Add trap on indirect call with uninitialized table element.
2020-05-13 17:06:59 -07:00
e3ac60da24
Fix invalid IR generation on imported memories and globals.
2020-05-13 15:57:41 -07:00
d23dbaa3fa
When converting a float to an int, NaN produces bad conversion to integer, other out-of-bounds failures produce integer overflow. ¯\_(ツ)_/¯
2020-05-13 15:57:41 -07:00
9d3162f578
Emit integer division by zero trap for all div/rem by zero, but not signed division of INT_MIN by -1.
2020-05-13 15:57:41 -07:00
6ed52be637
Add an explicit error when there's a relocation against .rodata.
2020-05-13 15:57:41 -07:00
2f1de920f0
Fix up master
...
This happened because we didn't use something like bors to ensure we
were merging into the latest master
2020-05-13 15:42:10 -07:00
ea90cadaf1
cargo fmt
...
https://github.com/wasmerio/wasmer-reborn/runs/672125543?check_suite_focus=true
2020-05-13 13:18:27 -07:00
30a86db05b
Fix type of OOB reported on call indirect index outside table.
2020-05-13 13:02:24 -07:00
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
119320603c
Sometimes we generate our own function names. Look up names in our name map, not the wasm module.
2020-05-13 11:50:23 -07:00
26cea55e84
⛳ Use &x[y] instead of x.get(y).unwrap() on PrimaryMap and SecondaryMap.
2020-05-13 11:29:42 -07:00
6871d327b1
Bounds check pointer accesses to dynamic memory plan memory.
2020-05-12 21:11:42 -07:00
af6a26381a
Disable local debugging code.
2020-05-12 15:03:54 -07:00
3b23ab2146
Fix call_indirect.
2020-05-11 17:12:47 -07:00
63d7df78fa
Implement load and store.
2020-05-07 18:30:30 -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
3a004b3e82
Fix build of compiler-llvm by growing the interface to SectionBody.
2020-05-03 16:08:05 -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