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

Self managing allocations #55293

Closed
wants to merge 20 commits into from

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Oct 23, 2018

No description provided.

@rust-highfive
Copy link
Collaborator

r? @zackmdavis

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive
Copy link
Collaborator

⚠️ Warning ⚠️

  • These commits modify submodules.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 23, 2018
@oli-obk
Copy link
Contributor Author

oli-obk commented Oct 23, 2018

r? @RalfJung

pulled out of #55260 to keep that PR simpler

@rust-highfive rust-highfive assigned RalfJung and unassigned zackmdavis Oct 23, 2018
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.

[00:04:01] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:04:01] tidy error: /checkout/src/librustc/mir/interpret/allocation.rs: missing trailing newline
[00:04:01] tidy error: /checkout/src/librustc/mir/interpret/mod.rs: missing trailing newline
[00:04:02] some tidy checks failed
[00:04:02] 
[00:04:02] 
[00:04:02] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor" "--quiet"
[00:04:02] 
[00:04:02] 
[00:04:02] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:04:02] Build completed unsuccessfully in 0:00:45
[00:04:02] Build completed unsuccessfully in 0:00:45
[00:04:02] Makefile:79: recipe for target 'tidy' failed
[00:04:02] make: *** [tidy] Error 1

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:2f10acce
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
---
travis_time:end:15d7eb90:start=1540322595447864581,finish=1540322595451974711,duration=4110130
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:067f2660
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:05b187c1
travis_time:start:05b187c1
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:0bd56084
$ dmesg | grep -i kill

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

Copy link
Member

@RalfJung RalfJung left a comment

Choose a reason for hiding this comment

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

I expect that the miri submodule update will get messy because we don't know in which order our PRs will land. As long as we have so many miri-breaking PRs in flight, I think it is better to do the submodule updates separately.

src/librustc/mir/interpret/mod.rs Outdated Show resolved Hide resolved
src/librustc/mir/interpret/allocation.rs Show resolved Hide resolved
) -> EvalResult<'tcx> {
// Empty accesses don't need to be valid pointers, but they should still be non-NULL
let align = Align::from_bytes(1, 1).unwrap();
if size.bytes() == 0 {
Copy link
Member

Choose a reason for hiding this comment

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

Now we check for emptiness twice. I think it should be fine to say that all the methods on an Allocation require an in-bounds ptr, even for size 0 -- then we'd have no special handling for size 0 here at all. All the handling would be in memory.rs where we need it anyway to handle integer pointers.

src/librustc/mir/interpret/allocation.rs Outdated Show resolved Hide resolved
src/librustc/mir/interpret/allocation.rs Outdated Show resolved Hide resolved
src/librustc/mir/interpret/allocation.rs Show resolved Hide resolved
@oli-obk
Copy link
Contributor Author

oli-obk commented Oct 25, 2018

before removing the size==0 checks I was seeing nice perf improvements. Lets see if this was me failing to run perfruns properly.

@bors try

@bors
Copy link
Contributor

bors commented Oct 25, 2018

⌛ Trying commit 07e8233 with merge 80add95...

bors added a commit that referenced this pull request Oct 25, 2018
@oli-obk
Copy link
Contributor Author

oli-obk commented Oct 25, 2018

@rust-timer build 80add95

@rust-timer
Copy link
Collaborator

Success: Queued 80add95 with parent 3476ac0, comparison URL.

@RalfJung
Copy link
Member

Do we also want to find a new home for Pointer? mod.rs is inadequate, I think. I just cannot decide between value.rs and alloc.rs.

@oli-obk
Copy link
Contributor Author

oli-obk commented Oct 25, 2018

Do we also want to find a new home for Pointer? mod.rs is inadequate, I think. I just cannot decide between value.rs and alloc.rs.

pointer.rs ?

@RalfJung
Copy link
Member

What would be in there? Pointer and the pointer arithmetic stuff?

Sounds reasonable.

@RalfJung
Copy link
Member

r=me if you remove the miri update and perf looks good

@bors
Copy link
Contributor

bors commented Oct 25, 2018

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

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit 80add95

@oli-obk
Copy link
Contributor Author

oli-obk commented Oct 25, 2018

Oh yes! improvements up to 6% across the board. Not fetching those allocations 4x for 4 checks does have an effect.

@oli-obk
Copy link
Contributor Author

oli-obk commented Oct 25, 2018

@bors r=RalfJung

@bors
Copy link
Contributor

bors commented Oct 25, 2018

📌 Commit a8b9eec4d2ca87ea45edb4f53682394eca7c893d has been approved by RalfJung

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 25, 2018
@oli-obk
Copy link
Contributor Author

oli-obk commented Nov 2, 2018

I am unable to reproduce on x86 linux. I also don't see how these changes could cause changes in the emitted machine code. It's just a refactoring moving functions between modules.

I could do this PR in steps by splitting it into smaller PRs

@RalfJung
Copy link
Member

RalfJung commented Nov 2, 2018

I don't have any better idea either. Maybe reduce this one to the most bitrotty "moving stuff around" part (Allocation, ScalarMaybeUndef, Pointer), and then have a separate PR for actually adding more methods to Allocation?

@bors
Copy link
Contributor

bors commented Nov 2, 2018

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

@oli-obk oli-obk mentioned this pull request Nov 4, 2018
@oli-obk
Copy link
Contributor Author

oli-obk commented Nov 8, 2018

blocked on #55674

@oli-obk oli-obk added the S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. label Nov 8, 2018
bors added a commit that referenced this pull request Nov 11, 2018
Miri engine refactoring

r? @RalfJung

split out the "just moves stuff around" part of #55293
@oli-obk
Copy link
Contributor Author

oli-obk commented Nov 13, 2018

closing in favour of #55915

@oli-obk oli-obk closed this Nov 13, 2018
bors added a commit that referenced this pull request Nov 25, 2018
@oli-obk oli-obk deleted the self_managing_allocations branch March 16, 2021 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants