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

Refactor call & function handling in trans, enable MIR bootstrap. #32080

Merged
merged 77 commits into from
Mar 18, 2016

Conversation

eddyb
Copy link
Member

@eddyb eddyb commented Mar 6, 2016

Non-Rust and Rust ABIs were combined into a common codepath, which means:

Additionally, MIR support for calling intrinsics (through old trans) was implemented.
Alongside assorted fixes, it enabled MIR to launch 🚀 and do a complete bootstrap.
To try it yourself, ./configure --enable-orbit or make RUSTFLAGS="-Z orbit".

@alexcrichton
Copy link
Member

r? @nikomatsakis

(just making sure an assignment is given, feel free to delegate elsewhere)

@bors
Copy link
Contributor

bors commented Mar 8, 2016

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

@eddyb
Copy link
Member Author

eddyb commented Mar 9, 2016

Status: I can build snap-stage3 with MIR forced on for everything.
These are the common run-pass failures for stage1 and stage2:
(that means they are likely MIR trans bugs and not due to miscompiled rustc)

failures:
    [run-pass] run-pass/allocator-override.rs
    [run-pass] run-pass/asm-in-out-operand.rs
    [run-pass] run-pass/asm-indirect-memory.rs
    [run-pass] run-pass/asm-out-assign.rs
    [run-pass] run-pass/associated-const-type-parameters.rs
    [run-pass] run-pass/backtrace-debuginfo.rs
    [run-pass] run-pass/const-str-ptr.rs
    [run-pass] run-pass/ignore-all-the-things.rs
    [run-pass] run-pass/int-abs-overflow.rs
    [run-pass] run-pass/issue-14936.rs
    [run-pass] run-pass/issue-15080.rs
    [run-pass] run-pass/issue-15104.rs
    [run-pass] run-pass/issue-23338-ensure-param-drop-order.rs
    [run-pass] run-pass/issue-7784.rs
    [run-pass] run-pass/issue-8460.rs
    [run-pass] run-pass/issue-8860.rs
    [run-pass] run-pass/match-vec-alternatives.rs
    [run-pass] run-pass/mir_raw_fat_ptr.rs
    [run-pass] run-pass/num-wrapping.rs
    [run-pass] run-pass/out-of-stack.rs
    [run-pass] run-pass/simd-intrinsic-generic-cast.rs
    [run-pass] run-pass/simd-intrinsic-generic-elements.rs
    [run-pass] run-pass/super-fast-paren-parsing.rs
    [run-pass] run-pass/vec-matching-fixed.rs
    [run-pass] run-pass/vec-matching-fold.rs
    [run-pass] run-pass/vec-matching-legal-tail-element-borrow.rs
    [run-pass] run-pass/vec-matching.rs
    [run-pass] run-pass/vec-tail-matching.rs
    [run-pass] run-pass/zero-size-type-destructors.rs

The only run-pass test that only fails in stage2 is run-pass/super-fast-paren-parsing.rs, which ends up in a stack overflow in rustc (@arielb1 was talking about needing llvm lifetime intrinsics to prevent this, I think).

@rust-lang/tools If I provide a flag to enable MIR trans for everything, and an attribute to mark functions which can't be yet properly translated via MIR, would it be possible to have buildbot ensure MIR doesn't regress?

@nikomatsakis
Copy link
Contributor

‼️ 😲

@eddyb eddyb force-pushed the transcendent branch 2 times, most recently from 934c483 to 5024b6d Compare March 9, 2016 14:49
@alexcrichton
Copy link
Member

@eddyb I'd be fine at least adding a MIR bot! If it's a ./configure switch just lemme know and I can set up something like auto-linux-64-opt-mir or something like that.

Do you think MIR will want platform coverage as well? A Linux/OSX/Windows builder, or just one with it enabled?

@eddyb
Copy link
Member Author

eddyb commented Mar 9, 2016

@alexcrichton Before the next snapshot, make RUSTFLAGS_STAGE1="-Z orbit" RUSTFLAGS_STAGE2=-"Z orbit", after that just make RUSTFLAGS="-Z orbit".

Sadly, it doesn't look like tests inherit RUSTFLAGS_STAGEn, just RUSTFLAGS, so we might need a snapshot anyway.

We'll want at least a non-MSVC and a MSVC builder, because of the differences in how unwinding works there.

@eddyb eddyb changed the title [WIP] Refactor how calls and functions are handled across trans. [WIP] Refactor call & function handling in trans, enable MIR bootstrap. Mar 9, 2016
@alexcrichton
Copy link
Member

Ok, sounds like a linux + MSVC builder, and can you add this as a ./configure option? That'll be easiest to add to our build matrix.

@eddyb
Copy link
Member Author

eddyb commented Mar 9, 2016

@alexcrichton Does that last commit look good?

@alexcrichton
Copy link
Member

Looks good to me!

@eddyb
Copy link
Member Author

eddyb commented Mar 10, 2016

Down to 9 run-pass MIR failures:

    [run-pass] run-pass/backtrace-debuginfo.rs
    [run-pass] run-pass/const-str-ptr.rs
    [run-pass] run-pass/int-abs-overflow.rs
    [run-pass] run-pass/issue-23338-ensure-param-drop-order.rs
    [run-pass] run-pass/issue-8460.rs
    [run-pass] run-pass/issue-8860.rs
    [run-pass] run-pass/mir_raw_fat_ptr.rs
    [run-pass] run-pass/simd-intrinsic-generic-elements.rs
    [run-pass] run-pass/zero-size-type-destructors.rs

I'll just start tagging them with #[rustc_no_mir], this PR is getting kind of long...

@eddyb eddyb changed the title [WIP] Refactor call & function handling in trans, enable MIR bootstrap. Refactor call & function handling in trans, enable MIR bootstrap. Mar 10, 2016
@eddyb eddyb force-pushed the transcendent branch 6 times, most recently from 76a4fa2 to 0c413a8 Compare March 10, 2016 14:56
@eddyb
Copy link
Member Author

eddyb commented Mar 18, 2016

@bors r=nikomatsakis force

@bors
Copy link
Contributor

bors commented Mar 18, 2016

📌 Commit e177207 has been approved by nikomatsakis

@bors
Copy link
Contributor

bors commented Mar 18, 2016

⌛ Testing commit e177207 with merge 3c572b6...

@bors
Copy link
Contributor

bors commented Mar 18, 2016

💔 Test failed - auto-win-gnu-64-opt

@eddyb
Copy link
Member Author

eddyb commented Mar 18, 2016

@bors r=nikomatsakis force

@bors
Copy link
Contributor

bors commented Mar 18, 2016

📌 Commit b12dcde has been approved by nikomatsakis

@bors
Copy link
Contributor

bors commented Mar 18, 2016

⌛ Testing commit b12dcde with merge 235d774...

bors added a commit that referenced this pull request Mar 18, 2016
Refactor call & function handling in trans, enable MIR bootstrap.

Non-Rust and Rust ABIs were combined into a common codepath, which means:
* The ugly `__rust_abi` "clown shoes" shim for C->Rust FFI is gone, fixes #10116.
* Methods, *including virtual ones* support non-Rust ABIs, closes #30235.
* Non-Rust ABIs also pass fat pointers in two arguments; the result should be identical.
* Zero-sized types are never passed as arguments; again, behavior shouldn't change.

Additionally, MIR support for calling intrinsics (through old trans) was implemented.
Alongside assorted fixes, it enabled MIR to launch 🚀 and do a *complete* bootstrap.
To try it yourself, `./configure --enable-orbit` *or* `make RUSTFLAGS="-Z orbit"`.
@bors
Copy link
Contributor

bors commented Mar 18, 2016

@jonas-schievink
Copy link
Contributor

:shipit:


It's doing strictly more work, AFAICT, because we emit more IR (not sure exactly why yet).

Pretty impressive that translation still ends up being faster!

bors added a commit that referenced this pull request Mar 20, 2016
Update snapshots to 2016-03-18 (235d774).

The new snapshots notably include @nikomatsakis' #32164 fix for the regionck error spew.
Also, `./configure --enable-orbit` *and/or* `make RUSTFLAGS="-Z orbit"` should work now (#32080).
bors added a commit that referenced this pull request Apr 3, 2016
rBreak Critical Edges and other MIR work

This PR is built on top of #32080.

This adds the basic depth-first traversals for MIR, preorder, postorder and reverse postorder. The MIR blocks are now translated using reverse postorder. There is also a transform for breaking critical edges, which includes the edges from `invoke`d calls (`Drop` and `Call`), to account for the fact that we can't add code after an `invoke`. It also stops generating the intermediate block (since the transform essentially does it if necessary already).

The kinds of cases this deals with are difficult to produce, so the test is the one I managed to get. However, it seems to bootstrap with `-Z orbit`, which it didn't before my changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature-gate non-Rust ABI methods remove the need for foreign ABI wrappers
7 participants