Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5a72ecf

Browse files
committedMar 15, 2020
Auto merge of #70016 - Dylan-DPC:rollup-5k7lxs3, r=Dylan-DPC
Rollup of 7 pull requests Successful merges: - #69357 (Emit 1-based column numbers in debuginfo) - #69471 (Remove `sip::Hasher::short_write`.) - #69498 (Change "method" to "associated function") - #69967 (Remove a few `Rc`s from RegionInferenceCtxt) - #69987 (Add self to .mailmap) - #69991 (fix E0117 message out of sync) - #69993 (Add long error explanation for E0693) Failed merges: r? @ghost
2 parents 7cdbc87 + 838884e commit 5a72ecf

File tree

95 files changed

+383
-278
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+383
-278
lines changed
 

‎.mailmap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,9 @@ Mateusz Mikuła <matti@marinelayer.io> <mati865@gmail.com>
172172
Mateusz Mikuła <matti@marinelayer.io> <mati865@users.noreply.github.com>
173173
Matt Brubeck <mbrubeck@limpet.net> <mbrubeck@cs.hmc.edu>
174174
Matthew Auld <matthew.auld@intel.com>
175+
Matthew Kraai <kraai@ftbfs.org>
176+
Matthew Kraai <kraai@ftbfs.org> <matt.kraai@abbott.com>
177+
Matthew Kraai <kraai@ftbfs.org> <mkraai@its.jnj.com>
175178
Matthew McPherrin <matthew@mcpherrin.ca> <matt@mcpherrin.ca>
176179
Matthijs Hofstra <thiezz@gmail.com>
177180
Melody Horn <melody@boringcactus.com> <mathphreak@gmail.com>

‎src/libcore/hash/sip.rs

Lines changed: 7 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -220,37 +220,6 @@ impl<S: Sip> Hasher<S> {
220220
self.state.v3 = self.k1 ^ 0x7465646279746573;
221221
self.ntail = 0;
222222
}
223-
224-
// Specialized write function that is only valid for buffers with len <= 8.
225-
// It's used to force inlining of write_u8 and write_usize, those would normally be inlined
226-
// except for composite types (that includes slices and str hashing because of delimiter).
227-
// Without this extra push the compiler is very reluctant to inline delimiter writes,
228-
// degrading performance substantially for the most common use cases.
229-
#[inline]
230-
fn short_write(&mut self, msg: &[u8]) {
231-
debug_assert!(msg.len() <= 8);
232-
let length = msg.len();
233-
self.length += length;
234-
235-
let needed = 8 - self.ntail;
236-
let fill = cmp::min(length, needed);
237-
if fill == 8 {
238-
self.tail = unsafe { load_int_le!(msg, 0, u64) };
239-
} else {
240-
self.tail |= unsafe { u8to64_le(msg, 0, fill) } << (8 * self.ntail);
241-
if length < needed {
242-
self.ntail += length;
243-
return;
244-
}
245-
}
246-
self.state.v3 ^= self.tail;
247-
S::c_rounds(&mut self.state);
248-
self.state.v0 ^= self.tail;
249-
250-
// Buffered tail is now flushed, process new input.
251-
self.ntail = length - needed;
252-
self.tail = unsafe { u8to64_le(msg, needed, self.ntail) };
253-
}
254223
}
255224

256225
#[stable(feature = "rust1", since = "1.0.0")]
@@ -280,21 +249,13 @@ impl super::Hasher for SipHasher13 {
280249
}
281250

282251
impl<S: Sip> super::Hasher for Hasher<S> {
283-
// see short_write comment for explanation
284-
#[inline]
285-
fn write_usize(&mut self, i: usize) {
286-
let bytes = unsafe {
287-
crate::slice::from_raw_parts(&i as *const usize as *const u8, mem::size_of::<usize>())
288-
};
289-
self.short_write(bytes);
290-
}
291-
292-
// see short_write comment for explanation
293-
#[inline]
294-
fn write_u8(&mut self, i: u8) {
295-
self.short_write(&[i]);
296-
}
297-
252+
// Note: no integer hashing methods (`write_u*`, `write_i*`) are defined
253+
// for this type. We could add them, copy the `short_write` implementation
254+
// in librustc_data_structures/sip128.rs, and add `write_u*`/`write_i*`
255+
// methods to `SipHasher`, `SipHasher13`, and `DefaultHasher`. This would
256+
// greatly speed up integer hashing by those hashers, at the cost of
257+
// slightly slowing down compile speeds on some benchmarks. See #69152 for
258+
// details.
298259
#[inline]
299260
fn write(&mut self, msg: &[u8]) {
300261
let length = msg.len();

0 commit comments

Comments
 (0)
Please sign in to comment.