Skip to content

Allow runtime switching between trans backends#45684

Merged
bors merged 17 commits into
rust-lang:masterfrom
bjorn3:runtime_choose_trans2
Jan 21, 2018
Merged

Allow runtime switching between trans backends#45684
bors merged 17 commits into
rust-lang:masterfrom
bjorn3:runtime_choose_trans2

Conversation

@bjorn3

@bjorn3 bjorn3 commented Nov 1, 2017

Copy link
Copy Markdown
Member

The driver callback after_llvm has been removed as it doesnt work with multiple backends.

r? @eddyb

@eddyb

eddyb commented Nov 1, 2017

Copy link
Copy Markdown
Contributor

cc @alexcrichton @rust-lang/compiler I'm not sure a flag is the right thing to use here.
Long-term, do we expect/want to have -C backend=cranelift/llvm/etc. or different drivers?

@bjorn3

bjorn3 commented Nov 1, 2017

Copy link
Copy Markdown
Member Author

Most of the driver is the same for each backend. We could pass different compiler callbacks to rustc_driver for each backend.

@alexcrichton

Copy link
Copy Markdown
Member

This seems to add -Z trans but never uses it? How can this be implemented unless we use trait objects?

@bjorn3

bjorn3 commented Nov 1, 2017

Copy link
Copy Markdown
Member Author

@kennytm kennytm added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 1, 2017
@eddyb

eddyb commented Nov 1, 2017

Copy link
Copy Markdown
Contributor

@bjorn3 We use "custom drivers" to refer to different binaries using rustc_driver, not replacements for rustc_driver.

Comment thread src/librustc_trans_utils/trans_crate.rs Outdated

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now with less object unsafe associated types 🎊

@carols10cents

Copy link
Copy Markdown
Member

What's the status of this PR @bjorn3 @alexcrichton @eddyb? I'm having a tough time telling :)

@eddyb

eddyb commented Nov 6, 2017

Copy link
Copy Markdown
Contributor

I'm not sure what we should do here. Nominating for discussion in the next compiler meeting.

Comment thread src/librustc_trans/lib.rs Outdated

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now with less object unsafe associated types 🎊

Edit: now completely object safe

@eddyb

eddyb commented Nov 9, 2017

Copy link
Copy Markdown
Contributor

@bjorn3 Out of curiosity, do you have some specific motivation/need behind this PR, or is it intended as a general refactoring towards supporting multiple backends?

@bjorn3

bjorn3 commented Nov 10, 2017

Copy link
Copy Markdown
Member Author

Mainly refactoring, but when this is merged I want to try to add basic cranelift support.

@eddyb

eddyb commented Nov 10, 2017

Copy link
Copy Markdown
Contributor

I'd suggest more coordination between you, @sunfishcode and me, and the compiler team in general. Just to avoid stepping on eachother's toes, as we are all interested in this goal :).

@bjorn3 bjorn3 force-pushed the runtime_choose_trans2 branch from eae208e to fd38507 Compare November 11, 2017 16:51
@eddyb

eddyb commented Nov 12, 2017

Copy link
Copy Markdown
Contributor

r? @nikomatsakis

@rust-highfive rust-highfive assigned nikomatsakis and unassigned eddyb Nov 12, 2017
Comment thread src/test/run-make/llvm-phase/test.rs Outdated

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed as it requires the now removed after_llvm callback.

@nikomatsakis nikomatsakis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, eddyb kicked this to me, but I actually don't know that I'm the right person to do a detailed review here. I mean I could, but I think that @eddyb and perhaps @michaelwoerister have stronger opinions about how this should be internally architected. @bjorn3 can you and @eddyb sync up at some point and talk it over?

Comment thread src/librustc_driver/driver.rs Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like an important thing to get right before we land, no? Although I guess it's only a warning, not an error, but I wouldn't want to silently be accepting bad things.

@bors

bors commented Nov 15, 2017

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (presumably #45944) made this pull request unmergeable. Please resolve the merge conflicts.

@bjorn3 bjorn3 force-pushed the runtime_choose_trans2 branch from 831a965 to b3a986a Compare November 15, 2017 14:30
Comment thread src/librustc_trans_utils/trans_crate.rs Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't need to do anything here, this is redundant.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean i should remove this line?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

@nikomatsakis

Copy link
Copy Markdown
Contributor

r? @eddyb -- I'm kicking this back to @eddyb =)

@bors

bors commented Jan 19, 2018

Copy link
Copy Markdown
Collaborator

💔 Test failed - status-travis

@arielb1

arielb1 commented Jan 19, 2018

Copy link
Copy Markdown
Contributor
[01:09:03] error: internal compiler error: librustc/ty/maps/mod.rs:81: tcx.maps.target_features_enabled(DefId(0/0:1 ~ some_crate[317d]::{{?}}[0])) unsupported by its crate
[01:09:03] 
[01:09:03] note: the compiler unexpectedly panicked. this is a bug.
[01:09:03] 
[01:09:03] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[01:09:03] 
[01:09:03] note: rustc 1.25.0-dev running on x86_64-unknown-linux-gnu
[01:09:03] 
[01:09:03] thread 'rustc' panicked at 'Box<Any>', librustc_errors/lib.rs:509:9
[01:09:03] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[01:09:03] 
[01:09:03] make[1]: *** [all] Error 101
[01:09:03] 
[01:09:03] ------------------------------------------
[01:09:03] 
[01:09:03] thread '[run-make] run-make/hotplug_codegen_backend' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:2884:9
[01:09:03] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[01:09:03] 
[01:09:03] 
[01:09:03] failures:
[01:09:03]     [run-make] run-make/hotplug_codegen_backend
[01:09:03] 

@bjorn3

bjorn3 commented Jan 20, 2018

Copy link
Copy Markdown
Member Author

Fixed ICE

@eddyb

eddyb commented Jan 20, 2018

Copy link
Copy Markdown
Contributor

@bors r+

@bors

bors commented Jan 20, 2018

Copy link
Copy Markdown
Collaborator

📌 Commit a4854e8 has been approved by eddyb

@bors

bors commented Jan 20, 2018

Copy link
Copy Markdown
Collaborator

⌛ Testing commit a4854e8 with merge 9aa40b0...

bors added a commit that referenced this pull request Jan 20, 2018
Allow runtime switching between trans backends

The driver callback after_llvm has been removed as it doesnt work with multiple backends.

r? @eddyb
@bors

bors commented Jan 20, 2018

Copy link
Copy Markdown
Collaborator

💔 Test failed - status-travis

@bjorn3 bjorn3 force-pushed the runtime_choose_trans2 branch from fb976fb to a30232f Compare January 20, 2018 16:27
@eddyb

eddyb commented Jan 20, 2018

Copy link
Copy Markdown
Contributor

@bors r+

@bors

bors commented Jan 20, 2018

Copy link
Copy Markdown
Collaborator

📌 Commit a30232f has been approved by eddyb

@bors

bors commented Jan 20, 2018

Copy link
Copy Markdown
Collaborator

⌛ Testing commit a30232f with merge 3153d4a27cf582356da0bb5a2190c7bebd150372...

@bors

bors commented Jan 20, 2018

Copy link
Copy Markdown
Collaborator

💔 Test failed - status-travis

@shepmaster

Copy link
Copy Markdown
Member

The job exceeded the maximum time limit for jobs, and has been terminated.

@bors retry

@bors

bors commented Jan 21, 2018

Copy link
Copy Markdown
Collaborator

⌛ Testing commit a30232f with merge 9368a1e...

bors added a commit that referenced this pull request Jan 21, 2018
Allow runtime switching between trans backends

The driver callback after_llvm has been removed as it doesnt work with multiple backends.

r? @eddyb
@bors

bors commented Jan 21, 2018

Copy link
Copy Markdown
Collaborator

☀️ Test successful - status-appveyor, status-travis
Approved by: eddyb
Pushing 9368a1e to master...

@bors bors merged commit a30232f into rust-lang:master Jan 21, 2018
kennytm-githubbot added a commit to rust-lang-nursery/rust-toolstate that referenced this pull request Jan 21, 2018
Tested on commit rust-lang/rust@9368a1e.

💔 rls on windows: test-pass → build-fail (cc @nrc).
💔 rls on linux: test-pass → build-fail (cc @nrc).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.