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

Rollup of 5 pull requests #72226

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
b70e7fd
Add inherent impls for unchecked math intrinsics
CAD97 Feb 3, 2020
2fcfd23
Redesign the Step trait
CAD97 Feb 18, 2020
f34322d
Adjust Step::forward_checked docs for large types
CAD97 Mar 14, 2020
c400f75
Miri interning: replace ICEs by proper errors, make intern_shallow ty…
RalfJung Apr 29, 2020
8e48a30
remove some dead code, and assert we do not swallow allocating errors
RalfJung Apr 29, 2020
ff39457
avoid raising interpreter errors from interning
RalfJung Apr 29, 2020
d3b2e1f
fmt
RalfJung Apr 29, 2020
a06740c
Typo
RalfJung Apr 29, 2020
e73ee41
rebase fallout
RalfJung May 4, 2020
23d880b
rustc_driver: factor out computing the exit code
RalfJung May 10, 2020
51e466d
rustc_driver::main: more informative return type
RalfJung May 10, 2020
5e35493
cargo update -p serde_derive
Xanewok May 5, 2020
403a9d0
cargo update -p failure_derive
Xanewok May 5, 2020
8c6e568
cargo update -p pest_generator
Xanewok May 5, 2020
3bdaced
cargo update -p derive-new
Xanewok May 5, 2020
e26f35d
rustbook: Bump mdbook dependency
Xanewok May 5, 2020
9111d8b
Fix the new capacity measurement in arenas.
nnethercote May 4, 2020
40d4868
Be less aggressive with `DroplessArena`/`TypedArena` growth.
nnethercote May 4, 2020
cef616b
Improve comments in iter::Step
CAD97 May 13, 2020
90b1961
Improve Step::forward/backward for optimization
CAD97 May 13, 2020
d53068e
improve step_integer_impls macro
CAD97 May 14, 2020
41f701a
Rollup merge of #69659 - CAD97:step-rework-take-3, r=Amanieu
RalfJung May 15, 2020
79ae6ee
Rollup merge of #71665 - RalfJung:miri-intern-no-ice, r=oli-obk
RalfJung May 15, 2020
201aa12
Rollup merge of #71872 - nnethercote:less-aggressive-arena-growth, r=…
RalfJung May 15, 2020
ae17c19
Rollup merge of #71919 - Xanewok:bump-syn-1, r=Mark-Simulacrum
RalfJung May 15, 2020
7d01ffc
Rollup merge of #72090 - RalfJung:rustc_driver-exit-code, r=oli-obk
RalfJung May 15, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 31 additions & 55 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ dependencies = [
"proc-macro2 1.0.3",
"quote 1.0.2",
"syn 1.0.11",
"synstructure 0.12.1",
"synstructure",
]

[[package]]
Expand Down Expand Up @@ -937,13 +937,13 @@ checksum = "a0afaad2b26fa326569eb264b1363e8ae3357618c43982b3f285f0774ce76b69"

[[package]]
name = "derive-new"
version = "0.5.6"
version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ca414e896ae072546f4d789f452daaecf60ddee4c9df5dc6d5936d769e3d87c"
checksum = "71f31892cd5c62e414316f2963c5689242c43d8e7bbcaaeca97e5e28c95d91d9"
dependencies = [
"proc-macro2 0.4.30",
"quote 0.6.12",
"syn 0.15.35",
"proc-macro2 1.0.3",
"quote 1.0.2",
"syn 1.0.11",
]

[[package]]
Expand Down Expand Up @@ -1144,14 +1144,14 @@ dependencies = [

[[package]]
name = "failure_derive"
version = "0.1.5"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1"
checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4"
dependencies = [
"proc-macro2 0.4.30",
"quote 0.6.12",
"syn 0.15.35",
"synstructure 0.10.2",
"proc-macro2 1.0.3",
"quote 1.0.2",
"syn 1.0.11",
"synstructure",
]

[[package]]
Expand Down Expand Up @@ -1404,30 +1404,18 @@ dependencies = [

[[package]]
name = "handlebars"
version = "2.0.1"
version = "3.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df044dd42cdb7e32f28557b661406fc0f2494be75199779998810dbc35030e0d"
checksum = "ba758d094d31274eb49d15da6f326b96bf3185239a6359bf684f3d5321148900"
dependencies = [
"hashbrown 0.5.0",
"lazy_static 1.4.0",
"log",
"pest",
"pest_derive",
"quick-error",
"regex",
"serde",
"serde_json",
]

[[package]]
name = "hashbrown"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1de41fb8dba9714efd92241565cdff73f78508c95697dd56787d3cba27e2353"
dependencies = [
"serde",
]

[[package]]
name = "hashbrown"
version = "0.6.2"
Expand Down Expand Up @@ -2054,9 +2042,9 @@ dependencies = [

[[package]]
name = "mdbook"
version = "0.3.5"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "031bdd9d4893c983e2f69ebc4b59070feee8276a584c4aabdcb351235ea28016"
checksum = "e7ec525f7ebccc2dd935c263717250cd37f9a4b264a77c5dbc950ea2734d8159"
dependencies = [
"ammonia",
"chrono",
Expand Down Expand Up @@ -2556,15 +2544,15 @@ dependencies = [

[[package]]
name = "pest_generator"
version = "2.1.0"
version = "2.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "63120576c4efd69615b5537d3d052257328a4ca82876771d6944424ccfd9f646"
checksum = "99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55"
dependencies = [
"pest",
"pest_meta",
"proc-macro2 0.4.30",
"quote 0.6.12",
"syn 0.15.35",
"proc-macro2 1.0.3",
"quote 1.0.2",
"syn 1.0.11",
]

[[package]]
Expand Down Expand Up @@ -2784,9 +2772,9 @@ checksum = "6ddd112cca70a4d30883b2d21568a1d376ff8be4758649f64f973c6845128ad3"

[[package]]
name = "quick-error"
version = "1.2.2"
version = "1.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0"
checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"

[[package]]
name = "quine-mc_cluskey"
Expand Down Expand Up @@ -3448,7 +3436,7 @@ dependencies = [
"proc-macro2 1.0.3",
"quote 1.0.2",
"syn 1.0.11",
"synstructure 0.12.1",
"synstructure",
]

[[package]]
Expand Down Expand Up @@ -4058,7 +4046,7 @@ dependencies = [
"proc-macro2 1.0.3",
"quote 1.0.2",
"syn 1.0.11",
"synstructure 0.12.1",
"synstructure",
]

[[package]]
Expand Down Expand Up @@ -4629,13 +4617,13 @@ dependencies = [

[[package]]
name = "serde_derive"
version = "1.0.81"
version = "1.0.106"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "477b13b646f5b5b56fc95bedfc3b550d12141ce84f466f6c44b9a17589923885"
checksum = "9e549e3abf4fb8621bd1609f11dfc9f5e50320802273b12f3811a67e6716ea6c"
dependencies = [
"proc-macro2 0.4.30",
"quote 0.6.12",
"syn 0.15.35",
"proc-macro2 1.0.3",
"quote 1.0.2",
"syn 1.0.11",
]

[[package]]
Expand Down Expand Up @@ -4799,7 +4787,7 @@ dependencies = [
"core",
"dlmalloc",
"fortanix-sgx-abi",
"hashbrown 0.6.2",
"hashbrown",
"hermit-abi",
"libc",
"panic_abort",
Expand Down Expand Up @@ -4931,18 +4919,6 @@ dependencies = [
"unicode-xid 0.2.0",
]

[[package]]
name = "synstructure"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f"
dependencies = [
"proc-macro2 0.4.30",
"quote 0.6.12",
"syn 0.15.35",
"unicode-xid 0.1.0",
]

[[package]]
name = "synstructure"
version = "0.12.1"
Expand Down
39 changes: 26 additions & 13 deletions src/libarena/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
//! of individual objects while the arena itself is still alive. The benefit
//! of an arena is very fast allocation; just a pointer bump.
//!
//! This crate implements `TypedArena`, a simple arena that can only hold
//! objects of a single type.
//! This crate implements several kinds of arena.

#![doc(
html_root_url = "https://doc.rust-lang.org/nightly/",
Expand Down Expand Up @@ -98,7 +97,13 @@ impl<T> TypedArenaChunk<T> {
}
}

// The arenas start with PAGE-sized chunks, and then each new chunk is twice as
// big as its predecessor, up until we reach HUGE_PAGE-sized chunks, whereupon
// we stop growing. This scales well, from arenas that are barely used up to
// arenas that are used for 100s of MiBs. Note also that the chosen sizes match
// the usual sizes of pages and huge pages on Linux.
const PAGE: usize = 4096;
const HUGE_PAGE: usize = 2 * 1024 * 1024;

impl<T> Default for TypedArena<T> {
/// Creates a new `TypedArena`.
Expand Down Expand Up @@ -211,6 +216,9 @@ impl<T> TypedArena<T> {
#[cold]
fn grow(&self, n: usize) {
unsafe {
// We need the element size in to convert chunk sizes (ranging from
// PAGE to HUGE_PAGE bytes) to element counts.
let elem_size = cmp::max(1, mem::size_of::<T>());
let mut chunks = self.chunks.borrow_mut();
let (chunk, mut new_capacity);
if let Some(last_chunk) = chunks.last_mut() {
Expand All @@ -221,18 +229,20 @@ impl<T> TypedArena<T> {
self.end.set(last_chunk.end());
return;
} else {
// If the previous chunk's capacity is less than HUGE_PAGE
// bytes, then this chunk will be least double the previous
// chunk's size.
new_capacity = last_chunk.storage.capacity();
loop {
if new_capacity < HUGE_PAGE / elem_size {
new_capacity = new_capacity.checked_mul(2).unwrap();
if new_capacity >= currently_used_cap + n {
break;
}
}
}
} else {
let elem_size = cmp::max(1, mem::size_of::<T>());
new_capacity = cmp::max(n, PAGE / elem_size);
new_capacity = PAGE / elem_size;
}
// Also ensure that this chunk can fit `n`.
new_capacity = cmp::max(n, new_capacity);

chunk = TypedArenaChunk::<T>::new(new_capacity);
self.ptr.set(chunk.start());
self.end.set(chunk.end());
Expand Down Expand Up @@ -347,17 +357,20 @@ impl DroplessArena {
self.end.set(last_chunk.end());
return;
} else {
// If the previous chunk's capacity is less than HUGE_PAGE
// bytes, then this chunk will be least double the previous
// chunk's size.
new_capacity = last_chunk.storage.capacity();
loop {
if new_capacity < HUGE_PAGE {
new_capacity = new_capacity.checked_mul(2).unwrap();
if new_capacity >= used_bytes + needed_bytes {
break;
}
}
}
} else {
new_capacity = cmp::max(needed_bytes, PAGE);
new_capacity = PAGE;
}
// Also ensure that this chunk can fit `needed_bytes`.
new_capacity = cmp::max(needed_bytes, new_capacity);

chunk = TypedArenaChunk::<u8>::new(new_capacity);
self.ptr.set(chunk.start());
self.end.set(chunk.end());
Expand Down
Loading