Skip to content

Commit f9441ad

Browse files
committed
Merge branch 'master' of github.com:rust-lang/rust
2 parents abf053d + 2b0e6d2 commit f9441ad

File tree

11 files changed

+1589
-1603
lines changed

11 files changed

+1589
-1603
lines changed

Cargo.lock

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2055,12 +2055,13 @@ dependencies = [
20552055

20562056
[[package]]
20572057
name = "measureme"
2058-
version = "0.4.0"
2058+
version = "0.5.0"
20592059
source = "registry+https://github.com/rust-lang/crates.io-index"
2060-
checksum = "cd21b0e6e1af976b269ce062038fe5e1b9ca2f817ab7a3af09ec4210aebf0d30"
2060+
checksum = "c420bbc064623934620b5ab2dc0cf96451b34163329e82f95e7fa1b7b99a6ac8"
20612061
dependencies = [
20622062
"byteorder",
20632063
"memmap",
2064+
"parking_lot 0.9.0",
20642065
"rustc-hash",
20652066
]
20662067

@@ -2072,9 +2073,9 @@ checksum = "2efc7bc57c883d4a4d6e3246905283d8dae951bb3bd32f49d6ef297f546e1c39"
20722073

20732074
[[package]]
20742075
name = "memmap"
2075-
version = "0.6.2"
2076+
version = "0.7.0"
20762077
source = "registry+https://github.com/rust-lang/crates.io-index"
2077-
checksum = "e2ffa2c986de11a9df78620c01eeaaf27d94d3ff02bf81bfcca953102dd0c6ff"
2078+
checksum = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b"
20782079
dependencies = [
20792080
"libc",
20802081
"winapi 0.3.8",
@@ -2213,6 +2214,7 @@ dependencies = [
22132214
"rand 0.7.0",
22142215
"rustc-workspace-hack",
22152216
"rustc_version",
2217+
"serde",
22162218
"shell-escape",
22172219
"vergen",
22182220
]

src/libarena/lib.rs

Lines changed: 12 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -202,53 +202,18 @@ impl<T> TypedArena<T> {
202202
#[inline]
203203
pub fn alloc_from_iter<I: IntoIterator<Item = T>>(&self, iter: I) -> &mut [T] {
204204
assert!(mem::size_of::<T>() != 0);
205-
let mut iter = iter.into_iter();
206-
let size_hint = iter.size_hint();
207-
208-
match size_hint {
209-
(min, Some(max)) if min == max => {
210-
// We know the exact number of elements the iterator will produce here
211-
let len = min;
212-
213-
if len == 0 {
214-
return &mut [];
215-
}
216-
217-
self.ensure_capacity(len);
218-
219-
let slice = self.ptr.get();
220-
221-
unsafe {
222-
let mut ptr = self.ptr.get();
223-
for _ in 0..len {
224-
// Write into uninitialized memory.
225-
ptr::write(ptr, iter.next().unwrap());
226-
// Advance the pointer.
227-
ptr = ptr.offset(1);
228-
// Update the pointer per iteration so if `iter.next()` panics
229-
// we destroy the correct amount
230-
self.ptr.set(ptr);
231-
}
232-
slice::from_raw_parts_mut(slice, len)
233-
}
234-
}
235-
_ => {
236-
cold_path(move || -> &mut [T] {
237-
let mut vec: SmallVec<[_; 8]> = iter.collect();
238-
if vec.is_empty() {
239-
return &mut [];
240-
}
241-
// Move the content to the arena by copying it and then forgetting
242-
// the content of the SmallVec
243-
unsafe {
244-
let len = vec.len();
245-
let start_ptr = self.alloc_raw_slice(len);
246-
vec.as_ptr().copy_to_nonoverlapping(start_ptr, len);
247-
vec.set_len(0);
248-
slice::from_raw_parts_mut(start_ptr, len)
249-
}
250-
})
251-
}
205+
let mut vec: SmallVec<[_; 8]> = iter.into_iter().collect();
206+
if vec.is_empty() {
207+
return &mut [];
208+
}
209+
// Move the content to the arena by copying it and then forgetting
210+
// the content of the SmallVec
211+
unsafe {
212+
let len = vec.len();
213+
let start_ptr = self.alloc_raw_slice(len);
214+
vec.as_ptr().copy_to_nonoverlapping(start_ptr, len);
215+
vec.set_len(0);
216+
slice::from_raw_parts_mut(start_ptr, len)
252217
}
253218
}
254219

src/librustc/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ byteorder = { version = "1.3" }
3737
chalk-engine = { version = "0.9.0", default-features=false }
3838
rustc_fs_util = { path = "../librustc_fs_util" }
3939
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
40-
measureme = "0.4"
40+
measureme = "0.5"
4141
rustc_error_codes = { path = "../librustc_error_codes" }
4242
rustc_session = { path = "../librustc_session" }

src/librustc_codegen_ssa/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ test = false
1313
bitflags = "1.2.1"
1414
cc = "1.0.1"
1515
num_cpus = "1.0"
16-
memmap = "0.6"
16+
memmap = "0.7"
1717
log = "0.4.5"
1818
libc = "0.2.44"
1919
jobserver = "0.1.11"

src/librustc_data_structures/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ rustc-hash = "1.0.1"
2626
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
2727
rustc_index = { path = "../librustc_index", package = "rustc_index" }
2828
bitflags = "1.2.1"
29-
measureme = "0.4"
29+
measureme = "0.5"
3030

3131
[dependencies.parking_lot]
3232
version = "0.9"

src/librustc_data_structures/profiling.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::sync::Arc;
77
use std::thread::ThreadId;
88
use std::u32;
99

10-
use measureme::{StringId, TimestampKind};
10+
use measureme::{StringId};
1111

1212
/// MmapSerializatioSink is faster on macOS and Linux
1313
/// but FileSerializationSink is faster on Windows
@@ -63,8 +63,8 @@ const EVENT_FILTERS_BY_NAME: &[(&str, EventFilter)] = &[
6363
("incr-cache-load", EventFilter::INCR_CACHE_LOADS),
6464
];
6565

66-
fn thread_id_to_u64(tid: ThreadId) -> u64 {
67-
unsafe { mem::transmute::<ThreadId, u64>(tid) }
66+
fn thread_id_to_u32(tid: ThreadId) -> u32 {
67+
unsafe { mem::transmute::<ThreadId, u64>(tid) as u32 }
6868
}
6969

7070

@@ -149,11 +149,10 @@ impl SelfProfilerRef {
149149
/// Record a query in-memory cache hit.
150150
#[inline(always)]
151151
pub fn query_cache_hit(&self, query_name: impl QueryName) {
152-
self.non_guard_query_event(
152+
self.instant_query_event(
153153
|profiler| profiler.query_cache_hit_event_kind,
154154
query_name,
155155
EventFilter::QUERY_CACHE_HITS,
156-
TimestampKind::Instant,
157156
);
158157
}
159158

@@ -184,22 +183,20 @@ impl SelfProfilerRef {
184183
}
185184

186185
#[inline(always)]
187-
fn non_guard_query_event(
186+
fn instant_query_event(
188187
&self,
189188
event_kind: fn(&SelfProfiler) -> StringId,
190189
query_name: impl QueryName,
191190
event_filter: EventFilter,
192-
timestamp_kind: TimestampKind
193191
) {
194192
drop(self.exec(event_filter, |profiler| {
195193
let event_id = SelfProfiler::get_query_name_string_id(query_name);
196-
let thread_id = thread_id_to_u64(std::thread::current().id());
194+
let thread_id = thread_id_to_u32(std::thread::current().id());
197195

198-
profiler.profiler.record_event(
196+
profiler.profiler.record_instant_event(
199197
event_kind(profiler),
200198
event_id,
201199
thread_id,
202-
timestamp_kind,
203200
);
204201

205202
TimingGuard::none()
@@ -306,7 +303,7 @@ impl<'a> TimingGuard<'a> {
306303
event_kind: StringId,
307304
event_id: StringId,
308305
) -> TimingGuard<'a> {
309-
let thread_id = thread_id_to_u64(std::thread::current().id());
306+
let thread_id = thread_id_to_u32(std::thread::current().id());
310307
let raw_profiler = &profiler.profiler;
311308
let timing_guard = raw_profiler.start_recording_interval_event(event_kind,
312309
event_id,

src/librustc_metadata/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ doctest = false
1212
[dependencies]
1313
flate2 = "1.0"
1414
log = "0.4"
15-
memmap = "0.6"
15+
memmap = "0.7"
1616
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
1717
rustc = { path = "../librustc" }
1818
rustc_data_structures = { path = "../librustc_data_structures" }

0 commit comments

Comments
 (0)