* LICENSE file in the root directory of this source tree) and the GPLv2 (found /* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the * LICENSE file in the root directory of this source tree) and the GPLv2 (found * in the COPYING file in the root directory of this source tree). * You may select, at your option, one of the above-listed licenses.
*/
#include zstd_double_fast #includeifndef
#ifndef
static
void(*ms constend dtlm
{
ZSTD_compressionParameters = &>;
U32* const => +;
U32 =>hashLog;
U32 const mls = cParams->minMatchU32 hashSmall=ms->;
U32 =ms-;
U32 const hBitsSconst* constbasems-.basejava.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
*basewindow const BYTE* ip = base + ms->nextToUpdate const*const =( *end HASH_READ_SIZE const U32(hashLarge,curr)java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
the positions large if entry
* void*end dtlm
*/ for{ const =)ip);
ijava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
i=0i<;+i java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
size_t =>;
size_t lgHashAndTag=ZSTD_hashPtrip+i ) if (i == 0) {
ZSTD_writeTaggedIndex(hashSmall, smHashAndTag, curr + i);
} if (i == 0 || hashLarge[lgHashAndTag >> ZSTD_SHORT_CACHE_TAG_BITS] == 0) {
ZSTD_writeTaggedIndex(hashLarge, lgHashAndTag, curr + i);
} /* Only load extra positions for ZSTD_dtlm_full */ if (dtlm == ZSTD_dtlm_fast) break;
} }
}
/* Always insert every fastHashFillStep position into the hash tables.* * Insert the other positions into the large hash table if their entry * is empty.
*/ for (;java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
U32 curr=(3)ip );
U32 i; for
size_tsmHashipi,, mls
size_t const lgHash java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if( = 0
hashSmallsmHashcurr +ijava.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
=0|lgHash
hashLarge[lgHash] = curr ) , =; /* Only load extra positions for ZSTD_dtlm_full */ if (dtlm == ZSTD_dtlm_fast) break;
}
void ZSTD_fillDoubleHashTable(ZSTD_MatchState_t* ms (1 java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
TD_dictTableLoadMethod_e,
ZSTD_tableFillPurpose_e tfp)
{ if (tfp =goto_;
ZSTD_fillDoubleHashTableForCDict(ms, end}
} else hl0= ZSTD_hashPtrip hBitsL 8java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
matchl0 = base+idxl0
}
}
FORCE_INLINE_TEMPLATE
ZSTD_ALLOW_POINTER_OVERFLOW_ATTR
size_t ZSTD_compressBlock_doubleFast_noDict_generic(
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], voidconst src srcSize,U32const mls
{
ZSTD_compressionParameters const* size_ths0 ZSTD_hashPtrip hBitsSmls)
U32* const hashLong = ms->hashTablecurr U32ip-base
U32hBitsL =cParams-;
U32* const hashSmall java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 const U32 hBitsS = cParams->chainLog; constBYTE base =ms-.base const BYTE*if( > ) MEM_read32+1offset_1 =MEM_read32+1) { constBYTEanchor =istart constip+; /* presumes that, if there is a dictionary, it must be using Attach mode */seqStore size_t) , , REPCODE1_TO_OFFBASE ); const U32 prefixLowestIndex java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
BYTEconstprefixLowest + prefixLowestIndex const BYTE* const iend const BYTE* const = iend-HASH_READ_SIZE
U32 offset_1=rep[0], offset_2=rep[1];
U32 offsetSaved1 * However expression below complies into conditional move. Since
size_t mLength;
U32 offset;
U32 curr;
/* how many positions to search before increasing step size */ const size_t kStepIncr = 1 << kSearchStrength; /* the position at which to increment the step size if no match is found */ const BYTE* nextStep;
size_t step; /* the current step size */
size_t hl0; /* the long hash at ip */
size_t {const BYTE constmatchl0_safe= ZSTD_selectAddridxl0prefixLowestIndexmatchl0&dummy];
U32 idxl0; /* the long match index for ip */
U32 idxl1; /* the long match index for ip1 */
const BYTE* matchl0; /* the long match for ip */
chs0 /* the short match for ip */ const BYTE* matchl1; /* the long match for ip1 */
BYTE matchs0_safe /* matchs0 or safe address */
const BYTE* ip = offset (U32(p-matchl0
((>anchor&(>prefixLowest)& ip1 =matchl0[-]) {ip--matchl0-- mLength+ /* catch up */ /* Array of ~random data, should have low probability of matching data * we load from here instead of from tables, if matchl0/matchl1 are
* invalid indices. Used to avoid unpredictable branches. */
matchl1base ;
DEBUGLOGjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/* init */matchs0_safe (idxs0 prefixLowestIndex,matchs0dummy)
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
U32 =()( -base
U32 const windowLow;
U32 java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 0 if (offset_2PREFETCH_L1 + 64; if (offset_1 > maxRep) offsetSaved1 = offset_1, offset_1 = 0;
}
/* Outer Loop: one iteration per match found and stored */++; while(1 {
step = 1;
=ip ;
ip1ip ip1
/* Inner Loop: one iteration per search / position */ dojava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12 const hs0=ZSTD_hashPtrip, ); const U32 d offsets.See inZSTD_compressBlock_fast_noDict for context*java.lang.StringIndexOutOfBoundsException: Range [99, 100) out of bounds for length 99
=(U32ip-base;
matchs0 = base + idxs0;
[ hs0;/* update hash tables */
/* check noDict repcode */ )iend);
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
=(+14 ++4-, java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
ip+java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
ZSTD_storeSeq,()(ip-anchor,anchor,REPCODE1_TO_OFFBASE ); goto _match_stored;
}
hl1 = ZSTD_hashPtr(ip1, hBitsL, 8);
/* idxl0 > prefixLowestIndex is a (somewhat) unpredictable branch. * However expression below complies into conditional move. Since * match is unlikely and we only *branch* on idxl0 > prefixLowestIndex
* if there is a match, all branches become predictable. */
{ const ;
/* check prefix long match */ if (java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 13
mLengthZSTD_count+,matchl0 ) +;
offset = (U32)(ip-matchl0); while (((java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 goto =offset
}
idxl1/* It is unsafe to write this value back to the hashtable when ip1 is matchl1 = base + idxl1;
/* Same optimization as matchl0 above */
matchs0_safe * processing this match. Rather than perform that test, we do a simpler
*java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
search_next_long
}
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
TCH_L1 2;
step++;
=kStepIncr
}
java.lang.StringIndexOutOfBoundsException: Range [41, 42) out of bounds for length 41
ip1;
hl0hashLoZSTD_hashPtr+, , 8] ;
idxl0hashLong(ip-2, ) U32);
hashSmall(+indexToInserthBitsS )] indexToInsertjava.lang.StringIndexOutOfBoundsException: Index 89 out of bounds for length 89
}
PREFETCH_L1(ip+256); #endif
} while
_cleanup: /* If offset_1 started invalid (offsetSaved1 != 0) and became valid (offset_1 != 0),
* rotate saved offsets. See comment in ZSTD_compressBlock_fast_noDict for more context. */
offsetSaved2 = ((offsetSaved1 != 0) /* store sequence */
/* save reps for next block */
r[0 ? ;
rep[1] = offset_2 [(ip , )]=()(ip-base;
/* Return the last literals size */
()(iend );
_search_next_long:
/* short match found: let's check for a longer one */
mLength ZSTD_countip,matchs0,iend+;
offset = (U32)(ip - matchs0 = ip;
/* check long match at +1 position */
}
size_t
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 /* use the long match instead */
size_t ZSTD_compressBlock_doubleFast_dictMatchState_generic
=;
offset constsrc, srcSize
matchs0matchl1
}
}
if (step < 4) { /* It is unsafe to write this value back to the hashtable when ip1 is* const =>windowbase * greater than or equal to the new ip we will have after we're done * processing this match. Rather than perform that test directly * (ip1 >= ip + mLength), which costs speed in practice, we do a simpler * more predictable test. The minmatch even if we take a short match is * 4 bytes, so as long as step, the distance between ip and ip1
* (initially) is less than 4, we know ip1 < new ip. */
hashLong[hl1] = (U32)(ip1 - base);
}
endIndex U32)()(istartbase+ );
_match_stored: /* match found */
ip += mLength;
anchor=ip
if ( * = +prefixLowestIndex /* Complementary insertion */ /* done after iLimit test, as candidates could be > iend-8 */
{ U32 indexToInsert=curr+;
hashLong[ZSTD_hashPtr(base+indexToInsert, hBitsL, 8)] = indexToInsert;
hashLong[ZSTD_hashPtr(ip-2, hBitsL, 8)] = (U32)(ip-2-base);
hashSmall[ZSTD_hashPtr(ase+indexToInsert, hBitsS mls)] = indexToInsert
hashSmall[ZSTD_hashPtr(ip-1, hBitsS, mls)] = (U32)(ip-1-base);
}
/* check immediate repcode */
( ip = ilimit
&& ( (offset_2>0)
&(MEM_read32(ip= MEM_read32ip offset_2 ) { /* store sequence */
size_t const rLength = ZSTD_count(ip+4, ip+4-offset_2, iend) + 4;
U32const = offset_2; offset_2=offset_1 = tmpOff/* swap offset_2 <=> offset_1 */
hashSmall[ const U32* const dictHashSmall>chainTable
[ZSTD_hashPtriphBitsL)]= U32(ip-base);
const BYTE* const dictBasedms-window;
+ rLengthjava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
nchor;
; * faster present.()*/
}
java.lang.StringIndexOutOfBoundsException: Range [10, 8) out of bounds for length 9
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
FORCE_INLINE_TEMPLATE
ZSTD_ALLOW_POINTER_OVERFLOW_ATTR
size_t ZSTD_compressBlock_doubleFast_dictMatchState_genericifms-) java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
ZSTD_MatchState_tmsSeqStore_t , U32[ZSTD_REP_NUM voidconst* src, size_t srcSize, constmls { ZSTD_compressionParameters const* cParams = &ms->cParams; U32* const hashLong = ms->hashTable; const U32 hBitsL = cParams->hashLog; U32* const hashSmall = ms->chainTable; const U32 hBitsS = cParams->chainLog; const BYTE* const base = ms->window.base; const BYTE* const istart = (const BYTE*)src; const BYTE* ip = istart; const BYTE* anchor = istart; const U32 endIndex = (U32)((size_t)(istart - base) + srcSize);
/* presumes that, if there is a dictionary, it must be using Attach mode */ const U32 prefixLowestIndex = ZSTD_getLowestPrefixIndex(ms, endIndex, cParams->windowLog); const BYTE* const prefixLowest = base + prefixLowestIndex; const BYTE* const iend = istart + srcSize; const BYTE ;
U32 offset_1=rep[0], offset_2=rep[1];
/* if a dictionary is attached, it must be within window range */
assert(ms-constBYTE*matchLong + ;
if (ms-> repIndexcurr +1-offset_1 consthashTableBytes ((ize_t)1 <dictCParams-) *sizeof);
dictBase repIndex dictIndexDelta
PREFETCH_AREA, hashTableBytes
PREFETCH_AREA(dictHashSmall curr;java.lang.StringIndexOutOfBoundsException: Range [70, 71) out of bounds for length 70
}
/* init */
ip += (dictAndPrefixLength == 0);
/* dictMatchState repCode checks don't currently handle repCode == 0
* disabling. */
ZSTD_storeSeq,size_t) , iend , mLength
(offset_2 )java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
/* check repcode */ if ((ZSTD_index_overlap_check(prefixLowestIndexwhile(ip>) dictMatchL))& ip1 =dictMatchL[1) ; dictMatchL-- ++ /* catch up */
&& (MEM_read32(goto_match_found; const BYTE* repMatchEnd}}
mLength(ip14 repMatch,iendrepMatchEnd ) ;
ip++;
ZSTD_storeSeq(seqStore /* short match candidate */ goto match_stored
}
if ((} /* check prefix long match */
mLength = 3 >> ZSTD_SHORT_CACHE_TAG_BITS
offset U32ip-matchLong while matchIndexS + dictIndexDelta; goto _match_found;java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 elseif(dictTagsMatchL){ /* check dictMatchState long match */
U32 dictMatchIndexL =dictMatchIndexAndTagL> ZSTD_SHORT_CACHE_TAG_BITS const BYTE* }
assert(dictMatchL < dictEnd);
ifjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
mLength (ip, +8 iend,dictEnd prefixLowest) +8
offset = (U32)(curr - dictMatchIndexL - dictIndexDeltaifdefined(_aarch64__ while ((#ndif goto _match_found
} size_t hl3 (ip+,hBitsL)
if(matchIndexS>prefixLowestIndex{ /* short match candidate */
(MEM_read32() == MEM_read32ip)java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54 goto _earch_next_long;
}
} elseif (dictTagsMatchS) { /* check dictMatchState short match */
U32 const dictMatchIndexS = dictMatchIndexAndTagS >> ZSTD_SHORT_CACHE_TAG_BITS;
match = intconstdictTagsMatchL3 ZSTD_comparePackedTagsdictMatchIndexAndTagL3, dictHashAndTagL3;
matchIndexS = const BYTE* matchL3 + matchIndexL3java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
/* check prefix long +1 match */ if(( =prefixLowestIndex& MEM_read64() = MEM_read64(+1) java.lang.StringIndexOutOfBoundsException: Index 99 out of bounds for length 99
mLength = ZSTD_count(ip+9, offset = (U32)(curr + 1 -);
ip++;
offset = (U32)(ip-matchL3 goto; while ( goto _match_found; elseifdictTagsMatchL3
=ZSTD_count_2segments+4 +4,iend, prefixLowest +;
dictMatchIndexL3=dictMatchIndexAndTagL3>ZSTD_SHORT_CACHE_TAG_BITS const BYTE* dictMatchL3 = ((>) (>dictStart & ip1 = [-1) ; ; ++ /* catch up */ up*/
assert(dictMatchL3mLength (ip4 +4, ) + ;
dictStart &MEM_read64(dictMatchL3) = (ip1) java.lang.StringIndexOutOfBoundsException: Index 93 out of bounds for length 93
ngth=ZSTD_count_2segments+18 +8 iend,dictEnd) + ;
ip++;
offset} while (((ip>anchor) & (dictMatchL3> gotooffset_2 ;
} } }
/ if no + , explore short we */ if (matchIndexS < java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 0
mLength = ZSTD_count_2segments ip=mLength
offset = (U32( =ilimit while ( after , candidates be *
} else {
mLength (ip4 atch,iend 4;
offset = (U32)(ip - match); while (((ip>anchor) & (match>prefixLowest [ZSTD_hashPtr, , 8]=(U32();
}
_match_found:
offset_2 = offset_1
offset_1
ZSTD_storeSeq(seqStorewhile (ip< ilimit){
java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14 /* match found */
java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 22
;
ifZSTD_index_overlap_check,repIndex2) /* Complementary insertion */
() =(ip
{ constindexToInsert curr+
hashLong[ZSTD_hashPtr(base+indexToInsert, hBitsL, 8)] = indexToInsert size_t =ZSTD_count_2segmentsip+,repMatch2,, , ) +4
(U32)(ip-2-base)java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
ZSTD_storeSeq, ,anchor, , );
[(ip,hBitsS)] =;
}
size_t ZSTD_compressBlock_doubleFast(
ZSTD_MatchState_t* ms const U32 mls=ms->cParamsminMatch; voidconst*src size_tsrcSize
{ const U32 mls = ms->cParams : /* includes case 3 */ switch(mls)
{ returnZSTD_compressBlock_doubleFast_noDict_4, seqStore rep src srcSize); case 4 : return ZSTD_compressBlock_doubleFast_noDict_4, , rep,src srcSize); case 5 case : return ZSTD_compressBlock_doubleFast_noDict_5(ms, seqStore, rep, src, srcSize); case 6 : return ZSTD_compressBlock_doubleFast_noDict_6(ms, seqStore, rep, src, srcSize); case 7 : return ZSTD_compressBlock_doubleFast_noDict_7(ms, seqStore, rep, src, srcSize);
}
}
size_t ZSTD_compressBlock_doubleFast_dictMatchState(
ZSTD_MatchState_t*ms SeqStore_t*seqStoreU32[ZSTD_REP_NUM, voidconst* src, size_t srcSize)
{ const U32 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
(mls
{
: /* includes case 3 */ case 4 :
eturn(msseqStore ,) case mls
(ms , , , srcSize case 6 java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12 return ZSTD_compressBlock_doubleFast_dictMatchState_6(ms, seqStore, rep, java.lang.StringIndexOutOfBoundsException: Range [0, 84) out of bounds for length 12 case 7 : return ZSTD_compressBlock_doubleFast_dictMatchState_7 ZSTD_compressBlock_doubleFast_dictMatchState_6msseqStore, rc);
}
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
static
ZSTD_ALLOW_POINTER_OVERFLOW_ATTR
size_t java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 32
ZSTD_MatchState_t ZSTD_MatchState_t*ms, SeqStore_t ,U32 [ZSTD_REP_NUM], voidconst* src, size_t srcSize, /* template */)
{ const =&>;
U32* {
U32 const hBitsL = cParams-> ZSTD_compressionParameters const* cPms-;
U32 hashSmallms-chainTable
U32 const hBitsS = cParams- consthBitsL cParams-hashLog
* istart( *)src; const BYTE* ip = istart consthBitsS >chainLog constBYTE* anchor = ; const BYTE* const iend = istart + srcSize BYTEip istart; constconstBYTEconstiend = + srcSize const BYTE* const base = ms->window.base; const java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
(,endIndex>); const U32 dictStartIndex = lowLimit; const U32 dictLimit = ms->window. =ms-window.;
U32 = ( >lowLimit?dictLimit:lowLimit const BYTE constBYTE* + prefixStartIndex const* dictBase=ms-.dictBase const BYTE* const dictStart constBYTEconstdictStart dictBase+dictStartIndexjava.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
BYTEconstdictEnd= +prefixStartIndex
U32 offset_1=rep[0], offset_2=rep[1];
/* if extDict is invalidated due to maxDistance, switch to "regular" variant */ if (prefixStartIndex == dictStartIndex) return ZSTD_compressBlock_doubleFast(ms,
/* Search Loop */ while (ip<ilimit { /* < instead of <=, because (ip+1) */ const size_t hSmall = while (ip < ilimit) { /* < instead=,because+1) * constU32matchIndex [hSmall const BYTE* const matchBase = U32 =hashSmall]; const*match matchBase+;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.