Compare commits
10 Commits
9c61785deb
...
50aa7dc743
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
50aa7dc743 | ||
|
|
d2a1ec5962 | ||
|
|
ed8857bcda | ||
|
|
d88b837b35 | ||
|
|
d89ffb3518 | ||
|
|
c6ff870926 | ||
|
|
923a9429ed | ||
|
|
9a695a46ba | ||
|
|
1255ffce0e | ||
|
|
46c4ee6ab2 |
@ -1,38 +0,0 @@
|
||||
From e69d9f880677f2aa3488c80b953ec4309f0dfa2e Mon Sep 17 00:00:00 2001
|
||||
From: costan <costan@google.com>
|
||||
Date: Thu, 4 Jan 2018 14:26:40 -0800
|
||||
Subject: [PATCH 03/35] Fix Travis CI configuration for OSX.
|
||||
|
||||
---
|
||||
.travis.yml | 15 +++++++++++----
|
||||
1 file changed, 11 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/.travis.yml b/.travis.yml
|
||||
index 9841e9a..8816edb 100644
|
||||
--- a/.travis.yml
|
||||
+++ b/.travis.yml
|
||||
@@ -38,10 +38,17 @@ addons:
|
||||
- clang-4.0
|
||||
|
||||
install:
|
||||
-# Travis doesn't have a nice way to install homebrew packages yet.
|
||||
-# https://github.com/travis-ci/travis-ci/issues/5377
|
||||
-- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update; fi
|
||||
-- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install gcc@6; fi
|
||||
+# Travis doesn't have a DSL for installing homebrew packages yet. Status tracked
|
||||
+# in https://github.com/travis-ci/travis-ci/issues/5377
|
||||
+# The Travis VM image for Mac already has a link at /usr/local/include/c++,
|
||||
+# causing Homebrew's gcc@6 installation to error out. This was reported to
|
||||
+# Homebrew maintainers at https://github.com/Homebrew/brew/issues/1742 and
|
||||
+# removing the link emerged as a workaround.
|
||||
+- if [ "$TRAVIS_OS_NAME" == "osx" ]; then
|
||||
+ brew update;
|
||||
+ if [ -L /usr/local/include/c++ ]; then rm /usr/local/include/c++; fi;
|
||||
+ brew install gcc@6;
|
||||
+ fi
|
||||
# /usr/bin/gcc is stuck to old versions by on both Linux and OSX.
|
||||
- if [ "$CXX" = "g++" ]; then export CXX="g++-6" CC="gcc-6"; fi
|
||||
- echo ${CC}
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
72
add-option-to-enable-rtti-set-default-to-current-ben.patch
Normal file
72
add-option-to-enable-rtti-set-default-to-current-ben.patch
Normal file
@ -0,0 +1,72 @@
|
||||
From 07d1ae496bea8280f4cec08df5745845f7956365 Mon Sep 17 00:00:00 2001
|
||||
From: Ganesh Maharaj Mahalingam <ganesh.mahalingam@intel.com>
|
||||
Date: Wed, 6 Apr 2022 10:04:21 -0700
|
||||
Subject: [PATCH] snappy: Autospec creation for version 1.1.9
|
||||
|
||||
This patch addresses an issue with Ceph
|
||||
https://tracker.ceph.com/issues/53060. There have been multiple patches
|
||||
to upstream snappy, but they have all been rejected and the reasoning
|
||||
has always been that snappy would like to be consistent in their build
|
||||
flags with chrome as mentioned at
|
||||
https://github.com/google/snappy/pull/144#issuecomment-968371042
|
||||
add-option-to-enable-rtti-set-default-to-current-ben.patch
|
||||
---
|
||||
CMakeLists.txt | 14 ++++++++++----
|
||||
snappy-stubs-internal.h | 2 +-
|
||||
2 files changed, 11 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 672561e..cafdc59 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -53,8 +53,10 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
add_definitions(-D_HAS_EXCEPTIONS=0)
|
||||
|
||||
# Disable RTTI.
|
||||
- string(REGEX REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-")
|
||||
+ if(NOT SNAPPY_ENABLE_RTTI)
|
||||
+ string(REGEX REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-")
|
||||
+ endif(SNAPPY_ENABLE_RTTI)
|
||||
else(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
# Use -Wall for clang and gcc.
|
||||
if(NOT CMAKE_CXX_FLAGS MATCHES "-Wall")
|
||||
@@ -78,8 +80,10 @@ else(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions")
|
||||
|
||||
# Disable RTTI.
|
||||
- string(REGEX REPLACE "-frtti" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
|
||||
+ if(NOT SNAPPY_ENABLE_RTTI)
|
||||
+ string(REGEX REPLACE "-frtti" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
|
||||
+ endif(SNAPPY_ENABLE_RTTI)
|
||||
endif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
|
||||
# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to make
|
||||
@@ -98,6 +102,8 @@ option(SNAPPY_REQUIRE_AVX2 "Target processors with AVX2 support." OFF)
|
||||
|
||||
option(SNAPPY_INSTALL "Install Snappy's header and library" ON)
|
||||
|
||||
+option(SNAPPY_ENABLE_RTTI "Enable RTTI for Snappy's library" OFF)
|
||||
+
|
||||
include(TestBigEndian)
|
||||
test_big_endian(SNAPPY_IS_BIG_ENDIAN)
|
||||
|
||||
diff --git a/snappy-stubs-internal.h b/snappy-stubs-internal.h
|
||||
index c2a838f..5bf7870 100644
|
||||
--- a/snappy-stubs-internal.h
|
||||
+++ b/snappy-stubs-internal.h
|
||||
@@ -100,7 +100,7 @@
|
||||
|
||||
// Inlining hints.
|
||||
#ifdef HAVE_ATTRIBUTE_ALWAYS_INLINE
|
||||
-#define SNAPPY_ATTRIBUTE_ALWAYS_INLINE __attribute__((always_inline))
|
||||
+#define SNAPPY_ATTRIBUTE_ALWAYS_INLINE
|
||||
#else
|
||||
#define SNAPPY_ATTRIBUTE_ALWAYS_INLINE
|
||||
#endif
|
||||
--
|
||||
2.24.4
|
||||
|
||||
@ -0,0 +1,26 @@
|
||||
From 581af0c0a819da2214466e4d30416616966e781d Mon Sep 17 00:00:00 2001
|
||||
From: hanxinke <hanxinke@huawei.com>
|
||||
Date: Tue, 7 Dec 2021 15:47:14 +0800
|
||||
Subject: [PATCH] fix the AdvanceToNextTag fails to be compiled without inline
|
||||
|
||||
Signed-off-by: hanxinke <hanxinke@huawei.com>
|
||||
---
|
||||
snappy.cc | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/snappy.cc b/snappy.cc
|
||||
index 79dc0e8..51157be 100644
|
||||
--- a/snappy.cc
|
||||
+++ b/snappy.cc
|
||||
@@ -1014,7 +1014,7 @@ void MemMove(ptrdiff_t dst, const void* src, size_t size) {
|
||||
}
|
||||
|
||||
SNAPPY_ATTRIBUTE_ALWAYS_INLINE
|
||||
-size_t AdvanceToNextTag(const uint8_t** ip_p, size_t* tag) {
|
||||
+inline size_t AdvanceToNextTag(const uint8_t** ip_p, size_t* tag) {
|
||||
const uint8_t*& ip = *ip_p;
|
||||
// This section is crucial for the throughput of the decompression loop.
|
||||
// The latency of an iteration is fundamentally constrained by the
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
70
remove-dependency-on-google-benchmark-and-gmock.patch
Normal file
70
remove-dependency-on-google-benchmark-and-gmock.patch
Normal file
@ -0,0 +1,70 @@
|
||||
From 14ccda0d6c228999c8d982a84562432cd7465743 Mon Sep 17 00:00:00 2001
|
||||
From: hanxinke <hanxinke@huawei.com>
|
||||
Date: Tue, 7 Dec 2021 15:34:34 +0800
|
||||
Subject: [PATCH] remove dependency on google benchmark and gmock
|
||||
|
||||
Signed-off-by: hanxinke <hanxinke@huawei.com>
|
||||
---
|
||||
CMakeLists.txt | 22 +++++++++++-----------
|
||||
1 file changed, 11 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 672561e..3127d9b 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -88,7 +88,7 @@ option(BUILD_SHARED_LIBS "Build shared libraries(DLLs)." OFF)
|
||||
|
||||
option(SNAPPY_BUILD_TESTS "Build Snappy's own tests." ON)
|
||||
|
||||
-option(SNAPPY_BUILD_BENCHMARKS "Build Snappy's benchmarks" ON)
|
||||
+option(SNAPPY_BUILD_BENCHMARKS "Build Snappy's benchmarks" OFF)
|
||||
|
||||
option(SNAPPY_FUZZING_BUILD "Build Snappy for fuzzing." OFF)
|
||||
|
||||
@@ -288,25 +288,25 @@ if(SNAPPY_BUILD_TESTS)
|
||||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||
set(install_gtest OFF)
|
||||
set(install_gmock OFF)
|
||||
- set(build_gmock ON)
|
||||
+ set(build_gmock OFF)
|
||||
|
||||
# This project is tested using GoogleTest.
|
||||
- add_subdirectory("third_party/googletest")
|
||||
+ # add_subdirectory("third_party/googletest")
|
||||
|
||||
# GoogleTest triggers a missing field initializers warning.
|
||||
- if(SNAPPY_HAVE_NO_MISSING_FIELD_INITIALIZERS)
|
||||
- set_property(TARGET gtest
|
||||
- APPEND PROPERTY COMPILE_OPTIONS -Wno-missing-field-initializers)
|
||||
- set_property(TARGET gmock
|
||||
- APPEND PROPERTY COMPILE_OPTIONS -Wno-missing-field-initializers)
|
||||
- endif(SNAPPY_HAVE_NO_MISSING_FIELD_INITIALIZERS)
|
||||
+ # if(SNAPPY_HAVE_NO_MISSING_FIELD_INITIALIZERS)
|
||||
+ # set_property(TARGET gtest
|
||||
+ # APPEND PROPERTY COMPILE_OPTIONS -Wno-missing-field-initializers)
|
||||
+ # set_property(TARGET gmock
|
||||
+ # APPEND PROPERTY COMPILE_OPTIONS -Wno-missing-field-initializers)
|
||||
+ # endif(SNAPPY_HAVE_NO_MISSING_FIELD_INITIALIZERS)
|
||||
|
||||
add_executable(snappy_unittest "")
|
||||
target_sources(snappy_unittest
|
||||
PRIVATE
|
||||
"snappy_unittest.cc"
|
||||
)
|
||||
- target_link_libraries(snappy_unittest snappy_test_support gmock_main gtest)
|
||||
+ target_link_libraries(snappy_unittest snappy_test_support gtest_main gtest)
|
||||
|
||||
add_test(
|
||||
NAME snappy_unittest
|
||||
@@ -332,7 +332,7 @@ if(SNAPPY_BUILD_BENCHMARKS)
|
||||
# This project uses Google benchmark for benchmarking.
|
||||
set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "" FORCE)
|
||||
set(BENCHMARK_ENABLE_EXCEPTIONS OFF CACHE BOOL "" FORCE)
|
||||
- add_subdirectory("third_party/benchmark")
|
||||
+ # add_subdirectory("third_party/benchmark")
|
||||
endif(SNAPPY_BUILD_BENCHMARKS)
|
||||
|
||||
if(SNAPPY_FUZZING_BUILD)
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
Binary file not shown.
BIN
snappy-1.1.9.tar.gz
Normal file
BIN
snappy-1.1.9.tar.gz
Normal file
Binary file not shown.
@ -1,12 +0,0 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -118,7 +118,7 @@
|
||||
"${PROJECT_SOURCE_DIR}/snappy-test.cc"
|
||||
)
|
||||
target_compile_definitions(snappy_unittest PRIVATE -DHAVE_CONFIG_H)
|
||||
- target_link_libraries(snappy_unittest snappy ${GFLAGS_LIBRARIES})
|
||||
+ target_link_libraries(snappy_unittest snappy ${GTEST_LIBRARIES} ${GFLAGS_LIBRARIES})
|
||||
|
||||
if(HAVE_LIBZ)
|
||||
target_link_libraries(snappy_unittest z)
|
||||
@ -1,275 +0,0 @@
|
||||
diff --git a/snappy.cc b/snappy.cc
|
||||
index fd519e5..e7d7373 100644
|
||||
--- a/snappy.cc
|
||||
+++ b/snappy.cc
|
||||
@@ -42,6 +42,11 @@
|
||||
#if SNAPPY_HAVE_SSE2
|
||||
#include <emmintrin.h>
|
||||
#endif
|
||||
+
|
||||
+#if ARCH_ARM
|
||||
+#include <arm_neon.h>
|
||||
+#endif
|
||||
+
|
||||
#include <stdio.h>
|
||||
|
||||
#include <algorithm>
|
||||
@@ -53,6 +58,7 @@ namespace snappy {
|
||||
|
||||
using internal::COPY_1_BYTE_OFFSET;
|
||||
using internal::COPY_2_BYTE_OFFSET;
|
||||
+using internal::COPY_4_BYTE_OFFSET;
|
||||
using internal::LITERAL;
|
||||
using internal::char_table;
|
||||
using internal::kMaximumTagLength;
|
||||
@@ -63,13 +69,22 @@ using internal::kMaximumTagLength;
|
||||
// input. Of course, it doesn't hurt if the hash function is reasonably fast
|
||||
// either, as it gets called a lot.
|
||||
static inline uint32 HashBytes(uint32 bytes, int shift) {
|
||||
- uint32 kMul = 0x1e35a7bd;
|
||||
+ const uint32 kMul = 0x1e35a7bd;
|
||||
return (bytes * kMul) >> shift;
|
||||
}
|
||||
static inline uint32 Hash(const char* p, int shift) {
|
||||
return HashBytes(UNALIGNED_LOAD32(p), shift);
|
||||
}
|
||||
|
||||
+#if ARCH_ARM
|
||||
+static inline void Prefetch(const void* data) {
|
||||
+ __asm__ __volatile__(
|
||||
+ "prfm PLDL1STRM, [%[data]] \n\t"
|
||||
+ :: [data] "r" (data)
|
||||
+ );
|
||||
+}
|
||||
+#endif // ARCH_ARM
|
||||
+
|
||||
size_t MaxCompressedLength(size_t source_len) {
|
||||
// Compressed data can be defined as:
|
||||
// compressed := item* literal*
|
||||
@@ -184,12 +199,12 @@ inline char* IncrementalCopy(const char* src, char* op, char* const op_limit,
|
||||
// abcabcxxxxx
|
||||
// abcabcabcabcxxxxx
|
||||
// ^
|
||||
- // The last x is 14 bytes after ^.
|
||||
- if (SNAPPY_PREDICT_TRUE(op <= buf_limit - 14)) {
|
||||
+ // The last x is 11 bytes after ^.
|
||||
+ if (SNAPPY_PREDICT_TRUE(op <= buf_limit - 11)) {
|
||||
while (pattern_size < 8) {
|
||||
UnalignedCopy64(src, op);
|
||||
op += pattern_size;
|
||||
- pattern_size *= 2;
|
||||
+ pattern_size <<= 1;
|
||||
}
|
||||
if (SNAPPY_PREDICT_TRUE(op >= op_limit)) return op_limit;
|
||||
} else {
|
||||
@@ -202,9 +217,22 @@ inline char* IncrementalCopy(const char* src, char* op, char* const op_limit,
|
||||
// UnalignedCopy128 might overwrite data in op. UnalignedCopy64 is safe
|
||||
// because expanding the pattern to at least 8 bytes guarantees that
|
||||
// op - src >= 8.
|
||||
- while (op <= buf_limit - 16) {
|
||||
+ const char* loop_limit = buf_limit - 16;
|
||||
+ while (op <= loop_limit) {
|
||||
+#if ARCH_ARM
|
||||
+ __asm__ __volatile__(
|
||||
+ "ldr d0, [%[src]] \n\t"
|
||||
+ "str d0, [%[op]] \n\t"
|
||||
+ "ldr d1, [%[src], #8] \n\t"
|
||||
+ "str d1, [%[op], #8] \n\t"
|
||||
+ : [op] "+r" (op)
|
||||
+ : [src] "r" (src)
|
||||
+ : "d0", "d1"
|
||||
+ );
|
||||
+#else
|
||||
UnalignedCopy64(src, op);
|
||||
UnalignedCopy64(src + 8, op + 8);
|
||||
+#endif
|
||||
src += 16;
|
||||
op += 16;
|
||||
if (SNAPPY_PREDICT_TRUE(op >= op_limit)) return op_limit;
|
||||
@@ -219,7 +247,7 @@ inline char* IncrementalCopy(const char* src, char* op, char* const op_limit,
|
||||
return IncrementalCopySlow(src, op, op_limit);
|
||||
}
|
||||
|
||||
-} // namespace
|
||||
+} // namespaceEncode32
|
||||
|
||||
static inline char* EmitLiteral(char* op,
|
||||
const char* literal,
|
||||
@@ -237,30 +265,27 @@ static inline char* EmitLiteral(char* op,
|
||||
// MaxCompressedLength).
|
||||
assert(len > 0); // Zero-length literals are disallowed
|
||||
int n = len - 1;
|
||||
- if (allow_fast_path && len <= 16) {
|
||||
+ if (allow_fast_path && SNAPPY_PREDICT_TRUE(len <= 16)) {
|
||||
// Fits in tag byte
|
||||
*op++ = LITERAL | (n << 2);
|
||||
-
|
||||
+#if ARCH_ARM
|
||||
+ vst1q_u64((uint64_t*)op, vld1q_u64((const uint64_t*)literal));
|
||||
+#else
|
||||
UnalignedCopy128(literal, op);
|
||||
+#endif
|
||||
return op + len;
|
||||
}
|
||||
|
||||
- if (n < 60) {
|
||||
+ if (SNAPPY_PREDICT_TRUE(n < 60)) {
|
||||
// Fits in tag byte
|
||||
*op++ = LITERAL | (n << 2);
|
||||
} else {
|
||||
- // Encode in upcoming bytes
|
||||
- char* base = op;
|
||||
- int count = 0;
|
||||
- op++;
|
||||
- while (n > 0) {
|
||||
- *op++ = n & 0xff;
|
||||
- n >>= 8;
|
||||
- count++;
|
||||
- }
|
||||
+ int count = (Bits::Log2Floor(n) >> 3) + 1;
|
||||
assert(count >= 1);
|
||||
assert(count <= 4);
|
||||
- *base = LITERAL | ((59+count) << 2);
|
||||
+ *op++ = LITERAL | ((59 + count) << 2);
|
||||
+ LittleEndian::Store32(op,n);
|
||||
+ op += count;
|
||||
}
|
||||
memcpy(op, literal, len);
|
||||
return op + len;
|
||||
@@ -471,12 +496,12 @@ char* CompressFragment(const char* input,
|
||||
if (SNAPPY_PREDICT_FALSE(next_ip > ip_limit)) {
|
||||
goto emit_remainder;
|
||||
}
|
||||
- next_hash = Hash(next_ip, shift);
|
||||
candidate = base_ip + table[hash];
|
||||
assert(candidate >= base_ip);
|
||||
assert(candidate < ip);
|
||||
|
||||
table[hash] = ip - base_ip;
|
||||
+ next_hash = Hash(next_ip, shift);
|
||||
} while (SNAPPY_PREDICT_TRUE(UNALIGNED_LOAD32(ip) !=
|
||||
UNALIGNED_LOAD32(candidate)));
|
||||
|
||||
@@ -496,17 +521,22 @@ char* CompressFragment(const char* input,
|
||||
// this loop via goto if we get close to exhausting the input.
|
||||
EightBytesReference input_bytes;
|
||||
uint32 candidate_bytes = 0;
|
||||
+ uint32 prev_val = 0;
|
||||
+ uint32 cur_val = 0;
|
||||
+ uint32 next_val = 0;
|
||||
|
||||
do {
|
||||
// We have a 4-byte match at ip, and no need to emit any
|
||||
// "literal bytes" prior to ip.
|
||||
- const char* base = ip;
|
||||
+#if defined(ARCH_ARM)
|
||||
+ Prefetch(ip + 256);
|
||||
+#endif
|
||||
+ size_t offset = ip - candidate;
|
||||
std::pair<size_t, bool> p =
|
||||
FindMatchLength(candidate + 4, ip + 4, ip_end);
|
||||
size_t matched = 4 + p.first;
|
||||
+ assert(0 == memcmp(ip, candidate, matched));
|
||||
ip += matched;
|
||||
- size_t offset = base - candidate;
|
||||
- assert(0 == memcmp(base, candidate, matched));
|
||||
op = EmitCopy(op, offset, matched, p.second);
|
||||
next_emit = ip;
|
||||
if (SNAPPY_PREDICT_FALSE(ip >= ip_limit)) {
|
||||
@@ -516,15 +546,19 @@ char* CompressFragment(const char* input,
|
||||
// table[Hash(ip, shift)] for that. To improve compression,
|
||||
// we also update table[Hash(ip - 1, shift)] and table[Hash(ip, shift)].
|
||||
input_bytes = GetEightBytesAt(ip - 1);
|
||||
- uint32 prev_hash = HashBytes(GetUint32AtOffset(input_bytes, 0), shift);
|
||||
- table[prev_hash] = ip - base_ip - 1;
|
||||
- uint32 cur_hash = HashBytes(GetUint32AtOffset(input_bytes, 1), shift);
|
||||
+ prev_val = GetUint32AtOffset(input_bytes, 0);
|
||||
+ cur_val = GetUint32AtOffset(input_bytes, 1);
|
||||
+ next_val = GetUint32AtOffset(input_bytes, 2);
|
||||
+
|
||||
+ uint32 prev_hash = HashBytes(prev_val, shift);
|
||||
+ uint32 cur_hash = HashBytes(cur_val, shift);
|
||||
candidate = base_ip + table[cur_hash];
|
||||
candidate_bytes = UNALIGNED_LOAD32(candidate);
|
||||
+ table[prev_hash] = ip - base_ip - 1;
|
||||
table[cur_hash] = ip - base_ip;
|
||||
- } while (GetUint32AtOffset(input_bytes, 1) == candidate_bytes);
|
||||
+ } while (cur_val == candidate_bytes);
|
||||
|
||||
- next_hash = HashBytes(GetUint32AtOffset(input_bytes, 2), shift);
|
||||
+ next_hash = HashBytes(next_val, shift);
|
||||
++ip;
|
||||
}
|
||||
}
|
||||
@@ -636,8 +670,7 @@ class SnappyDecompressor {
|
||||
// Length is encoded in 1..5 bytes
|
||||
*result = 0;
|
||||
uint32 shift = 0;
|
||||
- while (true) {
|
||||
- if (shift >= 32) return false;
|
||||
+ for (;;) {
|
||||
size_t n;
|
||||
const char* ip = reader_->Peek(&n);
|
||||
if (n == 0) return false;
|
||||
@@ -650,6 +683,7 @@ class SnappyDecompressor {
|
||||
break;
|
||||
}
|
||||
shift += 7;
|
||||
+ if (shift >= 32) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -658,10 +692,9 @@ class SnappyDecompressor {
|
||||
// Returns true if successful, false on error or end of input.
|
||||
template <class Writer>
|
||||
void DecompressAllTags(Writer* writer) {
|
||||
- const char* ip = ip_;
|
||||
// For position-independent executables, accessing global arrays can be
|
||||
// slow. Move wordmask array onto the stack to mitigate this.
|
||||
- uint32 wordmask[sizeof(internal::wordmask)/sizeof(uint32)];
|
||||
+ uint32 wordmask[5];
|
||||
// Do not use memcpy to copy internal::wordmask to
|
||||
// wordmask. LLVM converts stack arrays to global arrays if it detects
|
||||
// const stack arrays and this hurts the performance of position
|
||||
@@ -673,6 +706,7 @@ class SnappyDecompressor {
|
||||
wordmask[3] = internal::wordmask[3];
|
||||
wordmask[4] = internal::wordmask[4];
|
||||
|
||||
+ const char* ip = ip_;
|
||||
// We could have put this refill fragment only at the beginning of the loop.
|
||||
// However, duplicating it at the end of each branch gives the compiler more
|
||||
// scope to optimize the <ip_limit_ - ip> expression based on the local
|
||||
@@ -737,22 +771,28 @@ class SnappyDecompressor {
|
||||
if (avail == 0) return; // Premature end of input
|
||||
ip_limit_ = ip + avail;
|
||||
}
|
||||
- if (!writer->Append(ip, literal_length)) {
|
||||
+ bool append_res = !writer->Append(ip, literal_length);
|
||||
+ if (SNAPPY_PREDICT_TRUE(append_res)) {
|
||||
return;
|
||||
}
|
||||
ip += literal_length;
|
||||
MAYBE_REFILL();
|
||||
} else {
|
||||
+ const uint32 val = LittleEndian::Load32(ip);
|
||||
const size_t entry = char_table[c];
|
||||
- const size_t trailer = LittleEndian::Load32(ip) & wordmask[entry >> 11];
|
||||
const size_t length = entry & 0xff;
|
||||
- ip += entry >> 11;
|
||||
+ const size_t copy_offset = entry & 0x700;
|
||||
+ const size_t mask_idx = entry >> 11;
|
||||
+ const uint32 mask = wordmask[mask_idx];
|
||||
+ const size_t trailer = val & mask;
|
||||
+ const size_t offset = copy_offset + trailer;
|
||||
+ ip += mask_idx;
|
||||
|
||||
// copy_offset/256 is encoded in bits 8..10. By just fetching
|
||||
// those bits, we get copy_offset (since the bit-field starts at
|
||||
// bit 8).
|
||||
- const size_t copy_offset = entry & 0x700;
|
||||
- if (!writer->AppendFromSelf(copy_offset + trailer, length)) {
|
||||
+ bool append_res = !writer->AppendFromSelf(offset, length);
|
||||
+ if (append_res) {
|
||||
return;
|
||||
}
|
||||
MAYBE_REFILL();
|
||||
@ -1,17 +0,0 @@
|
||||
diff --git a/snappy-stubs-public.h.in b/snappy-stubs-public.h.in
|
||||
index 3fd79bb..bb5b222 100644
|
||||
--- a/snappy-stubs-public.h.in
|
||||
+++ b/snappy-stubs-public.h.in
|
||||
@@ -48,9 +48,9 @@
|
||||
#include <sys/uio.h>
|
||||
#endif // HAVE_SYS_UIO_H
|
||||
|
||||
-#define SNAPPY_MAJOR ${SNAPPY_MAJOR}
|
||||
-#define SNAPPY_MINOR ${SNAPPY_MINOR}
|
||||
-#define SNAPPY_PATCHLEVEL ${SNAPPY_PATCHLEVEL}
|
||||
+#define SNAPPY_MAJOR ${PROJECT_VERSION_MAJOR}
|
||||
+#define SNAPPY_MINOR ${PROJECT_VERSION_MINOR}
|
||||
+#define SNAPPY_PATCHLEVEL ${PROJECT_VERSION_PATCH}
|
||||
#define SNAPPY_VERSION \
|
||||
((SNAPPY_MAJOR << 16) | (SNAPPY_MINOR << 8) | SNAPPY_PATCHLEVEL)
|
||||
|
||||
@ -3,8 +3,8 @@ exec_prefix=${prefix}
|
||||
includedir=${prefix}/include
|
||||
libdir=${prefix}/lib64
|
||||
|
||||
Name: snappy
|
||||
Name: snappy
|
||||
Description: A fast compression/decompression library
|
||||
Version: 1.1.7
|
||||
Version: 1.1.8
|
||||
Libs: -L\${libdir} -lsnappy
|
||||
Cflags: -I\${includedir}
|
||||
|
||||
29
snappy.spec
29
snappy.spec
@ -1,18 +1,17 @@
|
||||
Name: snappy
|
||||
Version: 1.1.7
|
||||
Release: 10
|
||||
Version: 1.1.9
|
||||
Release: 2
|
||||
Summary: A fast compressor/decompressor
|
||||
License: BSD
|
||||
URL: https://github.com/google/snappy
|
||||
Source0: https://github.com/google/snappy/archive/%{version}/%{name}-%{version}.tar.gz
|
||||
Source1: snappy.pc
|
||||
|
||||
Patch0: snappy-gtest.patch
|
||||
Patch1: snappy-version-macros.patch
|
||||
Patch2: snappy-kunpeng-backport.patch
|
||||
Patch6000: Fix-Travis-CI-configuration-for-OSX.patch
|
||||
Patch0: remove-dependency-on-google-benchmark-and-gmock.patch
|
||||
Patch1: fix-the-AdvanceToNextTag-fails-to-be-compiled-without-inline.patch
|
||||
Patch2: add-option-to-enable-rtti-set-default-to-current-ben.patch
|
||||
|
||||
BuildRequires: gcc-c++ automake autoconf gtest-devel cmake
|
||||
BuildRequires: gcc-c++ make gtest-devel cmake
|
||||
|
||||
%description
|
||||
Snappy is a compression/decompression library. It does not aim for maximum compression,
|
||||
@ -20,7 +19,7 @@ or compatibility with any other compression library; instead, it aims for very h
|
||||
speeds and reasonable compression.
|
||||
|
||||
%package devel
|
||||
Summary: Development files for snappy
|
||||
Summary: Development files for snappy
|
||||
Group: Development/Libraries
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: cmake-filesystem pkgconfig
|
||||
@ -34,7 +33,7 @@ This package is the development files for snappy.
|
||||
%autosetup -n %{name}-%{version} -p1
|
||||
|
||||
%build
|
||||
%cmake
|
||||
%cmake -DSNAPPY_ENABLE_RTTI=ON
|
||||
%make_build
|
||||
|
||||
%install
|
||||
@ -71,6 +70,18 @@ make test
|
||||
%doc NEWS README.md
|
||||
|
||||
%changelog
|
||||
* Wed Jun 22 2022 wangzengliang<wangzengliang1@huawei.com> - 1.1.9-2
|
||||
- DESC: add-option to enable rtti set default to current
|
||||
|
||||
* Tue Dec 7 2021 hanxinke<hanxinke@huawei.com> - 1.1.9-1
|
||||
- DESC: upgrade snappy to 1.1.9
|
||||
|
||||
* Fri Jul 17 2020 shixuantong <shixuantong> - 1.1.8-1
|
||||
- Type:NA
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC:update to 1.1.8-1
|
||||
|
||||
* Wed Oct 9 2019 shenyangyang<shenyangyang4@huawei.com> - 1.1.7-10
|
||||
- Type:enhancement
|
||||
- ID:NA
|
||||
|
||||
4
snappy.yaml
Normal file
4
snappy.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
version_control: github
|
||||
src_repo: google/snappy
|
||||
tag_prefix: ^
|
||||
seperator: .
|
||||
Loading…
x
Reference in New Issue
Block a user