Project Alice
Loading...
Searching...
No Matches
zstd_lazy.c File Reference
#include "zstd_compress_internal.h"
#include "zstd_lazy.h"
#include "../common/bits.h"
Include dependency graph for zstd_lazy.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define kLazySkippingStep   8
 
#define NEXT_IN_CHAIN(d, mask)   chainTable[(d) & (mask)]
 
#define ZSTD_ROW_HASH_TAG_MASK   ((1u << ZSTD_ROW_HASH_TAG_BITS) - 1)
 
#define ZSTD_ROW_HASH_MAX_ENTRIES   64 /* absolute maximum number of entries per row, for all configurations */
 
#define ZSTD_ROW_HASH_CACHE_MASK   (ZSTD_ROW_HASH_CACHE_SIZE - 1)
 
#define ZSTD_BT_SEARCH_FN(dictMode, mls)   ZSTD_BtFindBestMatch_##dictMode##_##mls
 
#define ZSTD_HC_SEARCH_FN(dictMode, mls)   ZSTD_HcFindBestMatch_##dictMode##_##mls
 
#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)   ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
 
#define ZSTD_SEARCH_FN_ATTRS   FORCE_NOINLINE
 
#define GEN_ZSTD_BT_SEARCH_FN(dictMode, mls)
 
#define GEN_ZSTD_HC_SEARCH_FN(dictMode, mls)
 
#define GEN_ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)
 
#define ZSTD_FOR_EACH_ROWLOG(X, dictMode, mls)
 
#define ZSTD_FOR_EACH_MLS_ROWLOG(X, dictMode)
 
#define ZSTD_FOR_EACH_MLS(X, dictMode)
 
#define ZSTD_FOR_EACH_DICT_MODE(X, ...)
 
#define GEN_ZSTD_CALL_BT_SEARCH_FN(dictMode, mls)
 
#define GEN_ZSTD_CALL_HC_SEARCH_FN(dictMode, mls)
 
#define GEN_ZSTD_CALL_ROW_SEARCH_FN(dictMode, mls, rowLog)
 
#define ZSTD_SWITCH_MLS(X, dictMode)
 
#define ZSTD_SWITCH_ROWLOG(dictMode, mls)
 
#define ZSTD_SWITCH_SEARCH_METHOD(dictMode)
 

Typedefs

typedef U64 ZSTD_VecMask
 

Enumerations

enum  searchMethod_e { search_hashChain =0 , search_binaryTree =1 , search_rowHash =2 }
 

Functions

FORCE_INLINE_TEMPLATE ZSTD_ALLOW_POINTER_OVERFLOW_ATTR size_t ZSTD_BtFindBestMatch (ZSTD_matchState_t *ms, const BYTE *const ip, const BYTE *const iLimit, size_t *offBasePtr, const U32 mls, const ZSTD_dictMode_e dictMode)
 
void ZSTD_dedicatedDictSearch_lazy_loadDictionary (ZSTD_matchState_t *ms, const BYTE *const ip)
 
FORCE_INLINE_TEMPLATE size_t ZSTD_dedicatedDictSearch_lazy_search (size_t *offsetPtr, size_t ml, U32 nbAttempts, const ZSTD_matchState_t *const dms, const BYTE *const ip, const BYTE *const iLimit, const BYTE *const prefixStart, const U32 curr, const U32 dictLimit, const size_t ddsIdx)
 
FORCE_INLINE_TEMPLATE ZSTD_ALLOW_POINTER_OVERFLOW_ATTR U32 ZSTD_insertAndFindFirstIndex_internal (ZSTD_matchState_t *ms, const ZSTD_compressionParameters *const cParams, const BYTE *ip, U32 const mls, U32 const lazySkipping)
 
U32 ZSTD_insertAndFindFirstIndex (ZSTD_matchState_t *ms, const BYTE *ip)
 
FORCE_INLINE_TEMPLATE ZSTD_ALLOW_POINTER_OVERFLOW_ATTR size_t ZSTD_HcFindBestMatch (ZSTD_matchState_t *ms, const BYTE *const ip, const BYTE *const iLimit, size_t *offsetPtr, const U32 mls, const ZSTD_dictMode_e dictMode)
 
MEM_STATIC U32 ZSTD_VecMask_next (ZSTD_VecMask val)
 
FORCE_INLINE_TEMPLATE U32 ZSTD_row_nextIndex (BYTE *const tagRow, U32 const rowMask)
 
MEM_STATIC int ZSTD_isAligned (void const *ptr, size_t align)
 
FORCE_INLINE_TEMPLATE void ZSTD_row_prefetch (U32 const *hashTable, BYTE const *tagTable, U32 const relRow, U32 const rowLog)
 
FORCE_INLINE_TEMPLATE ZSTD_ALLOW_POINTER_OVERFLOW_ATTR void ZSTD_row_fillHashCache (ZSTD_matchState_t *ms, const BYTE *base, U32 const rowLog, U32 const mls, U32 idx, const BYTE *const iLimit)
 
FORCE_INLINE_TEMPLATE ZSTD_ALLOW_POINTER_OVERFLOW_ATTR U32 ZSTD_row_nextCachedHash (U32 *cache, U32 const *hashTable, BYTE const *tagTable, BYTE const *base, U32 idx, U32 const hashLog, U32 const rowLog, U32 const mls, U64 const hashSalt)
 
FORCE_INLINE_TEMPLATE ZSTD_ALLOW_POINTER_OVERFLOW_ATTR void ZSTD_row_update_internalImpl (ZSTD_matchState_t *ms, U32 updateStartIdx, U32 const updateEndIdx, U32 const mls, U32 const rowLog, U32 const rowMask, U32 const useCache)
 
FORCE_INLINE_TEMPLATE ZSTD_ALLOW_POINTER_OVERFLOW_ATTR void ZSTD_row_update_internal (ZSTD_matchState_t *ms, const BYTE *ip, U32 const mls, U32 const rowLog, U32 const rowMask, U32 const useCache)
 
void ZSTD_row_update (ZSTD_matchState_t *const ms, const BYTE *ip)
 
FORCE_INLINE_TEMPLATE U32 ZSTD_row_matchMaskGroupWidth (const U32 rowEntries)
 
FORCE_INLINE_TEMPLATE ZSTD_VecMask ZSTD_row_getMatchMask (const BYTE *const tagRow, const BYTE tag, const U32 headGrouped, const U32 rowEntries)
 
FORCE_INLINE_TEMPLATE ZSTD_ALLOW_POINTER_OVERFLOW_ATTR size_t ZSTD_RowFindBestMatch (ZSTD_matchState_t *ms, const BYTE *const ip, const BYTE *const iLimit, size_t *offsetPtr, const U32 mls, const ZSTD_dictMode_e dictMode, const U32 rowLog)
 
FORCE_INLINE_TEMPLATE size_t ZSTD_searchMax (ZSTD_matchState_t *ms, const BYTE *ip, const BYTE *iend, size_t *offsetPtr, U32 const mls, U32 const rowLog, searchMethod_e const searchMethod, ZSTD_dictMode_e const dictMode)
 
FORCE_INLINE_TEMPLATE ZSTD_ALLOW_POINTER_OVERFLOW_ATTR size_t ZSTD_compressBlock_lazy_generic (ZSTD_matchState_t *ms, seqStore_t *seqStore, U32 rep[ZSTD_REP_NUM], const void *src, size_t srcSize, const searchMethod_e searchMethod, const U32 depth, ZSTD_dictMode_e const dictMode)
 
size_t ZSTD_compressBlock_greedy (ZSTD_matchState_t *ms, seqStore_t *seqStore, U32 rep[ZSTD_REP_NUM], void const *src, size_t srcSize)
 
size_t ZSTD_compressBlock_greedy_dictMatchState (ZSTD_matchState_t *ms, seqStore_t *seqStore, U32 rep[ZSTD_REP_NUM], void const *src, size_t srcSize)
 
size_t ZSTD_compressBlock_greedy_dedicatedDictSearch (ZSTD_matchState_t *ms, seqStore_t *seqStore, U32 rep[ZSTD_REP_NUM], void const *src, size_t srcSize)
 
size_t ZSTD_compressBlock_greedy_row (ZSTD_matchState_t *ms, seqStore_t *seqStore, U32 rep[ZSTD_REP_NUM], void const *src, size_t srcSize)
 
size_t ZSTD_compressBlock_greedy_dictMatchState_row (ZSTD_matchState_t *ms, seqStore_t *seqStore, U32 rep[ZSTD_REP_NUM], void const *src, size_t srcSize)
 
size_t ZSTD_compressBlock_greedy_dedicatedDictSearch_row (ZSTD_matchState_t *ms, seqStore_t *seqStore, U32 rep[ZSTD_REP_NUM], void const *src, size_t srcSize)
 
size_t ZSTD_compressBlock_lazy (ZSTD_matchState_t *ms, seqStore_t *seqStore, U32 rep[ZSTD_REP_NUM], void const *src, size_t srcSize)
 
size_t ZSTD_compressBlock_lazy_dictMatchState (ZSTD_matchState_t *ms, seqStore_t *seqStore, U32 rep[ZSTD_REP_NUM], void const *src, size_t srcSize)
 
size_t ZSTD_compressBlock_lazy_dedicatedDictSearch (ZSTD_matchState_t *ms, seqStore_t *seqStore, U32 rep[ZSTD_REP_NUM], void const *src, size_t srcSize)
 
size_t ZSTD_compressBlock_lazy_row (ZSTD_matchState_t *ms, seqStore_t *seqStore, U32 rep[ZSTD_REP_NUM], void const *src, size_t srcSize)
 
size_t ZSTD_compressBlock_lazy_dictMatchState_row (ZSTD_matchState_t *ms, seqStore_t *seqStore, U32 rep[ZSTD_REP_NUM], void const *src, size_t srcSize)
 
size_t ZSTD_compressBlock_lazy_dedicatedDictSearch_row (ZSTD_matchState_t *ms, seqStore_t *seqStore, U32 rep[ZSTD_REP_NUM], void const *src, size_t srcSize)
 
size_t ZSTD_compressBlock_lazy2 (ZSTD_matchState_t *ms, seqStore_t *seqStore, U32 rep[ZSTD_REP_NUM], void const *src, size_t srcSize)
 
size_t ZSTD_compressBlock_lazy2_dictMatchState (ZSTD_matchState_t *ms, seqStore_t *seqStore, U32 rep[ZSTD_REP_NUM], void const *src, size_t srcSize)
 
size_t ZSTD_compressBlock_lazy2_dedicatedDictSearch (ZSTD_matchState_t *ms, seqStore_t *seqStore, U32 rep[ZSTD_REP_NUM], void const *src, size_t srcSize)
 
size_t ZSTD_compressBlock_lazy2_row (ZSTD_matchState_t *ms, seqStore_t *seqStore, U32 rep[ZSTD_REP_NUM], void const *src, size_t srcSize)
 
size_t ZSTD_compressBlock_lazy2_dictMatchState_row (ZSTD_matchState_t *ms, seqStore_t *seqStore, U32 rep[ZSTD_REP_NUM], void const *src, size_t srcSize)
 
size_t ZSTD_compressBlock_lazy2_dedicatedDictSearch_row (ZSTD_matchState_t *ms, seqStore_t *seqStore, U32 rep[ZSTD_REP_NUM], void const *src, size_t srcSize)
 
size_t ZSTD_compressBlock_btlazy2 (ZSTD_matchState_t *ms, seqStore_t *seqStore, U32 rep[ZSTD_REP_NUM], void const *src, size_t srcSize)
 
size_t ZSTD_compressBlock_btlazy2_dictMatchState (ZSTD_matchState_t *ms, seqStore_t *seqStore, U32 rep[ZSTD_REP_NUM], void const *src, size_t srcSize)
 
FORCE_INLINE_TEMPLATE ZSTD_ALLOW_POINTER_OVERFLOW_ATTR size_t ZSTD_compressBlock_lazy_extDict_generic (ZSTD_matchState_t *ms, seqStore_t *seqStore, U32 rep[ZSTD_REP_NUM], const void *src, size_t srcSize, const searchMethod_e searchMethod, const U32 depth)
 
size_t ZSTD_compressBlock_greedy_extDict (ZSTD_matchState_t *ms, seqStore_t *seqStore, U32 rep[ZSTD_REP_NUM], void const *src, size_t srcSize)
 
size_t ZSTD_compressBlock_greedy_extDict_row (ZSTD_matchState_t *ms, seqStore_t *seqStore, U32 rep[ZSTD_REP_NUM], void const *src, size_t srcSize)
 
size_t ZSTD_compressBlock_lazy_extDict (ZSTD_matchState_t *ms, seqStore_t *seqStore, U32 rep[ZSTD_REP_NUM], void const *src, size_t srcSize)
 
size_t ZSTD_compressBlock_lazy_extDict_row (ZSTD_matchState_t *ms, seqStore_t *seqStore, U32 rep[ZSTD_REP_NUM], void const *src, size_t srcSize)
 
size_t ZSTD_compressBlock_lazy2_extDict (ZSTD_matchState_t *ms, seqStore_t *seqStore, U32 rep[ZSTD_REP_NUM], void const *src, size_t srcSize)
 
size_t ZSTD_compressBlock_lazy2_extDict_row (ZSTD_matchState_t *ms, seqStore_t *seqStore, U32 rep[ZSTD_REP_NUM], void const *src, size_t srcSize)
 
size_t ZSTD_compressBlock_btlazy2_extDict (ZSTD_matchState_t *ms, seqStore_t *seqStore, U32 rep[ZSTD_REP_NUM], void const *src, size_t srcSize)
 

Macro Definition Documentation

◆ GEN_ZSTD_BT_SEARCH_FN

#define GEN_ZSTD_BT_SEARCH_FN (   dictMode,
  mls 
)
Value:
ZSTD_SEARCH_FN_ATTRS size_t ZSTD_BT_SEARCH_FN(dictMode, mls)( \
const BYTE* ip, const BYTE* const iLimit, \
size_t* offBasePtr) \
{ \
assert(MAX(4, MIN(6, ms->cParams.minMatch)) == mls); \
return ZSTD_BtFindBestMatch(ms, ip, iLimit, offBasePtr, mls, ZSTD_##dictMode); \
} \
unsigned char BYTE
Definition: mem.h:58
#define MIN(a, b)
#define MAX(a, b)
ZSTD_compressionParameters cParams
#define ZSTD_SEARCH_FN_ATTRS
Definition: zstd_lazy.c:1363
#define ZSTD_BT_SEARCH_FN(dictMode, mls)
Definition: zstd_lazy.c:1359
FORCE_INLINE_TEMPLATE ZSTD_ALLOW_POINTER_OVERFLOW_ATTR size_t ZSTD_BtFindBestMatch(ZSTD_matchState_t *ms, const BYTE *const ip, const BYTE *const iLimit, size_t *offBasePtr, const U32 mls, const ZSTD_dictMode_e dictMode)
Definition: zstd_lazy.c:395

Definition at line 1365 of file zstd_lazy.c.

◆ GEN_ZSTD_CALL_BT_SEARCH_FN

#define GEN_ZSTD_CALL_BT_SEARCH_FN (   dictMode,
  mls 
)
Value:
case mls: \
return ZSTD_BT_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);

Definition at line 1426 of file zstd_lazy.c.

◆ GEN_ZSTD_CALL_HC_SEARCH_FN

#define GEN_ZSTD_CALL_HC_SEARCH_FN (   dictMode,
  mls 
)
Value:
case mls: \
return ZSTD_HC_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
#define ZSTD_HC_SEARCH_FN(dictMode, mls)
Definition: zstd_lazy.c:1360

Definition at line 1429 of file zstd_lazy.c.

◆ GEN_ZSTD_CALL_ROW_SEARCH_FN

#define GEN_ZSTD_CALL_ROW_SEARCH_FN (   dictMode,
  mls,
  rowLog 
)
Value:
case rowLog: \
return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)
Definition: zstd_lazy.c:1361

Definition at line 1432 of file zstd_lazy.c.

◆ GEN_ZSTD_HC_SEARCH_FN

#define GEN_ZSTD_HC_SEARCH_FN (   dictMode,
  mls 
)
Value:
ZSTD_SEARCH_FN_ATTRS size_t ZSTD_HC_SEARCH_FN(dictMode, mls)( \
const BYTE* ip, const BYTE* const iLimit, \
size_t* offsetPtr) \
{ \
assert(MAX(4, MIN(6, ms->cParams.minMatch)) == mls); \
return ZSTD_HcFindBestMatch(ms, ip, iLimit, offsetPtr, mls, ZSTD_##dictMode); \
} \
FORCE_INLINE_TEMPLATE ZSTD_ALLOW_POINTER_OVERFLOW_ATTR size_t ZSTD_HcFindBestMatch(ZSTD_matchState_t *ms, const BYTE *const ip, const BYTE *const iLimit, size_t *offsetPtr, const U32 mls, const ZSTD_dictMode_e dictMode)
Definition: zstd_lazy.c:667

Definition at line 1375 of file zstd_lazy.c.

◆ GEN_ZSTD_ROW_SEARCH_FN

#define GEN_ZSTD_ROW_SEARCH_FN (   dictMode,
  mls,
  rowLog 
)
Value:
ZSTD_SEARCH_FN_ATTRS size_t ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)( \
const BYTE* ip, const BYTE* const iLimit, \
size_t* offsetPtr) \
{ \
assert(MAX(4, MIN(6, ms->cParams.minMatch)) == mls); \
assert(MAX(4, MIN(6, ms->cParams.searchLog)) == rowLog); \
return ZSTD_RowFindBestMatch(ms, ip, iLimit, offsetPtr, mls, ZSTD_##dictMode, rowLog); \
} \
FORCE_INLINE_TEMPLATE ZSTD_ALLOW_POINTER_OVERFLOW_ATTR size_t ZSTD_RowFindBestMatch(ZSTD_matchState_t *ms, const BYTE *const ip, const BYTE *const iLimit, size_t *offsetPtr, const U32 mls, const ZSTD_dictMode_e dictMode, const U32 rowLog)
Definition: zstd_lazy.c:1141

Definition at line 1385 of file zstd_lazy.c.

◆ kLazySkippingStep

#define kLazySkippingStep   8

Definition at line 20 of file zstd_lazy.c.

◆ NEXT_IN_CHAIN

#define NEXT_IN_CHAIN (   d,
  mask 
)    chainTable[(d) & (mask)]

Definition at line 626 of file zstd_lazy.c.

◆ ZSTD_BT_SEARCH_FN

#define ZSTD_BT_SEARCH_FN (   dictMode,
  mls 
)    ZSTD_BtFindBestMatch_##dictMode##_##mls

Generate search functions templated on (dictMode, mls, rowLog). These functions are outlined for code size & compilation time. ZSTD_searchMax() dispatches to the correct implementation function.

TODO: The start of the search function involves loading and calculating a bunch of constants from the ZSTD_matchState_t. These computations could be done in an initialization function, and saved somewhere in the match state. Then we could pass a pointer to the saved state instead of the match state, and avoid duplicate computations.

TODO: Move the match re-winding into searchMax. This improves compression ratio, and unlocks further simplifications with the next TODO.

TODO: Try moving the repcode search into searchMax. After the re-winding and repcode search are in searchMax, there is no more logic in the match finder loop that requires knowledge about the dictMode. So we should be able to avoid force inlining it, and we can join the extDict loop with the single segment loop. It should go in searchMax instead of its own function to avoid having multiple virtual function calls per search.

Definition at line 1359 of file zstd_lazy.c.

◆ ZSTD_FOR_EACH_DICT_MODE

#define ZSTD_FOR_EACH_DICT_MODE (   X,
  ... 
)
Value:
X(__VA_ARGS__, noDict) \
X(__VA_ARGS__, extDict) \
X(__VA_ARGS__, dictMatchState) \
X(__VA_ARGS__, dedicatedDictSearch)
#define X(name, r, bit)
Definition: cpu.h:146

Definition at line 1411 of file zstd_lazy.c.

◆ ZSTD_FOR_EACH_MLS

#define ZSTD_FOR_EACH_MLS (   X,
  dictMode 
)
Value:
X(dictMode, 4) \
X(dictMode, 5) \
X(dictMode, 6)

Definition at line 1406 of file zstd_lazy.c.

◆ ZSTD_FOR_EACH_MLS_ROWLOG

#define ZSTD_FOR_EACH_MLS_ROWLOG (   X,
  dictMode 
)
Value:
ZSTD_FOR_EACH_ROWLOG(X, dictMode, 4) \
ZSTD_FOR_EACH_ROWLOG(X, dictMode, 5) \
ZSTD_FOR_EACH_ROWLOG(X, dictMode, 6)
#define ZSTD_FOR_EACH_ROWLOG(X, dictMode, mls)
Definition: zstd_lazy.c:1396

Definition at line 1401 of file zstd_lazy.c.

◆ ZSTD_FOR_EACH_ROWLOG

#define ZSTD_FOR_EACH_ROWLOG (   X,
  dictMode,
  mls 
)
Value:
X(dictMode, mls, 4) \
X(dictMode, mls, 5) \
X(dictMode, mls, 6)

Definition at line 1396 of file zstd_lazy.c.

◆ ZSTD_HC_SEARCH_FN

#define ZSTD_HC_SEARCH_FN (   dictMode,
  mls 
)    ZSTD_HcFindBestMatch_##dictMode##_##mls

Definition at line 1360 of file zstd_lazy.c.

◆ ZSTD_ROW_HASH_CACHE_MASK

#define ZSTD_ROW_HASH_CACHE_MASK   (ZSTD_ROW_HASH_CACHE_SIZE - 1)

Definition at line 782 of file zstd_lazy.c.

◆ ZSTD_ROW_HASH_MAX_ENTRIES

#define ZSTD_ROW_HASH_MAX_ENTRIES   64 /* absolute maximum number of entries per row, for all configurations */

Definition at line 780 of file zstd_lazy.c.

◆ ZSTD_ROW_HASH_TAG_MASK

#define ZSTD_ROW_HASH_TAG_MASK   ((1u << ZSTD_ROW_HASH_TAG_BITS) - 1)

Definition at line 779 of file zstd_lazy.c.

◆ ZSTD_ROW_SEARCH_FN

#define ZSTD_ROW_SEARCH_FN (   dictMode,
  mls,
  rowLog 
)    ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog

Definition at line 1361 of file zstd_lazy.c.

◆ ZSTD_SEARCH_FN_ATTRS

#define ZSTD_SEARCH_FN_ATTRS   FORCE_NOINLINE

Definition at line 1363 of file zstd_lazy.c.

◆ ZSTD_SWITCH_MLS

#define ZSTD_SWITCH_MLS (   X,
  dictMode 
)
Value:
switch (mls) { \
ZSTD_FOR_EACH_MLS(X, dictMode) \
}

Definition at line 1436 of file zstd_lazy.c.

◆ ZSTD_SWITCH_ROWLOG

#define ZSTD_SWITCH_ROWLOG (   dictMode,
  mls 
)
Value:
case mls: \
switch (rowLog) { \
ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
} \
break;
#define ZSTD_UNREACHABLE
Definition: compiler.h:195
#define GEN_ZSTD_CALL_ROW_SEARCH_FN(dictMode, mls, rowLog)
Definition: zstd_lazy.c:1432

Definition at line 1441 of file zstd_lazy.c.

◆ ZSTD_SWITCH_SEARCH_METHOD

#define ZSTD_SWITCH_SEARCH_METHOD (   dictMode)
Value:
switch (searchMethod) { \
ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_HC_SEARCH_FN, dictMode) \
break; \
ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_BT_SEARCH_FN, dictMode) \
break; \
ZSTD_SWITCH_MLS(ZSTD_SWITCH_ROWLOG, dictMode) \
break; \
} \
@ search_hashChain
Definition: zstd_lazy.c:1424
@ search_rowHash
Definition: zstd_lazy.c:1424
@ search_binaryTree
Definition: zstd_lazy.c:1424
#define GEN_ZSTD_CALL_HC_SEARCH_FN(dictMode, mls)
Definition: zstd_lazy.c:1429
#define GEN_ZSTD_CALL_BT_SEARCH_FN(dictMode, mls)
Definition: zstd_lazy.c:1426
#define ZSTD_SWITCH_ROWLOG(dictMode, mls)
Definition: zstd_lazy.c:1441

Definition at line 1449 of file zstd_lazy.c.

Typedef Documentation

◆ ZSTD_VecMask

typedef U64 ZSTD_VecMask

Definition at line 784 of file zstd_lazy.c.

Enumeration Type Documentation

◆ searchMethod_e

Enumerator
search_hashChain 
search_binaryTree 
search_rowHash 

Definition at line 1424 of file zstd_lazy.c.

Function Documentation

◆ ZSTD_BtFindBestMatch()

FORCE_INLINE_TEMPLATE ZSTD_ALLOW_POINTER_OVERFLOW_ATTR size_t ZSTD_BtFindBestMatch ( ZSTD_matchState_t ms,
const BYTE *const  ip,
const BYTE *const  iLimit,
size_t *  offBasePtr,
const U32  mls,
const ZSTD_dictMode_e  dictMode 
)

ZSTD_BtFindBestMatch() : Tree updater, providing best match

Definition at line 395 of file zstd_lazy.c.

◆ ZSTD_compressBlock_btlazy2()

size_t ZSTD_compressBlock_btlazy2 ( ZSTD_matchState_t ms,
seqStore_t seqStore,
U32  rep[ZSTD_REP_NUM],
void const *  src,
size_t  srcSize 
)

Definition at line 1916 of file zstd_lazy.c.

Here is the call graph for this function:

◆ ZSTD_compressBlock_btlazy2_dictMatchState()

size_t ZSTD_compressBlock_btlazy2_dictMatchState ( ZSTD_matchState_t ms,
seqStore_t seqStore,
U32  rep[ZSTD_REP_NUM],
void const *  src,
size_t  srcSize 
)

Definition at line 1923 of file zstd_lazy.c.

Here is the call graph for this function:

◆ ZSTD_compressBlock_btlazy2_extDict()

size_t ZSTD_compressBlock_btlazy2_extDict ( ZSTD_matchState_t ms,
seqStore_t seqStore,
U32  rep[ZSTD_REP_NUM],
void const *  src,
size_t  srcSize 
)

Definition at line 2192 of file zstd_lazy.c.

Here is the call graph for this function:

◆ ZSTD_compressBlock_greedy()

size_t ZSTD_compressBlock_greedy ( ZSTD_matchState_t ms,
seqStore_t seqStore,
U32  rep[ZSTD_REP_NUM],
void const *  src,
size_t  srcSize 
)

used in ZSTD_reduceIndex(). preemptively increase value of ZSTD_DUBT_UNSORTED_MARK

Definition at line 1784 of file zstd_lazy.c.

Here is the call graph for this function:

◆ ZSTD_compressBlock_greedy_dedicatedDictSearch()

size_t ZSTD_compressBlock_greedy_dedicatedDictSearch ( ZSTD_matchState_t ms,
seqStore_t seqStore,
U32  rep[ZSTD_REP_NUM],
void const *  src,
size_t  srcSize 
)

Definition at line 1798 of file zstd_lazy.c.

Here is the call graph for this function:

◆ ZSTD_compressBlock_greedy_dedicatedDictSearch_row()

size_t ZSTD_compressBlock_greedy_dedicatedDictSearch_row ( ZSTD_matchState_t ms,
seqStore_t seqStore,
U32  rep[ZSTD_REP_NUM],
void const *  src,
size_t  srcSize 
)

Definition at line 1819 of file zstd_lazy.c.

Here is the call graph for this function:

◆ ZSTD_compressBlock_greedy_dictMatchState()

size_t ZSTD_compressBlock_greedy_dictMatchState ( ZSTD_matchState_t ms,
seqStore_t seqStore,
U32  rep[ZSTD_REP_NUM],
void const *  src,
size_t  srcSize 
)

Definition at line 1791 of file zstd_lazy.c.

Here is the call graph for this function:

◆ ZSTD_compressBlock_greedy_dictMatchState_row()

size_t ZSTD_compressBlock_greedy_dictMatchState_row ( ZSTD_matchState_t ms,
seqStore_t seqStore,
U32  rep[ZSTD_REP_NUM],
void const *  src,
size_t  srcSize 
)

Definition at line 1812 of file zstd_lazy.c.

Here is the call graph for this function:

◆ ZSTD_compressBlock_greedy_extDict()

size_t ZSTD_compressBlock_greedy_extDict ( ZSTD_matchState_t ms,
seqStore_t seqStore,
U32  rep[ZSTD_REP_NUM],
void const *  src,
size_t  srcSize 
)

Definition at line 2141 of file zstd_lazy.c.

Here is the call graph for this function:

◆ ZSTD_compressBlock_greedy_extDict_row()

size_t ZSTD_compressBlock_greedy_extDict_row ( ZSTD_matchState_t ms,
seqStore_t seqStore,
U32  rep[ZSTD_REP_NUM],
void const *  src,
size_t  srcSize 
)

Definition at line 2148 of file zstd_lazy.c.

Here is the call graph for this function:

◆ ZSTD_compressBlock_greedy_row()

size_t ZSTD_compressBlock_greedy_row ( ZSTD_matchState_t ms,
seqStore_t seqStore,
U32  rep[ZSTD_REP_NUM],
void const *  src,
size_t  srcSize 
)

Definition at line 1805 of file zstd_lazy.c.

Here is the call graph for this function:

◆ ZSTD_compressBlock_lazy()

size_t ZSTD_compressBlock_lazy ( ZSTD_matchState_t ms,
seqStore_t seqStore,
U32  rep[ZSTD_REP_NUM],
void const *  src,
size_t  srcSize 
)

Definition at line 1828 of file zstd_lazy.c.

Here is the call graph for this function:

◆ ZSTD_compressBlock_lazy2()

size_t ZSTD_compressBlock_lazy2 ( ZSTD_matchState_t ms,
seqStore_t seqStore,
U32  rep[ZSTD_REP_NUM],
void const *  src,
size_t  srcSize 
)

Definition at line 1872 of file zstd_lazy.c.

Here is the call graph for this function:

◆ ZSTD_compressBlock_lazy2_dedicatedDictSearch()

size_t ZSTD_compressBlock_lazy2_dedicatedDictSearch ( ZSTD_matchState_t ms,
seqStore_t seqStore,
U32  rep[ZSTD_REP_NUM],
void const *  src,
size_t  srcSize 
)

Definition at line 1886 of file zstd_lazy.c.

Here is the call graph for this function:

◆ ZSTD_compressBlock_lazy2_dedicatedDictSearch_row()

size_t ZSTD_compressBlock_lazy2_dedicatedDictSearch_row ( ZSTD_matchState_t ms,
seqStore_t seqStore,
U32  rep[ZSTD_REP_NUM],
void const *  src,
size_t  srcSize 
)

Definition at line 1907 of file zstd_lazy.c.

Here is the call graph for this function:

◆ ZSTD_compressBlock_lazy2_dictMatchState()

size_t ZSTD_compressBlock_lazy2_dictMatchState ( ZSTD_matchState_t ms,
seqStore_t seqStore,
U32  rep[ZSTD_REP_NUM],
void const *  src,
size_t  srcSize 
)

Definition at line 1879 of file zstd_lazy.c.

Here is the call graph for this function:

◆ ZSTD_compressBlock_lazy2_dictMatchState_row()

size_t ZSTD_compressBlock_lazy2_dictMatchState_row ( ZSTD_matchState_t ms,
seqStore_t seqStore,
U32  rep[ZSTD_REP_NUM],
void const *  src,
size_t  srcSize 
)

Definition at line 1900 of file zstd_lazy.c.

Here is the call graph for this function:

◆ ZSTD_compressBlock_lazy2_extDict()

size_t ZSTD_compressBlock_lazy2_extDict ( ZSTD_matchState_t ms,
seqStore_t seqStore,
U32  rep[ZSTD_REP_NUM],
void const *  src,
size_t  srcSize 
)

Definition at line 2175 of file zstd_lazy.c.

Here is the call graph for this function:

◆ ZSTD_compressBlock_lazy2_extDict_row()

size_t ZSTD_compressBlock_lazy2_extDict_row ( ZSTD_matchState_t ms,
seqStore_t seqStore,
U32  rep[ZSTD_REP_NUM],
void const *  src,
size_t  srcSize 
)

Definition at line 2183 of file zstd_lazy.c.

Here is the call graph for this function:

◆ ZSTD_compressBlock_lazy2_row()

size_t ZSTD_compressBlock_lazy2_row ( ZSTD_matchState_t ms,
seqStore_t seqStore,
U32  rep[ZSTD_REP_NUM],
void const *  src,
size_t  srcSize 
)

Definition at line 1893 of file zstd_lazy.c.

Here is the call graph for this function:

◆ ZSTD_compressBlock_lazy_dedicatedDictSearch()

size_t ZSTD_compressBlock_lazy_dedicatedDictSearch ( ZSTD_matchState_t ms,
seqStore_t seqStore,
U32  rep[ZSTD_REP_NUM],
void const *  src,
size_t  srcSize 
)

Definition at line 1842 of file zstd_lazy.c.

Here is the call graph for this function:

◆ ZSTD_compressBlock_lazy_dedicatedDictSearch_row()

size_t ZSTD_compressBlock_lazy_dedicatedDictSearch_row ( ZSTD_matchState_t ms,
seqStore_t seqStore,
U32  rep[ZSTD_REP_NUM],
void const *  src,
size_t  srcSize 
)

Definition at line 1863 of file zstd_lazy.c.

Here is the call graph for this function:

◆ ZSTD_compressBlock_lazy_dictMatchState()

size_t ZSTD_compressBlock_lazy_dictMatchState ( ZSTD_matchState_t ms,
seqStore_t seqStore,
U32  rep[ZSTD_REP_NUM],
void const *  src,
size_t  srcSize 
)

Definition at line 1835 of file zstd_lazy.c.

Here is the call graph for this function:

◆ ZSTD_compressBlock_lazy_dictMatchState_row()

size_t ZSTD_compressBlock_lazy_dictMatchState_row ( ZSTD_matchState_t ms,
seqStore_t seqStore,
U32  rep[ZSTD_REP_NUM],
void const *  src,
size_t  srcSize 
)

Definition at line 1856 of file zstd_lazy.c.

Here is the call graph for this function:

◆ ZSTD_compressBlock_lazy_extDict()

size_t ZSTD_compressBlock_lazy_extDict ( ZSTD_matchState_t ms,
seqStore_t seqStore,
U32  rep[ZSTD_REP_NUM],
void const *  src,
size_t  srcSize 
)

Definition at line 2157 of file zstd_lazy.c.

Here is the call graph for this function:

◆ ZSTD_compressBlock_lazy_extDict_generic()

FORCE_INLINE_TEMPLATE ZSTD_ALLOW_POINTER_OVERFLOW_ATTR size_t ZSTD_compressBlock_lazy_extDict_generic ( ZSTD_matchState_t ms,
seqStore_t seqStore,
U32  rep[ZSTD_REP_NUM],
const void *  src,
size_t  srcSize,
const searchMethod_e  searchMethod,
const U32  depth 
)

Definition at line 1937 of file zstd_lazy.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ZSTD_compressBlock_lazy_extDict_row()

size_t ZSTD_compressBlock_lazy_extDict_row ( ZSTD_matchState_t ms,
seqStore_t seqStore,
U32  rep[ZSTD_REP_NUM],
void const *  src,
size_t  srcSize 
)

Definition at line 2165 of file zstd_lazy.c.

Here is the call graph for this function:

◆ ZSTD_compressBlock_lazy_generic()

FORCE_INLINE_TEMPLATE ZSTD_ALLOW_POINTER_OVERFLOW_ATTR size_t ZSTD_compressBlock_lazy_generic ( ZSTD_matchState_t ms,
seqStore_t seqStore,
U32  rep[ZSTD_REP_NUM],
const void *  src,
size_t  srcSize,
const searchMethod_e  searchMethod,
const U32  depth,
ZSTD_dictMode_e const  dictMode 
)

Definition at line 1516 of file zstd_lazy.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ZSTD_compressBlock_lazy_row()

size_t ZSTD_compressBlock_lazy_row ( ZSTD_matchState_t ms,
seqStore_t seqStore,
U32  rep[ZSTD_REP_NUM],
void const *  src,
size_t  srcSize 
)

Definition at line 1849 of file zstd_lazy.c.

Here is the call graph for this function:

◆ ZSTD_dedicatedDictSearch_lazy_loadDictionary()

void ZSTD_dedicatedDictSearch_lazy_loadDictionary ( ZSTD_matchState_t ms,
const BYTE *const  ip 
)

Definition at line 411 of file zstd_lazy.c.

Here is the call graph for this function:

◆ ZSTD_dedicatedDictSearch_lazy_search()

FORCE_INLINE_TEMPLATE size_t ZSTD_dedicatedDictSearch_lazy_search ( size_t *  offsetPtr,
size_t  ml,
U32  nbAttempts,
const ZSTD_matchState_t *const  dms,
const BYTE *const  ip,
const BYTE *const  iLimit,
const BYTE *const  prefixStart,
const U32  curr,
const U32  dictLimit,
const size_t  ddsIdx 
)

Definition at line 529 of file zstd_lazy.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ZSTD_HcFindBestMatch()

FORCE_INLINE_TEMPLATE ZSTD_ALLOW_POINTER_OVERFLOW_ATTR size_t ZSTD_HcFindBestMatch ( ZSTD_matchState_t ms,
const BYTE *const  ip,
const BYTE *const  iLimit,
size_t *  offsetPtr,
const U32  mls,
const ZSTD_dictMode_e  dictMode 
)

Definition at line 667 of file zstd_lazy.c.

Here is the call graph for this function:

◆ ZSTD_insertAndFindFirstIndex()

U32 ZSTD_insertAndFindFirstIndex ( ZSTD_matchState_t ms,
const BYTE ip 
)

Definition at line 659 of file zstd_lazy.c.

Here is the call graph for this function:

◆ ZSTD_insertAndFindFirstIndex_internal()

FORCE_INLINE_TEMPLATE ZSTD_ALLOW_POINTER_OVERFLOW_ATTR U32 ZSTD_insertAndFindFirstIndex_internal ( ZSTD_matchState_t ms,
const ZSTD_compressionParameters *const  cParams,
const BYTE ip,
U32 const  mls,
U32 const  lazySkipping 
)

Definition at line 632 of file zstd_lazy.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ZSTD_isAligned()

MEM_STATIC int ZSTD_isAligned ( void const *  ptr,
size_t  align 
)

Definition at line 808 of file zstd_lazy.c.

Here is the caller graph for this function:

◆ ZSTD_row_fillHashCache()

FORCE_INLINE_TEMPLATE ZSTD_ALLOW_POINTER_OVERFLOW_ATTR void ZSTD_row_fillHashCache ( ZSTD_matchState_t ms,
const BYTE base,
U32 const  rowLog,
U32 const  mls,
U32  idx,
const BYTE *const  iLimit 
)

Definition at line 837 of file zstd_lazy.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ZSTD_row_getMatchMask()

FORCE_INLINE_TEMPLATE ZSTD_VecMask ZSTD_row_getMatchMask ( const BYTE *const  tagRow,
const BYTE  tag,
const U32  headGrouped,
const U32  rowEntries 
)

Definition at line 1061 of file zstd_lazy.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ZSTD_row_matchMaskGroupWidth()

FORCE_INLINE_TEMPLATE U32 ZSTD_row_matchMaskGroupWidth ( const U32  rowEntries)

Definition at line 963 of file zstd_lazy.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ZSTD_row_nextCachedHash()

FORCE_INLINE_TEMPLATE ZSTD_ALLOW_POINTER_OVERFLOW_ATTR U32 ZSTD_row_nextCachedHash ( U32 cache,
U32 const *  hashTable,
BYTE const *  tagTable,
BYTE const *  base,
U32  idx,
U32 const  hashLog,
U32 const  rowLog,
U32 const  mls,
U64 const  hashSalt 
)

Definition at line 865 of file zstd_lazy.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ZSTD_row_nextIndex()

FORCE_INLINE_TEMPLATE U32 ZSTD_row_nextIndex ( BYTE *const  tagRow,
U32 const  rowMask 
)

Definition at line 798 of file zstd_lazy.c.

Here is the caller graph for this function:

◆ ZSTD_row_prefetch()

FORCE_INLINE_TEMPLATE void ZSTD_row_prefetch ( U32 const *  hashTable,
BYTE const *  tagTable,
U32 const  relRow,
U32 const  rowLog 
)

Definition at line 816 of file zstd_lazy.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ZSTD_row_update()

void ZSTD_row_update ( ZSTD_matchState_t *const  ms,
const BYTE ip 
)

Definition at line 949 of file zstd_lazy.c.

Here is the call graph for this function:

◆ ZSTD_row_update_internal()

FORCE_INLINE_TEMPLATE ZSTD_ALLOW_POINTER_OVERFLOW_ATTR void ZSTD_row_update_internal ( ZSTD_matchState_t ms,
const BYTE ip,
U32 const  mls,
U32 const  rowLog,
U32 const  rowMask,
U32 const  useCache 
)

Definition at line 916 of file zstd_lazy.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ZSTD_row_update_internalImpl()

FORCE_INLINE_TEMPLATE ZSTD_ALLOW_POINTER_OVERFLOW_ATTR void ZSTD_row_update_internalImpl ( ZSTD_matchState_t ms,
U32  updateStartIdx,
U32 const  updateEndIdx,
U32 const  mls,
U32 const  rowLog,
U32 const  rowMask,
U32 const  useCache 
)

Definition at line 885 of file zstd_lazy.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ZSTD_RowFindBestMatch()

FORCE_INLINE_TEMPLATE ZSTD_ALLOW_POINTER_OVERFLOW_ATTR size_t ZSTD_RowFindBestMatch ( ZSTD_matchState_t ms,
const BYTE *const  ip,
const BYTE *const  iLimit,
size_t *  offsetPtr,
const U32  mls,
const ZSTD_dictMode_e  dictMode,
const U32  rowLog 
)

Definition at line 1141 of file zstd_lazy.c.

Here is the call graph for this function:

◆ ZSTD_searchMax()

FORCE_INLINE_TEMPLATE size_t ZSTD_searchMax ( ZSTD_matchState_t ms,
const BYTE ip,
const BYTE iend,
size_t *  offsetPtr,
U32 const  mls,
U32 const  rowLog,
searchMethod_e const  searchMethod,
ZSTD_dictMode_e const  dictMode 
)

Searches for the longest match at ip. Dispatches to the correct implementation function based on the (searchMethod, dictMode, mls, rowLog). We use switch statements here instead of using an indirect function call through a function pointer because after Spectre and Meltdown mitigations, indirect function calls can be very costly, especially in the kernel.

NOTE: dictMode and searchMethod should be templated, so those switch statements should be optimized out. Only the mls & rowLog switches should be left.

Parameters
msThe match state.
ipThe position to search at.
iendThe end of the input data.
[out]offsetPtrStores the match offset into this pointer.
mlsThe minimum search length, in the range [4, 6].
rowLogThe row log (if applicable), in the range [4, 6].
searchMethodThe search method to use (templated).
dictModeThe dictMode (templated).
Returns
The length of the longest match found, or < mls if no match is found. If a match is found its offset is stored in offsetPtr.

Definition at line 1487 of file zstd_lazy.c.

Here is the caller graph for this function:

◆ ZSTD_VecMask_next()

MEM_STATIC U32 ZSTD_VecMask_next ( ZSTD_VecMask  val)

Definition at line 790 of file zstd_lazy.c.

Here is the call graph for this function:
Here is the caller graph for this function: