@@ -615,7 +615,7 @@ ZSTD_bounds ZSTD_cParam_getBounds(ZSTD_cParameter param)
615
615
bounds .upperBound = (int )ZSTD_ps_disable ;
616
616
return bounds ;
617
617
618
- case ZSTD_c_enableMatchFinderFallback :
618
+ case ZSTD_c_enableSeqProducerFallback :
619
619
bounds .lowerBound = 0 ;
620
620
bounds .upperBound = 1 ;
621
621
return bounds ;
@@ -695,7 +695,7 @@ static int ZSTD_isUpdateAuthorized(ZSTD_cParameter param)
695
695
case ZSTD_c_useRowMatchFinder :
696
696
case ZSTD_c_deterministicRefPrefix :
697
697
case ZSTD_c_prefetchCDictTables :
698
- case ZSTD_c_enableMatchFinderFallback :
698
+ case ZSTD_c_enableSeqProducerFallback :
699
699
case ZSTD_c_maxBlockSize :
700
700
case ZSTD_c_searchForExternalRepcodes :
701
701
default :
@@ -754,7 +754,7 @@ size_t ZSTD_CCtx_setParameter(ZSTD_CCtx* cctx, ZSTD_cParameter param, int value)
754
754
case ZSTD_c_useRowMatchFinder :
755
755
case ZSTD_c_deterministicRefPrefix :
756
756
case ZSTD_c_prefetchCDictTables :
757
- case ZSTD_c_enableMatchFinderFallback :
757
+ case ZSTD_c_enableSeqProducerFallback :
758
758
case ZSTD_c_maxBlockSize :
759
759
case ZSTD_c_searchForExternalRepcodes :
760
760
break ;
@@ -989,8 +989,8 @@ size_t ZSTD_CCtxParams_setParameter(ZSTD_CCtx_params* CCtxParams,
989
989
CCtxParams -> prefetchCDictTables = (ZSTD_paramSwitch_e )value ;
990
990
return CCtxParams -> prefetchCDictTables ;
991
991
992
- case ZSTD_c_enableMatchFinderFallback :
993
- BOUNDCHECK (ZSTD_c_enableMatchFinderFallback , value );
992
+ case ZSTD_c_enableSeqProducerFallback :
993
+ BOUNDCHECK (ZSTD_c_enableSeqProducerFallback , value );
994
994
CCtxParams -> enableMatchFinderFallback = value ;
995
995
return CCtxParams -> enableMatchFinderFallback ;
996
996
@@ -1140,7 +1140,7 @@ size_t ZSTD_CCtxParams_getParameter(
1140
1140
case ZSTD_c_prefetchCDictTables :
1141
1141
* value = (int )CCtxParams -> prefetchCDictTables ;
1142
1142
break ;
1143
- case ZSTD_c_enableMatchFinderFallback :
1143
+ case ZSTD_c_enableSeqProducerFallback :
1144
1144
* value = CCtxParams -> enableMatchFinderFallback ;
1145
1145
break ;
1146
1146
case ZSTD_c_maxBlockSize :
@@ -1610,8 +1610,8 @@ ZSTD_sizeof_matchState(const ZSTD_compressionParameters* const cParams,
1610
1610
1611
1611
/* Helper function for calculating memory requirements.
1612
1612
* Gives a tighter bound than ZSTD_sequenceBound() by taking minMatch into account. */
1613
- static size_t ZSTD_maxNbSeq (size_t blockSize , unsigned minMatch , int useExternalMatchFinder ) {
1614
- U32 const divider = (minMatch == 3 || useExternalMatchFinder ) ? 3 : 4 ;
1613
+ static size_t ZSTD_maxNbSeq (size_t blockSize , unsigned minMatch , int useSequenceProducer ) {
1614
+ U32 const divider = (minMatch == 3 || useSequenceProducer ) ? 3 : 4 ;
1615
1615
return blockSize / divider ;
1616
1616
}
1617
1617
@@ -1623,12 +1623,12 @@ static size_t ZSTD_estimateCCtxSize_usingCCtxParams_internal(
1623
1623
const size_t buffInSize ,
1624
1624
const size_t buffOutSize ,
1625
1625
const U64 pledgedSrcSize ,
1626
- int useExternalMatchFinder ,
1626
+ int useSequenceProducer ,
1627
1627
size_t maxBlockSize )
1628
1628
{
1629
1629
size_t const windowSize = (size_t ) BOUNDED (1ULL , 1ULL << cParams -> windowLog , pledgedSrcSize );
1630
1630
size_t const blockSize = MIN (ZSTD_resolveMaxBlockSize (maxBlockSize ), windowSize );
1631
- size_t const maxNbSeq = ZSTD_maxNbSeq (blockSize , cParams -> minMatch , useExternalMatchFinder );
1631
+ size_t const maxNbSeq = ZSTD_maxNbSeq (blockSize , cParams -> minMatch , useSequenceProducer );
1632
1632
size_t const tokenSpace = ZSTD_cwksp_alloc_size (WILDCOPY_OVERLENGTH + blockSize )
1633
1633
+ ZSTD_cwksp_aligned_alloc_size (maxNbSeq * sizeof (seqDef ))
1634
1634
+ 3 * ZSTD_cwksp_alloc_size (maxNbSeq * sizeof (BYTE ));
@@ -1648,7 +1648,7 @@ static size_t ZSTD_estimateCCtxSize_usingCCtxParams_internal(
1648
1648
size_t const cctxSpace = isStatic ? ZSTD_cwksp_alloc_size (sizeof (ZSTD_CCtx )) : 0 ;
1649
1649
1650
1650
size_t const maxNbExternalSeq = ZSTD_sequenceBound (blockSize );
1651
- size_t const externalSeqSpace = useExternalMatchFinder
1651
+ size_t const externalSeqSpace = useSequenceProducer
1652
1652
? ZSTD_cwksp_aligned_alloc_size (maxNbExternalSeq * sizeof (ZSTD_Sequence ))
1653
1653
: 0 ;
1654
1654
@@ -1679,7 +1679,7 @@ size_t ZSTD_estimateCCtxSize_usingCCtxParams(const ZSTD_CCtx_params* params)
1679
1679
* be needed. However, we still allocate two 0-sized buffers, which can
1680
1680
* take space under ASAN. */
1681
1681
return ZSTD_estimateCCtxSize_usingCCtxParams_internal (
1682
- & cParams , & params -> ldmParams , 1 , useRowMatchFinder , 0 , 0 , ZSTD_CONTENTSIZE_UNKNOWN , params -> useExternalMatchFinder , params -> maxBlockSize );
1682
+ & cParams , & params -> ldmParams , 1 , useRowMatchFinder , 0 , 0 , ZSTD_CONTENTSIZE_UNKNOWN , params -> useSequenceProducer , params -> maxBlockSize );
1683
1683
}
1684
1684
1685
1685
size_t ZSTD_estimateCCtxSize_usingCParams (ZSTD_compressionParameters cParams )
@@ -1740,7 +1740,7 @@ size_t ZSTD_estimateCStreamSize_usingCCtxParams(const ZSTD_CCtx_params* params)
1740
1740
1741
1741
return ZSTD_estimateCCtxSize_usingCCtxParams_internal (
1742
1742
& cParams , & params -> ldmParams , 1 , useRowMatchFinder , inBuffSize , outBuffSize ,
1743
- ZSTD_CONTENTSIZE_UNKNOWN , params -> useExternalMatchFinder , params -> maxBlockSize );
1743
+ ZSTD_CONTENTSIZE_UNKNOWN , params -> useSequenceProducer , params -> maxBlockSize );
1744
1744
}
1745
1745
}
1746
1746
@@ -2024,7 +2024,7 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc,
2024
2024
2025
2025
{ size_t const windowSize = MAX (1 , (size_t )MIN (((U64 )1 << params -> cParams .windowLog ), pledgedSrcSize ));
2026
2026
size_t const blockSize = MIN (params -> maxBlockSize , windowSize );
2027
- size_t const maxNbSeq = ZSTD_maxNbSeq (blockSize , params -> cParams .minMatch , params -> useExternalMatchFinder );
2027
+ size_t const maxNbSeq = ZSTD_maxNbSeq (blockSize , params -> cParams .minMatch , params -> useSequenceProducer );
2028
2028
size_t const buffOutSize = (zbuff == ZSTDb_buffered && params -> outBufferMode == ZSTD_bm_buffered )
2029
2029
? ZSTD_compressBound (blockSize ) + 1
2030
2030
: 0 ;
@@ -2041,7 +2041,7 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc,
2041
2041
size_t const neededSpace =
2042
2042
ZSTD_estimateCCtxSize_usingCCtxParams_internal (
2043
2043
& params -> cParams , & params -> ldmParams , zc -> staticSize != 0 , params -> useRowMatchFinder ,
2044
- buffInSize , buffOutSize , pledgedSrcSize , params -> useExternalMatchFinder , params -> maxBlockSize );
2044
+ buffInSize , buffOutSize , pledgedSrcSize , params -> useSequenceProducer , params -> maxBlockSize );
2045
2045
int resizeWorkspace ;
2046
2046
2047
2047
FORWARD_IF_ERROR (neededSpace , "cctx size estimate failed!" );
@@ -2155,7 +2155,7 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc,
2155
2155
}
2156
2156
2157
2157
/* reserve space for block-level external sequences */
2158
- if (params -> useExternalMatchFinder ) {
2158
+ if (params -> useSequenceProducer ) {
2159
2159
size_t const maxNbExternalSeq = ZSTD_sequenceBound (blockSize );
2160
2160
zc -> externalMatchCtx .seqBufferCapacity = maxNbExternalSeq ;
2161
2161
zc -> externalMatchCtx .seqBuffer =
@@ -3022,25 +3022,25 @@ void ZSTD_resetSeqStore(seqStore_t* ssPtr)
3022
3022
ssPtr -> longLengthType = ZSTD_llt_none ;
3023
3023
}
3024
3024
3025
- /* ZSTD_postProcessExternalMatchFinderResult () :
3025
+ /* ZSTD_postProcessSequenceProducerResult () :
3026
3026
* Validates and post-processes sequences obtained through the external matchfinder API:
3027
3027
* - Checks whether nbExternalSeqs represents an error condition.
3028
3028
* - Appends a block delimiter to outSeqs if one is not already present.
3029
3029
* See zstd.h for context regarding block delimiters.
3030
3030
* Returns the number of sequences after post-processing, or an error code. */
3031
- static size_t ZSTD_postProcessExternalMatchFinderResult (
3031
+ static size_t ZSTD_postProcessSequenceProducerResult (
3032
3032
ZSTD_Sequence * outSeqs , size_t nbExternalSeqs , size_t outSeqsCapacity , size_t srcSize
3033
3033
) {
3034
3034
RETURN_ERROR_IF (
3035
3035
nbExternalSeqs > outSeqsCapacity ,
3036
- externalMatchFinder_failed ,
3036
+ sequenceProducer_failed ,
3037
3037
"External matchfinder returned error code %lu" ,
3038
3038
(unsigned long )nbExternalSeqs
3039
3039
);
3040
3040
3041
3041
RETURN_ERROR_IF (
3042
3042
nbExternalSeqs == 0 && srcSize > 0 ,
3043
- externalMatchFinder_failed ,
3043
+ sequenceProducer_failed ,
3044
3044
"External matchfinder produced zero sequences for a non-empty src buffer!"
3045
3045
);
3046
3046
@@ -3061,7 +3061,7 @@ static size_t ZSTD_postProcessExternalMatchFinderResult(
3061
3061
* produced an invalid parse, by definition of ZSTD_sequenceBound(). */
3062
3062
RETURN_ERROR_IF (
3063
3063
nbExternalSeqs == outSeqsCapacity ,
3064
- externalMatchFinder_failed ,
3064
+ sequenceProducer_failed ,
3065
3065
"nbExternalSeqs == outSeqsCapacity but lastSeq is not a block delimiter!"
3066
3066
);
3067
3067
@@ -3139,7 +3139,7 @@ static size_t ZSTD_buildSeqStore(ZSTD_CCtx* zc, const void* src, size_t srcSize)
3139
3139
/* External matchfinder + LDM is technically possible, just not implemented yet.
3140
3140
* We need to revisit soon and implement it. */
3141
3141
RETURN_ERROR_IF (
3142
- zc -> appliedParams .useExternalMatchFinder ,
3142
+ zc -> appliedParams .useSequenceProducer ,
3143
3143
parameter_combination_unsupported ,
3144
3144
"Long-distance matching with external matchfinder enabled is not currently supported."
3145
3145
);
@@ -3158,7 +3158,7 @@ static size_t ZSTD_buildSeqStore(ZSTD_CCtx* zc, const void* src, size_t srcSize)
3158
3158
/* External matchfinder + LDM is technically possible, just not implemented yet.
3159
3159
* We need to revisit soon and implement it. */
3160
3160
RETURN_ERROR_IF (
3161
- zc -> appliedParams .useExternalMatchFinder ,
3161
+ zc -> appliedParams .useSequenceProducer ,
3162
3162
parameter_combination_unsupported ,
3163
3163
"Long-distance matching with external matchfinder enabled is not currently supported."
3164
3164
);
@@ -3177,7 +3177,7 @@ static size_t ZSTD_buildSeqStore(ZSTD_CCtx* zc, const void* src, size_t srcSize)
3177
3177
zc -> appliedParams .useRowMatchFinder ,
3178
3178
src , srcSize );
3179
3179
assert (ldmSeqStore .pos == ldmSeqStore .size );
3180
- } else if (zc -> appliedParams .useExternalMatchFinder ) {
3180
+ } else if (zc -> appliedParams .useSequenceProducer ) {
3181
3181
assert (
3182
3182
zc -> externalMatchCtx .seqBufferCapacity >= ZSTD_sequenceBound (srcSize )
3183
3183
);
@@ -3195,7 +3195,7 @@ static size_t ZSTD_buildSeqStore(ZSTD_CCtx* zc, const void* src, size_t srcSize)
3195
3195
windowSize
3196
3196
);
3197
3197
3198
- size_t const nbPostProcessedSeqs = ZSTD_postProcessExternalMatchFinderResult (
3198
+ size_t const nbPostProcessedSeqs = ZSTD_postProcessSequenceProducerResult (
3199
3199
zc -> externalMatchCtx .seqBuffer ,
3200
3200
nbExternalSeqs ,
3201
3201
zc -> externalMatchCtx .seqBufferCapacity ,
@@ -6033,7 +6033,7 @@ static size_t ZSTD_CCtx_init_compressStream2(ZSTD_CCtx* cctx,
6033
6033
#ifdef ZSTD_MULTITHREAD
6034
6034
/* If external matchfinder is enabled, make sure to fail before checking job size (for consistency) */
6035
6035
RETURN_ERROR_IF (
6036
- params .useExternalMatchFinder == 1 && params .nbWorkers >= 1 ,
6036
+ params .useSequenceProducer == 1 && params .nbWorkers >= 1 ,
6037
6037
parameter_combination_unsupported ,
6038
6038
"External matchfinder isn't supported with nbWorkers >= 1"
6039
6039
);
@@ -6251,7 +6251,7 @@ size_t ZSTD_compress2(ZSTD_CCtx* cctx,
6251
6251
*/
6252
6252
static size_t
6253
6253
ZSTD_validateSequence (U32 offCode , U32 matchLength , U32 minMatch ,
6254
- size_t posInSrc , U32 windowLog , size_t dictSize , int useExternalMatchFinder )
6254
+ size_t posInSrc , U32 windowLog , size_t dictSize , int useSequenceProducer )
6255
6255
{
6256
6256
U32 const windowSize = 1u << windowLog ;
6257
6257
/* posInSrc represents the amount of data the decoder would decode up to this point.
@@ -6260,7 +6260,7 @@ ZSTD_validateSequence(U32 offCode, U32 matchLength, U32 minMatch,
6260
6260
* window size. After output surpasses windowSize, we're limited to windowSize offsets again.
6261
6261
*/
6262
6262
size_t const offsetBound = posInSrc > windowSize ? (size_t )windowSize : posInSrc + (size_t )dictSize ;
6263
- size_t const matchLenLowerBound = (minMatch == 3 || useExternalMatchFinder ) ? 3 : 4 ;
6263
+ size_t const matchLenLowerBound = (minMatch == 3 || useSequenceProducer ) ? 3 : 4 ;
6264
6264
RETURN_ERROR_IF (offCode > OFFSET_TO_OFFBASE (offsetBound ), externalSequences_invalid , "Offset too large!" );
6265
6265
/* Validate maxNbSeq is large enough for the given matchLength and minMatch */
6266
6266
RETURN_ERROR_IF (matchLength < matchLenLowerBound , externalSequences_invalid , "Matchlength too small for the minMatch" );
@@ -6325,7 +6325,7 @@ ZSTD_copySequencesToSeqStoreExplicitBlockDelim(ZSTD_CCtx* cctx,
6325
6325
if (cctx -> appliedParams .validateSequences ) {
6326
6326
seqPos -> posInSrc += litLength + matchLength ;
6327
6327
FORWARD_IF_ERROR (ZSTD_validateSequence (offBase , matchLength , cctx -> appliedParams .cParams .minMatch , seqPos -> posInSrc ,
6328
- cctx -> appliedParams .cParams .windowLog , dictSize , cctx -> appliedParams .useExternalMatchFinder ),
6328
+ cctx -> appliedParams .cParams .windowLog , dictSize , cctx -> appliedParams .useSequenceProducer ),
6329
6329
"Sequence validation failed" );
6330
6330
}
6331
6331
RETURN_ERROR_IF (idx - seqPos -> idx >= cctx -> seqStore .maxNbSeq , externalSequences_invalid ,
@@ -6463,7 +6463,7 @@ ZSTD_copySequencesToSeqStoreNoBlockDelim(ZSTD_CCtx* cctx, ZSTD_sequencePosition*
6463
6463
if (cctx -> appliedParams .validateSequences ) {
6464
6464
seqPos -> posInSrc += litLength + matchLength ;
6465
6465
FORWARD_IF_ERROR (ZSTD_validateSequence (offBase , matchLength , cctx -> appliedParams .cParams .minMatch , seqPos -> posInSrc ,
6466
- cctx -> appliedParams .cParams .windowLog , dictSize , cctx -> appliedParams .useExternalMatchFinder ),
6466
+ cctx -> appliedParams .cParams .windowLog , dictSize , cctx -> appliedParams .useSequenceProducer ),
6467
6467
"Sequence validation failed" );
6468
6468
}
6469
6469
DEBUGLOG (6 , "Storing sequence: (of: %u, ml: %u, ll: %u)" , offBase , matchLength , litLength );
@@ -6908,9 +6908,9 @@ ZSTD_parameters ZSTD_getParams(int compressionLevel, unsigned long long srcSizeH
6908
6908
return ZSTD_getParams_internal (compressionLevel , srcSizeHint , dictSize , ZSTD_cpm_unknown );
6909
6909
}
6910
6910
6911
- void ZSTD_registerExternalMatchFinder (
6911
+ void ZSTD_registerExternalSequenceProducer (
6912
6912
ZSTD_CCtx * zc , void * mState ,
6913
- ZSTD_externalMatchFinder_F * mFinder
6913
+ ZSTD_sequenceProducer_F * mFinder
6914
6914
) {
6915
6915
if (mFinder != NULL ) {
6916
6916
ZSTD_externalMatchCtx emctx ;
@@ -6919,9 +6919,9 @@ void ZSTD_registerExternalMatchFinder(
6919
6919
emctx .seqBuffer = NULL ;
6920
6920
emctx .seqBufferCapacity = 0 ;
6921
6921
zc -> externalMatchCtx = emctx ;
6922
- zc -> requestedParams .useExternalMatchFinder = 1 ;
6922
+ zc -> requestedParams .useSequenceProducer = 1 ;
6923
6923
} else {
6924
6924
ZSTD_memset (& zc -> externalMatchCtx , 0 , sizeof (zc -> externalMatchCtx ));
6925
- zc -> requestedParams .useExternalMatchFinder = 0 ;
6925
+ zc -> requestedParams .useSequenceProducer = 0 ;
6926
6926
}
6927
6927
}
0 commit comments