Commit Graph

62 Commits

Author SHA1 Message Date
bjorn3
ff38b37769 Fix docs 2021-04-14 15:16:02 +02:00
bjorn3
eed9aaa268 Extract create_jit_module function 2021-04-14 15:05:57 +02:00
bjorn3
d4d270d503 Merge BACKEND_CONFIG and CURRENT_MODULE thread locals 2021-04-14 15:01:09 +02:00
bjorn3
6fac7f089f Don't unregister unwind tables after the JIT is done 2021-04-14 15:01:07 +02:00
bjorn3
86530f889e Use maybe_create_entry_wrapper again in jit mode
This simplifies the jit driver a lot
2021-04-14 14:59:36 +02:00
bjorn3
ba8e610b26 Inline driver::codegen_crate 2021-04-14 14:57:04 +02:00
bjorn3
d9e9fedfe5 Remove CodegenCx::finalize and pass Module separately from CodegenCx 2021-04-14 14:57:02 +02:00
bjorn3
b09b8b1bd4 Re-use Context in codegen_shim 2021-04-14 14:20:42 +02:00
bjorn3
65420b50f8 Don't deduplicate anonymous allocations 2021-04-14 10:38:18 +02:00
bjorn3
53bfc6729a Centralize all configuration into config.rs 2021-04-07 11:52:11 +02:00
bjorn3
94b51d14e6 Make all compiler-builtins symbols hidden
This matches cg_llvm

Fixes #1152
2021-03-27 17:32:41 +01:00
bjorn3
56fe51cb36 Update Cranelift 2021-03-21 10:05:22 +01:00
bjorn3
e86b95480f Directly invoke the main function in JIT mode
Fixes #1151
2021-03-17 13:56:54 +01:00
bjorn3
5e736293b3 Rustfmt 2021-03-05 11:21:44 +01:00
bjorn3
73d3a1c14a Use dynamic dispatch for the inner Module
This improves compilation time and shrinks the linked backend from
13MB to 9.7MB on Linux.
2021-02-23 18:49:37 +01:00
bjorn3
013b3c5a7c Rustfmt 2021-02-21 17:03:21 +01:00
bjorn3
4eb6754749 Sync from rust 3e826bb112 2021-02-21 17:02:04 +01:00
bjorn3
25f7eeec46 Don't import the metadata symbol
Helps with #1134
2021-02-21 10:40:30 +01:00
bjorn3
f2f5452089 Use real atomic instructions instead of a global lock 2021-02-18 18:14:21 +01:00
Camille GILLOT
fe8d11bb99 Use an ItemId inside mir::GlobalAsm. 2021-02-15 19:24:58 +01:00
bjorn3
94aac0af59 Pass around BackendConfig 2021-02-12 15:39:58 +00:00
bjorn3
c5dff34ae9 Revert "Update libc and libloading"
This reverts commit bfcf97bd83.

It causes a "can't resolve symbol" crash on macOS
2021-02-09 13:19:19 +01:00
bjorn3
bfcf97bd83 Update libc and libloading 2021-02-09 12:40:43 +01:00
bjorn3
a75f9bc3be Merge commit 'd556c56f792756dd7cfec742b9f2e07612dc10f4' into sync_cg_clif-2021-02-01 2021-02-01 10:11:46 +01:00
bjorn3
aa23f862dc Remove vararg support check
This check wasn't very useful and removing it simplifies the code.
2021-01-27 10:32:56 +01:00
bjorn3
4555737152 Split symbol name and signature calculation 2021-01-26 15:11:03 +01:00
bjorn3
77f74ed070 Merge commit 'dbee13661efa269cb4cd57bb4c6b99a19732b484' into sync_cg_clif-2020-12-27 2020-12-27 10:30:38 +01:00
bjorn3
3f6a3b5ebe Implement lazy compilation in JIT mode
Lazy compilation has the potential to significantly improve the startup
time of a program. While functions have to be codegened when called, it
is expected that a significant amount of all code is only required when
an error occurs or only when the program is used in certain ways.

The basic approach is to first codegen a shim for each function. This
shim calls the `__cg_clif_jit` function of cg_clif with a pointer to the
`Instance` corresponding to the function for which it is a shim.
`__cg_clif_jit` function then codegens this function and uses the hot
code swapping support of SimpleJIT to redirect future calls to the
function to the real version. Finally it calls the newly codegened
function.
2020-12-25 12:08:21 +01:00
bjorn3
0b9b2532d2 Move finalize CodegenCx timer out of codegen mono items timer 2020-12-25 11:49:50 +01:00
bjorn3
20ffea6b8a Change the way JIT mode is selected 2020-12-25 11:31:33 +01:00
bjorn3
c556e4dd35 Use PIC in JIT mode too 2020-12-25 10:55:11 +01:00
bjorn3
f8e22bfb1b Update Cranelift 2020-12-12 10:37:10 +01:00
bjorn3
5f21ff20b3 Inline codegen_mono_item 2020-12-04 10:19:50 +01:00
bjorn3
d404840788 Merge commit '5988bbd24aa87732bfa1d111ba00bcdaa22c481a' into sync_cg_clif-2020-11-27 2020-11-27 20:48:53 +01:00
bjorn3
db8fa0edfa Inline codegen_mono_items and outline predefine_mono_items 2020-11-12 17:07:02 +01:00
bjorn3
6eaa502049 Update Cranelift for SimpleJIT changes 2020-11-12 11:56:09 +01:00
bjorn3
1a32c542ff Update Cranelift 2020-11-09 18:16:08 +01:00
bjorn3
285c7c66dc Merge commit '03f01bbe901d60b71cf2c5ec766aef5e532ab79d' into update_cg_clif-2020-11-01 2020-11-03 11:00:04 +01:00
bjorn3
4cc6b4f9bf Fix many clippy warnings 2020-10-28 21:47:25 +01:00
bjorn3
6e8ea1c049 Abort earlier when an error happens in jit mode 2020-10-11 11:31:36 +02:00
bjorn3
c352f91b40 Rustfmt 2020-10-09 19:17:52 +02:00
bjorn3
0a5968dfd2 Use the new cranelift-module interface
This updates Cranelift to include bytecodealliance/wasmtime#2249
2020-10-08 19:00:21 +02:00
bjorn3
426e55709c Replace CG_CLIF_JIT with --jit 2020-09-29 18:41:59 +02:00
bjorn3
838dd17a67 Don't read CG_CLIF_JIT from init_global_lock
In preparation to moving away from an env var
2020-09-29 18:12:23 +02:00
bjorn3
b8b5a824a6 Fix JIT 2020-09-29 15:28:48 +02:00
bjorn3
c8699076f9 Document almost all modules
Fixes #1082
2020-09-23 15:13:49 +02:00
CohenArthur
4e685a512e fmt: Run cargo fmt since it is available 2020-08-28 12:10:48 +02:00
CohenArthur
2a14fb7bf2 jit: Add NULL as terminating argv 2020-08-22 11:24:02 +02:00
bjorn3
35701d8caa Move global_asm into CodegenCx 2020-07-09 19:24:53 +02:00
bjorn3
037d411bf4 Implement global_asm! using an external assembler
Fixes #1061
2020-07-09 17:02:09 +02:00