Jef
e57cec3b3f
Do call_indirect properly, by accessing the table section
2019-01-18 13:01:42 +01:00
Jef
d06be92a4e
Don't allocate context if it's unused
2019-01-17 14:34:34 +01:00
Jef
e0f032a0e5
clz/ctz/popcnt
2019-01-17 13:51:18 +01:00
Jef
74d168ec4b
Merge ends, store locals in registers where possible
2019-01-17 11:07:51 +01:00
Jef
a7fa7da7d4
Support a proper vmctx that contains more than just memory offset
2019-01-16 16:34:24 +01:00
Jef
d7434fe5d2
Have vmctx be the first argument so we (almost) never have to shuffle it around
2019-01-16 09:33:46 +01:00
Jef
1b6952bb99
Implement vmctx as a hidden argument for cranelift compat
2019-01-15 12:27:55 +01:00
Jef
8312730377
Make calling functions safe
2019-01-14 18:45:14 +01:00
Jef
1eebc65c9e
First baby steps to supporting memory accesses
...
Currently we don't actually sandbox the memory at all, so you can do evil things
like read and write the host's memory. We also don't support growing memory or
cranelift-compatible ABI that passes the memory offset as an argument.
We also always immediately allocate the buffer when encountering a memory section,
there is preliminary support for translating a buffer which can then have the real
offset replaced using relocations (and returning a different type when doing so)
but I haven't written the code that actually does relocation so it doesn't work yet.
2019-01-11 15:20:32 +01:00
Jef
ddb4c0fd19
x64 sign-extends imm32 arguments, so don't truncate them in an unsigned way
2019-01-08 11:10:59 +01:00
Jef
010f2d8569
Fix comparisons, add more tests for binops
2019-01-08 09:45:39 +01:00
Jef
fcd18746a7
Add 64-bit operations
2019-01-07 19:17:29 +01:00
Jef
3b5c11a92a
Test comparison operators
2018-12-19 12:58:08 +01:00
Jef
2173f4bcca
Add other comparison operators, fix materialising locals, add more TODO comments (v. important)
2018-12-19 12:42:35 +01:00
Jef
cbf34a455b
Add factorial tests from spec (after fixing them slightly)
2018-12-19 10:40:31 +01:00
Jef
5418241dc6
Allow blocks to return values in any register
2018-12-18 17:16:38 +01:00
Jef
74ffb8560c
Fix use of locals
2018-12-18 12:12:17 +01:00
Jef
23b5a56a7d
Fix locals not being restored properly (which may cause us to read garbage values from the stack)
2018-12-17 12:16:40 +01:00
Jef
bd2ee53c89
Optimize pop_i32_into, check more fib values
2018-12-15 16:39:38 +01:00
Jef
1e04dc90b6
Make more tests quickcheck-compatible, remove unused code
2018-12-14 16:35:48 +01:00
Jef
b832832c76
Add const folding, fix returning values from blocks
2018-12-14 16:20:28 +01:00
Jef
17ecd049a1
Register allocation V2
...
This lays the groundwork for other on-the-fly optimisations,
like passing literals through in order to do const folding
in linear time, while compiling.
2018-12-14 14:16:43 +01:00
Jef
4994e3671c
Remove unused argument from fibonacci example
2018-12-13 12:26:49 +01:00
Jef
912fa83fff
Add benchmarks
2018-12-13 12:26:47 +01:00
Jef
5bb7430976
Add quickcheck, implement simple binary operations
2018-12-13 10:25:37 +01:00
Jef
189996accd
Fix receiving more than 6 arguments, allow calling functions with more than 6 arguments
2018-12-12 13:23:43 +01:00
Jef
86353cba5e
Allow calling functions with any signature
2018-12-12 11:52:48 +01:00
Sergey Pepyakin
b32f77ea02
Add the fib test.
2018-12-11 20:15:26 +01:00
Sergey Pepyakin
e02dbf1bc2
Add i32 literals support.
2018-12-11 20:12:55 +01:00
Sergey Pepyakin
0e9ba8332f
Pass arguments.
2018-12-11 19:46:41 +01:00
Sergey Pepyakin
078486e080
Basic form of a function call
2018-12-07 19:16:42 +01:00
Sergey Pepyakin
52c0443368
Pass function sig in function_body::translate
2018-11-29 18:58:14 +01:00
Sergey Pepyakin
aa5643b9b5
Implement if then else
2018-11-28 05:45:25 -08:00
Sergey Pepyakin
ba216b2e8a
Add a simple i32.eq operator.
2018-11-28 05:45:25 -08:00
Sergey Pepyakin
08240761d5
Compile a simple function ( #2 )
...
* Implement basics.
* Execute code
* Add wasm2wat test cases.
* abi_loc_for_arg for stack.
* Assert that sp_depth is 0 at the epilogue
* Do 32bit add.
* Assert that RAX can be used as a scratch register
* Reuse assembler.
* Align stack slots.
2018-11-08 13:56:27 -08:00