senhuang42
28394b64f2
Add proper bounds check on adding ldms
2020-10-07 13:56:25 -04:00
senhuang42
a2f2b58d04
Add a function ldm_voidSequences()
2020-10-07 13:56:25 -04:00
senhuang42
9c3c7cd20e
Fix function argument to getNextMatch()
2020-10-07 13:56:25 -04:00
senhuang42
c8b8572b38
Adjustments to no longer segfault on nci
2020-10-07 13:56:25 -04:00
senhuang42
f57c7e6bbf
Add base adjustment correction
2020-10-07 13:56:25 -04:00
senhuang42
5df9b5e05f
Add initial getNextMatch() in opt parser
2020-10-07 13:56:25 -04:00
senhuang42
f8ce7cabc3
Added more debugging
2020-10-07 13:56:25 -04:00
senhuang42
84009a076a
Add re-copying of ldmSeqStore after processing
2020-10-07 13:56:25 -04:00
senhuang42
42395a70c2
Add debug statements, flesh out functions
2020-10-07 13:56:25 -04:00
senhuang42
dd3dd199bb
Get zstd to build with new functions and callsites, fix arguments
2020-10-07 13:56:25 -04:00
senhuang42
766c4a8c28
Implement part of ldm_maybeAddLdm()
2020-10-07 13:56:25 -04:00
senhuang42
84777059d2
Implement ldm_getNextMatch()
2020-10-07 13:56:24 -04:00
senhuang42
28c74bf591
Implement basic splitSequence and skipSequence functions
2020-10-07 13:56:24 -04:00
senhuang42
634ab7830d
Flesh out required args for ldm_handleLdm()
2020-10-07 13:56:24 -04:00
senhuang42
db70761032
Add callsites to appropriate locations in ..opt_generic()
2020-10-07 13:56:24 -04:00
senhuang42
aea61e3c91
Add ldm helper function declarations into opt parser
2020-10-07 13:56:24 -04:00
senhuang42
35d9f488f5
Modify codepath to use opt parser exclusively if the compression level is high enough
2020-10-07 13:56:24 -04:00
senhuang42
e1ae398ad5
Add rawSeqStore to match state
2020-10-07 13:56:24 -04:00
Martin Liska
b684900a4a
Allow external creation of POOLs that can be shared.
2020-10-07 12:44:33 +02:00
Nick Terrell
4b4d8b4dc9
Merge pull request #2338 from terrelln/comments
...
Add comments to ZSTD_getLowest{Match,Prefix}Index()
2020-10-01 18:56:24 -07:00
Nick Terrell
0057c4acf7
Merge pull request #2333 from terrelln/stable-dst
...
Reset all decompression parameters in ZSTD_DCtx_reset()
2020-10-01 18:56:11 -07:00
Nick Terrell
2e7d174130
Reset all decompression parameters in ZSTD_DCtx_reset()
...
* Reset all decompression parameters in `ZSTD_DCtx_reset()` when
resetting parameters.
* Add a test case.
2020-10-01 14:19:21 -07:00
Nick Terrell
27c969ed07
Add comments to ZSTD_getLowest{Match,Prefix}Index()
...
Clarify how we handle dictionaries in each case.
2020-10-01 13:21:46 -07:00
Yann Collet
cc88eb7594
Merge pull request #2317 from animalize/msvc_inline
...
Let MSVC force inline ZSTD_hashPtr() function
2020-09-30 08:27:53 -07:00
Nick Terrell
f1cbeec039
[superblock] Reduce stack usage by correctly sizing header buffers
2020-09-24 19:42:04 -07:00
Nick Terrell
6a1e526ea7
[lib] Add ZSTD_COMPRESS_HEAPMODE tuning parameter
2020-09-24 19:42:04 -07:00
Nick Terrell
b841387218
[freestanding] Improve macro resolution to handle #if X
2020-09-24 19:42:04 -07:00
Nick Terrell
caecd8c211
Allow user to override ASAN/MSAN detection
...
Rename ADDRESS_SANITIZER -> ZSTD_ADDRESS_SANITIZER and same for
MEMORY_SANITIZER. Also set it to 0/1 instead of checking for defined.
This allows the user to override ASAN/MSAN detection for platforms that
don't support it.
2020-09-24 19:42:04 -07:00
Nick Terrell
88fac5d514
Remove call to memset
...
The previous commit fixes the test so it errors on calls to mem*()
functions from <string.h>.
2020-09-24 19:42:04 -07:00
Nick Terrell
9ae0483858
Reorganize zstd_deps.h and mem.h + replace mem.h for the kernel
2020-09-24 19:41:59 -07:00
Nick Terrell
260fc75028
Move __has_builtin() fallback define to compiler.h
2020-09-24 15:51:08 -07:00
Nick Terrell
4d63ee57f5
Move ASAN/MSAN support declarations to compiler.h
2020-09-24 15:51:08 -07:00
Nick Terrell
b09ec5c2b9
Remove MEM_STATIC_ASSERT and use DEBUG_STATIC_ASSERT instead
2020-09-24 15:51:04 -07:00
Nick Terrell
9261476b7d
[lib] Wrap customMem xor checks in parens for readability
...
This clarifies operator precedence, and quiets cppcheck in
the Kernel Test Robot. I think this is a slight bonus to
readability, so I am accepting the suggestion.
2020-09-23 23:26:07 -07:00
Nick Terrell
dec7fb03ec
[lib] Silence -Wunused-const-variable warnings
2020-09-23 12:59:57 -07:00
animalize
2e5d73dd72
Use MEM_STATIC FORCE_INLINE_ATTR
instead of FORCE_INLINE_TEMPLATE
...
It adds `__attribute__((unused))` for __GNUC__, to eliminate `-Werror=unused-function` error.
2020-09-21 13:26:38 +08:00
animalize
0a69a6b1ca
Let MSVC force inline ZSTD_hashPtr() function
...
ZSTD_hashPtr() function was not expanded by MSVC, led to low performance compared to GCC.
2020-09-21 10:38:55 +08:00
Felix Handte
200c960f1d
Merge pull request #2311 from felixhandte/ddss-fix-cparam-derivation
...
Fix Compression Parameter Derivation Bugs Introduced by DDSS Changes
2020-09-18 14:02:14 -04:00
W. Felix Handte
8930c6e551
Use ZSTD_CCtxParams_init() to Init CCtxParams, not memset()
...
Even if the discrepancies are at the moment benign, it's probably better to
standardize on using the one true initializer, rather than trying (and failing)
to correctly duplicate its behavior.
2020-09-17 12:15:33 -04:00
W. Felix Handte
e8a44326fa
Avoid Redundancy in ZSTD_initCDict_internal() Args; Don't Take CParams + CCtxParams
2020-09-17 12:08:36 -04:00
W. Felix Handte
eee51a664a
Fall Back if Derived CParams are Incompatible with DDSS; Refactor CDict Creation
...
Rewrite ZSTD_createCDict_advanced() as a wrapper around
ZSTD_createCDict_advanced2(). Evaluate whether to use DDSS mode *after* fully
resolving cparams. If not, fall back.
2020-09-15 18:01:08 -04:00
W. Felix Handte
bc6521a6f6
Make ZSTD_createCDict_advanced2() cctxParams Arg Const
2020-09-15 14:06:10 -04:00
W. Felix Handte
26a96a5b35
Do More Complete CParams Deduction in Non-DDSS Path of ZSTD_createCDict_advanced2
...
Call ZSTD_getCParamsFromCCtxParams() instead of ZSTD_getCParams_internal().
2020-09-15 13:57:43 -04:00
W. Felix Handte
a2af804129
Pull CParam Override Logic into Helper
2020-09-15 13:38:05 -04:00
Yann Collet
c91a0855f8
check endDirective in ZSTD_compressStream2()
...
fix #2297
also :
- `assert()` `endDirective` in `ZSTD_compressStream_internal()`, for debug mode
- add relevant tests
2020-09-14 10:56:08 -07:00
senhuang42
17b56f934e
Coding style cleanup
2020-09-11 11:42:12 -04:00
senhuang42
801513b5e7
Modify params rather than cctx->requestedParams
2020-09-11 11:41:10 -04:00
W. Felix Handte
c5fab8848a
Document searchFuncs Table
2020-09-10 22:10:02 -04:00
W. Felix Handte
85a95840e4
Further Consolidate Dict Mode Checks
2020-09-10 22:10:02 -04:00
W. Felix Handte
032010fcc1
Improve Documentation Slightly
2020-09-10 22:10:02 -04:00
W. Felix Handte
0faefbf1b3
Make DDSS Selection Override ForceCopy Directive
2020-09-10 22:10:02 -04:00
W. Felix Handte
efa33861f2
Attempt to Fix MSVC Warnings
2020-09-10 22:10:02 -04:00
W. Felix Handte
ed43832770
Simplify Match Limit Checks
...
Seems like a ~1.25% speedup.
2020-09-10 22:10:02 -04:00
W. Felix Handte
06d240b8a7
Use All Available Space in the Hash Table to Extent Chain Table Reach
...
Rather than restrict our temp chain table to 2 ** chainLog entries, this
commit uses all available space to reach further back to gather longer
chains to pack into the DDSS chain table.
2020-09-10 22:10:02 -04:00
W. Felix Handte
b2b0641ea0
Rewrite Table Fill to Retain Cache Entries Beyond Chain Window
2020-09-10 22:10:02 -04:00
W. Felix Handte
916238d9dc
Avoid Malloc in Table Fill; Pack Tmp Structure into Hash Table
2020-09-10 22:10:02 -04:00
W. Felix Handte
f42c5bddd9
Truncate Chain at Last Possible Attempt
...
Make the chain table denser?
2020-09-10 22:10:02 -04:00
W. Felix Handte
20a020edbc
Prefetch Chain Table Matches
2020-09-10 22:10:02 -04:00
W. Felix Handte
9b9feb84f2
Lay Out Chain Table Chains Contiguously
...
Rather than interleave all of the chain table entries, tying each entry's
position to the corresponding position in the input, this commit changes the
layout so that all the entries in a single chain are laid out next to each
other. The last entry in the hash table's bucket for this hash is now a packed
pointer of position + length of this chain.
This cannot be merged as written, since it allocates temporary memory inside
ZSTD_dedicatedDictSearch_lazy_loadDictionary().
2020-09-10 22:10:02 -04:00
W. Felix Handte
66509c7bf4
Only Insert Positions Inside the Chain Window
2020-09-10 22:10:02 -04:00
W. Felix Handte
13c5ec3e41
Only Allow Dedicated Dict Search for Dicts Loaded in 1 Chunk
...
The load algorithm requires we do it all in one go.
2020-09-10 22:10:02 -04:00
W. Felix Handte
07793547e6
Fix Bug: Only Use DDSS Insertion on CDict MatchStates
...
Previously, if DDSS was enabled on a CCtx and a dictionary was inserted into
the CCtx, the CCtx MatchState would be filled as a DDSS struct, causing
segfaults etc. This changes the check to use whether the MatchState is marked
as using the DDSS (which is only ever set for CDict MatchStates), rather than
looking at the CCtxParams.
2020-09-10 18:51:52 -04:00
W. Felix Handte
d214d8c859
Shorten Dict Mode Conditionals in Order to Improve Readability
2020-09-10 18:51:52 -04:00
W. Felix Handte
f49c1563ff
Force-Inline ZSTD_insertAndFindFirstIndex_internal()
...
Without this, gcc was declining to inline the function in `ZSTD_noDict` mode,
resulting in a ~10% slowdown.
2020-09-10 18:51:52 -04:00
W. Felix Handte
cab86b074f
Clean Up Search Function Selection
2020-09-10 18:51:52 -04:00
W. Felix Handte
2ffbde0d95
Fix -Wshorten-64-to-32
Error
2020-09-10 18:51:52 -04:00
W. Felix Handte
7b5d2f72ea
Adjust Working Context Table Sizes Back Down
2020-09-10 18:51:52 -04:00
W. Felix Handte
c09454e28f
Add Warning Comment to ZSTD_createCDict_advanced2() Declaration
2020-09-10 18:51:52 -04:00
W. Felix Handte
d332f57897
Permit Matching Against Lowest Valid Position
...
This comparison was previously faulty: the lowest valid position is itself
valid, and we should therefore be allowed to match against it.
2020-09-10 18:51:52 -04:00
W. Felix Handte
a3659fe1ef
Make ZSTD_dedicatedDictSearch_getCParams Wrap ZSTD_getCParams
...
Fixes up bounds-checking, and lets us clean up what is at the moment an
unnecessary duplication of the default cparams tables.
2020-09-10 18:51:52 -04:00
W. Felix Handte
7b9a755ac9
Remove Chain Limit on Hash Cache Entries; Slightly Improve Compression
...
Entries in the hashTable chain cache aren't subject to the same aliasing that
the circular chain table is subject to. As such, we don't need to stop when we
cross the chain limit. We can delve deeper. :)
2020-09-10 18:51:52 -04:00
W. Felix Handte
e8b4011b52
Split Lookups in Hash Cache and Chain Table into Two Loops
...
Sliiiight speedup.
2020-09-10 18:51:52 -04:00
W. Felix Handte
9e83c782f8
Simplify DDS Hash Table Construction
...
No need to walk the chainTable; we can just keep shifting the entries in the
hashTable.
2020-09-10 18:51:52 -04:00
W. Felix Handte
ad9f98ac3f
Document the ZSTD_c_enableDedicatedDictSearch Parameter
2020-09-10 18:51:52 -04:00
W. Felix Handte
5390fee4f7
Rename and Move DD_BLOG Constant to ZSTD_LAZY_DDSS_BUCKET_LOG
2020-09-10 18:51:52 -04:00
W. Felix Handte
5e91ae27eb
Prefetch First Batch of Match Positions; +11% Speed in Level 5 w/ 1 Dict
2020-09-10 18:51:52 -04:00
W. Felix Handte
df386b3d8d
Fix Off-By-One Error in Counting DDS Search Attempts
...
This caused us to double-search the first position and fail to search the
last position in the chain, slowing down search and making it less effective.
2020-09-10 18:51:52 -04:00
W. Felix Handte
914bfe7ee4
Init CCtx's Local Dict with CCtxParams
2020-09-10 18:51:52 -04:00
W. Felix Handte
db2aa25252
Decision for Whether to Attach Should be Based on CDict Config, not CCtx
2020-09-10 18:51:52 -04:00
W. Felix Handte
a494111385
Move Prefetch Before Insertion; Speed Up ~6%
2020-09-10 18:51:52 -04:00
W. Felix Handte
eede46a47e
Misc Refactor of DDS Search Code
2020-09-10 18:51:52 -04:00
W. Felix Handte
f1b428fdac
Rename enableDedicatedDictSearch to dedicatedDictSearch in MatchState
...
This makes it clear that not only is the feature allowed here, we're actually
using it, as opposed to the CCtxParam field, in which it's enabled, but we may
or may not be using it.
2020-09-10 18:51:52 -04:00
W. Felix Handte
41012193ad
Always Init CDict's enableDedicatedDictSearch Field
2020-09-10 18:51:52 -04:00
W. Felix Handte
34b545acb0
Add a ZSTD_dedicatedDictSearch ZSTD_dictMode_e to Allow Const Propagation
...
Speed +1.5%.
2020-09-10 18:51:52 -04:00
W. Felix Handte
beefdb0d3d
Fix ZSTD_c_forceAttachDict Bounds
2020-09-10 18:51:52 -04:00
W. Felix Handte
c204110eff
Make ZSTD_c_enableDedicatedDictSearch an Experimental Param
2020-09-10 18:51:52 -04:00
W. Felix Handte
ae4ebf6b8c
TODO: Comment
2020-09-10 18:51:52 -04:00
W. Felix Handte
def62e2d3e
Fix Compilation Warnings
2020-09-10 18:51:52 -04:00
Bimba Shrestha
9c628238d3
creating ZSTD_createCDict_advanced_internal
2020-09-10 18:51:52 -04:00
Bimba Shrestha
0a9787c3e1
changing to int for consistency
2020-09-10 18:51:52 -04:00
Bimba Shrestha
e29bc3a009
using dict mls instead of src mls
2020-09-10 18:51:52 -04:00
Bimba Shrestha
145c2d12f9
add hashtable head prefetching
2020-09-10 18:51:52 -04:00
Bimba Shrestha
5d5507788d
change method name for consistency
2020-09-10 18:51:52 -04:00
Bimba Shrestha
b30f71becf
pass correct cparams
2020-09-10 18:51:52 -04:00
Bimba Shrestha
a3f6e4026e
removing wrong comment
2020-09-10 18:51:52 -04:00
Bimba Shrestha
71fda0362f
making cctxParams a pointer
2020-09-10 18:51:52 -04:00
Bimba Shrestha
628559d0e4
loading dict using new algorithm
2020-09-10 18:51:52 -04:00
Bimba Shrestha
22705f0c93
adding dedicatedDictSearch algorithm
2020-09-10 18:51:52 -04:00
Bimba Shrestha
31e581bf65
adding enableDedicatedDictSearch to matchState_t
2020-09-10 18:51:52 -04:00
Bimba Shrestha
50550a14ad
adding dedicated dict load method to lazy
2020-09-10 18:51:52 -04:00
Bimba Shrestha
75b6360036
adding ZSTD_createCDict_advanced2 to zstd.h
2020-09-10 18:51:52 -04:00
Bimba Shrestha
b7dddbe89b
always attach dict when using dedicatedDictSearch
2020-09-10 18:51:52 -04:00
Bimba Shrestha
e36a373df4
adding dedicatedDictSearch cParams helper methods
2020-09-10 18:51:52 -04:00
Bimba Shrestha
f10d4e313c
adding ZSTD_dedicatedDictSearch_defaultCParameters variable
2020-09-10 18:51:52 -04:00
Bimba Shrestha
c497cb6716
Add ZSTD_c_enableDedicatedDictSearch Param
2020-09-10 18:51:52 -04:00
senhuang42
64bd68e44b
Adjust ZSTD_createCDict_byReference() function, and check for cdict when using compressStream2
2020-09-10 13:42:26 -04:00
Nick Terrell
da30a78c68
[lib] Bump version number to 1.4.6
2020-09-09 17:13:45 -07:00
Nick Terrell
b92569a522
[doc] Document new build macros in lib/README.md
2020-09-09 17:13:16 -07:00
Nick Terrell
aab4bf7b0d
[linux-kernel] Add test that checks the ifdef hardwiring
2020-09-09 14:36:19 -07:00
Nick Terrell
79ded1b4a9
[lib] Add ZSTD_NO_UNUSED_FUNCTIONS macro to hide unused functions
...
The unused function definitions are hidden behind a
`#ifndef ZSTD_NO_UNUSED_FUNCTIONS` check.
Initially hiding all functions which are unused and take up more than
2KB of stack space, because these will show up as warnings in the
Linux Kernel build system.
2020-09-09 14:35:39 -07:00
Nick Terrell
ac3a136b0a
[lib] Replace 64-bit divisions with ZSTD_div64()
2020-09-09 14:35:39 -07:00
Nick Terrell
a90779397a
[lib] Reduce zstd stack usage by 1KB
2020-09-09 14:35:39 -07:00
Nick Terrell
046aca190f
Fix ZSTD_initCStream_advanced() with no dictionary and static allocation
2020-09-09 14:35:39 -07:00
Nick Terrell
e975de289c
Add ZSTD_NO_INTRINSICS macro to avoid explicit intrinsics
2020-09-09 14:35:39 -07:00
Nick Terrell
f91ed5c766
[lib] s/current/curr because it collides with Linux Kernel macro
2020-09-09 14:35:39 -07:00
Nick Terrell
5e4efd22d4
Merge pull request #2291 from i-do-cpp/fix-compression-level-default
...
Fix setParameter not falling back to default compression level
2020-09-08 16:42:34 -07:00
Felix Handte
8db661dd7f
Merge pull request #2294 from felixhandte/makefile-lib-fix-var-order
...
Fix Makefile Variable Concatenation Order
2020-09-04 10:58:57 -04:00
W. Felix Handte
75bc289911
Fix Makefile Variable Concatenation Order
...
Previously, this construct would add `-O3` onto the end of the compiler flags
variable, **after** `MOREFLAGS`, which meant that it was impossible to over-
ride. This commit fixes this order and should otherwise be a no-op.
2020-09-03 17:30:29 -04:00
Nick Terrell
6da8acd231
Merge pull request #2293 from allanjude/coverity
...
Resolve Coverity 1432392 Unintentional integer overflow
2020-09-03 13:58:45 -07:00
Allan Jude
8665793164
Resolve Coverity 1432392 Unintentional integer overflow
...
Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)
overflow_before_widen: Potentially overflowing expression:
cdict->dictContentSize * 6U
with type unsigned int (32 bits, unsigned) is evaluated using 32-bit
arithmetic, and then used in a context that expects an expression of
type U64 (64 bits, unsigned).
2020-09-03 19:31:50 +00:00
i-do-cpp
aec8b27fff
Update zstd_compress.c
2020-08-31 09:34:08 +02:00
i-do-cpp
d514281e73
Fix setParameter not falling back to default compression level on 0 value
...
See documentation for `ZSTD_c_compressionLevel`: `Special: value 0 means default, which is controlled by ZSTD_CLEVEL_DEFAULT`
2020-08-31 09:25:43 +02:00
Yann Collet
c6d5a2cad0
Merge pull request #2288 from animalize/doc_version
...
[doc] Add ZSTD_versionString() to manual
2020-08-27 12:32:07 -07:00
animalize
6365e0e32f
Add ZSTD_versionString() function to manual.
2020-08-27 13:51:22 +08:00
Nick Terrell
c465f24457
ZSTD_ prefix mem{cpy,move,set},malloc,calloc,free
2020-08-26 12:26:03 -07:00
Nick Terrell
a686d306d2
Rename ZSTD_{malloc,calloc,free} to ZSTD_custom{Malloc,Calloc,Free}
2020-08-26 12:25:08 -07:00
Nick Terrell
80f577baa2
Move standard includes to zstd_deps.h
2020-08-26 12:25:08 -07:00
Nick Terrell
cf83aceaf3
Merge pull request #2282 from terrelln/ncount-fix
...
[bug] Fix FSE_readNCount()
2020-08-26 10:31:07 -07:00
Nick Terrell
4193638996
[bug] Fix FSE_readNCount()
...
* Fix bug introduced in PR #2271
* Fix long-standing bug that is impossible to trigger inside of zstd
* Add a fuzzer that makes sure the normalized count always round trips
correctly
2020-08-25 15:42:41 -07:00
Yann Collet
f82d9865b9
Merge pull request #2278 from senhuang42/ignore_checksum_advanced_param
...
New advanced decompression param to ignore checksums
2020-08-25 12:08:53 -07:00
Nick Terrell
614e446000
Merge pull request #2271 from terrelln/small-blocks
...
Small block optimizations
2020-08-24 18:54:33 -07:00
Nick Terrell
52f33a1da5
Fix compiler warnings
2020-08-24 16:09:45 -07:00
Nick Terrell
6f301a7903
Merge pull request #2272 from terrelln/dstSize_tooSmall
...
[fix] Always return dstSize_tooSmall when it is the case
2020-08-24 15:01:17 -07:00
Nick Terrell
6d2f750b37
Document the BMI2 default() functions
2020-08-24 14:44:33 -07:00
senhuang42
a030560d62
Add new DCtx param: validateChecksum and update unit tests
2020-08-24 17:28:00 -04:00
Nick Terrell
cebe0b5c0b
Improve FSE_normalizeCount() docs
2020-08-24 13:58:34 -07:00
Nick Terrell
1302f8d676
[fix] Always return dstSize_tooSmall when it is the case
2020-08-24 13:38:13 -07:00
senhuang42
44c54a3e31
Addressing comments: more comments, cleanup, remove extra function, checksum logic
2020-08-24 16:14:19 -04:00
Nick Terrell
8def0e5fd3
Fix up code after reading through
2020-08-24 12:24:45 -07:00
senhuang42
ffaa0df76d
Document change in CLI for --no-check during decompression in --help menu
2020-08-24 09:49:12 -04:00
senhuang42
e3f5f9658a
Added CLI tests for --no-check, fixed ignore checksum logic
2020-08-22 16:05:40 -04:00
senhuang42
20eb095882
Added unit test to fuzzer.c, changed definition param name
2020-08-22 13:26:33 -04:00
senhuang42
47685ac856
Move enum into zstd.h, and fix pesky switch() logic
2020-08-21 18:18:53 -04:00
senhuang42
08d3567ba8
Add function prototype
2020-08-21 16:51:43 -04:00
senhuang42
6a8dbdcd1f
Modify decompression loop to gnore checksums if flag is enabled
2020-08-21 16:46:46 -04:00
senhuang42
2f39124342
Rename to ZSTD_d_forceIgnoreChecksum, add to DCtx, add function to set the advanced param
2020-08-21 16:23:39 -04:00
senhuang42
b5cddda073
Add new definition of ZSTD_d_forceSkipChecksum in experimental section
2020-08-21 15:59:03 -04:00
Nick Terrell
8f8bd2d1ac
[regression] Update results.csv
2020-08-20 12:41:35 -07:00
Antonio Bueno
77c97089fc
Fixed Markdown warnings. No visible changes.
2020-08-19 12:36:28 +02:00
Nick Terrell
575731b6db
Use ncount=1 when < 4096 symbols
2020-08-18 16:47:53 -07:00
Nick Terrell
612e947c5e
wire up bmi2 support
2020-08-17 16:35:28 -07:00
Nick Terrell
ba1fd17a9f
speed up literal header decoding
2020-08-17 12:17:53 -07:00
Nick Terrell
6004c1117f
speed up small blocks
2020-08-16 23:03:38 -07:00
Felix Handte
bb265da4ae
Merge pull request #2270 from felixhandte/fix-doc-cctx-set-param
...
Fix Documentation for ZSTD_CCtxParams_setParameter()
2020-08-14 21:44:56 -04:00
W. Felix Handte
99746eea7e
Fix Documentation for ZSTD_CCtxParams_setParameter()
...
It does not only return 0 on success.
2020-08-14 14:44:08 -04:00
Carl Woffenden
4c81fae146
Fix clang -Wcomma warning
2020-08-13 16:11:22 +02:00
Nick Terrell
e3bda594ae
Prefer __builtin_prefetch over inline asm
...
Reorder the ifdefs for the PREFETCH macros so that the compiler builtin is
favored over the inline assembly for aarch64.
2020-08-10 22:17:18 -07:00
Yann Collet
38e38546a4
Merge pull request #2258 from Niadb/dev
...
Added STATIC_BMI2 for compile time detection of BMI2 on MSVC, when enabled various intrinsics are used
2020-08-04 09:43:59 -07:00
Yann Collet
60b56e3b5f
Merge pull request #2253 from facebook/histvec
...
optimized histogram
2020-08-02 14:08:42 -07:00
Nick Terrell
f85a0f8bcf
Merge pull request #2256 from helloguo/dev
...
Optimize ZSTD_wildcopy
2020-07-29 11:57:49 -07:00
Carl Woffenden
5d81d44e40
Fixed VS variable shadowing warning (and added test)
2020-07-29 12:33:39 +02:00
helloguo
acb3dd9a68
Use ZSTD_copy16 instead of memcpy
2020-07-28 11:58:46 -07:00
Niadb
a8ebc14035
Update bitstream.h
...
Profiler showed some of these not being inlined on MSVC
2020-07-28 11:17:04 -06:00
Niadb
216a63dcf7
Add files via upload
2020-07-28 02:52:52 -06:00
Niadb
493fd40dca
Add files via upload
2020-07-28 02:52:15 -06:00
helloguo
82b0cd844f
Optimize ZSTD_wildcopy
2020-07-27 22:08:52 -07:00
Yann Collet
8b9cdd2597
fixed overlapping count & workspace special case
2020-07-26 22:40:21 -07:00
Yann Collet
051232223f
optimized histogram
...
new version easier to vectorize
leads to smaller code and faster execution
notably at the last recombination stage
(basically, fixed cost per block).
Assembly inspected with godbolt
On my laptop, with `clang` and `-mavx2` :
2K block : 1280 MB/s -> 1550 MB/s
8K block : 1750 MB/s -> 1860 MB/s
2020-07-26 22:24:22 -07:00
helloguo
6de87b3a74
fix preprocessor in ZSTD_wildcopy
2020-07-24 10:53:58 -07:00
Yann Collet
c224367ede
ensure workspace is large enough
...
even when MAX_TABLELOG is reduced
2020-07-16 20:33:50 -07:00
Yann Collet
21c273da84
import some minor fixes from FSE project
2020-07-16 20:25:15 -07:00
Yann Collet
a44671b281
Revert "Fix -Wunused-variable under FUZZING_BUILD_MODE..."
2020-07-15 12:42:18 -07:00
Mitch Phillips
23b55d6b3e
Fix -Wunused-variable under FUZZING_BUILD_MODE...
...
Fuzzing build modes (FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) doesn't
necessarily imply that assert() is enabled, according to the manual.
When the current do-nothing is expanded under -Wunused-variable (-Wall),
it results in unused variables in some of the FUZZING_BUILD_MODE...
blocks.
This patch extends the do-nothing to avoid the unused variable.
2020-07-14 09:03:02 -07:00
Yann Collet
16b353b207
minor doc clarification regarding MT parameters
2020-07-11 02:16:52 -07:00
Yann Collet
2cdd33ae16
Merge pull request #2227 from yoshihitoh/single-file-dict-emscripten
...
[contrib] Fix single-file compilation error on Emscripten build.
2020-07-07 08:51:20 -07:00
dkcasset
82e7e2b47e
Add variable for sed extended RE option (defaults to -E)
2020-06-29 13:44:23 -07:00
yoshihitoh
c6548eac8e
Rename static vars to avoid redefinition error.
2020-06-29 10:51:50 +09:00
dkcasset
b0ed66ef92
Replace -E option with equivalent -r for older versions of sed
2020-06-26 10:43:28 -07:00
Nick Terrell
7afd5d85d3
Merge pull request #2218 from terrelln/assert-seq
...
Fix unused variable warnings in fuzzing build mode without asserts
2020-06-22 17:41:18 -07:00
Nick Terrell
081691a3aa
Merge pull request #2217 from terrelln/cover-redundant
...
[cover] Remove unnecessary mask and dedup hash functions
2020-06-22 17:41:13 -07:00
Nick Terrell
370933fa20
Merge pull request #2209 from Niadb/dev
...
Explicitly use __cdecl for qsort, to avoid warning when default calling convention is not __cdecl
2020-06-22 17:41:03 -07:00
Nick Terrell
cce0edfdbe
Fix unused variable warnings in fuzzing build mode without asserts
...
Fix unused vairable warnings when `FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION` is defined but asserts are disabled.
Fixes #2210 .
2020-06-22 12:56:57 -07:00
Nick Terrell
2312b819af
[cover] Remove unnecessary mask and dedup hash functions
...
* Remove the unnecessary mask, since `ZSTD_hash*()` already ensures
the output is mod 2^h.
* Dedup the hash functions and use `ZSTD_hash*()` directly.
2020-06-22 12:52:13 -07:00
Nick Terrell
78601d0806
Merge pull request #2212 from cwoffenden/single-file-dict
...
Single-file libs now include dictBuilder
2020-06-22 12:46:54 -07:00
Nick Terrell
1047097dad
[superblock] Add defensive assert and bounds check
...
The bound check condition should always be met because we selected `set_basic` as
our encoding type. But that code is very far away, so assert it is true so if it is
ever false we can catch it, and add a bounds check.
Fixes #2213 .
2020-06-22 10:21:38 -07:00
Carl Woffenden
38cdb6a072
Renamed cover and fast cover hash functions/vars
2020-06-22 11:54:24 +02:00
Carl Woffenden
4a9b7d136f
Initial implementation (files added, macros fixed)
...
Hashing functions still to fix.
2020-06-22 10:31:36 +02:00
Niadb
74f65f624c
Update compiler.h
...
clean wording
2020-06-19 09:51:00 -06:00
Niadb
8c115cbe23
Update compiler.h
...
Added a comment explaining the purpose of the WIN_CDECL macro
2020-06-19 09:48:35 -06:00
Niadb
2962fda93f
Add files via upload
2020-06-19 03:34:05 -06:00
Niadb
405586d40a
Add files via upload
2020-06-19 03:32:11 -06:00
Niadb
a4c8aa5e02
Add files via upload
2020-06-19 03:31:47 -06:00
Nick Terrell
08981d2638
[lib] Allow compression dictionaries with missing symbols
...
Allow compression to use dictionaries with missing symbols in their
entropy tables. We set the FSE repeat mode to check when there are
missing symbols, and set the FSE repeat mode to valid when all symbols
are present.
Note that when not all symbols are present, the heuristics which favor
dictionary tables for lower compression levels won't activate.
Tested by manually creating a dictionary with missing symbols of every
type, and validing that the compressor rejects it before this change,
and accepts it after this change. Also, I ran the `dictionary_loader`
fuzzer for >1 hour of CPU time without running into cases where
compression succeeds, but decompression fails.
Fixes #2174 .
2020-06-12 17:57:19 -07:00
Felix Handte
2af4e07326
Merge pull request #2133 from felixhandte/single-size-calculation
...
Consolidate CCtx Size Estimation Code
2020-05-28 13:07:18 -04:00
Yann Collet
39a32f40c9
fixed default rule for lib/Makefile
...
default rule is `lib-release`
`lib-release` wasn't working : it was just skipped.
Removing `lib-release` from the list of .PHONY targets fixes it.
Same for `lib-mt`.
2020-05-25 06:50:45 -07:00
Yann Collet
082755bd3f
do not install zbuff.h
...
this API is deprecated, for a loong time now,
all related symbols will be removed in a future version (likely v1.5.0)
and the header file `zbuff.h` doesn't compile from `include/` anyway,
because it needs to be positioned one directory below `zstd.h`.
Also removed `cover.h` from `cmake` installer,
as it should have never been part of this list to begin with.
2020-05-22 15:35:54 -07:00
Orivej Desh
93cec0c1d6
Fix legacy build after #2103
2020-05-22 12:48:02 +00:00
Nick Terrell
3cc227e90e
[ldm][mt] Fix loadedDictEnd
2020-05-19 15:55:03 -07:00
Yann Collet
fdc56baa42
fix 22294 ( #2151 )
2020-05-18 21:05:10 -07:00
Nick Terrell
b2092c6dc4
[ldm] Reset loadedDictEnd when the context is reset
2020-05-18 12:35:44 -07:00
Nick Terrell
add7ed2d4a
[lib] Fix bug in loading LDM dictionary in MT mode
...
Exposed when loading a dictionary < LDM minMatch bytes in MT mode.
Test Plan:
```
CC=clang make -j zstreamtest MOREFLAGS="-O0 -fsanitize=address"
./zstreamtest -vv -i100000000 -t1 --newapi -s7065 -t3925297
```
TODO: Add an explicit test that loads a small dictionary in MT mode
2020-05-14 11:52:28 -07:00
W. Felix Handte
3bb7992350
Fix Size Estimate for LDM Seq Space
2020-05-14 13:50:53 -04:00
Nick Terrell
70c80e19e6
[greedy] Fix performance instability
2020-05-12 17:51:16 -07:00
Nick Terrell
c3e921c639
Merge pull request #2131 from terrelln/raw-dict-fuzzer
...
Fix rare scenario with lazy parser, dictionary, and repcodes
2020-05-12 17:44:31 -07:00
W. Felix Handte
d9a1e37aec
Nit: Fix Size Type for 32-bit
2020-05-12 18:03:31 -04:00
Nick Terrell
f800e72a3c
[lib] Fix assertion when dictionary is prefix
2020-05-12 14:33:59 -07:00
W. Felix Handte
1aa6c7ccce
Assert We Allocated Approximately What We Expected To
2020-05-12 16:55:03 -04:00
W. Felix Handte
27e2482217
Minor Refactor
2020-05-12 16:55:03 -04:00
W. Felix Handte
afc2488973
Handle Non-Static CCtxes in Estimation
2020-05-12 16:54:33 -04:00
W. Felix Handte
7ed996f5a0
Consolidate CCtx Size Estimation Code
...
This commit pulls out the internals of `ZSTD_estimateCCtxSize_usingCCtxParams`
into a helper. It then migrates two other callsites to use that helper,
a small optimization for `ZSTD_estimateCStreamSize_usingCCtxParams`, which
folds the buffer sizing into the helper, and then `ZSTD_resetCCtx_internal`,
which is more invasive.
This attempts to guarantee that the estimates returned to users are always
correct.
2020-05-12 16:26:53 -04:00
Nick Terrell
3c1eba4d99
[lib] Fix lazy repcode validity checks
2020-05-12 12:25:06 -07:00
Nick Terrell
4e0515916d
[lib] Fix repcode validation in no dict mode
2020-05-12 11:57:15 -07:00
Nick Terrell
6d687a8816
[lib] Fix dictionary + repcodes + optimal parser
2020-05-12 10:36:53 -07:00
Nick Terrell
4b88bd3ee0
[lib][fuzz] Assert sequences are valid in round trip tests
2020-05-11 20:38:49 -07:00
Yann Collet
20bd246045
blindfix for VS macro redefinition
2020-05-11 19:29:36 -07:00
Yann Collet
76e726e3be
updated documentation for ZSTD_estimate*()
...
make it clearer that tighter memory estimation
can be provided using advanced functions
on the condition of a defined input size bound.
2020-05-11 19:21:50 -07:00
Nick Terrell
80d3585e31
[lib] Fix lazy parser with dictionary + repcodes
2020-05-11 19:04:30 -07:00
Yann Collet
608f1bfc4c
fixed context downsize with initStatic
...
When context is created using initStatic,
no resize is possible.
fix : only bump oversizeDuration when !initStatic
2020-05-11 18:16:38 -07:00
W. Felix Handte
c6636afbbb
Fix ZSTD_estimateCCtxSize() Under ASAN
...
`ZSTD_estimateCCtxSize()` provides estimates for one-shot compression, which
is guaranteed not to buffer inputs or outputs. So it ignores the sizes of the
buffers, assuming they'll be zero. However, the actual workspace allocation
logic always allocates those buffers, and when running under ASAN, the
workspace surrounds every allocation with 256 bytes of redzone. So the 0-sized
buffers end up consuming 512 bytes of space, which is accounted for in the
actual allocation path through the use of `ZSTD_cwksp_alloc_size()` but isn't
in the estimation path, since it ignores the buffers entirely.
This commit fixes this.
2020-05-11 18:58:19 -04:00
W. Felix Handte
87c541c5f9
Only Trigger libzstd.pc Build on Unix-Like Platforms
...
We don't even define the rule on unsupported platforms.
2020-05-08 16:11:32 -04:00
W. Felix Handte
78aa9373cb
Add libzstd.pc Build to More Aggregate Targets in Makefiles
2020-05-08 16:11:32 -04:00
W. Felix Handte
15561bcf74
Fix pkg-config File Generation Again Again
...
Resubmission of #2001 . This switches the `sed` invocations to use `-E`,
extended regex syntax, which is better standardized across platforms.
I guess.
Same test plan:
```
make -C lib clean libzstd.pc
cat lib/libzstd.pc
echo # should fail
make -C lib clean libzstd.pc LIBDIR=/foo
make -C lib clean libzstd.pc INCLUDEDIR=/foo
make -C lib clean libzstd.pc LIBDIR=/usr/localfoo
make -C lib clean libzstd.pc INCLUDEDIR=/usr/localfoo
make -C lib clean libzstd.pc LIBDIR=/usr/local/lib prefix=/foo
make -C lib clean libzstd.pc INCLUDEDIR=/usr/local/include prefix=/foo
echo # should succeed
make -C lib clean libzstd.pc LIBDIR=/usr/local/foo
make -C lib clean libzstd.pc INCLUDEDIR=/usr/local/foo
make -C lib clean libzstd.pc LIBDIR=/usr/local/
make -C lib clean libzstd.pc INCLUDEDIR=/usr/local/
make -C lib clean libzstd.pc LIBDIR=/usr/local
make -C lib clean libzstd.pc INCLUDEDIR=/usr/local
make -C lib clean libzstd.pc LIBDIR=/tmp/foo prefix=/tmp
make -C lib clean libzstd.pc INCLUDEDIR=/tmp/foo prefix=/tmp
make -C lib clean libzstd.pc LIBDIR=/tmp/foo prefix=/tmp/foo
make -C lib clean libzstd.pc INCLUDEDIR=/tmp/foo prefix=/tmp/foo
echo # should also succeed
make -C lib clean libzstd.pc prefix=/foo LIBDIR=/foo/bar INCLUDEDIR=/foo/
cat lib/libzstd.pc
mkdir out
cd out
cmake ../build/cmake
make
cat lib/libzstd.pc
```
2020-05-08 16:11:32 -04:00
Bimba Shrestha
df9e5b6f4c
adding
2020-05-07 22:07:40 -05:00
Yann Collet
efc656c9a6
Merge pull request #2114 from facebook/verbose
...
support for verbose make
2020-05-07 13:16:33 -07:00
Yann Collet
1afe57cff7
Merge pull request #2112 from facebook/cfast
...
small speed improvement for strategy fast
2020-05-07 13:13:34 -07:00
caoyzh
969ba4f2b9
Change the modification of ZSTD_wildcopy()
2020-05-07 13:10:46 -07:00
caoyzh
a7e34ff693
revert ZSTD_reduceTable_internal()'s modificatiion
2020-05-07 13:10:46 -07:00
caoyzh
9e802ede9c
Modify indent of comments
2020-05-07 13:10:46 -07:00
caoyzh
7f75f05e84
Change "arm_neon.h" to system include <arm_neon.h>
2020-05-07 13:10:46 -07:00
caoyzh
b2e56f7f7f
Optimize compression by using neon function.
2020-05-07 13:10:46 -07:00
Nick Terrell
45c66dd298
[zdict] Stabilize ZDICT_finalizeDictionary()
2020-05-07 10:37:01 -07:00
Yann Collet
cf854f4660
support for verbose make
...
A commonly accepted makefile idiom is V=1 or VERBOSE=1
to request the printing of all commands.
This is not "default" though, and must be manually added.
Example :
Before :
```
make libzstd
compiling dynamic library 1.4.5
creating versioned links
make libzstd V=1
compiling dynamic library 1.4.5
creating versioned links
```
After :
```
make libzstd
compiling dynamic library 1.4.5
creating versioned links
make libzstd V=1
compiling dynamic library 1.4.5
cc -DXXH_NAMESPACE=ZSTD_ -DZSTD_LEGACY_SUPPORT=5 -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement -Wstrict-prototypes -Wundef -Wpointer-arith -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings -Wredundant-decls -Wmissing-prototypes -Wc++-compat -O3 common/debug.c common/entropy_common.c common/error_private.c common/fse_decompress.c common/pool.c common/threading.c common/xxhash.c common/zstd_common.c compress/fse_compress.c compress/hist.c compress/huf_compress.c compress/zstd_compress.c compress/zstd_compress_literals.c compress/zstd_compress_sequences.c compress/zstd_compress_superblock.c compress/zstd_double_fast.c compress/zstd_fast.c compress/zstd_lazy.c compress/zstd_ldm.c compress/zstd_opt.c compress/zstdmt_compress.c decompress/huf_decompress.c decompress/zstd_ddict.c decompress/zstd_decompress.c decompress/zstd_decompress_block.c deprecated/zbuff_common.c deprecated/zbuff_compress.c deprecated/zbuff_decompress.c dictBuilder/cover.c dictBuilder/divsufsort.c dictBuilder/fastcover.c dictBuilder/zdict.c legacy/zstd_v05.c legacy/zstd_v06.c legacy/zstd_v07.c -shared -fPIC -fvisibility=hidden -Wl,-soname=libzstd.so.1 -o libzstd.so.1.4.5
creating versioned links
ln -sf libzstd.so.1.4.5 libzstd.so.1
ln -sf libzstd.so.1.4.5 libzstd.so
```
2020-05-07 08:04:10 -07:00
Yann Collet
54144285fd
small speed improvement for strategy fast
...
gcc 9.3.0 :
kennedy : 459 -> 466
silesia : 360 -> 365
enwik8 : 267 -> 269
clang 10.0.0 :
kennedy : 436 -> 441
silesia : 364 -> 366
enwik8 : 271 -> 272
2020-05-07 06:15:58 -07:00
Nick Terrell
5717bd39ee
[lib] Fix NULL pointer dereference
...
When the output buffer is `NULL` with size 0, but the frame content size
is non-zero, we will write to the NULL pointer because our bounds check
underflowed.
This was exposed by a recent PR that allowed an empty frame into the
single-pass shortcut in streaming mode.
* Fix the bug.
* Fix another NULL dereference in zstd-v1.
* Overflow checks in 32-bit mode.
* Add a dedicated test.
* Expose the bug in the dedicated simple_decompress fuzzer.
* Switch all mallocs in fuzzers to return NULL for size=0.
* Fix a new timeout in a fuzzer.
Neither clang nor gcc show a decompression speed regression on x86-64.
On x86-32 clang is slightly positive and gcc loses 2.5% of speed.
Credit to OSS-Fuzz.
2020-05-06 12:09:02 -07:00
Felix Handte
ad8dbae1b7
Merge pull request #2103 from felixhandte/relative-includes
...
Migrate Includes to Relative Paths
2020-05-06 09:42:23 -07:00
Yann Collet
c29fd7cd8b
some more conversion warnings
...
hunting down some static analyzer warnings
2020-05-05 10:16:59 -07:00
Yann Collet
c1b836f4c3
fix minor conversion warnings
2020-05-04 14:43:09 -07:00
Felix Handte
8b327149a8
Merge pull request #1976 from felixhandte/minimal-lib-target
...
Add Minification Variable to `lib/Makefile`
2020-05-04 12:42:56 -07:00
W. Felix Handte
7b75d772b1
Remove Useless Assignment in Makefile
2020-05-04 15:20:26 -04:00
W. Felix Handte
6028827fee
Rewrite Include Paths to be Relative
...
Addresses #1998 .
2020-05-04 15:20:26 -04:00
Felix Handte
7e9aabd652
Merge pull request #2099 from felixhandte/compile-under-pedantic
...
Compile Under `-pedantic -Werror` and `-std=c90`
2020-05-04 10:07:13 -07:00
W. Felix Handte
fa5e01c467
Add Space-Optimized Helper Variable to Lib Makefile
...
This diff reorganizes the `lib/Makefile` to extract various settings that a
user would normally invoke together (supposing that they were aware of them)
if they were trying to build the smallest `libzstd` possible. It collects
these settings under a master setting `ZSTD_LIB_MIN_SIZE`.
Also document this new option.
2020-05-04 11:19:25 -04:00
Felix Handte
816ed80774
Merge pull request #1984 from MeghnaM/1636-Reduce-stack-usage-of-HUF_sort
...
Reduce stack usage of HUF_sort()
2020-05-04 08:15:31 -07:00
W. Felix Handte
3764859060
Switch Helper Declaration to Not Force Inline
...
It was causing build issues in ANSI mode.
2020-05-04 10:59:15 -04:00
W. Felix Handte
c7da66c9cf
Purge C++-Style Comments (// ...
), Make Compilation Succeed Under C90
2020-05-04 10:59:15 -04:00
W. Felix Handte
952427aebf
Avoid inline Keyword in C90
...
Previously we would use it for all gcc-like compilations, even when a
restrictive mode that disallowed it had been selected.
2020-05-04 10:59:15 -04:00
W. Felix Handte
baa4e2e36c
Don't Evaluate Arguments to Dummy Function
2020-05-04 10:59:15 -04:00
W. Felix Handte
450542d3a7
Allow Empty Format Strings in Error Macro Invocations
...
`-Wall` implies `-Wformat-zero-length`, which will cause compilation to fail
under `-Werror` when an empty string is passed as the format string to a
`printf`-family function. This commit moves us back to prefixing the provided
format string, which successfully avoids that warning.
However, this removes the failure mode where that `RAWLOG` invocation would
fail to compile when no format string was provided at all (which was desirable
to avoid having code that would successfully compile normally but fail under
`-pedantic`, which *does* require that a non-zero number of args are provided).
So this commit also introduces a function which does nothing at all, but will
fail to compile if not provided with at least one argument, which is a string.
This successfully links the compilability of pedantic and non-pedantic builds.
2020-05-04 10:59:15 -04:00
W. Felix Handte
6696933b32
Make All Invocations Start With Literal Format String
2020-05-04 10:59:15 -04:00
W. Felix Handte
2745f7a7d5
Make Error Macro Invocation Without Info String Fail to Compile
...
Even without `-pedantic`, these macros will now fail to compile unless you
provide an info string argument. This will prevent us from regressing.
2020-05-04 10:59:15 -04:00