This commit is contained in:
		
							
								
								
									
										31
									
								
								vendor/github.com/cespare/xxhash/v2/README.md
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										31
									
								
								vendor/github.com/cespare/xxhash/v2/README.md
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -3,8 +3,7 @@ | ||||
| [](https://pkg.go.dev/github.com/cespare/xxhash/v2) | ||||
| [](https://github.com/cespare/xxhash/actions/workflows/test.yml) | ||||
|  | ||||
| xxhash is a Go implementation of the 64-bit | ||||
| [xxHash](http://cyan4973.github.io/xxHash/) algorithm, XXH64. This is a | ||||
| xxhash is a Go implementation of the 64-bit [xxHash] algorithm, XXH64. This is a | ||||
| high-quality hashing algorithm that is much faster than anything in the Go | ||||
| standard library. | ||||
|  | ||||
| @@ -25,8 +24,11 @@ func (*Digest) WriteString(string) (int, error) | ||||
| func (*Digest) Sum64() uint64 | ||||
| ``` | ||||
|  | ||||
| This implementation provides a fast pure-Go implementation and an even faster | ||||
| assembly implementation for amd64. | ||||
| The package is written with optimized pure Go and also contains even faster | ||||
| assembly implementations for amd64 and arm64. If desired, the `purego` build tag | ||||
| opts into using the Go code even on those architectures. | ||||
|  | ||||
| [xxHash]: http://cyan4973.github.io/xxHash/ | ||||
|  | ||||
| ## Compatibility | ||||
|  | ||||
| @@ -45,19 +47,20 @@ I recommend using the latest release of Go. | ||||
| Here are some quick benchmarks comparing the pure-Go and assembly | ||||
| implementations of Sum64. | ||||
|  | ||||
| | input size | purego | asm | | ||||
| | --- | --- | --- | | ||||
| | 5 B   |  979.66 MB/s |  1291.17 MB/s  | | ||||
| | 100 B | 7475.26 MB/s | 7973.40 MB/s  | | ||||
| | 4 KB  | 17573.46 MB/s | 17602.65 MB/s | | ||||
| | 10 MB | 17131.46 MB/s | 17142.16 MB/s | | ||||
| | input size | purego    | asm       | | ||||
| | ---------- | --------- | --------- | | ||||
| | 4 B        |  1.3 GB/s |  1.2 GB/s | | ||||
| | 16 B       |  2.9 GB/s |  3.5 GB/s | | ||||
| | 100 B      |  6.9 GB/s |  8.1 GB/s | | ||||
| | 4 KB       | 11.7 GB/s | 16.7 GB/s | | ||||
| | 10 MB      | 12.0 GB/s | 17.3 GB/s | | ||||
|  | ||||
| These numbers were generated on Ubuntu 18.04 with an Intel i7-8700K CPU using | ||||
| the following commands under Go 1.11.2: | ||||
| These numbers were generated on Ubuntu 20.04 with an Intel Xeon Platinum 8252C | ||||
| CPU using the following commands under Go 1.19.2: | ||||
|  | ||||
| ``` | ||||
| $ go test -tags purego -benchtime 10s -bench '/xxhash,direct,bytes' | ||||
| $ go test -benchtime 10s -bench '/xxhash,direct,bytes' | ||||
| benchstat <(go test -tags purego -benchtime 500ms -count 15 -bench 'Sum64$') | ||||
| benchstat <(go test -benchtime 500ms -count 15 -bench 'Sum64$') | ||||
| ``` | ||||
|  | ||||
| ## Projects using this package | ||||
|   | ||||
							
								
								
									
										10
									
								
								vendor/github.com/cespare/xxhash/v2/testall.sh
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								vendor/github.com/cespare/xxhash/v2/testall.sh
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | ||||
| #!/bin/bash | ||||
| set -eu -o pipefail | ||||
|  | ||||
| # Small convenience script for running the tests with various combinations of | ||||
| # arch/tags. This assumes we're running on amd64 and have qemu available. | ||||
|  | ||||
| go test ./... | ||||
| go test -tags purego ./... | ||||
| GOARCH=arm64 go test | ||||
| GOARCH=arm64 go test -tags purego | ||||
							
								
								
									
										47
									
								
								vendor/github.com/cespare/xxhash/v2/xxhash.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										47
									
								
								vendor/github.com/cespare/xxhash/v2/xxhash.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -16,19 +16,11 @@ const ( | ||||
| 	prime5 uint64 = 2870177450012600261 | ||||
| ) | ||||
|  | ||||
| // NOTE(caleb): I'm using both consts and vars of the primes. Using consts where | ||||
| // possible in the Go code is worth a small (but measurable) performance boost | ||||
| // by avoiding some MOVQs. Vars are needed for the asm and also are useful for | ||||
| // convenience in the Go code in a few places where we need to intentionally | ||||
| // avoid constant arithmetic (e.g., v1 := prime1 + prime2 fails because the | ||||
| // result overflows a uint64). | ||||
| var ( | ||||
| 	prime1v = prime1 | ||||
| 	prime2v = prime2 | ||||
| 	prime3v = prime3 | ||||
| 	prime4v = prime4 | ||||
| 	prime5v = prime5 | ||||
| ) | ||||
| // Store the primes in an array as well. | ||||
| // | ||||
| // The consts are used when possible in Go code to avoid MOVs but we need a | ||||
| // contiguous array of the assembly code. | ||||
| var primes = [...]uint64{prime1, prime2, prime3, prime4, prime5} | ||||
|  | ||||
| // Digest implements hash.Hash64. | ||||
| type Digest struct { | ||||
| @@ -50,10 +42,10 @@ func New() *Digest { | ||||
|  | ||||
| // Reset clears the Digest's state so that it can be reused. | ||||
| func (d *Digest) Reset() { | ||||
| 	d.v1 = prime1v + prime2 | ||||
| 	d.v1 = primes[0] + prime2 | ||||
| 	d.v2 = prime2 | ||||
| 	d.v3 = 0 | ||||
| 	d.v4 = -prime1v | ||||
| 	d.v4 = -primes[0] | ||||
| 	d.total = 0 | ||||
| 	d.n = 0 | ||||
| } | ||||
| @@ -69,21 +61,23 @@ func (d *Digest) Write(b []byte) (n int, err error) { | ||||
| 	n = len(b) | ||||
| 	d.total += uint64(n) | ||||
|  | ||||
| 	memleft := d.mem[d.n&(len(d.mem)-1):] | ||||
|  | ||||
| 	if d.n+n < 32 { | ||||
| 		// This new data doesn't even fill the current block. | ||||
| 		copy(d.mem[d.n:], b) | ||||
| 		copy(memleft, b) | ||||
| 		d.n += n | ||||
| 		return | ||||
| 	} | ||||
|  | ||||
| 	if d.n > 0 { | ||||
| 		// Finish off the partial block. | ||||
| 		copy(d.mem[d.n:], b) | ||||
| 		c := copy(memleft, b) | ||||
| 		d.v1 = round(d.v1, u64(d.mem[0:8])) | ||||
| 		d.v2 = round(d.v2, u64(d.mem[8:16])) | ||||
| 		d.v3 = round(d.v3, u64(d.mem[16:24])) | ||||
| 		d.v4 = round(d.v4, u64(d.mem[24:32])) | ||||
| 		b = b[32-d.n:] | ||||
| 		b = b[c:] | ||||
| 		d.n = 0 | ||||
| 	} | ||||
|  | ||||
| @@ -133,21 +127,20 @@ func (d *Digest) Sum64() uint64 { | ||||
|  | ||||
| 	h += d.total | ||||
|  | ||||
| 	i, end := 0, d.n | ||||
| 	for ; i+8 <= end; i += 8 { | ||||
| 		k1 := round(0, u64(d.mem[i:i+8])) | ||||
| 	b := d.mem[:d.n&(len(d.mem)-1)] | ||||
| 	for ; len(b) >= 8; b = b[8:] { | ||||
| 		k1 := round(0, u64(b[:8])) | ||||
| 		h ^= k1 | ||||
| 		h = rol27(h)*prime1 + prime4 | ||||
| 	} | ||||
| 	if i+4 <= end { | ||||
| 		h ^= uint64(u32(d.mem[i:i+4])) * prime1 | ||||
| 	if len(b) >= 4 { | ||||
| 		h ^= uint64(u32(b[:4])) * prime1 | ||||
| 		h = rol23(h)*prime2 + prime3 | ||||
| 		i += 4 | ||||
| 		b = b[4:] | ||||
| 	} | ||||
| 	for i < end { | ||||
| 		h ^= uint64(d.mem[i]) * prime5 | ||||
| 	for ; len(b) > 0; b = b[1:] { | ||||
| 		h ^= uint64(b[0]) * prime5 | ||||
| 		h = rol11(h) * prime1 | ||||
| 		i++ | ||||
| 	} | ||||
|  | ||||
| 	h ^= h >> 33 | ||||
|   | ||||
							
								
								
									
										308
									
								
								vendor/github.com/cespare/xxhash/v2/xxhash_amd64.s
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										308
									
								
								vendor/github.com/cespare/xxhash/v2/xxhash_amd64.s
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,215 +1,209 @@ | ||||
| //go:build !appengine && gc && !purego | ||||
| // +build !appengine | ||||
| // +build gc | ||||
| // +build !purego | ||||
|  | ||||
| #include "textflag.h" | ||||
|  | ||||
| // Register allocation: | ||||
| // AX	h | ||||
| // SI	pointer to advance through b | ||||
| // DX	n | ||||
| // BX	loop end | ||||
| // R8	v1, k1 | ||||
| // R9	v2 | ||||
| // R10	v3 | ||||
| // R11	v4 | ||||
| // R12	tmp | ||||
| // R13	prime1v | ||||
| // R14	prime2v | ||||
| // DI	prime4v | ||||
| // Registers: | ||||
| #define h      AX | ||||
| #define d      AX | ||||
| #define p      SI // pointer to advance through b | ||||
| #define n      DX | ||||
| #define end    BX // loop end | ||||
| #define v1     R8 | ||||
| #define v2     R9 | ||||
| #define v3     R10 | ||||
| #define v4     R11 | ||||
| #define x      R12 | ||||
| #define prime1 R13 | ||||
| #define prime2 R14 | ||||
| #define prime4 DI | ||||
|  | ||||
| // round reads from and advances the buffer pointer in SI. | ||||
| // It assumes that R13 has prime1v and R14 has prime2v. | ||||
| #define round(r) \ | ||||
| 	MOVQ  (SI), R12 \ | ||||
| 	ADDQ  $8, SI    \ | ||||
| 	IMULQ R14, R12  \ | ||||
| 	ADDQ  R12, r    \ | ||||
| 	ROLQ  $31, r    \ | ||||
| 	IMULQ R13, r | ||||
| #define round(acc, x) \ | ||||
| 	IMULQ prime2, x   \ | ||||
| 	ADDQ  x, acc      \ | ||||
| 	ROLQ  $31, acc    \ | ||||
| 	IMULQ prime1, acc | ||||
|  | ||||
| // mergeRound applies a merge round on the two registers acc and val. | ||||
| // It assumes that R13 has prime1v, R14 has prime2v, and DI has prime4v. | ||||
| #define mergeRound(acc, val) \ | ||||
| 	IMULQ R14, val \ | ||||
| 	ROLQ  $31, val \ | ||||
| 	IMULQ R13, val \ | ||||
| 	XORQ  val, acc \ | ||||
| 	IMULQ R13, acc \ | ||||
| 	ADDQ  DI, acc | ||||
| // round0 performs the operation x = round(0, x). | ||||
| #define round0(x) \ | ||||
| 	IMULQ prime2, x \ | ||||
| 	ROLQ  $31, x    \ | ||||
| 	IMULQ prime1, x | ||||
|  | ||||
| // mergeRound applies a merge round on the two registers acc and x. | ||||
| // It assumes that prime1, prime2, and prime4 have been loaded. | ||||
| #define mergeRound(acc, x) \ | ||||
| 	round0(x)         \ | ||||
| 	XORQ  x, acc      \ | ||||
| 	IMULQ prime1, acc \ | ||||
| 	ADDQ  prime4, acc | ||||
|  | ||||
| // blockLoop processes as many 32-byte blocks as possible, | ||||
| // updating v1, v2, v3, and v4. It assumes that there is at least one block | ||||
| // to process. | ||||
| #define blockLoop() \ | ||||
| loop:  \ | ||||
| 	MOVQ +0(p), x  \ | ||||
| 	round(v1, x)   \ | ||||
| 	MOVQ +8(p), x  \ | ||||
| 	round(v2, x)   \ | ||||
| 	MOVQ +16(p), x \ | ||||
| 	round(v3, x)   \ | ||||
| 	MOVQ +24(p), x \ | ||||
| 	round(v4, x)   \ | ||||
| 	ADDQ $32, p    \ | ||||
| 	CMPQ p, end    \ | ||||
| 	JLE  loop | ||||
|  | ||||
| // func Sum64(b []byte) uint64 | ||||
| TEXT ·Sum64(SB), NOSPLIT, $0-32 | ||||
| TEXT ·Sum64(SB), NOSPLIT|NOFRAME, $0-32 | ||||
| 	// Load fixed primes. | ||||
| 	MOVQ ·prime1v(SB), R13 | ||||
| 	MOVQ ·prime2v(SB), R14 | ||||
| 	MOVQ ·prime4v(SB), DI | ||||
| 	MOVQ ·primes+0(SB), prime1 | ||||
| 	MOVQ ·primes+8(SB), prime2 | ||||
| 	MOVQ ·primes+24(SB), prime4 | ||||
|  | ||||
| 	// Load slice. | ||||
| 	MOVQ b_base+0(FP), SI | ||||
| 	MOVQ b_len+8(FP), DX | ||||
| 	LEAQ (SI)(DX*1), BX | ||||
| 	MOVQ b_base+0(FP), p | ||||
| 	MOVQ b_len+8(FP), n | ||||
| 	LEAQ (p)(n*1), end | ||||
|  | ||||
| 	// The first loop limit will be len(b)-32. | ||||
| 	SUBQ $32, BX | ||||
| 	SUBQ $32, end | ||||
|  | ||||
| 	// Check whether we have at least one block. | ||||
| 	CMPQ DX, $32 | ||||
| 	CMPQ n, $32 | ||||
| 	JLT  noBlocks | ||||
|  | ||||
| 	// Set up initial state (v1, v2, v3, v4). | ||||
| 	MOVQ R13, R8 | ||||
| 	ADDQ R14, R8 | ||||
| 	MOVQ R14, R9 | ||||
| 	XORQ R10, R10 | ||||
| 	XORQ R11, R11 | ||||
| 	SUBQ R13, R11 | ||||
| 	MOVQ prime1, v1 | ||||
| 	ADDQ prime2, v1 | ||||
| 	MOVQ prime2, v2 | ||||
| 	XORQ v3, v3 | ||||
| 	XORQ v4, v4 | ||||
| 	SUBQ prime1, v4 | ||||
|  | ||||
| 	// Loop until SI > BX. | ||||
| blockLoop: | ||||
| 	round(R8) | ||||
| 	round(R9) | ||||
| 	round(R10) | ||||
| 	round(R11) | ||||
| 	blockLoop() | ||||
|  | ||||
| 	CMPQ SI, BX | ||||
| 	JLE  blockLoop | ||||
| 	MOVQ v1, h | ||||
| 	ROLQ $1, h | ||||
| 	MOVQ v2, x | ||||
| 	ROLQ $7, x | ||||
| 	ADDQ x, h | ||||
| 	MOVQ v3, x | ||||
| 	ROLQ $12, x | ||||
| 	ADDQ x, h | ||||
| 	MOVQ v4, x | ||||
| 	ROLQ $18, x | ||||
| 	ADDQ x, h | ||||
|  | ||||
| 	MOVQ R8, AX | ||||
| 	ROLQ $1, AX | ||||
| 	MOVQ R9, R12 | ||||
| 	ROLQ $7, R12 | ||||
| 	ADDQ R12, AX | ||||
| 	MOVQ R10, R12 | ||||
| 	ROLQ $12, R12 | ||||
| 	ADDQ R12, AX | ||||
| 	MOVQ R11, R12 | ||||
| 	ROLQ $18, R12 | ||||
| 	ADDQ R12, AX | ||||
|  | ||||
| 	mergeRound(AX, R8) | ||||
| 	mergeRound(AX, R9) | ||||
| 	mergeRound(AX, R10) | ||||
| 	mergeRound(AX, R11) | ||||
| 	mergeRound(h, v1) | ||||
| 	mergeRound(h, v2) | ||||
| 	mergeRound(h, v3) | ||||
| 	mergeRound(h, v4) | ||||
|  | ||||
| 	JMP afterBlocks | ||||
|  | ||||
| noBlocks: | ||||
| 	MOVQ ·prime5v(SB), AX | ||||
| 	MOVQ ·primes+32(SB), h | ||||
|  | ||||
| afterBlocks: | ||||
| 	ADDQ DX, AX | ||||
| 	ADDQ n, h | ||||
|  | ||||
| 	// Right now BX has len(b)-32, and we want to loop until SI > len(b)-8. | ||||
| 	ADDQ $24, BX | ||||
| 	ADDQ $24, end | ||||
| 	CMPQ p, end | ||||
| 	JG   try4 | ||||
|  | ||||
| 	CMPQ SI, BX | ||||
| 	JG   fourByte | ||||
| loop8: | ||||
| 	MOVQ  (p), x | ||||
| 	ADDQ  $8, p | ||||
| 	round0(x) | ||||
| 	XORQ  x, h | ||||
| 	ROLQ  $27, h | ||||
| 	IMULQ prime1, h | ||||
| 	ADDQ  prime4, h | ||||
|  | ||||
| wordLoop: | ||||
| 	// Calculate k1. | ||||
| 	MOVQ  (SI), R8 | ||||
| 	ADDQ  $8, SI | ||||
| 	IMULQ R14, R8 | ||||
| 	ROLQ  $31, R8 | ||||
| 	IMULQ R13, R8 | ||||
| 	CMPQ p, end | ||||
| 	JLE  loop8 | ||||
|  | ||||
| 	XORQ  R8, AX | ||||
| 	ROLQ  $27, AX | ||||
| 	IMULQ R13, AX | ||||
| 	ADDQ  DI, AX | ||||
| try4: | ||||
| 	ADDQ $4, end | ||||
| 	CMPQ p, end | ||||
| 	JG   try1 | ||||
|  | ||||
| 	CMPQ SI, BX | ||||
| 	JLE  wordLoop | ||||
| 	MOVL  (p), x | ||||
| 	ADDQ  $4, p | ||||
| 	IMULQ prime1, x | ||||
| 	XORQ  x, h | ||||
|  | ||||
| fourByte: | ||||
| 	ADDQ $4, BX | ||||
| 	CMPQ SI, BX | ||||
| 	JG   singles | ||||
| 	ROLQ  $23, h | ||||
| 	IMULQ prime2, h | ||||
| 	ADDQ  ·primes+16(SB), h | ||||
|  | ||||
| 	MOVL  (SI), R8 | ||||
| 	ADDQ  $4, SI | ||||
| 	IMULQ R13, R8 | ||||
| 	XORQ  R8, AX | ||||
|  | ||||
| 	ROLQ  $23, AX | ||||
| 	IMULQ R14, AX | ||||
| 	ADDQ  ·prime3v(SB), AX | ||||
|  | ||||
| singles: | ||||
| 	ADDQ $4, BX | ||||
| 	CMPQ SI, BX | ||||
| try1: | ||||
| 	ADDQ $4, end | ||||
| 	CMPQ p, end | ||||
| 	JGE  finalize | ||||
|  | ||||
| singlesLoop: | ||||
| 	MOVBQZX (SI), R12 | ||||
| 	ADDQ    $1, SI | ||||
| 	IMULQ   ·prime5v(SB), R12 | ||||
| 	XORQ    R12, AX | ||||
| loop1: | ||||
| 	MOVBQZX (p), x | ||||
| 	ADDQ    $1, p | ||||
| 	IMULQ   ·primes+32(SB), x | ||||
| 	XORQ    x, h | ||||
| 	ROLQ    $11, h | ||||
| 	IMULQ   prime1, h | ||||
|  | ||||
| 	ROLQ  $11, AX | ||||
| 	IMULQ R13, AX | ||||
|  | ||||
| 	CMPQ SI, BX | ||||
| 	JL   singlesLoop | ||||
| 	CMPQ p, end | ||||
| 	JL   loop1 | ||||
|  | ||||
| finalize: | ||||
| 	MOVQ  AX, R12 | ||||
| 	SHRQ  $33, R12 | ||||
| 	XORQ  R12, AX | ||||
| 	IMULQ R14, AX | ||||
| 	MOVQ  AX, R12 | ||||
| 	SHRQ  $29, R12 | ||||
| 	XORQ  R12, AX | ||||
| 	IMULQ ·prime3v(SB), AX | ||||
| 	MOVQ  AX, R12 | ||||
| 	SHRQ  $32, R12 | ||||
| 	XORQ  R12, AX | ||||
| 	MOVQ  h, x | ||||
| 	SHRQ  $33, x | ||||
| 	XORQ  x, h | ||||
| 	IMULQ prime2, h | ||||
| 	MOVQ  h, x | ||||
| 	SHRQ  $29, x | ||||
| 	XORQ  x, h | ||||
| 	IMULQ ·primes+16(SB), h | ||||
| 	MOVQ  h, x | ||||
| 	SHRQ  $32, x | ||||
| 	XORQ  x, h | ||||
|  | ||||
| 	MOVQ AX, ret+24(FP) | ||||
| 	MOVQ h, ret+24(FP) | ||||
| 	RET | ||||
|  | ||||
| // writeBlocks uses the same registers as above except that it uses AX to store | ||||
| // the d pointer. | ||||
|  | ||||
| // func writeBlocks(d *Digest, b []byte) int | ||||
| TEXT ·writeBlocks(SB), NOSPLIT, $0-40 | ||||
| TEXT ·writeBlocks(SB), NOSPLIT|NOFRAME, $0-40 | ||||
| 	// Load fixed primes needed for round. | ||||
| 	MOVQ ·prime1v(SB), R13 | ||||
| 	MOVQ ·prime2v(SB), R14 | ||||
| 	MOVQ ·primes+0(SB), prime1 | ||||
| 	MOVQ ·primes+8(SB), prime2 | ||||
|  | ||||
| 	// Load slice. | ||||
| 	MOVQ b_base+8(FP), SI | ||||
| 	MOVQ b_len+16(FP), DX | ||||
| 	LEAQ (SI)(DX*1), BX | ||||
| 	SUBQ $32, BX | ||||
| 	MOVQ b_base+8(FP), p | ||||
| 	MOVQ b_len+16(FP), n | ||||
| 	LEAQ (p)(n*1), end | ||||
| 	SUBQ $32, end | ||||
|  | ||||
| 	// Load vN from d. | ||||
| 	MOVQ d+0(FP), AX | ||||
| 	MOVQ 0(AX), R8   // v1 | ||||
| 	MOVQ 8(AX), R9   // v2 | ||||
| 	MOVQ 16(AX), R10 // v3 | ||||
| 	MOVQ 24(AX), R11 // v4 | ||||
| 	MOVQ s+0(FP), d | ||||
| 	MOVQ 0(d), v1 | ||||
| 	MOVQ 8(d), v2 | ||||
| 	MOVQ 16(d), v3 | ||||
| 	MOVQ 24(d), v4 | ||||
|  | ||||
| 	// We don't need to check the loop condition here; this function is | ||||
| 	// always called with at least one block of data to process. | ||||
| blockLoop: | ||||
| 	round(R8) | ||||
| 	round(R9) | ||||
| 	round(R10) | ||||
| 	round(R11) | ||||
|  | ||||
| 	CMPQ SI, BX | ||||
| 	JLE  blockLoop | ||||
| 	blockLoop() | ||||
|  | ||||
| 	// Copy vN back to d. | ||||
| 	MOVQ R8, 0(AX) | ||||
| 	MOVQ R9, 8(AX) | ||||
| 	MOVQ R10, 16(AX) | ||||
| 	MOVQ R11, 24(AX) | ||||
| 	MOVQ v1, 0(d) | ||||
| 	MOVQ v2, 8(d) | ||||
| 	MOVQ v3, 16(d) | ||||
| 	MOVQ v4, 24(d) | ||||
|  | ||||
| 	// The number of bytes written is SI minus the old base pointer. | ||||
| 	SUBQ b_base+8(FP), SI | ||||
| 	MOVQ SI, ret+32(FP) | ||||
| 	// The number of bytes written is p minus the old base pointer. | ||||
| 	SUBQ b_base+8(FP), p | ||||
| 	MOVQ p, ret+32(FP) | ||||
|  | ||||
| 	RET | ||||
|   | ||||
							
								
								
									
										183
									
								
								vendor/github.com/cespare/xxhash/v2/xxhash_arm64.s
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										183
									
								
								vendor/github.com/cespare/xxhash/v2/xxhash_arm64.s
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,183 @@ | ||||
| //go:build !appengine && gc && !purego | ||||
| // +build !appengine | ||||
| // +build gc | ||||
| // +build !purego | ||||
|  | ||||
| #include "textflag.h" | ||||
|  | ||||
| // Registers: | ||||
| #define digest	R1 | ||||
| #define h	R2 // return value | ||||
| #define p	R3 // input pointer | ||||
| #define n	R4 // input length | ||||
| #define nblocks	R5 // n / 32 | ||||
| #define prime1	R7 | ||||
| #define prime2	R8 | ||||
| #define prime3	R9 | ||||
| #define prime4	R10 | ||||
| #define prime5	R11 | ||||
| #define v1	R12 | ||||
| #define v2	R13 | ||||
| #define v3	R14 | ||||
| #define v4	R15 | ||||
| #define x1	R20 | ||||
| #define x2	R21 | ||||
| #define x3	R22 | ||||
| #define x4	R23 | ||||
|  | ||||
| #define round(acc, x) \ | ||||
| 	MADD prime2, acc, x, acc \ | ||||
| 	ROR  $64-31, acc         \ | ||||
| 	MUL  prime1, acc | ||||
|  | ||||
| // round0 performs the operation x = round(0, x). | ||||
| #define round0(x) \ | ||||
| 	MUL prime2, x \ | ||||
| 	ROR $64-31, x \ | ||||
| 	MUL prime1, x | ||||
|  | ||||
| #define mergeRound(acc, x) \ | ||||
| 	round0(x)                     \ | ||||
| 	EOR  x, acc                   \ | ||||
| 	MADD acc, prime4, prime1, acc | ||||
|  | ||||
| // blockLoop processes as many 32-byte blocks as possible, | ||||
| // updating v1, v2, v3, and v4. It assumes that n >= 32. | ||||
| #define blockLoop() \ | ||||
| 	LSR     $5, n, nblocks  \ | ||||
| 	PCALIGN $16             \ | ||||
| 	loop:                   \ | ||||
| 	LDP.P   16(p), (x1, x2) \ | ||||
| 	LDP.P   16(p), (x3, x4) \ | ||||
| 	round(v1, x1)           \ | ||||
| 	round(v2, x2)           \ | ||||
| 	round(v3, x3)           \ | ||||
| 	round(v4, x4)           \ | ||||
| 	SUB     $1, nblocks     \ | ||||
| 	CBNZ    nblocks, loop | ||||
|  | ||||
| // func Sum64(b []byte) uint64 | ||||
| TEXT ·Sum64(SB), NOSPLIT|NOFRAME, $0-32 | ||||
| 	LDP b_base+0(FP), (p, n) | ||||
|  | ||||
| 	LDP  ·primes+0(SB), (prime1, prime2) | ||||
| 	LDP  ·primes+16(SB), (prime3, prime4) | ||||
| 	MOVD ·primes+32(SB), prime5 | ||||
|  | ||||
| 	CMP  $32, n | ||||
| 	CSEL LT, prime5, ZR, h // if n < 32 { h = prime5 } else { h = 0 } | ||||
| 	BLT  afterLoop | ||||
|  | ||||
| 	ADD  prime1, prime2, v1 | ||||
| 	MOVD prime2, v2 | ||||
| 	MOVD $0, v3 | ||||
| 	NEG  prime1, v4 | ||||
|  | ||||
| 	blockLoop() | ||||
|  | ||||
| 	ROR $64-1, v1, x1 | ||||
| 	ROR $64-7, v2, x2 | ||||
| 	ADD x1, x2 | ||||
| 	ROR $64-12, v3, x3 | ||||
| 	ROR $64-18, v4, x4 | ||||
| 	ADD x3, x4 | ||||
| 	ADD x2, x4, h | ||||
|  | ||||
| 	mergeRound(h, v1) | ||||
| 	mergeRound(h, v2) | ||||
| 	mergeRound(h, v3) | ||||
| 	mergeRound(h, v4) | ||||
|  | ||||
| afterLoop: | ||||
| 	ADD n, h | ||||
|  | ||||
| 	TBZ   $4, n, try8 | ||||
| 	LDP.P 16(p), (x1, x2) | ||||
|  | ||||
| 	round0(x1) | ||||
|  | ||||
| 	// NOTE: here and below, sequencing the EOR after the ROR (using a | ||||
| 	// rotated register) is worth a small but measurable speedup for small | ||||
| 	// inputs. | ||||
| 	ROR  $64-27, h | ||||
| 	EOR  x1 @> 64-27, h, h | ||||
| 	MADD h, prime4, prime1, h | ||||
|  | ||||
| 	round0(x2) | ||||
| 	ROR  $64-27, h | ||||
| 	EOR  x2 @> 64-27, h, h | ||||
| 	MADD h, prime4, prime1, h | ||||
|  | ||||
| try8: | ||||
| 	TBZ    $3, n, try4 | ||||
| 	MOVD.P 8(p), x1 | ||||
|  | ||||
| 	round0(x1) | ||||
| 	ROR  $64-27, h | ||||
| 	EOR  x1 @> 64-27, h, h | ||||
| 	MADD h, prime4, prime1, h | ||||
|  | ||||
| try4: | ||||
| 	TBZ     $2, n, try2 | ||||
| 	MOVWU.P 4(p), x2 | ||||
|  | ||||
| 	MUL  prime1, x2 | ||||
| 	ROR  $64-23, h | ||||
| 	EOR  x2 @> 64-23, h, h | ||||
| 	MADD h, prime3, prime2, h | ||||
|  | ||||
| try2: | ||||
| 	TBZ     $1, n, try1 | ||||
| 	MOVHU.P 2(p), x3 | ||||
| 	AND     $255, x3, x1 | ||||
| 	LSR     $8, x3, x2 | ||||
|  | ||||
| 	MUL prime5, x1 | ||||
| 	ROR $64-11, h | ||||
| 	EOR x1 @> 64-11, h, h | ||||
| 	MUL prime1, h | ||||
|  | ||||
| 	MUL prime5, x2 | ||||
| 	ROR $64-11, h | ||||
| 	EOR x2 @> 64-11, h, h | ||||
| 	MUL prime1, h | ||||
|  | ||||
| try1: | ||||
| 	TBZ   $0, n, finalize | ||||
| 	MOVBU (p), x4 | ||||
|  | ||||
| 	MUL prime5, x4 | ||||
| 	ROR $64-11, h | ||||
| 	EOR x4 @> 64-11, h, h | ||||
| 	MUL prime1, h | ||||
|  | ||||
| finalize: | ||||
| 	EOR h >> 33, h | ||||
| 	MUL prime2, h | ||||
| 	EOR h >> 29, h | ||||
| 	MUL prime3, h | ||||
| 	EOR h >> 32, h | ||||
|  | ||||
| 	MOVD h, ret+24(FP) | ||||
| 	RET | ||||
|  | ||||
| // func writeBlocks(d *Digest, b []byte) int | ||||
| TEXT ·writeBlocks(SB), NOSPLIT|NOFRAME, $0-40 | ||||
| 	LDP ·primes+0(SB), (prime1, prime2) | ||||
|  | ||||
| 	// Load state. Assume v[1-4] are stored contiguously. | ||||
| 	MOVD d+0(FP), digest | ||||
| 	LDP  0(digest), (v1, v2) | ||||
| 	LDP  16(digest), (v3, v4) | ||||
|  | ||||
| 	LDP b_base+8(FP), (p, n) | ||||
|  | ||||
| 	blockLoop() | ||||
|  | ||||
| 	// Store updated state. | ||||
| 	STP (v1, v2), 0(digest) | ||||
| 	STP (v3, v4), 16(digest) | ||||
|  | ||||
| 	BIC  $31, n | ||||
| 	MOVD n, ret+32(FP) | ||||
| 	RET | ||||
| @@ -1,3 +1,5 @@ | ||||
| //go:build (amd64 || arm64) && !appengine && gc && !purego | ||||
| // +build amd64 arm64 | ||||
| // +build !appengine | ||||
| // +build gc | ||||
| // +build !purego | ||||
							
								
								
									
										22
									
								
								vendor/github.com/cespare/xxhash/v2/xxhash_other.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										22
									
								
								vendor/github.com/cespare/xxhash/v2/xxhash_other.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,4 +1,5 @@ | ||||
| // +build !amd64 appengine !gc purego | ||||
| //go:build (!amd64 && !arm64) || appengine || !gc || purego | ||||
| // +build !amd64,!arm64 appengine !gc purego | ||||
|  | ||||
| package xxhash | ||||
|  | ||||
| @@ -14,10 +15,10 @@ func Sum64(b []byte) uint64 { | ||||
| 	var h uint64 | ||||
|  | ||||
| 	if n >= 32 { | ||||
| 		v1 := prime1v + prime2 | ||||
| 		v1 := primes[0] + prime2 | ||||
| 		v2 := prime2 | ||||
| 		v3 := uint64(0) | ||||
| 		v4 := -prime1v | ||||
| 		v4 := -primes[0] | ||||
| 		for len(b) >= 32 { | ||||
| 			v1 = round(v1, u64(b[0:8:len(b)])) | ||||
| 			v2 = round(v2, u64(b[8:16:len(b)])) | ||||
| @@ -36,19 +37,18 @@ func Sum64(b []byte) uint64 { | ||||
|  | ||||
| 	h += uint64(n) | ||||
|  | ||||
| 	i, end := 0, len(b) | ||||
| 	for ; i+8 <= end; i += 8 { | ||||
| 		k1 := round(0, u64(b[i:i+8:len(b)])) | ||||
| 	for ; len(b) >= 8; b = b[8:] { | ||||
| 		k1 := round(0, u64(b[:8])) | ||||
| 		h ^= k1 | ||||
| 		h = rol27(h)*prime1 + prime4 | ||||
| 	} | ||||
| 	if i+4 <= end { | ||||
| 		h ^= uint64(u32(b[i:i+4:len(b)])) * prime1 | ||||
| 	if len(b) >= 4 { | ||||
| 		h ^= uint64(u32(b[:4])) * prime1 | ||||
| 		h = rol23(h)*prime2 + prime3 | ||||
| 		i += 4 | ||||
| 		b = b[4:] | ||||
| 	} | ||||
| 	for ; i < end; i++ { | ||||
| 		h ^= uint64(b[i]) * prime5 | ||||
| 	for ; len(b) > 0; b = b[1:] { | ||||
| 		h ^= uint64(b[0]) * prime5 | ||||
| 		h = rol11(h) * prime1 | ||||
| 	} | ||||
|  | ||||
|   | ||||
							
								
								
									
										1
									
								
								vendor/github.com/cespare/xxhash/v2/xxhash_safe.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								vendor/github.com/cespare/xxhash/v2/xxhash_safe.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,3 +1,4 @@ | ||||
| //go:build appengine | ||||
| // +build appengine | ||||
|  | ||||
| // This file contains the safe implementations of otherwise unsafe-using code. | ||||
|   | ||||
							
								
								
									
										3
									
								
								vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,3 +1,4 @@ | ||||
| //go:build !appengine | ||||
| // +build !appengine | ||||
|  | ||||
| // This file encapsulates usage of unsafe. | ||||
| @@ -11,7 +12,7 @@ import ( | ||||
|  | ||||
| // In the future it's possible that compiler optimizations will make these | ||||
| // XxxString functions unnecessary by realizing that calls such as | ||||
| // Sum64([]byte(s)) don't need to copy s. See https://golang.org/issue/2205. | ||||
| // Sum64([]byte(s)) don't need to copy s. See https://go.dev/issue/2205. | ||||
| // If that happens, even if we keep these functions they can be replaced with | ||||
| // the trivial safe code. | ||||
|  | ||||
|   | ||||
							
								
								
									
										5
									
								
								vendor/github.com/klauspost/compress/README.md
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								vendor/github.com/klauspost/compress/README.md
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -17,6 +17,11 @@ This package provides various compression algorithms. | ||||
|  | ||||
| # changelog | ||||
|  | ||||
| * Oct 26, 2022 (v1.15.12) | ||||
|  | ||||
| 	* zstd: Tweak decoder allocs. https://github.com/klauspost/compress/pull/680 | ||||
| 	* gzhttp: Always delete `HeaderNoCompression` https://github.com/klauspost/compress/pull/683 | ||||
|  | ||||
| * Sept 26, 2022 (v1.15.11) | ||||
|  | ||||
| 	* flate: Improve level 1-3 compression  https://github.com/klauspost/compress/pull/678 | ||||
|   | ||||
							
								
								
									
										24
									
								
								vendor/github.com/klauspost/compress/huff0/compress.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										24
									
								
								vendor/github.com/klauspost/compress/huff0/compress.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -365,29 +365,29 @@ func (s *Scratch) countSimple(in []byte) (max int, reuse bool) { | ||||
| 	m := uint32(0) | ||||
| 	if len(s.prevTable) > 0 { | ||||
| 		for i, v := range s.count[:] { | ||||
| 			if v == 0 { | ||||
| 				continue | ||||
| 			} | ||||
| 			if v > m { | ||||
| 				m = v | ||||
| 			} | ||||
| 			if v > 0 { | ||||
| 				s.symbolLen = uint16(i) + 1 | ||||
| 				if i >= len(s.prevTable) { | ||||
| 					reuse = false | ||||
| 				} else { | ||||
| 					if s.prevTable[i].nBits == 0 { | ||||
| 						reuse = false | ||||
| 					} | ||||
| 				} | ||||
| 			s.symbolLen = uint16(i) + 1 | ||||
| 			if i >= len(s.prevTable) { | ||||
| 				reuse = false | ||||
| 			} else if s.prevTable[i].nBits == 0 { | ||||
| 				reuse = false | ||||
| 			} | ||||
| 		} | ||||
| 		return int(m), reuse | ||||
| 	} | ||||
| 	for i, v := range s.count[:] { | ||||
| 		if v == 0 { | ||||
| 			continue | ||||
| 		} | ||||
| 		if v > m { | ||||
| 			m = v | ||||
| 		} | ||||
| 		if v > 0 { | ||||
| 			s.symbolLen = uint16(i) + 1 | ||||
| 		} | ||||
| 		s.symbolLen = uint16(i) + 1 | ||||
| 	} | ||||
| 	return int(m), false | ||||
| } | ||||
|   | ||||
							
								
								
									
										5
									
								
								vendor/github.com/klauspost/compress/zstd/blockdec.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								vendor/github.com/klauspost/compress/zstd/blockdec.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -82,8 +82,9 @@ type blockDec struct { | ||||
|  | ||||
| 	err error | ||||
|  | ||||
| 	// Check against this crc | ||||
| 	checkCRC []byte | ||||
| 	// Check against this crc, if hasCRC is true. | ||||
| 	checkCRC uint32 | ||||
| 	hasCRC   bool | ||||
|  | ||||
| 	// Frame to use for singlethreaded decoding. | ||||
| 	// Should not be used by the decoder itself since parent may be another frame. | ||||
|   | ||||
							
								
								
									
										5
									
								
								vendor/github.com/klauspost/compress/zstd/decodeheader.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								vendor/github.com/klauspost/compress/zstd/decodeheader.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -4,7 +4,6 @@ | ||||
| package zstd | ||||
|  | ||||
| import ( | ||||
| 	"bytes" | ||||
| 	"encoding/binary" | ||||
| 	"errors" | ||||
| 	"io" | ||||
| @@ -102,8 +101,8 @@ func (h *Header) Decode(in []byte) error { | ||||
| 	} | ||||
| 	h.HeaderSize += 4 | ||||
| 	b, in := in[:4], in[4:] | ||||
| 	if !bytes.Equal(b, frameMagic) { | ||||
| 		if !bytes.Equal(b[1:4], skippableFrameMagic) || b[0]&0xf0 != 0x50 { | ||||
| 	if string(b) != frameMagic { | ||||
| 		if string(b[1:4]) != skippableFrameMagic || b[0]&0xf0 != 0x50 { | ||||
| 			return ErrMagicMismatch | ||||
| 		} | ||||
| 		if len(in) < 4 { | ||||
|   | ||||
							
								
								
									
										39
									
								
								vendor/github.com/klauspost/compress/zstd/decoder.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										39
									
								
								vendor/github.com/klauspost/compress/zstd/decoder.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -5,7 +5,6 @@ | ||||
| package zstd | ||||
|  | ||||
| import ( | ||||
| 	"bytes" | ||||
| 	"context" | ||||
| 	"encoding/binary" | ||||
| 	"io" | ||||
| @@ -459,7 +458,11 @@ func (d *Decoder) nextBlock(blocking bool) (ok bool) { | ||||
| 		println("got", len(d.current.b), "bytes, error:", d.current.err, "data crc:", tmp) | ||||
| 	} | ||||
|  | ||||
| 	if !d.o.ignoreChecksum && len(next.b) > 0 { | ||||
| 	if d.o.ignoreChecksum { | ||||
| 		return true | ||||
| 	} | ||||
|  | ||||
| 	if len(next.b) > 0 { | ||||
| 		n, err := d.current.crc.Write(next.b) | ||||
| 		if err == nil { | ||||
| 			if n != len(next.b) { | ||||
| @@ -467,18 +470,16 @@ func (d *Decoder) nextBlock(blocking bool) (ok bool) { | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 	if next.err == nil && next.d != nil && len(next.d.checkCRC) != 0 { | ||||
| 		got := d.current.crc.Sum64() | ||||
| 		var tmp [4]byte | ||||
| 		binary.LittleEndian.PutUint32(tmp[:], uint32(got)) | ||||
| 		if !d.o.ignoreChecksum && !bytes.Equal(tmp[:], next.d.checkCRC) { | ||||
| 	if next.err == nil && next.d != nil && next.d.hasCRC { | ||||
| 		got := uint32(d.current.crc.Sum64()) | ||||
| 		if got != next.d.checkCRC { | ||||
| 			if debugDecoder { | ||||
| 				println("CRC Check Failed:", tmp[:], " (got) !=", next.d.checkCRC, "(on stream)") | ||||
| 				printf("CRC Check Failed: %08x (got) != %08x (on stream)\n", got, next.d.checkCRC) | ||||
| 			} | ||||
| 			d.current.err = ErrCRCMismatch | ||||
| 		} else { | ||||
| 			if debugDecoder { | ||||
| 				println("CRC ok", tmp[:]) | ||||
| 				printf("CRC ok %08x\n", got) | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| @@ -918,18 +919,22 @@ decodeStream: | ||||
| 				println("next block returned error:", err) | ||||
| 			} | ||||
| 			dec.err = err | ||||
| 			dec.checkCRC = nil | ||||
| 			dec.hasCRC = false | ||||
| 			if dec.Last && frame.HasCheckSum && err == nil { | ||||
| 				crc, err := frame.rawInput.readSmall(4) | ||||
| 				if err != nil { | ||||
| 				if len(crc) < 4 { | ||||
| 					if err == nil { | ||||
| 						err = io.ErrUnexpectedEOF | ||||
|  | ||||
| 					} | ||||
| 					println("CRC missing?", err) | ||||
| 					dec.err = err | ||||
| 				} | ||||
| 				var tmp [4]byte | ||||
| 				copy(tmp[:], crc) | ||||
| 				dec.checkCRC = tmp[:] | ||||
| 				if debugDecoder { | ||||
| 					println("found crc to check:", dec.checkCRC) | ||||
| 				} else { | ||||
| 					dec.checkCRC = binary.LittleEndian.Uint32(crc) | ||||
| 					dec.hasCRC = true | ||||
| 					if debugDecoder { | ||||
| 						printf("found crc to check: %08x\n", dec.checkCRC) | ||||
| 					} | ||||
| 				} | ||||
| 			} | ||||
| 			err = dec.err | ||||
|   | ||||
							
								
								
									
										5
									
								
								vendor/github.com/klauspost/compress/zstd/dict.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								vendor/github.com/klauspost/compress/zstd/dict.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,7 +1,6 @@ | ||||
| package zstd | ||||
|  | ||||
| import ( | ||||
| 	"bytes" | ||||
| 	"encoding/binary" | ||||
| 	"errors" | ||||
| 	"fmt" | ||||
| @@ -20,7 +19,7 @@ type dict struct { | ||||
| 	content []byte | ||||
| } | ||||
|  | ||||
| var dictMagic = [4]byte{0x37, 0xa4, 0x30, 0xec} | ||||
| const dictMagic = "\x37\xa4\x30\xec" | ||||
|  | ||||
| // ID returns the dictionary id or 0 if d is nil. | ||||
| func (d *dict) ID() uint32 { | ||||
| @@ -50,7 +49,7 @@ func loadDict(b []byte) (*dict, error) { | ||||
| 		ofDec: sequenceDec{fse: &fseDecoder{}}, | ||||
| 		mlDec: sequenceDec{fse: &fseDecoder{}}, | ||||
| 	} | ||||
| 	if !bytes.Equal(b[:4], dictMagic[:]) { | ||||
| 	if string(b[:4]) != dictMagic { | ||||
| 		return nil, ErrMagicMismatch | ||||
| 	} | ||||
| 	d.id = binary.LittleEndian.Uint32(b[4:8]) | ||||
|   | ||||
							
								
								
									
										26
									
								
								vendor/github.com/klauspost/compress/zstd/enc_base.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										26
									
								
								vendor/github.com/klauspost/compress/zstd/enc_base.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -16,6 +16,7 @@ type fastBase struct { | ||||
| 	cur int32 | ||||
| 	// maximum offset. Should be at least 2x block size. | ||||
| 	maxMatchOff int32 | ||||
| 	bufferReset int32 | ||||
| 	hist        []byte | ||||
| 	crc         *xxhash.Digest | ||||
| 	tmp         [8]byte | ||||
| @@ -56,8 +57,8 @@ func (e *fastBase) Block() *blockEnc { | ||||
| } | ||||
|  | ||||
| func (e *fastBase) addBlock(src []byte) int32 { | ||||
| 	if debugAsserts && e.cur > bufferReset { | ||||
| 		panic(fmt.Sprintf("ecur (%d) > buffer reset (%d)", e.cur, bufferReset)) | ||||
| 	if debugAsserts && e.cur > e.bufferReset { | ||||
| 		panic(fmt.Sprintf("ecur (%d) > buffer reset (%d)", e.cur, e.bufferReset)) | ||||
| 	} | ||||
| 	// check if we have space already | ||||
| 	if len(e.hist)+len(src) > cap(e.hist) { | ||||
| @@ -126,24 +127,7 @@ func (e *fastBase) matchlen(s, t int32, src []byte) int32 { | ||||
| 			panic(fmt.Sprintf("len(src)-s (%d) > maxCompressedBlockSize (%d)", len(src)-int(s), maxCompressedBlockSize)) | ||||
| 		} | ||||
| 	} | ||||
| 	a := src[s:] | ||||
| 	b := src[t:] | ||||
| 	b = b[:len(a)] | ||||
| 	end := int32((len(a) >> 3) << 3) | ||||
| 	for i := int32(0); i < end; i += 8 { | ||||
| 		if diff := load6432(a, i) ^ load6432(b, i); diff != 0 { | ||||
| 			return i + int32(bits.TrailingZeros64(diff)>>3) | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	a = a[end:] | ||||
| 	b = b[end:] | ||||
| 	for i := range a { | ||||
| 		if a[i] != b[i] { | ||||
| 			return int32(i) + end | ||||
| 		} | ||||
| 	} | ||||
| 	return int32(len(a)) + end | ||||
| 	return int32(matchLen(src[s:], src[t:])) | ||||
| } | ||||
|  | ||||
| // Reset the encoding table. | ||||
| @@ -171,7 +155,7 @@ func (e *fastBase) resetBase(d *dict, singleBlock bool) { | ||||
|  | ||||
| 	// We offset current position so everything will be out of reach. | ||||
| 	// If above reset line, history will be purged. | ||||
| 	if e.cur < bufferReset { | ||||
| 	if e.cur < e.bufferReset { | ||||
| 		e.cur += e.maxMatchOff + int32(len(e.hist)) | ||||
| 	} | ||||
| 	e.hist = e.hist[:0] | ||||
|   | ||||
							
								
								
									
										63
									
								
								vendor/github.com/klauspost/compress/zstd/enc_best.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										63
									
								
								vendor/github.com/klauspost/compress/zstd/enc_best.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -85,14 +85,10 @@ func (e *bestFastEncoder) Encode(blk *blockEnc, src []byte) { | ||||
| 	) | ||||
|  | ||||
| 	// Protect against e.cur wraparound. | ||||
| 	for e.cur >= bufferReset { | ||||
| 	for e.cur >= e.bufferReset-int32(len(e.hist)) { | ||||
| 		if len(e.hist) == 0 { | ||||
| 			for i := range e.table[:] { | ||||
| 				e.table[i] = prevEntry{} | ||||
| 			} | ||||
| 			for i := range e.longTable[:] { | ||||
| 				e.longTable[i] = prevEntry{} | ||||
| 			} | ||||
| 			e.table = [bestShortTableSize]prevEntry{} | ||||
| 			e.longTable = [bestLongTableSize]prevEntry{} | ||||
| 			e.cur = e.maxMatchOff | ||||
| 			break | ||||
| 		} | ||||
| @@ -193,8 +189,8 @@ encodeLoop: | ||||
| 			panic("offset0 was 0") | ||||
| 		} | ||||
|  | ||||
| 		bestOf := func(a, b match) match { | ||||
| 			if a.est+(a.s-b.s)*bitsPerByte>>10 < b.est+(b.s-a.s)*bitsPerByte>>10 { | ||||
| 		bestOf := func(a, b *match) *match { | ||||
| 			if a.est-b.est+(a.s-b.s)*bitsPerByte>>10 < 0 { | ||||
| 				return a | ||||
| 			} | ||||
| 			return b | ||||
| @@ -220,22 +216,26 @@ encodeLoop: | ||||
| 			return m | ||||
| 		} | ||||
|  | ||||
| 		best := bestOf(matchAt(candidateL.offset-e.cur, s, uint32(cv), -1), matchAt(candidateL.prev-e.cur, s, uint32(cv), -1)) | ||||
| 		best = bestOf(best, matchAt(candidateS.offset-e.cur, s, uint32(cv), -1)) | ||||
| 		best = bestOf(best, matchAt(candidateS.prev-e.cur, s, uint32(cv), -1)) | ||||
| 		m1 := matchAt(candidateL.offset-e.cur, s, uint32(cv), -1) | ||||
| 		m2 := matchAt(candidateL.prev-e.cur, s, uint32(cv), -1) | ||||
| 		m3 := matchAt(candidateS.offset-e.cur, s, uint32(cv), -1) | ||||
| 		m4 := matchAt(candidateS.prev-e.cur, s, uint32(cv), -1) | ||||
| 		best := bestOf(bestOf(&m1, &m2), bestOf(&m3, &m4)) | ||||
|  | ||||
| 		if canRepeat && best.length < goodEnough { | ||||
| 			cv32 := uint32(cv >> 8) | ||||
| 			spp := s + 1 | ||||
| 			best = bestOf(best, matchAt(spp-offset1, spp, cv32, 1)) | ||||
| 			best = bestOf(best, matchAt(spp-offset2, spp, cv32, 2)) | ||||
| 			best = bestOf(best, matchAt(spp-offset3, spp, cv32, 3)) | ||||
| 			m1 := matchAt(spp-offset1, spp, cv32, 1) | ||||
| 			m2 := matchAt(spp-offset2, spp, cv32, 2) | ||||
| 			m3 := matchAt(spp-offset3, spp, cv32, 3) | ||||
| 			best = bestOf(bestOf(best, &m1), bestOf(&m2, &m3)) | ||||
| 			if best.length > 0 { | ||||
| 				cv32 = uint32(cv >> 24) | ||||
| 				spp += 2 | ||||
| 				best = bestOf(best, matchAt(spp-offset1, spp, cv32, 1)) | ||||
| 				best = bestOf(best, matchAt(spp-offset2, spp, cv32, 2)) | ||||
| 				best = bestOf(best, matchAt(spp-offset3, spp, cv32, 3)) | ||||
| 				m1 := matchAt(spp-offset1, spp, cv32, 1) | ||||
| 				m2 := matchAt(spp-offset2, spp, cv32, 2) | ||||
| 				m3 := matchAt(spp-offset3, spp, cv32, 3) | ||||
| 				best = bestOf(bestOf(best, &m1), bestOf(&m2, &m3)) | ||||
| 			} | ||||
| 		} | ||||
| 		// Load next and check... | ||||
| @@ -262,26 +262,33 @@ encodeLoop: | ||||
| 			candidateL2 := e.longTable[hashLen(cv2, bestLongTableBits, bestLongLen)] | ||||
|  | ||||
| 			// Short at s+1 | ||||
| 			best = bestOf(best, matchAt(candidateS.offset-e.cur, s, uint32(cv), -1)) | ||||
| 			m1 := matchAt(candidateS.offset-e.cur, s, uint32(cv), -1) | ||||
| 			// Long at s+1, s+2 | ||||
| 			best = bestOf(best, matchAt(candidateL.offset-e.cur, s, uint32(cv), -1)) | ||||
| 			best = bestOf(best, matchAt(candidateL.prev-e.cur, s, uint32(cv), -1)) | ||||
| 			best = bestOf(best, matchAt(candidateL2.offset-e.cur, s+1, uint32(cv2), -1)) | ||||
| 			best = bestOf(best, matchAt(candidateL2.prev-e.cur, s+1, uint32(cv2), -1)) | ||||
| 			m2 := matchAt(candidateL.offset-e.cur, s, uint32(cv), -1) | ||||
| 			m3 := matchAt(candidateL.prev-e.cur, s, uint32(cv), -1) | ||||
| 			m4 := matchAt(candidateL2.offset-e.cur, s+1, uint32(cv2), -1) | ||||
| 			m5 := matchAt(candidateL2.prev-e.cur, s+1, uint32(cv2), -1) | ||||
| 			best = bestOf(bestOf(bestOf(best, &m1), &m2), bestOf(bestOf(&m3, &m4), &m5)) | ||||
| 			if false { | ||||
| 				// Short at s+3. | ||||
| 				// Too often worse... | ||||
| 				best = bestOf(best, matchAt(e.table[hashLen(cv2>>8, bestShortTableBits, bestShortLen)].offset-e.cur, s+2, uint32(cv2>>8), -1)) | ||||
| 				m := matchAt(e.table[hashLen(cv2>>8, bestShortTableBits, bestShortLen)].offset-e.cur, s+2, uint32(cv2>>8), -1) | ||||
| 				best = bestOf(best, &m) | ||||
| 			} | ||||
| 			// See if we can find a better match by checking where the current best ends. | ||||
| 			// Use that offset to see if we can find a better full match. | ||||
| 			if sAt := best.s + best.length; sAt < sLimit { | ||||
| 				nextHashL := hashLen(load6432(src, sAt), bestLongTableBits, bestLongLen) | ||||
| 				candidateEnd := e.longTable[nextHashL] | ||||
| 				if pos := candidateEnd.offset - e.cur - best.length; pos >= 0 { | ||||
| 					bestEnd := bestOf(best, matchAt(pos, best.s, load3232(src, best.s), -1)) | ||||
| 					if pos := candidateEnd.prev - e.cur - best.length; pos >= 0 { | ||||
| 						bestEnd = bestOf(bestEnd, matchAt(pos, best.s, load3232(src, best.s), -1)) | ||||
| 				// Start check at a fixed offset to allow for a few mismatches. | ||||
| 				// For this compression level 2 yields the best results. | ||||
| 				const skipBeginning = 2 | ||||
| 				if pos := candidateEnd.offset - e.cur - best.length + skipBeginning; pos >= 0 { | ||||
| 					m := matchAt(pos, best.s+skipBeginning, load3232(src, best.s+skipBeginning), -1) | ||||
| 					bestEnd := bestOf(best, &m) | ||||
| 					if pos := candidateEnd.prev - e.cur - best.length + skipBeginning; pos >= 0 { | ||||
| 						m := matchAt(pos, best.s+skipBeginning, load3232(src, best.s+skipBeginning), -1) | ||||
| 						bestEnd = bestOf(bestEnd, &m) | ||||
| 					} | ||||
| 					best = bestEnd | ||||
| 				} | ||||
|   | ||||
							
								
								
									
										12
									
								
								vendor/github.com/klauspost/compress/zstd/enc_better.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								vendor/github.com/klauspost/compress/zstd/enc_better.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -62,14 +62,10 @@ func (e *betterFastEncoder) Encode(blk *blockEnc, src []byte) { | ||||
| 	) | ||||
|  | ||||
| 	// Protect against e.cur wraparound. | ||||
| 	for e.cur >= bufferReset { | ||||
| 	for e.cur >= e.bufferReset-int32(len(e.hist)) { | ||||
| 		if len(e.hist) == 0 { | ||||
| 			for i := range e.table[:] { | ||||
| 				e.table[i] = tableEntry{} | ||||
| 			} | ||||
| 			for i := range e.longTable[:] { | ||||
| 				e.longTable[i] = prevEntry{} | ||||
| 			} | ||||
| 			e.table = [betterShortTableSize]tableEntry{} | ||||
| 			e.longTable = [betterLongTableSize]prevEntry{} | ||||
| 			e.cur = e.maxMatchOff | ||||
| 			break | ||||
| 		} | ||||
| @@ -587,7 +583,7 @@ func (e *betterFastEncoderDict) Encode(blk *blockEnc, src []byte) { | ||||
| 	) | ||||
|  | ||||
| 	// Protect against e.cur wraparound. | ||||
| 	for e.cur >= bufferReset { | ||||
| 	for e.cur >= e.bufferReset-int32(len(e.hist)) { | ||||
| 		if len(e.hist) == 0 { | ||||
| 			for i := range e.table[:] { | ||||
| 				e.table[i] = tableEntry{} | ||||
|   | ||||
							
								
								
									
										16
									
								
								vendor/github.com/klauspost/compress/zstd/enc_dfast.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										16
									
								
								vendor/github.com/klauspost/compress/zstd/enc_dfast.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -44,14 +44,10 @@ func (e *doubleFastEncoder) Encode(blk *blockEnc, src []byte) { | ||||
| 	) | ||||
|  | ||||
| 	// Protect against e.cur wraparound. | ||||
| 	for e.cur >= bufferReset { | ||||
| 	for e.cur >= e.bufferReset-int32(len(e.hist)) { | ||||
| 		if len(e.hist) == 0 { | ||||
| 			for i := range e.table[:] { | ||||
| 				e.table[i] = tableEntry{} | ||||
| 			} | ||||
| 			for i := range e.longTable[:] { | ||||
| 				e.longTable[i] = tableEntry{} | ||||
| 			} | ||||
| 			e.table = [dFastShortTableSize]tableEntry{} | ||||
| 			e.longTable = [dFastLongTableSize]tableEntry{} | ||||
| 			e.cur = e.maxMatchOff | ||||
| 			break | ||||
| 		} | ||||
| @@ -388,7 +384,7 @@ func (e *doubleFastEncoder) EncodeNoHist(blk *blockEnc, src []byte) { | ||||
| 	) | ||||
|  | ||||
| 	// Protect against e.cur wraparound. | ||||
| 	if e.cur >= bufferReset { | ||||
| 	if e.cur >= e.bufferReset { | ||||
| 		for i := range e.table[:] { | ||||
| 			e.table[i] = tableEntry{} | ||||
| 		} | ||||
| @@ -685,7 +681,7 @@ encodeLoop: | ||||
| 	} | ||||
|  | ||||
| 	// We do not store history, so we must offset e.cur to avoid false matches for next user. | ||||
| 	if e.cur < bufferReset { | ||||
| 	if e.cur < e.bufferReset { | ||||
| 		e.cur += int32(len(src)) | ||||
| 	} | ||||
| } | ||||
| @@ -700,7 +696,7 @@ func (e *doubleFastEncoderDict) Encode(blk *blockEnc, src []byte) { | ||||
| 	) | ||||
|  | ||||
| 	// Protect against e.cur wraparound. | ||||
| 	for e.cur >= bufferReset { | ||||
| 	for e.cur >= e.bufferReset-int32(len(e.hist)) { | ||||
| 		if len(e.hist) == 0 { | ||||
| 			for i := range e.table[:] { | ||||
| 				e.table[i] = tableEntry{} | ||||
|   | ||||
							
								
								
									
										12
									
								
								vendor/github.com/klauspost/compress/zstd/enc_fast.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								vendor/github.com/klauspost/compress/zstd/enc_fast.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -43,7 +43,7 @@ func (e *fastEncoder) Encode(blk *blockEnc, src []byte) { | ||||
| 	) | ||||
|  | ||||
| 	// Protect against e.cur wraparound. | ||||
| 	for e.cur >= bufferReset { | ||||
| 	for e.cur >= e.bufferReset-int32(len(e.hist)) { | ||||
| 		if len(e.hist) == 0 { | ||||
| 			for i := range e.table[:] { | ||||
| 				e.table[i] = tableEntry{} | ||||
| @@ -310,7 +310,7 @@ func (e *fastEncoder) EncodeNoHist(blk *blockEnc, src []byte) { | ||||
| 	} | ||||
|  | ||||
| 	// Protect against e.cur wraparound. | ||||
| 	if e.cur >= bufferReset { | ||||
| 	if e.cur >= e.bufferReset { | ||||
| 		for i := range e.table[:] { | ||||
| 			e.table[i] = tableEntry{} | ||||
| 		} | ||||
| @@ -538,7 +538,7 @@ encodeLoop: | ||||
| 		println("returning, recent offsets:", blk.recentOffsets, "extra literals:", blk.extraLits) | ||||
| 	} | ||||
| 	// We do not store history, so we must offset e.cur to avoid false matches for next user. | ||||
| 	if e.cur < bufferReset { | ||||
| 	if e.cur < e.bufferReset { | ||||
| 		e.cur += int32(len(src)) | ||||
| 	} | ||||
| } | ||||
| @@ -555,11 +555,9 @@ func (e *fastEncoderDict) Encode(blk *blockEnc, src []byte) { | ||||
| 		return | ||||
| 	} | ||||
| 	// Protect against e.cur wraparound. | ||||
| 	for e.cur >= bufferReset { | ||||
| 	for e.cur >= e.bufferReset-int32(len(e.hist)) { | ||||
| 		if len(e.hist) == 0 { | ||||
| 			for i := range e.table[:] { | ||||
| 				e.table[i] = tableEntry{} | ||||
| 			} | ||||
| 			e.table = [tableSize]tableEntry{} | ||||
| 			e.cur = e.maxMatchOff | ||||
| 			break | ||||
| 		} | ||||
|   | ||||
							
								
								
									
										35
									
								
								vendor/github.com/klauspost/compress/zstd/encoder.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										35
									
								
								vendor/github.com/klauspost/compress/zstd/encoder.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -8,6 +8,7 @@ import ( | ||||
| 	"crypto/rand" | ||||
| 	"fmt" | ||||
| 	"io" | ||||
| 	"math" | ||||
| 	rdebug "runtime/debug" | ||||
| 	"sync" | ||||
|  | ||||
| @@ -639,3 +640,37 @@ func (e *Encoder) EncodeAll(src, dst []byte) []byte { | ||||
| 	} | ||||
| 	return dst | ||||
| } | ||||
|  | ||||
| // MaxEncodedSize returns the expected maximum | ||||
| // size of an encoded block or stream. | ||||
| func (e *Encoder) MaxEncodedSize(size int) int { | ||||
| 	frameHeader := 4 + 2 // magic + frame header & window descriptor | ||||
| 	if e.o.dict != nil { | ||||
| 		frameHeader += 4 | ||||
| 	} | ||||
| 	// Frame content size: | ||||
| 	if size < 256 { | ||||
| 		frameHeader++ | ||||
| 	} else if size < 65536+256 { | ||||
| 		frameHeader += 2 | ||||
| 	} else if size < math.MaxInt32 { | ||||
| 		frameHeader += 4 | ||||
| 	} else { | ||||
| 		frameHeader += 8 | ||||
| 	} | ||||
| 	// Final crc | ||||
| 	if e.o.crc { | ||||
| 		frameHeader += 4 | ||||
| 	} | ||||
|  | ||||
| 	// Max overhead is 3 bytes/block. | ||||
| 	// There cannot be 0 blocks. | ||||
| 	blocks := (size + e.o.blockSize) / e.o.blockSize | ||||
|  | ||||
| 	// Combine, add padding. | ||||
| 	maxSz := frameHeader + 3*blocks + size | ||||
| 	if e.o.pad > 1 { | ||||
| 		maxSz += calcSkippableFrame(int64(maxSz), int64(e.o.pad)) | ||||
| 	} | ||||
| 	return maxSz | ||||
| } | ||||
|   | ||||
							
								
								
									
										15
									
								
								vendor/github.com/klauspost/compress/zstd/encoder_options.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										15
									
								
								vendor/github.com/klauspost/compress/zstd/encoder_options.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -3,6 +3,7 @@ package zstd | ||||
| import ( | ||||
| 	"errors" | ||||
| 	"fmt" | ||||
| 	"math" | ||||
| 	"runtime" | ||||
| 	"strings" | ||||
| ) | ||||
| @@ -47,22 +48,22 @@ func (o encoderOptions) encoder() encoder { | ||||
| 	switch o.level { | ||||
| 	case SpeedFastest: | ||||
| 		if o.dict != nil { | ||||
| 			return &fastEncoderDict{fastEncoder: fastEncoder{fastBase: fastBase{maxMatchOff: int32(o.windowSize), lowMem: o.lowMem}}} | ||||
| 			return &fastEncoderDict{fastEncoder: fastEncoder{fastBase: fastBase{maxMatchOff: int32(o.windowSize), bufferReset: math.MaxInt32 - int32(o.windowSize*2), lowMem: o.lowMem}}} | ||||
| 		} | ||||
| 		return &fastEncoder{fastBase: fastBase{maxMatchOff: int32(o.windowSize), lowMem: o.lowMem}} | ||||
| 		return &fastEncoder{fastBase: fastBase{maxMatchOff: int32(o.windowSize), bufferReset: math.MaxInt32 - int32(o.windowSize*2), lowMem: o.lowMem}} | ||||
|  | ||||
| 	case SpeedDefault: | ||||
| 		if o.dict != nil { | ||||
| 			return &doubleFastEncoderDict{fastEncoderDict: fastEncoderDict{fastEncoder: fastEncoder{fastBase: fastBase{maxMatchOff: int32(o.windowSize), lowMem: o.lowMem}}}} | ||||
| 			return &doubleFastEncoderDict{fastEncoderDict: fastEncoderDict{fastEncoder: fastEncoder{fastBase: fastBase{maxMatchOff: int32(o.windowSize), bufferReset: math.MaxInt32 - int32(o.windowSize*2), lowMem: o.lowMem}}}} | ||||
| 		} | ||||
| 		return &doubleFastEncoder{fastEncoder: fastEncoder{fastBase: fastBase{maxMatchOff: int32(o.windowSize), lowMem: o.lowMem}}} | ||||
| 		return &doubleFastEncoder{fastEncoder: fastEncoder{fastBase: fastBase{maxMatchOff: int32(o.windowSize), bufferReset: math.MaxInt32 - int32(o.windowSize*2), lowMem: o.lowMem}}} | ||||
| 	case SpeedBetterCompression: | ||||
| 		if o.dict != nil { | ||||
| 			return &betterFastEncoderDict{betterFastEncoder: betterFastEncoder{fastBase: fastBase{maxMatchOff: int32(o.windowSize), lowMem: o.lowMem}}} | ||||
| 			return &betterFastEncoderDict{betterFastEncoder: betterFastEncoder{fastBase: fastBase{maxMatchOff: int32(o.windowSize), bufferReset: math.MaxInt32 - int32(o.windowSize*2), lowMem: o.lowMem}}} | ||||
| 		} | ||||
| 		return &betterFastEncoder{fastBase: fastBase{maxMatchOff: int32(o.windowSize), lowMem: o.lowMem}} | ||||
| 		return &betterFastEncoder{fastBase: fastBase{maxMatchOff: int32(o.windowSize), bufferReset: math.MaxInt32 - int32(o.windowSize*2), lowMem: o.lowMem}} | ||||
| 	case SpeedBestCompression: | ||||
| 		return &bestFastEncoder{fastBase: fastBase{maxMatchOff: int32(o.windowSize), lowMem: o.lowMem}} | ||||
| 		return &bestFastEncoder{fastBase: fastBase{maxMatchOff: int32(o.windowSize), bufferReset: math.MaxInt32 - int32(o.windowSize*2), lowMem: o.lowMem}} | ||||
| 	} | ||||
| 	panic("unknown compression level") | ||||
| } | ||||
|   | ||||
							
								
								
									
										33
									
								
								vendor/github.com/klauspost/compress/zstd/framedec.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										33
									
								
								vendor/github.com/klauspost/compress/zstd/framedec.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -5,7 +5,7 @@ | ||||
| package zstd | ||||
|  | ||||
| import ( | ||||
| 	"bytes" | ||||
| 	"encoding/binary" | ||||
| 	"encoding/hex" | ||||
| 	"errors" | ||||
| 	"io" | ||||
| @@ -43,9 +43,9 @@ const ( | ||||
| 	MaxWindowSize = 1 << 29 | ||||
| ) | ||||
|  | ||||
| var ( | ||||
| 	frameMagic          = []byte{0x28, 0xb5, 0x2f, 0xfd} | ||||
| 	skippableFrameMagic = []byte{0x2a, 0x4d, 0x18} | ||||
| const ( | ||||
| 	frameMagic          = "\x28\xb5\x2f\xfd" | ||||
| 	skippableFrameMagic = "\x2a\x4d\x18" | ||||
| ) | ||||
|  | ||||
| func newFrameDec(o decoderOptions) *frameDec { | ||||
| @@ -89,9 +89,9 @@ func (d *frameDec) reset(br byteBuffer) error { | ||||
| 			copy(signature[1:], b) | ||||
| 		} | ||||
|  | ||||
| 		if !bytes.Equal(signature[1:4], skippableFrameMagic) || signature[0]&0xf0 != 0x50 { | ||||
| 		if string(signature[1:4]) != skippableFrameMagic || signature[0]&0xf0 != 0x50 { | ||||
| 			if debugDecoder { | ||||
| 				println("Not skippable", hex.EncodeToString(signature[:]), hex.EncodeToString(skippableFrameMagic)) | ||||
| 				println("Not skippable", hex.EncodeToString(signature[:]), hex.EncodeToString([]byte(skippableFrameMagic))) | ||||
| 			} | ||||
| 			// Break if not skippable frame. | ||||
| 			break | ||||
| @@ -114,9 +114,9 @@ func (d *frameDec) reset(br byteBuffer) error { | ||||
| 			return err | ||||
| 		} | ||||
| 	} | ||||
| 	if !bytes.Equal(signature[:], frameMagic) { | ||||
| 	if string(signature[:]) != frameMagic { | ||||
| 		if debugDecoder { | ||||
| 			println("Got magic numbers: ", signature, "want:", frameMagic) | ||||
| 			println("Got magic numbers: ", signature, "want:", []byte(frameMagic)) | ||||
| 		} | ||||
| 		return ErrMagicMismatch | ||||
| 	} | ||||
| @@ -305,7 +305,7 @@ func (d *frameDec) checkCRC() error { | ||||
| 	} | ||||
|  | ||||
| 	// We can overwrite upper tmp now | ||||
| 	want, err := d.rawInput.readSmall(4) | ||||
| 	buf, err := d.rawInput.readSmall(4) | ||||
| 	if err != nil { | ||||
| 		println("CRC missing?", err) | ||||
| 		return err | ||||
| @@ -315,22 +315,17 @@ func (d *frameDec) checkCRC() error { | ||||
| 		return nil | ||||
| 	} | ||||
|  | ||||
| 	var tmp [4]byte | ||||
| 	got := d.crc.Sum64() | ||||
| 	// Flip to match file order. | ||||
| 	tmp[0] = byte(got >> 0) | ||||
| 	tmp[1] = byte(got >> 8) | ||||
| 	tmp[2] = byte(got >> 16) | ||||
| 	tmp[3] = byte(got >> 24) | ||||
| 	want := binary.LittleEndian.Uint32(buf[:4]) | ||||
| 	got := uint32(d.crc.Sum64()) | ||||
|  | ||||
| 	if !bytes.Equal(tmp[:], want) { | ||||
| 	if got != want { | ||||
| 		if debugDecoder { | ||||
| 			println("CRC Check Failed:", tmp[:], "!=", want) | ||||
| 			printf("CRC check failed: got %08x, want %08x\n", got, want) | ||||
| 		} | ||||
| 		return ErrCRCMismatch | ||||
| 	} | ||||
| 	if debugDecoder { | ||||
| 		println("CRC ok", tmp[:]) | ||||
| 		printf("CRC ok %08x\n", got) | ||||
| 	} | ||||
| 	return nil | ||||
| } | ||||
|   | ||||
							
								
								
									
										49
									
								
								vendor/github.com/klauspost/compress/zstd/internal/xxhash/README.md
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										49
									
								
								vendor/github.com/klauspost/compress/zstd/internal/xxhash/README.md
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -2,12 +2,7 @@ | ||||
|  | ||||
| VENDORED: Go to [github.com/cespare/xxhash](https://github.com/cespare/xxhash) for original package. | ||||
|  | ||||
|  | ||||
| [](https://godoc.org/github.com/cespare/xxhash) | ||||
| [](https://travis-ci.org/cespare/xxhash) | ||||
|  | ||||
| xxhash is a Go implementation of the 64-bit | ||||
| [xxHash](http://cyan4973.github.io/xxHash/) algorithm, XXH64. This is a | ||||
| xxhash is a Go implementation of the 64-bit [xxHash] algorithm, XXH64. This is a | ||||
| high-quality hashing algorithm that is much faster than anything in the Go | ||||
| standard library. | ||||
|  | ||||
| @@ -28,31 +23,49 @@ func (*Digest) WriteString(string) (int, error) | ||||
| func (*Digest) Sum64() uint64 | ||||
| ``` | ||||
|  | ||||
| This implementation provides a fast pure-Go implementation and an even faster | ||||
| assembly implementation for amd64. | ||||
| The package is written with optimized pure Go and also contains even faster | ||||
| assembly implementations for amd64 and arm64. If desired, the `purego` build tag | ||||
| opts into using the Go code even on those architectures. | ||||
|  | ||||
| [xxHash]: http://cyan4973.github.io/xxHash/ | ||||
|  | ||||
| ## Compatibility | ||||
|  | ||||
| This package is in a module and the latest code is in version 2 of the module. | ||||
| You need a version of Go with at least "minimal module compatibility" to use | ||||
| github.com/cespare/xxhash/v2: | ||||
|  | ||||
| * 1.9.7+ for Go 1.9 | ||||
| * 1.10.3+ for Go 1.10 | ||||
| * Go 1.11 or later | ||||
|  | ||||
| I recommend using the latest release of Go. | ||||
|  | ||||
| ## Benchmarks | ||||
|  | ||||
| Here are some quick benchmarks comparing the pure-Go and assembly | ||||
| implementations of Sum64. | ||||
|  | ||||
| | input size | purego | asm | | ||||
| | --- | --- | --- | | ||||
| | 5 B   |  979.66 MB/s |  1291.17 MB/s  | | ||||
| | 100 B | 7475.26 MB/s | 7973.40 MB/s  | | ||||
| | 4 KB  | 17573.46 MB/s | 17602.65 MB/s | | ||||
| | 10 MB | 17131.46 MB/s | 17142.16 MB/s | | ||||
| | input size | purego    | asm       | | ||||
| | ---------- | --------- | --------- | | ||||
| | 4 B        |  1.3 GB/s |  1.2 GB/s | | ||||
| | 16 B       |  2.9 GB/s |  3.5 GB/s | | ||||
| | 100 B      |  6.9 GB/s |  8.1 GB/s | | ||||
| | 4 KB       | 11.7 GB/s | 16.7 GB/s | | ||||
| | 10 MB      | 12.0 GB/s | 17.3 GB/s | | ||||
|  | ||||
| These numbers were generated on Ubuntu 18.04 with an Intel i7-8700K CPU using | ||||
| the following commands under Go 1.11.2: | ||||
| These numbers were generated on Ubuntu 20.04 with an Intel Xeon Platinum 8252C | ||||
| CPU using the following commands under Go 1.19.2: | ||||
|  | ||||
| ``` | ||||
| $ go test -tags purego -benchtime 10s -bench '/xxhash,direct,bytes' | ||||
| $ go test -benchtime 10s -bench '/xxhash,direct,bytes' | ||||
| benchstat <(go test -tags purego -benchtime 500ms -count 15 -bench 'Sum64$') | ||||
| benchstat <(go test -benchtime 500ms -count 15 -bench 'Sum64$') | ||||
| ``` | ||||
|  | ||||
| ## Projects using this package | ||||
|  | ||||
| - [InfluxDB](https://github.com/influxdata/influxdb) | ||||
| - [Prometheus](https://github.com/prometheus/prometheus) | ||||
| - [VictoriaMetrics](https://github.com/VictoriaMetrics/VictoriaMetrics) | ||||
| - [FreeCache](https://github.com/coocood/freecache) | ||||
| - [FastCache](https://github.com/VictoriaMetrics/fastcache) | ||||
|   | ||||
							
								
								
									
										47
									
								
								vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										47
									
								
								vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -18,19 +18,11 @@ const ( | ||||
| 	prime5 uint64 = 2870177450012600261 | ||||
| ) | ||||
|  | ||||
| // NOTE(caleb): I'm using both consts and vars of the primes. Using consts where | ||||
| // possible in the Go code is worth a small (but measurable) performance boost | ||||
| // by avoiding some MOVQs. Vars are needed for the asm and also are useful for | ||||
| // convenience in the Go code in a few places where we need to intentionally | ||||
| // avoid constant arithmetic (e.g., v1 := prime1 + prime2 fails because the | ||||
| // result overflows a uint64). | ||||
| var ( | ||||
| 	prime1v = prime1 | ||||
| 	prime2v = prime2 | ||||
| 	prime3v = prime3 | ||||
| 	prime4v = prime4 | ||||
| 	prime5v = prime5 | ||||
| ) | ||||
| // Store the primes in an array as well. | ||||
| // | ||||
| // The consts are used when possible in Go code to avoid MOVs but we need a | ||||
| // contiguous array of the assembly code. | ||||
| var primes = [...]uint64{prime1, prime2, prime3, prime4, prime5} | ||||
|  | ||||
| // Digest implements hash.Hash64. | ||||
| type Digest struct { | ||||
| @@ -52,10 +44,10 @@ func New() *Digest { | ||||
|  | ||||
| // Reset clears the Digest's state so that it can be reused. | ||||
| func (d *Digest) Reset() { | ||||
| 	d.v1 = prime1v + prime2 | ||||
| 	d.v1 = primes[0] + prime2 | ||||
| 	d.v2 = prime2 | ||||
| 	d.v3 = 0 | ||||
| 	d.v4 = -prime1v | ||||
| 	d.v4 = -primes[0] | ||||
| 	d.total = 0 | ||||
| 	d.n = 0 | ||||
| } | ||||
| @@ -71,21 +63,23 @@ func (d *Digest) Write(b []byte) (n int, err error) { | ||||
| 	n = len(b) | ||||
| 	d.total += uint64(n) | ||||
|  | ||||
| 	memleft := d.mem[d.n&(len(d.mem)-1):] | ||||
|  | ||||
| 	if d.n+n < 32 { | ||||
| 		// This new data doesn't even fill the current block. | ||||
| 		copy(d.mem[d.n:], b) | ||||
| 		copy(memleft, b) | ||||
| 		d.n += n | ||||
| 		return | ||||
| 	} | ||||
|  | ||||
| 	if d.n > 0 { | ||||
| 		// Finish off the partial block. | ||||
| 		copy(d.mem[d.n:], b) | ||||
| 		c := copy(memleft, b) | ||||
| 		d.v1 = round(d.v1, u64(d.mem[0:8])) | ||||
| 		d.v2 = round(d.v2, u64(d.mem[8:16])) | ||||
| 		d.v3 = round(d.v3, u64(d.mem[16:24])) | ||||
| 		d.v4 = round(d.v4, u64(d.mem[24:32])) | ||||
| 		b = b[32-d.n:] | ||||
| 		b = b[c:] | ||||
| 		d.n = 0 | ||||
| 	} | ||||
|  | ||||
| @@ -135,21 +129,20 @@ func (d *Digest) Sum64() uint64 { | ||||
|  | ||||
| 	h += d.total | ||||
|  | ||||
| 	i, end := 0, d.n | ||||
| 	for ; i+8 <= end; i += 8 { | ||||
| 		k1 := round(0, u64(d.mem[i:i+8])) | ||||
| 	b := d.mem[:d.n&(len(d.mem)-1)] | ||||
| 	for ; len(b) >= 8; b = b[8:] { | ||||
| 		k1 := round(0, u64(b[:8])) | ||||
| 		h ^= k1 | ||||
| 		h = rol27(h)*prime1 + prime4 | ||||
| 	} | ||||
| 	if i+4 <= end { | ||||
| 		h ^= uint64(u32(d.mem[i:i+4])) * prime1 | ||||
| 	if len(b) >= 4 { | ||||
| 		h ^= uint64(u32(b[:4])) * prime1 | ||||
| 		h = rol23(h)*prime2 + prime3 | ||||
| 		i += 4 | ||||
| 		b = b[4:] | ||||
| 	} | ||||
| 	for i < end { | ||||
| 		h ^= uint64(d.mem[i]) * prime5 | ||||
| 	for ; len(b) > 0; b = b[1:] { | ||||
| 		h ^= uint64(b[0]) * prime5 | ||||
| 		h = rol11(h) * prime1 | ||||
| 		i++ | ||||
| 	} | ||||
|  | ||||
| 	h ^= h >> 33 | ||||
|   | ||||
							
								
								
									
										308
									
								
								vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_amd64.s
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										308
									
								
								vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_amd64.s
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,3 +1,4 @@ | ||||
| //go:build !appengine && gc && !purego && !noasm | ||||
| // +build !appengine | ||||
| // +build gc | ||||
| // +build !purego | ||||
| @@ -5,212 +6,205 @@ | ||||
|  | ||||
| #include "textflag.h" | ||||
|  | ||||
| // Register allocation: | ||||
| // AX	h | ||||
| // SI	pointer to advance through b | ||||
| // DX	n | ||||
| // BX	loop end | ||||
| // R8	v1, k1 | ||||
| // R9	v2 | ||||
| // R10	v3 | ||||
| // R11	v4 | ||||
| // R12	tmp | ||||
| // R13	prime1v | ||||
| // R14	prime2v | ||||
| // DI	prime4v | ||||
| // Registers: | ||||
| #define h      AX | ||||
| #define d      AX | ||||
| #define p      SI // pointer to advance through b | ||||
| #define n      DX | ||||
| #define end    BX // loop end | ||||
| #define v1     R8 | ||||
| #define v2     R9 | ||||
| #define v3     R10 | ||||
| #define v4     R11 | ||||
| #define x      R12 | ||||
| #define prime1 R13 | ||||
| #define prime2 R14 | ||||
| #define prime4 DI | ||||
|  | ||||
| // round reads from and advances the buffer pointer in SI. | ||||
| // It assumes that R13 has prime1v and R14 has prime2v. | ||||
| #define round(r) \ | ||||
| 	MOVQ  (SI), R12 \ | ||||
| 	ADDQ  $8, SI    \ | ||||
| 	IMULQ R14, R12  \ | ||||
| 	ADDQ  R12, r    \ | ||||
| 	ROLQ  $31, r    \ | ||||
| 	IMULQ R13, r | ||||
| #define round(acc, x) \ | ||||
| 	IMULQ prime2, x   \ | ||||
| 	ADDQ  x, acc      \ | ||||
| 	ROLQ  $31, acc    \ | ||||
| 	IMULQ prime1, acc | ||||
|  | ||||
| // mergeRound applies a merge round on the two registers acc and val. | ||||
| // It assumes that R13 has prime1v, R14 has prime2v, and DI has prime4v. | ||||
| #define mergeRound(acc, val) \ | ||||
| 	IMULQ R14, val \ | ||||
| 	ROLQ  $31, val \ | ||||
| 	IMULQ R13, val \ | ||||
| 	XORQ  val, acc \ | ||||
| 	IMULQ R13, acc \ | ||||
| 	ADDQ  DI, acc | ||||
| // round0 performs the operation x = round(0, x). | ||||
| #define round0(x) \ | ||||
| 	IMULQ prime2, x \ | ||||
| 	ROLQ  $31, x    \ | ||||
| 	IMULQ prime1, x | ||||
|  | ||||
| // mergeRound applies a merge round on the two registers acc and x. | ||||
| // It assumes that prime1, prime2, and prime4 have been loaded. | ||||
| #define mergeRound(acc, x) \ | ||||
| 	round0(x)         \ | ||||
| 	XORQ  x, acc      \ | ||||
| 	IMULQ prime1, acc \ | ||||
| 	ADDQ  prime4, acc | ||||
|  | ||||
| // blockLoop processes as many 32-byte blocks as possible, | ||||
| // updating v1, v2, v3, and v4. It assumes that there is at least one block | ||||
| // to process. | ||||
| #define blockLoop() \ | ||||
| loop:  \ | ||||
| 	MOVQ +0(p), x  \ | ||||
| 	round(v1, x)   \ | ||||
| 	MOVQ +8(p), x  \ | ||||
| 	round(v2, x)   \ | ||||
| 	MOVQ +16(p), x \ | ||||
| 	round(v3, x)   \ | ||||
| 	MOVQ +24(p), x \ | ||||
| 	round(v4, x)   \ | ||||
| 	ADDQ $32, p    \ | ||||
| 	CMPQ p, end    \ | ||||
| 	JLE  loop | ||||
|  | ||||
| // func Sum64(b []byte) uint64 | ||||
| TEXT ·Sum64(SB), NOSPLIT, $0-32 | ||||
| TEXT ·Sum64(SB), NOSPLIT|NOFRAME, $0-32 | ||||
| 	// Load fixed primes. | ||||
| 	MOVQ ·prime1v(SB), R13 | ||||
| 	MOVQ ·prime2v(SB), R14 | ||||
| 	MOVQ ·prime4v(SB), DI | ||||
| 	MOVQ ·primes+0(SB), prime1 | ||||
| 	MOVQ ·primes+8(SB), prime2 | ||||
| 	MOVQ ·primes+24(SB), prime4 | ||||
|  | ||||
| 	// Load slice. | ||||
| 	MOVQ b_base+0(FP), SI | ||||
| 	MOVQ b_len+8(FP), DX | ||||
| 	LEAQ (SI)(DX*1), BX | ||||
| 	MOVQ b_base+0(FP), p | ||||
| 	MOVQ b_len+8(FP), n | ||||
| 	LEAQ (p)(n*1), end | ||||
|  | ||||
| 	// The first loop limit will be len(b)-32. | ||||
| 	SUBQ $32, BX | ||||
| 	SUBQ $32, end | ||||
|  | ||||
| 	// Check whether we have at least one block. | ||||
| 	CMPQ DX, $32 | ||||
| 	CMPQ n, $32 | ||||
| 	JLT  noBlocks | ||||
|  | ||||
| 	// Set up initial state (v1, v2, v3, v4). | ||||
| 	MOVQ R13, R8 | ||||
| 	ADDQ R14, R8 | ||||
| 	MOVQ R14, R9 | ||||
| 	XORQ R10, R10 | ||||
| 	XORQ R11, R11 | ||||
| 	SUBQ R13, R11 | ||||
| 	MOVQ prime1, v1 | ||||
| 	ADDQ prime2, v1 | ||||
| 	MOVQ prime2, v2 | ||||
| 	XORQ v3, v3 | ||||
| 	XORQ v4, v4 | ||||
| 	SUBQ prime1, v4 | ||||
|  | ||||
| 	// Loop until SI > BX. | ||||
| blockLoop: | ||||
| 	round(R8) | ||||
| 	round(R9) | ||||
| 	round(R10) | ||||
| 	round(R11) | ||||
| 	blockLoop() | ||||
|  | ||||
| 	CMPQ SI, BX | ||||
| 	JLE  blockLoop | ||||
| 	MOVQ v1, h | ||||
| 	ROLQ $1, h | ||||
| 	MOVQ v2, x | ||||
| 	ROLQ $7, x | ||||
| 	ADDQ x, h | ||||
| 	MOVQ v3, x | ||||
| 	ROLQ $12, x | ||||
| 	ADDQ x, h | ||||
| 	MOVQ v4, x | ||||
| 	ROLQ $18, x | ||||
| 	ADDQ x, h | ||||
|  | ||||
| 	MOVQ R8, AX | ||||
| 	ROLQ $1, AX | ||||
| 	MOVQ R9, R12 | ||||
| 	ROLQ $7, R12 | ||||
| 	ADDQ R12, AX | ||||
| 	MOVQ R10, R12 | ||||
| 	ROLQ $12, R12 | ||||
| 	ADDQ R12, AX | ||||
| 	MOVQ R11, R12 | ||||
| 	ROLQ $18, R12 | ||||
| 	ADDQ R12, AX | ||||
|  | ||||
| 	mergeRound(AX, R8) | ||||
| 	mergeRound(AX, R9) | ||||
| 	mergeRound(AX, R10) | ||||
| 	mergeRound(AX, R11) | ||||
| 	mergeRound(h, v1) | ||||
| 	mergeRound(h, v2) | ||||
| 	mergeRound(h, v3) | ||||
| 	mergeRound(h, v4) | ||||
|  | ||||
| 	JMP afterBlocks | ||||
|  | ||||
| noBlocks: | ||||
| 	MOVQ ·prime5v(SB), AX | ||||
| 	MOVQ ·primes+32(SB), h | ||||
|  | ||||
| afterBlocks: | ||||
| 	ADDQ DX, AX | ||||
| 	ADDQ n, h | ||||
|  | ||||
| 	// Right now BX has len(b)-32, and we want to loop until SI > len(b)-8. | ||||
| 	ADDQ $24, BX | ||||
| 	ADDQ $24, end | ||||
| 	CMPQ p, end | ||||
| 	JG   try4 | ||||
|  | ||||
| 	CMPQ SI, BX | ||||
| 	JG   fourByte | ||||
| loop8: | ||||
| 	MOVQ  (p), x | ||||
| 	ADDQ  $8, p | ||||
| 	round0(x) | ||||
| 	XORQ  x, h | ||||
| 	ROLQ  $27, h | ||||
| 	IMULQ prime1, h | ||||
| 	ADDQ  prime4, h | ||||
|  | ||||
| wordLoop: | ||||
| 	// Calculate k1. | ||||
| 	MOVQ  (SI), R8 | ||||
| 	ADDQ  $8, SI | ||||
| 	IMULQ R14, R8 | ||||
| 	ROLQ  $31, R8 | ||||
| 	IMULQ R13, R8 | ||||
| 	CMPQ p, end | ||||
| 	JLE  loop8 | ||||
|  | ||||
| 	XORQ  R8, AX | ||||
| 	ROLQ  $27, AX | ||||
| 	IMULQ R13, AX | ||||
| 	ADDQ  DI, AX | ||||
| try4: | ||||
| 	ADDQ $4, end | ||||
| 	CMPQ p, end | ||||
| 	JG   try1 | ||||
|  | ||||
| 	CMPQ SI, BX | ||||
| 	JLE  wordLoop | ||||
| 	MOVL  (p), x | ||||
| 	ADDQ  $4, p | ||||
| 	IMULQ prime1, x | ||||
| 	XORQ  x, h | ||||
|  | ||||
| fourByte: | ||||
| 	ADDQ $4, BX | ||||
| 	CMPQ SI, BX | ||||
| 	JG   singles | ||||
| 	ROLQ  $23, h | ||||
| 	IMULQ prime2, h | ||||
| 	ADDQ  ·primes+16(SB), h | ||||
|  | ||||
| 	MOVL  (SI), R8 | ||||
| 	ADDQ  $4, SI | ||||
| 	IMULQ R13, R8 | ||||
| 	XORQ  R8, AX | ||||
|  | ||||
| 	ROLQ  $23, AX | ||||
| 	IMULQ R14, AX | ||||
| 	ADDQ  ·prime3v(SB), AX | ||||
|  | ||||
| singles: | ||||
| 	ADDQ $4, BX | ||||
| 	CMPQ SI, BX | ||||
| try1: | ||||
| 	ADDQ $4, end | ||||
| 	CMPQ p, end | ||||
| 	JGE  finalize | ||||
|  | ||||
| singlesLoop: | ||||
| 	MOVBQZX (SI), R12 | ||||
| 	ADDQ    $1, SI | ||||
| 	IMULQ   ·prime5v(SB), R12 | ||||
| 	XORQ    R12, AX | ||||
| loop1: | ||||
| 	MOVBQZX (p), x | ||||
| 	ADDQ    $1, p | ||||
| 	IMULQ   ·primes+32(SB), x | ||||
| 	XORQ    x, h | ||||
| 	ROLQ    $11, h | ||||
| 	IMULQ   prime1, h | ||||
|  | ||||
| 	ROLQ  $11, AX | ||||
| 	IMULQ R13, AX | ||||
|  | ||||
| 	CMPQ SI, BX | ||||
| 	JL   singlesLoop | ||||
| 	CMPQ p, end | ||||
| 	JL   loop1 | ||||
|  | ||||
| finalize: | ||||
| 	MOVQ  AX, R12 | ||||
| 	SHRQ  $33, R12 | ||||
| 	XORQ  R12, AX | ||||
| 	IMULQ R14, AX | ||||
| 	MOVQ  AX, R12 | ||||
| 	SHRQ  $29, R12 | ||||
| 	XORQ  R12, AX | ||||
| 	IMULQ ·prime3v(SB), AX | ||||
| 	MOVQ  AX, R12 | ||||
| 	SHRQ  $32, R12 | ||||
| 	XORQ  R12, AX | ||||
| 	MOVQ  h, x | ||||
| 	SHRQ  $33, x | ||||
| 	XORQ  x, h | ||||
| 	IMULQ prime2, h | ||||
| 	MOVQ  h, x | ||||
| 	SHRQ  $29, x | ||||
| 	XORQ  x, h | ||||
| 	IMULQ ·primes+16(SB), h | ||||
| 	MOVQ  h, x | ||||
| 	SHRQ  $32, x | ||||
| 	XORQ  x, h | ||||
|  | ||||
| 	MOVQ AX, ret+24(FP) | ||||
| 	MOVQ h, ret+24(FP) | ||||
| 	RET | ||||
|  | ||||
| // writeBlocks uses the same registers as above except that it uses AX to store | ||||
| // the d pointer. | ||||
|  | ||||
| // func writeBlocks(d *Digest, b []byte) int | ||||
| TEXT ·writeBlocks(SB), NOSPLIT, $0-40 | ||||
| TEXT ·writeBlocks(SB), NOSPLIT|NOFRAME, $0-40 | ||||
| 	// Load fixed primes needed for round. | ||||
| 	MOVQ ·prime1v(SB), R13 | ||||
| 	MOVQ ·prime2v(SB), R14 | ||||
| 	MOVQ ·primes+0(SB), prime1 | ||||
| 	MOVQ ·primes+8(SB), prime2 | ||||
|  | ||||
| 	// Load slice. | ||||
| 	MOVQ b_base+8(FP), SI | ||||
| 	MOVQ b_len+16(FP), DX | ||||
| 	LEAQ (SI)(DX*1), BX | ||||
| 	SUBQ $32, BX | ||||
| 	MOVQ b_base+8(FP), p | ||||
| 	MOVQ b_len+16(FP), n | ||||
| 	LEAQ (p)(n*1), end | ||||
| 	SUBQ $32, end | ||||
|  | ||||
| 	// Load vN from d. | ||||
| 	MOVQ d+0(FP), AX | ||||
| 	MOVQ 0(AX), R8   // v1 | ||||
| 	MOVQ 8(AX), R9   // v2 | ||||
| 	MOVQ 16(AX), R10 // v3 | ||||
| 	MOVQ 24(AX), R11 // v4 | ||||
| 	MOVQ s+0(FP), d | ||||
| 	MOVQ 0(d), v1 | ||||
| 	MOVQ 8(d), v2 | ||||
| 	MOVQ 16(d), v3 | ||||
| 	MOVQ 24(d), v4 | ||||
|  | ||||
| 	// We don't need to check the loop condition here; this function is | ||||
| 	// always called with at least one block of data to process. | ||||
| blockLoop: | ||||
| 	round(R8) | ||||
| 	round(R9) | ||||
| 	round(R10) | ||||
| 	round(R11) | ||||
|  | ||||
| 	CMPQ SI, BX | ||||
| 	JLE  blockLoop | ||||
| 	blockLoop() | ||||
|  | ||||
| 	// Copy vN back to d. | ||||
| 	MOVQ R8, 0(AX) | ||||
| 	MOVQ R9, 8(AX) | ||||
| 	MOVQ R10, 16(AX) | ||||
| 	MOVQ R11, 24(AX) | ||||
| 	MOVQ v1, 0(d) | ||||
| 	MOVQ v2, 8(d) | ||||
| 	MOVQ v3, 16(d) | ||||
| 	MOVQ v4, 24(d) | ||||
|  | ||||
| 	// The number of bytes written is SI minus the old base pointer. | ||||
| 	SUBQ b_base+8(FP), SI | ||||
| 	MOVQ SI, ret+32(FP) | ||||
| 	// The number of bytes written is p minus the old base pointer. | ||||
| 	SUBQ b_base+8(FP), p | ||||
| 	MOVQ p, ret+32(FP) | ||||
|  | ||||
| 	RET | ||||
|   | ||||
							
								
								
									
										136
									
								
								vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_arm64.s
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										136
									
								
								vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_arm64.s
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,13 +1,17 @@ | ||||
| // +build gc,!purego,!noasm | ||||
| //go:build !appengine && gc && !purego && !noasm | ||||
| // +build !appengine | ||||
| // +build gc | ||||
| // +build !purego | ||||
| // +build !noasm | ||||
|  | ||||
| #include "textflag.h" | ||||
|  | ||||
| // Register allocation. | ||||
| // Registers: | ||||
| #define digest	R1 | ||||
| #define h	R2 // Return value. | ||||
| #define p	R3 // Input pointer. | ||||
| #define len	R4 | ||||
| #define nblocks	R5 // len / 32. | ||||
| #define h	R2 // return value | ||||
| #define p	R3 // input pointer | ||||
| #define n	R4 // input length | ||||
| #define nblocks	R5 // n / 32 | ||||
| #define prime1	R7 | ||||
| #define prime2	R8 | ||||
| #define prime3	R9 | ||||
| @@ -25,60 +29,52 @@ | ||||
| #define round(acc, x) \ | ||||
| 	MADD prime2, acc, x, acc \ | ||||
| 	ROR  $64-31, acc         \ | ||||
| 	MUL  prime1, acc         \ | ||||
| 	MUL  prime1, acc | ||||
|  | ||||
| // x = round(0, x). | ||||
| // round0 performs the operation x = round(0, x). | ||||
| #define round0(x) \ | ||||
| 	MUL prime2, x \ | ||||
| 	ROR $64-31, x \ | ||||
| 	MUL prime1, x \ | ||||
| 	MUL prime1, x | ||||
|  | ||||
| #define mergeRound(x) \ | ||||
| 	round0(x)                 \ | ||||
| 	EOR  x, h                 \ | ||||
| 	MADD h, prime4, prime1, h \ | ||||
| #define mergeRound(acc, x) \ | ||||
| 	round0(x)                     \ | ||||
| 	EOR  x, acc                   \ | ||||
| 	MADD acc, prime4, prime1, acc | ||||
|  | ||||
| // Update v[1-4] with 32-byte blocks. Assumes len >= 32. | ||||
| #define blocksLoop() \ | ||||
| 	LSR     $5, len, nblocks \ | ||||
| 	PCALIGN $16              \ | ||||
| 	loop:                    \ | ||||
| 	LDP.P   32(p), (x1, x2)  \ | ||||
| 	round(v1, x1)            \ | ||||
| 	LDP     -16(p), (x3, x4) \ | ||||
| 	round(v2, x2)            \ | ||||
| 	SUB     $1, nblocks      \ | ||||
| 	round(v3, x3)            \ | ||||
| 	round(v4, x4)            \ | ||||
| 	CBNZ    nblocks, loop    \ | ||||
|  | ||||
| // The primes are repeated here to ensure that they're stored | ||||
| // in a contiguous array, so we can load them with LDP. | ||||
| DATA primes<> +0(SB)/8, $11400714785074694791 | ||||
| DATA primes<> +8(SB)/8, $14029467366897019727 | ||||
| DATA primes<>+16(SB)/8, $1609587929392839161 | ||||
| DATA primes<>+24(SB)/8, $9650029242287828579 | ||||
| DATA primes<>+32(SB)/8, $2870177450012600261 | ||||
| GLOBL primes<>(SB), NOPTR+RODATA, $40 | ||||
| // blockLoop processes as many 32-byte blocks as possible, | ||||
| // updating v1, v2, v3, and v4. It assumes that n >= 32. | ||||
| #define blockLoop() \ | ||||
| 	LSR     $5, n, nblocks  \ | ||||
| 	PCALIGN $16             \ | ||||
| 	loop:                   \ | ||||
| 	LDP.P   16(p), (x1, x2) \ | ||||
| 	LDP.P   16(p), (x3, x4) \ | ||||
| 	round(v1, x1)           \ | ||||
| 	round(v2, x2)           \ | ||||
| 	round(v3, x3)           \ | ||||
| 	round(v4, x4)           \ | ||||
| 	SUB     $1, nblocks     \ | ||||
| 	CBNZ    nblocks, loop | ||||
|  | ||||
| // func Sum64(b []byte) uint64 | ||||
| TEXT ·Sum64(SB), NOFRAME+NOSPLIT, $0-32 | ||||
| 	LDP b_base+0(FP), (p, len) | ||||
| TEXT ·Sum64(SB), NOSPLIT|NOFRAME, $0-32 | ||||
| 	LDP b_base+0(FP), (p, n) | ||||
|  | ||||
| 	LDP  primes<> +0(SB), (prime1, prime2) | ||||
| 	LDP  primes<>+16(SB), (prime3, prime4) | ||||
| 	MOVD primes<>+32(SB), prime5 | ||||
| 	LDP  ·primes+0(SB), (prime1, prime2) | ||||
| 	LDP  ·primes+16(SB), (prime3, prime4) | ||||
| 	MOVD ·primes+32(SB), prime5 | ||||
|  | ||||
| 	CMP  $32, len | ||||
| 	CSEL LO, prime5, ZR, h // if len < 32 { h = prime5 } else { h = 0 } | ||||
| 	BLO  afterLoop | ||||
| 	CMP  $32, n | ||||
| 	CSEL LT, prime5, ZR, h // if n < 32 { h = prime5 } else { h = 0 } | ||||
| 	BLT  afterLoop | ||||
|  | ||||
| 	ADD  prime1, prime2, v1 | ||||
| 	MOVD prime2, v2 | ||||
| 	MOVD $0, v3 | ||||
| 	NEG  prime1, v4 | ||||
|  | ||||
| 	blocksLoop() | ||||
| 	blockLoop() | ||||
|  | ||||
| 	ROR $64-1, v1, x1 | ||||
| 	ROR $64-7, v2, x2 | ||||
| @@ -88,71 +84,75 @@ TEXT ·Sum64(SB), NOFRAME+NOSPLIT, $0-32 | ||||
| 	ADD x3, x4 | ||||
| 	ADD x2, x4, h | ||||
|  | ||||
| 	mergeRound(v1) | ||||
| 	mergeRound(v2) | ||||
| 	mergeRound(v3) | ||||
| 	mergeRound(v4) | ||||
| 	mergeRound(h, v1) | ||||
| 	mergeRound(h, v2) | ||||
| 	mergeRound(h, v3) | ||||
| 	mergeRound(h, v4) | ||||
|  | ||||
| afterLoop: | ||||
| 	ADD len, h | ||||
| 	ADD n, h | ||||
|  | ||||
| 	TBZ   $4, len, try8 | ||||
| 	TBZ   $4, n, try8 | ||||
| 	LDP.P 16(p), (x1, x2) | ||||
|  | ||||
| 	round0(x1) | ||||
|  | ||||
| 	// NOTE: here and below, sequencing the EOR after the ROR (using a | ||||
| 	// rotated register) is worth a small but measurable speedup for small | ||||
| 	// inputs. | ||||
| 	ROR  $64-27, h | ||||
| 	EOR  x1 @> 64-27, h, h | ||||
| 	MADD h, prime4, prime1, h | ||||
|  | ||||
| 	round0(x2) | ||||
| 	ROR  $64-27, h | ||||
| 	EOR  x2 @> 64-27, h | ||||
| 	EOR  x2 @> 64-27, h, h | ||||
| 	MADD h, prime4, prime1, h | ||||
|  | ||||
| try8: | ||||
| 	TBZ    $3, len, try4 | ||||
| 	TBZ    $3, n, try4 | ||||
| 	MOVD.P 8(p), x1 | ||||
|  | ||||
| 	round0(x1) | ||||
| 	ROR  $64-27, h | ||||
| 	EOR  x1 @> 64-27, h | ||||
| 	EOR  x1 @> 64-27, h, h | ||||
| 	MADD h, prime4, prime1, h | ||||
|  | ||||
| try4: | ||||
| 	TBZ     $2, len, try2 | ||||
| 	TBZ     $2, n, try2 | ||||
| 	MOVWU.P 4(p), x2 | ||||
|  | ||||
| 	MUL  prime1, x2 | ||||
| 	ROR  $64-23, h | ||||
| 	EOR  x2 @> 64-23, h | ||||
| 	EOR  x2 @> 64-23, h, h | ||||
| 	MADD h, prime3, prime2, h | ||||
|  | ||||
| try2: | ||||
| 	TBZ     $1, len, try1 | ||||
| 	TBZ     $1, n, try1 | ||||
| 	MOVHU.P 2(p), x3 | ||||
| 	AND     $255, x3, x1 | ||||
| 	LSR     $8, x3, x2 | ||||
|  | ||||
| 	MUL prime5, x1 | ||||
| 	ROR $64-11, h | ||||
| 	EOR x1 @> 64-11, h | ||||
| 	EOR x1 @> 64-11, h, h | ||||
| 	MUL prime1, h | ||||
|  | ||||
| 	MUL prime5, x2 | ||||
| 	ROR $64-11, h | ||||
| 	EOR x2 @> 64-11, h | ||||
| 	EOR x2 @> 64-11, h, h | ||||
| 	MUL prime1, h | ||||
|  | ||||
| try1: | ||||
| 	TBZ   $0, len, end | ||||
| 	TBZ   $0, n, finalize | ||||
| 	MOVBU (p), x4 | ||||
|  | ||||
| 	MUL prime5, x4 | ||||
| 	ROR $64-11, h | ||||
| 	EOR x4 @> 64-11, h | ||||
| 	EOR x4 @> 64-11, h, h | ||||
| 	MUL prime1, h | ||||
|  | ||||
| end: | ||||
| finalize: | ||||
| 	EOR h >> 33, h | ||||
| 	MUL prime2, h | ||||
| 	EOR h >> 29, h | ||||
| @@ -163,24 +163,22 @@ end: | ||||
| 	RET | ||||
|  | ||||
| // func writeBlocks(d *Digest, b []byte) int | ||||
| // | ||||
| // Assumes len(b) >= 32. | ||||
| TEXT ·writeBlocks(SB), NOFRAME+NOSPLIT, $0-40 | ||||
| 	LDP primes<>(SB), (prime1, prime2) | ||||
| TEXT ·writeBlocks(SB), NOSPLIT|NOFRAME, $0-40 | ||||
| 	LDP ·primes+0(SB), (prime1, prime2) | ||||
|  | ||||
| 	// Load state. Assume v[1-4] are stored contiguously. | ||||
| 	MOVD d+0(FP), digest | ||||
| 	LDP  0(digest), (v1, v2) | ||||
| 	LDP  16(digest), (v3, v4) | ||||
|  | ||||
| 	LDP b_base+8(FP), (p, len) | ||||
| 	LDP b_base+8(FP), (p, n) | ||||
|  | ||||
| 	blocksLoop() | ||||
| 	blockLoop() | ||||
|  | ||||
| 	// Store updated state. | ||||
| 	STP (v1, v2), 0(digest) | ||||
| 	STP (v3, v4), 16(digest) | ||||
|  | ||||
| 	BIC  $31, len | ||||
| 	MOVD len, ret+32(FP) | ||||
| 	BIC  $31, n | ||||
| 	MOVD n, ret+32(FP) | ||||
| 	RET | ||||
|   | ||||
							
								
								
									
										2
									
								
								vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_asm.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_asm.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -13,4 +13,4 @@ package xxhash | ||||
| func Sum64(b []byte) uint64 | ||||
|  | ||||
| //go:noescape | ||||
| func writeBlocks(d *Digest, b []byte) int | ||||
| func writeBlocks(s *Digest, b []byte) int | ||||
|   | ||||
							
								
								
									
										19
									
								
								vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_other.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										19
									
								
								vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_other.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -15,10 +15,10 @@ func Sum64(b []byte) uint64 { | ||||
| 	var h uint64 | ||||
|  | ||||
| 	if n >= 32 { | ||||
| 		v1 := prime1v + prime2 | ||||
| 		v1 := primes[0] + prime2 | ||||
| 		v2 := prime2 | ||||
| 		v3 := uint64(0) | ||||
| 		v4 := -prime1v | ||||
| 		v4 := -primes[0] | ||||
| 		for len(b) >= 32 { | ||||
| 			v1 = round(v1, u64(b[0:8:len(b)])) | ||||
| 			v2 = round(v2, u64(b[8:16:len(b)])) | ||||
| @@ -37,19 +37,18 @@ func Sum64(b []byte) uint64 { | ||||
|  | ||||
| 	h += uint64(n) | ||||
|  | ||||
| 	i, end := 0, len(b) | ||||
| 	for ; i+8 <= end; i += 8 { | ||||
| 		k1 := round(0, u64(b[i:i+8:len(b)])) | ||||
| 	for ; len(b) >= 8; b = b[8:] { | ||||
| 		k1 := round(0, u64(b[:8])) | ||||
| 		h ^= k1 | ||||
| 		h = rol27(h)*prime1 + prime4 | ||||
| 	} | ||||
| 	if i+4 <= end { | ||||
| 		h ^= uint64(u32(b[i:i+4:len(b)])) * prime1 | ||||
| 	if len(b) >= 4 { | ||||
| 		h ^= uint64(u32(b[:4])) * prime1 | ||||
| 		h = rol23(h)*prime2 + prime3 | ||||
| 		i += 4 | ||||
| 		b = b[4:] | ||||
| 	} | ||||
| 	for ; i < end; i++ { | ||||
| 		h ^= uint64(b[i]) * prime5 | ||||
| 	for ; len(b) > 0; b = b[1:] { | ||||
| 		h ^= uint64(b[0]) * prime5 | ||||
| 		h = rol11(h) * prime1 | ||||
| 	} | ||||
|  | ||||
|   | ||||
							
								
								
									
										30
									
								
								vendor/github.com/klauspost/compress/zstd/zstd.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										30
									
								
								vendor/github.com/klauspost/compress/zstd/zstd.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -36,9 +36,6 @@ const forcePreDef = false | ||||
| // zstdMinMatch is the minimum zstd match length. | ||||
| const zstdMinMatch = 3 | ||||
|  | ||||
| // Reset the buffer offset when reaching this. | ||||
| const bufferReset = math.MaxInt32 - MaxWindowSize | ||||
|  | ||||
| // fcsUnknown is used for unknown frame content size. | ||||
| const fcsUnknown = math.MaxUint64 | ||||
|  | ||||
| @@ -110,26 +107,25 @@ func printf(format string, a ...interface{}) { | ||||
| 	} | ||||
| } | ||||
|  | ||||
| // matchLen returns the maximum length. | ||||
| // matchLen returns the maximum common prefix length of a and b. | ||||
| // a must be the shortest of the two. | ||||
| // The function also returns whether all bytes matched. | ||||
| func matchLen(a, b []byte) int { | ||||
| 	b = b[:len(a)] | ||||
| 	for i := 0; i < len(a)-7; i += 8 { | ||||
| 		if diff := load64(a, i) ^ load64(b, i); diff != 0 { | ||||
| 			return i + (bits.TrailingZeros64(diff) >> 3) | ||||
| func matchLen(a, b []byte) (n int) { | ||||
| 	for ; len(a) >= 8 && len(b) >= 8; a, b = a[8:], b[8:] { | ||||
| 		diff := binary.LittleEndian.Uint64(a) ^ binary.LittleEndian.Uint64(b) | ||||
| 		if diff != 0 { | ||||
| 			return n + bits.TrailingZeros64(diff)>>3 | ||||
| 		} | ||||
| 		n += 8 | ||||
| 	} | ||||
|  | ||||
| 	checked := (len(a) >> 3) << 3 | ||||
| 	a = a[checked:] | ||||
| 	b = b[checked:] | ||||
| 	for i := range a { | ||||
| 		if a[i] != b[i] { | ||||
| 			return i + checked | ||||
| 			break | ||||
| 		} | ||||
| 		n++ | ||||
| 	} | ||||
| 	return len(a) + checked | ||||
| 	return n | ||||
|  | ||||
| } | ||||
|  | ||||
| func load3232(b []byte, i int32) uint32 { | ||||
| @@ -140,10 +136,6 @@ func load6432(b []byte, i int32) uint64 { | ||||
| 	return binary.LittleEndian.Uint64(b[i:]) | ||||
| } | ||||
|  | ||||
| func load64(b []byte, i int) uint64 { | ||||
| 	return binary.LittleEndian.Uint64(b[i:]) | ||||
| } | ||||
|  | ||||
| type byter interface { | ||||
| 	Bytes() []byte | ||||
| 	Len() int | ||||
|   | ||||
							
								
								
									
										4
									
								
								vendor/github.com/prometheus/common/expfmt/fuzz.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								vendor/github.com/prometheus/common/expfmt/fuzz.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -21,8 +21,8 @@ import "bytes" | ||||
|  | ||||
| // Fuzz text metric parser with with github.com/dvyukov/go-fuzz: | ||||
| // | ||||
| //     go-fuzz-build github.com/prometheus/common/expfmt | ||||
| //     go-fuzz -bin expfmt-fuzz.zip -workdir fuzz | ||||
| //	go-fuzz-build github.com/prometheus/common/expfmt | ||||
| //	go-fuzz -bin expfmt-fuzz.zip -workdir fuzz | ||||
| // | ||||
| // Further input samples should go in the folder fuzz/corpus. | ||||
| func Fuzz(in []byte) int { | ||||
|   | ||||
							
								
								
									
										22
									
								
								vendor/github.com/prometheus/common/expfmt/openmetrics_create.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										22
									
								
								vendor/github.com/prometheus/common/expfmt/openmetrics_create.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -46,20 +46,20 @@ import ( | ||||
| // missing features and peculiarities to avoid complications when switching from | ||||
| // Prometheus to OpenMetrics or vice versa: | ||||
| // | ||||
| // - Counters are expected to have the `_total` suffix in their metric name. In | ||||
| //   the output, the suffix will be truncated from the `# TYPE` and `# HELP` | ||||
| //   line. A counter with a missing `_total` suffix is not an error. However, | ||||
| //   its type will be set to `unknown` in that case to avoid invalid OpenMetrics | ||||
| //   output. | ||||
| //   - Counters are expected to have the `_total` suffix in their metric name. In | ||||
| //     the output, the suffix will be truncated from the `# TYPE` and `# HELP` | ||||
| //     line. A counter with a missing `_total` suffix is not an error. However, | ||||
| //     its type will be set to `unknown` in that case to avoid invalid OpenMetrics | ||||
| //     output. | ||||
| // | ||||
| // - No support for the following (optional) features: `# UNIT` line, `_created` | ||||
| //   line, info type, stateset type, gaugehistogram type. | ||||
| //   - No support for the following (optional) features: `# UNIT` line, `_created` | ||||
| //     line, info type, stateset type, gaugehistogram type. | ||||
| // | ||||
| // - The size of exemplar labels is not checked (i.e. it's possible to create | ||||
| //   exemplars that are larger than allowed by the OpenMetrics specification). | ||||
| //   - The size of exemplar labels is not checked (i.e. it's possible to create | ||||
| //     exemplars that are larger than allowed by the OpenMetrics specification). | ||||
| // | ||||
| // - The value of Counters is not checked. (OpenMetrics doesn't allow counters | ||||
| //   with a `NaN` value.) | ||||
| //   - The value of Counters is not checked. (OpenMetrics doesn't allow counters | ||||
| //     with a `NaN` value.) | ||||
| func MetricFamilyToOpenMetrics(out io.Writer, in *dto.MetricFamily) (written int, err error) { | ||||
| 	name := in.GetName() | ||||
| 	if name == "" { | ||||
|   | ||||
							
								
								
									
										3
									
								
								vendor/github.com/prometheus/common/expfmt/text_create.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								vendor/github.com/prometheus/common/expfmt/text_create.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -17,7 +17,6 @@ import ( | ||||
| 	"bufio" | ||||
| 	"fmt" | ||||
| 	"io" | ||||
| 	"io/ioutil" | ||||
| 	"math" | ||||
| 	"strconv" | ||||
| 	"strings" | ||||
| @@ -44,7 +43,7 @@ const ( | ||||
| var ( | ||||
| 	bufPool = sync.Pool{ | ||||
| 		New: func() interface{} { | ||||
| 			return bufio.NewWriter(ioutil.Discard) | ||||
| 			return bufio.NewWriter(io.Discard) | ||||
| 		}, | ||||
| 	} | ||||
| 	numBufPool = sync.Pool{ | ||||
|   | ||||
							
								
								
									
										22
									
								
								vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										22
									
								
								vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -11,18 +11,18 @@ Redistribution and use in source and binary forms, with or without | ||||
| modification, are permitted provided that the following conditions are | ||||
| met: | ||||
|  | ||||
|     Redistributions of source code must retain the above copyright | ||||
|     notice, this list of conditions and the following disclaimer. | ||||
| 	Redistributions of source code must retain the above copyright | ||||
| 	notice, this list of conditions and the following disclaimer. | ||||
|  | ||||
|     Redistributions in binary form must reproduce the above copyright | ||||
|     notice, this list of conditions and the following disclaimer in | ||||
|     the documentation and/or other materials provided with the | ||||
|     distribution. | ||||
| 	Redistributions in binary form must reproduce the above copyright | ||||
| 	notice, this list of conditions and the following disclaimer in | ||||
| 	the documentation and/or other materials provided with the | ||||
| 	distribution. | ||||
|  | ||||
|     Neither the name of the Open Knowledge Foundation Ltd. nor the | ||||
|     names of its contributors may be used to endorse or promote | ||||
|     products derived from this software without specific prior written | ||||
|     permission. | ||||
| 	Neither the name of the Open Knowledge Foundation Ltd. nor the | ||||
| 	names of its contributors may be used to endorse or promote | ||||
| 	products derived from this software without specific prior written | ||||
| 	permission. | ||||
|  | ||||
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||||
| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||||
| @@ -35,8 +35,6 @@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||||
| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||||
| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||||
| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
|  | ||||
|  | ||||
| */ | ||||
| package goautoneg | ||||
|  | ||||
|   | ||||
							
								
								
									
										4
									
								
								vendor/github.com/urfave/cli/v2/app.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								vendor/github.com/urfave/cli/v2/app.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -107,6 +107,8 @@ type App struct { | ||||
| 	CustomAppHelpTemplate string | ||||
| 	// SliceFlagSeparator is used to customize the separator for SliceFlag, the default is "," | ||||
| 	SliceFlagSeparator string | ||||
| 	// DisableSliceFlagSeparator is used to disable SliceFlagSeparator, the default is false | ||||
| 	DisableSliceFlagSeparator bool | ||||
| 	// Boolean to enable short-option handling so user can combine several | ||||
| 	// single-character bool arguments into one | ||||
| 	// i.e. foobar -o -v -> foobar -ov | ||||
| @@ -264,6 +266,8 @@ func (a *App) Setup() { | ||||
| 	if len(a.SliceFlagSeparator) != 0 { | ||||
| 		defaultSliceFlagSeparator = a.SliceFlagSeparator | ||||
| 	} | ||||
|  | ||||
| 	disableSliceFlagSeparator = a.DisableSliceFlagSeparator | ||||
| } | ||||
|  | ||||
| func (a *App) newRootCommand() *Command { | ||||
|   | ||||
							
								
								
									
										12
									
								
								vendor/github.com/urfave/cli/v2/command.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								vendor/github.com/urfave/cli/v2/command.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -136,6 +136,10 @@ func (c *Command) setup(ctx *Context) { | ||||
| 		newCmds = append(newCmds, scmd) | ||||
| 	} | ||||
| 	c.Subcommands = newCmds | ||||
|  | ||||
| 	if c.BashComplete == nil { | ||||
| 		c.BashComplete = DefaultCompleteWithFlags(c) | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func (c *Command) Run(cCtx *Context, arguments ...string) (err error) { | ||||
| @@ -148,11 +152,7 @@ func (c *Command) Run(cCtx *Context, arguments ...string) (err error) { | ||||
| 	set, err := c.parseFlags(&a, cCtx.shellComplete) | ||||
| 	cCtx.flagSet = set | ||||
|  | ||||
| 	if c.isRoot { | ||||
| 		if checkCompletions(cCtx) { | ||||
| 			return nil | ||||
| 		} | ||||
| 	} else if checkCommandCompletions(cCtx, c.Name) { | ||||
| 	if checkCompletions(cCtx) { | ||||
| 		return nil | ||||
| 	} | ||||
|  | ||||
| @@ -203,7 +203,7 @@ func (c *Command) Run(cCtx *Context, arguments ...string) (err error) { | ||||
|  | ||||
| 	cerr := cCtx.checkRequiredFlags(c.Flags) | ||||
| 	if cerr != nil { | ||||
| 		_ = ShowSubcommandHelp(cCtx) | ||||
| 		_ = helpCommand.Action(cCtx) | ||||
| 		return cerr | ||||
| 	} | ||||
|  | ||||
|   | ||||
							
								
								
									
										9
									
								
								vendor/github.com/urfave/cli/v2/flag.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										9
									
								
								vendor/github.com/urfave/cli/v2/flag.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -15,7 +15,10 @@ import ( | ||||
|  | ||||
| const defaultPlaceholder = "value" | ||||
|  | ||||
| var defaultSliceFlagSeparator = "," | ||||
| var ( | ||||
| 	defaultSliceFlagSeparator = "," | ||||
| 	disableSliceFlagSeparator = false | ||||
| ) | ||||
|  | ||||
| var ( | ||||
| 	slPfx = fmt.Sprintf("sl:::%d:::", time.Now().UTC().UnixNano()) | ||||
| @@ -380,5 +383,9 @@ func flagFromEnvOrFile(envVars []string, filePath string) (value string, fromWhe | ||||
| } | ||||
|  | ||||
| func flagSplitMultiValues(val string) []string { | ||||
| 	if disableSliceFlagSeparator { | ||||
| 		return []string{val} | ||||
| 	} | ||||
|  | ||||
| 	return strings.Split(val, defaultSliceFlagSeparator) | ||||
| } | ||||
|   | ||||
							
								
								
									
										2
									
								
								vendor/github.com/urfave/cli/v2/godoc-current.txt
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/urfave/cli/v2/godoc-current.txt
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -318,6 +318,8 @@ type App struct { | ||||
| 	CustomAppHelpTemplate string | ||||
| 	// SliceFlagSeparator is used to customize the separator for SliceFlag, the default is "," | ||||
| 	SliceFlagSeparator string | ||||
| 	// DisableSliceFlagSeparator is used to disable SliceFlagSeparator, the default is false | ||||
| 	DisableSliceFlagSeparator bool | ||||
| 	// Boolean to enable short-option handling so user can combine several | ||||
| 	// single-character bool arguments into one | ||||
| 	// i.e. foobar -o -v -> foobar -ov | ||||
|   | ||||
							
								
								
									
										21
									
								
								vendor/github.com/urfave/cli/v2/help.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										21
									
								
								vendor/github.com/urfave/cli/v2/help.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -227,7 +227,7 @@ func DefaultCompleteWithFlags(cmd *Command) func(cCtx *Context) { | ||||
| 			return | ||||
| 		} | ||||
|  | ||||
| 		printCommandSuggestions(cCtx.App.Commands, cCtx.App.Writer) | ||||
| 		printCommandSuggestions(cCtx.Command.Subcommands, cCtx.App.Writer) | ||||
| 	} | ||||
| } | ||||
|  | ||||
| @@ -308,15 +308,15 @@ func printVersion(cCtx *Context) { | ||||
|  | ||||
| // ShowCompletions prints the lists of commands within a given context | ||||
| func ShowCompletions(cCtx *Context) { | ||||
| 	a := cCtx.App | ||||
| 	if a != nil && a.BashComplete != nil { | ||||
| 		a.BashComplete(cCtx) | ||||
| 	c := cCtx.Command | ||||
| 	if c != nil && c.BashComplete != nil { | ||||
| 		c.BashComplete(cCtx) | ||||
| 	} | ||||
| } | ||||
|  | ||||
| // ShowCommandCompletions prints the custom completions for a given command | ||||
| func ShowCommandCompletions(ctx *Context, command string) { | ||||
| 	c := ctx.App.Command(command) | ||||
| 	c := ctx.Command.Command(command) | ||||
| 	if c != nil { | ||||
| 		if c.BashComplete != nil { | ||||
| 			c.BashComplete(ctx) | ||||
| @@ -453,7 +453,7 @@ func checkCompletions(cCtx *Context) bool { | ||||
|  | ||||
| 	if args := cCtx.Args(); args.Present() { | ||||
| 		name := args.First() | ||||
| 		if cmd := cCtx.App.Command(name); cmd != nil { | ||||
| 		if cmd := cCtx.Command.Command(name); cmd != nil { | ||||
| 			// let the command handle the completion | ||||
| 			return false | ||||
| 		} | ||||
| @@ -463,15 +463,6 @@ func checkCompletions(cCtx *Context) bool { | ||||
| 	return true | ||||
| } | ||||
|  | ||||
| func checkCommandCompletions(c *Context, name string) bool { | ||||
| 	if !c.shellComplete { | ||||
| 		return false | ||||
| 	} | ||||
|  | ||||
| 	ShowCommandCompletions(c, name) | ||||
| 	return true | ||||
| } | ||||
|  | ||||
| func subtract(a, b int) int { | ||||
| 	return a - b | ||||
| } | ||||
|   | ||||
							
								
								
									
										4
									
								
								vendor/github.com/xdg-go/scram/CHANGELOG.md
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								vendor/github.com/xdg-go/scram/CHANGELOG.md
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,5 +1,9 @@ | ||||
| # CHANGELOG | ||||
|  | ||||
| ## v1.1.2 - 2022-12-07 | ||||
|  | ||||
| - Bump stringprep dependency to v1.0.4 for upstream CVE fix. | ||||
|  | ||||
| ## v1.1.1 - 2022-03-03 | ||||
|  | ||||
| - Bump stringprep dependency to v1.0.3 for upstream CVE fix. | ||||
|   | ||||
							
								
								
									
										7
									
								
								vendor/github.com/xdg-go/stringprep/CHANGELOG.md
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								vendor/github.com/xdg-go/stringprep/CHANGELOG.md
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,5 +1,12 @@ | ||||
| # CHANGELOG | ||||
|  | ||||
| <a name="v1.0.4"></a> | ||||
| ## [v1.0.4] - 2022-12-07 | ||||
|  | ||||
| ### Maintenance | ||||
|  | ||||
| - Bump golang.org/x/text to v0.3.8 due to CVE-2022-32149 | ||||
|  | ||||
| <a name="v1.0.3"></a> | ||||
| ## [v1.0.3] - 2022-03-01 | ||||
|  | ||||
|   | ||||
							
								
								
									
										2
									
								
								vendor/go.mongodb.org/mongo-driver/version/version.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/go.mongodb.org/mongo-driver/version/version.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -8,4 +8,4 @@ | ||||
| package version // import "go.mongodb.org/mongo-driver/version" | ||||
|  | ||||
| // Driver is the current version of the driver. | ||||
| var Driver = "v1.11.0" | ||||
| var Driver = "v1.11.1" | ||||
|   | ||||
							
								
								
									
										46
									
								
								vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										46
									
								
								vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -59,8 +59,9 @@ type RetryablePoolError interface { | ||||
| 	Retryable() bool | ||||
| } | ||||
|  | ||||
| // LabeledError is an error that can have error labels added to it. | ||||
| type LabeledError interface { | ||||
| // labeledError is an error that can have error labels added to it. | ||||
| type labeledError interface { | ||||
| 	error | ||||
| 	HasErrorLabel(string) bool | ||||
| } | ||||
|  | ||||
| @@ -398,9 +399,19 @@ func (op Operation) Execute(ctx context.Context) error { | ||||
| 		// Set the previous indefinite error to be returned in any case where a retryable write error does not have a | ||||
| 		// NoWritesPerfomed label (the definite case). | ||||
| 		switch err := err.(type) { | ||||
| 		case LabeledError: | ||||
| 		case labeledError: | ||||
| 			// If the "prevIndefiniteErr" is nil, then the current error is the first error encountered | ||||
| 			// during the retry attempt cycle. We must persist the first error in the case where all | ||||
| 			// following errors are labeled "NoWritesPerformed", which would otherwise raise nil as the | ||||
| 			// error. | ||||
| 			if prevIndefiniteErr == nil { | ||||
| 				prevIndefiniteErr = err | ||||
| 			} | ||||
|  | ||||
| 			// If the error is not labeled NoWritesPerformed and is retryable, then set the previous | ||||
| 			// indefinite error to be the current error. | ||||
| 			if !err.HasErrorLabel(NoWritesPerformed) && err.HasErrorLabel(RetryableWriteError) { | ||||
| 				prevIndefiniteErr = err.(error) | ||||
| 				prevIndefiniteErr = err | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| @@ -595,6 +606,13 @@ func (op Operation) Execute(ctx context.Context) error { | ||||
| 		finishedInfo.cmdErr = err | ||||
| 		op.publishFinishedEvent(ctx, finishedInfo) | ||||
|  | ||||
| 		// prevIndefiniteErrorIsSet is "true" if the "err" variable has been set to the "prevIndefiniteErr" in | ||||
| 		// a case in the switch statement below. | ||||
| 		var prevIndefiniteErrIsSet bool | ||||
|  | ||||
| 		// TODO(GODRIVER-2579): When refactoring the "Execute" method, consider creating a separate method for the | ||||
| 		// error handling logic below. This will remove the necessity of the "checkError" goto label. | ||||
| 	checkError: | ||||
| 		var perr error | ||||
| 		switch tt := err.(type) { | ||||
| 		case WriteCommandError: | ||||
| @@ -627,9 +645,13 @@ func (op Operation) Execute(ctx context.Context) error { | ||||
| 			} | ||||
|  | ||||
| 			// If the error is no longer retryable and has the NoWritesPerformed label, then we should | ||||
| 			// return the previous indefinite error. | ||||
| 			if tt.HasErrorLabel(NoWritesPerformed) { | ||||
| 				return prevIndefiniteErr | ||||
| 			// set the error to the "previous indefinite error" unless the current error is already the | ||||
| 			// "previous indefinite error". After reseting, repeat the error check. | ||||
| 			if tt.HasErrorLabel(NoWritesPerformed) && !prevIndefiniteErrIsSet { | ||||
| 				err = prevIndefiniteErr | ||||
| 				prevIndefiniteErrIsSet = true | ||||
|  | ||||
| 				goto checkError | ||||
| 			} | ||||
|  | ||||
| 			// If the operation isn't being retried, process the response | ||||
| @@ -720,9 +742,13 @@ func (op Operation) Execute(ctx context.Context) error { | ||||
| 			} | ||||
|  | ||||
| 			// If the error is no longer retryable and has the NoWritesPerformed label, then we should | ||||
| 			// return the previous indefinite error. | ||||
| 			if tt.HasErrorLabel(NoWritesPerformed) { | ||||
| 				return prevIndefiniteErr | ||||
| 			// set the error to the "previous indefinite error" unless the current error is already the | ||||
| 			// "previous indefinite error". After reseting, repeat the error check. | ||||
| 			if tt.HasErrorLabel(NoWritesPerformed) && !prevIndefiniteErrIsSet { | ||||
| 				err = prevIndefiniteErr | ||||
| 				prevIndefiniteErrIsSet = true | ||||
|  | ||||
| 				goto checkError | ||||
| 			} | ||||
|  | ||||
| 			// If the operation isn't being retried, process the response | ||||
|   | ||||
							
								
								
									
										70
									
								
								vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/server.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										70
									
								
								vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/server.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -520,6 +520,7 @@ func (s *Server) update() { | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	timeoutCnt := 0 | ||||
| 	for { | ||||
| 		// Check if the server is disconnecting. Even if waitForNextCheck has already read from the done channel, we | ||||
| 		// can safely read from it again because Disconnect closes the channel. | ||||
| @@ -545,18 +546,42 @@ func (s *Server) update() { | ||||
| 			continue | ||||
| 		} | ||||
|  | ||||
| 		// Must hold the processErrorLock while updating the server description and clearing the | ||||
| 		// pool. Not holding the lock leads to possible out-of-order processing of pool.clear() and | ||||
| 		// pool.ready() calls from concurrent server description updates. | ||||
| 		s.processErrorLock.Lock() | ||||
| 		s.updateDescription(desc) | ||||
| 		if err := desc.LastError; err != nil { | ||||
| 			// Clear the pool once the description has been updated to Unknown. Pass in a nil service ID to clear | ||||
| 			// because the monitoring routine only runs for non-load balanced deployments in which servers don't return | ||||
| 			// IDs. | ||||
| 			s.pool.clear(err, nil) | ||||
| 		if isShortcut := func() bool { | ||||
| 			// Must hold the processErrorLock while updating the server description and clearing the | ||||
| 			// pool. Not holding the lock leads to possible out-of-order processing of pool.clear() and | ||||
| 			// pool.ready() calls from concurrent server description updates. | ||||
| 			s.processErrorLock.Lock() | ||||
| 			defer s.processErrorLock.Unlock() | ||||
|  | ||||
| 			s.updateDescription(desc) | ||||
| 			// Retry after the first timeout before clearing the pool in case of a FAAS pause as | ||||
| 			// described in GODRIVER-2577. | ||||
| 			if err := unwrapConnectionError(desc.LastError); err != nil && timeoutCnt < 1 { | ||||
| 				if err == context.Canceled || err == context.DeadlineExceeded { | ||||
| 					timeoutCnt++ | ||||
| 					// We want to immediately retry on timeout error. Continue to next loop. | ||||
| 					return true | ||||
| 				} | ||||
| 				if err, ok := err.(net.Error); ok && err.Timeout() { | ||||
| 					timeoutCnt++ | ||||
| 					// We want to immediately retry on timeout error. Continue to next loop. | ||||
| 					return true | ||||
| 				} | ||||
| 			} | ||||
| 			if err := desc.LastError; err != nil { | ||||
| 				// Clear the pool once the description has been updated to Unknown. Pass in a nil service ID to clear | ||||
| 				// because the monitoring routine only runs for non-load balanced deployments in which servers don't return | ||||
| 				// IDs. | ||||
| 				s.pool.clear(err, nil) | ||||
| 			} | ||||
| 			// We're either not handling a timeout error, or we just handled the 2nd consecutive | ||||
| 			// timeout error. In either case, reset the timeout count to 0 and return false to | ||||
| 			// continue the normal check process. | ||||
| 			timeoutCnt = 0 | ||||
| 			return false | ||||
| 		}(); isShortcut { | ||||
| 			continue | ||||
| 		} | ||||
| 		s.processErrorLock.Unlock() | ||||
|  | ||||
| 		// If the server supports streaming or we're already streaming, we want to move to streaming the next response | ||||
| 		// without waiting. If the server has transitioned to Unknown from a network error, we want to do another | ||||
| @@ -707,19 +732,31 @@ func (s *Server) check() (description.Server, error) { | ||||
| 	var err error | ||||
| 	var durationNanos int64 | ||||
|  | ||||
| 	// Create a new connection if this is the first check, the connection was closed after an error during the previous | ||||
| 	// check, or the previous check was cancelled. | ||||
| 	start := time.Now() | ||||
| 	if s.conn == nil || s.conn.closed() || s.checkWasCancelled() { | ||||
| 		// Create a new connection if this is the first check, the connection was closed after an error during the previous | ||||
| 		// check, or the previous check was cancelled. | ||||
| 		isNilConn := s.conn == nil | ||||
| 		if !isNilConn { | ||||
| 			s.publishServerHeartbeatStartedEvent(s.conn.ID(), false) | ||||
| 		} | ||||
| 		// Create a new connection and add it's handshake RTT as a sample. | ||||
| 		err = s.setupHeartbeatConnection() | ||||
| 		durationNanos = time.Since(start).Nanoseconds() | ||||
| 		if err == nil { | ||||
| 			// Use the description from the connection handshake as the value for this check. | ||||
| 			s.rttMonitor.addSample(s.conn.helloRTT) | ||||
| 			descPtr = &s.conn.desc | ||||
| 			if !isNilConn { | ||||
| 				s.publishServerHeartbeatSucceededEvent(s.conn.ID(), durationNanos, s.conn.desc, false) | ||||
| 			} | ||||
| 		} else { | ||||
| 			err = unwrapConnectionError(err) | ||||
| 			if !isNilConn { | ||||
| 				s.publishServerHeartbeatFailedEvent(s.conn.ID(), durationNanos, err, false) | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	if descPtr == nil && err == nil { | ||||
| 	} else { | ||||
| 		// An existing connection is being used. Use the server description properties to execute the right heartbeat. | ||||
|  | ||||
| 		// Wrap conn in a type that implements driver.StreamerConnection. | ||||
| @@ -729,7 +766,6 @@ func (s *Server) check() (description.Server, error) { | ||||
| 		streamable := previousDescription.TopologyVersion != nil | ||||
|  | ||||
| 		s.publishServerHeartbeatStartedEvent(s.conn.ID(), s.conn.getCurrentlyStreaming() || streamable) | ||||
| 		start := time.Now() | ||||
| 		switch { | ||||
| 		case s.conn.getCurrentlyStreaming(): | ||||
| 			// The connection is already in a streaming state, so we stream the next response. | ||||
|   | ||||
							
								
								
									
										1
									
								
								vendor/golang.org/x/sys/windows/syscall_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								vendor/golang.org/x/sys/windows/syscall_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -367,6 +367,7 @@ func NewCallbackCDecl(fn interface{}) uintptr { | ||||
| //sys	IsWindowUnicode(hwnd HWND) (isUnicode bool) = user32.IsWindowUnicode | ||||
| //sys	IsWindowVisible(hwnd HWND) (isVisible bool) = user32.IsWindowVisible | ||||
| //sys	GetGUIThreadInfo(thread uint32, info *GUIThreadInfo) (err error) = user32.GetGUIThreadInfo | ||||
| //sys	GetLargePageMinimum() (size uintptr) | ||||
|  | ||||
| // Volume Management Functions | ||||
| //sys	DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err error) = DefineDosDeviceW | ||||
|   | ||||
							
								
								
									
										7
									
								
								vendor/golang.org/x/sys/windows/zsyscall_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								vendor/golang.org/x/sys/windows/zsyscall_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -252,6 +252,7 @@ var ( | ||||
| 	procGetFileType                                          = modkernel32.NewProc("GetFileType") | ||||
| 	procGetFinalPathNameByHandleW                            = modkernel32.NewProc("GetFinalPathNameByHandleW") | ||||
| 	procGetFullPathNameW                                     = modkernel32.NewProc("GetFullPathNameW") | ||||
| 	procGetLargePageMinimum                                  = modkernel32.NewProc("GetLargePageMinimum") | ||||
| 	procGetLastError                                         = modkernel32.NewProc("GetLastError") | ||||
| 	procGetLogicalDriveStringsW                              = modkernel32.NewProc("GetLogicalDriveStringsW") | ||||
| 	procGetLogicalDrives                                     = modkernel32.NewProc("GetLogicalDrives") | ||||
| @@ -2180,6 +2181,12 @@ func GetFullPathName(path *uint16, buflen uint32, buf *uint16, fname **uint16) ( | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func GetLargePageMinimum() (size uintptr) { | ||||
| 	r0, _, _ := syscall.Syscall(procGetLargePageMinimum.Addr(), 0, 0, 0, 0) | ||||
| 	size = uintptr(r0) | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func GetLastError() (lasterr error) { | ||||
| 	r0, _, _ := syscall.Syscall(procGetLastError.Addr(), 0, 0, 0, 0) | ||||
| 	if r0 != 0 { | ||||
|   | ||||
							
								
								
									
										36
									
								
								vendor/k8s.io/apimachinery/pkg/util/wait/wait.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										36
									
								
								vendor/k8s.io/apimachinery/pkg/util/wait/wait.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -276,7 +276,7 @@ func (b *Backoff) Step() time.Duration { | ||||
| 	duration := b.Duration | ||||
|  | ||||
| 	// calculate the next step | ||||
| 	if b.Factor != 0 { | ||||
| 	if b.Factor != 0 && b.Steps != 0 { | ||||
| 		b.Duration = time.Duration(float64(b.Duration) * b.Factor) | ||||
| 		if b.Cap > 0 && b.Duration > b.Cap { | ||||
| 			b.Duration = b.Cap | ||||
| @@ -431,6 +431,17 @@ func ExponentialBackoff(backoff Backoff, condition ConditionFunc) error { | ||||
| 	return ErrWaitTimeout | ||||
| } | ||||
|  | ||||
| // ManagedExponentialBackoff, unlike ExponentialBackoff does not return ErrWaitTimeout. | ||||
| // Instead the loop continues indefinitely with Sleep being maxDuration (by Steps or Cap) + Jitter | ||||
| func ManagedExponentialBackoff(backoff Backoff, condition ConditionFunc) error { | ||||
| 	for { | ||||
| 		if ok, err := runConditionWithCrashProtection(condition); err != nil || ok { | ||||
| 			return err | ||||
| 		} | ||||
| 		time.Sleep(backoff.Step()) | ||||
| 	} | ||||
| } | ||||
|  | ||||
| // Poll tries a condition func until it returns true, an error, or the timeout | ||||
| // is reached. | ||||
| // | ||||
| @@ -755,3 +766,26 @@ func ExponentialBackoffWithContext(ctx context.Context, backoff Backoff, conditi | ||||
|  | ||||
| 	return ErrWaitTimeout | ||||
| } | ||||
|  | ||||
| // ManagedExponentialBackoffWithContext works with a request context and a Backoff. It ensures that the retry wait never | ||||
| // exceeds the deadline specified by the request context. | ||||
| func ManagedExponentialBackoffWithContext(ctx context.Context, backoff Backoff, condition ConditionFunc) error { | ||||
| 	for { | ||||
| 		select { | ||||
| 		case <-ctx.Done(): | ||||
| 			return ctx.Err() | ||||
| 		default: | ||||
| 		} | ||||
|  | ||||
| 		if ok, err := runConditionWithCrashProtection(condition); err != nil || ok { | ||||
| 			return err | ||||
| 		} | ||||
|  | ||||
| 		waitBeforeRetry := backoff.Step() | ||||
| 		select { | ||||
| 		case <-ctx.Done(): | ||||
| 			return ctx.Err() | ||||
| 		case <-time.After(waitBeforeRetry): | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|   | ||||
							
								
								
									
										27
									
								
								vendor/modules.txt
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										27
									
								
								vendor/modules.txt
									
									
									
									
										vendored
									
									
								
							| @@ -1,7 +1,7 @@ | ||||
| # github.com/beorn7/perks v1.0.1 | ||||
| ## explicit; go 1.11 | ||||
| github.com/beorn7/perks/quantile | ||||
| # github.com/cespare/xxhash/v2 v2.1.2 | ||||
| # github.com/cespare/xxhash/v2 v2.2.0 | ||||
| ## explicit; go 1.11 | ||||
| github.com/cespare/xxhash/v2 | ||||
| # github.com/cpuguy83/go-md2man/v2 v2.0.2 | ||||
| @@ -26,7 +26,7 @@ github.com/jtagcat/util/batch | ||||
| github.com/jtagcat/util/retry | ||||
| github.com/jtagcat/util/std | ||||
| github.com/jtagcat/util/tail | ||||
| # github.com/klauspost/compress v1.15.12 | ||||
| # github.com/klauspost/compress v1.15.13 | ||||
| ## explicit; go 1.17 | ||||
| github.com/klauspost/compress | ||||
| github.com/klauspost/compress/fse | ||||
| @@ -55,8 +55,8 @@ github.com/prometheus/client_golang/prometheus/promhttp | ||||
| # github.com/prometheus/client_model v0.3.0 | ||||
| ## explicit; go 1.9 | ||||
| github.com/prometheus/client_model/go | ||||
| # github.com/prometheus/common v0.37.0 | ||||
| ## explicit; go 1.16 | ||||
| # github.com/prometheus/common v0.39.0 | ||||
| ## explicit; go 1.17 | ||||
| github.com/prometheus/common/expfmt | ||||
| github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg | ||||
| github.com/prometheus/common/model | ||||
| @@ -68,16 +68,16 @@ github.com/prometheus/procfs/internal/util | ||||
| # github.com/russross/blackfriday/v2 v2.1.0 | ||||
| ## explicit | ||||
| github.com/russross/blackfriday/v2 | ||||
| # github.com/urfave/cli/v2 v2.23.5 | ||||
| # github.com/urfave/cli/v2 v2.23.7 | ||||
| ## explicit; go 1.18 | ||||
| github.com/urfave/cli/v2 | ||||
| # github.com/xdg-go/pbkdf2 v1.0.0 | ||||
| ## explicit; go 1.9 | ||||
| github.com/xdg-go/pbkdf2 | ||||
| # github.com/xdg-go/scram v1.1.1 | ||||
| # github.com/xdg-go/scram v1.1.2 | ||||
| ## explicit; go 1.11 | ||||
| github.com/xdg-go/scram | ||||
| # github.com/xdg-go/stringprep v1.0.3 | ||||
| # github.com/xdg-go/stringprep v1.0.4 | ||||
| ## explicit; go 1.11 | ||||
| github.com/xdg-go/stringprep | ||||
| # github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 | ||||
| @@ -86,7 +86,7 @@ github.com/xrash/smetrics | ||||
| # github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a | ||||
| ## explicit; go 1.12 | ||||
| github.com/youmark/pkcs8 | ||||
| # go.mongodb.org/mongo-driver v1.11.0 | ||||
| # go.mongodb.org/mongo-driver v1.11.1 | ||||
| ## explicit; go 1.13 | ||||
| go.mongodb.org/mongo-driver/bson | ||||
| go.mongodb.org/mongo-driver/bson/bsoncodec | ||||
| @@ -123,7 +123,7 @@ go.mongodb.org/mongo-driver/x/mongo/driver/operation | ||||
| go.mongodb.org/mongo-driver/x/mongo/driver/session | ||||
| go.mongodb.org/mongo-driver/x/mongo/driver/topology | ||||
| go.mongodb.org/mongo-driver/x/mongo/driver/wiremessage | ||||
| # golang.org/x/crypto v0.2.0 | ||||
| # golang.org/x/crypto v0.4.0 | ||||
| ## explicit; go 1.17 | ||||
| golang.org/x/crypto/ocsp | ||||
| golang.org/x/crypto/pbkdf2 | ||||
| @@ -131,12 +131,12 @@ golang.org/x/crypto/scrypt | ||||
| # golang.org/x/sync v0.1.0 | ||||
| ## explicit | ||||
| golang.org/x/sync/errgroup | ||||
| # golang.org/x/sys v0.2.0 | ||||
| # golang.org/x/sys v0.3.0 | ||||
| ## explicit; go 1.17 | ||||
| golang.org/x/sys/internal/unsafeheader | ||||
| golang.org/x/sys/unix | ||||
| golang.org/x/sys/windows | ||||
| # golang.org/x/text v0.4.0 | ||||
| # golang.org/x/text v0.5.0 | ||||
| ## explicit; go 1.17 | ||||
| golang.org/x/text/transform | ||||
| golang.org/x/text/unicode/norm | ||||
| @@ -170,7 +170,7 @@ google.golang.org/protobuf/runtime/protoiface | ||||
| google.golang.org/protobuf/runtime/protoimpl | ||||
| google.golang.org/protobuf/types/descriptorpb | ||||
| google.golang.org/protobuf/types/known/timestamppb | ||||
| # k8s.io/apimachinery v0.25.4 | ||||
| # k8s.io/apimachinery v0.26.0 => github.com/jtagcat/kubernetes/staging/src/k8s.io/apimachinery v0.0.0-20221027124836-581f57977fff | ||||
| ## explicit; go 1.19 | ||||
| k8s.io/apimachinery/pkg/util/runtime | ||||
| k8s.io/apimachinery/pkg/util/wait | ||||
| @@ -182,6 +182,7 @@ k8s.io/klog/v2/internal/clock | ||||
| k8s.io/klog/v2/internal/dbg | ||||
| k8s.io/klog/v2/internal/serialize | ||||
| k8s.io/klog/v2/internal/severity | ||||
| # k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2 | ||||
| # k8s.io/utils v0.0.0-20221128185143-99ec85e7a448 | ||||
| ## explicit; go 1.18 | ||||
| k8s.io/utils/clock | ||||
| # k8s.io/apimachinery => github.com/jtagcat/kubernetes/staging/src/k8s.io/apimachinery v0.0.0-20221027124836-581f57977fff | ||||
|   | ||||
		Reference in New Issue
	
	Block a user