Skip to content

Commit a3622ac

Browse files
committed
[wasm-ld] Switch to xxh3_64bits
Similar to recent changes to ELF (e.g., D154813), Mach-O, and COFF to improve hashing performance. Reviewed By: dschuff Differential Revision: https://reviews.llvm.org/D155752
1 parent 8e0715e commit a3622ac

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

lld/test/wasm/build-id.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ foo:
4343

4444

4545
# DEFAULT: Contents of section build_id:
46-
# DEFAULT-NEXT: 0000 10cdbf99 f76b1f5e ebb2f36a 1bde1d6c .....k.^...j...l
47-
# DEFAULT-NEXT: 0010 01
46+
# DEFAULT-NEXT: 0000 100e228e 4e2fa853 6393b43d ed1d4676
47+
# DEFAULT-NEXT: 0010 13 .
4848

4949
# SHA1: Contents of section build_id:
5050
# SHA1-NEXT: 0000 14ad22e8 54d72438 94af85de 3c5592bd ..".T.$8....<U..

lld/wasm/InputChunks.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ void MergeInputChunk::splitStrings(ArrayRef<uint8_t> data) {
451451
fatal(toString(this) + ": string is not null terminated");
452452
size_t size = end + 1;
453453

454-
pieces.emplace_back(off, xxHash64(s.substr(0, size)), true);
454+
pieces.emplace_back(off, xxh3_64bits(s.substr(0, size)), true);
455455
s = s.substr(size);
456456
off += size;
457457
}

lld/wasm/Writer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ void Writer::writeBuildId() {
290290
case BuildIdKind::Fast: {
291291
std::vector<uint8_t> fileHash(8);
292292
computeHash(fileHash, buf, [](uint8_t *dest, ArrayRef<uint8_t> arr) {
293-
support::endian::write64le(dest, xxHash64(arr));
293+
support::endian::write64le(dest, xxh3_64bits(arr));
294294
});
295295
makeUUID(5, fileHash, buildId);
296296
break;

0 commit comments

Comments
 (0)