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 7 pull requests #69990

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
54d1c50
Remove `sip::Hasher::short_write`.
nnethercote Feb 25, 2020
3ba89e8
Remove quotes around unknown fn placeholder in backtrace
dtolnay Feb 13, 2020
db75b6a
Add quotes around filename in Backtrace debug
dtolnay Feb 13, 2020
1f1ca87
Change disabled and unsupported backtraces to print using placeholder…
dtolnay Feb 13, 2020
a9cc010
Make it possible to instantiate hardcoded Backtrace from test
dtolnay Feb 13, 2020
33600e4
Add test of Debug representation of Backtrace
dtolnay Feb 13, 2020
a2364dc
Write backtrace fmt test using relative paths
dtolnay Mar 9, 2020
cdc7304
Compute the correct layout for variants of uninhabited enums and read…
oli-obk Mar 6, 2020
ec88ffa
Comment nits
oli-obk Mar 11, 2020
74608c7
Rustfmt and adjust capitalization
oli-obk Mar 11, 2020
543832b
Regenerate tables for Unicode 13.0.0
cuviper Mar 11, 2020
7995a08
Increase verbosity when suggesting subtle code changes
estebank Mar 12, 2020
40ffcc2
Add self to .mailmap
kraai Mar 13, 2020
c274e07
Fix abort-on-eprintln during process shutdown
alexcrichton Mar 12, 2020
570edd0
Rollup merge of #69122 - dtolnay:backtrace, r=cramertj
Dylan-DPC Mar 14, 2020
f8756ac
Rollup merge of #69471 - nnethercote:rm-sip-Hasher-short_write, r=dto…
Dylan-DPC Mar 14, 2020
8f06c62
Rollup merge of #69768 - oli-obk:union_field_ice, r=eddyb,RalfJung
Dylan-DPC Mar 14, 2020
af0cdbf
Rollup merge of #69929 - cuviper:unicode-13.0.0, r=Mark-Simulacrum
Dylan-DPC Mar 14, 2020
b8d85a3
Rollup merge of #69942 - estebank:sized-verbose-sugg, r=matthewjasper
Dylan-DPC Mar 14, 2020
6c44885
Rollup merge of #69955 - alexcrichton:stderr-infallible, r=sfackler
Dylan-DPC Mar 14, 2020
9771fdf
Rollup merge of #69987 - kraai:mailmap, r=nikomatsakis
Dylan-DPC Mar 14, 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
3 changes: 3 additions & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ Mateusz Mikuła <matti@marinelayer.io> <mati865@gmail.com>
Mateusz Mikuła <matti@marinelayer.io> <mati865@users.noreply.github.com>
Matt Brubeck <mbrubeck@limpet.net> <mbrubeck@cs.hmc.edu>
Matthew Auld <matthew.auld@intel.com>
Matthew Kraai <kraai@ftbfs.org>
Matthew Kraai <kraai@ftbfs.org> <matt.kraai@abbott.com>
Matthew Kraai <kraai@ftbfs.org> <mkraai@its.jnj.com>
Matthew McPherrin <matthew@mcpherrin.ca> <matt@mcpherrin.ca>
Matthijs Hofstra <thiezz@gmail.com>
Melody Horn <melody@boringcactus.com> <mathphreak@gmail.com>
Expand Down
53 changes: 7 additions & 46 deletions src/libcore/hash/sip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,37 +220,6 @@ impl<S: Sip> Hasher<S> {
self.state.v3 = self.k1 ^ 0x7465646279746573;
self.ntail = 0;
}

// Specialized write function that is only valid for buffers with len <= 8.
// It's used to force inlining of write_u8 and write_usize, those would normally be inlined
// except for composite types (that includes slices and str hashing because of delimiter).
// Without this extra push the compiler is very reluctant to inline delimiter writes,
// degrading performance substantially for the most common use cases.
#[inline]
fn short_write(&mut self, msg: &[u8]) {
debug_assert!(msg.len() <= 8);
let length = msg.len();
self.length += length;

let needed = 8 - self.ntail;
let fill = cmp::min(length, needed);
if fill == 8 {
self.tail = unsafe { load_int_le!(msg, 0, u64) };
} else {
self.tail |= unsafe { u8to64_le(msg, 0, fill) } << (8 * self.ntail);
if length < needed {
self.ntail += length;
return;
}
}
self.state.v3 ^= self.tail;
S::c_rounds(&mut self.state);
self.state.v0 ^= self.tail;

// Buffered tail is now flushed, process new input.
self.ntail = length - needed;
self.tail = unsafe { u8to64_le(msg, needed, self.ntail) };
}
}

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

impl<S: Sip> super::Hasher for Hasher<S> {
// see short_write comment for explanation
#[inline]
fn write_usize(&mut self, i: usize) {
let bytes = unsafe {
crate::slice::from_raw_parts(&i as *const usize as *const u8, mem::size_of::<usize>())
};
self.short_write(bytes);
}

// see short_write comment for explanation
#[inline]
fn write_u8(&mut self, i: u8) {
self.short_write(&[i]);
}

// Note: no integer hashing methods (`write_u*`, `write_i*`) are defined
// for this type. We could add them, copy the `short_write` implementation
// in librustc_data_structures/sip128.rs, and add `write_u*`/`write_i*`
// methods to `SipHasher`, `SipHasher13`, and `DefaultHasher`. This would
// greatly speed up integer hashing by those hashers, at the cost of
// slightly slowing down compile speeds on some benchmarks. See #69152 for
// details.
#[inline]
fn write(&mut self, msg: &[u8]) {
let length = msg.len();
Expand Down
Loading