]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Nits 3177/head
authorElliot Gorokhovsky <embg@fb.com>
Thu, 23 Jun 2022 20:58:03 +0000 (16:58 -0400)
committerElliot Gorokhovsky <embg@fb.com>
Thu, 23 Jun 2022 20:59:21 +0000 (16:59 -0400)
lib/compress/zstd_compress.c
lib/compress/zstd_compress_internal.h
lib/compress/zstd_double_fast.c
lib/compress/zstd_fast.c

index f8ca7d35e9c0ddafd343e9aec830c56481d3e3b7..b1f9bba8a9dbfebaa59fd2128de8ec362b2cf797 100644 (file)
@@ -1943,6 +1943,7 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc,
 
         /* init params */
         zc->blockState.matchState.cParams = params->cParams;
+        zc->blockState.matchState.prefetchCDictTables = params->prefetchCDictTables == ZSTD_ps_enable;
         zc->pledgedSrcSizePlusOne = pledgedSrcSize+1;
         zc->consumedSrcSize = 0;
         zc->producedCSize = 0;
@@ -2928,7 +2929,6 @@ static size_t ZSTD_buildSeqStore(ZSTD_CCtx* zc, const void* src, size_t srcSize)
                                                                                     zc->appliedParams.useRowMatchFinder,
                                                                                     dictMode);
             ms->ldmSeqStore = NULL;
-            ms->prefetchCDictTables = zc->appliedParams.prefetchCDictTables == ZSTD_ps_enable;
             lastLLSize = blockCompressor(ms, &zc->seqStore, zc->blockState.nextCBlock->rep, src, srcSize);
         }
         {   const BYTE* const lastLiterals = (const BYTE*)src + srcSize - lastLLSize;
index 8c73007c8d59dcc9e80160635b5f146b5afc6124..4771b15ba6c20461fd3c1397790a6df2dc202a40 100644 (file)
@@ -235,7 +235,11 @@ struct ZSTD_matchState_t {
     const ZSTD_matchState_t* dictMatchState;
     ZSTD_compressionParameters cParams;
     const rawSeqStore_t* ldmSeqStore;
-    int prefetchCDictTables;  /* Controls prefetching in some dictMatchState matchfinders */
+
+    /* Controls prefetching in some dictMatchState matchfinders.
+     * This behavior is controlled from the cctx ms.
+     * This parameter has no effect in the cdict ms. */
+    int prefetchCDictTables;
 };
 
 typedef struct {
index a69fdc8182afc9f2a5cc9529bd0f411f5991695e..c2dbd54c1279376a2f8e0e9a414f4088c62cb1c0 100644 (file)
@@ -346,10 +346,10 @@ size_t ZSTD_compressBlock_doubleFast_dictMatchState_generic(
     assert(ms->window.dictLimit + (1U << cParams->windowLog) >= endIndex);
 
     if (ms->prefetchCDictTables) {
-        size_t const hashTableSize = ((size_t)1) << dictCParams->hashLog;
-        size_t const chainTableSize = ((size_t)1) << dictCParams->chainLog;
-        PREFETCH_AREA(dictHashLong, hashTableSize * sizeof(U32))
-        PREFETCH_AREA(dictHashSmall, chainTableSize * sizeof(U32))
+        size_t const hashTableBytes = (((size_t)1) << dictCParams->hashLog) * sizeof(U32);
+        size_t const chainTableBytes = (((size_t)1) << dictCParams->chainLog) * sizeof(U32);
+        PREFETCH_AREA(dictHashLong, hashTableBytes)
+        PREFETCH_AREA(dictHashSmall, chainTableBytes)
     }
 
     /* init */
index a44057988b88b0f1d83a3a02d8897b7653dbb0c1..291173449bb5aada9e5b46da37880d75ee1c8c09 100644 (file)
@@ -501,8 +501,8 @@ size_t ZSTD_compressBlock_fast_dictMatchState_generic(
     assert(prefixStartIndex >= (U32)(dictEnd - dictBase));
 
     if (ms->prefetchCDictTables) {
-        size_t const hashTableSize = ((size_t)1) << dictCParams->hashLog;
-        PREFETCH_AREA(dictHashTable, hashTableSize * sizeof(U32))
+        size_t const hashTableBytes = (((size_t)1) << dictCParams->hashLog) * sizeof(U32);
+        PREFETCH_AREA(dictHashTable, hashTableBytes)
     }
 
     /* init */