Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync rustc_codegen_cranelift #80408

Merged
merged 34 commits into from
Dec 28, 2020
Merged

Conversation

bjorn3
Copy link
Member

@bjorn3 bjorn3 commented Dec 27, 2020

The highlight of this sync are two JIT mode improvements. The first is that it is now possible to use JIT mode when using -Zcodegen-backend instead of the custom driver using -Cllvm-args=mode=jit. The second one is a new JIT mode that lazily compiles functions when they are called the first time: https://github.com/bjorn3/rustc_codegen_cranelift/pull/1120

In addition this includes a few small runtime performance improvements and various fixes for rustc changes that didn't cause compilation to fail.

r? @ghost

@rustbot label +A-codegen +A-cranelift +T-compiler

bjorn3 and others added 30 commits November 27, 2020 20:48
This includes bytecodealliance/wasmtime#2403 which enables hotswapping with SimpleJIT
Directly use raw pointers in `AtomicPtr` store/load

I was unable to find any reason for this limitation in the latest source of LLVM or in the documentation [here](http://llvm.org/docs/Atomics.html#libcalls-atomic).

fixes rust-lang/miri#1574
LICM in Cranelift has been fixed recently
This commit makes minor changes to the cranelift backend so that it can
build given changes in cg_ssa for Split DWARF.

Signed-off-by: David Wood <david@davidtw.co>
…omatsakis

Move binder for dyn to each list item

This essentially changes `ty::Binder<&'tcx List<ExistentialTraitRef>>` to `&'tcx List<ty::Binder<ExistentialTraitRef>>`.

This is a first step in moving the `dyn Trait` representation closer to Chalk, which we've talked about in `@rust-lang/wg-traits.`

r? `@nikomatsakis`
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.
@rustbot rustbot added A-codegen Area: Code generation A-cranelift Things relevant to the [future] cranelift backend T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 27, 2020
@bjorn3
Copy link
Member Author

bjorn3 commented Dec 27, 2020

@bors r+

@bors
Copy link
Contributor

bors commented Dec 27, 2020

📌 Commit 52cf01c has been approved by bjorn3

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Dec 27, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Dec 28, 2020
…jorn3

Sync rustc_codegen_cranelift

The highlight of this sync are two JIT mode improvements. The first is that it is now possible to use JIT mode when using `-Zcodegen-backend` instead of the custom driver using `-Cllvm-args=mode=jit`. The second one is a new JIT mode that lazily compiles functions when they are called the first time: https://github.com/bjorn3/rustc_codegen_cranelift/pull/1120

In addition this includes a few small runtime performance improvements and various fixes for rustc changes that didn't cause compilation to fail.

r? `@ghost`

`@rustbot` label +A-codegen +A-cranelift +T-compiler
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 28, 2020
Rollup of 11 pull requests

Successful merges:

 - rust-lang#79662 (Move some more code out of CodegenBackend::{codegen_crate,link})
 - rust-lang#79815 (Update RELEASES.md for 1.49.0)
 - rust-lang#80284 (Suggest fn ptr rather than fn item and suggest to use `Fn` trait bounds rather than the unique closure type in E0121)
 - rust-lang#80331 (Add more comments to trait queries)
 - rust-lang#80344 (use matches!() macro in more places)
 - rust-lang#80353 (BTreeMap: test split_off (and append) more thoroughly)
 - rust-lang#80362 (Document rustc_macros on nightly-rustc)
 - rust-lang#80399 (Remove FIXME in rustc_privacy)
 - rust-lang#80408 (Sync rustc_codegen_cranelift)
 - rust-lang#80411 (rustc_span: Remove `Symbol::with`)
 - rust-lang#80434 (bootstrap: put the component name in the tarball temp dir path)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 55b52ee into rust-lang:master Dec 28, 2020
@rustbot rustbot added this to the 1.51.0 milestone Dec 28, 2020
@bjorn3 bjorn3 deleted the sync_cg_clif-2020-12-27 branch December 28, 2020 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation A-cranelift Things relevant to the [future] cranelift backend S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants