Skip to content

Add a DroplessArena and utilize it as a more efficient arena when possible #38653

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

Merged
merged 4 commits into from
Jan 1, 2017

Conversation

Mark-Simulacrum
Copy link
Member

I will collect performance (probably just -Ztime-passes, and more if that shows significant differences, perhaps).

6feba98 also fixes a potential infinite loop if inplace reallocation failed for TypedArena (and DroplessArena via copied code).

r? @eddyb

}
}
}

pub struct CtxtInterners<'tcx> {
/// The arenas that types etc are allocated from.
Copy link
Member

Choose a reason for hiding this comment

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

No need to remove the comment, just make it singular.

@@ -387,6 +369,7 @@ impl<'a, 'gcx, 'tcx> Deref for TyCtxt<'a, 'gcx, 'tcx> {
}

pub struct GlobalCtxt<'tcx> {
global_arenas: &'tcx CtxtArenas<'tcx>,
Copy link
Member

Choose a reason for hiding this comment

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

A rename to GlobalArenas might make more sense. In fact, a GlobalInterners type would help too, I think layout isn't the only one, and stability also is global-only.

@@ -4560,9 +4561,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
/// Report errors if the provided parameters are too few or too many.
fn check_path_parameter_count(&self,
span: Span,
segment: &mut Option<(&hir::PathSegment, &ty::Generics)>) {
segment: &mut Option<(&hir::PathSegment, Rc<ty::Generics>)>) {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe you shouldn't change anything about ty::Generics, if you can avoid it (since we're keeping at least some of the typed drop-ful arenas for now).

CtxtInterners contains a single DroplessArena, while GlobalArenas
contains the TypedArenas still required for the remaining
Drop-containing types.

stability_interner: RefCell<FxHashSet<&'tcx attr::Stability>>,

layout_interner: RefCell<FxHashSet<&'tcx Layout>>,
Copy link
Member

Choose a reason for hiding this comment

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

My main concern now might be grouping these in a GlobalInterners type.

@eddyb
Copy link
Member

eddyb commented Dec 31, 2016

@bors r+

@bors
Copy link
Collaborator

bors commented Dec 31, 2016

📌 Commit 1676bec has been approved by eddyb

@Mark-Simulacrum
Copy link
Member Author

Leaving this here in case anyone has any ideas: https://gist.githubusercontent.com/Mark-Simulacrum/6a088a61f8eff2c2ded205432b4b5de9/raw/982f7329e4ac5c2c8aec57fbccf20257b8a350de/gistfile1.txt. This is a list of the DroplessArena chunks deallocated; sorted and uniq -c. It's worth noting that most DroplessArenas are small (one to two allocations, in general).

However, no meaningful optimizations based on this have been thought of quite yet.

@bors
Copy link
Collaborator

bors commented Dec 31, 2016

⌛ Testing commit 1676bec with merge ca4a0b1...

@bors
Copy link
Collaborator

bors commented Dec 31, 2016

💔 Test failed - status-travis

@alexcrichton
Copy link
Member

alexcrichton commented Dec 31, 2016 via email

@bors
Copy link
Collaborator

bors commented Jan 1, 2017

⌛ Testing commit 1676bec with merge 08babdb...

bors added a commit that referenced this pull request Jan 1, 2017
Add a DroplessArena and utilize it as a more efficient arena when possible

I will collect performance (probably just `-Ztime-passes`, and more if that shows significant differences, perhaps).

6feba98 also fixes a potential infinite loop if inplace reallocation failed for `TypedArena` (and `DroplessArena` via copied code).

r? @eddyb
@bors
Copy link
Collaborator

bors commented Jan 1, 2017

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

@bors bors merged commit 1676bec into rust-lang:master Jan 1, 2017
@Mark-Simulacrum Mark-Simulacrum deleted the dropless-arena branch March 25, 2017 17:26
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.

4 participants