Skip to content

Self managing allocations - #55293

Closed
oli-obk wants to merge 20 commits into
rust-lang:masterfrom
oli-obk:self_managing_allocations
Closed

Self managing allocations#55293
oli-obk wants to merge 20 commits into
rust-lang:masterfrom
oli-obk:self_managing_allocations

Conversation

@oli-obk

Copy link
Copy Markdown
Contributor

No description provided.

@rust-highfive

Copy link
Copy Markdown
Contributor

r? @zackmdavis

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

@rust-highfive

Copy link
Copy Markdown
Contributor

⚠️Warning⚠️

  • These commits modify submodules.

@rust-highfiverust-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
Copy Markdown
ContributorAuthor

r? @RalfJung

pulled out of #55260 to keep that PR simpler

@rust-highfive

Copy link
Copy Markdown
Contributor

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)

@RalfJungRalfJung left a comment

Copy link
Copy Markdown
Member

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.

Comment threadsrc/librustc/mir/interpret/mod.rs Outdated
Comment threadsrc/librustc/mir/interpret/allocation.rs
) -> 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
Copy Markdown
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.

Comment threadsrc/librustc/mir/interpret/allocation.rs Outdated
Comment threadsrc/librustc/mir/interpret/allocation.rs Outdated
Comment threadsrc/librustc/mir/interpret/allocation.rs
Comment threadsrc/librustc/mir/interpret/mod.rs Outdated
@oli-obk

Copy link
Copy Markdown
ContributorAuthor

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

bors commented Oct 25, 2018

Copy link
Copy Markdown
Collaborator

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

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

Copy link
Copy Markdown
ContributorAuthor

@rust-timer build 80add95

@rust-timer

Copy link
Copy Markdown
Collaborator

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

Comment threadsrc/librustc/mir/interpret/allocation.rs Outdated
@RalfJung

Copy link
Copy Markdown
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
Copy Markdown
ContributorAuthor

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
Copy Markdown
Member

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

Sounds reasonable.

@RalfJung

Copy link
Copy Markdown
Member

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

@bors

bors commented Oct 25, 2018

Copy link
Copy Markdown
Collaborator

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

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking try commit 80add95

@oli-obk

Copy link
Copy Markdown
ContributorAuthor

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

@oli-obk
oli-obkforce-pushed the self_managing_allocations branch from fba8adc to a8b9eecCompareOctober 25, 2018 20:27
@oli-obk

Copy link
Copy Markdown
ContributorAuthor

@bors r=RalfJung

@bors

bors commented Oct 25, 2018

Copy link
Copy Markdown
Collaborator

📌 Commit a8b9eec4d2ca87ea45edb4f53682394eca7c893d has been approved by RalfJung

@borsbors 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
@RalfJungRalfJung mentioned this pull request Nov 1, 2018
@oli-obk
oli-obkforce-pushed the self_managing_allocations branch from 880ba86 to 0aa2aa8CompareNovember 2, 2018 10:12
@oli-obk

Copy link
Copy Markdown
ContributorAuthor

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
Copy Markdown
Member

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

bors commented Nov 2, 2018

Copy link
Copy Markdown
Collaborator

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

@oli-obkoli-obk mentioned this pull request Nov 4, 2018
@oli-obk

Copy link
Copy Markdown
ContributorAuthor

blocked on #55674

@oli-obkoli-obk added the S-blocked Status: 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-obkoli-obk mentioned this pull request Nov 13, 2018
@oli-obk

Copy link
Copy Markdown
ContributorAuthor

closing in favour of #55915

@oli-obkoli-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 freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-blockedStatus: Blocked on something else such as an RFC or other implementation work.S-waiting-on-authorStatus: 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

@oli-obk@rust-highfive@bors@rust-timer@RalfJung@emilyalbini@kennytm@zackmdavis