From 85de641ac8f464b828c976d00c1689b8d6734700 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Wed, 5 Apr 2023 21:31:12 -0700 Subject: [PATCH] vendor: update github.com/klauspost/compress from v1.16.3 to v1.16.4 --- go.mod | 2 +- go.sum | 4 +- .../github.com/klauspost/compress/README.md | 2 + .../klauspost/compress/s2/decode.go | 1044 -------- .../klauspost/compress/s2/encode.go | 1030 +------- .../klauspost/compress/s2/encodeblock_amd64.s | 2181 +++++++++-------- .../klauspost/compress/s2/reader.go | 1055 ++++++++ .../klauspost/compress/s2/writer.go | 1020 ++++++++ .../klauspost/compress/zstd/blockenc.go | 9 +- .../klauspost/compress/zstd/decoder.go | 7 +- .../klauspost/compress/zstd/enc_best.go | 225 +- .../klauspost/compress/zstd/encoder.go | 78 +- .../compress/zstd/encoder_options.go | 4 +- .../klauspost/compress/zstd/framedec.go | 35 +- .../klauspost/compress/zstd/seqdec.go | 5 +- .../klauspost/compress/zstd/seqdec_amd64.go | 16 + .../klauspost/compress/zstd/seqdec_amd64.s | 124 +- .../klauspost/compress/zstd/zstd.go | 4 +- vendor/modules.txt | 2 +- 19 files changed, 3515 insertions(+), 3332 deletions(-) create mode 100644 vendor/github.com/klauspost/compress/s2/reader.go create mode 100644 vendor/github.com/klauspost/compress/s2/writer.go diff --git a/go.mod b/go.mod index 338dd765b..f80c5dec2 100644 --- a/go.mod +++ b/go.mod @@ -23,7 +23,7 @@ require ( github.com/golang/snappy v0.0.4 github.com/googleapis/gax-go/v2 v2.8.0 github.com/influxdata/influxdb v1.11.0 - github.com/klauspost/compress v1.16.3 + github.com/klauspost/compress v1.16.4 github.com/prometheus/prometheus v0.43.0 github.com/urfave/cli/v2 v2.25.0 github.com/valyala/fastjson v1.6.4 diff --git a/go.sum b/go.sum index c9b3f8c28..a5cf4f137 100644 --- a/go.sum +++ b/go.sum @@ -313,8 +313,8 @@ github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.13.4/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/klauspost/compress v1.13.5/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= -github.com/klauspost/compress v1.16.3 h1:XuJt9zzcnaz6a16/OU53ZjWp/v7/42WcR5t2a0PcNQY= -github.com/klauspost/compress v1.16.3/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/klauspost/compress v1.16.4 h1:91KN02FnsOYhuunwU4ssRe8lc2JosWmizWa91B5v1PU= +github.com/klauspost/compress v1.16.4/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/kolo/xmlrpc v0.0.0-20220921171641-a4b6fa1dd06b h1:udzkj9S/zlT5X367kqJis0QP7YMxobob6zhzq6Yre00= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= diff --git a/vendor/github.com/klauspost/compress/README.md b/vendor/github.com/klauspost/compress/README.md index c2c7252fe..55c8ca447 100644 --- a/vendor/github.com/klauspost/compress/README.md +++ b/vendor/github.com/klauspost/compress/README.md @@ -615,6 +615,8 @@ Here are other packages of good quality and pure Go (no cgo wrappers or autoconv * [github.com/pierrec/lz4](https://github.com/pierrec/lz4) - strong multithreaded LZ4 compression. * [github.com/cosnicolaou/pbzip2](https://github.com/cosnicolaou/pbzip2) - multithreaded bzip2 decompression. * [github.com/dsnet/compress](https://github.com/dsnet/compress) - brotli decompression, bzip2 writer. +* [github.com/ronanh/intcomp](https://github.com/ronanh/intcomp) - Integer compression. +* [github.com/spenczar/fpc](https://github.com/spenczar/fpc) - Float compression. # license diff --git a/vendor/github.com/klauspost/compress/s2/decode.go b/vendor/github.com/klauspost/compress/s2/decode.go index b7c9adfdd..6c7feafcc 100644 --- a/vendor/github.com/klauspost/compress/s2/decode.go +++ b/vendor/github.com/klauspost/compress/s2/decode.go @@ -9,12 +9,7 @@ import ( "encoding/binary" "errors" "fmt" - "io" - "io/ioutil" - "math" - "runtime" "strconv" - "sync" ) var ( @@ -28,16 +23,6 @@ var ( ErrUnsupported = errors.New("s2: unsupported input") ) -// ErrCantSeek is returned if the stream cannot be seeked. -type ErrCantSeek struct { - Reason string -} - -// Error returns the error as string. -func (e ErrCantSeek) Error() string { - return fmt.Sprintf("s2: Can't seek because %s", e.Reason) -} - // DecodedLen returns the length of the decoded block. func DecodedLen(src []byte) (int, error) { v, _, err := decodedLen(src) @@ -84,1035 +69,6 @@ func Decode(dst, src []byte) ([]byte, error) { return dst, nil } -// NewReader returns a new Reader that decompresses from r, using the framing -// format described at -// https://github.com/google/snappy/blob/master/framing_format.txt with S2 changes. -func NewReader(r io.Reader, opts ...ReaderOption) *Reader { - nr := Reader{ - r: r, - maxBlock: maxBlockSize, - } - for _, opt := range opts { - if err := opt(&nr); err != nil { - nr.err = err - return &nr - } - } - nr.maxBufSize = MaxEncodedLen(nr.maxBlock) + checksumSize - if nr.lazyBuf > 0 { - nr.buf = make([]byte, MaxEncodedLen(nr.lazyBuf)+checksumSize) - } else { - nr.buf = make([]byte, MaxEncodedLen(defaultBlockSize)+checksumSize) - } - nr.readHeader = nr.ignoreStreamID - nr.paramsOK = true - return &nr -} - -// ReaderOption is an option for creating a decoder. -type ReaderOption func(*Reader) error - -// ReaderMaxBlockSize allows to control allocations if the stream -// has been compressed with a smaller WriterBlockSize, or with the default 1MB. -// Blocks must be this size or smaller to decompress, -// otherwise the decoder will return ErrUnsupported. -// -// For streams compressed with Snappy this can safely be set to 64KB (64 << 10). -// -// Default is the maximum limit of 4MB. -func ReaderMaxBlockSize(blockSize int) ReaderOption { - return func(r *Reader) error { - if blockSize > maxBlockSize || blockSize <= 0 { - return errors.New("s2: block size too large. Must be <= 4MB and > 0") - } - if r.lazyBuf == 0 && blockSize < defaultBlockSize { - r.lazyBuf = blockSize - } - r.maxBlock = blockSize - return nil - } -} - -// ReaderAllocBlock allows to control upfront stream allocations -// and not allocate for frames bigger than this initially. -// If frames bigger than this is seen a bigger buffer will be allocated. -// -// Default is 1MB, which is default output size. -func ReaderAllocBlock(blockSize int) ReaderOption { - return func(r *Reader) error { - if blockSize > maxBlockSize || blockSize < 1024 { - return errors.New("s2: invalid ReaderAllocBlock. Must be <= 4MB and >= 1024") - } - r.lazyBuf = blockSize - return nil - } -} - -// ReaderIgnoreStreamIdentifier will make the reader skip the expected -// stream identifier at the beginning of the stream. -// This can be used when serving a stream that has been forwarded to a specific point. -func ReaderIgnoreStreamIdentifier() ReaderOption { - return func(r *Reader) error { - r.ignoreStreamID = true - return nil - } -} - -// ReaderSkippableCB will register a callback for chuncks with the specified ID. -// ID must be a Reserved skippable chunks ID, 0x80-0xfd (inclusive). -// For each chunk with the ID, the callback is called with the content. -// Any returned non-nil error will abort decompression. -// Only one callback per ID is supported, latest sent will be used. -func ReaderSkippableCB(id uint8, fn func(r io.Reader) error) ReaderOption { - return func(r *Reader) error { - if id < 0x80 || id > 0xfd { - return fmt.Errorf("ReaderSkippableCB: Invalid id provided, must be 0x80-0xfd (inclusive)") - } - r.skippableCB[id] = fn - return nil - } -} - -// ReaderIgnoreCRC will make the reader skip CRC calculation and checks. -func ReaderIgnoreCRC() ReaderOption { - return func(r *Reader) error { - r.ignoreCRC = true - return nil - } -} - -// Reader is an io.Reader that can read Snappy-compressed bytes. -type Reader struct { - r io.Reader - err error - decoded []byte - buf []byte - skippableCB [0x80]func(r io.Reader) error - blockStart int64 // Uncompressed offset at start of current. - index *Index - - // decoded[i:j] contains decoded bytes that have not yet been passed on. - i, j int - // maximum block size allowed. - maxBlock int - // maximum expected buffer size. - maxBufSize int - // alloc a buffer this size if > 0. - lazyBuf int - readHeader bool - paramsOK bool - snappyFrame bool - ignoreStreamID bool - ignoreCRC bool -} - -// ensureBufferSize will ensure that the buffer can take at least n bytes. -// If false is returned the buffer exceeds maximum allowed size. -func (r *Reader) ensureBufferSize(n int) bool { - if n > r.maxBufSize { - r.err = ErrCorrupt - return false - } - if cap(r.buf) >= n { - return true - } - // Realloc buffer. - r.buf = make([]byte, n) - return true -} - -// Reset discards any buffered data, resets all state, and switches the Snappy -// reader to read from r. This permits reusing a Reader rather than allocating -// a new one. -func (r *Reader) Reset(reader io.Reader) { - if !r.paramsOK { - return - } - r.index = nil - r.r = reader - r.err = nil - r.i = 0 - r.j = 0 - r.blockStart = 0 - r.readHeader = r.ignoreStreamID -} - -func (r *Reader) readFull(p []byte, allowEOF bool) (ok bool) { - if _, r.err = io.ReadFull(r.r, p); r.err != nil { - if r.err == io.ErrUnexpectedEOF || (r.err == io.EOF && !allowEOF) { - r.err = ErrCorrupt - } - return false - } - return true -} - -// skippable will skip n bytes. -// If the supplied reader supports seeking that is used. -// tmp is used as a temporary buffer for reading. -// The supplied slice does not need to be the size of the read. -func (r *Reader) skippable(tmp []byte, n int, allowEOF bool, id uint8) (ok bool) { - if id < 0x80 { - r.err = fmt.Errorf("interbal error: skippable id < 0x80") - return false - } - if fn := r.skippableCB[id-0x80]; fn != nil { - rd := io.LimitReader(r.r, int64(n)) - r.err = fn(rd) - if r.err != nil { - return false - } - _, r.err = io.CopyBuffer(ioutil.Discard, rd, tmp) - return r.err == nil - } - if rs, ok := r.r.(io.ReadSeeker); ok { - _, err := rs.Seek(int64(n), io.SeekCurrent) - if err == nil { - return true - } - if err == io.ErrUnexpectedEOF || (r.err == io.EOF && !allowEOF) { - r.err = ErrCorrupt - return false - } - } - for n > 0 { - if n < len(tmp) { - tmp = tmp[:n] - } - if _, r.err = io.ReadFull(r.r, tmp); r.err != nil { - if r.err == io.ErrUnexpectedEOF || (r.err == io.EOF && !allowEOF) { - r.err = ErrCorrupt - } - return false - } - n -= len(tmp) - } - return true -} - -// Read satisfies the io.Reader interface. -func (r *Reader) Read(p []byte) (int, error) { - if r.err != nil { - return 0, r.err - } - for { - if r.i < r.j { - n := copy(p, r.decoded[r.i:r.j]) - r.i += n - return n, nil - } - if !r.readFull(r.buf[:4], true) { - return 0, r.err - } - chunkType := r.buf[0] - if !r.readHeader { - if chunkType != chunkTypeStreamIdentifier { - r.err = ErrCorrupt - return 0, r.err - } - r.readHeader = true - } - chunkLen := int(r.buf[1]) | int(r.buf[2])<<8 | int(r.buf[3])<<16 - - // The chunk types are specified at - // https://github.com/google/snappy/blob/master/framing_format.txt - switch chunkType { - case chunkTypeCompressedData: - r.blockStart += int64(r.j) - // Section 4.2. Compressed data (chunk type 0x00). - if chunkLen < checksumSize { - r.err = ErrCorrupt - return 0, r.err - } - if !r.ensureBufferSize(chunkLen) { - if r.err == nil { - r.err = ErrUnsupported - } - return 0, r.err - } - buf := r.buf[:chunkLen] - if !r.readFull(buf, false) { - return 0, r.err - } - checksum := uint32(buf[0]) | uint32(buf[1])<<8 | uint32(buf[2])<<16 | uint32(buf[3])<<24 - buf = buf[checksumSize:] - - n, err := DecodedLen(buf) - if err != nil { - r.err = err - return 0, r.err - } - if r.snappyFrame && n > maxSnappyBlockSize { - r.err = ErrCorrupt - return 0, r.err - } - - if n > len(r.decoded) { - if n > r.maxBlock { - r.err = ErrCorrupt - return 0, r.err - } - r.decoded = make([]byte, n) - } - if _, err := Decode(r.decoded, buf); err != nil { - r.err = err - return 0, r.err - } - if !r.ignoreCRC && crc(r.decoded[:n]) != checksum { - r.err = ErrCRC - return 0, r.err - } - r.i, r.j = 0, n - continue - - case chunkTypeUncompressedData: - r.blockStart += int64(r.j) - // Section 4.3. Uncompressed data (chunk type 0x01). - if chunkLen < checksumSize { - r.err = ErrCorrupt - return 0, r.err - } - if !r.ensureBufferSize(chunkLen) { - if r.err == nil { - r.err = ErrUnsupported - } - return 0, r.err - } - buf := r.buf[:checksumSize] - if !r.readFull(buf, false) { - return 0, r.err - } - checksum := uint32(buf[0]) | uint32(buf[1])<<8 | uint32(buf[2])<<16 | uint32(buf[3])<<24 - // Read directly into r.decoded instead of via r.buf. - n := chunkLen - checksumSize - if r.snappyFrame && n > maxSnappyBlockSize { - r.err = ErrCorrupt - return 0, r.err - } - if n > len(r.decoded) { - if n > r.maxBlock { - r.err = ErrCorrupt - return 0, r.err - } - r.decoded = make([]byte, n) - } - if !r.readFull(r.decoded[:n], false) { - return 0, r.err - } - if !r.ignoreCRC && crc(r.decoded[:n]) != checksum { - r.err = ErrCRC - return 0, r.err - } - r.i, r.j = 0, n - continue - - case chunkTypeStreamIdentifier: - // Section 4.1. Stream identifier (chunk type 0xff). - if chunkLen != len(magicBody) { - r.err = ErrCorrupt - return 0, r.err - } - if !r.readFull(r.buf[:len(magicBody)], false) { - return 0, r.err - } - if string(r.buf[:len(magicBody)]) != magicBody { - if string(r.buf[:len(magicBody)]) != magicBodySnappy { - r.err = ErrCorrupt - return 0, r.err - } else { - r.snappyFrame = true - } - } else { - r.snappyFrame = false - } - continue - } - - if chunkType <= 0x7f { - // Section 4.5. Reserved unskippable chunks (chunk types 0x02-0x7f). - // fmt.Printf("ERR chunktype: 0x%x\n", chunkType) - r.err = ErrUnsupported - return 0, r.err - } - // Section 4.4 Padding (chunk type 0xfe). - // Section 4.6. Reserved skippable chunks (chunk types 0x80-0xfd). - if chunkLen > maxChunkSize { - // fmt.Printf("ERR chunkLen: 0x%x\n", chunkLen) - r.err = ErrUnsupported - return 0, r.err - } - - // fmt.Printf("skippable: ID: 0x%x, len: 0x%x\n", chunkType, chunkLen) - if !r.skippable(r.buf, chunkLen, false, chunkType) { - return 0, r.err - } - } -} - -// DecodeConcurrent will decode the full stream to w. -// This function should not be combined with reading, seeking or other operations. -// Up to 'concurrent' goroutines will be used. -// If <= 0, runtime.NumCPU will be used. -// On success the number of bytes decompressed nil and is returned. -// This is mainly intended for bigger streams. -func (r *Reader) DecodeConcurrent(w io.Writer, concurrent int) (written int64, err error) { - if r.i > 0 || r.j > 0 || r.blockStart > 0 { - return 0, errors.New("DecodeConcurrent called after ") - } - if concurrent <= 0 { - concurrent = runtime.NumCPU() - } - - // Write to output - var errMu sync.Mutex - var aErr error - setErr := func(e error) (ok bool) { - errMu.Lock() - defer errMu.Unlock() - if e == nil { - return aErr == nil - } - if aErr == nil { - aErr = e - } - return false - } - hasErr := func() (ok bool) { - errMu.Lock() - v := aErr != nil - errMu.Unlock() - return v - } - - var aWritten int64 - toRead := make(chan []byte, concurrent) - writtenBlocks := make(chan []byte, concurrent) - queue := make(chan chan []byte, concurrent) - reUse := make(chan chan []byte, concurrent) - for i := 0; i < concurrent; i++ { - toRead <- make([]byte, 0, r.maxBufSize) - writtenBlocks <- make([]byte, 0, r.maxBufSize) - reUse <- make(chan []byte, 1) - } - // Writer - var wg sync.WaitGroup - wg.Add(1) - go func() { - defer wg.Done() - for toWrite := range queue { - entry := <-toWrite - reUse <- toWrite - if hasErr() { - writtenBlocks <- entry - continue - } - n, err := w.Write(entry) - want := len(entry) - writtenBlocks <- entry - if err != nil { - setErr(err) - continue - } - if n != want { - setErr(io.ErrShortWrite) - continue - } - aWritten += int64(n) - } - }() - - // Reader - defer func() { - close(queue) - if r.err != nil { - err = r.err - setErr(r.err) - } - wg.Wait() - if err == nil { - err = aErr - } - written = aWritten - }() - - for !hasErr() { - if !r.readFull(r.buf[:4], true) { - if r.err == io.EOF { - r.err = nil - } - return 0, r.err - } - chunkType := r.buf[0] - if !r.readHeader { - if chunkType != chunkTypeStreamIdentifier { - r.err = ErrCorrupt - return 0, r.err - } - r.readHeader = true - } - chunkLen := int(r.buf[1]) | int(r.buf[2])<<8 | int(r.buf[3])<<16 - - // The chunk types are specified at - // https://github.com/google/snappy/blob/master/framing_format.txt - switch chunkType { - case chunkTypeCompressedData: - r.blockStart += int64(r.j) - // Section 4.2. Compressed data (chunk type 0x00). - if chunkLen < checksumSize { - r.err = ErrCorrupt - return 0, r.err - } - if chunkLen > r.maxBufSize { - r.err = ErrCorrupt - return 0, r.err - } - orgBuf := <-toRead - buf := orgBuf[:chunkLen] - - if !r.readFull(buf, false) { - return 0, r.err - } - - checksum := uint32(buf[0]) | uint32(buf[1])<<8 | uint32(buf[2])<<16 | uint32(buf[3])<<24 - buf = buf[checksumSize:] - - n, err := DecodedLen(buf) - if err != nil { - r.err = err - return 0, r.err - } - if r.snappyFrame && n > maxSnappyBlockSize { - r.err = ErrCorrupt - return 0, r.err - } - - if n > r.maxBlock { - r.err = ErrCorrupt - return 0, r.err - } - wg.Add(1) - - decoded := <-writtenBlocks - entry := <-reUse - queue <- entry - go func() { - defer wg.Done() - decoded = decoded[:n] - _, err := Decode(decoded, buf) - toRead <- orgBuf - if err != nil { - writtenBlocks <- decoded - setErr(err) - return - } - if !r.ignoreCRC && crc(decoded) != checksum { - writtenBlocks <- decoded - setErr(ErrCRC) - return - } - entry <- decoded - }() - continue - - case chunkTypeUncompressedData: - - // Section 4.3. Uncompressed data (chunk type 0x01). - if chunkLen < checksumSize { - r.err = ErrCorrupt - return 0, r.err - } - if chunkLen > r.maxBufSize { - r.err = ErrCorrupt - return 0, r.err - } - // Grab write buffer - orgBuf := <-writtenBlocks - buf := orgBuf[:checksumSize] - if !r.readFull(buf, false) { - return 0, r.err - } - checksum := uint32(buf[0]) | uint32(buf[1])<<8 | uint32(buf[2])<<16 | uint32(buf[3])<<24 - // Read content. - n := chunkLen - checksumSize - - if r.snappyFrame && n > maxSnappyBlockSize { - r.err = ErrCorrupt - return 0, r.err - } - if n > r.maxBlock { - r.err = ErrCorrupt - return 0, r.err - } - // Read uncompressed - buf = orgBuf[:n] - if !r.readFull(buf, false) { - return 0, r.err - } - - if !r.ignoreCRC && crc(buf) != checksum { - r.err = ErrCRC - return 0, r.err - } - entry := <-reUse - queue <- entry - entry <- buf - continue - - case chunkTypeStreamIdentifier: - // Section 4.1. Stream identifier (chunk type 0xff). - if chunkLen != len(magicBody) { - r.err = ErrCorrupt - return 0, r.err - } - if !r.readFull(r.buf[:len(magicBody)], false) { - return 0, r.err - } - if string(r.buf[:len(magicBody)]) != magicBody { - if string(r.buf[:len(magicBody)]) != magicBodySnappy { - r.err = ErrCorrupt - return 0, r.err - } else { - r.snappyFrame = true - } - } else { - r.snappyFrame = false - } - continue - } - - if chunkType <= 0x7f { - // Section 4.5. Reserved unskippable chunks (chunk types 0x02-0x7f). - // fmt.Printf("ERR chunktype: 0x%x\n", chunkType) - r.err = ErrUnsupported - return 0, r.err - } - // Section 4.4 Padding (chunk type 0xfe). - // Section 4.6. Reserved skippable chunks (chunk types 0x80-0xfd). - if chunkLen > maxChunkSize { - // fmt.Printf("ERR chunkLen: 0x%x\n", chunkLen) - r.err = ErrUnsupported - return 0, r.err - } - - // fmt.Printf("skippable: ID: 0x%x, len: 0x%x\n", chunkType, chunkLen) - if !r.skippable(r.buf, chunkLen, false, chunkType) { - return 0, r.err - } - } - return 0, r.err -} - -// Skip will skip n bytes forward in the decompressed output. -// For larger skips this consumes less CPU and is faster than reading output and discarding it. -// CRC is not checked on skipped blocks. -// io.ErrUnexpectedEOF is returned if the stream ends before all bytes have been skipped. -// If a decoding error is encountered subsequent calls to Read will also fail. -func (r *Reader) Skip(n int64) error { - if n < 0 { - return errors.New("attempted negative skip") - } - if r.err != nil { - return r.err - } - - for n > 0 { - if r.i < r.j { - // Skip in buffer. - // decoded[i:j] contains decoded bytes that have not yet been passed on. - left := int64(r.j - r.i) - if left >= n { - tmp := int64(r.i) + n - if tmp > math.MaxInt32 { - return errors.New("s2: internal overflow in skip") - } - r.i = int(tmp) - return nil - } - n -= int64(r.j - r.i) - r.i = r.j - } - - // Buffer empty; read blocks until we have content. - if !r.readFull(r.buf[:4], true) { - if r.err == io.EOF { - r.err = io.ErrUnexpectedEOF - } - return r.err - } - chunkType := r.buf[0] - if !r.readHeader { - if chunkType != chunkTypeStreamIdentifier { - r.err = ErrCorrupt - return r.err - } - r.readHeader = true - } - chunkLen := int(r.buf[1]) | int(r.buf[2])<<8 | int(r.buf[3])<<16 - - // The chunk types are specified at - // https://github.com/google/snappy/blob/master/framing_format.txt - switch chunkType { - case chunkTypeCompressedData: - r.blockStart += int64(r.j) - // Section 4.2. Compressed data (chunk type 0x00). - if chunkLen < checksumSize { - r.err = ErrCorrupt - return r.err - } - if !r.ensureBufferSize(chunkLen) { - if r.err == nil { - r.err = ErrUnsupported - } - return r.err - } - buf := r.buf[:chunkLen] - if !r.readFull(buf, false) { - return r.err - } - checksum := uint32(buf[0]) | uint32(buf[1])<<8 | uint32(buf[2])<<16 | uint32(buf[3])<<24 - buf = buf[checksumSize:] - - dLen, err := DecodedLen(buf) - if err != nil { - r.err = err - return r.err - } - if dLen > r.maxBlock { - r.err = ErrCorrupt - return r.err - } - // Check if destination is within this block - if int64(dLen) > n { - if len(r.decoded) < dLen { - r.decoded = make([]byte, dLen) - } - if _, err := Decode(r.decoded, buf); err != nil { - r.err = err - return r.err - } - if crc(r.decoded[:dLen]) != checksum { - r.err = ErrCorrupt - return r.err - } - } else { - // Skip block completely - n -= int64(dLen) - r.blockStart += int64(dLen) - dLen = 0 - } - r.i, r.j = 0, dLen - continue - case chunkTypeUncompressedData: - r.blockStart += int64(r.j) - // Section 4.3. Uncompressed data (chunk type 0x01). - if chunkLen < checksumSize { - r.err = ErrCorrupt - return r.err - } - if !r.ensureBufferSize(chunkLen) { - if r.err != nil { - r.err = ErrUnsupported - } - return r.err - } - buf := r.buf[:checksumSize] - if !r.readFull(buf, false) { - return r.err - } - checksum := uint32(buf[0]) | uint32(buf[1])<<8 | uint32(buf[2])<<16 | uint32(buf[3])<<24 - // Read directly into r.decoded instead of via r.buf. - n2 := chunkLen - checksumSize - if n2 > len(r.decoded) { - if n2 > r.maxBlock { - r.err = ErrCorrupt - return r.err - } - r.decoded = make([]byte, n2) - } - if !r.readFull(r.decoded[:n2], false) { - return r.err - } - if int64(n2) < n { - if crc(r.decoded[:n2]) != checksum { - r.err = ErrCorrupt - return r.err - } - } - r.i, r.j = 0, n2 - continue - case chunkTypeStreamIdentifier: - // Section 4.1. Stream identifier (chunk type 0xff). - if chunkLen != len(magicBody) { - r.err = ErrCorrupt - return r.err - } - if !r.readFull(r.buf[:len(magicBody)], false) { - return r.err - } - if string(r.buf[:len(magicBody)]) != magicBody { - if string(r.buf[:len(magicBody)]) != magicBodySnappy { - r.err = ErrCorrupt - return r.err - } - } - - continue - } - - if chunkType <= 0x7f { - // Section 4.5. Reserved unskippable chunks (chunk types 0x02-0x7f). - r.err = ErrUnsupported - return r.err - } - if chunkLen > maxChunkSize { - r.err = ErrUnsupported - return r.err - } - // Section 4.4 Padding (chunk type 0xfe). - // Section 4.6. Reserved skippable chunks (chunk types 0x80-0xfd). - if !r.skippable(r.buf, chunkLen, false, chunkType) { - return r.err - } - } - return nil -} - -// ReadSeeker provides random or forward seeking in compressed content. -// See Reader.ReadSeeker -type ReadSeeker struct { - *Reader - readAtMu sync.Mutex -} - -// ReadSeeker will return an io.ReadSeeker and io.ReaderAt -// compatible version of the reader. -// If 'random' is specified the returned io.Seeker can be used for -// random seeking, otherwise only forward seeking is supported. -// Enabling random seeking requires the original input to support -// the io.Seeker interface. -// A custom index can be specified which will be used if supplied. -// When using a custom index, it will not be read from the input stream. -// The ReadAt position will affect regular reads and the current position of Seek. -// So using Read after ReadAt will continue from where the ReadAt stopped. -// No functions should be used concurrently. -// The returned ReadSeeker contains a shallow reference to the existing Reader, -// meaning changes performed to one is reflected in the other. -func (r *Reader) ReadSeeker(random bool, index []byte) (*ReadSeeker, error) { - // Read index if provided. - if len(index) != 0 { - if r.index == nil { - r.index = &Index{} - } - if _, err := r.index.Load(index); err != nil { - return nil, ErrCantSeek{Reason: "loading index returned: " + err.Error()} - } - } - - // Check if input is seekable - rs, ok := r.r.(io.ReadSeeker) - if !ok { - if !random { - return &ReadSeeker{Reader: r}, nil - } - return nil, ErrCantSeek{Reason: "input stream isn't seekable"} - } - - if r.index != nil { - // Seekable and index, ok... - return &ReadSeeker{Reader: r}, nil - } - - // Load from stream. - r.index = &Index{} - - // Read current position. - pos, err := rs.Seek(0, io.SeekCurrent) - if err != nil { - return nil, ErrCantSeek{Reason: "seeking input returned: " + err.Error()} - } - err = r.index.LoadStream(rs) - if err != nil { - if err == ErrUnsupported { - // If we don't require random seeking, reset input and return. - if !random { - _, err = rs.Seek(pos, io.SeekStart) - if err != nil { - return nil, ErrCantSeek{Reason: "resetting stream returned: " + err.Error()} - } - r.index = nil - return &ReadSeeker{Reader: r}, nil - } - return nil, ErrCantSeek{Reason: "input stream does not contain an index"} - } - return nil, ErrCantSeek{Reason: "reading index returned: " + err.Error()} - } - - // reset position. - _, err = rs.Seek(pos, io.SeekStart) - if err != nil { - return nil, ErrCantSeek{Reason: "seeking input returned: " + err.Error()} - } - return &ReadSeeker{Reader: r}, nil -} - -// Seek allows seeking in compressed data. -func (r *ReadSeeker) Seek(offset int64, whence int) (int64, error) { - if r.err != nil { - if !errors.Is(r.err, io.EOF) { - return 0, r.err - } - // Reset on EOF - r.err = nil - } - - // Calculate absolute offset. - absOffset := offset - - switch whence { - case io.SeekStart: - case io.SeekCurrent: - absOffset = r.blockStart + int64(r.i) + offset - case io.SeekEnd: - if r.index == nil { - return 0, ErrUnsupported - } - absOffset = r.index.TotalUncompressed + offset - default: - r.err = ErrUnsupported - return 0, r.err - } - - if absOffset < 0 { - return 0, errors.New("seek before start of file") - } - - if !r.readHeader { - // Make sure we read the header. - _, r.err = r.Read([]byte{}) - if r.err != nil { - return 0, r.err - } - } - - // If we are inside current block no need to seek. - // This includes no offset changes. - if absOffset >= r.blockStart && absOffset < r.blockStart+int64(r.j) { - r.i = int(absOffset - r.blockStart) - return r.blockStart + int64(r.i), nil - } - - rs, ok := r.r.(io.ReadSeeker) - if r.index == nil || !ok { - currOffset := r.blockStart + int64(r.i) - if absOffset >= currOffset { - err := r.Skip(absOffset - currOffset) - return r.blockStart + int64(r.i), err - } - return 0, ErrUnsupported - } - - // We can seek and we have an index. - c, u, err := r.index.Find(absOffset) - if err != nil { - return r.blockStart + int64(r.i), err - } - - // Seek to next block - _, err = rs.Seek(c, io.SeekStart) - if err != nil { - return 0, err - } - - r.i = r.j // Remove rest of current block. - r.blockStart = u - int64(r.j) // Adjust current block start for accounting. - if u < absOffset { - // Forward inside block - return absOffset, r.Skip(absOffset - u) - } - if u > absOffset { - return 0, fmt.Errorf("s2 seek: (internal error) u (%d) > absOffset (%d)", u, absOffset) - } - return absOffset, nil -} - -// ReadAt reads len(p) bytes into p starting at offset off in the -// underlying input source. It returns the number of bytes -// read (0 <= n <= len(p)) and any error encountered. -// -// When ReadAt returns n < len(p), it returns a non-nil error -// explaining why more bytes were not returned. In this respect, -// ReadAt is stricter than Read. -// -// Even if ReadAt returns n < len(p), it may use all of p as scratch -// space during the call. If some data is available but not len(p) bytes, -// ReadAt blocks until either all the data is available or an error occurs. -// In this respect ReadAt is different from Read. -// -// If the n = len(p) bytes returned by ReadAt are at the end of the -// input source, ReadAt may return either err == EOF or err == nil. -// -// If ReadAt is reading from an input source with a seek offset, -// ReadAt should not affect nor be affected by the underlying -// seek offset. -// -// Clients of ReadAt can execute parallel ReadAt calls on the -// same input source. This is however not recommended. -func (r *ReadSeeker) ReadAt(p []byte, offset int64) (int, error) { - r.readAtMu.Lock() - defer r.readAtMu.Unlock() - _, err := r.Seek(offset, io.SeekStart) - if err != nil { - return 0, err - } - n := 0 - for n < len(p) { - n2, err := r.Read(p[n:]) - if err != nil { - // This will include io.EOF - return n + n2, err - } - n += n2 - } - return n, nil -} - -// ReadByte satisfies the io.ByteReader interface. -func (r *Reader) ReadByte() (byte, error) { - if r.err != nil { - return 0, r.err - } - if r.i < r.j { - c := r.decoded[r.i] - r.i++ - return c, nil - } - var tmp [1]byte - for i := 0; i < 10; i++ { - n, err := r.Read(tmp[:]) - if err != nil { - return 0, err - } - if n == 1 { - return tmp[0], nil - } - } - return 0, io.ErrNoProgress -} - -// SkippableCB will register a callback for chunks with the specified ID. -// ID must be a Reserved skippable chunks ID, 0x80-0xfe (inclusive). -// For each chunk with the ID, the callback is called with the content. -// Any returned non-nil error will abort decompression. -// Only one callback per ID is supported, latest sent will be used. -// Sending a nil function will disable previous callbacks. -func (r *Reader) SkippableCB(id uint8, fn func(r io.Reader) error) error { - if id < 0x80 || id > chunkTypePadding { - return fmt.Errorf("ReaderSkippableCB: Invalid id provided, must be 0x80-0xfe (inclusive)") - } - r.skippableCB[id] = fn - return nil -} - // s2DecodeDict writes the decoding of src to dst. It assumes that the varint-encoded // length of the decompressed bytes has already been read, and that len(dst) // equals that length. diff --git a/vendor/github.com/klauspost/compress/s2/encode.go b/vendor/github.com/klauspost/compress/s2/encode.go index c2ca7236a..e6c231021 100644 --- a/vendor/github.com/klauspost/compress/s2/encode.go +++ b/vendor/github.com/klauspost/compress/s2/encode.go @@ -6,15 +6,9 @@ package s2 import ( - "crypto/rand" "encoding/binary" - "errors" - "fmt" - "io" "math" "math/bits" - "runtime" - "sync" ) // Encode returns the encoded form of src. The returned slice may be a sub- @@ -355,9 +349,12 @@ const inputMargin = 8 // will be accepted by the encoder. const minNonLiteralBlockSize = 32 +const intReduction = 2 - (1 << (^uint(0) >> 63)) // 1 (32 bits) or 0 (64 bits) + // MaxBlockSize is the maximum value where MaxEncodedLen will return a valid block size. // Blocks this big are highly discouraged, though. -const MaxBlockSize = math.MaxUint32 - binary.MaxVarintLen32 - 5 +// Half the size on 32 bit systems. +const MaxBlockSize = (1<<(32-intReduction) - 1) - binary.MaxVarintLen32 - 5 // MaxEncodedLen returns the maximum length of a snappy block, given its // uncompressed length. @@ -366,7 +363,14 @@ const MaxBlockSize = math.MaxUint32 - binary.MaxVarintLen32 - 5 // 32 bit platforms will have lower thresholds for rejecting big content. func MaxEncodedLen(srcLen int) int { n := uint64(srcLen) - if n > 0xffffffff { + if intReduction == 1 { + // 32 bits + if n > math.MaxInt32 { + // Also includes negative. + return -1 + } + } else if n > 0xffffffff { + // 64 bits // Also includes negative. return -1 } @@ -375,1009 +379,15 @@ func MaxEncodedLen(srcLen int) int { // Add maximum size of encoding block as literals. n += uint64(literalExtraSize(int64(srcLen))) - if n > 0xffffffff { + if intReduction == 1 { + // 32 bits + if n > math.MaxInt32 { + return -1 + } + } else if n > 0xffffffff { + // 64 bits + // Also includes negative. return -1 } return int(n) } - -var errClosed = errors.New("s2: Writer is closed") - -// NewWriter returns a new Writer that compresses to w, using the -// framing format described at -// https://github.com/google/snappy/blob/master/framing_format.txt -// -// Users must call Close to guarantee all data has been forwarded to -// the underlying io.Writer and that resources are released. -// They may also call Flush zero or more times before calling Close. -func NewWriter(w io.Writer, opts ...WriterOption) *Writer { - w2 := Writer{ - blockSize: defaultBlockSize, - concurrency: runtime.GOMAXPROCS(0), - randSrc: rand.Reader, - level: levelFast, - } - for _, opt := range opts { - if err := opt(&w2); err != nil { - w2.errState = err - return &w2 - } - } - w2.obufLen = obufHeaderLen + MaxEncodedLen(w2.blockSize) - w2.paramsOK = true - w2.ibuf = make([]byte, 0, w2.blockSize) - w2.buffers.New = func() interface{} { - return make([]byte, w2.obufLen) - } - w2.Reset(w) - return &w2 -} - -// Writer is an io.Writer that can write Snappy-compressed bytes. -type Writer struct { - errMu sync.Mutex - errState error - - // ibuf is a buffer for the incoming (uncompressed) bytes. - ibuf []byte - - blockSize int - obufLen int - concurrency int - written int64 - uncompWritten int64 // Bytes sent to compression - output chan chan result - buffers sync.Pool - pad int - - writer io.Writer - randSrc io.Reader - writerWg sync.WaitGroup - index Index - customEnc func(dst, src []byte) int - - // wroteStreamHeader is whether we have written the stream header. - wroteStreamHeader bool - paramsOK bool - snappy bool - flushOnWrite bool - appendIndex bool - level uint8 -} - -const ( - levelUncompressed = iota + 1 - levelFast - levelBetter - levelBest -) - -type result struct { - b []byte - // Uncompressed start offset - startOffset int64 -} - -// err returns the previously set error. -// If no error has been set it is set to err if not nil. -func (w *Writer) err(err error) error { - w.errMu.Lock() - errSet := w.errState - if errSet == nil && err != nil { - w.errState = err - errSet = err - } - w.errMu.Unlock() - return errSet -} - -// Reset discards the writer's state and switches the Snappy writer to write to w. -// This permits reusing a Writer rather than allocating a new one. -func (w *Writer) Reset(writer io.Writer) { - if !w.paramsOK { - return - } - // Close previous writer, if any. - if w.output != nil { - close(w.output) - w.writerWg.Wait() - w.output = nil - } - w.errState = nil - w.ibuf = w.ibuf[:0] - w.wroteStreamHeader = false - w.written = 0 - w.writer = writer - w.uncompWritten = 0 - w.index.reset(w.blockSize) - - // If we didn't get a writer, stop here. - if writer == nil { - return - } - // If no concurrency requested, don't spin up writer goroutine. - if w.concurrency == 1 { - return - } - - toWrite := make(chan chan result, w.concurrency) - w.output = toWrite - w.writerWg.Add(1) - - // Start a writer goroutine that will write all output in order. - go func() { - defer w.writerWg.Done() - - // Get a queued write. - for write := range toWrite { - // Wait for the data to be available. - input := <-write - in := input.b - if len(in) > 0 { - if w.err(nil) == nil { - // Don't expose data from previous buffers. - toWrite := in[:len(in):len(in)] - // Write to output. - n, err := writer.Write(toWrite) - if err == nil && n != len(toWrite) { - err = io.ErrShortBuffer - } - _ = w.err(err) - w.err(w.index.add(w.written, input.startOffset)) - w.written += int64(n) - } - } - if cap(in) >= w.obufLen { - w.buffers.Put(in) - } - // close the incoming write request. - // This can be used for synchronizing flushes. - close(write) - } - }() -} - -// Write satisfies the io.Writer interface. -func (w *Writer) Write(p []byte) (nRet int, errRet error) { - if err := w.err(nil); err != nil { - return 0, err - } - if w.flushOnWrite { - return w.write(p) - } - // If we exceed the input buffer size, start writing - for len(p) > (cap(w.ibuf)-len(w.ibuf)) && w.err(nil) == nil { - var n int - if len(w.ibuf) == 0 { - // Large write, empty buffer. - // Write directly from p to avoid copy. - n, _ = w.write(p) - } else { - n = copy(w.ibuf[len(w.ibuf):cap(w.ibuf)], p) - w.ibuf = w.ibuf[:len(w.ibuf)+n] - w.write(w.ibuf) - w.ibuf = w.ibuf[:0] - } - nRet += n - p = p[n:] - } - if err := w.err(nil); err != nil { - return nRet, err - } - // p should always be able to fit into w.ibuf now. - n := copy(w.ibuf[len(w.ibuf):cap(w.ibuf)], p) - w.ibuf = w.ibuf[:len(w.ibuf)+n] - nRet += n - return nRet, nil -} - -// ReadFrom implements the io.ReaderFrom interface. -// Using this is typically more efficient since it avoids a memory copy. -// ReadFrom reads data from r until EOF or error. -// The return value n is the number of bytes read. -// Any error except io.EOF encountered during the read is also returned. -func (w *Writer) ReadFrom(r io.Reader) (n int64, err error) { - if err := w.err(nil); err != nil { - return 0, err - } - if len(w.ibuf) > 0 { - err := w.Flush() - if err != nil { - return 0, err - } - } - if br, ok := r.(byter); ok { - buf := br.Bytes() - if err := w.EncodeBuffer(buf); err != nil { - return 0, err - } - return int64(len(buf)), w.Flush() - } - for { - inbuf := w.buffers.Get().([]byte)[:w.blockSize+obufHeaderLen] - n2, err := io.ReadFull(r, inbuf[obufHeaderLen:]) - if err != nil { - if err == io.ErrUnexpectedEOF { - err = io.EOF - } - if err != io.EOF { - return n, w.err(err) - } - } - if n2 == 0 { - break - } - n += int64(n2) - err2 := w.writeFull(inbuf[:n2+obufHeaderLen]) - if w.err(err2) != nil { - break - } - - if err != nil { - // We got EOF and wrote everything - break - } - } - - return n, w.err(nil) -} - -// AddSkippableBlock will add a skippable block to the stream. -// The ID must be 0x80-0xfe (inclusive). -// Length of the skippable block must be <= 16777215 bytes. -func (w *Writer) AddSkippableBlock(id uint8, data []byte) (err error) { - if err := w.err(nil); err != nil { - return err - } - if len(data) == 0 { - return nil - } - if id < 0x80 || id > chunkTypePadding { - return fmt.Errorf("invalid skippable block id %x", id) - } - if len(data) > maxChunkSize { - return fmt.Errorf("skippable block excessed maximum size") - } - var header [4]byte - chunkLen := 4 + len(data) - header[0] = id - header[1] = uint8(chunkLen >> 0) - header[2] = uint8(chunkLen >> 8) - header[3] = uint8(chunkLen >> 16) - if w.concurrency == 1 { - write := func(b []byte) error { - n, err := w.writer.Write(b) - if err = w.err(err); err != nil { - return err - } - if n != len(data) { - return w.err(io.ErrShortWrite) - } - w.written += int64(n) - return w.err(nil) - } - if !w.wroteStreamHeader { - w.wroteStreamHeader = true - if w.snappy { - if err := write([]byte(magicChunkSnappy)); err != nil { - return err - } - } else { - if err := write([]byte(magicChunk)); err != nil { - return err - } - } - } - if err := write(header[:]); err != nil { - return err - } - if err := write(data); err != nil { - return err - } - } - - // Create output... - if !w.wroteStreamHeader { - w.wroteStreamHeader = true - hWriter := make(chan result) - w.output <- hWriter - if w.snappy { - hWriter <- result{startOffset: w.uncompWritten, b: []byte(magicChunkSnappy)} - } else { - hWriter <- result{startOffset: w.uncompWritten, b: []byte(magicChunk)} - } - } - - // Copy input. - inbuf := w.buffers.Get().([]byte)[:4] - copy(inbuf, header[:]) - inbuf = append(inbuf, data...) - - output := make(chan result, 1) - // Queue output. - w.output <- output - output <- result{startOffset: w.uncompWritten, b: inbuf} - - return nil -} - -// EncodeBuffer will add a buffer to the stream. -// This is the fastest way to encode a stream, -// but the input buffer cannot be written to by the caller -// until Flush or Close has been called when concurrency != 1. -// -// If you cannot control that, use the regular Write function. -// -// Note that input is not buffered. -// This means that each write will result in discrete blocks being created. -// For buffered writes, use the regular Write function. -func (w *Writer) EncodeBuffer(buf []byte) (err error) { - if err := w.err(nil); err != nil { - return err - } - - if w.flushOnWrite { - _, err := w.write(buf) - return err - } - // Flush queued data first. - if len(w.ibuf) > 0 { - err := w.Flush() - if err != nil { - return err - } - } - if w.concurrency == 1 { - _, err := w.writeSync(buf) - return err - } - - // Spawn goroutine and write block to output channel. - if !w.wroteStreamHeader { - w.wroteStreamHeader = true - hWriter := make(chan result) - w.output <- hWriter - if w.snappy { - hWriter <- result{startOffset: w.uncompWritten, b: []byte(magicChunkSnappy)} - } else { - hWriter <- result{startOffset: w.uncompWritten, b: []byte(magicChunk)} - } - } - - for len(buf) > 0 { - // Cut input. - uncompressed := buf - if len(uncompressed) > w.blockSize { - uncompressed = uncompressed[:w.blockSize] - } - buf = buf[len(uncompressed):] - // Get an output buffer. - obuf := w.buffers.Get().([]byte)[:len(uncompressed)+obufHeaderLen] - output := make(chan result) - // Queue output now, so we keep order. - w.output <- output - res := result{ - startOffset: w.uncompWritten, - } - w.uncompWritten += int64(len(uncompressed)) - go func() { - checksum := crc(uncompressed) - - // Set to uncompressed. - chunkType := uint8(chunkTypeUncompressedData) - chunkLen := 4 + len(uncompressed) - - // Attempt compressing. - n := binary.PutUvarint(obuf[obufHeaderLen:], uint64(len(uncompressed))) - n2 := w.encodeBlock(obuf[obufHeaderLen+n:], uncompressed) - - // Check if we should use this, or store as uncompressed instead. - if n2 > 0 { - chunkType = uint8(chunkTypeCompressedData) - chunkLen = 4 + n + n2 - obuf = obuf[:obufHeaderLen+n+n2] - } else { - // copy uncompressed - copy(obuf[obufHeaderLen:], uncompressed) - } - - // Fill in the per-chunk header that comes before the body. - obuf[0] = chunkType - obuf[1] = uint8(chunkLen >> 0) - obuf[2] = uint8(chunkLen >> 8) - obuf[3] = uint8(chunkLen >> 16) - obuf[4] = uint8(checksum >> 0) - obuf[5] = uint8(checksum >> 8) - obuf[6] = uint8(checksum >> 16) - obuf[7] = uint8(checksum >> 24) - - // Queue final output. - res.b = obuf - output <- res - }() - } - return nil -} - -func (w *Writer) encodeBlock(obuf, uncompressed []byte) int { - if w.customEnc != nil { - return w.customEnc(obuf, uncompressed) - } - if w.snappy { - switch w.level { - case levelFast: - return encodeBlockSnappy(obuf, uncompressed) - case levelBetter: - return encodeBlockBetterSnappy(obuf, uncompressed) - case levelBest: - return encodeBlockBestSnappy(obuf, uncompressed) - } - return 0 - } - switch w.level { - case levelFast: - return encodeBlock(obuf, uncompressed) - case levelBetter: - return encodeBlockBetter(obuf, uncompressed) - case levelBest: - return encodeBlockBest(obuf, uncompressed, nil) - } - return 0 -} - -func (w *Writer) write(p []byte) (nRet int, errRet error) { - if err := w.err(nil); err != nil { - return 0, err - } - if w.concurrency == 1 { - return w.writeSync(p) - } - - // Spawn goroutine and write block to output channel. - for len(p) > 0 { - if !w.wroteStreamHeader { - w.wroteStreamHeader = true - hWriter := make(chan result) - w.output <- hWriter - if w.snappy { - hWriter <- result{startOffset: w.uncompWritten, b: []byte(magicChunkSnappy)} - } else { - hWriter <- result{startOffset: w.uncompWritten, b: []byte(magicChunk)} - } - } - - var uncompressed []byte - if len(p) > w.blockSize { - uncompressed, p = p[:w.blockSize], p[w.blockSize:] - } else { - uncompressed, p = p, nil - } - - // Copy input. - // If the block is incompressible, this is used for the result. - inbuf := w.buffers.Get().([]byte)[:len(uncompressed)+obufHeaderLen] - obuf := w.buffers.Get().([]byte)[:w.obufLen] - copy(inbuf[obufHeaderLen:], uncompressed) - uncompressed = inbuf[obufHeaderLen:] - - output := make(chan result) - // Queue output now, so we keep order. - w.output <- output - res := result{ - startOffset: w.uncompWritten, - } - w.uncompWritten += int64(len(uncompressed)) - - go func() { - checksum := crc(uncompressed) - - // Set to uncompressed. - chunkType := uint8(chunkTypeUncompressedData) - chunkLen := 4 + len(uncompressed) - - // Attempt compressing. - n := binary.PutUvarint(obuf[obufHeaderLen:], uint64(len(uncompressed))) - n2 := w.encodeBlock(obuf[obufHeaderLen+n:], uncompressed) - - // Check if we should use this, or store as uncompressed instead. - if n2 > 0 { - chunkType = uint8(chunkTypeCompressedData) - chunkLen = 4 + n + n2 - obuf = obuf[:obufHeaderLen+n+n2] - } else { - // Use input as output. - obuf, inbuf = inbuf, obuf - } - - // Fill in the per-chunk header that comes before the body. - obuf[0] = chunkType - obuf[1] = uint8(chunkLen >> 0) - obuf[2] = uint8(chunkLen >> 8) - obuf[3] = uint8(chunkLen >> 16) - obuf[4] = uint8(checksum >> 0) - obuf[5] = uint8(checksum >> 8) - obuf[6] = uint8(checksum >> 16) - obuf[7] = uint8(checksum >> 24) - - // Queue final output. - res.b = obuf - output <- res - - // Put unused buffer back in pool. - w.buffers.Put(inbuf) - }() - nRet += len(uncompressed) - } - return nRet, nil -} - -// writeFull is a special version of write that will always write the full buffer. -// Data to be compressed should start at offset obufHeaderLen and fill the remainder of the buffer. -// The data will be written as a single block. -// The caller is not allowed to use inbuf after this function has been called. -func (w *Writer) writeFull(inbuf []byte) (errRet error) { - if err := w.err(nil); err != nil { - return err - } - - if w.concurrency == 1 { - _, err := w.writeSync(inbuf[obufHeaderLen:]) - return err - } - - // Spawn goroutine and write block to output channel. - if !w.wroteStreamHeader { - w.wroteStreamHeader = true - hWriter := make(chan result) - w.output <- hWriter - if w.snappy { - hWriter <- result{startOffset: w.uncompWritten, b: []byte(magicChunkSnappy)} - } else { - hWriter <- result{startOffset: w.uncompWritten, b: []byte(magicChunk)} - } - } - - // Get an output buffer. - obuf := w.buffers.Get().([]byte)[:w.obufLen] - uncompressed := inbuf[obufHeaderLen:] - - output := make(chan result) - // Queue output now, so we keep order. - w.output <- output - res := result{ - startOffset: w.uncompWritten, - } - w.uncompWritten += int64(len(uncompressed)) - - go func() { - checksum := crc(uncompressed) - - // Set to uncompressed. - chunkType := uint8(chunkTypeUncompressedData) - chunkLen := 4 + len(uncompressed) - - // Attempt compressing. - n := binary.PutUvarint(obuf[obufHeaderLen:], uint64(len(uncompressed))) - n2 := w.encodeBlock(obuf[obufHeaderLen+n:], uncompressed) - - // Check if we should use this, or store as uncompressed instead. - if n2 > 0 { - chunkType = uint8(chunkTypeCompressedData) - chunkLen = 4 + n + n2 - obuf = obuf[:obufHeaderLen+n+n2] - } else { - // Use input as output. - obuf, inbuf = inbuf, obuf - } - - // Fill in the per-chunk header that comes before the body. - obuf[0] = chunkType - obuf[1] = uint8(chunkLen >> 0) - obuf[2] = uint8(chunkLen >> 8) - obuf[3] = uint8(chunkLen >> 16) - obuf[4] = uint8(checksum >> 0) - obuf[5] = uint8(checksum >> 8) - obuf[6] = uint8(checksum >> 16) - obuf[7] = uint8(checksum >> 24) - - // Queue final output. - res.b = obuf - output <- res - - // Put unused buffer back in pool. - w.buffers.Put(inbuf) - }() - return nil -} - -func (w *Writer) writeSync(p []byte) (nRet int, errRet error) { - if err := w.err(nil); err != nil { - return 0, err - } - if !w.wroteStreamHeader { - w.wroteStreamHeader = true - var n int - var err error - if w.snappy { - n, err = w.writer.Write([]byte(magicChunkSnappy)) - } else { - n, err = w.writer.Write([]byte(magicChunk)) - } - if err != nil { - return 0, w.err(err) - } - if n != len(magicChunk) { - return 0, w.err(io.ErrShortWrite) - } - w.written += int64(n) - } - - for len(p) > 0 { - var uncompressed []byte - if len(p) > w.blockSize { - uncompressed, p = p[:w.blockSize], p[w.blockSize:] - } else { - uncompressed, p = p, nil - } - - obuf := w.buffers.Get().([]byte)[:w.obufLen] - checksum := crc(uncompressed) - - // Set to uncompressed. - chunkType := uint8(chunkTypeUncompressedData) - chunkLen := 4 + len(uncompressed) - - // Attempt compressing. - n := binary.PutUvarint(obuf[obufHeaderLen:], uint64(len(uncompressed))) - n2 := w.encodeBlock(obuf[obufHeaderLen+n:], uncompressed) - - if n2 > 0 { - chunkType = uint8(chunkTypeCompressedData) - chunkLen = 4 + n + n2 - obuf = obuf[:obufHeaderLen+n+n2] - } else { - obuf = obuf[:8] - } - - // Fill in the per-chunk header that comes before the body. - obuf[0] = chunkType - obuf[1] = uint8(chunkLen >> 0) - obuf[2] = uint8(chunkLen >> 8) - obuf[3] = uint8(chunkLen >> 16) - obuf[4] = uint8(checksum >> 0) - obuf[5] = uint8(checksum >> 8) - obuf[6] = uint8(checksum >> 16) - obuf[7] = uint8(checksum >> 24) - - n, err := w.writer.Write(obuf) - if err != nil { - return 0, w.err(err) - } - if n != len(obuf) { - return 0, w.err(io.ErrShortWrite) - } - w.err(w.index.add(w.written, w.uncompWritten)) - w.written += int64(n) - w.uncompWritten += int64(len(uncompressed)) - - if chunkType == chunkTypeUncompressedData { - // Write uncompressed data. - n, err := w.writer.Write(uncompressed) - if err != nil { - return 0, w.err(err) - } - if n != len(uncompressed) { - return 0, w.err(io.ErrShortWrite) - } - w.written += int64(n) - } - w.buffers.Put(obuf) - // Queue final output. - nRet += len(uncompressed) - } - return nRet, nil -} - -// Flush flushes the Writer to its underlying io.Writer. -// This does not apply padding. -func (w *Writer) Flush() error { - if err := w.err(nil); err != nil { - return err - } - - // Queue any data still in input buffer. - if len(w.ibuf) != 0 { - if !w.wroteStreamHeader { - _, err := w.writeSync(w.ibuf) - w.ibuf = w.ibuf[:0] - return w.err(err) - } else { - _, err := w.write(w.ibuf) - w.ibuf = w.ibuf[:0] - err = w.err(err) - if err != nil { - return err - } - } - } - if w.output == nil { - return w.err(nil) - } - - // Send empty buffer - res := make(chan result) - w.output <- res - // Block until this has been picked up. - res <- result{b: nil, startOffset: w.uncompWritten} - // When it is closed, we have flushed. - <-res - return w.err(nil) -} - -// Close calls Flush and then closes the Writer. -// Calling Close multiple times is ok, -// but calling CloseIndex after this will make it not return the index. -func (w *Writer) Close() error { - _, err := w.closeIndex(w.appendIndex) - return err -} - -// CloseIndex calls Close and returns an index on first call. -// This is not required if you are only adding index to a stream. -func (w *Writer) CloseIndex() ([]byte, error) { - return w.closeIndex(true) -} - -func (w *Writer) closeIndex(idx bool) ([]byte, error) { - err := w.Flush() - if w.output != nil { - close(w.output) - w.writerWg.Wait() - w.output = nil - } - - var index []byte - if w.err(nil) == nil && w.writer != nil { - // Create index. - if idx { - compSize := int64(-1) - if w.pad <= 1 { - compSize = w.written - } - index = w.index.appendTo(w.ibuf[:0], w.uncompWritten, compSize) - // Count as written for padding. - if w.appendIndex { - w.written += int64(len(index)) - } - } - - if w.pad > 1 { - tmp := w.ibuf[:0] - if len(index) > 0 { - // Allocate another buffer. - tmp = w.buffers.Get().([]byte)[:0] - defer w.buffers.Put(tmp) - } - add := calcSkippableFrame(w.written, int64(w.pad)) - frame, err := skippableFrame(tmp, add, w.randSrc) - if err = w.err(err); err != nil { - return nil, err - } - n, err2 := w.writer.Write(frame) - if err2 == nil && n != len(frame) { - err2 = io.ErrShortWrite - } - _ = w.err(err2) - } - if len(index) > 0 && w.appendIndex { - n, err2 := w.writer.Write(index) - if err2 == nil && n != len(index) { - err2 = io.ErrShortWrite - } - _ = w.err(err2) - } - } - err = w.err(errClosed) - if err == errClosed { - return index, nil - } - return nil, err -} - -// calcSkippableFrame will return a total size to be added for written -// to be divisible by multiple. -// The value will always be > skippableFrameHeader. -// The function will panic if written < 0 or wantMultiple <= 0. -func calcSkippableFrame(written, wantMultiple int64) int { - if wantMultiple <= 0 { - panic("wantMultiple <= 0") - } - if written < 0 { - panic("written < 0") - } - leftOver := written % wantMultiple - if leftOver == 0 { - return 0 - } - toAdd := wantMultiple - leftOver - for toAdd < skippableFrameHeader { - toAdd += wantMultiple - } - return int(toAdd) -} - -// skippableFrame will add a skippable frame with a total size of bytes. -// total should be >= skippableFrameHeader and < maxBlockSize + skippableFrameHeader -func skippableFrame(dst []byte, total int, r io.Reader) ([]byte, error) { - if total == 0 { - return dst, nil - } - if total < skippableFrameHeader { - return dst, fmt.Errorf("s2: requested skippable frame (%d) < 4", total) - } - if int64(total) >= maxBlockSize+skippableFrameHeader { - return dst, fmt.Errorf("s2: requested skippable frame (%d) >= max 1<<24", total) - } - // Chunk type 0xfe "Section 4.4 Padding (chunk type 0xfe)" - dst = append(dst, chunkTypePadding) - f := uint32(total - skippableFrameHeader) - // Add chunk length. - dst = append(dst, uint8(f), uint8(f>>8), uint8(f>>16)) - // Add data - start := len(dst) - dst = append(dst, make([]byte, f)...) - _, err := io.ReadFull(r, dst[start:]) - return dst, err -} - -// WriterOption is an option for creating a encoder. -type WriterOption func(*Writer) error - -// WriterConcurrency will set the concurrency, -// meaning the maximum number of decoders to run concurrently. -// The value supplied must be at least 1. -// By default this will be set to GOMAXPROCS. -func WriterConcurrency(n int) WriterOption { - return func(w *Writer) error { - if n <= 0 { - return errors.New("concurrency must be at least 1") - } - w.concurrency = n - return nil - } -} - -// WriterAddIndex will append an index to the end of a stream -// when it is closed. -func WriterAddIndex() WriterOption { - return func(w *Writer) error { - w.appendIndex = true - return nil - } -} - -// WriterBetterCompression will enable better compression. -// EncodeBetter compresses better than Encode but typically with a -// 10-40% speed decrease on both compression and decompression. -func WriterBetterCompression() WriterOption { - return func(w *Writer) error { - w.level = levelBetter - return nil - } -} - -// WriterBestCompression will enable better compression. -// EncodeBetter compresses better than Encode but typically with a -// big speed decrease on compression. -func WriterBestCompression() WriterOption { - return func(w *Writer) error { - w.level = levelBest - return nil - } -} - -// WriterUncompressed will bypass compression. -// The stream will be written as uncompressed blocks only. -// If concurrency is > 1 CRC and output will still be done async. -func WriterUncompressed() WriterOption { - return func(w *Writer) error { - w.level = levelUncompressed - return nil - } -} - -// WriterBlockSize allows to override the default block size. -// Blocks will be this size or smaller. -// Minimum size is 4KB and and maximum size is 4MB. -// -// Bigger blocks may give bigger throughput on systems with many cores, -// and will increase compression slightly, but it will limit the possible -// concurrency for smaller payloads for both encoding and decoding. -// Default block size is 1MB. -// -// When writing Snappy compatible output using WriterSnappyCompat, -// the maximum block size is 64KB. -func WriterBlockSize(n int) WriterOption { - return func(w *Writer) error { - if w.snappy && n > maxSnappyBlockSize || n < minBlockSize { - return errors.New("s2: block size too large. Must be <= 64K and >=4KB on for snappy compatible output") - } - if n > maxBlockSize || n < minBlockSize { - return errors.New("s2: block size too large. Must be <= 4MB and >=4KB") - } - w.blockSize = n - return nil - } -} - -// WriterPadding will add padding to all output so the size will be a multiple of n. -// This can be used to obfuscate the exact output size or make blocks of a certain size. -// The contents will be a skippable frame, so it will be invisible by the decoder. -// n must be > 0 and <= 4MB. -// The padded area will be filled with data from crypto/rand.Reader. -// The padding will be applied whenever Close is called on the writer. -func WriterPadding(n int) WriterOption { - return func(w *Writer) error { - if n <= 0 { - return fmt.Errorf("s2: padding must be at least 1") - } - // No need to waste our time. - if n == 1 { - w.pad = 0 - } - if n > maxBlockSize { - return fmt.Errorf("s2: padding must less than 4MB") - } - w.pad = n - return nil - } -} - -// WriterPaddingSrc will get random data for padding from the supplied source. -// By default crypto/rand is used. -func WriterPaddingSrc(reader io.Reader) WriterOption { - return func(w *Writer) error { - w.randSrc = reader - return nil - } -} - -// WriterSnappyCompat will write snappy compatible output. -// The output can be decompressed using either snappy or s2. -// If block size is more than 64KB it is set to that. -func WriterSnappyCompat() WriterOption { - return func(w *Writer) error { - w.snappy = true - if w.blockSize > 64<<10 { - // We choose 8 bytes less than 64K, since that will make literal emits slightly more effective. - // And allows us to skip some size checks. - w.blockSize = (64 << 10) - 8 - } - return nil - } -} - -// WriterFlushOnWrite will compress blocks on each call to the Write function. -// -// This is quite inefficient as blocks size will depend on the write size. -// -// Use WriterConcurrency(1) to also make sure that output is flushed. -// When Write calls return, otherwise they will be written when compression is done. -func WriterFlushOnWrite() WriterOption { - return func(w *Writer) error { - w.flushOnWrite = true - return nil - } -} - -// WriterCustomEncoder allows to override the encoder for blocks on the stream. -// The function must compress 'src' into 'dst' and return the bytes used in dst as an integer. -// Block size (initial varint) should not be added by the encoder. -// Returning value 0 indicates the block could not be compressed. -// The function should expect to be called concurrently. -func WriterCustomEncoder(fn func(dst, src []byte) int) WriterOption { - return func(w *Writer) error { - w.customEnc = fn - return nil - } -} diff --git a/vendor/github.com/klauspost/compress/s2/encodeblock_amd64.s b/vendor/github.com/klauspost/compress/s2/encodeblock_amd64.s index 12a4de3be..9222d179c 100644 --- a/vendor/github.com/klauspost/compress/s2/encodeblock_amd64.s +++ b/vendor/github.com/klauspost/compress/s2/encodeblock_amd64.s @@ -52,7 +52,7 @@ search_loop_encodeBlockAsm: SHRL $0x06, BX LEAL 4(CX)(BX*1), BX CMPL BX, 8(SP) - JGE emit_remainder_encodeBlockAsm + JAE emit_remainder_encodeBlockAsm MOVQ (DX)(CX*1), SI MOVL BX, 20(SP) MOVQ $0x0000cf1bbcdcbf9b, R8 @@ -90,7 +90,7 @@ search_loop_encodeBlockAsm: repeat_extend_back_loop_encodeBlockAsm: CMPL SI, DI - JLE repeat_extend_back_end_encodeBlockAsm + JBE repeat_extend_back_end_encodeBlockAsm MOVB -1(DX)(BX*1), R8 MOVB -1(DX)(SI*1), R9 CMPB R8, R9 @@ -109,13 +109,13 @@ repeat_extend_back_end_encodeBlockAsm: SUBL BX, R8 LEAL -1(R8), BX CMPL BX, $0x3c - JLT one_byte_repeat_emit_encodeBlockAsm + JB one_byte_repeat_emit_encodeBlockAsm CMPL BX, $0x00000100 - JLT two_bytes_repeat_emit_encodeBlockAsm + JB two_bytes_repeat_emit_encodeBlockAsm CMPL BX, $0x00010000 - JLT three_bytes_repeat_emit_encodeBlockAsm + JB three_bytes_repeat_emit_encodeBlockAsm CMPL BX, $0x01000000 - JLT four_bytes_repeat_emit_encodeBlockAsm + JB four_bytes_repeat_emit_encodeBlockAsm MOVB $0xfc, (AX) MOVL BX, 1(AX) ADDQ $0x05, AX @@ -141,7 +141,7 @@ two_bytes_repeat_emit_encodeBlockAsm: MOVB BL, 1(AX) ADDQ $0x02, AX CMPL BX, $0x40 - JL memmove_repeat_emit_encodeBlockAsm + JB memmove_repeat_emit_encodeBlockAsm JMP memmove_long_repeat_emit_encodeBlockAsm one_byte_repeat_emit_encodeBlockAsm: @@ -154,7 +154,7 @@ memmove_repeat_emit_encodeBlockAsm: // genMemMoveShort CMPQ R8, $0x08 - JLE emit_lit_memmove_repeat_emit_encodeBlockAsm_memmove_move_8 + JBE emit_lit_memmove_repeat_emit_encodeBlockAsm_memmove_move_8 CMPQ R8, $0x10 JBE emit_lit_memmove_repeat_emit_encodeBlockAsm_memmove_move_8through16 CMPQ R8, $0x20 @@ -250,7 +250,7 @@ emit_literal_done_repeat_emit_encodeBlockAsm: // matchLen XORL R11, R11 CMPL R8, $0x08 - JL matchlen_match4_repeat_extend_encodeBlockAsm + JB matchlen_match4_repeat_extend_encodeBlockAsm matchlen_loopback_repeat_extend_encodeBlockAsm: MOVQ (R9)(R11*1), R10 @@ -273,12 +273,12 @@ matchlen_loop_repeat_extend_encodeBlockAsm: LEAL -8(R8), R8 LEAL 8(R11), R11 CMPL R8, $0x08 - JGE matchlen_loopback_repeat_extend_encodeBlockAsm + JAE matchlen_loopback_repeat_extend_encodeBlockAsm JZ repeat_extend_forward_end_encodeBlockAsm matchlen_match4_repeat_extend_encodeBlockAsm: CMPL R8, $0x04 - JL matchlen_match2_repeat_extend_encodeBlockAsm + JB matchlen_match2_repeat_extend_encodeBlockAsm MOVL (R9)(R11*1), R10 CMPL (BX)(R11*1), R10 JNE matchlen_match2_repeat_extend_encodeBlockAsm @@ -287,7 +287,7 @@ matchlen_match4_repeat_extend_encodeBlockAsm: matchlen_match2_repeat_extend_encodeBlockAsm: CMPL R8, $0x02 - JL matchlen_match1_repeat_extend_encodeBlockAsm + JB matchlen_match1_repeat_extend_encodeBlockAsm MOVW (R9)(R11*1), R10 CMPW (BX)(R11*1), R10 JNE matchlen_match1_repeat_extend_encodeBlockAsm @@ -296,7 +296,7 @@ matchlen_match2_repeat_extend_encodeBlockAsm: matchlen_match1_repeat_extend_encodeBlockAsm: CMPL R8, $0x01 - JL repeat_extend_forward_end_encodeBlockAsm + JB repeat_extend_forward_end_encodeBlockAsm MOVB (R9)(R11*1), R10 CMPB (BX)(R11*1), R10 JNE repeat_extend_forward_end_encodeBlockAsm @@ -315,19 +315,19 @@ emit_repeat_again_match_repeat_encodeBlockAsm: MOVL BX, DI LEAL -4(BX), BX CMPL DI, $0x08 - JLE repeat_two_match_repeat_encodeBlockAsm + JBE repeat_two_match_repeat_encodeBlockAsm CMPL DI, $0x0c - JGE cant_repeat_two_offset_match_repeat_encodeBlockAsm + JAE cant_repeat_two_offset_match_repeat_encodeBlockAsm CMPL SI, $0x00000800 - JLT repeat_two_offset_match_repeat_encodeBlockAsm + JB repeat_two_offset_match_repeat_encodeBlockAsm cant_repeat_two_offset_match_repeat_encodeBlockAsm: CMPL BX, $0x00000104 - JLT repeat_three_match_repeat_encodeBlockAsm + JB repeat_three_match_repeat_encodeBlockAsm CMPL BX, $0x00010100 - JLT repeat_four_match_repeat_encodeBlockAsm + JB repeat_four_match_repeat_encodeBlockAsm CMPL BX, $0x0100ffff - JLT repeat_five_match_repeat_encodeBlockAsm + JB repeat_five_match_repeat_encodeBlockAsm LEAL -16842747(BX), BX MOVL $0xfffb001d, (AX) MOVB $0xff, 4(AX) @@ -379,34 +379,34 @@ repeat_two_offset_match_repeat_encodeBlockAsm: repeat_as_copy_encodeBlockAsm: // emitCopy CMPL SI, $0x00010000 - JL two_byte_offset_repeat_as_copy_encodeBlockAsm + JB two_byte_offset_repeat_as_copy_encodeBlockAsm CMPL BX, $0x40 - JLE four_bytes_remain_repeat_as_copy_encodeBlockAsm + JBE four_bytes_remain_repeat_as_copy_encodeBlockAsm MOVB $0xff, (AX) MOVL SI, 1(AX) LEAL -64(BX), BX ADDQ $0x05, AX CMPL BX, $0x04 - JL four_bytes_remain_repeat_as_copy_encodeBlockAsm + JB four_bytes_remain_repeat_as_copy_encodeBlockAsm // emitRepeat emit_repeat_again_repeat_as_copy_encodeBlockAsm_emit_copy: MOVL BX, DI LEAL -4(BX), BX CMPL DI, $0x08 - JLE repeat_two_repeat_as_copy_encodeBlockAsm_emit_copy + JBE repeat_two_repeat_as_copy_encodeBlockAsm_emit_copy CMPL DI, $0x0c - JGE cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm_emit_copy + JAE cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm_emit_copy CMPL SI, $0x00000800 - JLT repeat_two_offset_repeat_as_copy_encodeBlockAsm_emit_copy + JB repeat_two_offset_repeat_as_copy_encodeBlockAsm_emit_copy cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm_emit_copy: CMPL BX, $0x00000104 - JLT repeat_three_repeat_as_copy_encodeBlockAsm_emit_copy + JB repeat_three_repeat_as_copy_encodeBlockAsm_emit_copy CMPL BX, $0x00010100 - JLT repeat_four_repeat_as_copy_encodeBlockAsm_emit_copy + JB repeat_four_repeat_as_copy_encodeBlockAsm_emit_copy CMPL BX, $0x0100ffff - JLT repeat_five_repeat_as_copy_encodeBlockAsm_emit_copy + JB repeat_five_repeat_as_copy_encodeBlockAsm_emit_copy LEAL -16842747(BX), BX MOVL $0xfffb001d, (AX) MOVB $0xff, 4(AX) @@ -467,7 +467,7 @@ four_bytes_remain_repeat_as_copy_encodeBlockAsm: two_byte_offset_repeat_as_copy_encodeBlockAsm: CMPL BX, $0x40 - JLE two_byte_offset_short_repeat_as_copy_encodeBlockAsm + JBE two_byte_offset_short_repeat_as_copy_encodeBlockAsm CMPL SI, $0x00000800 JAE long_offset_short_repeat_as_copy_encodeBlockAsm MOVL $0x00000001, DI @@ -489,19 +489,19 @@ emit_repeat_again_repeat_as_copy_encodeBlockAsm_emit_copy_short_2b: MOVL BX, DI LEAL -4(BX), BX CMPL DI, $0x08 - JLE repeat_two_repeat_as_copy_encodeBlockAsm_emit_copy_short_2b + JBE repeat_two_repeat_as_copy_encodeBlockAsm_emit_copy_short_2b CMPL DI, $0x0c - JGE cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm_emit_copy_short_2b + JAE cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm_emit_copy_short_2b CMPL SI, $0x00000800 - JLT repeat_two_offset_repeat_as_copy_encodeBlockAsm_emit_copy_short_2b + JB repeat_two_offset_repeat_as_copy_encodeBlockAsm_emit_copy_short_2b cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm_emit_copy_short_2b: CMPL BX, $0x00000104 - JLT repeat_three_repeat_as_copy_encodeBlockAsm_emit_copy_short_2b + JB repeat_three_repeat_as_copy_encodeBlockAsm_emit_copy_short_2b CMPL BX, $0x00010100 - JLT repeat_four_repeat_as_copy_encodeBlockAsm_emit_copy_short_2b + JB repeat_four_repeat_as_copy_encodeBlockAsm_emit_copy_short_2b CMPL BX, $0x0100ffff - JLT repeat_five_repeat_as_copy_encodeBlockAsm_emit_copy_short_2b + JB repeat_five_repeat_as_copy_encodeBlockAsm_emit_copy_short_2b LEAL -16842747(BX), BX MOVL $0xfffb001d, (AX) MOVB $0xff, 4(AX) @@ -561,19 +561,19 @@ emit_repeat_again_repeat_as_copy_encodeBlockAsm_emit_copy_short: MOVL BX, DI LEAL -4(BX), BX CMPL DI, $0x08 - JLE repeat_two_repeat_as_copy_encodeBlockAsm_emit_copy_short + JBE repeat_two_repeat_as_copy_encodeBlockAsm_emit_copy_short CMPL DI, $0x0c - JGE cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm_emit_copy_short + JAE cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm_emit_copy_short CMPL SI, $0x00000800 - JLT repeat_two_offset_repeat_as_copy_encodeBlockAsm_emit_copy_short + JB repeat_two_offset_repeat_as_copy_encodeBlockAsm_emit_copy_short cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm_emit_copy_short: CMPL BX, $0x00000104 - JLT repeat_three_repeat_as_copy_encodeBlockAsm_emit_copy_short + JB repeat_three_repeat_as_copy_encodeBlockAsm_emit_copy_short CMPL BX, $0x00010100 - JLT repeat_four_repeat_as_copy_encodeBlockAsm_emit_copy_short + JB repeat_four_repeat_as_copy_encodeBlockAsm_emit_copy_short CMPL BX, $0x0100ffff - JLT repeat_five_repeat_as_copy_encodeBlockAsm_emit_copy_short + JB repeat_five_repeat_as_copy_encodeBlockAsm_emit_copy_short LEAL -16842747(BX), BX MOVL $0xfffb001d, (AX) MOVB $0xff, 4(AX) @@ -626,9 +626,9 @@ two_byte_offset_short_repeat_as_copy_encodeBlockAsm: MOVL BX, DI SHLL $0x02, DI CMPL BX, $0x0c - JGE emit_copy_three_repeat_as_copy_encodeBlockAsm + JAE emit_copy_three_repeat_as_copy_encodeBlockAsm CMPL SI, $0x00000800 - JGE emit_copy_three_repeat_as_copy_encodeBlockAsm + JAE emit_copy_three_repeat_as_copy_encodeBlockAsm LEAL -15(DI), DI MOVB SI, 1(AX) SHRL $0x08, SI @@ -679,7 +679,7 @@ candidate_match_encodeBlockAsm: match_extend_back_loop_encodeBlockAsm: CMPL CX, SI - JLE match_extend_back_end_encodeBlockAsm + JBE match_extend_back_end_encodeBlockAsm MOVB -1(DX)(BX*1), DI MOVB -1(DX)(CX*1), R8 CMPB DI, R8 @@ -694,7 +694,7 @@ match_extend_back_end_encodeBlockAsm: SUBL 12(SP), SI LEAQ 5(AX)(SI*1), SI CMPQ SI, (SP) - JL match_dst_size_check_encodeBlockAsm + JB match_dst_size_check_encodeBlockAsm MOVQ $0x00000000, ret+48(FP) RET @@ -709,13 +709,13 @@ match_dst_size_check_encodeBlockAsm: SUBL DI, R8 LEAL -1(R8), DI CMPL DI, $0x3c - JLT one_byte_match_emit_encodeBlockAsm + JB one_byte_match_emit_encodeBlockAsm CMPL DI, $0x00000100 - JLT two_bytes_match_emit_encodeBlockAsm + JB two_bytes_match_emit_encodeBlockAsm CMPL DI, $0x00010000 - JLT three_bytes_match_emit_encodeBlockAsm + JB three_bytes_match_emit_encodeBlockAsm CMPL DI, $0x01000000 - JLT four_bytes_match_emit_encodeBlockAsm + JB four_bytes_match_emit_encodeBlockAsm MOVB $0xfc, (AX) MOVL DI, 1(AX) ADDQ $0x05, AX @@ -741,7 +741,7 @@ two_bytes_match_emit_encodeBlockAsm: MOVB DI, 1(AX) ADDQ $0x02, AX CMPL DI, $0x40 - JL memmove_match_emit_encodeBlockAsm + JB memmove_match_emit_encodeBlockAsm JMP memmove_long_match_emit_encodeBlockAsm one_byte_match_emit_encodeBlockAsm: @@ -754,7 +754,7 @@ memmove_match_emit_encodeBlockAsm: // genMemMoveShort CMPQ R8, $0x08 - JLE emit_lit_memmove_match_emit_encodeBlockAsm_memmove_move_8 + JBE emit_lit_memmove_match_emit_encodeBlockAsm_memmove_move_8 CMPQ R8, $0x10 JBE emit_lit_memmove_match_emit_encodeBlockAsm_memmove_move_8through16 CMPQ R8, $0x20 @@ -853,7 +853,7 @@ match_nolit_loop_encodeBlockAsm: // matchLen XORL R9, R9 CMPL SI, $0x08 - JL matchlen_match4_match_nolit_encodeBlockAsm + JB matchlen_match4_match_nolit_encodeBlockAsm matchlen_loopback_match_nolit_encodeBlockAsm: MOVQ (DI)(R9*1), R8 @@ -876,12 +876,12 @@ matchlen_loop_match_nolit_encodeBlockAsm: LEAL -8(SI), SI LEAL 8(R9), R9 CMPL SI, $0x08 - JGE matchlen_loopback_match_nolit_encodeBlockAsm + JAE matchlen_loopback_match_nolit_encodeBlockAsm JZ match_nolit_end_encodeBlockAsm matchlen_match4_match_nolit_encodeBlockAsm: CMPL SI, $0x04 - JL matchlen_match2_match_nolit_encodeBlockAsm + JB matchlen_match2_match_nolit_encodeBlockAsm MOVL (DI)(R9*1), R8 CMPL (BX)(R9*1), R8 JNE matchlen_match2_match_nolit_encodeBlockAsm @@ -890,7 +890,7 @@ matchlen_match4_match_nolit_encodeBlockAsm: matchlen_match2_match_nolit_encodeBlockAsm: CMPL SI, $0x02 - JL matchlen_match1_match_nolit_encodeBlockAsm + JB matchlen_match1_match_nolit_encodeBlockAsm MOVW (DI)(R9*1), R8 CMPW (BX)(R9*1), R8 JNE matchlen_match1_match_nolit_encodeBlockAsm @@ -899,7 +899,7 @@ matchlen_match2_match_nolit_encodeBlockAsm: matchlen_match1_match_nolit_encodeBlockAsm: CMPL SI, $0x01 - JL match_nolit_end_encodeBlockAsm + JB match_nolit_end_encodeBlockAsm MOVB (DI)(R9*1), R8 CMPB (BX)(R9*1), R8 JNE match_nolit_end_encodeBlockAsm @@ -913,34 +913,34 @@ match_nolit_end_encodeBlockAsm: // emitCopy CMPL BX, $0x00010000 - JL two_byte_offset_match_nolit_encodeBlockAsm + JB two_byte_offset_match_nolit_encodeBlockAsm CMPL R9, $0x40 - JLE four_bytes_remain_match_nolit_encodeBlockAsm + JBE four_bytes_remain_match_nolit_encodeBlockAsm MOVB $0xff, (AX) MOVL BX, 1(AX) LEAL -64(R9), R9 ADDQ $0x05, AX CMPL R9, $0x04 - JL four_bytes_remain_match_nolit_encodeBlockAsm + JB four_bytes_remain_match_nolit_encodeBlockAsm // emitRepeat emit_repeat_again_match_nolit_encodeBlockAsm_emit_copy: MOVL R9, SI LEAL -4(R9), R9 CMPL SI, $0x08 - JLE repeat_two_match_nolit_encodeBlockAsm_emit_copy + JBE repeat_two_match_nolit_encodeBlockAsm_emit_copy CMPL SI, $0x0c - JGE cant_repeat_two_offset_match_nolit_encodeBlockAsm_emit_copy + JAE cant_repeat_two_offset_match_nolit_encodeBlockAsm_emit_copy CMPL BX, $0x00000800 - JLT repeat_two_offset_match_nolit_encodeBlockAsm_emit_copy + JB repeat_two_offset_match_nolit_encodeBlockAsm_emit_copy cant_repeat_two_offset_match_nolit_encodeBlockAsm_emit_copy: CMPL R9, $0x00000104 - JLT repeat_three_match_nolit_encodeBlockAsm_emit_copy + JB repeat_three_match_nolit_encodeBlockAsm_emit_copy CMPL R9, $0x00010100 - JLT repeat_four_match_nolit_encodeBlockAsm_emit_copy + JB repeat_four_match_nolit_encodeBlockAsm_emit_copy CMPL R9, $0x0100ffff - JLT repeat_five_match_nolit_encodeBlockAsm_emit_copy + JB repeat_five_match_nolit_encodeBlockAsm_emit_copy LEAL -16842747(R9), R9 MOVL $0xfffb001d, (AX) MOVB $0xff, 4(AX) @@ -1001,7 +1001,7 @@ four_bytes_remain_match_nolit_encodeBlockAsm: two_byte_offset_match_nolit_encodeBlockAsm: CMPL R9, $0x40 - JLE two_byte_offset_short_match_nolit_encodeBlockAsm + JBE two_byte_offset_short_match_nolit_encodeBlockAsm CMPL BX, $0x00000800 JAE long_offset_short_match_nolit_encodeBlockAsm MOVL $0x00000001, SI @@ -1023,19 +1023,19 @@ emit_repeat_again_match_nolit_encodeBlockAsm_emit_copy_short_2b: MOVL R9, SI LEAL -4(R9), R9 CMPL SI, $0x08 - JLE repeat_two_match_nolit_encodeBlockAsm_emit_copy_short_2b + JBE repeat_two_match_nolit_encodeBlockAsm_emit_copy_short_2b CMPL SI, $0x0c - JGE cant_repeat_two_offset_match_nolit_encodeBlockAsm_emit_copy_short_2b + JAE cant_repeat_two_offset_match_nolit_encodeBlockAsm_emit_copy_short_2b CMPL BX, $0x00000800 - JLT repeat_two_offset_match_nolit_encodeBlockAsm_emit_copy_short_2b + JB repeat_two_offset_match_nolit_encodeBlockAsm_emit_copy_short_2b cant_repeat_two_offset_match_nolit_encodeBlockAsm_emit_copy_short_2b: CMPL R9, $0x00000104 - JLT repeat_three_match_nolit_encodeBlockAsm_emit_copy_short_2b + JB repeat_three_match_nolit_encodeBlockAsm_emit_copy_short_2b CMPL R9, $0x00010100 - JLT repeat_four_match_nolit_encodeBlockAsm_emit_copy_short_2b + JB repeat_four_match_nolit_encodeBlockAsm_emit_copy_short_2b CMPL R9, $0x0100ffff - JLT repeat_five_match_nolit_encodeBlockAsm_emit_copy_short_2b + JB repeat_five_match_nolit_encodeBlockAsm_emit_copy_short_2b LEAL -16842747(R9), R9 MOVL $0xfffb001d, (AX) MOVB $0xff, 4(AX) @@ -1095,19 +1095,19 @@ emit_repeat_again_match_nolit_encodeBlockAsm_emit_copy_short: MOVL R9, SI LEAL -4(R9), R9 CMPL SI, $0x08 - JLE repeat_two_match_nolit_encodeBlockAsm_emit_copy_short + JBE repeat_two_match_nolit_encodeBlockAsm_emit_copy_short CMPL SI, $0x0c - JGE cant_repeat_two_offset_match_nolit_encodeBlockAsm_emit_copy_short + JAE cant_repeat_two_offset_match_nolit_encodeBlockAsm_emit_copy_short CMPL BX, $0x00000800 - JLT repeat_two_offset_match_nolit_encodeBlockAsm_emit_copy_short + JB repeat_two_offset_match_nolit_encodeBlockAsm_emit_copy_short cant_repeat_two_offset_match_nolit_encodeBlockAsm_emit_copy_short: CMPL R9, $0x00000104 - JLT repeat_three_match_nolit_encodeBlockAsm_emit_copy_short + JB repeat_three_match_nolit_encodeBlockAsm_emit_copy_short CMPL R9, $0x00010100 - JLT repeat_four_match_nolit_encodeBlockAsm_emit_copy_short + JB repeat_four_match_nolit_encodeBlockAsm_emit_copy_short CMPL R9, $0x0100ffff - JLT repeat_five_match_nolit_encodeBlockAsm_emit_copy_short + JB repeat_five_match_nolit_encodeBlockAsm_emit_copy_short LEAL -16842747(R9), R9 MOVL $0xfffb001d, (AX) MOVB $0xff, 4(AX) @@ -1160,9 +1160,9 @@ two_byte_offset_short_match_nolit_encodeBlockAsm: MOVL R9, SI SHLL $0x02, SI CMPL R9, $0x0c - JGE emit_copy_three_match_nolit_encodeBlockAsm + JAE emit_copy_three_match_nolit_encodeBlockAsm CMPL BX, $0x00000800 - JGE emit_copy_three_match_nolit_encodeBlockAsm + JAE emit_copy_three_match_nolit_encodeBlockAsm LEAL -15(SI), SI MOVB BL, 1(AX) SHRL $0x08, BX @@ -1180,10 +1180,10 @@ emit_copy_three_match_nolit_encodeBlockAsm: match_nolit_emitcopy_end_encodeBlockAsm: CMPL CX, 8(SP) - JGE emit_remainder_encodeBlockAsm + JAE emit_remainder_encodeBlockAsm MOVQ -2(DX)(CX*1), SI CMPQ AX, (SP) - JL match_nolit_dst_ok_encodeBlockAsm + JB match_nolit_dst_ok_encodeBlockAsm MOVQ $0x00000000, ret+48(FP) RET @@ -1213,7 +1213,7 @@ emit_remainder_encodeBlockAsm: SUBL 12(SP), CX LEAQ 5(AX)(CX*1), CX CMPQ CX, (SP) - JL emit_remainder_ok_encodeBlockAsm + JB emit_remainder_ok_encodeBlockAsm MOVQ $0x00000000, ret+48(FP) RET @@ -1228,13 +1228,13 @@ emit_remainder_ok_encodeBlockAsm: SUBL BX, SI LEAL -1(SI), DX CMPL DX, $0x3c - JLT one_byte_emit_remainder_encodeBlockAsm + JB one_byte_emit_remainder_encodeBlockAsm CMPL DX, $0x00000100 - JLT two_bytes_emit_remainder_encodeBlockAsm + JB two_bytes_emit_remainder_encodeBlockAsm CMPL DX, $0x00010000 - JLT three_bytes_emit_remainder_encodeBlockAsm + JB three_bytes_emit_remainder_encodeBlockAsm CMPL DX, $0x01000000 - JLT four_bytes_emit_remainder_encodeBlockAsm + JB four_bytes_emit_remainder_encodeBlockAsm MOVB $0xfc, (AX) MOVL DX, 1(AX) ADDQ $0x05, AX @@ -1260,7 +1260,7 @@ two_bytes_emit_remainder_encodeBlockAsm: MOVB DL, 1(AX) ADDQ $0x02, AX CMPL DX, $0x40 - JL memmove_emit_remainder_encodeBlockAsm + JB memmove_emit_remainder_encodeBlockAsm JMP memmove_long_emit_remainder_encodeBlockAsm one_byte_emit_remainder_encodeBlockAsm: @@ -1423,7 +1423,7 @@ search_loop_encodeBlockAsm4MB: SHRL $0x06, BX LEAL 4(CX)(BX*1), BX CMPL BX, 8(SP) - JGE emit_remainder_encodeBlockAsm4MB + JAE emit_remainder_encodeBlockAsm4MB MOVQ (DX)(CX*1), SI MOVL BX, 20(SP) MOVQ $0x0000cf1bbcdcbf9b, R8 @@ -1461,7 +1461,7 @@ search_loop_encodeBlockAsm4MB: repeat_extend_back_loop_encodeBlockAsm4MB: CMPL SI, DI - JLE repeat_extend_back_end_encodeBlockAsm4MB + JBE repeat_extend_back_end_encodeBlockAsm4MB MOVB -1(DX)(BX*1), R8 MOVB -1(DX)(SI*1), R9 CMPB R8, R9 @@ -1480,11 +1480,11 @@ repeat_extend_back_end_encodeBlockAsm4MB: SUBL BX, R8 LEAL -1(R8), BX CMPL BX, $0x3c - JLT one_byte_repeat_emit_encodeBlockAsm4MB + JB one_byte_repeat_emit_encodeBlockAsm4MB CMPL BX, $0x00000100 - JLT two_bytes_repeat_emit_encodeBlockAsm4MB + JB two_bytes_repeat_emit_encodeBlockAsm4MB CMPL BX, $0x00010000 - JLT three_bytes_repeat_emit_encodeBlockAsm4MB + JB three_bytes_repeat_emit_encodeBlockAsm4MB MOVL BX, R10 SHRL $0x10, R10 MOVB $0xf8, (AX) @@ -1504,7 +1504,7 @@ two_bytes_repeat_emit_encodeBlockAsm4MB: MOVB BL, 1(AX) ADDQ $0x02, AX CMPL BX, $0x40 - JL memmove_repeat_emit_encodeBlockAsm4MB + JB memmove_repeat_emit_encodeBlockAsm4MB JMP memmove_long_repeat_emit_encodeBlockAsm4MB one_byte_repeat_emit_encodeBlockAsm4MB: @@ -1517,7 +1517,7 @@ memmove_repeat_emit_encodeBlockAsm4MB: // genMemMoveShort CMPQ R8, $0x08 - JLE emit_lit_memmove_repeat_emit_encodeBlockAsm4MB_memmove_move_8 + JBE emit_lit_memmove_repeat_emit_encodeBlockAsm4MB_memmove_move_8 CMPQ R8, $0x10 JBE emit_lit_memmove_repeat_emit_encodeBlockAsm4MB_memmove_move_8through16 CMPQ R8, $0x20 @@ -1613,7 +1613,7 @@ emit_literal_done_repeat_emit_encodeBlockAsm4MB: // matchLen XORL R11, R11 CMPL R8, $0x08 - JL matchlen_match4_repeat_extend_encodeBlockAsm4MB + JB matchlen_match4_repeat_extend_encodeBlockAsm4MB matchlen_loopback_repeat_extend_encodeBlockAsm4MB: MOVQ (R9)(R11*1), R10 @@ -1636,12 +1636,12 @@ matchlen_loop_repeat_extend_encodeBlockAsm4MB: LEAL -8(R8), R8 LEAL 8(R11), R11 CMPL R8, $0x08 - JGE matchlen_loopback_repeat_extend_encodeBlockAsm4MB + JAE matchlen_loopback_repeat_extend_encodeBlockAsm4MB JZ repeat_extend_forward_end_encodeBlockAsm4MB matchlen_match4_repeat_extend_encodeBlockAsm4MB: CMPL R8, $0x04 - JL matchlen_match2_repeat_extend_encodeBlockAsm4MB + JB matchlen_match2_repeat_extend_encodeBlockAsm4MB MOVL (R9)(R11*1), R10 CMPL (BX)(R11*1), R10 JNE matchlen_match2_repeat_extend_encodeBlockAsm4MB @@ -1650,7 +1650,7 @@ matchlen_match4_repeat_extend_encodeBlockAsm4MB: matchlen_match2_repeat_extend_encodeBlockAsm4MB: CMPL R8, $0x02 - JL matchlen_match1_repeat_extend_encodeBlockAsm4MB + JB matchlen_match1_repeat_extend_encodeBlockAsm4MB MOVW (R9)(R11*1), R10 CMPW (BX)(R11*1), R10 JNE matchlen_match1_repeat_extend_encodeBlockAsm4MB @@ -1659,7 +1659,7 @@ matchlen_match2_repeat_extend_encodeBlockAsm4MB: matchlen_match1_repeat_extend_encodeBlockAsm4MB: CMPL R8, $0x01 - JL repeat_extend_forward_end_encodeBlockAsm4MB + JB repeat_extend_forward_end_encodeBlockAsm4MB MOVB (R9)(R11*1), R10 CMPB (BX)(R11*1), R10 JNE repeat_extend_forward_end_encodeBlockAsm4MB @@ -1677,17 +1677,17 @@ repeat_extend_forward_end_encodeBlockAsm4MB: MOVL BX, DI LEAL -4(BX), BX CMPL DI, $0x08 - JLE repeat_two_match_repeat_encodeBlockAsm4MB + JBE repeat_two_match_repeat_encodeBlockAsm4MB CMPL DI, $0x0c - JGE cant_repeat_two_offset_match_repeat_encodeBlockAsm4MB + JAE cant_repeat_two_offset_match_repeat_encodeBlockAsm4MB CMPL SI, $0x00000800 - JLT repeat_two_offset_match_repeat_encodeBlockAsm4MB + JB repeat_two_offset_match_repeat_encodeBlockAsm4MB cant_repeat_two_offset_match_repeat_encodeBlockAsm4MB: CMPL BX, $0x00000104 - JLT repeat_three_match_repeat_encodeBlockAsm4MB + JB repeat_three_match_repeat_encodeBlockAsm4MB CMPL BX, $0x00010100 - JLT repeat_four_match_repeat_encodeBlockAsm4MB + JB repeat_four_match_repeat_encodeBlockAsm4MB LEAL -65536(BX), BX MOVL BX, SI MOVW $0x001d, (AX) @@ -1732,31 +1732,31 @@ repeat_two_offset_match_repeat_encodeBlockAsm4MB: repeat_as_copy_encodeBlockAsm4MB: // emitCopy CMPL SI, $0x00010000 - JL two_byte_offset_repeat_as_copy_encodeBlockAsm4MB + JB two_byte_offset_repeat_as_copy_encodeBlockAsm4MB CMPL BX, $0x40 - JLE four_bytes_remain_repeat_as_copy_encodeBlockAsm4MB + JBE four_bytes_remain_repeat_as_copy_encodeBlockAsm4MB MOVB $0xff, (AX) MOVL SI, 1(AX) LEAL -64(BX), BX ADDQ $0x05, AX CMPL BX, $0x04 - JL four_bytes_remain_repeat_as_copy_encodeBlockAsm4MB + JB four_bytes_remain_repeat_as_copy_encodeBlockAsm4MB // emitRepeat MOVL BX, DI LEAL -4(BX), BX CMPL DI, $0x08 - JLE repeat_two_repeat_as_copy_encodeBlockAsm4MB_emit_copy + JBE repeat_two_repeat_as_copy_encodeBlockAsm4MB_emit_copy CMPL DI, $0x0c - JGE cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm4MB_emit_copy + JAE cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm4MB_emit_copy CMPL SI, $0x00000800 - JLT repeat_two_offset_repeat_as_copy_encodeBlockAsm4MB_emit_copy + JB repeat_two_offset_repeat_as_copy_encodeBlockAsm4MB_emit_copy cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm4MB_emit_copy: CMPL BX, $0x00000104 - JLT repeat_three_repeat_as_copy_encodeBlockAsm4MB_emit_copy + JB repeat_three_repeat_as_copy_encodeBlockAsm4MB_emit_copy CMPL BX, $0x00010100 - JLT repeat_four_repeat_as_copy_encodeBlockAsm4MB_emit_copy + JB repeat_four_repeat_as_copy_encodeBlockAsm4MB_emit_copy LEAL -65536(BX), BX MOVL BX, SI MOVW $0x001d, (AX) @@ -1810,7 +1810,7 @@ four_bytes_remain_repeat_as_copy_encodeBlockAsm4MB: two_byte_offset_repeat_as_copy_encodeBlockAsm4MB: CMPL BX, $0x40 - JLE two_byte_offset_short_repeat_as_copy_encodeBlockAsm4MB + JBE two_byte_offset_short_repeat_as_copy_encodeBlockAsm4MB CMPL SI, $0x00000800 JAE long_offset_short_repeat_as_copy_encodeBlockAsm4MB MOVL $0x00000001, DI @@ -1829,17 +1829,17 @@ two_byte_offset_repeat_as_copy_encodeBlockAsm4MB: MOVL BX, DI LEAL -4(BX), BX CMPL DI, $0x08 - JLE repeat_two_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short_2b + JBE repeat_two_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short_2b CMPL DI, $0x0c - JGE cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short_2b + JAE cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short_2b CMPL SI, $0x00000800 - JLT repeat_two_offset_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short_2b + JB repeat_two_offset_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short_2b cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short_2b: CMPL BX, $0x00000104 - JLT repeat_three_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short_2b + JB repeat_three_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short_2b CMPL BX, $0x00010100 - JLT repeat_four_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short_2b + JB repeat_four_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short_2b LEAL -65536(BX), BX MOVL BX, SI MOVW $0x001d, (AX) @@ -1891,17 +1891,17 @@ long_offset_short_repeat_as_copy_encodeBlockAsm4MB: MOVL BX, DI LEAL -4(BX), BX CMPL DI, $0x08 - JLE repeat_two_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short + JBE repeat_two_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short CMPL DI, $0x0c - JGE cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short + JAE cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short CMPL SI, $0x00000800 - JLT repeat_two_offset_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short + JB repeat_two_offset_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short: CMPL BX, $0x00000104 - JLT repeat_three_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short + JB repeat_three_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short CMPL BX, $0x00010100 - JLT repeat_four_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short + JB repeat_four_repeat_as_copy_encodeBlockAsm4MB_emit_copy_short LEAL -65536(BX), BX MOVL BX, SI MOVW $0x001d, (AX) @@ -1947,9 +1947,9 @@ two_byte_offset_short_repeat_as_copy_encodeBlockAsm4MB: MOVL BX, DI SHLL $0x02, DI CMPL BX, $0x0c - JGE emit_copy_three_repeat_as_copy_encodeBlockAsm4MB + JAE emit_copy_three_repeat_as_copy_encodeBlockAsm4MB CMPL SI, $0x00000800 - JGE emit_copy_three_repeat_as_copy_encodeBlockAsm4MB + JAE emit_copy_three_repeat_as_copy_encodeBlockAsm4MB LEAL -15(DI), DI MOVB SI, 1(AX) SHRL $0x08, SI @@ -2000,7 +2000,7 @@ candidate_match_encodeBlockAsm4MB: match_extend_back_loop_encodeBlockAsm4MB: CMPL CX, SI - JLE match_extend_back_end_encodeBlockAsm4MB + JBE match_extend_back_end_encodeBlockAsm4MB MOVB -1(DX)(BX*1), DI MOVB -1(DX)(CX*1), R8 CMPB DI, R8 @@ -2015,7 +2015,7 @@ match_extend_back_end_encodeBlockAsm4MB: SUBL 12(SP), SI LEAQ 4(AX)(SI*1), SI CMPQ SI, (SP) - JL match_dst_size_check_encodeBlockAsm4MB + JB match_dst_size_check_encodeBlockAsm4MB MOVQ $0x00000000, ret+48(FP) RET @@ -2030,11 +2030,11 @@ match_dst_size_check_encodeBlockAsm4MB: SUBL DI, R8 LEAL -1(R8), DI CMPL DI, $0x3c - JLT one_byte_match_emit_encodeBlockAsm4MB + JB one_byte_match_emit_encodeBlockAsm4MB CMPL DI, $0x00000100 - JLT two_bytes_match_emit_encodeBlockAsm4MB + JB two_bytes_match_emit_encodeBlockAsm4MB CMPL DI, $0x00010000 - JLT three_bytes_match_emit_encodeBlockAsm4MB + JB three_bytes_match_emit_encodeBlockAsm4MB MOVL DI, R9 SHRL $0x10, R9 MOVB $0xf8, (AX) @@ -2054,7 +2054,7 @@ two_bytes_match_emit_encodeBlockAsm4MB: MOVB DI, 1(AX) ADDQ $0x02, AX CMPL DI, $0x40 - JL memmove_match_emit_encodeBlockAsm4MB + JB memmove_match_emit_encodeBlockAsm4MB JMP memmove_long_match_emit_encodeBlockAsm4MB one_byte_match_emit_encodeBlockAsm4MB: @@ -2067,7 +2067,7 @@ memmove_match_emit_encodeBlockAsm4MB: // genMemMoveShort CMPQ R8, $0x08 - JLE emit_lit_memmove_match_emit_encodeBlockAsm4MB_memmove_move_8 + JBE emit_lit_memmove_match_emit_encodeBlockAsm4MB_memmove_move_8 CMPQ R8, $0x10 JBE emit_lit_memmove_match_emit_encodeBlockAsm4MB_memmove_move_8through16 CMPQ R8, $0x20 @@ -2166,7 +2166,7 @@ match_nolit_loop_encodeBlockAsm4MB: // matchLen XORL R9, R9 CMPL SI, $0x08 - JL matchlen_match4_match_nolit_encodeBlockAsm4MB + JB matchlen_match4_match_nolit_encodeBlockAsm4MB matchlen_loopback_match_nolit_encodeBlockAsm4MB: MOVQ (DI)(R9*1), R8 @@ -2189,12 +2189,12 @@ matchlen_loop_match_nolit_encodeBlockAsm4MB: LEAL -8(SI), SI LEAL 8(R9), R9 CMPL SI, $0x08 - JGE matchlen_loopback_match_nolit_encodeBlockAsm4MB + JAE matchlen_loopback_match_nolit_encodeBlockAsm4MB JZ match_nolit_end_encodeBlockAsm4MB matchlen_match4_match_nolit_encodeBlockAsm4MB: CMPL SI, $0x04 - JL matchlen_match2_match_nolit_encodeBlockAsm4MB + JB matchlen_match2_match_nolit_encodeBlockAsm4MB MOVL (DI)(R9*1), R8 CMPL (BX)(R9*1), R8 JNE matchlen_match2_match_nolit_encodeBlockAsm4MB @@ -2203,7 +2203,7 @@ matchlen_match4_match_nolit_encodeBlockAsm4MB: matchlen_match2_match_nolit_encodeBlockAsm4MB: CMPL SI, $0x02 - JL matchlen_match1_match_nolit_encodeBlockAsm4MB + JB matchlen_match1_match_nolit_encodeBlockAsm4MB MOVW (DI)(R9*1), R8 CMPW (BX)(R9*1), R8 JNE matchlen_match1_match_nolit_encodeBlockAsm4MB @@ -2212,7 +2212,7 @@ matchlen_match2_match_nolit_encodeBlockAsm4MB: matchlen_match1_match_nolit_encodeBlockAsm4MB: CMPL SI, $0x01 - JL match_nolit_end_encodeBlockAsm4MB + JB match_nolit_end_encodeBlockAsm4MB MOVB (DI)(R9*1), R8 CMPB (BX)(R9*1), R8 JNE match_nolit_end_encodeBlockAsm4MB @@ -2226,31 +2226,31 @@ match_nolit_end_encodeBlockAsm4MB: // emitCopy CMPL BX, $0x00010000 - JL two_byte_offset_match_nolit_encodeBlockAsm4MB + JB two_byte_offset_match_nolit_encodeBlockAsm4MB CMPL R9, $0x40 - JLE four_bytes_remain_match_nolit_encodeBlockAsm4MB + JBE four_bytes_remain_match_nolit_encodeBlockAsm4MB MOVB $0xff, (AX) MOVL BX, 1(AX) LEAL -64(R9), R9 ADDQ $0x05, AX CMPL R9, $0x04 - JL four_bytes_remain_match_nolit_encodeBlockAsm4MB + JB four_bytes_remain_match_nolit_encodeBlockAsm4MB // emitRepeat MOVL R9, SI LEAL -4(R9), R9 CMPL SI, $0x08 - JLE repeat_two_match_nolit_encodeBlockAsm4MB_emit_copy + JBE repeat_two_match_nolit_encodeBlockAsm4MB_emit_copy CMPL SI, $0x0c - JGE cant_repeat_two_offset_match_nolit_encodeBlockAsm4MB_emit_copy + JAE cant_repeat_two_offset_match_nolit_encodeBlockAsm4MB_emit_copy CMPL BX, $0x00000800 - JLT repeat_two_offset_match_nolit_encodeBlockAsm4MB_emit_copy + JB repeat_two_offset_match_nolit_encodeBlockAsm4MB_emit_copy cant_repeat_two_offset_match_nolit_encodeBlockAsm4MB_emit_copy: CMPL R9, $0x00000104 - JLT repeat_three_match_nolit_encodeBlockAsm4MB_emit_copy + JB repeat_three_match_nolit_encodeBlockAsm4MB_emit_copy CMPL R9, $0x00010100 - JLT repeat_four_match_nolit_encodeBlockAsm4MB_emit_copy + JB repeat_four_match_nolit_encodeBlockAsm4MB_emit_copy LEAL -65536(R9), R9 MOVL R9, BX MOVW $0x001d, (AX) @@ -2304,7 +2304,7 @@ four_bytes_remain_match_nolit_encodeBlockAsm4MB: two_byte_offset_match_nolit_encodeBlockAsm4MB: CMPL R9, $0x40 - JLE two_byte_offset_short_match_nolit_encodeBlockAsm4MB + JBE two_byte_offset_short_match_nolit_encodeBlockAsm4MB CMPL BX, $0x00000800 JAE long_offset_short_match_nolit_encodeBlockAsm4MB MOVL $0x00000001, SI @@ -2323,17 +2323,17 @@ two_byte_offset_match_nolit_encodeBlockAsm4MB: MOVL R9, SI LEAL -4(R9), R9 CMPL SI, $0x08 - JLE repeat_two_match_nolit_encodeBlockAsm4MB_emit_copy_short_2b + JBE repeat_two_match_nolit_encodeBlockAsm4MB_emit_copy_short_2b CMPL SI, $0x0c - JGE cant_repeat_two_offset_match_nolit_encodeBlockAsm4MB_emit_copy_short_2b + JAE cant_repeat_two_offset_match_nolit_encodeBlockAsm4MB_emit_copy_short_2b CMPL BX, $0x00000800 - JLT repeat_two_offset_match_nolit_encodeBlockAsm4MB_emit_copy_short_2b + JB repeat_two_offset_match_nolit_encodeBlockAsm4MB_emit_copy_short_2b cant_repeat_two_offset_match_nolit_encodeBlockAsm4MB_emit_copy_short_2b: CMPL R9, $0x00000104 - JLT repeat_three_match_nolit_encodeBlockAsm4MB_emit_copy_short_2b + JB repeat_three_match_nolit_encodeBlockAsm4MB_emit_copy_short_2b CMPL R9, $0x00010100 - JLT repeat_four_match_nolit_encodeBlockAsm4MB_emit_copy_short_2b + JB repeat_four_match_nolit_encodeBlockAsm4MB_emit_copy_short_2b LEAL -65536(R9), R9 MOVL R9, BX MOVW $0x001d, (AX) @@ -2385,17 +2385,17 @@ long_offset_short_match_nolit_encodeBlockAsm4MB: MOVL R9, SI LEAL -4(R9), R9 CMPL SI, $0x08 - JLE repeat_two_match_nolit_encodeBlockAsm4MB_emit_copy_short + JBE repeat_two_match_nolit_encodeBlockAsm4MB_emit_copy_short CMPL SI, $0x0c - JGE cant_repeat_two_offset_match_nolit_encodeBlockAsm4MB_emit_copy_short + JAE cant_repeat_two_offset_match_nolit_encodeBlockAsm4MB_emit_copy_short CMPL BX, $0x00000800 - JLT repeat_two_offset_match_nolit_encodeBlockAsm4MB_emit_copy_short + JB repeat_two_offset_match_nolit_encodeBlockAsm4MB_emit_copy_short cant_repeat_two_offset_match_nolit_encodeBlockAsm4MB_emit_copy_short: CMPL R9, $0x00000104 - JLT repeat_three_match_nolit_encodeBlockAsm4MB_emit_copy_short + JB repeat_three_match_nolit_encodeBlockAsm4MB_emit_copy_short CMPL R9, $0x00010100 - JLT repeat_four_match_nolit_encodeBlockAsm4MB_emit_copy_short + JB repeat_four_match_nolit_encodeBlockAsm4MB_emit_copy_short LEAL -65536(R9), R9 MOVL R9, BX MOVW $0x001d, (AX) @@ -2441,9 +2441,9 @@ two_byte_offset_short_match_nolit_encodeBlockAsm4MB: MOVL R9, SI SHLL $0x02, SI CMPL R9, $0x0c - JGE emit_copy_three_match_nolit_encodeBlockAsm4MB + JAE emit_copy_three_match_nolit_encodeBlockAsm4MB CMPL BX, $0x00000800 - JGE emit_copy_three_match_nolit_encodeBlockAsm4MB + JAE emit_copy_three_match_nolit_encodeBlockAsm4MB LEAL -15(SI), SI MOVB BL, 1(AX) SHRL $0x08, BX @@ -2461,10 +2461,10 @@ emit_copy_three_match_nolit_encodeBlockAsm4MB: match_nolit_emitcopy_end_encodeBlockAsm4MB: CMPL CX, 8(SP) - JGE emit_remainder_encodeBlockAsm4MB + JAE emit_remainder_encodeBlockAsm4MB MOVQ -2(DX)(CX*1), SI CMPQ AX, (SP) - JL match_nolit_dst_ok_encodeBlockAsm4MB + JB match_nolit_dst_ok_encodeBlockAsm4MB MOVQ $0x00000000, ret+48(FP) RET @@ -2494,7 +2494,7 @@ emit_remainder_encodeBlockAsm4MB: SUBL 12(SP), CX LEAQ 4(AX)(CX*1), CX CMPQ CX, (SP) - JL emit_remainder_ok_encodeBlockAsm4MB + JB emit_remainder_ok_encodeBlockAsm4MB MOVQ $0x00000000, ret+48(FP) RET @@ -2509,11 +2509,11 @@ emit_remainder_ok_encodeBlockAsm4MB: SUBL BX, SI LEAL -1(SI), DX CMPL DX, $0x3c - JLT one_byte_emit_remainder_encodeBlockAsm4MB + JB one_byte_emit_remainder_encodeBlockAsm4MB CMPL DX, $0x00000100 - JLT two_bytes_emit_remainder_encodeBlockAsm4MB + JB two_bytes_emit_remainder_encodeBlockAsm4MB CMPL DX, $0x00010000 - JLT three_bytes_emit_remainder_encodeBlockAsm4MB + JB three_bytes_emit_remainder_encodeBlockAsm4MB MOVL DX, BX SHRL $0x10, BX MOVB $0xf8, (AX) @@ -2533,7 +2533,7 @@ two_bytes_emit_remainder_encodeBlockAsm4MB: MOVB DL, 1(AX) ADDQ $0x02, AX CMPL DX, $0x40 - JL memmove_emit_remainder_encodeBlockAsm4MB + JB memmove_emit_remainder_encodeBlockAsm4MB JMP memmove_long_emit_remainder_encodeBlockAsm4MB one_byte_emit_remainder_encodeBlockAsm4MB: @@ -2696,7 +2696,7 @@ search_loop_encodeBlockAsm12B: SHRL $0x05, BX LEAL 4(CX)(BX*1), BX CMPL BX, 8(SP) - JGE emit_remainder_encodeBlockAsm12B + JAE emit_remainder_encodeBlockAsm12B MOVQ (DX)(CX*1), SI MOVL BX, 20(SP) MOVQ $0x000000cf1bbcdcbb, R8 @@ -2734,7 +2734,7 @@ search_loop_encodeBlockAsm12B: repeat_extend_back_loop_encodeBlockAsm12B: CMPL SI, DI - JLE repeat_extend_back_end_encodeBlockAsm12B + JBE repeat_extend_back_end_encodeBlockAsm12B MOVB -1(DX)(BX*1), R8 MOVB -1(DX)(SI*1), R9 CMPB R8, R9 @@ -2753,9 +2753,12 @@ repeat_extend_back_end_encodeBlockAsm12B: SUBL BX, R8 LEAL -1(R8), BX CMPL BX, $0x3c - JLT one_byte_repeat_emit_encodeBlockAsm12B + JB one_byte_repeat_emit_encodeBlockAsm12B CMPL BX, $0x00000100 - JLT two_bytes_repeat_emit_encodeBlockAsm12B + JB two_bytes_repeat_emit_encodeBlockAsm12B + JB three_bytes_repeat_emit_encodeBlockAsm12B + +three_bytes_repeat_emit_encodeBlockAsm12B: MOVB $0xf4, (AX) MOVW BX, 1(AX) ADDQ $0x03, AX @@ -2766,7 +2769,7 @@ two_bytes_repeat_emit_encodeBlockAsm12B: MOVB BL, 1(AX) ADDQ $0x02, AX CMPL BX, $0x40 - JL memmove_repeat_emit_encodeBlockAsm12B + JB memmove_repeat_emit_encodeBlockAsm12B JMP memmove_long_repeat_emit_encodeBlockAsm12B one_byte_repeat_emit_encodeBlockAsm12B: @@ -2779,7 +2782,7 @@ memmove_repeat_emit_encodeBlockAsm12B: // genMemMoveShort CMPQ R8, $0x08 - JLE emit_lit_memmove_repeat_emit_encodeBlockAsm12B_memmove_move_8 + JBE emit_lit_memmove_repeat_emit_encodeBlockAsm12B_memmove_move_8 CMPQ R8, $0x10 JBE emit_lit_memmove_repeat_emit_encodeBlockAsm12B_memmove_move_8through16 CMPQ R8, $0x20 @@ -2875,7 +2878,7 @@ emit_literal_done_repeat_emit_encodeBlockAsm12B: // matchLen XORL R11, R11 CMPL R8, $0x08 - JL matchlen_match4_repeat_extend_encodeBlockAsm12B + JB matchlen_match4_repeat_extend_encodeBlockAsm12B matchlen_loopback_repeat_extend_encodeBlockAsm12B: MOVQ (R9)(R11*1), R10 @@ -2898,12 +2901,12 @@ matchlen_loop_repeat_extend_encodeBlockAsm12B: LEAL -8(R8), R8 LEAL 8(R11), R11 CMPL R8, $0x08 - JGE matchlen_loopback_repeat_extend_encodeBlockAsm12B + JAE matchlen_loopback_repeat_extend_encodeBlockAsm12B JZ repeat_extend_forward_end_encodeBlockAsm12B matchlen_match4_repeat_extend_encodeBlockAsm12B: CMPL R8, $0x04 - JL matchlen_match2_repeat_extend_encodeBlockAsm12B + JB matchlen_match2_repeat_extend_encodeBlockAsm12B MOVL (R9)(R11*1), R10 CMPL (BX)(R11*1), R10 JNE matchlen_match2_repeat_extend_encodeBlockAsm12B @@ -2912,7 +2915,7 @@ matchlen_match4_repeat_extend_encodeBlockAsm12B: matchlen_match2_repeat_extend_encodeBlockAsm12B: CMPL R8, $0x02 - JL matchlen_match1_repeat_extend_encodeBlockAsm12B + JB matchlen_match1_repeat_extend_encodeBlockAsm12B MOVW (R9)(R11*1), R10 CMPW (BX)(R11*1), R10 JNE matchlen_match1_repeat_extend_encodeBlockAsm12B @@ -2921,7 +2924,7 @@ matchlen_match2_repeat_extend_encodeBlockAsm12B: matchlen_match1_repeat_extend_encodeBlockAsm12B: CMPL R8, $0x01 - JL repeat_extend_forward_end_encodeBlockAsm12B + JB repeat_extend_forward_end_encodeBlockAsm12B MOVB (R9)(R11*1), R10 CMPB (BX)(R11*1), R10 JNE repeat_extend_forward_end_encodeBlockAsm12B @@ -2939,15 +2942,15 @@ repeat_extend_forward_end_encodeBlockAsm12B: MOVL BX, DI LEAL -4(BX), BX CMPL DI, $0x08 - JLE repeat_two_match_repeat_encodeBlockAsm12B + JBE repeat_two_match_repeat_encodeBlockAsm12B CMPL DI, $0x0c - JGE cant_repeat_two_offset_match_repeat_encodeBlockAsm12B + JAE cant_repeat_two_offset_match_repeat_encodeBlockAsm12B CMPL SI, $0x00000800 - JLT repeat_two_offset_match_repeat_encodeBlockAsm12B + JB repeat_two_offset_match_repeat_encodeBlockAsm12B cant_repeat_two_offset_match_repeat_encodeBlockAsm12B: CMPL BX, $0x00000104 - JLT repeat_three_match_repeat_encodeBlockAsm12B + JB repeat_three_match_repeat_encodeBlockAsm12B LEAL -256(BX), BX MOVW $0x0019, (AX) MOVW BX, 2(AX) @@ -2982,7 +2985,7 @@ repeat_two_offset_match_repeat_encodeBlockAsm12B: repeat_as_copy_encodeBlockAsm12B: // emitCopy CMPL BX, $0x40 - JLE two_byte_offset_short_repeat_as_copy_encodeBlockAsm12B + JBE two_byte_offset_short_repeat_as_copy_encodeBlockAsm12B CMPL SI, $0x00000800 JAE long_offset_short_repeat_as_copy_encodeBlockAsm12B MOVL $0x00000001, DI @@ -3001,15 +3004,15 @@ repeat_as_copy_encodeBlockAsm12B: MOVL BX, DI LEAL -4(BX), BX CMPL DI, $0x08 - JLE repeat_two_repeat_as_copy_encodeBlockAsm12B_emit_copy_short_2b + JBE repeat_two_repeat_as_copy_encodeBlockAsm12B_emit_copy_short_2b CMPL DI, $0x0c - JGE cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm12B_emit_copy_short_2b + JAE cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm12B_emit_copy_short_2b CMPL SI, $0x00000800 - JLT repeat_two_offset_repeat_as_copy_encodeBlockAsm12B_emit_copy_short_2b + JB repeat_two_offset_repeat_as_copy_encodeBlockAsm12B_emit_copy_short_2b cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm12B_emit_copy_short_2b: CMPL BX, $0x00000104 - JLT repeat_three_repeat_as_copy_encodeBlockAsm12B_emit_copy_short_2b + JB repeat_three_repeat_as_copy_encodeBlockAsm12B_emit_copy_short_2b LEAL -256(BX), BX MOVW $0x0019, (AX) MOVW BX, 2(AX) @@ -3051,15 +3054,15 @@ long_offset_short_repeat_as_copy_encodeBlockAsm12B: MOVL BX, DI LEAL -4(BX), BX CMPL DI, $0x08 - JLE repeat_two_repeat_as_copy_encodeBlockAsm12B_emit_copy_short + JBE repeat_two_repeat_as_copy_encodeBlockAsm12B_emit_copy_short CMPL DI, $0x0c - JGE cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm12B_emit_copy_short + JAE cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm12B_emit_copy_short CMPL SI, $0x00000800 - JLT repeat_two_offset_repeat_as_copy_encodeBlockAsm12B_emit_copy_short + JB repeat_two_offset_repeat_as_copy_encodeBlockAsm12B_emit_copy_short cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm12B_emit_copy_short: CMPL BX, $0x00000104 - JLT repeat_three_repeat_as_copy_encodeBlockAsm12B_emit_copy_short + JB repeat_three_repeat_as_copy_encodeBlockAsm12B_emit_copy_short LEAL -256(BX), BX MOVW $0x0019, (AX) MOVW BX, 2(AX) @@ -3095,9 +3098,9 @@ two_byte_offset_short_repeat_as_copy_encodeBlockAsm12B: MOVL BX, DI SHLL $0x02, DI CMPL BX, $0x0c - JGE emit_copy_three_repeat_as_copy_encodeBlockAsm12B + JAE emit_copy_three_repeat_as_copy_encodeBlockAsm12B CMPL SI, $0x00000800 - JGE emit_copy_three_repeat_as_copy_encodeBlockAsm12B + JAE emit_copy_three_repeat_as_copy_encodeBlockAsm12B LEAL -15(DI), DI MOVB SI, 1(AX) SHRL $0x08, SI @@ -3148,7 +3151,7 @@ candidate_match_encodeBlockAsm12B: match_extend_back_loop_encodeBlockAsm12B: CMPL CX, SI - JLE match_extend_back_end_encodeBlockAsm12B + JBE match_extend_back_end_encodeBlockAsm12B MOVB -1(DX)(BX*1), DI MOVB -1(DX)(CX*1), R8 CMPB DI, R8 @@ -3163,7 +3166,7 @@ match_extend_back_end_encodeBlockAsm12B: SUBL 12(SP), SI LEAQ 3(AX)(SI*1), SI CMPQ SI, (SP) - JL match_dst_size_check_encodeBlockAsm12B + JB match_dst_size_check_encodeBlockAsm12B MOVQ $0x00000000, ret+48(FP) RET @@ -3178,9 +3181,12 @@ match_dst_size_check_encodeBlockAsm12B: SUBL DI, R8 LEAL -1(R8), DI CMPL DI, $0x3c - JLT one_byte_match_emit_encodeBlockAsm12B + JB one_byte_match_emit_encodeBlockAsm12B CMPL DI, $0x00000100 - JLT two_bytes_match_emit_encodeBlockAsm12B + JB two_bytes_match_emit_encodeBlockAsm12B + JB three_bytes_match_emit_encodeBlockAsm12B + +three_bytes_match_emit_encodeBlockAsm12B: MOVB $0xf4, (AX) MOVW DI, 1(AX) ADDQ $0x03, AX @@ -3191,7 +3197,7 @@ two_bytes_match_emit_encodeBlockAsm12B: MOVB DI, 1(AX) ADDQ $0x02, AX CMPL DI, $0x40 - JL memmove_match_emit_encodeBlockAsm12B + JB memmove_match_emit_encodeBlockAsm12B JMP memmove_long_match_emit_encodeBlockAsm12B one_byte_match_emit_encodeBlockAsm12B: @@ -3204,7 +3210,7 @@ memmove_match_emit_encodeBlockAsm12B: // genMemMoveShort CMPQ R8, $0x08 - JLE emit_lit_memmove_match_emit_encodeBlockAsm12B_memmove_move_8 + JBE emit_lit_memmove_match_emit_encodeBlockAsm12B_memmove_move_8 CMPQ R8, $0x10 JBE emit_lit_memmove_match_emit_encodeBlockAsm12B_memmove_move_8through16 CMPQ R8, $0x20 @@ -3303,7 +3309,7 @@ match_nolit_loop_encodeBlockAsm12B: // matchLen XORL R9, R9 CMPL SI, $0x08 - JL matchlen_match4_match_nolit_encodeBlockAsm12B + JB matchlen_match4_match_nolit_encodeBlockAsm12B matchlen_loopback_match_nolit_encodeBlockAsm12B: MOVQ (DI)(R9*1), R8 @@ -3326,12 +3332,12 @@ matchlen_loop_match_nolit_encodeBlockAsm12B: LEAL -8(SI), SI LEAL 8(R9), R9 CMPL SI, $0x08 - JGE matchlen_loopback_match_nolit_encodeBlockAsm12B + JAE matchlen_loopback_match_nolit_encodeBlockAsm12B JZ match_nolit_end_encodeBlockAsm12B matchlen_match4_match_nolit_encodeBlockAsm12B: CMPL SI, $0x04 - JL matchlen_match2_match_nolit_encodeBlockAsm12B + JB matchlen_match2_match_nolit_encodeBlockAsm12B MOVL (DI)(R9*1), R8 CMPL (BX)(R9*1), R8 JNE matchlen_match2_match_nolit_encodeBlockAsm12B @@ -3340,7 +3346,7 @@ matchlen_match4_match_nolit_encodeBlockAsm12B: matchlen_match2_match_nolit_encodeBlockAsm12B: CMPL SI, $0x02 - JL matchlen_match1_match_nolit_encodeBlockAsm12B + JB matchlen_match1_match_nolit_encodeBlockAsm12B MOVW (DI)(R9*1), R8 CMPW (BX)(R9*1), R8 JNE matchlen_match1_match_nolit_encodeBlockAsm12B @@ -3349,7 +3355,7 @@ matchlen_match2_match_nolit_encodeBlockAsm12B: matchlen_match1_match_nolit_encodeBlockAsm12B: CMPL SI, $0x01 - JL match_nolit_end_encodeBlockAsm12B + JB match_nolit_end_encodeBlockAsm12B MOVB (DI)(R9*1), R8 CMPB (BX)(R9*1), R8 JNE match_nolit_end_encodeBlockAsm12B @@ -3363,7 +3369,7 @@ match_nolit_end_encodeBlockAsm12B: // emitCopy CMPL R9, $0x40 - JLE two_byte_offset_short_match_nolit_encodeBlockAsm12B + JBE two_byte_offset_short_match_nolit_encodeBlockAsm12B CMPL BX, $0x00000800 JAE long_offset_short_match_nolit_encodeBlockAsm12B MOVL $0x00000001, SI @@ -3382,15 +3388,15 @@ match_nolit_end_encodeBlockAsm12B: MOVL R9, SI LEAL -4(R9), R9 CMPL SI, $0x08 - JLE repeat_two_match_nolit_encodeBlockAsm12B_emit_copy_short_2b + JBE repeat_two_match_nolit_encodeBlockAsm12B_emit_copy_short_2b CMPL SI, $0x0c - JGE cant_repeat_two_offset_match_nolit_encodeBlockAsm12B_emit_copy_short_2b + JAE cant_repeat_two_offset_match_nolit_encodeBlockAsm12B_emit_copy_short_2b CMPL BX, $0x00000800 - JLT repeat_two_offset_match_nolit_encodeBlockAsm12B_emit_copy_short_2b + JB repeat_two_offset_match_nolit_encodeBlockAsm12B_emit_copy_short_2b cant_repeat_two_offset_match_nolit_encodeBlockAsm12B_emit_copy_short_2b: CMPL R9, $0x00000104 - JLT repeat_three_match_nolit_encodeBlockAsm12B_emit_copy_short_2b + JB repeat_three_match_nolit_encodeBlockAsm12B_emit_copy_short_2b LEAL -256(R9), R9 MOVW $0x0019, (AX) MOVW R9, 2(AX) @@ -3432,15 +3438,15 @@ long_offset_short_match_nolit_encodeBlockAsm12B: MOVL R9, SI LEAL -4(R9), R9 CMPL SI, $0x08 - JLE repeat_two_match_nolit_encodeBlockAsm12B_emit_copy_short + JBE repeat_two_match_nolit_encodeBlockAsm12B_emit_copy_short CMPL SI, $0x0c - JGE cant_repeat_two_offset_match_nolit_encodeBlockAsm12B_emit_copy_short + JAE cant_repeat_two_offset_match_nolit_encodeBlockAsm12B_emit_copy_short CMPL BX, $0x00000800 - JLT repeat_two_offset_match_nolit_encodeBlockAsm12B_emit_copy_short + JB repeat_two_offset_match_nolit_encodeBlockAsm12B_emit_copy_short cant_repeat_two_offset_match_nolit_encodeBlockAsm12B_emit_copy_short: CMPL R9, $0x00000104 - JLT repeat_three_match_nolit_encodeBlockAsm12B_emit_copy_short + JB repeat_three_match_nolit_encodeBlockAsm12B_emit_copy_short LEAL -256(R9), R9 MOVW $0x0019, (AX) MOVW R9, 2(AX) @@ -3476,9 +3482,9 @@ two_byte_offset_short_match_nolit_encodeBlockAsm12B: MOVL R9, SI SHLL $0x02, SI CMPL R9, $0x0c - JGE emit_copy_three_match_nolit_encodeBlockAsm12B + JAE emit_copy_three_match_nolit_encodeBlockAsm12B CMPL BX, $0x00000800 - JGE emit_copy_three_match_nolit_encodeBlockAsm12B + JAE emit_copy_three_match_nolit_encodeBlockAsm12B LEAL -15(SI), SI MOVB BL, 1(AX) SHRL $0x08, BX @@ -3496,10 +3502,10 @@ emit_copy_three_match_nolit_encodeBlockAsm12B: match_nolit_emitcopy_end_encodeBlockAsm12B: CMPL CX, 8(SP) - JGE emit_remainder_encodeBlockAsm12B + JAE emit_remainder_encodeBlockAsm12B MOVQ -2(DX)(CX*1), SI CMPQ AX, (SP) - JL match_nolit_dst_ok_encodeBlockAsm12B + JB match_nolit_dst_ok_encodeBlockAsm12B MOVQ $0x00000000, ret+48(FP) RET @@ -3529,7 +3535,7 @@ emit_remainder_encodeBlockAsm12B: SUBL 12(SP), CX LEAQ 3(AX)(CX*1), CX CMPQ CX, (SP) - JL emit_remainder_ok_encodeBlockAsm12B + JB emit_remainder_ok_encodeBlockAsm12B MOVQ $0x00000000, ret+48(FP) RET @@ -3544,9 +3550,12 @@ emit_remainder_ok_encodeBlockAsm12B: SUBL BX, SI LEAL -1(SI), DX CMPL DX, $0x3c - JLT one_byte_emit_remainder_encodeBlockAsm12B + JB one_byte_emit_remainder_encodeBlockAsm12B CMPL DX, $0x00000100 - JLT two_bytes_emit_remainder_encodeBlockAsm12B + JB two_bytes_emit_remainder_encodeBlockAsm12B + JB three_bytes_emit_remainder_encodeBlockAsm12B + +three_bytes_emit_remainder_encodeBlockAsm12B: MOVB $0xf4, (AX) MOVW DX, 1(AX) ADDQ $0x03, AX @@ -3557,7 +3566,7 @@ two_bytes_emit_remainder_encodeBlockAsm12B: MOVB DL, 1(AX) ADDQ $0x02, AX CMPL DX, $0x40 - JL memmove_emit_remainder_encodeBlockAsm12B + JB memmove_emit_remainder_encodeBlockAsm12B JMP memmove_long_emit_remainder_encodeBlockAsm12B one_byte_emit_remainder_encodeBlockAsm12B: @@ -3720,7 +3729,7 @@ search_loop_encodeBlockAsm10B: SHRL $0x05, BX LEAL 4(CX)(BX*1), BX CMPL BX, 8(SP) - JGE emit_remainder_encodeBlockAsm10B + JAE emit_remainder_encodeBlockAsm10B MOVQ (DX)(CX*1), SI MOVL BX, 20(SP) MOVQ $0x9e3779b1, R8 @@ -3758,7 +3767,7 @@ search_loop_encodeBlockAsm10B: repeat_extend_back_loop_encodeBlockAsm10B: CMPL SI, DI - JLE repeat_extend_back_end_encodeBlockAsm10B + JBE repeat_extend_back_end_encodeBlockAsm10B MOVB -1(DX)(BX*1), R8 MOVB -1(DX)(SI*1), R9 CMPB R8, R9 @@ -3777,9 +3786,12 @@ repeat_extend_back_end_encodeBlockAsm10B: SUBL BX, R8 LEAL -1(R8), BX CMPL BX, $0x3c - JLT one_byte_repeat_emit_encodeBlockAsm10B + JB one_byte_repeat_emit_encodeBlockAsm10B CMPL BX, $0x00000100 - JLT two_bytes_repeat_emit_encodeBlockAsm10B + JB two_bytes_repeat_emit_encodeBlockAsm10B + JB three_bytes_repeat_emit_encodeBlockAsm10B + +three_bytes_repeat_emit_encodeBlockAsm10B: MOVB $0xf4, (AX) MOVW BX, 1(AX) ADDQ $0x03, AX @@ -3790,7 +3802,7 @@ two_bytes_repeat_emit_encodeBlockAsm10B: MOVB BL, 1(AX) ADDQ $0x02, AX CMPL BX, $0x40 - JL memmove_repeat_emit_encodeBlockAsm10B + JB memmove_repeat_emit_encodeBlockAsm10B JMP memmove_long_repeat_emit_encodeBlockAsm10B one_byte_repeat_emit_encodeBlockAsm10B: @@ -3803,7 +3815,7 @@ memmove_repeat_emit_encodeBlockAsm10B: // genMemMoveShort CMPQ R8, $0x08 - JLE emit_lit_memmove_repeat_emit_encodeBlockAsm10B_memmove_move_8 + JBE emit_lit_memmove_repeat_emit_encodeBlockAsm10B_memmove_move_8 CMPQ R8, $0x10 JBE emit_lit_memmove_repeat_emit_encodeBlockAsm10B_memmove_move_8through16 CMPQ R8, $0x20 @@ -3899,7 +3911,7 @@ emit_literal_done_repeat_emit_encodeBlockAsm10B: // matchLen XORL R11, R11 CMPL R8, $0x08 - JL matchlen_match4_repeat_extend_encodeBlockAsm10B + JB matchlen_match4_repeat_extend_encodeBlockAsm10B matchlen_loopback_repeat_extend_encodeBlockAsm10B: MOVQ (R9)(R11*1), R10 @@ -3922,12 +3934,12 @@ matchlen_loop_repeat_extend_encodeBlockAsm10B: LEAL -8(R8), R8 LEAL 8(R11), R11 CMPL R8, $0x08 - JGE matchlen_loopback_repeat_extend_encodeBlockAsm10B + JAE matchlen_loopback_repeat_extend_encodeBlockAsm10B JZ repeat_extend_forward_end_encodeBlockAsm10B matchlen_match4_repeat_extend_encodeBlockAsm10B: CMPL R8, $0x04 - JL matchlen_match2_repeat_extend_encodeBlockAsm10B + JB matchlen_match2_repeat_extend_encodeBlockAsm10B MOVL (R9)(R11*1), R10 CMPL (BX)(R11*1), R10 JNE matchlen_match2_repeat_extend_encodeBlockAsm10B @@ -3936,7 +3948,7 @@ matchlen_match4_repeat_extend_encodeBlockAsm10B: matchlen_match2_repeat_extend_encodeBlockAsm10B: CMPL R8, $0x02 - JL matchlen_match1_repeat_extend_encodeBlockAsm10B + JB matchlen_match1_repeat_extend_encodeBlockAsm10B MOVW (R9)(R11*1), R10 CMPW (BX)(R11*1), R10 JNE matchlen_match1_repeat_extend_encodeBlockAsm10B @@ -3945,7 +3957,7 @@ matchlen_match2_repeat_extend_encodeBlockAsm10B: matchlen_match1_repeat_extend_encodeBlockAsm10B: CMPL R8, $0x01 - JL repeat_extend_forward_end_encodeBlockAsm10B + JB repeat_extend_forward_end_encodeBlockAsm10B MOVB (R9)(R11*1), R10 CMPB (BX)(R11*1), R10 JNE repeat_extend_forward_end_encodeBlockAsm10B @@ -3963,15 +3975,15 @@ repeat_extend_forward_end_encodeBlockAsm10B: MOVL BX, DI LEAL -4(BX), BX CMPL DI, $0x08 - JLE repeat_two_match_repeat_encodeBlockAsm10B + JBE repeat_two_match_repeat_encodeBlockAsm10B CMPL DI, $0x0c - JGE cant_repeat_two_offset_match_repeat_encodeBlockAsm10B + JAE cant_repeat_two_offset_match_repeat_encodeBlockAsm10B CMPL SI, $0x00000800 - JLT repeat_two_offset_match_repeat_encodeBlockAsm10B + JB repeat_two_offset_match_repeat_encodeBlockAsm10B cant_repeat_two_offset_match_repeat_encodeBlockAsm10B: CMPL BX, $0x00000104 - JLT repeat_three_match_repeat_encodeBlockAsm10B + JB repeat_three_match_repeat_encodeBlockAsm10B LEAL -256(BX), BX MOVW $0x0019, (AX) MOVW BX, 2(AX) @@ -4006,7 +4018,7 @@ repeat_two_offset_match_repeat_encodeBlockAsm10B: repeat_as_copy_encodeBlockAsm10B: // emitCopy CMPL BX, $0x40 - JLE two_byte_offset_short_repeat_as_copy_encodeBlockAsm10B + JBE two_byte_offset_short_repeat_as_copy_encodeBlockAsm10B CMPL SI, $0x00000800 JAE long_offset_short_repeat_as_copy_encodeBlockAsm10B MOVL $0x00000001, DI @@ -4025,15 +4037,15 @@ repeat_as_copy_encodeBlockAsm10B: MOVL BX, DI LEAL -4(BX), BX CMPL DI, $0x08 - JLE repeat_two_repeat_as_copy_encodeBlockAsm10B_emit_copy_short_2b + JBE repeat_two_repeat_as_copy_encodeBlockAsm10B_emit_copy_short_2b CMPL DI, $0x0c - JGE cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm10B_emit_copy_short_2b + JAE cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm10B_emit_copy_short_2b CMPL SI, $0x00000800 - JLT repeat_two_offset_repeat_as_copy_encodeBlockAsm10B_emit_copy_short_2b + JB repeat_two_offset_repeat_as_copy_encodeBlockAsm10B_emit_copy_short_2b cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm10B_emit_copy_short_2b: CMPL BX, $0x00000104 - JLT repeat_three_repeat_as_copy_encodeBlockAsm10B_emit_copy_short_2b + JB repeat_three_repeat_as_copy_encodeBlockAsm10B_emit_copy_short_2b LEAL -256(BX), BX MOVW $0x0019, (AX) MOVW BX, 2(AX) @@ -4075,15 +4087,15 @@ long_offset_short_repeat_as_copy_encodeBlockAsm10B: MOVL BX, DI LEAL -4(BX), BX CMPL DI, $0x08 - JLE repeat_two_repeat_as_copy_encodeBlockAsm10B_emit_copy_short + JBE repeat_two_repeat_as_copy_encodeBlockAsm10B_emit_copy_short CMPL DI, $0x0c - JGE cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm10B_emit_copy_short + JAE cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm10B_emit_copy_short CMPL SI, $0x00000800 - JLT repeat_two_offset_repeat_as_copy_encodeBlockAsm10B_emit_copy_short + JB repeat_two_offset_repeat_as_copy_encodeBlockAsm10B_emit_copy_short cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm10B_emit_copy_short: CMPL BX, $0x00000104 - JLT repeat_three_repeat_as_copy_encodeBlockAsm10B_emit_copy_short + JB repeat_three_repeat_as_copy_encodeBlockAsm10B_emit_copy_short LEAL -256(BX), BX MOVW $0x0019, (AX) MOVW BX, 2(AX) @@ -4119,9 +4131,9 @@ two_byte_offset_short_repeat_as_copy_encodeBlockAsm10B: MOVL BX, DI SHLL $0x02, DI CMPL BX, $0x0c - JGE emit_copy_three_repeat_as_copy_encodeBlockAsm10B + JAE emit_copy_three_repeat_as_copy_encodeBlockAsm10B CMPL SI, $0x00000800 - JGE emit_copy_three_repeat_as_copy_encodeBlockAsm10B + JAE emit_copy_three_repeat_as_copy_encodeBlockAsm10B LEAL -15(DI), DI MOVB SI, 1(AX) SHRL $0x08, SI @@ -4172,7 +4184,7 @@ candidate_match_encodeBlockAsm10B: match_extend_back_loop_encodeBlockAsm10B: CMPL CX, SI - JLE match_extend_back_end_encodeBlockAsm10B + JBE match_extend_back_end_encodeBlockAsm10B MOVB -1(DX)(BX*1), DI MOVB -1(DX)(CX*1), R8 CMPB DI, R8 @@ -4187,7 +4199,7 @@ match_extend_back_end_encodeBlockAsm10B: SUBL 12(SP), SI LEAQ 3(AX)(SI*1), SI CMPQ SI, (SP) - JL match_dst_size_check_encodeBlockAsm10B + JB match_dst_size_check_encodeBlockAsm10B MOVQ $0x00000000, ret+48(FP) RET @@ -4202,9 +4214,12 @@ match_dst_size_check_encodeBlockAsm10B: SUBL DI, R8 LEAL -1(R8), DI CMPL DI, $0x3c - JLT one_byte_match_emit_encodeBlockAsm10B + JB one_byte_match_emit_encodeBlockAsm10B CMPL DI, $0x00000100 - JLT two_bytes_match_emit_encodeBlockAsm10B + JB two_bytes_match_emit_encodeBlockAsm10B + JB three_bytes_match_emit_encodeBlockAsm10B + +three_bytes_match_emit_encodeBlockAsm10B: MOVB $0xf4, (AX) MOVW DI, 1(AX) ADDQ $0x03, AX @@ -4215,7 +4230,7 @@ two_bytes_match_emit_encodeBlockAsm10B: MOVB DI, 1(AX) ADDQ $0x02, AX CMPL DI, $0x40 - JL memmove_match_emit_encodeBlockAsm10B + JB memmove_match_emit_encodeBlockAsm10B JMP memmove_long_match_emit_encodeBlockAsm10B one_byte_match_emit_encodeBlockAsm10B: @@ -4228,7 +4243,7 @@ memmove_match_emit_encodeBlockAsm10B: // genMemMoveShort CMPQ R8, $0x08 - JLE emit_lit_memmove_match_emit_encodeBlockAsm10B_memmove_move_8 + JBE emit_lit_memmove_match_emit_encodeBlockAsm10B_memmove_move_8 CMPQ R8, $0x10 JBE emit_lit_memmove_match_emit_encodeBlockAsm10B_memmove_move_8through16 CMPQ R8, $0x20 @@ -4327,7 +4342,7 @@ match_nolit_loop_encodeBlockAsm10B: // matchLen XORL R9, R9 CMPL SI, $0x08 - JL matchlen_match4_match_nolit_encodeBlockAsm10B + JB matchlen_match4_match_nolit_encodeBlockAsm10B matchlen_loopback_match_nolit_encodeBlockAsm10B: MOVQ (DI)(R9*1), R8 @@ -4350,12 +4365,12 @@ matchlen_loop_match_nolit_encodeBlockAsm10B: LEAL -8(SI), SI LEAL 8(R9), R9 CMPL SI, $0x08 - JGE matchlen_loopback_match_nolit_encodeBlockAsm10B + JAE matchlen_loopback_match_nolit_encodeBlockAsm10B JZ match_nolit_end_encodeBlockAsm10B matchlen_match4_match_nolit_encodeBlockAsm10B: CMPL SI, $0x04 - JL matchlen_match2_match_nolit_encodeBlockAsm10B + JB matchlen_match2_match_nolit_encodeBlockAsm10B MOVL (DI)(R9*1), R8 CMPL (BX)(R9*1), R8 JNE matchlen_match2_match_nolit_encodeBlockAsm10B @@ -4364,7 +4379,7 @@ matchlen_match4_match_nolit_encodeBlockAsm10B: matchlen_match2_match_nolit_encodeBlockAsm10B: CMPL SI, $0x02 - JL matchlen_match1_match_nolit_encodeBlockAsm10B + JB matchlen_match1_match_nolit_encodeBlockAsm10B MOVW (DI)(R9*1), R8 CMPW (BX)(R9*1), R8 JNE matchlen_match1_match_nolit_encodeBlockAsm10B @@ -4373,7 +4388,7 @@ matchlen_match2_match_nolit_encodeBlockAsm10B: matchlen_match1_match_nolit_encodeBlockAsm10B: CMPL SI, $0x01 - JL match_nolit_end_encodeBlockAsm10B + JB match_nolit_end_encodeBlockAsm10B MOVB (DI)(R9*1), R8 CMPB (BX)(R9*1), R8 JNE match_nolit_end_encodeBlockAsm10B @@ -4387,7 +4402,7 @@ match_nolit_end_encodeBlockAsm10B: // emitCopy CMPL R9, $0x40 - JLE two_byte_offset_short_match_nolit_encodeBlockAsm10B + JBE two_byte_offset_short_match_nolit_encodeBlockAsm10B CMPL BX, $0x00000800 JAE long_offset_short_match_nolit_encodeBlockAsm10B MOVL $0x00000001, SI @@ -4406,15 +4421,15 @@ match_nolit_end_encodeBlockAsm10B: MOVL R9, SI LEAL -4(R9), R9 CMPL SI, $0x08 - JLE repeat_two_match_nolit_encodeBlockAsm10B_emit_copy_short_2b + JBE repeat_two_match_nolit_encodeBlockAsm10B_emit_copy_short_2b CMPL SI, $0x0c - JGE cant_repeat_two_offset_match_nolit_encodeBlockAsm10B_emit_copy_short_2b + JAE cant_repeat_two_offset_match_nolit_encodeBlockAsm10B_emit_copy_short_2b CMPL BX, $0x00000800 - JLT repeat_two_offset_match_nolit_encodeBlockAsm10B_emit_copy_short_2b + JB repeat_two_offset_match_nolit_encodeBlockAsm10B_emit_copy_short_2b cant_repeat_two_offset_match_nolit_encodeBlockAsm10B_emit_copy_short_2b: CMPL R9, $0x00000104 - JLT repeat_three_match_nolit_encodeBlockAsm10B_emit_copy_short_2b + JB repeat_three_match_nolit_encodeBlockAsm10B_emit_copy_short_2b LEAL -256(R9), R9 MOVW $0x0019, (AX) MOVW R9, 2(AX) @@ -4456,15 +4471,15 @@ long_offset_short_match_nolit_encodeBlockAsm10B: MOVL R9, SI LEAL -4(R9), R9 CMPL SI, $0x08 - JLE repeat_two_match_nolit_encodeBlockAsm10B_emit_copy_short + JBE repeat_two_match_nolit_encodeBlockAsm10B_emit_copy_short CMPL SI, $0x0c - JGE cant_repeat_two_offset_match_nolit_encodeBlockAsm10B_emit_copy_short + JAE cant_repeat_two_offset_match_nolit_encodeBlockAsm10B_emit_copy_short CMPL BX, $0x00000800 - JLT repeat_two_offset_match_nolit_encodeBlockAsm10B_emit_copy_short + JB repeat_two_offset_match_nolit_encodeBlockAsm10B_emit_copy_short cant_repeat_two_offset_match_nolit_encodeBlockAsm10B_emit_copy_short: CMPL R9, $0x00000104 - JLT repeat_three_match_nolit_encodeBlockAsm10B_emit_copy_short + JB repeat_three_match_nolit_encodeBlockAsm10B_emit_copy_short LEAL -256(R9), R9 MOVW $0x0019, (AX) MOVW R9, 2(AX) @@ -4500,9 +4515,9 @@ two_byte_offset_short_match_nolit_encodeBlockAsm10B: MOVL R9, SI SHLL $0x02, SI CMPL R9, $0x0c - JGE emit_copy_three_match_nolit_encodeBlockAsm10B + JAE emit_copy_three_match_nolit_encodeBlockAsm10B CMPL BX, $0x00000800 - JGE emit_copy_three_match_nolit_encodeBlockAsm10B + JAE emit_copy_three_match_nolit_encodeBlockAsm10B LEAL -15(SI), SI MOVB BL, 1(AX) SHRL $0x08, BX @@ -4520,10 +4535,10 @@ emit_copy_three_match_nolit_encodeBlockAsm10B: match_nolit_emitcopy_end_encodeBlockAsm10B: CMPL CX, 8(SP) - JGE emit_remainder_encodeBlockAsm10B + JAE emit_remainder_encodeBlockAsm10B MOVQ -2(DX)(CX*1), SI CMPQ AX, (SP) - JL match_nolit_dst_ok_encodeBlockAsm10B + JB match_nolit_dst_ok_encodeBlockAsm10B MOVQ $0x00000000, ret+48(FP) RET @@ -4553,7 +4568,7 @@ emit_remainder_encodeBlockAsm10B: SUBL 12(SP), CX LEAQ 3(AX)(CX*1), CX CMPQ CX, (SP) - JL emit_remainder_ok_encodeBlockAsm10B + JB emit_remainder_ok_encodeBlockAsm10B MOVQ $0x00000000, ret+48(FP) RET @@ -4568,9 +4583,12 @@ emit_remainder_ok_encodeBlockAsm10B: SUBL BX, SI LEAL -1(SI), DX CMPL DX, $0x3c - JLT one_byte_emit_remainder_encodeBlockAsm10B + JB one_byte_emit_remainder_encodeBlockAsm10B CMPL DX, $0x00000100 - JLT two_bytes_emit_remainder_encodeBlockAsm10B + JB two_bytes_emit_remainder_encodeBlockAsm10B + JB three_bytes_emit_remainder_encodeBlockAsm10B + +three_bytes_emit_remainder_encodeBlockAsm10B: MOVB $0xf4, (AX) MOVW DX, 1(AX) ADDQ $0x03, AX @@ -4581,7 +4599,7 @@ two_bytes_emit_remainder_encodeBlockAsm10B: MOVB DL, 1(AX) ADDQ $0x02, AX CMPL DX, $0x40 - JL memmove_emit_remainder_encodeBlockAsm10B + JB memmove_emit_remainder_encodeBlockAsm10B JMP memmove_long_emit_remainder_encodeBlockAsm10B one_byte_emit_remainder_encodeBlockAsm10B: @@ -4744,7 +4762,7 @@ search_loop_encodeBlockAsm8B: SHRL $0x04, BX LEAL 4(CX)(BX*1), BX CMPL BX, 8(SP) - JGE emit_remainder_encodeBlockAsm8B + JAE emit_remainder_encodeBlockAsm8B MOVQ (DX)(CX*1), SI MOVL BX, 20(SP) MOVQ $0x9e3779b1, R8 @@ -4782,7 +4800,7 @@ search_loop_encodeBlockAsm8B: repeat_extend_back_loop_encodeBlockAsm8B: CMPL SI, DI - JLE repeat_extend_back_end_encodeBlockAsm8B + JBE repeat_extend_back_end_encodeBlockAsm8B MOVB -1(DX)(BX*1), R8 MOVB -1(DX)(SI*1), R9 CMPB R8, R9 @@ -4801,9 +4819,12 @@ repeat_extend_back_end_encodeBlockAsm8B: SUBL BX, R8 LEAL -1(R8), BX CMPL BX, $0x3c - JLT one_byte_repeat_emit_encodeBlockAsm8B + JB one_byte_repeat_emit_encodeBlockAsm8B CMPL BX, $0x00000100 - JLT two_bytes_repeat_emit_encodeBlockAsm8B + JB two_bytes_repeat_emit_encodeBlockAsm8B + JB three_bytes_repeat_emit_encodeBlockAsm8B + +three_bytes_repeat_emit_encodeBlockAsm8B: MOVB $0xf4, (AX) MOVW BX, 1(AX) ADDQ $0x03, AX @@ -4814,7 +4835,7 @@ two_bytes_repeat_emit_encodeBlockAsm8B: MOVB BL, 1(AX) ADDQ $0x02, AX CMPL BX, $0x40 - JL memmove_repeat_emit_encodeBlockAsm8B + JB memmove_repeat_emit_encodeBlockAsm8B JMP memmove_long_repeat_emit_encodeBlockAsm8B one_byte_repeat_emit_encodeBlockAsm8B: @@ -4827,7 +4848,7 @@ memmove_repeat_emit_encodeBlockAsm8B: // genMemMoveShort CMPQ R8, $0x08 - JLE emit_lit_memmove_repeat_emit_encodeBlockAsm8B_memmove_move_8 + JBE emit_lit_memmove_repeat_emit_encodeBlockAsm8B_memmove_move_8 CMPQ R8, $0x10 JBE emit_lit_memmove_repeat_emit_encodeBlockAsm8B_memmove_move_8through16 CMPQ R8, $0x20 @@ -4923,7 +4944,7 @@ emit_literal_done_repeat_emit_encodeBlockAsm8B: // matchLen XORL R11, R11 CMPL R8, $0x08 - JL matchlen_match4_repeat_extend_encodeBlockAsm8B + JB matchlen_match4_repeat_extend_encodeBlockAsm8B matchlen_loopback_repeat_extend_encodeBlockAsm8B: MOVQ (R9)(R11*1), R10 @@ -4946,12 +4967,12 @@ matchlen_loop_repeat_extend_encodeBlockAsm8B: LEAL -8(R8), R8 LEAL 8(R11), R11 CMPL R8, $0x08 - JGE matchlen_loopback_repeat_extend_encodeBlockAsm8B + JAE matchlen_loopback_repeat_extend_encodeBlockAsm8B JZ repeat_extend_forward_end_encodeBlockAsm8B matchlen_match4_repeat_extend_encodeBlockAsm8B: CMPL R8, $0x04 - JL matchlen_match2_repeat_extend_encodeBlockAsm8B + JB matchlen_match2_repeat_extend_encodeBlockAsm8B MOVL (R9)(R11*1), R10 CMPL (BX)(R11*1), R10 JNE matchlen_match2_repeat_extend_encodeBlockAsm8B @@ -4960,7 +4981,7 @@ matchlen_match4_repeat_extend_encodeBlockAsm8B: matchlen_match2_repeat_extend_encodeBlockAsm8B: CMPL R8, $0x02 - JL matchlen_match1_repeat_extend_encodeBlockAsm8B + JB matchlen_match1_repeat_extend_encodeBlockAsm8B MOVW (R9)(R11*1), R10 CMPW (BX)(R11*1), R10 JNE matchlen_match1_repeat_extend_encodeBlockAsm8B @@ -4969,7 +4990,7 @@ matchlen_match2_repeat_extend_encodeBlockAsm8B: matchlen_match1_repeat_extend_encodeBlockAsm8B: CMPL R8, $0x01 - JL repeat_extend_forward_end_encodeBlockAsm8B + JB repeat_extend_forward_end_encodeBlockAsm8B MOVB (R9)(R11*1), R10 CMPB (BX)(R11*1), R10 JNE repeat_extend_forward_end_encodeBlockAsm8B @@ -4987,13 +5008,13 @@ repeat_extend_forward_end_encodeBlockAsm8B: MOVL BX, SI LEAL -4(BX), BX CMPL SI, $0x08 - JLE repeat_two_match_repeat_encodeBlockAsm8B + JBE repeat_two_match_repeat_encodeBlockAsm8B CMPL SI, $0x0c - JGE cant_repeat_two_offset_match_repeat_encodeBlockAsm8B + JAE cant_repeat_two_offset_match_repeat_encodeBlockAsm8B cant_repeat_two_offset_match_repeat_encodeBlockAsm8B: CMPL BX, $0x00000104 - JLT repeat_three_match_repeat_encodeBlockAsm8B + JB repeat_three_match_repeat_encodeBlockAsm8B LEAL -256(BX), BX MOVW $0x0019, (AX) MOVW BX, 2(AX) @@ -5026,7 +5047,7 @@ repeat_two_match_repeat_encodeBlockAsm8B: repeat_as_copy_encodeBlockAsm8B: // emitCopy CMPL BX, $0x40 - JLE two_byte_offset_short_repeat_as_copy_encodeBlockAsm8B + JBE two_byte_offset_short_repeat_as_copy_encodeBlockAsm8B CMPL SI, $0x00000800 JAE long_offset_short_repeat_as_copy_encodeBlockAsm8B MOVL $0x00000001, DI @@ -5045,13 +5066,13 @@ repeat_as_copy_encodeBlockAsm8B: MOVL BX, SI LEAL -4(BX), BX CMPL SI, $0x08 - JLE repeat_two_repeat_as_copy_encodeBlockAsm8B_emit_copy_short_2b + JBE repeat_two_repeat_as_copy_encodeBlockAsm8B_emit_copy_short_2b CMPL SI, $0x0c - JGE cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm8B_emit_copy_short_2b + JAE cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm8B_emit_copy_short_2b cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm8B_emit_copy_short_2b: CMPL BX, $0x00000104 - JLT repeat_three_repeat_as_copy_encodeBlockAsm8B_emit_copy_short_2b + JB repeat_three_repeat_as_copy_encodeBlockAsm8B_emit_copy_short_2b LEAL -256(BX), BX MOVW $0x0019, (AX) MOVW BX, 2(AX) @@ -5091,13 +5112,13 @@ long_offset_short_repeat_as_copy_encodeBlockAsm8B: MOVL BX, SI LEAL -4(BX), BX CMPL SI, $0x08 - JLE repeat_two_repeat_as_copy_encodeBlockAsm8B_emit_copy_short + JBE repeat_two_repeat_as_copy_encodeBlockAsm8B_emit_copy_short CMPL SI, $0x0c - JGE cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm8B_emit_copy_short + JAE cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm8B_emit_copy_short cant_repeat_two_offset_repeat_as_copy_encodeBlockAsm8B_emit_copy_short: CMPL BX, $0x00000104 - JLT repeat_three_repeat_as_copy_encodeBlockAsm8B_emit_copy_short + JB repeat_three_repeat_as_copy_encodeBlockAsm8B_emit_copy_short LEAL -256(BX), BX MOVW $0x0019, (AX) MOVW BX, 2(AX) @@ -5131,7 +5152,7 @@ two_byte_offset_short_repeat_as_copy_encodeBlockAsm8B: MOVL BX, DI SHLL $0x02, DI CMPL BX, $0x0c - JGE emit_copy_three_repeat_as_copy_encodeBlockAsm8B + JAE emit_copy_three_repeat_as_copy_encodeBlockAsm8B LEAL -15(DI), DI MOVB SI, 1(AX) SHRL $0x08, SI @@ -5182,7 +5203,7 @@ candidate_match_encodeBlockAsm8B: match_extend_back_loop_encodeBlockAsm8B: CMPL CX, SI - JLE match_extend_back_end_encodeBlockAsm8B + JBE match_extend_back_end_encodeBlockAsm8B MOVB -1(DX)(BX*1), DI MOVB -1(DX)(CX*1), R8 CMPB DI, R8 @@ -5197,7 +5218,7 @@ match_extend_back_end_encodeBlockAsm8B: SUBL 12(SP), SI LEAQ 3(AX)(SI*1), SI CMPQ SI, (SP) - JL match_dst_size_check_encodeBlockAsm8B + JB match_dst_size_check_encodeBlockAsm8B MOVQ $0x00000000, ret+48(FP) RET @@ -5212,9 +5233,12 @@ match_dst_size_check_encodeBlockAsm8B: SUBL DI, R8 LEAL -1(R8), DI CMPL DI, $0x3c - JLT one_byte_match_emit_encodeBlockAsm8B + JB one_byte_match_emit_encodeBlockAsm8B CMPL DI, $0x00000100 - JLT two_bytes_match_emit_encodeBlockAsm8B + JB two_bytes_match_emit_encodeBlockAsm8B + JB three_bytes_match_emit_encodeBlockAsm8B + +three_bytes_match_emit_encodeBlockAsm8B: MOVB $0xf4, (AX) MOVW DI, 1(AX) ADDQ $0x03, AX @@ -5225,7 +5249,7 @@ two_bytes_match_emit_encodeBlockAsm8B: MOVB DI, 1(AX) ADDQ $0x02, AX CMPL DI, $0x40 - JL memmove_match_emit_encodeBlockAsm8B + JB memmove_match_emit_encodeBlockAsm8B JMP memmove_long_match_emit_encodeBlockAsm8B one_byte_match_emit_encodeBlockAsm8B: @@ -5238,7 +5262,7 @@ memmove_match_emit_encodeBlockAsm8B: // genMemMoveShort CMPQ R8, $0x08 - JLE emit_lit_memmove_match_emit_encodeBlockAsm8B_memmove_move_8 + JBE emit_lit_memmove_match_emit_encodeBlockAsm8B_memmove_move_8 CMPQ R8, $0x10 JBE emit_lit_memmove_match_emit_encodeBlockAsm8B_memmove_move_8through16 CMPQ R8, $0x20 @@ -5337,7 +5361,7 @@ match_nolit_loop_encodeBlockAsm8B: // matchLen XORL R9, R9 CMPL SI, $0x08 - JL matchlen_match4_match_nolit_encodeBlockAsm8B + JB matchlen_match4_match_nolit_encodeBlockAsm8B matchlen_loopback_match_nolit_encodeBlockAsm8B: MOVQ (DI)(R9*1), R8 @@ -5360,12 +5384,12 @@ matchlen_loop_match_nolit_encodeBlockAsm8B: LEAL -8(SI), SI LEAL 8(R9), R9 CMPL SI, $0x08 - JGE matchlen_loopback_match_nolit_encodeBlockAsm8B + JAE matchlen_loopback_match_nolit_encodeBlockAsm8B JZ match_nolit_end_encodeBlockAsm8B matchlen_match4_match_nolit_encodeBlockAsm8B: CMPL SI, $0x04 - JL matchlen_match2_match_nolit_encodeBlockAsm8B + JB matchlen_match2_match_nolit_encodeBlockAsm8B MOVL (DI)(R9*1), R8 CMPL (BX)(R9*1), R8 JNE matchlen_match2_match_nolit_encodeBlockAsm8B @@ -5374,7 +5398,7 @@ matchlen_match4_match_nolit_encodeBlockAsm8B: matchlen_match2_match_nolit_encodeBlockAsm8B: CMPL SI, $0x02 - JL matchlen_match1_match_nolit_encodeBlockAsm8B + JB matchlen_match1_match_nolit_encodeBlockAsm8B MOVW (DI)(R9*1), R8 CMPW (BX)(R9*1), R8 JNE matchlen_match1_match_nolit_encodeBlockAsm8B @@ -5383,7 +5407,7 @@ matchlen_match2_match_nolit_encodeBlockAsm8B: matchlen_match1_match_nolit_encodeBlockAsm8B: CMPL SI, $0x01 - JL match_nolit_end_encodeBlockAsm8B + JB match_nolit_end_encodeBlockAsm8B MOVB (DI)(R9*1), R8 CMPB (BX)(R9*1), R8 JNE match_nolit_end_encodeBlockAsm8B @@ -5397,7 +5421,7 @@ match_nolit_end_encodeBlockAsm8B: // emitCopy CMPL R9, $0x40 - JLE two_byte_offset_short_match_nolit_encodeBlockAsm8B + JBE two_byte_offset_short_match_nolit_encodeBlockAsm8B CMPL BX, $0x00000800 JAE long_offset_short_match_nolit_encodeBlockAsm8B MOVL $0x00000001, SI @@ -5416,13 +5440,13 @@ match_nolit_end_encodeBlockAsm8B: MOVL R9, BX LEAL -4(R9), R9 CMPL BX, $0x08 - JLE repeat_two_match_nolit_encodeBlockAsm8B_emit_copy_short_2b + JBE repeat_two_match_nolit_encodeBlockAsm8B_emit_copy_short_2b CMPL BX, $0x0c - JGE cant_repeat_two_offset_match_nolit_encodeBlockAsm8B_emit_copy_short_2b + JAE cant_repeat_two_offset_match_nolit_encodeBlockAsm8B_emit_copy_short_2b cant_repeat_two_offset_match_nolit_encodeBlockAsm8B_emit_copy_short_2b: CMPL R9, $0x00000104 - JLT repeat_three_match_nolit_encodeBlockAsm8B_emit_copy_short_2b + JB repeat_three_match_nolit_encodeBlockAsm8B_emit_copy_short_2b LEAL -256(R9), R9 MOVW $0x0019, (AX) MOVW R9, 2(AX) @@ -5462,13 +5486,13 @@ long_offset_short_match_nolit_encodeBlockAsm8B: MOVL R9, BX LEAL -4(R9), R9 CMPL BX, $0x08 - JLE repeat_two_match_nolit_encodeBlockAsm8B_emit_copy_short + JBE repeat_two_match_nolit_encodeBlockAsm8B_emit_copy_short CMPL BX, $0x0c - JGE cant_repeat_two_offset_match_nolit_encodeBlockAsm8B_emit_copy_short + JAE cant_repeat_two_offset_match_nolit_encodeBlockAsm8B_emit_copy_short cant_repeat_two_offset_match_nolit_encodeBlockAsm8B_emit_copy_short: CMPL R9, $0x00000104 - JLT repeat_three_match_nolit_encodeBlockAsm8B_emit_copy_short + JB repeat_three_match_nolit_encodeBlockAsm8B_emit_copy_short LEAL -256(R9), R9 MOVW $0x0019, (AX) MOVW R9, 2(AX) @@ -5502,7 +5526,7 @@ two_byte_offset_short_match_nolit_encodeBlockAsm8B: MOVL R9, SI SHLL $0x02, SI CMPL R9, $0x0c - JGE emit_copy_three_match_nolit_encodeBlockAsm8B + JAE emit_copy_three_match_nolit_encodeBlockAsm8B LEAL -15(SI), SI MOVB BL, 1(AX) SHRL $0x08, BX @@ -5520,10 +5544,10 @@ emit_copy_three_match_nolit_encodeBlockAsm8B: match_nolit_emitcopy_end_encodeBlockAsm8B: CMPL CX, 8(SP) - JGE emit_remainder_encodeBlockAsm8B + JAE emit_remainder_encodeBlockAsm8B MOVQ -2(DX)(CX*1), SI CMPQ AX, (SP) - JL match_nolit_dst_ok_encodeBlockAsm8B + JB match_nolit_dst_ok_encodeBlockAsm8B MOVQ $0x00000000, ret+48(FP) RET @@ -5553,7 +5577,7 @@ emit_remainder_encodeBlockAsm8B: SUBL 12(SP), CX LEAQ 3(AX)(CX*1), CX CMPQ CX, (SP) - JL emit_remainder_ok_encodeBlockAsm8B + JB emit_remainder_ok_encodeBlockAsm8B MOVQ $0x00000000, ret+48(FP) RET @@ -5568,9 +5592,12 @@ emit_remainder_ok_encodeBlockAsm8B: SUBL BX, SI LEAL -1(SI), DX CMPL DX, $0x3c - JLT one_byte_emit_remainder_encodeBlockAsm8B + JB one_byte_emit_remainder_encodeBlockAsm8B CMPL DX, $0x00000100 - JLT two_bytes_emit_remainder_encodeBlockAsm8B + JB two_bytes_emit_remainder_encodeBlockAsm8B + JB three_bytes_emit_remainder_encodeBlockAsm8B + +three_bytes_emit_remainder_encodeBlockAsm8B: MOVB $0xf4, (AX) MOVW DX, 1(AX) ADDQ $0x03, AX @@ -5581,7 +5608,7 @@ two_bytes_emit_remainder_encodeBlockAsm8B: MOVB DL, 1(AX) ADDQ $0x02, AX CMPL DX, $0x40 - JL memmove_emit_remainder_encodeBlockAsm8B + JB memmove_emit_remainder_encodeBlockAsm8B JMP memmove_long_emit_remainder_encodeBlockAsm8B one_byte_emit_remainder_encodeBlockAsm8B: @@ -5743,7 +5770,7 @@ search_loop_encodeBetterBlockAsm: SUBL 12(SP), BX SHRL $0x07, BX CMPL BX, $0x63 - JLE check_maxskip_ok_encodeBetterBlockAsm + JBE check_maxskip_ok_encodeBetterBlockAsm LEAL 100(CX), BX JMP check_maxskip_cont_encodeBetterBlockAsm @@ -5752,7 +5779,7 @@ check_maxskip_ok_encodeBetterBlockAsm: check_maxskip_cont_encodeBetterBlockAsm: CMPL BX, 8(SP) - JGE emit_remainder_encodeBetterBlockAsm + JAE emit_remainder_encodeBetterBlockAsm MOVQ (DX)(CX*1), SI MOVL BX, 20(SP) MOVQ $0x00cf1bbcdcbfa563, R8 @@ -5807,7 +5834,7 @@ candidate_match_encodeBetterBlockAsm: match_extend_back_loop_encodeBetterBlockAsm: CMPL CX, SI - JLE match_extend_back_end_encodeBetterBlockAsm + JBE match_extend_back_end_encodeBetterBlockAsm MOVB -1(DX)(BX*1), DI MOVB -1(DX)(CX*1), R8 CMPB DI, R8 @@ -5822,7 +5849,7 @@ match_extend_back_end_encodeBetterBlockAsm: SUBL 12(SP), SI LEAQ 5(AX)(SI*1), SI CMPQ SI, (SP) - JL match_dst_size_check_encodeBetterBlockAsm + JB match_dst_size_check_encodeBetterBlockAsm MOVQ $0x00000000, ret+48(FP) RET @@ -5838,7 +5865,7 @@ match_dst_size_check_encodeBetterBlockAsm: // matchLen XORL R11, R11 CMPL DI, $0x08 - JL matchlen_match4_match_nolit_encodeBetterBlockAsm + JB matchlen_match4_match_nolit_encodeBetterBlockAsm matchlen_loopback_match_nolit_encodeBetterBlockAsm: MOVQ (R8)(R11*1), R10 @@ -5861,12 +5888,12 @@ matchlen_loop_match_nolit_encodeBetterBlockAsm: LEAL -8(DI), DI LEAL 8(R11), R11 CMPL DI, $0x08 - JGE matchlen_loopback_match_nolit_encodeBetterBlockAsm + JAE matchlen_loopback_match_nolit_encodeBetterBlockAsm JZ match_nolit_end_encodeBetterBlockAsm matchlen_match4_match_nolit_encodeBetterBlockAsm: CMPL DI, $0x04 - JL matchlen_match2_match_nolit_encodeBetterBlockAsm + JB matchlen_match2_match_nolit_encodeBetterBlockAsm MOVL (R8)(R11*1), R10 CMPL (R9)(R11*1), R10 JNE matchlen_match2_match_nolit_encodeBetterBlockAsm @@ -5875,7 +5902,7 @@ matchlen_match4_match_nolit_encodeBetterBlockAsm: matchlen_match2_match_nolit_encodeBetterBlockAsm: CMPL DI, $0x02 - JL matchlen_match1_match_nolit_encodeBetterBlockAsm + JB matchlen_match1_match_nolit_encodeBetterBlockAsm MOVW (R8)(R11*1), R10 CMPW (R9)(R11*1), R10 JNE matchlen_match1_match_nolit_encodeBetterBlockAsm @@ -5884,7 +5911,7 @@ matchlen_match2_match_nolit_encodeBetterBlockAsm: matchlen_match1_match_nolit_encodeBetterBlockAsm: CMPL DI, $0x01 - JL match_nolit_end_encodeBetterBlockAsm + JB match_nolit_end_encodeBetterBlockAsm MOVB (R8)(R11*1), R10 CMPB (R9)(R11*1), R10 JNE match_nolit_end_encodeBetterBlockAsm @@ -5898,9 +5925,9 @@ match_nolit_end_encodeBetterBlockAsm: CMPL 16(SP), DI JEQ match_is_repeat_encodeBetterBlockAsm CMPL R11, $0x01 - JG match_length_ok_encodeBetterBlockAsm + JA match_length_ok_encodeBetterBlockAsm CMPL DI, $0x0000ffff - JLE match_length_ok_encodeBetterBlockAsm + JBE match_length_ok_encodeBetterBlockAsm MOVL 20(SP), CX INCL CX JMP search_loop_encodeBetterBlockAsm @@ -5916,13 +5943,13 @@ match_length_ok_encodeBetterBlockAsm: SUBL BX, R8 LEAL -1(R8), BX CMPL BX, $0x3c - JLT one_byte_match_emit_encodeBetterBlockAsm + JB one_byte_match_emit_encodeBetterBlockAsm CMPL BX, $0x00000100 - JLT two_bytes_match_emit_encodeBetterBlockAsm + JB two_bytes_match_emit_encodeBetterBlockAsm CMPL BX, $0x00010000 - JLT three_bytes_match_emit_encodeBetterBlockAsm + JB three_bytes_match_emit_encodeBetterBlockAsm CMPL BX, $0x01000000 - JLT four_bytes_match_emit_encodeBetterBlockAsm + JB four_bytes_match_emit_encodeBetterBlockAsm MOVB $0xfc, (AX) MOVL BX, 1(AX) ADDQ $0x05, AX @@ -5948,7 +5975,7 @@ two_bytes_match_emit_encodeBetterBlockAsm: MOVB BL, 1(AX) ADDQ $0x02, AX CMPL BX, $0x40 - JL memmove_match_emit_encodeBetterBlockAsm + JB memmove_match_emit_encodeBetterBlockAsm JMP memmove_long_match_emit_encodeBetterBlockAsm one_byte_match_emit_encodeBetterBlockAsm: @@ -5961,7 +5988,7 @@ memmove_match_emit_encodeBetterBlockAsm: // genMemMoveShort CMPQ R8, $0x04 - JLE emit_lit_memmove_match_emit_encodeBetterBlockAsm_memmove_move_4 + JBE emit_lit_memmove_match_emit_encodeBetterBlockAsm_memmove_move_4 CMPQ R8, $0x08 JB emit_lit_memmove_match_emit_encodeBetterBlockAsm_memmove_move_4through7 CMPQ R8, $0x10 @@ -6061,34 +6088,34 @@ emit_literal_done_match_emit_encodeBetterBlockAsm: // emitCopy CMPL DI, $0x00010000 - JL two_byte_offset_match_nolit_encodeBetterBlockAsm + JB two_byte_offset_match_nolit_encodeBetterBlockAsm CMPL R11, $0x40 - JLE four_bytes_remain_match_nolit_encodeBetterBlockAsm + JBE four_bytes_remain_match_nolit_encodeBetterBlockAsm MOVB $0xff, (AX) MOVL DI, 1(AX) LEAL -64(R11), R11 ADDQ $0x05, AX CMPL R11, $0x04 - JL four_bytes_remain_match_nolit_encodeBetterBlockAsm + JB four_bytes_remain_match_nolit_encodeBetterBlockAsm // emitRepeat emit_repeat_again_match_nolit_encodeBetterBlockAsm_emit_copy: MOVL R11, BX LEAL -4(R11), R11 CMPL BX, $0x08 - JLE repeat_two_match_nolit_encodeBetterBlockAsm_emit_copy + JBE repeat_two_match_nolit_encodeBetterBlockAsm_emit_copy CMPL BX, $0x0c - JGE cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm_emit_copy + JAE cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm_emit_copy CMPL DI, $0x00000800 - JLT repeat_two_offset_match_nolit_encodeBetterBlockAsm_emit_copy + JB repeat_two_offset_match_nolit_encodeBetterBlockAsm_emit_copy cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm_emit_copy: CMPL R11, $0x00000104 - JLT repeat_three_match_nolit_encodeBetterBlockAsm_emit_copy + JB repeat_three_match_nolit_encodeBetterBlockAsm_emit_copy CMPL R11, $0x00010100 - JLT repeat_four_match_nolit_encodeBetterBlockAsm_emit_copy + JB repeat_four_match_nolit_encodeBetterBlockAsm_emit_copy CMPL R11, $0x0100ffff - JLT repeat_five_match_nolit_encodeBetterBlockAsm_emit_copy + JB repeat_five_match_nolit_encodeBetterBlockAsm_emit_copy LEAL -16842747(R11), R11 MOVL $0xfffb001d, (AX) MOVB $0xff, 4(AX) @@ -6149,7 +6176,7 @@ four_bytes_remain_match_nolit_encodeBetterBlockAsm: two_byte_offset_match_nolit_encodeBetterBlockAsm: CMPL R11, $0x40 - JLE two_byte_offset_short_match_nolit_encodeBetterBlockAsm + JBE two_byte_offset_short_match_nolit_encodeBetterBlockAsm CMPL DI, $0x00000800 JAE long_offset_short_match_nolit_encodeBetterBlockAsm MOVL $0x00000001, BX @@ -6171,19 +6198,19 @@ emit_repeat_again_match_nolit_encodeBetterBlockAsm_emit_copy_short_2b: MOVL R11, BX LEAL -4(R11), R11 CMPL BX, $0x08 - JLE repeat_two_match_nolit_encodeBetterBlockAsm_emit_copy_short_2b + JBE repeat_two_match_nolit_encodeBetterBlockAsm_emit_copy_short_2b CMPL BX, $0x0c - JGE cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm_emit_copy_short_2b + JAE cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm_emit_copy_short_2b CMPL DI, $0x00000800 - JLT repeat_two_offset_match_nolit_encodeBetterBlockAsm_emit_copy_short_2b + JB repeat_two_offset_match_nolit_encodeBetterBlockAsm_emit_copy_short_2b cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm_emit_copy_short_2b: CMPL R11, $0x00000104 - JLT repeat_three_match_nolit_encodeBetterBlockAsm_emit_copy_short_2b + JB repeat_three_match_nolit_encodeBetterBlockAsm_emit_copy_short_2b CMPL R11, $0x00010100 - JLT repeat_four_match_nolit_encodeBetterBlockAsm_emit_copy_short_2b + JB repeat_four_match_nolit_encodeBetterBlockAsm_emit_copy_short_2b CMPL R11, $0x0100ffff - JLT repeat_five_match_nolit_encodeBetterBlockAsm_emit_copy_short_2b + JB repeat_five_match_nolit_encodeBetterBlockAsm_emit_copy_short_2b LEAL -16842747(R11), R11 MOVL $0xfffb001d, (AX) MOVB $0xff, 4(AX) @@ -6243,19 +6270,19 @@ emit_repeat_again_match_nolit_encodeBetterBlockAsm_emit_copy_short: MOVL R11, BX LEAL -4(R11), R11 CMPL BX, $0x08 - JLE repeat_two_match_nolit_encodeBetterBlockAsm_emit_copy_short + JBE repeat_two_match_nolit_encodeBetterBlockAsm_emit_copy_short CMPL BX, $0x0c - JGE cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm_emit_copy_short + JAE cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm_emit_copy_short CMPL DI, $0x00000800 - JLT repeat_two_offset_match_nolit_encodeBetterBlockAsm_emit_copy_short + JB repeat_two_offset_match_nolit_encodeBetterBlockAsm_emit_copy_short cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm_emit_copy_short: CMPL R11, $0x00000104 - JLT repeat_three_match_nolit_encodeBetterBlockAsm_emit_copy_short + JB repeat_three_match_nolit_encodeBetterBlockAsm_emit_copy_short CMPL R11, $0x00010100 - JLT repeat_four_match_nolit_encodeBetterBlockAsm_emit_copy_short + JB repeat_four_match_nolit_encodeBetterBlockAsm_emit_copy_short CMPL R11, $0x0100ffff - JLT repeat_five_match_nolit_encodeBetterBlockAsm_emit_copy_short + JB repeat_five_match_nolit_encodeBetterBlockAsm_emit_copy_short LEAL -16842747(R11), R11 MOVL $0xfffb001d, (AX) MOVB $0xff, 4(AX) @@ -6308,9 +6335,9 @@ two_byte_offset_short_match_nolit_encodeBetterBlockAsm: MOVL R11, BX SHLL $0x02, BX CMPL R11, $0x0c - JGE emit_copy_three_match_nolit_encodeBetterBlockAsm + JAE emit_copy_three_match_nolit_encodeBetterBlockAsm CMPL DI, $0x00000800 - JGE emit_copy_three_match_nolit_encodeBetterBlockAsm + JAE emit_copy_three_match_nolit_encodeBetterBlockAsm LEAL -15(BX), BX MOVB DI, 1(AX) SHRL $0x08, DI @@ -6337,13 +6364,13 @@ match_is_repeat_encodeBetterBlockAsm: SUBL BX, R8 LEAL -1(R8), BX CMPL BX, $0x3c - JLT one_byte_match_emit_repeat_encodeBetterBlockAsm + JB one_byte_match_emit_repeat_encodeBetterBlockAsm CMPL BX, $0x00000100 - JLT two_bytes_match_emit_repeat_encodeBetterBlockAsm + JB two_bytes_match_emit_repeat_encodeBetterBlockAsm CMPL BX, $0x00010000 - JLT three_bytes_match_emit_repeat_encodeBetterBlockAsm + JB three_bytes_match_emit_repeat_encodeBetterBlockAsm CMPL BX, $0x01000000 - JLT four_bytes_match_emit_repeat_encodeBetterBlockAsm + JB four_bytes_match_emit_repeat_encodeBetterBlockAsm MOVB $0xfc, (AX) MOVL BX, 1(AX) ADDQ $0x05, AX @@ -6369,7 +6396,7 @@ two_bytes_match_emit_repeat_encodeBetterBlockAsm: MOVB BL, 1(AX) ADDQ $0x02, AX CMPL BX, $0x40 - JL memmove_match_emit_repeat_encodeBetterBlockAsm + JB memmove_match_emit_repeat_encodeBetterBlockAsm JMP memmove_long_match_emit_repeat_encodeBetterBlockAsm one_byte_match_emit_repeat_encodeBetterBlockAsm: @@ -6382,7 +6409,7 @@ memmove_match_emit_repeat_encodeBetterBlockAsm: // genMemMoveShort CMPQ R8, $0x04 - JLE emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm_memmove_move_4 + JBE emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm_memmove_move_4 CMPQ R8, $0x08 JB emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm_memmove_move_4through7 CMPQ R8, $0x10 @@ -6485,19 +6512,19 @@ emit_repeat_again_match_nolit_repeat_encodeBetterBlockAsm: MOVL R11, BX LEAL -4(R11), R11 CMPL BX, $0x08 - JLE repeat_two_match_nolit_repeat_encodeBetterBlockAsm + JBE repeat_two_match_nolit_repeat_encodeBetterBlockAsm CMPL BX, $0x0c - JGE cant_repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm + JAE cant_repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm CMPL DI, $0x00000800 - JLT repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm + JB repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm cant_repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm: CMPL R11, $0x00000104 - JLT repeat_three_match_nolit_repeat_encodeBetterBlockAsm + JB repeat_three_match_nolit_repeat_encodeBetterBlockAsm CMPL R11, $0x00010100 - JLT repeat_four_match_nolit_repeat_encodeBetterBlockAsm + JB repeat_four_match_nolit_repeat_encodeBetterBlockAsm CMPL R11, $0x0100ffff - JLT repeat_five_match_nolit_repeat_encodeBetterBlockAsm + JB repeat_five_match_nolit_repeat_encodeBetterBlockAsm LEAL -16842747(R11), R11 MOVL $0xfffb001d, (AX) MOVB $0xff, 4(AX) @@ -6547,9 +6574,9 @@ repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm: match_nolit_emitcopy_end_encodeBetterBlockAsm: CMPL CX, 8(SP) - JGE emit_remainder_encodeBetterBlockAsm + JAE emit_remainder_encodeBetterBlockAsm CMPQ AX, (SP) - JL match_nolit_dst_ok_encodeBetterBlockAsm + JB match_nolit_dst_ok_encodeBetterBlockAsm MOVQ $0x00000000, ret+48(FP) RET @@ -6605,7 +6632,7 @@ emit_remainder_encodeBetterBlockAsm: SUBL 12(SP), CX LEAQ 5(AX)(CX*1), CX CMPQ CX, (SP) - JL emit_remainder_ok_encodeBetterBlockAsm + JB emit_remainder_ok_encodeBetterBlockAsm MOVQ $0x00000000, ret+48(FP) RET @@ -6620,13 +6647,13 @@ emit_remainder_ok_encodeBetterBlockAsm: SUBL BX, SI LEAL -1(SI), DX CMPL DX, $0x3c - JLT one_byte_emit_remainder_encodeBetterBlockAsm + JB one_byte_emit_remainder_encodeBetterBlockAsm CMPL DX, $0x00000100 - JLT two_bytes_emit_remainder_encodeBetterBlockAsm + JB two_bytes_emit_remainder_encodeBetterBlockAsm CMPL DX, $0x00010000 - JLT three_bytes_emit_remainder_encodeBetterBlockAsm + JB three_bytes_emit_remainder_encodeBetterBlockAsm CMPL DX, $0x01000000 - JLT four_bytes_emit_remainder_encodeBetterBlockAsm + JB four_bytes_emit_remainder_encodeBetterBlockAsm MOVB $0xfc, (AX) MOVL DX, 1(AX) ADDQ $0x05, AX @@ -6652,7 +6679,7 @@ two_bytes_emit_remainder_encodeBetterBlockAsm: MOVB DL, 1(AX) ADDQ $0x02, AX CMPL DX, $0x40 - JL memmove_emit_remainder_encodeBetterBlockAsm + JB memmove_emit_remainder_encodeBetterBlockAsm JMP memmove_long_emit_remainder_encodeBetterBlockAsm one_byte_emit_remainder_encodeBetterBlockAsm: @@ -6814,7 +6841,7 @@ search_loop_encodeBetterBlockAsm4MB: SUBL 12(SP), BX SHRL $0x07, BX CMPL BX, $0x63 - JLE check_maxskip_ok_encodeBetterBlockAsm4MB + JBE check_maxskip_ok_encodeBetterBlockAsm4MB LEAL 100(CX), BX JMP check_maxskip_cont_encodeBetterBlockAsm4MB @@ -6823,7 +6850,7 @@ check_maxskip_ok_encodeBetterBlockAsm4MB: check_maxskip_cont_encodeBetterBlockAsm4MB: CMPL BX, 8(SP) - JGE emit_remainder_encodeBetterBlockAsm4MB + JAE emit_remainder_encodeBetterBlockAsm4MB MOVQ (DX)(CX*1), SI MOVL BX, 20(SP) MOVQ $0x00cf1bbcdcbfa563, R8 @@ -6878,7 +6905,7 @@ candidate_match_encodeBetterBlockAsm4MB: match_extend_back_loop_encodeBetterBlockAsm4MB: CMPL CX, SI - JLE match_extend_back_end_encodeBetterBlockAsm4MB + JBE match_extend_back_end_encodeBetterBlockAsm4MB MOVB -1(DX)(BX*1), DI MOVB -1(DX)(CX*1), R8 CMPB DI, R8 @@ -6893,7 +6920,7 @@ match_extend_back_end_encodeBetterBlockAsm4MB: SUBL 12(SP), SI LEAQ 4(AX)(SI*1), SI CMPQ SI, (SP) - JL match_dst_size_check_encodeBetterBlockAsm4MB + JB match_dst_size_check_encodeBetterBlockAsm4MB MOVQ $0x00000000, ret+48(FP) RET @@ -6909,7 +6936,7 @@ match_dst_size_check_encodeBetterBlockAsm4MB: // matchLen XORL R11, R11 CMPL DI, $0x08 - JL matchlen_match4_match_nolit_encodeBetterBlockAsm4MB + JB matchlen_match4_match_nolit_encodeBetterBlockAsm4MB matchlen_loopback_match_nolit_encodeBetterBlockAsm4MB: MOVQ (R8)(R11*1), R10 @@ -6932,12 +6959,12 @@ matchlen_loop_match_nolit_encodeBetterBlockAsm4MB: LEAL -8(DI), DI LEAL 8(R11), R11 CMPL DI, $0x08 - JGE matchlen_loopback_match_nolit_encodeBetterBlockAsm4MB + JAE matchlen_loopback_match_nolit_encodeBetterBlockAsm4MB JZ match_nolit_end_encodeBetterBlockAsm4MB matchlen_match4_match_nolit_encodeBetterBlockAsm4MB: CMPL DI, $0x04 - JL matchlen_match2_match_nolit_encodeBetterBlockAsm4MB + JB matchlen_match2_match_nolit_encodeBetterBlockAsm4MB MOVL (R8)(R11*1), R10 CMPL (R9)(R11*1), R10 JNE matchlen_match2_match_nolit_encodeBetterBlockAsm4MB @@ -6946,7 +6973,7 @@ matchlen_match4_match_nolit_encodeBetterBlockAsm4MB: matchlen_match2_match_nolit_encodeBetterBlockAsm4MB: CMPL DI, $0x02 - JL matchlen_match1_match_nolit_encodeBetterBlockAsm4MB + JB matchlen_match1_match_nolit_encodeBetterBlockAsm4MB MOVW (R8)(R11*1), R10 CMPW (R9)(R11*1), R10 JNE matchlen_match1_match_nolit_encodeBetterBlockAsm4MB @@ -6955,7 +6982,7 @@ matchlen_match2_match_nolit_encodeBetterBlockAsm4MB: matchlen_match1_match_nolit_encodeBetterBlockAsm4MB: CMPL DI, $0x01 - JL match_nolit_end_encodeBetterBlockAsm4MB + JB match_nolit_end_encodeBetterBlockAsm4MB MOVB (R8)(R11*1), R10 CMPB (R9)(R11*1), R10 JNE match_nolit_end_encodeBetterBlockAsm4MB @@ -6969,9 +6996,9 @@ match_nolit_end_encodeBetterBlockAsm4MB: CMPL 16(SP), DI JEQ match_is_repeat_encodeBetterBlockAsm4MB CMPL R11, $0x01 - JG match_length_ok_encodeBetterBlockAsm4MB + JA match_length_ok_encodeBetterBlockAsm4MB CMPL DI, $0x0000ffff - JLE match_length_ok_encodeBetterBlockAsm4MB + JBE match_length_ok_encodeBetterBlockAsm4MB MOVL 20(SP), CX INCL CX JMP search_loop_encodeBetterBlockAsm4MB @@ -6987,11 +7014,11 @@ match_length_ok_encodeBetterBlockAsm4MB: SUBL BX, R8 LEAL -1(R8), BX CMPL BX, $0x3c - JLT one_byte_match_emit_encodeBetterBlockAsm4MB + JB one_byte_match_emit_encodeBetterBlockAsm4MB CMPL BX, $0x00000100 - JLT two_bytes_match_emit_encodeBetterBlockAsm4MB + JB two_bytes_match_emit_encodeBetterBlockAsm4MB CMPL BX, $0x00010000 - JLT three_bytes_match_emit_encodeBetterBlockAsm4MB + JB three_bytes_match_emit_encodeBetterBlockAsm4MB MOVL BX, R10 SHRL $0x10, R10 MOVB $0xf8, (AX) @@ -7011,7 +7038,7 @@ two_bytes_match_emit_encodeBetterBlockAsm4MB: MOVB BL, 1(AX) ADDQ $0x02, AX CMPL BX, $0x40 - JL memmove_match_emit_encodeBetterBlockAsm4MB + JB memmove_match_emit_encodeBetterBlockAsm4MB JMP memmove_long_match_emit_encodeBetterBlockAsm4MB one_byte_match_emit_encodeBetterBlockAsm4MB: @@ -7024,7 +7051,7 @@ memmove_match_emit_encodeBetterBlockAsm4MB: // genMemMoveShort CMPQ R8, $0x04 - JLE emit_lit_memmove_match_emit_encodeBetterBlockAsm4MB_memmove_move_4 + JBE emit_lit_memmove_match_emit_encodeBetterBlockAsm4MB_memmove_move_4 CMPQ R8, $0x08 JB emit_lit_memmove_match_emit_encodeBetterBlockAsm4MB_memmove_move_4through7 CMPQ R8, $0x10 @@ -7124,31 +7151,31 @@ emit_literal_done_match_emit_encodeBetterBlockAsm4MB: // emitCopy CMPL DI, $0x00010000 - JL two_byte_offset_match_nolit_encodeBetterBlockAsm4MB + JB two_byte_offset_match_nolit_encodeBetterBlockAsm4MB CMPL R11, $0x40 - JLE four_bytes_remain_match_nolit_encodeBetterBlockAsm4MB + JBE four_bytes_remain_match_nolit_encodeBetterBlockAsm4MB MOVB $0xff, (AX) MOVL DI, 1(AX) LEAL -64(R11), R11 ADDQ $0x05, AX CMPL R11, $0x04 - JL four_bytes_remain_match_nolit_encodeBetterBlockAsm4MB + JB four_bytes_remain_match_nolit_encodeBetterBlockAsm4MB // emitRepeat MOVL R11, BX LEAL -4(R11), R11 CMPL BX, $0x08 - JLE repeat_two_match_nolit_encodeBetterBlockAsm4MB_emit_copy + JBE repeat_two_match_nolit_encodeBetterBlockAsm4MB_emit_copy CMPL BX, $0x0c - JGE cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm4MB_emit_copy + JAE cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm4MB_emit_copy CMPL DI, $0x00000800 - JLT repeat_two_offset_match_nolit_encodeBetterBlockAsm4MB_emit_copy + JB repeat_two_offset_match_nolit_encodeBetterBlockAsm4MB_emit_copy cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm4MB_emit_copy: CMPL R11, $0x00000104 - JLT repeat_three_match_nolit_encodeBetterBlockAsm4MB_emit_copy + JB repeat_three_match_nolit_encodeBetterBlockAsm4MB_emit_copy CMPL R11, $0x00010100 - JLT repeat_four_match_nolit_encodeBetterBlockAsm4MB_emit_copy + JB repeat_four_match_nolit_encodeBetterBlockAsm4MB_emit_copy LEAL -65536(R11), R11 MOVL R11, DI MOVW $0x001d, (AX) @@ -7202,7 +7229,7 @@ four_bytes_remain_match_nolit_encodeBetterBlockAsm4MB: two_byte_offset_match_nolit_encodeBetterBlockAsm4MB: CMPL R11, $0x40 - JLE two_byte_offset_short_match_nolit_encodeBetterBlockAsm4MB + JBE two_byte_offset_short_match_nolit_encodeBetterBlockAsm4MB CMPL DI, $0x00000800 JAE long_offset_short_match_nolit_encodeBetterBlockAsm4MB MOVL $0x00000001, BX @@ -7221,17 +7248,17 @@ two_byte_offset_match_nolit_encodeBetterBlockAsm4MB: MOVL R11, BX LEAL -4(R11), R11 CMPL BX, $0x08 - JLE repeat_two_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short_2b + JBE repeat_two_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short_2b CMPL BX, $0x0c - JGE cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short_2b + JAE cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short_2b CMPL DI, $0x00000800 - JLT repeat_two_offset_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short_2b + JB repeat_two_offset_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short_2b cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short_2b: CMPL R11, $0x00000104 - JLT repeat_three_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short_2b + JB repeat_three_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short_2b CMPL R11, $0x00010100 - JLT repeat_four_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short_2b + JB repeat_four_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short_2b LEAL -65536(R11), R11 MOVL R11, DI MOVW $0x001d, (AX) @@ -7283,17 +7310,17 @@ long_offset_short_match_nolit_encodeBetterBlockAsm4MB: MOVL R11, BX LEAL -4(R11), R11 CMPL BX, $0x08 - JLE repeat_two_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short + JBE repeat_two_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short CMPL BX, $0x0c - JGE cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short + JAE cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short CMPL DI, $0x00000800 - JLT repeat_two_offset_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short + JB repeat_two_offset_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short: CMPL R11, $0x00000104 - JLT repeat_three_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short + JB repeat_three_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short CMPL R11, $0x00010100 - JLT repeat_four_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short + JB repeat_four_match_nolit_encodeBetterBlockAsm4MB_emit_copy_short LEAL -65536(R11), R11 MOVL R11, DI MOVW $0x001d, (AX) @@ -7339,9 +7366,9 @@ two_byte_offset_short_match_nolit_encodeBetterBlockAsm4MB: MOVL R11, BX SHLL $0x02, BX CMPL R11, $0x0c - JGE emit_copy_three_match_nolit_encodeBetterBlockAsm4MB + JAE emit_copy_three_match_nolit_encodeBetterBlockAsm4MB CMPL DI, $0x00000800 - JGE emit_copy_three_match_nolit_encodeBetterBlockAsm4MB + JAE emit_copy_three_match_nolit_encodeBetterBlockAsm4MB LEAL -15(BX), BX MOVB DI, 1(AX) SHRL $0x08, DI @@ -7368,11 +7395,11 @@ match_is_repeat_encodeBetterBlockAsm4MB: SUBL BX, R8 LEAL -1(R8), BX CMPL BX, $0x3c - JLT one_byte_match_emit_repeat_encodeBetterBlockAsm4MB + JB one_byte_match_emit_repeat_encodeBetterBlockAsm4MB CMPL BX, $0x00000100 - JLT two_bytes_match_emit_repeat_encodeBetterBlockAsm4MB + JB two_bytes_match_emit_repeat_encodeBetterBlockAsm4MB CMPL BX, $0x00010000 - JLT three_bytes_match_emit_repeat_encodeBetterBlockAsm4MB + JB three_bytes_match_emit_repeat_encodeBetterBlockAsm4MB MOVL BX, R10 SHRL $0x10, R10 MOVB $0xf8, (AX) @@ -7392,7 +7419,7 @@ two_bytes_match_emit_repeat_encodeBetterBlockAsm4MB: MOVB BL, 1(AX) ADDQ $0x02, AX CMPL BX, $0x40 - JL memmove_match_emit_repeat_encodeBetterBlockAsm4MB + JB memmove_match_emit_repeat_encodeBetterBlockAsm4MB JMP memmove_long_match_emit_repeat_encodeBetterBlockAsm4MB one_byte_match_emit_repeat_encodeBetterBlockAsm4MB: @@ -7405,7 +7432,7 @@ memmove_match_emit_repeat_encodeBetterBlockAsm4MB: // genMemMoveShort CMPQ R8, $0x04 - JLE emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm4MB_memmove_move_4 + JBE emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm4MB_memmove_move_4 CMPQ R8, $0x08 JB emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm4MB_memmove_move_4through7 CMPQ R8, $0x10 @@ -7507,17 +7534,17 @@ emit_literal_done_match_emit_repeat_encodeBetterBlockAsm4MB: MOVL R11, BX LEAL -4(R11), R11 CMPL BX, $0x08 - JLE repeat_two_match_nolit_repeat_encodeBetterBlockAsm4MB + JBE repeat_two_match_nolit_repeat_encodeBetterBlockAsm4MB CMPL BX, $0x0c - JGE cant_repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm4MB + JAE cant_repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm4MB CMPL DI, $0x00000800 - JLT repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm4MB + JB repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm4MB cant_repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm4MB: CMPL R11, $0x00000104 - JLT repeat_three_match_nolit_repeat_encodeBetterBlockAsm4MB + JB repeat_three_match_nolit_repeat_encodeBetterBlockAsm4MB CMPL R11, $0x00010100 - JLT repeat_four_match_nolit_repeat_encodeBetterBlockAsm4MB + JB repeat_four_match_nolit_repeat_encodeBetterBlockAsm4MB LEAL -65536(R11), R11 MOVL R11, DI MOVW $0x001d, (AX) @@ -7560,9 +7587,9 @@ repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm4MB: match_nolit_emitcopy_end_encodeBetterBlockAsm4MB: CMPL CX, 8(SP) - JGE emit_remainder_encodeBetterBlockAsm4MB + JAE emit_remainder_encodeBetterBlockAsm4MB CMPQ AX, (SP) - JL match_nolit_dst_ok_encodeBetterBlockAsm4MB + JB match_nolit_dst_ok_encodeBetterBlockAsm4MB MOVQ $0x00000000, ret+48(FP) RET @@ -7618,7 +7645,7 @@ emit_remainder_encodeBetterBlockAsm4MB: SUBL 12(SP), CX LEAQ 4(AX)(CX*1), CX CMPQ CX, (SP) - JL emit_remainder_ok_encodeBetterBlockAsm4MB + JB emit_remainder_ok_encodeBetterBlockAsm4MB MOVQ $0x00000000, ret+48(FP) RET @@ -7633,11 +7660,11 @@ emit_remainder_ok_encodeBetterBlockAsm4MB: SUBL BX, SI LEAL -1(SI), DX CMPL DX, $0x3c - JLT one_byte_emit_remainder_encodeBetterBlockAsm4MB + JB one_byte_emit_remainder_encodeBetterBlockAsm4MB CMPL DX, $0x00000100 - JLT two_bytes_emit_remainder_encodeBetterBlockAsm4MB + JB two_bytes_emit_remainder_encodeBetterBlockAsm4MB CMPL DX, $0x00010000 - JLT three_bytes_emit_remainder_encodeBetterBlockAsm4MB + JB three_bytes_emit_remainder_encodeBetterBlockAsm4MB MOVL DX, BX SHRL $0x10, BX MOVB $0xf8, (AX) @@ -7657,7 +7684,7 @@ two_bytes_emit_remainder_encodeBetterBlockAsm4MB: MOVB DL, 1(AX) ADDQ $0x02, AX CMPL DX, $0x40 - JL memmove_emit_remainder_encodeBetterBlockAsm4MB + JB memmove_emit_remainder_encodeBetterBlockAsm4MB JMP memmove_long_emit_remainder_encodeBetterBlockAsm4MB one_byte_emit_remainder_encodeBetterBlockAsm4MB: @@ -7820,7 +7847,7 @@ search_loop_encodeBetterBlockAsm12B: SHRL $0x06, BX LEAL 1(CX)(BX*1), BX CMPL BX, 8(SP) - JGE emit_remainder_encodeBetterBlockAsm12B + JAE emit_remainder_encodeBetterBlockAsm12B MOVQ (DX)(CX*1), SI MOVL BX, 20(SP) MOVQ $0x0000cf1bbcdcbf9b, R8 @@ -7875,7 +7902,7 @@ candidate_match_encodeBetterBlockAsm12B: match_extend_back_loop_encodeBetterBlockAsm12B: CMPL CX, SI - JLE match_extend_back_end_encodeBetterBlockAsm12B + JBE match_extend_back_end_encodeBetterBlockAsm12B MOVB -1(DX)(BX*1), DI MOVB -1(DX)(CX*1), R8 CMPB DI, R8 @@ -7890,7 +7917,7 @@ match_extend_back_end_encodeBetterBlockAsm12B: SUBL 12(SP), SI LEAQ 3(AX)(SI*1), SI CMPQ SI, (SP) - JL match_dst_size_check_encodeBetterBlockAsm12B + JB match_dst_size_check_encodeBetterBlockAsm12B MOVQ $0x00000000, ret+48(FP) RET @@ -7906,7 +7933,7 @@ match_dst_size_check_encodeBetterBlockAsm12B: // matchLen XORL R11, R11 CMPL DI, $0x08 - JL matchlen_match4_match_nolit_encodeBetterBlockAsm12B + JB matchlen_match4_match_nolit_encodeBetterBlockAsm12B matchlen_loopback_match_nolit_encodeBetterBlockAsm12B: MOVQ (R8)(R11*1), R10 @@ -7929,12 +7956,12 @@ matchlen_loop_match_nolit_encodeBetterBlockAsm12B: LEAL -8(DI), DI LEAL 8(R11), R11 CMPL DI, $0x08 - JGE matchlen_loopback_match_nolit_encodeBetterBlockAsm12B + JAE matchlen_loopback_match_nolit_encodeBetterBlockAsm12B JZ match_nolit_end_encodeBetterBlockAsm12B matchlen_match4_match_nolit_encodeBetterBlockAsm12B: CMPL DI, $0x04 - JL matchlen_match2_match_nolit_encodeBetterBlockAsm12B + JB matchlen_match2_match_nolit_encodeBetterBlockAsm12B MOVL (R8)(R11*1), R10 CMPL (R9)(R11*1), R10 JNE matchlen_match2_match_nolit_encodeBetterBlockAsm12B @@ -7943,7 +7970,7 @@ matchlen_match4_match_nolit_encodeBetterBlockAsm12B: matchlen_match2_match_nolit_encodeBetterBlockAsm12B: CMPL DI, $0x02 - JL matchlen_match1_match_nolit_encodeBetterBlockAsm12B + JB matchlen_match1_match_nolit_encodeBetterBlockAsm12B MOVW (R8)(R11*1), R10 CMPW (R9)(R11*1), R10 JNE matchlen_match1_match_nolit_encodeBetterBlockAsm12B @@ -7952,7 +7979,7 @@ matchlen_match2_match_nolit_encodeBetterBlockAsm12B: matchlen_match1_match_nolit_encodeBetterBlockAsm12B: CMPL DI, $0x01 - JL match_nolit_end_encodeBetterBlockAsm12B + JB match_nolit_end_encodeBetterBlockAsm12B MOVB (R8)(R11*1), R10 CMPB (R9)(R11*1), R10 JNE match_nolit_end_encodeBetterBlockAsm12B @@ -7975,9 +8002,12 @@ match_nolit_end_encodeBetterBlockAsm12B: SUBL BX, R8 LEAL -1(R8), BX CMPL BX, $0x3c - JLT one_byte_match_emit_encodeBetterBlockAsm12B + JB one_byte_match_emit_encodeBetterBlockAsm12B CMPL BX, $0x00000100 - JLT two_bytes_match_emit_encodeBetterBlockAsm12B + JB two_bytes_match_emit_encodeBetterBlockAsm12B + JB three_bytes_match_emit_encodeBetterBlockAsm12B + +three_bytes_match_emit_encodeBetterBlockAsm12B: MOVB $0xf4, (AX) MOVW BX, 1(AX) ADDQ $0x03, AX @@ -7988,7 +8018,7 @@ two_bytes_match_emit_encodeBetterBlockAsm12B: MOVB BL, 1(AX) ADDQ $0x02, AX CMPL BX, $0x40 - JL memmove_match_emit_encodeBetterBlockAsm12B + JB memmove_match_emit_encodeBetterBlockAsm12B JMP memmove_long_match_emit_encodeBetterBlockAsm12B one_byte_match_emit_encodeBetterBlockAsm12B: @@ -8001,7 +8031,7 @@ memmove_match_emit_encodeBetterBlockAsm12B: // genMemMoveShort CMPQ R8, $0x04 - JLE emit_lit_memmove_match_emit_encodeBetterBlockAsm12B_memmove_move_4 + JBE emit_lit_memmove_match_emit_encodeBetterBlockAsm12B_memmove_move_4 CMPQ R8, $0x08 JB emit_lit_memmove_match_emit_encodeBetterBlockAsm12B_memmove_move_4through7 CMPQ R8, $0x10 @@ -8101,7 +8131,7 @@ emit_literal_done_match_emit_encodeBetterBlockAsm12B: // emitCopy CMPL R11, $0x40 - JLE two_byte_offset_short_match_nolit_encodeBetterBlockAsm12B + JBE two_byte_offset_short_match_nolit_encodeBetterBlockAsm12B CMPL DI, $0x00000800 JAE long_offset_short_match_nolit_encodeBetterBlockAsm12B MOVL $0x00000001, BX @@ -8120,15 +8150,15 @@ emit_literal_done_match_emit_encodeBetterBlockAsm12B: MOVL R11, BX LEAL -4(R11), R11 CMPL BX, $0x08 - JLE repeat_two_match_nolit_encodeBetterBlockAsm12B_emit_copy_short_2b + JBE repeat_two_match_nolit_encodeBetterBlockAsm12B_emit_copy_short_2b CMPL BX, $0x0c - JGE cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm12B_emit_copy_short_2b + JAE cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm12B_emit_copy_short_2b CMPL DI, $0x00000800 - JLT repeat_two_offset_match_nolit_encodeBetterBlockAsm12B_emit_copy_short_2b + JB repeat_two_offset_match_nolit_encodeBetterBlockAsm12B_emit_copy_short_2b cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm12B_emit_copy_short_2b: CMPL R11, $0x00000104 - JLT repeat_three_match_nolit_encodeBetterBlockAsm12B_emit_copy_short_2b + JB repeat_three_match_nolit_encodeBetterBlockAsm12B_emit_copy_short_2b LEAL -256(R11), R11 MOVW $0x0019, (AX) MOVW R11, 2(AX) @@ -8170,15 +8200,15 @@ long_offset_short_match_nolit_encodeBetterBlockAsm12B: MOVL R11, BX LEAL -4(R11), R11 CMPL BX, $0x08 - JLE repeat_two_match_nolit_encodeBetterBlockAsm12B_emit_copy_short + JBE repeat_two_match_nolit_encodeBetterBlockAsm12B_emit_copy_short CMPL BX, $0x0c - JGE cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm12B_emit_copy_short + JAE cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm12B_emit_copy_short CMPL DI, $0x00000800 - JLT repeat_two_offset_match_nolit_encodeBetterBlockAsm12B_emit_copy_short + JB repeat_two_offset_match_nolit_encodeBetterBlockAsm12B_emit_copy_short cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm12B_emit_copy_short: CMPL R11, $0x00000104 - JLT repeat_three_match_nolit_encodeBetterBlockAsm12B_emit_copy_short + JB repeat_three_match_nolit_encodeBetterBlockAsm12B_emit_copy_short LEAL -256(R11), R11 MOVW $0x0019, (AX) MOVW R11, 2(AX) @@ -8214,9 +8244,9 @@ two_byte_offset_short_match_nolit_encodeBetterBlockAsm12B: MOVL R11, BX SHLL $0x02, BX CMPL R11, $0x0c - JGE emit_copy_three_match_nolit_encodeBetterBlockAsm12B + JAE emit_copy_three_match_nolit_encodeBetterBlockAsm12B CMPL DI, $0x00000800 - JGE emit_copy_three_match_nolit_encodeBetterBlockAsm12B + JAE emit_copy_three_match_nolit_encodeBetterBlockAsm12B LEAL -15(BX), BX MOVB DI, 1(AX) SHRL $0x08, DI @@ -8243,9 +8273,12 @@ match_is_repeat_encodeBetterBlockAsm12B: SUBL BX, R8 LEAL -1(R8), BX CMPL BX, $0x3c - JLT one_byte_match_emit_repeat_encodeBetterBlockAsm12B + JB one_byte_match_emit_repeat_encodeBetterBlockAsm12B CMPL BX, $0x00000100 - JLT two_bytes_match_emit_repeat_encodeBetterBlockAsm12B + JB two_bytes_match_emit_repeat_encodeBetterBlockAsm12B + JB three_bytes_match_emit_repeat_encodeBetterBlockAsm12B + +three_bytes_match_emit_repeat_encodeBetterBlockAsm12B: MOVB $0xf4, (AX) MOVW BX, 1(AX) ADDQ $0x03, AX @@ -8256,7 +8289,7 @@ two_bytes_match_emit_repeat_encodeBetterBlockAsm12B: MOVB BL, 1(AX) ADDQ $0x02, AX CMPL BX, $0x40 - JL memmove_match_emit_repeat_encodeBetterBlockAsm12B + JB memmove_match_emit_repeat_encodeBetterBlockAsm12B JMP memmove_long_match_emit_repeat_encodeBetterBlockAsm12B one_byte_match_emit_repeat_encodeBetterBlockAsm12B: @@ -8269,7 +8302,7 @@ memmove_match_emit_repeat_encodeBetterBlockAsm12B: // genMemMoveShort CMPQ R8, $0x04 - JLE emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm12B_memmove_move_4 + JBE emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm12B_memmove_move_4 CMPQ R8, $0x08 JB emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm12B_memmove_move_4through7 CMPQ R8, $0x10 @@ -8371,15 +8404,15 @@ emit_literal_done_match_emit_repeat_encodeBetterBlockAsm12B: MOVL R11, BX LEAL -4(R11), R11 CMPL BX, $0x08 - JLE repeat_two_match_nolit_repeat_encodeBetterBlockAsm12B + JBE repeat_two_match_nolit_repeat_encodeBetterBlockAsm12B CMPL BX, $0x0c - JGE cant_repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm12B + JAE cant_repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm12B CMPL DI, $0x00000800 - JLT repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm12B + JB repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm12B cant_repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm12B: CMPL R11, $0x00000104 - JLT repeat_three_match_nolit_repeat_encodeBetterBlockAsm12B + JB repeat_three_match_nolit_repeat_encodeBetterBlockAsm12B LEAL -256(R11), R11 MOVW $0x0019, (AX) MOVW R11, 2(AX) @@ -8412,9 +8445,9 @@ repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm12B: match_nolit_emitcopy_end_encodeBetterBlockAsm12B: CMPL CX, 8(SP) - JGE emit_remainder_encodeBetterBlockAsm12B + JAE emit_remainder_encodeBetterBlockAsm12B CMPQ AX, (SP) - JL match_nolit_dst_ok_encodeBetterBlockAsm12B + JB match_nolit_dst_ok_encodeBetterBlockAsm12B MOVQ $0x00000000, ret+48(FP) RET @@ -8470,7 +8503,7 @@ emit_remainder_encodeBetterBlockAsm12B: SUBL 12(SP), CX LEAQ 3(AX)(CX*1), CX CMPQ CX, (SP) - JL emit_remainder_ok_encodeBetterBlockAsm12B + JB emit_remainder_ok_encodeBetterBlockAsm12B MOVQ $0x00000000, ret+48(FP) RET @@ -8485,9 +8518,12 @@ emit_remainder_ok_encodeBetterBlockAsm12B: SUBL BX, SI LEAL -1(SI), DX CMPL DX, $0x3c - JLT one_byte_emit_remainder_encodeBetterBlockAsm12B + JB one_byte_emit_remainder_encodeBetterBlockAsm12B CMPL DX, $0x00000100 - JLT two_bytes_emit_remainder_encodeBetterBlockAsm12B + JB two_bytes_emit_remainder_encodeBetterBlockAsm12B + JB three_bytes_emit_remainder_encodeBetterBlockAsm12B + +three_bytes_emit_remainder_encodeBetterBlockAsm12B: MOVB $0xf4, (AX) MOVW DX, 1(AX) ADDQ $0x03, AX @@ -8498,7 +8534,7 @@ two_bytes_emit_remainder_encodeBetterBlockAsm12B: MOVB DL, 1(AX) ADDQ $0x02, AX CMPL DX, $0x40 - JL memmove_emit_remainder_encodeBetterBlockAsm12B + JB memmove_emit_remainder_encodeBetterBlockAsm12B JMP memmove_long_emit_remainder_encodeBetterBlockAsm12B one_byte_emit_remainder_encodeBetterBlockAsm12B: @@ -8661,7 +8697,7 @@ search_loop_encodeBetterBlockAsm10B: SHRL $0x05, BX LEAL 1(CX)(BX*1), BX CMPL BX, 8(SP) - JGE emit_remainder_encodeBetterBlockAsm10B + JAE emit_remainder_encodeBetterBlockAsm10B MOVQ (DX)(CX*1), SI MOVL BX, 20(SP) MOVQ $0x0000cf1bbcdcbf9b, R8 @@ -8716,7 +8752,7 @@ candidate_match_encodeBetterBlockAsm10B: match_extend_back_loop_encodeBetterBlockAsm10B: CMPL CX, SI - JLE match_extend_back_end_encodeBetterBlockAsm10B + JBE match_extend_back_end_encodeBetterBlockAsm10B MOVB -1(DX)(BX*1), DI MOVB -1(DX)(CX*1), R8 CMPB DI, R8 @@ -8731,7 +8767,7 @@ match_extend_back_end_encodeBetterBlockAsm10B: SUBL 12(SP), SI LEAQ 3(AX)(SI*1), SI CMPQ SI, (SP) - JL match_dst_size_check_encodeBetterBlockAsm10B + JB match_dst_size_check_encodeBetterBlockAsm10B MOVQ $0x00000000, ret+48(FP) RET @@ -8747,7 +8783,7 @@ match_dst_size_check_encodeBetterBlockAsm10B: // matchLen XORL R11, R11 CMPL DI, $0x08 - JL matchlen_match4_match_nolit_encodeBetterBlockAsm10B + JB matchlen_match4_match_nolit_encodeBetterBlockAsm10B matchlen_loopback_match_nolit_encodeBetterBlockAsm10B: MOVQ (R8)(R11*1), R10 @@ -8770,12 +8806,12 @@ matchlen_loop_match_nolit_encodeBetterBlockAsm10B: LEAL -8(DI), DI LEAL 8(R11), R11 CMPL DI, $0x08 - JGE matchlen_loopback_match_nolit_encodeBetterBlockAsm10B + JAE matchlen_loopback_match_nolit_encodeBetterBlockAsm10B JZ match_nolit_end_encodeBetterBlockAsm10B matchlen_match4_match_nolit_encodeBetterBlockAsm10B: CMPL DI, $0x04 - JL matchlen_match2_match_nolit_encodeBetterBlockAsm10B + JB matchlen_match2_match_nolit_encodeBetterBlockAsm10B MOVL (R8)(R11*1), R10 CMPL (R9)(R11*1), R10 JNE matchlen_match2_match_nolit_encodeBetterBlockAsm10B @@ -8784,7 +8820,7 @@ matchlen_match4_match_nolit_encodeBetterBlockAsm10B: matchlen_match2_match_nolit_encodeBetterBlockAsm10B: CMPL DI, $0x02 - JL matchlen_match1_match_nolit_encodeBetterBlockAsm10B + JB matchlen_match1_match_nolit_encodeBetterBlockAsm10B MOVW (R8)(R11*1), R10 CMPW (R9)(R11*1), R10 JNE matchlen_match1_match_nolit_encodeBetterBlockAsm10B @@ -8793,7 +8829,7 @@ matchlen_match2_match_nolit_encodeBetterBlockAsm10B: matchlen_match1_match_nolit_encodeBetterBlockAsm10B: CMPL DI, $0x01 - JL match_nolit_end_encodeBetterBlockAsm10B + JB match_nolit_end_encodeBetterBlockAsm10B MOVB (R8)(R11*1), R10 CMPB (R9)(R11*1), R10 JNE match_nolit_end_encodeBetterBlockAsm10B @@ -8816,9 +8852,12 @@ match_nolit_end_encodeBetterBlockAsm10B: SUBL BX, R8 LEAL -1(R8), BX CMPL BX, $0x3c - JLT one_byte_match_emit_encodeBetterBlockAsm10B + JB one_byte_match_emit_encodeBetterBlockAsm10B CMPL BX, $0x00000100 - JLT two_bytes_match_emit_encodeBetterBlockAsm10B + JB two_bytes_match_emit_encodeBetterBlockAsm10B + JB three_bytes_match_emit_encodeBetterBlockAsm10B + +three_bytes_match_emit_encodeBetterBlockAsm10B: MOVB $0xf4, (AX) MOVW BX, 1(AX) ADDQ $0x03, AX @@ -8829,7 +8868,7 @@ two_bytes_match_emit_encodeBetterBlockAsm10B: MOVB BL, 1(AX) ADDQ $0x02, AX CMPL BX, $0x40 - JL memmove_match_emit_encodeBetterBlockAsm10B + JB memmove_match_emit_encodeBetterBlockAsm10B JMP memmove_long_match_emit_encodeBetterBlockAsm10B one_byte_match_emit_encodeBetterBlockAsm10B: @@ -8842,7 +8881,7 @@ memmove_match_emit_encodeBetterBlockAsm10B: // genMemMoveShort CMPQ R8, $0x04 - JLE emit_lit_memmove_match_emit_encodeBetterBlockAsm10B_memmove_move_4 + JBE emit_lit_memmove_match_emit_encodeBetterBlockAsm10B_memmove_move_4 CMPQ R8, $0x08 JB emit_lit_memmove_match_emit_encodeBetterBlockAsm10B_memmove_move_4through7 CMPQ R8, $0x10 @@ -8942,7 +8981,7 @@ emit_literal_done_match_emit_encodeBetterBlockAsm10B: // emitCopy CMPL R11, $0x40 - JLE two_byte_offset_short_match_nolit_encodeBetterBlockAsm10B + JBE two_byte_offset_short_match_nolit_encodeBetterBlockAsm10B CMPL DI, $0x00000800 JAE long_offset_short_match_nolit_encodeBetterBlockAsm10B MOVL $0x00000001, BX @@ -8961,15 +9000,15 @@ emit_literal_done_match_emit_encodeBetterBlockAsm10B: MOVL R11, BX LEAL -4(R11), R11 CMPL BX, $0x08 - JLE repeat_two_match_nolit_encodeBetterBlockAsm10B_emit_copy_short_2b + JBE repeat_two_match_nolit_encodeBetterBlockAsm10B_emit_copy_short_2b CMPL BX, $0x0c - JGE cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm10B_emit_copy_short_2b + JAE cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm10B_emit_copy_short_2b CMPL DI, $0x00000800 - JLT repeat_two_offset_match_nolit_encodeBetterBlockAsm10B_emit_copy_short_2b + JB repeat_two_offset_match_nolit_encodeBetterBlockAsm10B_emit_copy_short_2b cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm10B_emit_copy_short_2b: CMPL R11, $0x00000104 - JLT repeat_three_match_nolit_encodeBetterBlockAsm10B_emit_copy_short_2b + JB repeat_three_match_nolit_encodeBetterBlockAsm10B_emit_copy_short_2b LEAL -256(R11), R11 MOVW $0x0019, (AX) MOVW R11, 2(AX) @@ -9011,15 +9050,15 @@ long_offset_short_match_nolit_encodeBetterBlockAsm10B: MOVL R11, BX LEAL -4(R11), R11 CMPL BX, $0x08 - JLE repeat_two_match_nolit_encodeBetterBlockAsm10B_emit_copy_short + JBE repeat_two_match_nolit_encodeBetterBlockAsm10B_emit_copy_short CMPL BX, $0x0c - JGE cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm10B_emit_copy_short + JAE cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm10B_emit_copy_short CMPL DI, $0x00000800 - JLT repeat_two_offset_match_nolit_encodeBetterBlockAsm10B_emit_copy_short + JB repeat_two_offset_match_nolit_encodeBetterBlockAsm10B_emit_copy_short cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm10B_emit_copy_short: CMPL R11, $0x00000104 - JLT repeat_three_match_nolit_encodeBetterBlockAsm10B_emit_copy_short + JB repeat_three_match_nolit_encodeBetterBlockAsm10B_emit_copy_short LEAL -256(R11), R11 MOVW $0x0019, (AX) MOVW R11, 2(AX) @@ -9055,9 +9094,9 @@ two_byte_offset_short_match_nolit_encodeBetterBlockAsm10B: MOVL R11, BX SHLL $0x02, BX CMPL R11, $0x0c - JGE emit_copy_three_match_nolit_encodeBetterBlockAsm10B + JAE emit_copy_three_match_nolit_encodeBetterBlockAsm10B CMPL DI, $0x00000800 - JGE emit_copy_three_match_nolit_encodeBetterBlockAsm10B + JAE emit_copy_three_match_nolit_encodeBetterBlockAsm10B LEAL -15(BX), BX MOVB DI, 1(AX) SHRL $0x08, DI @@ -9084,9 +9123,12 @@ match_is_repeat_encodeBetterBlockAsm10B: SUBL BX, R8 LEAL -1(R8), BX CMPL BX, $0x3c - JLT one_byte_match_emit_repeat_encodeBetterBlockAsm10B + JB one_byte_match_emit_repeat_encodeBetterBlockAsm10B CMPL BX, $0x00000100 - JLT two_bytes_match_emit_repeat_encodeBetterBlockAsm10B + JB two_bytes_match_emit_repeat_encodeBetterBlockAsm10B + JB three_bytes_match_emit_repeat_encodeBetterBlockAsm10B + +three_bytes_match_emit_repeat_encodeBetterBlockAsm10B: MOVB $0xf4, (AX) MOVW BX, 1(AX) ADDQ $0x03, AX @@ -9097,7 +9139,7 @@ two_bytes_match_emit_repeat_encodeBetterBlockAsm10B: MOVB BL, 1(AX) ADDQ $0x02, AX CMPL BX, $0x40 - JL memmove_match_emit_repeat_encodeBetterBlockAsm10B + JB memmove_match_emit_repeat_encodeBetterBlockAsm10B JMP memmove_long_match_emit_repeat_encodeBetterBlockAsm10B one_byte_match_emit_repeat_encodeBetterBlockAsm10B: @@ -9110,7 +9152,7 @@ memmove_match_emit_repeat_encodeBetterBlockAsm10B: // genMemMoveShort CMPQ R8, $0x04 - JLE emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm10B_memmove_move_4 + JBE emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm10B_memmove_move_4 CMPQ R8, $0x08 JB emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm10B_memmove_move_4through7 CMPQ R8, $0x10 @@ -9212,15 +9254,15 @@ emit_literal_done_match_emit_repeat_encodeBetterBlockAsm10B: MOVL R11, BX LEAL -4(R11), R11 CMPL BX, $0x08 - JLE repeat_two_match_nolit_repeat_encodeBetterBlockAsm10B + JBE repeat_two_match_nolit_repeat_encodeBetterBlockAsm10B CMPL BX, $0x0c - JGE cant_repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm10B + JAE cant_repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm10B CMPL DI, $0x00000800 - JLT repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm10B + JB repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm10B cant_repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm10B: CMPL R11, $0x00000104 - JLT repeat_three_match_nolit_repeat_encodeBetterBlockAsm10B + JB repeat_three_match_nolit_repeat_encodeBetterBlockAsm10B LEAL -256(R11), R11 MOVW $0x0019, (AX) MOVW R11, 2(AX) @@ -9253,9 +9295,9 @@ repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm10B: match_nolit_emitcopy_end_encodeBetterBlockAsm10B: CMPL CX, 8(SP) - JGE emit_remainder_encodeBetterBlockAsm10B + JAE emit_remainder_encodeBetterBlockAsm10B CMPQ AX, (SP) - JL match_nolit_dst_ok_encodeBetterBlockAsm10B + JB match_nolit_dst_ok_encodeBetterBlockAsm10B MOVQ $0x00000000, ret+48(FP) RET @@ -9311,7 +9353,7 @@ emit_remainder_encodeBetterBlockAsm10B: SUBL 12(SP), CX LEAQ 3(AX)(CX*1), CX CMPQ CX, (SP) - JL emit_remainder_ok_encodeBetterBlockAsm10B + JB emit_remainder_ok_encodeBetterBlockAsm10B MOVQ $0x00000000, ret+48(FP) RET @@ -9326,9 +9368,12 @@ emit_remainder_ok_encodeBetterBlockAsm10B: SUBL BX, SI LEAL -1(SI), DX CMPL DX, $0x3c - JLT one_byte_emit_remainder_encodeBetterBlockAsm10B + JB one_byte_emit_remainder_encodeBetterBlockAsm10B CMPL DX, $0x00000100 - JLT two_bytes_emit_remainder_encodeBetterBlockAsm10B + JB two_bytes_emit_remainder_encodeBetterBlockAsm10B + JB three_bytes_emit_remainder_encodeBetterBlockAsm10B + +three_bytes_emit_remainder_encodeBetterBlockAsm10B: MOVB $0xf4, (AX) MOVW DX, 1(AX) ADDQ $0x03, AX @@ -9339,7 +9384,7 @@ two_bytes_emit_remainder_encodeBetterBlockAsm10B: MOVB DL, 1(AX) ADDQ $0x02, AX CMPL DX, $0x40 - JL memmove_emit_remainder_encodeBetterBlockAsm10B + JB memmove_emit_remainder_encodeBetterBlockAsm10B JMP memmove_long_emit_remainder_encodeBetterBlockAsm10B one_byte_emit_remainder_encodeBetterBlockAsm10B: @@ -9502,7 +9547,7 @@ search_loop_encodeBetterBlockAsm8B: SHRL $0x04, BX LEAL 1(CX)(BX*1), BX CMPL BX, 8(SP) - JGE emit_remainder_encodeBetterBlockAsm8B + JAE emit_remainder_encodeBetterBlockAsm8B MOVQ (DX)(CX*1), SI MOVL BX, 20(SP) MOVQ $0x0000cf1bbcdcbf9b, R8 @@ -9557,7 +9602,7 @@ candidate_match_encodeBetterBlockAsm8B: match_extend_back_loop_encodeBetterBlockAsm8B: CMPL CX, SI - JLE match_extend_back_end_encodeBetterBlockAsm8B + JBE match_extend_back_end_encodeBetterBlockAsm8B MOVB -1(DX)(BX*1), DI MOVB -1(DX)(CX*1), R8 CMPB DI, R8 @@ -9572,7 +9617,7 @@ match_extend_back_end_encodeBetterBlockAsm8B: SUBL 12(SP), SI LEAQ 3(AX)(SI*1), SI CMPQ SI, (SP) - JL match_dst_size_check_encodeBetterBlockAsm8B + JB match_dst_size_check_encodeBetterBlockAsm8B MOVQ $0x00000000, ret+48(FP) RET @@ -9588,7 +9633,7 @@ match_dst_size_check_encodeBetterBlockAsm8B: // matchLen XORL R11, R11 CMPL DI, $0x08 - JL matchlen_match4_match_nolit_encodeBetterBlockAsm8B + JB matchlen_match4_match_nolit_encodeBetterBlockAsm8B matchlen_loopback_match_nolit_encodeBetterBlockAsm8B: MOVQ (R8)(R11*1), R10 @@ -9611,12 +9656,12 @@ matchlen_loop_match_nolit_encodeBetterBlockAsm8B: LEAL -8(DI), DI LEAL 8(R11), R11 CMPL DI, $0x08 - JGE matchlen_loopback_match_nolit_encodeBetterBlockAsm8B + JAE matchlen_loopback_match_nolit_encodeBetterBlockAsm8B JZ match_nolit_end_encodeBetterBlockAsm8B matchlen_match4_match_nolit_encodeBetterBlockAsm8B: CMPL DI, $0x04 - JL matchlen_match2_match_nolit_encodeBetterBlockAsm8B + JB matchlen_match2_match_nolit_encodeBetterBlockAsm8B MOVL (R8)(R11*1), R10 CMPL (R9)(R11*1), R10 JNE matchlen_match2_match_nolit_encodeBetterBlockAsm8B @@ -9625,7 +9670,7 @@ matchlen_match4_match_nolit_encodeBetterBlockAsm8B: matchlen_match2_match_nolit_encodeBetterBlockAsm8B: CMPL DI, $0x02 - JL matchlen_match1_match_nolit_encodeBetterBlockAsm8B + JB matchlen_match1_match_nolit_encodeBetterBlockAsm8B MOVW (R8)(R11*1), R10 CMPW (R9)(R11*1), R10 JNE matchlen_match1_match_nolit_encodeBetterBlockAsm8B @@ -9634,7 +9679,7 @@ matchlen_match2_match_nolit_encodeBetterBlockAsm8B: matchlen_match1_match_nolit_encodeBetterBlockAsm8B: CMPL DI, $0x01 - JL match_nolit_end_encodeBetterBlockAsm8B + JB match_nolit_end_encodeBetterBlockAsm8B MOVB (R8)(R11*1), R10 CMPB (R9)(R11*1), R10 JNE match_nolit_end_encodeBetterBlockAsm8B @@ -9657,9 +9702,12 @@ match_nolit_end_encodeBetterBlockAsm8B: SUBL BX, R8 LEAL -1(R8), BX CMPL BX, $0x3c - JLT one_byte_match_emit_encodeBetterBlockAsm8B + JB one_byte_match_emit_encodeBetterBlockAsm8B CMPL BX, $0x00000100 - JLT two_bytes_match_emit_encodeBetterBlockAsm8B + JB two_bytes_match_emit_encodeBetterBlockAsm8B + JB three_bytes_match_emit_encodeBetterBlockAsm8B + +three_bytes_match_emit_encodeBetterBlockAsm8B: MOVB $0xf4, (AX) MOVW BX, 1(AX) ADDQ $0x03, AX @@ -9670,7 +9718,7 @@ two_bytes_match_emit_encodeBetterBlockAsm8B: MOVB BL, 1(AX) ADDQ $0x02, AX CMPL BX, $0x40 - JL memmove_match_emit_encodeBetterBlockAsm8B + JB memmove_match_emit_encodeBetterBlockAsm8B JMP memmove_long_match_emit_encodeBetterBlockAsm8B one_byte_match_emit_encodeBetterBlockAsm8B: @@ -9683,7 +9731,7 @@ memmove_match_emit_encodeBetterBlockAsm8B: // genMemMoveShort CMPQ R8, $0x04 - JLE emit_lit_memmove_match_emit_encodeBetterBlockAsm8B_memmove_move_4 + JBE emit_lit_memmove_match_emit_encodeBetterBlockAsm8B_memmove_move_4 CMPQ R8, $0x08 JB emit_lit_memmove_match_emit_encodeBetterBlockAsm8B_memmove_move_4through7 CMPQ R8, $0x10 @@ -9783,7 +9831,7 @@ emit_literal_done_match_emit_encodeBetterBlockAsm8B: // emitCopy CMPL R11, $0x40 - JLE two_byte_offset_short_match_nolit_encodeBetterBlockAsm8B + JBE two_byte_offset_short_match_nolit_encodeBetterBlockAsm8B CMPL DI, $0x00000800 JAE long_offset_short_match_nolit_encodeBetterBlockAsm8B MOVL $0x00000001, BX @@ -9802,13 +9850,13 @@ emit_literal_done_match_emit_encodeBetterBlockAsm8B: MOVL R11, BX LEAL -4(R11), R11 CMPL BX, $0x08 - JLE repeat_two_match_nolit_encodeBetterBlockAsm8B_emit_copy_short_2b + JBE repeat_two_match_nolit_encodeBetterBlockAsm8B_emit_copy_short_2b CMPL BX, $0x0c - JGE cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm8B_emit_copy_short_2b + JAE cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm8B_emit_copy_short_2b cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm8B_emit_copy_short_2b: CMPL R11, $0x00000104 - JLT repeat_three_match_nolit_encodeBetterBlockAsm8B_emit_copy_short_2b + JB repeat_three_match_nolit_encodeBetterBlockAsm8B_emit_copy_short_2b LEAL -256(R11), R11 MOVW $0x0019, (AX) MOVW R11, 2(AX) @@ -9848,13 +9896,13 @@ long_offset_short_match_nolit_encodeBetterBlockAsm8B: MOVL R11, BX LEAL -4(R11), R11 CMPL BX, $0x08 - JLE repeat_two_match_nolit_encodeBetterBlockAsm8B_emit_copy_short + JBE repeat_two_match_nolit_encodeBetterBlockAsm8B_emit_copy_short CMPL BX, $0x0c - JGE cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm8B_emit_copy_short + JAE cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm8B_emit_copy_short cant_repeat_two_offset_match_nolit_encodeBetterBlockAsm8B_emit_copy_short: CMPL R11, $0x00000104 - JLT repeat_three_match_nolit_encodeBetterBlockAsm8B_emit_copy_short + JB repeat_three_match_nolit_encodeBetterBlockAsm8B_emit_copy_short LEAL -256(R11), R11 MOVW $0x0019, (AX) MOVW R11, 2(AX) @@ -9888,7 +9936,7 @@ two_byte_offset_short_match_nolit_encodeBetterBlockAsm8B: MOVL R11, BX SHLL $0x02, BX CMPL R11, $0x0c - JGE emit_copy_three_match_nolit_encodeBetterBlockAsm8B + JAE emit_copy_three_match_nolit_encodeBetterBlockAsm8B LEAL -15(BX), BX MOVB DI, 1(AX) SHRL $0x08, DI @@ -9915,9 +9963,12 @@ match_is_repeat_encodeBetterBlockAsm8B: SUBL BX, DI LEAL -1(DI), BX CMPL BX, $0x3c - JLT one_byte_match_emit_repeat_encodeBetterBlockAsm8B + JB one_byte_match_emit_repeat_encodeBetterBlockAsm8B CMPL BX, $0x00000100 - JLT two_bytes_match_emit_repeat_encodeBetterBlockAsm8B + JB two_bytes_match_emit_repeat_encodeBetterBlockAsm8B + JB three_bytes_match_emit_repeat_encodeBetterBlockAsm8B + +three_bytes_match_emit_repeat_encodeBetterBlockAsm8B: MOVB $0xf4, (AX) MOVW BX, 1(AX) ADDQ $0x03, AX @@ -9928,7 +9979,7 @@ two_bytes_match_emit_repeat_encodeBetterBlockAsm8B: MOVB BL, 1(AX) ADDQ $0x02, AX CMPL BX, $0x40 - JL memmove_match_emit_repeat_encodeBetterBlockAsm8B + JB memmove_match_emit_repeat_encodeBetterBlockAsm8B JMP memmove_long_match_emit_repeat_encodeBetterBlockAsm8B one_byte_match_emit_repeat_encodeBetterBlockAsm8B: @@ -9941,7 +9992,7 @@ memmove_match_emit_repeat_encodeBetterBlockAsm8B: // genMemMoveShort CMPQ DI, $0x04 - JLE emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm8B_memmove_move_4 + JBE emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm8B_memmove_move_4 CMPQ DI, $0x08 JB emit_lit_memmove_match_emit_repeat_encodeBetterBlockAsm8B_memmove_move_4through7 CMPQ DI, $0x10 @@ -10043,13 +10094,13 @@ emit_literal_done_match_emit_repeat_encodeBetterBlockAsm8B: MOVL R11, BX LEAL -4(R11), R11 CMPL BX, $0x08 - JLE repeat_two_match_nolit_repeat_encodeBetterBlockAsm8B + JBE repeat_two_match_nolit_repeat_encodeBetterBlockAsm8B CMPL BX, $0x0c - JGE cant_repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm8B + JAE cant_repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm8B cant_repeat_two_offset_match_nolit_repeat_encodeBetterBlockAsm8B: CMPL R11, $0x00000104 - JLT repeat_three_match_nolit_repeat_encodeBetterBlockAsm8B + JB repeat_three_match_nolit_repeat_encodeBetterBlockAsm8B LEAL -256(R11), R11 MOVW $0x0019, (AX) MOVW R11, 2(AX) @@ -10080,9 +10131,9 @@ repeat_two_match_nolit_repeat_encodeBetterBlockAsm8B: match_nolit_emitcopy_end_encodeBetterBlockAsm8B: CMPL CX, 8(SP) - JGE emit_remainder_encodeBetterBlockAsm8B + JAE emit_remainder_encodeBetterBlockAsm8B CMPQ AX, (SP) - JL match_nolit_dst_ok_encodeBetterBlockAsm8B + JB match_nolit_dst_ok_encodeBetterBlockAsm8B MOVQ $0x00000000, ret+48(FP) RET @@ -10138,7 +10189,7 @@ emit_remainder_encodeBetterBlockAsm8B: SUBL 12(SP), CX LEAQ 3(AX)(CX*1), CX CMPQ CX, (SP) - JL emit_remainder_ok_encodeBetterBlockAsm8B + JB emit_remainder_ok_encodeBetterBlockAsm8B MOVQ $0x00000000, ret+48(FP) RET @@ -10153,9 +10204,12 @@ emit_remainder_ok_encodeBetterBlockAsm8B: SUBL BX, SI LEAL -1(SI), DX CMPL DX, $0x3c - JLT one_byte_emit_remainder_encodeBetterBlockAsm8B + JB one_byte_emit_remainder_encodeBetterBlockAsm8B CMPL DX, $0x00000100 - JLT two_bytes_emit_remainder_encodeBetterBlockAsm8B + JB two_bytes_emit_remainder_encodeBetterBlockAsm8B + JB three_bytes_emit_remainder_encodeBetterBlockAsm8B + +three_bytes_emit_remainder_encodeBetterBlockAsm8B: MOVB $0xf4, (AX) MOVW DX, 1(AX) ADDQ $0x03, AX @@ -10166,7 +10220,7 @@ two_bytes_emit_remainder_encodeBetterBlockAsm8B: MOVB DL, 1(AX) ADDQ $0x02, AX CMPL DX, $0x40 - JL memmove_emit_remainder_encodeBetterBlockAsm8B + JB memmove_emit_remainder_encodeBetterBlockAsm8B JMP memmove_long_emit_remainder_encodeBetterBlockAsm8B one_byte_emit_remainder_encodeBetterBlockAsm8B: @@ -10329,7 +10383,7 @@ search_loop_encodeSnappyBlockAsm: SHRL $0x06, BX LEAL 4(CX)(BX*1), BX CMPL BX, 8(SP) - JGE emit_remainder_encodeSnappyBlockAsm + JAE emit_remainder_encodeSnappyBlockAsm MOVQ (DX)(CX*1), SI MOVL BX, 20(SP) MOVQ $0x0000cf1bbcdcbf9b, R8 @@ -10367,7 +10421,7 @@ search_loop_encodeSnappyBlockAsm: repeat_extend_back_loop_encodeSnappyBlockAsm: CMPL SI, BX - JLE repeat_extend_back_end_encodeSnappyBlockAsm + JBE repeat_extend_back_end_encodeSnappyBlockAsm MOVB -1(DX)(DI*1), R8 MOVB -1(DX)(SI*1), R9 CMPB R8, R9 @@ -10386,13 +10440,13 @@ repeat_extend_back_end_encodeSnappyBlockAsm: SUBL BX, DI LEAL -1(DI), BX CMPL BX, $0x3c - JLT one_byte_repeat_emit_encodeSnappyBlockAsm + JB one_byte_repeat_emit_encodeSnappyBlockAsm CMPL BX, $0x00000100 - JLT two_bytes_repeat_emit_encodeSnappyBlockAsm + JB two_bytes_repeat_emit_encodeSnappyBlockAsm CMPL BX, $0x00010000 - JLT three_bytes_repeat_emit_encodeSnappyBlockAsm + JB three_bytes_repeat_emit_encodeSnappyBlockAsm CMPL BX, $0x01000000 - JLT four_bytes_repeat_emit_encodeSnappyBlockAsm + JB four_bytes_repeat_emit_encodeSnappyBlockAsm MOVB $0xfc, (AX) MOVL BX, 1(AX) ADDQ $0x05, AX @@ -10418,7 +10472,7 @@ two_bytes_repeat_emit_encodeSnappyBlockAsm: MOVB BL, 1(AX) ADDQ $0x02, AX CMPL BX, $0x40 - JL memmove_repeat_emit_encodeSnappyBlockAsm + JB memmove_repeat_emit_encodeSnappyBlockAsm JMP memmove_long_repeat_emit_encodeSnappyBlockAsm one_byte_repeat_emit_encodeSnappyBlockAsm: @@ -10431,7 +10485,7 @@ memmove_repeat_emit_encodeSnappyBlockAsm: // genMemMoveShort CMPQ DI, $0x08 - JLE emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm_memmove_move_8 + JBE emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm_memmove_move_8 CMPQ DI, $0x10 JBE emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm_memmove_move_8through16 CMPQ DI, $0x20 @@ -10527,7 +10581,7 @@ emit_literal_done_repeat_emit_encodeSnappyBlockAsm: // matchLen XORL R10, R10 CMPL DI, $0x08 - JL matchlen_match4_repeat_extend_encodeSnappyBlockAsm + JB matchlen_match4_repeat_extend_encodeSnappyBlockAsm matchlen_loopback_repeat_extend_encodeSnappyBlockAsm: MOVQ (R8)(R10*1), R9 @@ -10550,12 +10604,12 @@ matchlen_loop_repeat_extend_encodeSnappyBlockAsm: LEAL -8(DI), DI LEAL 8(R10), R10 CMPL DI, $0x08 - JGE matchlen_loopback_repeat_extend_encodeSnappyBlockAsm + JAE matchlen_loopback_repeat_extend_encodeSnappyBlockAsm JZ repeat_extend_forward_end_encodeSnappyBlockAsm matchlen_match4_repeat_extend_encodeSnappyBlockAsm: CMPL DI, $0x04 - JL matchlen_match2_repeat_extend_encodeSnappyBlockAsm + JB matchlen_match2_repeat_extend_encodeSnappyBlockAsm MOVL (R8)(R10*1), R9 CMPL (BX)(R10*1), R9 JNE matchlen_match2_repeat_extend_encodeSnappyBlockAsm @@ -10564,7 +10618,7 @@ matchlen_match4_repeat_extend_encodeSnappyBlockAsm: matchlen_match2_repeat_extend_encodeSnappyBlockAsm: CMPL DI, $0x02 - JL matchlen_match1_repeat_extend_encodeSnappyBlockAsm + JB matchlen_match1_repeat_extend_encodeSnappyBlockAsm MOVW (R8)(R10*1), R9 CMPW (BX)(R10*1), R9 JNE matchlen_match1_repeat_extend_encodeSnappyBlockAsm @@ -10573,7 +10627,7 @@ matchlen_match2_repeat_extend_encodeSnappyBlockAsm: matchlen_match1_repeat_extend_encodeSnappyBlockAsm: CMPL DI, $0x01 - JL repeat_extend_forward_end_encodeSnappyBlockAsm + JB repeat_extend_forward_end_encodeSnappyBlockAsm MOVB (R8)(R10*1), R9 CMPB (BX)(R10*1), R9 JNE repeat_extend_forward_end_encodeSnappyBlockAsm @@ -10587,17 +10641,17 @@ repeat_extend_forward_end_encodeSnappyBlockAsm: // emitCopy CMPL SI, $0x00010000 - JL two_byte_offset_repeat_as_copy_encodeSnappyBlockAsm + JB two_byte_offset_repeat_as_copy_encodeSnappyBlockAsm four_bytes_loop_back_repeat_as_copy_encodeSnappyBlockAsm: CMPL BX, $0x40 - JLE four_bytes_remain_repeat_as_copy_encodeSnappyBlockAsm + JBE four_bytes_remain_repeat_as_copy_encodeSnappyBlockAsm MOVB $0xff, (AX) MOVL SI, 1(AX) LEAL -64(BX), BX ADDQ $0x05, AX CMPL BX, $0x04 - JL four_bytes_remain_repeat_as_copy_encodeSnappyBlockAsm + JB four_bytes_remain_repeat_as_copy_encodeSnappyBlockAsm JMP four_bytes_loop_back_repeat_as_copy_encodeSnappyBlockAsm four_bytes_remain_repeat_as_copy_encodeSnappyBlockAsm: @@ -10612,7 +10666,7 @@ four_bytes_remain_repeat_as_copy_encodeSnappyBlockAsm: two_byte_offset_repeat_as_copy_encodeSnappyBlockAsm: CMPL BX, $0x40 - JLE two_byte_offset_short_repeat_as_copy_encodeSnappyBlockAsm + JBE two_byte_offset_short_repeat_as_copy_encodeSnappyBlockAsm MOVB $0xee, (AX) MOVW SI, 1(AX) LEAL -60(BX), BX @@ -10623,9 +10677,9 @@ two_byte_offset_short_repeat_as_copy_encodeSnappyBlockAsm: MOVL BX, DI SHLL $0x02, DI CMPL BX, $0x0c - JGE emit_copy_three_repeat_as_copy_encodeSnappyBlockAsm + JAE emit_copy_three_repeat_as_copy_encodeSnappyBlockAsm CMPL SI, $0x00000800 - JGE emit_copy_three_repeat_as_copy_encodeSnappyBlockAsm + JAE emit_copy_three_repeat_as_copy_encodeSnappyBlockAsm LEAL -15(DI), DI MOVB SI, 1(AX) SHRL $0x08, SI @@ -10676,7 +10730,7 @@ candidate_match_encodeSnappyBlockAsm: match_extend_back_loop_encodeSnappyBlockAsm: CMPL CX, SI - JLE match_extend_back_end_encodeSnappyBlockAsm + JBE match_extend_back_end_encodeSnappyBlockAsm MOVB -1(DX)(BX*1), DI MOVB -1(DX)(CX*1), R8 CMPB DI, R8 @@ -10691,7 +10745,7 @@ match_extend_back_end_encodeSnappyBlockAsm: SUBL 12(SP), SI LEAQ 5(AX)(SI*1), SI CMPQ SI, (SP) - JL match_dst_size_check_encodeSnappyBlockAsm + JB match_dst_size_check_encodeSnappyBlockAsm MOVQ $0x00000000, ret+48(FP) RET @@ -10706,13 +10760,13 @@ match_dst_size_check_encodeSnappyBlockAsm: SUBL DI, R8 LEAL -1(R8), DI CMPL DI, $0x3c - JLT one_byte_match_emit_encodeSnappyBlockAsm + JB one_byte_match_emit_encodeSnappyBlockAsm CMPL DI, $0x00000100 - JLT two_bytes_match_emit_encodeSnappyBlockAsm + JB two_bytes_match_emit_encodeSnappyBlockAsm CMPL DI, $0x00010000 - JLT three_bytes_match_emit_encodeSnappyBlockAsm + JB three_bytes_match_emit_encodeSnappyBlockAsm CMPL DI, $0x01000000 - JLT four_bytes_match_emit_encodeSnappyBlockAsm + JB four_bytes_match_emit_encodeSnappyBlockAsm MOVB $0xfc, (AX) MOVL DI, 1(AX) ADDQ $0x05, AX @@ -10738,7 +10792,7 @@ two_bytes_match_emit_encodeSnappyBlockAsm: MOVB DI, 1(AX) ADDQ $0x02, AX CMPL DI, $0x40 - JL memmove_match_emit_encodeSnappyBlockAsm + JB memmove_match_emit_encodeSnappyBlockAsm JMP memmove_long_match_emit_encodeSnappyBlockAsm one_byte_match_emit_encodeSnappyBlockAsm: @@ -10751,7 +10805,7 @@ memmove_match_emit_encodeSnappyBlockAsm: // genMemMoveShort CMPQ R8, $0x08 - JLE emit_lit_memmove_match_emit_encodeSnappyBlockAsm_memmove_move_8 + JBE emit_lit_memmove_match_emit_encodeSnappyBlockAsm_memmove_move_8 CMPQ R8, $0x10 JBE emit_lit_memmove_match_emit_encodeSnappyBlockAsm_memmove_move_8through16 CMPQ R8, $0x20 @@ -10850,7 +10904,7 @@ match_nolit_loop_encodeSnappyBlockAsm: // matchLen XORL R9, R9 CMPL SI, $0x08 - JL matchlen_match4_match_nolit_encodeSnappyBlockAsm + JB matchlen_match4_match_nolit_encodeSnappyBlockAsm matchlen_loopback_match_nolit_encodeSnappyBlockAsm: MOVQ (DI)(R9*1), R8 @@ -10873,12 +10927,12 @@ matchlen_loop_match_nolit_encodeSnappyBlockAsm: LEAL -8(SI), SI LEAL 8(R9), R9 CMPL SI, $0x08 - JGE matchlen_loopback_match_nolit_encodeSnappyBlockAsm + JAE matchlen_loopback_match_nolit_encodeSnappyBlockAsm JZ match_nolit_end_encodeSnappyBlockAsm matchlen_match4_match_nolit_encodeSnappyBlockAsm: CMPL SI, $0x04 - JL matchlen_match2_match_nolit_encodeSnappyBlockAsm + JB matchlen_match2_match_nolit_encodeSnappyBlockAsm MOVL (DI)(R9*1), R8 CMPL (BX)(R9*1), R8 JNE matchlen_match2_match_nolit_encodeSnappyBlockAsm @@ -10887,7 +10941,7 @@ matchlen_match4_match_nolit_encodeSnappyBlockAsm: matchlen_match2_match_nolit_encodeSnappyBlockAsm: CMPL SI, $0x02 - JL matchlen_match1_match_nolit_encodeSnappyBlockAsm + JB matchlen_match1_match_nolit_encodeSnappyBlockAsm MOVW (DI)(R9*1), R8 CMPW (BX)(R9*1), R8 JNE matchlen_match1_match_nolit_encodeSnappyBlockAsm @@ -10896,7 +10950,7 @@ matchlen_match2_match_nolit_encodeSnappyBlockAsm: matchlen_match1_match_nolit_encodeSnappyBlockAsm: CMPL SI, $0x01 - JL match_nolit_end_encodeSnappyBlockAsm + JB match_nolit_end_encodeSnappyBlockAsm MOVB (DI)(R9*1), R8 CMPB (BX)(R9*1), R8 JNE match_nolit_end_encodeSnappyBlockAsm @@ -10910,17 +10964,17 @@ match_nolit_end_encodeSnappyBlockAsm: // emitCopy CMPL BX, $0x00010000 - JL two_byte_offset_match_nolit_encodeSnappyBlockAsm + JB two_byte_offset_match_nolit_encodeSnappyBlockAsm four_bytes_loop_back_match_nolit_encodeSnappyBlockAsm: CMPL R9, $0x40 - JLE four_bytes_remain_match_nolit_encodeSnappyBlockAsm + JBE four_bytes_remain_match_nolit_encodeSnappyBlockAsm MOVB $0xff, (AX) MOVL BX, 1(AX) LEAL -64(R9), R9 ADDQ $0x05, AX CMPL R9, $0x04 - JL four_bytes_remain_match_nolit_encodeSnappyBlockAsm + JB four_bytes_remain_match_nolit_encodeSnappyBlockAsm JMP four_bytes_loop_back_match_nolit_encodeSnappyBlockAsm four_bytes_remain_match_nolit_encodeSnappyBlockAsm: @@ -10935,7 +10989,7 @@ four_bytes_remain_match_nolit_encodeSnappyBlockAsm: two_byte_offset_match_nolit_encodeSnappyBlockAsm: CMPL R9, $0x40 - JLE two_byte_offset_short_match_nolit_encodeSnappyBlockAsm + JBE two_byte_offset_short_match_nolit_encodeSnappyBlockAsm MOVB $0xee, (AX) MOVW BX, 1(AX) LEAL -60(R9), R9 @@ -10946,9 +11000,9 @@ two_byte_offset_short_match_nolit_encodeSnappyBlockAsm: MOVL R9, SI SHLL $0x02, SI CMPL R9, $0x0c - JGE emit_copy_three_match_nolit_encodeSnappyBlockAsm + JAE emit_copy_three_match_nolit_encodeSnappyBlockAsm CMPL BX, $0x00000800 - JGE emit_copy_three_match_nolit_encodeSnappyBlockAsm + JAE emit_copy_three_match_nolit_encodeSnappyBlockAsm LEAL -15(SI), SI MOVB BL, 1(AX) SHRL $0x08, BX @@ -10966,10 +11020,10 @@ emit_copy_three_match_nolit_encodeSnappyBlockAsm: match_nolit_emitcopy_end_encodeSnappyBlockAsm: CMPL CX, 8(SP) - JGE emit_remainder_encodeSnappyBlockAsm + JAE emit_remainder_encodeSnappyBlockAsm MOVQ -2(DX)(CX*1), SI CMPQ AX, (SP) - JL match_nolit_dst_ok_encodeSnappyBlockAsm + JB match_nolit_dst_ok_encodeSnappyBlockAsm MOVQ $0x00000000, ret+48(FP) RET @@ -10999,7 +11053,7 @@ emit_remainder_encodeSnappyBlockAsm: SUBL 12(SP), CX LEAQ 5(AX)(CX*1), CX CMPQ CX, (SP) - JL emit_remainder_ok_encodeSnappyBlockAsm + JB emit_remainder_ok_encodeSnappyBlockAsm MOVQ $0x00000000, ret+48(FP) RET @@ -11014,13 +11068,13 @@ emit_remainder_ok_encodeSnappyBlockAsm: SUBL BX, SI LEAL -1(SI), DX CMPL DX, $0x3c - JLT one_byte_emit_remainder_encodeSnappyBlockAsm + JB one_byte_emit_remainder_encodeSnappyBlockAsm CMPL DX, $0x00000100 - JLT two_bytes_emit_remainder_encodeSnappyBlockAsm + JB two_bytes_emit_remainder_encodeSnappyBlockAsm CMPL DX, $0x00010000 - JLT three_bytes_emit_remainder_encodeSnappyBlockAsm + JB three_bytes_emit_remainder_encodeSnappyBlockAsm CMPL DX, $0x01000000 - JLT four_bytes_emit_remainder_encodeSnappyBlockAsm + JB four_bytes_emit_remainder_encodeSnappyBlockAsm MOVB $0xfc, (AX) MOVL DX, 1(AX) ADDQ $0x05, AX @@ -11046,7 +11100,7 @@ two_bytes_emit_remainder_encodeSnappyBlockAsm: MOVB DL, 1(AX) ADDQ $0x02, AX CMPL DX, $0x40 - JL memmove_emit_remainder_encodeSnappyBlockAsm + JB memmove_emit_remainder_encodeSnappyBlockAsm JMP memmove_long_emit_remainder_encodeSnappyBlockAsm one_byte_emit_remainder_encodeSnappyBlockAsm: @@ -11209,7 +11263,7 @@ search_loop_encodeSnappyBlockAsm64K: SHRL $0x06, BX LEAL 4(CX)(BX*1), BX CMPL BX, 8(SP) - JGE emit_remainder_encodeSnappyBlockAsm64K + JAE emit_remainder_encodeSnappyBlockAsm64K MOVQ (DX)(CX*1), SI MOVL BX, 20(SP) MOVQ $0x0000cf1bbcdcbf9b, R8 @@ -11247,7 +11301,7 @@ search_loop_encodeSnappyBlockAsm64K: repeat_extend_back_loop_encodeSnappyBlockAsm64K: CMPL SI, BX - JLE repeat_extend_back_end_encodeSnappyBlockAsm64K + JBE repeat_extend_back_end_encodeSnappyBlockAsm64K MOVB -1(DX)(DI*1), R8 MOVB -1(DX)(SI*1), R9 CMPB R8, R9 @@ -11266,9 +11320,12 @@ repeat_extend_back_end_encodeSnappyBlockAsm64K: SUBL BX, DI LEAL -1(DI), BX CMPL BX, $0x3c - JLT one_byte_repeat_emit_encodeSnappyBlockAsm64K + JB one_byte_repeat_emit_encodeSnappyBlockAsm64K CMPL BX, $0x00000100 - JLT two_bytes_repeat_emit_encodeSnappyBlockAsm64K + JB two_bytes_repeat_emit_encodeSnappyBlockAsm64K + JB three_bytes_repeat_emit_encodeSnappyBlockAsm64K + +three_bytes_repeat_emit_encodeSnappyBlockAsm64K: MOVB $0xf4, (AX) MOVW BX, 1(AX) ADDQ $0x03, AX @@ -11279,7 +11336,7 @@ two_bytes_repeat_emit_encodeSnappyBlockAsm64K: MOVB BL, 1(AX) ADDQ $0x02, AX CMPL BX, $0x40 - JL memmove_repeat_emit_encodeSnappyBlockAsm64K + JB memmove_repeat_emit_encodeSnappyBlockAsm64K JMP memmove_long_repeat_emit_encodeSnappyBlockAsm64K one_byte_repeat_emit_encodeSnappyBlockAsm64K: @@ -11292,7 +11349,7 @@ memmove_repeat_emit_encodeSnappyBlockAsm64K: // genMemMoveShort CMPQ DI, $0x08 - JLE emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm64K_memmove_move_8 + JBE emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm64K_memmove_move_8 CMPQ DI, $0x10 JBE emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm64K_memmove_move_8through16 CMPQ DI, $0x20 @@ -11388,7 +11445,7 @@ emit_literal_done_repeat_emit_encodeSnappyBlockAsm64K: // matchLen XORL R10, R10 CMPL DI, $0x08 - JL matchlen_match4_repeat_extend_encodeSnappyBlockAsm64K + JB matchlen_match4_repeat_extend_encodeSnappyBlockAsm64K matchlen_loopback_repeat_extend_encodeSnappyBlockAsm64K: MOVQ (R8)(R10*1), R9 @@ -11411,12 +11468,12 @@ matchlen_loop_repeat_extend_encodeSnappyBlockAsm64K: LEAL -8(DI), DI LEAL 8(R10), R10 CMPL DI, $0x08 - JGE matchlen_loopback_repeat_extend_encodeSnappyBlockAsm64K + JAE matchlen_loopback_repeat_extend_encodeSnappyBlockAsm64K JZ repeat_extend_forward_end_encodeSnappyBlockAsm64K matchlen_match4_repeat_extend_encodeSnappyBlockAsm64K: CMPL DI, $0x04 - JL matchlen_match2_repeat_extend_encodeSnappyBlockAsm64K + JB matchlen_match2_repeat_extend_encodeSnappyBlockAsm64K MOVL (R8)(R10*1), R9 CMPL (BX)(R10*1), R9 JNE matchlen_match2_repeat_extend_encodeSnappyBlockAsm64K @@ -11425,7 +11482,7 @@ matchlen_match4_repeat_extend_encodeSnappyBlockAsm64K: matchlen_match2_repeat_extend_encodeSnappyBlockAsm64K: CMPL DI, $0x02 - JL matchlen_match1_repeat_extend_encodeSnappyBlockAsm64K + JB matchlen_match1_repeat_extend_encodeSnappyBlockAsm64K MOVW (R8)(R10*1), R9 CMPW (BX)(R10*1), R9 JNE matchlen_match1_repeat_extend_encodeSnappyBlockAsm64K @@ -11434,7 +11491,7 @@ matchlen_match2_repeat_extend_encodeSnappyBlockAsm64K: matchlen_match1_repeat_extend_encodeSnappyBlockAsm64K: CMPL DI, $0x01 - JL repeat_extend_forward_end_encodeSnappyBlockAsm64K + JB repeat_extend_forward_end_encodeSnappyBlockAsm64K MOVB (R8)(R10*1), R9 CMPB (BX)(R10*1), R9 JNE repeat_extend_forward_end_encodeSnappyBlockAsm64K @@ -11449,7 +11506,7 @@ repeat_extend_forward_end_encodeSnappyBlockAsm64K: // emitCopy two_byte_offset_repeat_as_copy_encodeSnappyBlockAsm64K: CMPL BX, $0x40 - JLE two_byte_offset_short_repeat_as_copy_encodeSnappyBlockAsm64K + JBE two_byte_offset_short_repeat_as_copy_encodeSnappyBlockAsm64K MOVB $0xee, (AX) MOVW SI, 1(AX) LEAL -60(BX), BX @@ -11460,9 +11517,9 @@ two_byte_offset_short_repeat_as_copy_encodeSnappyBlockAsm64K: MOVL BX, DI SHLL $0x02, DI CMPL BX, $0x0c - JGE emit_copy_three_repeat_as_copy_encodeSnappyBlockAsm64K + JAE emit_copy_three_repeat_as_copy_encodeSnappyBlockAsm64K CMPL SI, $0x00000800 - JGE emit_copy_three_repeat_as_copy_encodeSnappyBlockAsm64K + JAE emit_copy_three_repeat_as_copy_encodeSnappyBlockAsm64K LEAL -15(DI), DI MOVB SI, 1(AX) SHRL $0x08, SI @@ -11513,7 +11570,7 @@ candidate_match_encodeSnappyBlockAsm64K: match_extend_back_loop_encodeSnappyBlockAsm64K: CMPL CX, SI - JLE match_extend_back_end_encodeSnappyBlockAsm64K + JBE match_extend_back_end_encodeSnappyBlockAsm64K MOVB -1(DX)(BX*1), DI MOVB -1(DX)(CX*1), R8 CMPB DI, R8 @@ -11528,7 +11585,7 @@ match_extend_back_end_encodeSnappyBlockAsm64K: SUBL 12(SP), SI LEAQ 3(AX)(SI*1), SI CMPQ SI, (SP) - JL match_dst_size_check_encodeSnappyBlockAsm64K + JB match_dst_size_check_encodeSnappyBlockAsm64K MOVQ $0x00000000, ret+48(FP) RET @@ -11543,9 +11600,12 @@ match_dst_size_check_encodeSnappyBlockAsm64K: SUBL DI, R8 LEAL -1(R8), DI CMPL DI, $0x3c - JLT one_byte_match_emit_encodeSnappyBlockAsm64K + JB one_byte_match_emit_encodeSnappyBlockAsm64K CMPL DI, $0x00000100 - JLT two_bytes_match_emit_encodeSnappyBlockAsm64K + JB two_bytes_match_emit_encodeSnappyBlockAsm64K + JB three_bytes_match_emit_encodeSnappyBlockAsm64K + +three_bytes_match_emit_encodeSnappyBlockAsm64K: MOVB $0xf4, (AX) MOVW DI, 1(AX) ADDQ $0x03, AX @@ -11556,7 +11616,7 @@ two_bytes_match_emit_encodeSnappyBlockAsm64K: MOVB DI, 1(AX) ADDQ $0x02, AX CMPL DI, $0x40 - JL memmove_match_emit_encodeSnappyBlockAsm64K + JB memmove_match_emit_encodeSnappyBlockAsm64K JMP memmove_long_match_emit_encodeSnappyBlockAsm64K one_byte_match_emit_encodeSnappyBlockAsm64K: @@ -11569,7 +11629,7 @@ memmove_match_emit_encodeSnappyBlockAsm64K: // genMemMoveShort CMPQ R8, $0x08 - JLE emit_lit_memmove_match_emit_encodeSnappyBlockAsm64K_memmove_move_8 + JBE emit_lit_memmove_match_emit_encodeSnappyBlockAsm64K_memmove_move_8 CMPQ R8, $0x10 JBE emit_lit_memmove_match_emit_encodeSnappyBlockAsm64K_memmove_move_8through16 CMPQ R8, $0x20 @@ -11668,7 +11728,7 @@ match_nolit_loop_encodeSnappyBlockAsm64K: // matchLen XORL R9, R9 CMPL SI, $0x08 - JL matchlen_match4_match_nolit_encodeSnappyBlockAsm64K + JB matchlen_match4_match_nolit_encodeSnappyBlockAsm64K matchlen_loopback_match_nolit_encodeSnappyBlockAsm64K: MOVQ (DI)(R9*1), R8 @@ -11691,12 +11751,12 @@ matchlen_loop_match_nolit_encodeSnappyBlockAsm64K: LEAL -8(SI), SI LEAL 8(R9), R9 CMPL SI, $0x08 - JGE matchlen_loopback_match_nolit_encodeSnappyBlockAsm64K + JAE matchlen_loopback_match_nolit_encodeSnappyBlockAsm64K JZ match_nolit_end_encodeSnappyBlockAsm64K matchlen_match4_match_nolit_encodeSnappyBlockAsm64K: CMPL SI, $0x04 - JL matchlen_match2_match_nolit_encodeSnappyBlockAsm64K + JB matchlen_match2_match_nolit_encodeSnappyBlockAsm64K MOVL (DI)(R9*1), R8 CMPL (BX)(R9*1), R8 JNE matchlen_match2_match_nolit_encodeSnappyBlockAsm64K @@ -11705,7 +11765,7 @@ matchlen_match4_match_nolit_encodeSnappyBlockAsm64K: matchlen_match2_match_nolit_encodeSnappyBlockAsm64K: CMPL SI, $0x02 - JL matchlen_match1_match_nolit_encodeSnappyBlockAsm64K + JB matchlen_match1_match_nolit_encodeSnappyBlockAsm64K MOVW (DI)(R9*1), R8 CMPW (BX)(R9*1), R8 JNE matchlen_match1_match_nolit_encodeSnappyBlockAsm64K @@ -11714,7 +11774,7 @@ matchlen_match2_match_nolit_encodeSnappyBlockAsm64K: matchlen_match1_match_nolit_encodeSnappyBlockAsm64K: CMPL SI, $0x01 - JL match_nolit_end_encodeSnappyBlockAsm64K + JB match_nolit_end_encodeSnappyBlockAsm64K MOVB (DI)(R9*1), R8 CMPB (BX)(R9*1), R8 JNE match_nolit_end_encodeSnappyBlockAsm64K @@ -11729,7 +11789,7 @@ match_nolit_end_encodeSnappyBlockAsm64K: // emitCopy two_byte_offset_match_nolit_encodeSnappyBlockAsm64K: CMPL R9, $0x40 - JLE two_byte_offset_short_match_nolit_encodeSnappyBlockAsm64K + JBE two_byte_offset_short_match_nolit_encodeSnappyBlockAsm64K MOVB $0xee, (AX) MOVW BX, 1(AX) LEAL -60(R9), R9 @@ -11740,9 +11800,9 @@ two_byte_offset_short_match_nolit_encodeSnappyBlockAsm64K: MOVL R9, SI SHLL $0x02, SI CMPL R9, $0x0c - JGE emit_copy_three_match_nolit_encodeSnappyBlockAsm64K + JAE emit_copy_three_match_nolit_encodeSnappyBlockAsm64K CMPL BX, $0x00000800 - JGE emit_copy_three_match_nolit_encodeSnappyBlockAsm64K + JAE emit_copy_three_match_nolit_encodeSnappyBlockAsm64K LEAL -15(SI), SI MOVB BL, 1(AX) SHRL $0x08, BX @@ -11760,10 +11820,10 @@ emit_copy_three_match_nolit_encodeSnappyBlockAsm64K: match_nolit_emitcopy_end_encodeSnappyBlockAsm64K: CMPL CX, 8(SP) - JGE emit_remainder_encodeSnappyBlockAsm64K + JAE emit_remainder_encodeSnappyBlockAsm64K MOVQ -2(DX)(CX*1), SI CMPQ AX, (SP) - JL match_nolit_dst_ok_encodeSnappyBlockAsm64K + JB match_nolit_dst_ok_encodeSnappyBlockAsm64K MOVQ $0x00000000, ret+48(FP) RET @@ -11793,7 +11853,7 @@ emit_remainder_encodeSnappyBlockAsm64K: SUBL 12(SP), CX LEAQ 3(AX)(CX*1), CX CMPQ CX, (SP) - JL emit_remainder_ok_encodeSnappyBlockAsm64K + JB emit_remainder_ok_encodeSnappyBlockAsm64K MOVQ $0x00000000, ret+48(FP) RET @@ -11808,9 +11868,12 @@ emit_remainder_ok_encodeSnappyBlockAsm64K: SUBL BX, SI LEAL -1(SI), DX CMPL DX, $0x3c - JLT one_byte_emit_remainder_encodeSnappyBlockAsm64K + JB one_byte_emit_remainder_encodeSnappyBlockAsm64K CMPL DX, $0x00000100 - JLT two_bytes_emit_remainder_encodeSnappyBlockAsm64K + JB two_bytes_emit_remainder_encodeSnappyBlockAsm64K + JB three_bytes_emit_remainder_encodeSnappyBlockAsm64K + +three_bytes_emit_remainder_encodeSnappyBlockAsm64K: MOVB $0xf4, (AX) MOVW DX, 1(AX) ADDQ $0x03, AX @@ -11821,7 +11884,7 @@ two_bytes_emit_remainder_encodeSnappyBlockAsm64K: MOVB DL, 1(AX) ADDQ $0x02, AX CMPL DX, $0x40 - JL memmove_emit_remainder_encodeSnappyBlockAsm64K + JB memmove_emit_remainder_encodeSnappyBlockAsm64K JMP memmove_long_emit_remainder_encodeSnappyBlockAsm64K one_byte_emit_remainder_encodeSnappyBlockAsm64K: @@ -11984,7 +12047,7 @@ search_loop_encodeSnappyBlockAsm12B: SHRL $0x05, BX LEAL 4(CX)(BX*1), BX CMPL BX, 8(SP) - JGE emit_remainder_encodeSnappyBlockAsm12B + JAE emit_remainder_encodeSnappyBlockAsm12B MOVQ (DX)(CX*1), SI MOVL BX, 20(SP) MOVQ $0x000000cf1bbcdcbb, R8 @@ -12022,7 +12085,7 @@ search_loop_encodeSnappyBlockAsm12B: repeat_extend_back_loop_encodeSnappyBlockAsm12B: CMPL SI, BX - JLE repeat_extend_back_end_encodeSnappyBlockAsm12B + JBE repeat_extend_back_end_encodeSnappyBlockAsm12B MOVB -1(DX)(DI*1), R8 MOVB -1(DX)(SI*1), R9 CMPB R8, R9 @@ -12041,9 +12104,12 @@ repeat_extend_back_end_encodeSnappyBlockAsm12B: SUBL BX, DI LEAL -1(DI), BX CMPL BX, $0x3c - JLT one_byte_repeat_emit_encodeSnappyBlockAsm12B + JB one_byte_repeat_emit_encodeSnappyBlockAsm12B CMPL BX, $0x00000100 - JLT two_bytes_repeat_emit_encodeSnappyBlockAsm12B + JB two_bytes_repeat_emit_encodeSnappyBlockAsm12B + JB three_bytes_repeat_emit_encodeSnappyBlockAsm12B + +three_bytes_repeat_emit_encodeSnappyBlockAsm12B: MOVB $0xf4, (AX) MOVW BX, 1(AX) ADDQ $0x03, AX @@ -12054,7 +12120,7 @@ two_bytes_repeat_emit_encodeSnappyBlockAsm12B: MOVB BL, 1(AX) ADDQ $0x02, AX CMPL BX, $0x40 - JL memmove_repeat_emit_encodeSnappyBlockAsm12B + JB memmove_repeat_emit_encodeSnappyBlockAsm12B JMP memmove_long_repeat_emit_encodeSnappyBlockAsm12B one_byte_repeat_emit_encodeSnappyBlockAsm12B: @@ -12067,7 +12133,7 @@ memmove_repeat_emit_encodeSnappyBlockAsm12B: // genMemMoveShort CMPQ DI, $0x08 - JLE emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm12B_memmove_move_8 + JBE emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm12B_memmove_move_8 CMPQ DI, $0x10 JBE emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm12B_memmove_move_8through16 CMPQ DI, $0x20 @@ -12163,7 +12229,7 @@ emit_literal_done_repeat_emit_encodeSnappyBlockAsm12B: // matchLen XORL R10, R10 CMPL DI, $0x08 - JL matchlen_match4_repeat_extend_encodeSnappyBlockAsm12B + JB matchlen_match4_repeat_extend_encodeSnappyBlockAsm12B matchlen_loopback_repeat_extend_encodeSnappyBlockAsm12B: MOVQ (R8)(R10*1), R9 @@ -12186,12 +12252,12 @@ matchlen_loop_repeat_extend_encodeSnappyBlockAsm12B: LEAL -8(DI), DI LEAL 8(R10), R10 CMPL DI, $0x08 - JGE matchlen_loopback_repeat_extend_encodeSnappyBlockAsm12B + JAE matchlen_loopback_repeat_extend_encodeSnappyBlockAsm12B JZ repeat_extend_forward_end_encodeSnappyBlockAsm12B matchlen_match4_repeat_extend_encodeSnappyBlockAsm12B: CMPL DI, $0x04 - JL matchlen_match2_repeat_extend_encodeSnappyBlockAsm12B + JB matchlen_match2_repeat_extend_encodeSnappyBlockAsm12B MOVL (R8)(R10*1), R9 CMPL (BX)(R10*1), R9 JNE matchlen_match2_repeat_extend_encodeSnappyBlockAsm12B @@ -12200,7 +12266,7 @@ matchlen_match4_repeat_extend_encodeSnappyBlockAsm12B: matchlen_match2_repeat_extend_encodeSnappyBlockAsm12B: CMPL DI, $0x02 - JL matchlen_match1_repeat_extend_encodeSnappyBlockAsm12B + JB matchlen_match1_repeat_extend_encodeSnappyBlockAsm12B MOVW (R8)(R10*1), R9 CMPW (BX)(R10*1), R9 JNE matchlen_match1_repeat_extend_encodeSnappyBlockAsm12B @@ -12209,7 +12275,7 @@ matchlen_match2_repeat_extend_encodeSnappyBlockAsm12B: matchlen_match1_repeat_extend_encodeSnappyBlockAsm12B: CMPL DI, $0x01 - JL repeat_extend_forward_end_encodeSnappyBlockAsm12B + JB repeat_extend_forward_end_encodeSnappyBlockAsm12B MOVB (R8)(R10*1), R9 CMPB (BX)(R10*1), R9 JNE repeat_extend_forward_end_encodeSnappyBlockAsm12B @@ -12224,7 +12290,7 @@ repeat_extend_forward_end_encodeSnappyBlockAsm12B: // emitCopy two_byte_offset_repeat_as_copy_encodeSnappyBlockAsm12B: CMPL BX, $0x40 - JLE two_byte_offset_short_repeat_as_copy_encodeSnappyBlockAsm12B + JBE two_byte_offset_short_repeat_as_copy_encodeSnappyBlockAsm12B MOVB $0xee, (AX) MOVW SI, 1(AX) LEAL -60(BX), BX @@ -12235,9 +12301,9 @@ two_byte_offset_short_repeat_as_copy_encodeSnappyBlockAsm12B: MOVL BX, DI SHLL $0x02, DI CMPL BX, $0x0c - JGE emit_copy_three_repeat_as_copy_encodeSnappyBlockAsm12B + JAE emit_copy_three_repeat_as_copy_encodeSnappyBlockAsm12B CMPL SI, $0x00000800 - JGE emit_copy_three_repeat_as_copy_encodeSnappyBlockAsm12B + JAE emit_copy_three_repeat_as_copy_encodeSnappyBlockAsm12B LEAL -15(DI), DI MOVB SI, 1(AX) SHRL $0x08, SI @@ -12288,7 +12354,7 @@ candidate_match_encodeSnappyBlockAsm12B: match_extend_back_loop_encodeSnappyBlockAsm12B: CMPL CX, SI - JLE match_extend_back_end_encodeSnappyBlockAsm12B + JBE match_extend_back_end_encodeSnappyBlockAsm12B MOVB -1(DX)(BX*1), DI MOVB -1(DX)(CX*1), R8 CMPB DI, R8 @@ -12303,7 +12369,7 @@ match_extend_back_end_encodeSnappyBlockAsm12B: SUBL 12(SP), SI LEAQ 3(AX)(SI*1), SI CMPQ SI, (SP) - JL match_dst_size_check_encodeSnappyBlockAsm12B + JB match_dst_size_check_encodeSnappyBlockAsm12B MOVQ $0x00000000, ret+48(FP) RET @@ -12318,9 +12384,12 @@ match_dst_size_check_encodeSnappyBlockAsm12B: SUBL DI, R8 LEAL -1(R8), DI CMPL DI, $0x3c - JLT one_byte_match_emit_encodeSnappyBlockAsm12B + JB one_byte_match_emit_encodeSnappyBlockAsm12B CMPL DI, $0x00000100 - JLT two_bytes_match_emit_encodeSnappyBlockAsm12B + JB two_bytes_match_emit_encodeSnappyBlockAsm12B + JB three_bytes_match_emit_encodeSnappyBlockAsm12B + +three_bytes_match_emit_encodeSnappyBlockAsm12B: MOVB $0xf4, (AX) MOVW DI, 1(AX) ADDQ $0x03, AX @@ -12331,7 +12400,7 @@ two_bytes_match_emit_encodeSnappyBlockAsm12B: MOVB DI, 1(AX) ADDQ $0x02, AX CMPL DI, $0x40 - JL memmove_match_emit_encodeSnappyBlockAsm12B + JB memmove_match_emit_encodeSnappyBlockAsm12B JMP memmove_long_match_emit_encodeSnappyBlockAsm12B one_byte_match_emit_encodeSnappyBlockAsm12B: @@ -12344,7 +12413,7 @@ memmove_match_emit_encodeSnappyBlockAsm12B: // genMemMoveShort CMPQ R8, $0x08 - JLE emit_lit_memmove_match_emit_encodeSnappyBlockAsm12B_memmove_move_8 + JBE emit_lit_memmove_match_emit_encodeSnappyBlockAsm12B_memmove_move_8 CMPQ R8, $0x10 JBE emit_lit_memmove_match_emit_encodeSnappyBlockAsm12B_memmove_move_8through16 CMPQ R8, $0x20 @@ -12443,7 +12512,7 @@ match_nolit_loop_encodeSnappyBlockAsm12B: // matchLen XORL R9, R9 CMPL SI, $0x08 - JL matchlen_match4_match_nolit_encodeSnappyBlockAsm12B + JB matchlen_match4_match_nolit_encodeSnappyBlockAsm12B matchlen_loopback_match_nolit_encodeSnappyBlockAsm12B: MOVQ (DI)(R9*1), R8 @@ -12466,12 +12535,12 @@ matchlen_loop_match_nolit_encodeSnappyBlockAsm12B: LEAL -8(SI), SI LEAL 8(R9), R9 CMPL SI, $0x08 - JGE matchlen_loopback_match_nolit_encodeSnappyBlockAsm12B + JAE matchlen_loopback_match_nolit_encodeSnappyBlockAsm12B JZ match_nolit_end_encodeSnappyBlockAsm12B matchlen_match4_match_nolit_encodeSnappyBlockAsm12B: CMPL SI, $0x04 - JL matchlen_match2_match_nolit_encodeSnappyBlockAsm12B + JB matchlen_match2_match_nolit_encodeSnappyBlockAsm12B MOVL (DI)(R9*1), R8 CMPL (BX)(R9*1), R8 JNE matchlen_match2_match_nolit_encodeSnappyBlockAsm12B @@ -12480,7 +12549,7 @@ matchlen_match4_match_nolit_encodeSnappyBlockAsm12B: matchlen_match2_match_nolit_encodeSnappyBlockAsm12B: CMPL SI, $0x02 - JL matchlen_match1_match_nolit_encodeSnappyBlockAsm12B + JB matchlen_match1_match_nolit_encodeSnappyBlockAsm12B MOVW (DI)(R9*1), R8 CMPW (BX)(R9*1), R8 JNE matchlen_match1_match_nolit_encodeSnappyBlockAsm12B @@ -12489,7 +12558,7 @@ matchlen_match2_match_nolit_encodeSnappyBlockAsm12B: matchlen_match1_match_nolit_encodeSnappyBlockAsm12B: CMPL SI, $0x01 - JL match_nolit_end_encodeSnappyBlockAsm12B + JB match_nolit_end_encodeSnappyBlockAsm12B MOVB (DI)(R9*1), R8 CMPB (BX)(R9*1), R8 JNE match_nolit_end_encodeSnappyBlockAsm12B @@ -12504,7 +12573,7 @@ match_nolit_end_encodeSnappyBlockAsm12B: // emitCopy two_byte_offset_match_nolit_encodeSnappyBlockAsm12B: CMPL R9, $0x40 - JLE two_byte_offset_short_match_nolit_encodeSnappyBlockAsm12B + JBE two_byte_offset_short_match_nolit_encodeSnappyBlockAsm12B MOVB $0xee, (AX) MOVW BX, 1(AX) LEAL -60(R9), R9 @@ -12515,9 +12584,9 @@ two_byte_offset_short_match_nolit_encodeSnappyBlockAsm12B: MOVL R9, SI SHLL $0x02, SI CMPL R9, $0x0c - JGE emit_copy_three_match_nolit_encodeSnappyBlockAsm12B + JAE emit_copy_three_match_nolit_encodeSnappyBlockAsm12B CMPL BX, $0x00000800 - JGE emit_copy_three_match_nolit_encodeSnappyBlockAsm12B + JAE emit_copy_three_match_nolit_encodeSnappyBlockAsm12B LEAL -15(SI), SI MOVB BL, 1(AX) SHRL $0x08, BX @@ -12535,10 +12604,10 @@ emit_copy_three_match_nolit_encodeSnappyBlockAsm12B: match_nolit_emitcopy_end_encodeSnappyBlockAsm12B: CMPL CX, 8(SP) - JGE emit_remainder_encodeSnappyBlockAsm12B + JAE emit_remainder_encodeSnappyBlockAsm12B MOVQ -2(DX)(CX*1), SI CMPQ AX, (SP) - JL match_nolit_dst_ok_encodeSnappyBlockAsm12B + JB match_nolit_dst_ok_encodeSnappyBlockAsm12B MOVQ $0x00000000, ret+48(FP) RET @@ -12568,7 +12637,7 @@ emit_remainder_encodeSnappyBlockAsm12B: SUBL 12(SP), CX LEAQ 3(AX)(CX*1), CX CMPQ CX, (SP) - JL emit_remainder_ok_encodeSnappyBlockAsm12B + JB emit_remainder_ok_encodeSnappyBlockAsm12B MOVQ $0x00000000, ret+48(FP) RET @@ -12583,9 +12652,12 @@ emit_remainder_ok_encodeSnappyBlockAsm12B: SUBL BX, SI LEAL -1(SI), DX CMPL DX, $0x3c - JLT one_byte_emit_remainder_encodeSnappyBlockAsm12B + JB one_byte_emit_remainder_encodeSnappyBlockAsm12B CMPL DX, $0x00000100 - JLT two_bytes_emit_remainder_encodeSnappyBlockAsm12B + JB two_bytes_emit_remainder_encodeSnappyBlockAsm12B + JB three_bytes_emit_remainder_encodeSnappyBlockAsm12B + +three_bytes_emit_remainder_encodeSnappyBlockAsm12B: MOVB $0xf4, (AX) MOVW DX, 1(AX) ADDQ $0x03, AX @@ -12596,7 +12668,7 @@ two_bytes_emit_remainder_encodeSnappyBlockAsm12B: MOVB DL, 1(AX) ADDQ $0x02, AX CMPL DX, $0x40 - JL memmove_emit_remainder_encodeSnappyBlockAsm12B + JB memmove_emit_remainder_encodeSnappyBlockAsm12B JMP memmove_long_emit_remainder_encodeSnappyBlockAsm12B one_byte_emit_remainder_encodeSnappyBlockAsm12B: @@ -12759,7 +12831,7 @@ search_loop_encodeSnappyBlockAsm10B: SHRL $0x05, BX LEAL 4(CX)(BX*1), BX CMPL BX, 8(SP) - JGE emit_remainder_encodeSnappyBlockAsm10B + JAE emit_remainder_encodeSnappyBlockAsm10B MOVQ (DX)(CX*1), SI MOVL BX, 20(SP) MOVQ $0x9e3779b1, R8 @@ -12797,7 +12869,7 @@ search_loop_encodeSnappyBlockAsm10B: repeat_extend_back_loop_encodeSnappyBlockAsm10B: CMPL SI, BX - JLE repeat_extend_back_end_encodeSnappyBlockAsm10B + JBE repeat_extend_back_end_encodeSnappyBlockAsm10B MOVB -1(DX)(DI*1), R8 MOVB -1(DX)(SI*1), R9 CMPB R8, R9 @@ -12816,9 +12888,12 @@ repeat_extend_back_end_encodeSnappyBlockAsm10B: SUBL BX, DI LEAL -1(DI), BX CMPL BX, $0x3c - JLT one_byte_repeat_emit_encodeSnappyBlockAsm10B + JB one_byte_repeat_emit_encodeSnappyBlockAsm10B CMPL BX, $0x00000100 - JLT two_bytes_repeat_emit_encodeSnappyBlockAsm10B + JB two_bytes_repeat_emit_encodeSnappyBlockAsm10B + JB three_bytes_repeat_emit_encodeSnappyBlockAsm10B + +three_bytes_repeat_emit_encodeSnappyBlockAsm10B: MOVB $0xf4, (AX) MOVW BX, 1(AX) ADDQ $0x03, AX @@ -12829,7 +12904,7 @@ two_bytes_repeat_emit_encodeSnappyBlockAsm10B: MOVB BL, 1(AX) ADDQ $0x02, AX CMPL BX, $0x40 - JL memmove_repeat_emit_encodeSnappyBlockAsm10B + JB memmove_repeat_emit_encodeSnappyBlockAsm10B JMP memmove_long_repeat_emit_encodeSnappyBlockAsm10B one_byte_repeat_emit_encodeSnappyBlockAsm10B: @@ -12842,7 +12917,7 @@ memmove_repeat_emit_encodeSnappyBlockAsm10B: // genMemMoveShort CMPQ DI, $0x08 - JLE emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm10B_memmove_move_8 + JBE emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm10B_memmove_move_8 CMPQ DI, $0x10 JBE emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm10B_memmove_move_8through16 CMPQ DI, $0x20 @@ -12938,7 +13013,7 @@ emit_literal_done_repeat_emit_encodeSnappyBlockAsm10B: // matchLen XORL R10, R10 CMPL DI, $0x08 - JL matchlen_match4_repeat_extend_encodeSnappyBlockAsm10B + JB matchlen_match4_repeat_extend_encodeSnappyBlockAsm10B matchlen_loopback_repeat_extend_encodeSnappyBlockAsm10B: MOVQ (R8)(R10*1), R9 @@ -12961,12 +13036,12 @@ matchlen_loop_repeat_extend_encodeSnappyBlockAsm10B: LEAL -8(DI), DI LEAL 8(R10), R10 CMPL DI, $0x08 - JGE matchlen_loopback_repeat_extend_encodeSnappyBlockAsm10B + JAE matchlen_loopback_repeat_extend_encodeSnappyBlockAsm10B JZ repeat_extend_forward_end_encodeSnappyBlockAsm10B matchlen_match4_repeat_extend_encodeSnappyBlockAsm10B: CMPL DI, $0x04 - JL matchlen_match2_repeat_extend_encodeSnappyBlockAsm10B + JB matchlen_match2_repeat_extend_encodeSnappyBlockAsm10B MOVL (R8)(R10*1), R9 CMPL (BX)(R10*1), R9 JNE matchlen_match2_repeat_extend_encodeSnappyBlockAsm10B @@ -12975,7 +13050,7 @@ matchlen_match4_repeat_extend_encodeSnappyBlockAsm10B: matchlen_match2_repeat_extend_encodeSnappyBlockAsm10B: CMPL DI, $0x02 - JL matchlen_match1_repeat_extend_encodeSnappyBlockAsm10B + JB matchlen_match1_repeat_extend_encodeSnappyBlockAsm10B MOVW (R8)(R10*1), R9 CMPW (BX)(R10*1), R9 JNE matchlen_match1_repeat_extend_encodeSnappyBlockAsm10B @@ -12984,7 +13059,7 @@ matchlen_match2_repeat_extend_encodeSnappyBlockAsm10B: matchlen_match1_repeat_extend_encodeSnappyBlockAsm10B: CMPL DI, $0x01 - JL repeat_extend_forward_end_encodeSnappyBlockAsm10B + JB repeat_extend_forward_end_encodeSnappyBlockAsm10B MOVB (R8)(R10*1), R9 CMPB (BX)(R10*1), R9 JNE repeat_extend_forward_end_encodeSnappyBlockAsm10B @@ -12999,7 +13074,7 @@ repeat_extend_forward_end_encodeSnappyBlockAsm10B: // emitCopy two_byte_offset_repeat_as_copy_encodeSnappyBlockAsm10B: CMPL BX, $0x40 - JLE two_byte_offset_short_repeat_as_copy_encodeSnappyBlockAsm10B + JBE two_byte_offset_short_repeat_as_copy_encodeSnappyBlockAsm10B MOVB $0xee, (AX) MOVW SI, 1(AX) LEAL -60(BX), BX @@ -13010,9 +13085,9 @@ two_byte_offset_short_repeat_as_copy_encodeSnappyBlockAsm10B: MOVL BX, DI SHLL $0x02, DI CMPL BX, $0x0c - JGE emit_copy_three_repeat_as_copy_encodeSnappyBlockAsm10B + JAE emit_copy_three_repeat_as_copy_encodeSnappyBlockAsm10B CMPL SI, $0x00000800 - JGE emit_copy_three_repeat_as_copy_encodeSnappyBlockAsm10B + JAE emit_copy_three_repeat_as_copy_encodeSnappyBlockAsm10B LEAL -15(DI), DI MOVB SI, 1(AX) SHRL $0x08, SI @@ -13063,7 +13138,7 @@ candidate_match_encodeSnappyBlockAsm10B: match_extend_back_loop_encodeSnappyBlockAsm10B: CMPL CX, SI - JLE match_extend_back_end_encodeSnappyBlockAsm10B + JBE match_extend_back_end_encodeSnappyBlockAsm10B MOVB -1(DX)(BX*1), DI MOVB -1(DX)(CX*1), R8 CMPB DI, R8 @@ -13078,7 +13153,7 @@ match_extend_back_end_encodeSnappyBlockAsm10B: SUBL 12(SP), SI LEAQ 3(AX)(SI*1), SI CMPQ SI, (SP) - JL match_dst_size_check_encodeSnappyBlockAsm10B + JB match_dst_size_check_encodeSnappyBlockAsm10B MOVQ $0x00000000, ret+48(FP) RET @@ -13093,9 +13168,12 @@ match_dst_size_check_encodeSnappyBlockAsm10B: SUBL DI, R8 LEAL -1(R8), DI CMPL DI, $0x3c - JLT one_byte_match_emit_encodeSnappyBlockAsm10B + JB one_byte_match_emit_encodeSnappyBlockAsm10B CMPL DI, $0x00000100 - JLT two_bytes_match_emit_encodeSnappyBlockAsm10B + JB two_bytes_match_emit_encodeSnappyBlockAsm10B + JB three_bytes_match_emit_encodeSnappyBlockAsm10B + +three_bytes_match_emit_encodeSnappyBlockAsm10B: MOVB $0xf4, (AX) MOVW DI, 1(AX) ADDQ $0x03, AX @@ -13106,7 +13184,7 @@ two_bytes_match_emit_encodeSnappyBlockAsm10B: MOVB DI, 1(AX) ADDQ $0x02, AX CMPL DI, $0x40 - JL memmove_match_emit_encodeSnappyBlockAsm10B + JB memmove_match_emit_encodeSnappyBlockAsm10B JMP memmove_long_match_emit_encodeSnappyBlockAsm10B one_byte_match_emit_encodeSnappyBlockAsm10B: @@ -13119,7 +13197,7 @@ memmove_match_emit_encodeSnappyBlockAsm10B: // genMemMoveShort CMPQ R8, $0x08 - JLE emit_lit_memmove_match_emit_encodeSnappyBlockAsm10B_memmove_move_8 + JBE emit_lit_memmove_match_emit_encodeSnappyBlockAsm10B_memmove_move_8 CMPQ R8, $0x10 JBE emit_lit_memmove_match_emit_encodeSnappyBlockAsm10B_memmove_move_8through16 CMPQ R8, $0x20 @@ -13218,7 +13296,7 @@ match_nolit_loop_encodeSnappyBlockAsm10B: // matchLen XORL R9, R9 CMPL SI, $0x08 - JL matchlen_match4_match_nolit_encodeSnappyBlockAsm10B + JB matchlen_match4_match_nolit_encodeSnappyBlockAsm10B matchlen_loopback_match_nolit_encodeSnappyBlockAsm10B: MOVQ (DI)(R9*1), R8 @@ -13241,12 +13319,12 @@ matchlen_loop_match_nolit_encodeSnappyBlockAsm10B: LEAL -8(SI), SI LEAL 8(R9), R9 CMPL SI, $0x08 - JGE matchlen_loopback_match_nolit_encodeSnappyBlockAsm10B + JAE matchlen_loopback_match_nolit_encodeSnappyBlockAsm10B JZ match_nolit_end_encodeSnappyBlockAsm10B matchlen_match4_match_nolit_encodeSnappyBlockAsm10B: CMPL SI, $0x04 - JL matchlen_match2_match_nolit_encodeSnappyBlockAsm10B + JB matchlen_match2_match_nolit_encodeSnappyBlockAsm10B MOVL (DI)(R9*1), R8 CMPL (BX)(R9*1), R8 JNE matchlen_match2_match_nolit_encodeSnappyBlockAsm10B @@ -13255,7 +13333,7 @@ matchlen_match4_match_nolit_encodeSnappyBlockAsm10B: matchlen_match2_match_nolit_encodeSnappyBlockAsm10B: CMPL SI, $0x02 - JL matchlen_match1_match_nolit_encodeSnappyBlockAsm10B + JB matchlen_match1_match_nolit_encodeSnappyBlockAsm10B MOVW (DI)(R9*1), R8 CMPW (BX)(R9*1), R8 JNE matchlen_match1_match_nolit_encodeSnappyBlockAsm10B @@ -13264,7 +13342,7 @@ matchlen_match2_match_nolit_encodeSnappyBlockAsm10B: matchlen_match1_match_nolit_encodeSnappyBlockAsm10B: CMPL SI, $0x01 - JL match_nolit_end_encodeSnappyBlockAsm10B + JB match_nolit_end_encodeSnappyBlockAsm10B MOVB (DI)(R9*1), R8 CMPB (BX)(R9*1), R8 JNE match_nolit_end_encodeSnappyBlockAsm10B @@ -13279,7 +13357,7 @@ match_nolit_end_encodeSnappyBlockAsm10B: // emitCopy two_byte_offset_match_nolit_encodeSnappyBlockAsm10B: CMPL R9, $0x40 - JLE two_byte_offset_short_match_nolit_encodeSnappyBlockAsm10B + JBE two_byte_offset_short_match_nolit_encodeSnappyBlockAsm10B MOVB $0xee, (AX) MOVW BX, 1(AX) LEAL -60(R9), R9 @@ -13290,9 +13368,9 @@ two_byte_offset_short_match_nolit_encodeSnappyBlockAsm10B: MOVL R9, SI SHLL $0x02, SI CMPL R9, $0x0c - JGE emit_copy_three_match_nolit_encodeSnappyBlockAsm10B + JAE emit_copy_three_match_nolit_encodeSnappyBlockAsm10B CMPL BX, $0x00000800 - JGE emit_copy_three_match_nolit_encodeSnappyBlockAsm10B + JAE emit_copy_three_match_nolit_encodeSnappyBlockAsm10B LEAL -15(SI), SI MOVB BL, 1(AX) SHRL $0x08, BX @@ -13310,10 +13388,10 @@ emit_copy_three_match_nolit_encodeSnappyBlockAsm10B: match_nolit_emitcopy_end_encodeSnappyBlockAsm10B: CMPL CX, 8(SP) - JGE emit_remainder_encodeSnappyBlockAsm10B + JAE emit_remainder_encodeSnappyBlockAsm10B MOVQ -2(DX)(CX*1), SI CMPQ AX, (SP) - JL match_nolit_dst_ok_encodeSnappyBlockAsm10B + JB match_nolit_dst_ok_encodeSnappyBlockAsm10B MOVQ $0x00000000, ret+48(FP) RET @@ -13343,7 +13421,7 @@ emit_remainder_encodeSnappyBlockAsm10B: SUBL 12(SP), CX LEAQ 3(AX)(CX*1), CX CMPQ CX, (SP) - JL emit_remainder_ok_encodeSnappyBlockAsm10B + JB emit_remainder_ok_encodeSnappyBlockAsm10B MOVQ $0x00000000, ret+48(FP) RET @@ -13358,9 +13436,12 @@ emit_remainder_ok_encodeSnappyBlockAsm10B: SUBL BX, SI LEAL -1(SI), DX CMPL DX, $0x3c - JLT one_byte_emit_remainder_encodeSnappyBlockAsm10B + JB one_byte_emit_remainder_encodeSnappyBlockAsm10B CMPL DX, $0x00000100 - JLT two_bytes_emit_remainder_encodeSnappyBlockAsm10B + JB two_bytes_emit_remainder_encodeSnappyBlockAsm10B + JB three_bytes_emit_remainder_encodeSnappyBlockAsm10B + +three_bytes_emit_remainder_encodeSnappyBlockAsm10B: MOVB $0xf4, (AX) MOVW DX, 1(AX) ADDQ $0x03, AX @@ -13371,7 +13452,7 @@ two_bytes_emit_remainder_encodeSnappyBlockAsm10B: MOVB DL, 1(AX) ADDQ $0x02, AX CMPL DX, $0x40 - JL memmove_emit_remainder_encodeSnappyBlockAsm10B + JB memmove_emit_remainder_encodeSnappyBlockAsm10B JMP memmove_long_emit_remainder_encodeSnappyBlockAsm10B one_byte_emit_remainder_encodeSnappyBlockAsm10B: @@ -13534,7 +13615,7 @@ search_loop_encodeSnappyBlockAsm8B: SHRL $0x04, BX LEAL 4(CX)(BX*1), BX CMPL BX, 8(SP) - JGE emit_remainder_encodeSnappyBlockAsm8B + JAE emit_remainder_encodeSnappyBlockAsm8B MOVQ (DX)(CX*1), SI MOVL BX, 20(SP) MOVQ $0x9e3779b1, R8 @@ -13572,7 +13653,7 @@ search_loop_encodeSnappyBlockAsm8B: repeat_extend_back_loop_encodeSnappyBlockAsm8B: CMPL SI, BX - JLE repeat_extend_back_end_encodeSnappyBlockAsm8B + JBE repeat_extend_back_end_encodeSnappyBlockAsm8B MOVB -1(DX)(DI*1), R8 MOVB -1(DX)(SI*1), R9 CMPB R8, R9 @@ -13591,9 +13672,12 @@ repeat_extend_back_end_encodeSnappyBlockAsm8B: SUBL BX, DI LEAL -1(DI), BX CMPL BX, $0x3c - JLT one_byte_repeat_emit_encodeSnappyBlockAsm8B + JB one_byte_repeat_emit_encodeSnappyBlockAsm8B CMPL BX, $0x00000100 - JLT two_bytes_repeat_emit_encodeSnappyBlockAsm8B + JB two_bytes_repeat_emit_encodeSnappyBlockAsm8B + JB three_bytes_repeat_emit_encodeSnappyBlockAsm8B + +three_bytes_repeat_emit_encodeSnappyBlockAsm8B: MOVB $0xf4, (AX) MOVW BX, 1(AX) ADDQ $0x03, AX @@ -13604,7 +13688,7 @@ two_bytes_repeat_emit_encodeSnappyBlockAsm8B: MOVB BL, 1(AX) ADDQ $0x02, AX CMPL BX, $0x40 - JL memmove_repeat_emit_encodeSnappyBlockAsm8B + JB memmove_repeat_emit_encodeSnappyBlockAsm8B JMP memmove_long_repeat_emit_encodeSnappyBlockAsm8B one_byte_repeat_emit_encodeSnappyBlockAsm8B: @@ -13617,7 +13701,7 @@ memmove_repeat_emit_encodeSnappyBlockAsm8B: // genMemMoveShort CMPQ DI, $0x08 - JLE emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm8B_memmove_move_8 + JBE emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm8B_memmove_move_8 CMPQ DI, $0x10 JBE emit_lit_memmove_repeat_emit_encodeSnappyBlockAsm8B_memmove_move_8through16 CMPQ DI, $0x20 @@ -13713,7 +13797,7 @@ emit_literal_done_repeat_emit_encodeSnappyBlockAsm8B: // matchLen XORL R10, R10 CMPL DI, $0x08 - JL matchlen_match4_repeat_extend_encodeSnappyBlockAsm8B + JB matchlen_match4_repeat_extend_encodeSnappyBlockAsm8B matchlen_loopback_repeat_extend_encodeSnappyBlockAsm8B: MOVQ (R8)(R10*1), R9 @@ -13736,12 +13820,12 @@ matchlen_loop_repeat_extend_encodeSnappyBlockAsm8B: LEAL -8(DI), DI LEAL 8(R10), R10 CMPL DI, $0x08 - JGE matchlen_loopback_repeat_extend_encodeSnappyBlockAsm8B + JAE matchlen_loopback_repeat_extend_encodeSnappyBlockAsm8B JZ repeat_extend_forward_end_encodeSnappyBlockAsm8B matchlen_match4_repeat_extend_encodeSnappyBlockAsm8B: CMPL DI, $0x04 - JL matchlen_match2_repeat_extend_encodeSnappyBlockAsm8B + JB matchlen_match2_repeat_extend_encodeSnappyBlockAsm8B MOVL (R8)(R10*1), R9 CMPL (BX)(R10*1), R9 JNE matchlen_match2_repeat_extend_encodeSnappyBlockAsm8B @@ -13750,7 +13834,7 @@ matchlen_match4_repeat_extend_encodeSnappyBlockAsm8B: matchlen_match2_repeat_extend_encodeSnappyBlockAsm8B: CMPL DI, $0x02 - JL matchlen_match1_repeat_extend_encodeSnappyBlockAsm8B + JB matchlen_match1_repeat_extend_encodeSnappyBlockAsm8B MOVW (R8)(R10*1), R9 CMPW (BX)(R10*1), R9 JNE matchlen_match1_repeat_extend_encodeSnappyBlockAsm8B @@ -13759,7 +13843,7 @@ matchlen_match2_repeat_extend_encodeSnappyBlockAsm8B: matchlen_match1_repeat_extend_encodeSnappyBlockAsm8B: CMPL DI, $0x01 - JL repeat_extend_forward_end_encodeSnappyBlockAsm8B + JB repeat_extend_forward_end_encodeSnappyBlockAsm8B MOVB (R8)(R10*1), R9 CMPB (BX)(R10*1), R9 JNE repeat_extend_forward_end_encodeSnappyBlockAsm8B @@ -13774,7 +13858,7 @@ repeat_extend_forward_end_encodeSnappyBlockAsm8B: // emitCopy two_byte_offset_repeat_as_copy_encodeSnappyBlockAsm8B: CMPL BX, $0x40 - JLE two_byte_offset_short_repeat_as_copy_encodeSnappyBlockAsm8B + JBE two_byte_offset_short_repeat_as_copy_encodeSnappyBlockAsm8B MOVB $0xee, (AX) MOVW SI, 1(AX) LEAL -60(BX), BX @@ -13785,7 +13869,7 @@ two_byte_offset_short_repeat_as_copy_encodeSnappyBlockAsm8B: MOVL BX, DI SHLL $0x02, DI CMPL BX, $0x0c - JGE emit_copy_three_repeat_as_copy_encodeSnappyBlockAsm8B + JAE emit_copy_three_repeat_as_copy_encodeSnappyBlockAsm8B LEAL -15(DI), DI MOVB SI, 1(AX) SHRL $0x08, SI @@ -13836,7 +13920,7 @@ candidate_match_encodeSnappyBlockAsm8B: match_extend_back_loop_encodeSnappyBlockAsm8B: CMPL CX, SI - JLE match_extend_back_end_encodeSnappyBlockAsm8B + JBE match_extend_back_end_encodeSnappyBlockAsm8B MOVB -1(DX)(BX*1), DI MOVB -1(DX)(CX*1), R8 CMPB DI, R8 @@ -13851,7 +13935,7 @@ match_extend_back_end_encodeSnappyBlockAsm8B: SUBL 12(SP), SI LEAQ 3(AX)(SI*1), SI CMPQ SI, (SP) - JL match_dst_size_check_encodeSnappyBlockAsm8B + JB match_dst_size_check_encodeSnappyBlockAsm8B MOVQ $0x00000000, ret+48(FP) RET @@ -13866,9 +13950,12 @@ match_dst_size_check_encodeSnappyBlockAsm8B: SUBL DI, R8 LEAL -1(R8), DI CMPL DI, $0x3c - JLT one_byte_match_emit_encodeSnappyBlockAsm8B + JB one_byte_match_emit_encodeSnappyBlockAsm8B CMPL DI, $0x00000100 - JLT two_bytes_match_emit_encodeSnappyBlockAsm8B + JB two_bytes_match_emit_encodeSnappyBlockAsm8B + JB three_bytes_match_emit_encodeSnappyBlockAsm8B + +three_bytes_match_emit_encodeSnappyBlockAsm8B: MOVB $0xf4, (AX) MOVW DI, 1(AX) ADDQ $0x03, AX @@ -13879,7 +13966,7 @@ two_bytes_match_emit_encodeSnappyBlockAsm8B: MOVB DI, 1(AX) ADDQ $0x02, AX CMPL DI, $0x40 - JL memmove_match_emit_encodeSnappyBlockAsm8B + JB memmove_match_emit_encodeSnappyBlockAsm8B JMP memmove_long_match_emit_encodeSnappyBlockAsm8B one_byte_match_emit_encodeSnappyBlockAsm8B: @@ -13892,7 +13979,7 @@ memmove_match_emit_encodeSnappyBlockAsm8B: // genMemMoveShort CMPQ R8, $0x08 - JLE emit_lit_memmove_match_emit_encodeSnappyBlockAsm8B_memmove_move_8 + JBE emit_lit_memmove_match_emit_encodeSnappyBlockAsm8B_memmove_move_8 CMPQ R8, $0x10 JBE emit_lit_memmove_match_emit_encodeSnappyBlockAsm8B_memmove_move_8through16 CMPQ R8, $0x20 @@ -13991,7 +14078,7 @@ match_nolit_loop_encodeSnappyBlockAsm8B: // matchLen XORL R9, R9 CMPL SI, $0x08 - JL matchlen_match4_match_nolit_encodeSnappyBlockAsm8B + JB matchlen_match4_match_nolit_encodeSnappyBlockAsm8B matchlen_loopback_match_nolit_encodeSnappyBlockAsm8B: MOVQ (DI)(R9*1), R8 @@ -14014,12 +14101,12 @@ matchlen_loop_match_nolit_encodeSnappyBlockAsm8B: LEAL -8(SI), SI LEAL 8(R9), R9 CMPL SI, $0x08 - JGE matchlen_loopback_match_nolit_encodeSnappyBlockAsm8B + JAE matchlen_loopback_match_nolit_encodeSnappyBlockAsm8B JZ match_nolit_end_encodeSnappyBlockAsm8B matchlen_match4_match_nolit_encodeSnappyBlockAsm8B: CMPL SI, $0x04 - JL matchlen_match2_match_nolit_encodeSnappyBlockAsm8B + JB matchlen_match2_match_nolit_encodeSnappyBlockAsm8B MOVL (DI)(R9*1), R8 CMPL (BX)(R9*1), R8 JNE matchlen_match2_match_nolit_encodeSnappyBlockAsm8B @@ -14028,7 +14115,7 @@ matchlen_match4_match_nolit_encodeSnappyBlockAsm8B: matchlen_match2_match_nolit_encodeSnappyBlockAsm8B: CMPL SI, $0x02 - JL matchlen_match1_match_nolit_encodeSnappyBlockAsm8B + JB matchlen_match1_match_nolit_encodeSnappyBlockAsm8B MOVW (DI)(R9*1), R8 CMPW (BX)(R9*1), R8 JNE matchlen_match1_match_nolit_encodeSnappyBlockAsm8B @@ -14037,7 +14124,7 @@ matchlen_match2_match_nolit_encodeSnappyBlockAsm8B: matchlen_match1_match_nolit_encodeSnappyBlockAsm8B: CMPL SI, $0x01 - JL match_nolit_end_encodeSnappyBlockAsm8B + JB match_nolit_end_encodeSnappyBlockAsm8B MOVB (DI)(R9*1), R8 CMPB (BX)(R9*1), R8 JNE match_nolit_end_encodeSnappyBlockAsm8B @@ -14052,7 +14139,7 @@ match_nolit_end_encodeSnappyBlockAsm8B: // emitCopy two_byte_offset_match_nolit_encodeSnappyBlockAsm8B: CMPL R9, $0x40 - JLE two_byte_offset_short_match_nolit_encodeSnappyBlockAsm8B + JBE two_byte_offset_short_match_nolit_encodeSnappyBlockAsm8B MOVB $0xee, (AX) MOVW BX, 1(AX) LEAL -60(R9), R9 @@ -14063,7 +14150,7 @@ two_byte_offset_short_match_nolit_encodeSnappyBlockAsm8B: MOVL R9, SI SHLL $0x02, SI CMPL R9, $0x0c - JGE emit_copy_three_match_nolit_encodeSnappyBlockAsm8B + JAE emit_copy_three_match_nolit_encodeSnappyBlockAsm8B LEAL -15(SI), SI MOVB BL, 1(AX) SHRL $0x08, BX @@ -14081,10 +14168,10 @@ emit_copy_three_match_nolit_encodeSnappyBlockAsm8B: match_nolit_emitcopy_end_encodeSnappyBlockAsm8B: CMPL CX, 8(SP) - JGE emit_remainder_encodeSnappyBlockAsm8B + JAE emit_remainder_encodeSnappyBlockAsm8B MOVQ -2(DX)(CX*1), SI CMPQ AX, (SP) - JL match_nolit_dst_ok_encodeSnappyBlockAsm8B + JB match_nolit_dst_ok_encodeSnappyBlockAsm8B MOVQ $0x00000000, ret+48(FP) RET @@ -14114,7 +14201,7 @@ emit_remainder_encodeSnappyBlockAsm8B: SUBL 12(SP), CX LEAQ 3(AX)(CX*1), CX CMPQ CX, (SP) - JL emit_remainder_ok_encodeSnappyBlockAsm8B + JB emit_remainder_ok_encodeSnappyBlockAsm8B MOVQ $0x00000000, ret+48(FP) RET @@ -14129,9 +14216,12 @@ emit_remainder_ok_encodeSnappyBlockAsm8B: SUBL BX, SI LEAL -1(SI), DX CMPL DX, $0x3c - JLT one_byte_emit_remainder_encodeSnappyBlockAsm8B + JB one_byte_emit_remainder_encodeSnappyBlockAsm8B CMPL DX, $0x00000100 - JLT two_bytes_emit_remainder_encodeSnappyBlockAsm8B + JB two_bytes_emit_remainder_encodeSnappyBlockAsm8B + JB three_bytes_emit_remainder_encodeSnappyBlockAsm8B + +three_bytes_emit_remainder_encodeSnappyBlockAsm8B: MOVB $0xf4, (AX) MOVW DX, 1(AX) ADDQ $0x03, AX @@ -14142,7 +14232,7 @@ two_bytes_emit_remainder_encodeSnappyBlockAsm8B: MOVB DL, 1(AX) ADDQ $0x02, AX CMPL DX, $0x40 - JL memmove_emit_remainder_encodeSnappyBlockAsm8B + JB memmove_emit_remainder_encodeSnappyBlockAsm8B JMP memmove_long_emit_remainder_encodeSnappyBlockAsm8B one_byte_emit_remainder_encodeSnappyBlockAsm8B: @@ -14304,7 +14394,7 @@ search_loop_encodeSnappyBetterBlockAsm: SUBL 12(SP), BX SHRL $0x07, BX CMPL BX, $0x63 - JLE check_maxskip_ok_encodeSnappyBetterBlockAsm + JBE check_maxskip_ok_encodeSnappyBetterBlockAsm LEAL 100(CX), BX JMP check_maxskip_cont_encodeSnappyBetterBlockAsm @@ -14313,7 +14403,7 @@ check_maxskip_ok_encodeSnappyBetterBlockAsm: check_maxskip_cont_encodeSnappyBetterBlockAsm: CMPL BX, 8(SP) - JGE emit_remainder_encodeSnappyBetterBlockAsm + JAE emit_remainder_encodeSnappyBetterBlockAsm MOVQ (DX)(CX*1), SI MOVL BX, 20(SP) MOVQ $0x00cf1bbcdcbfa563, R8 @@ -14368,7 +14458,7 @@ candidate_match_encodeSnappyBetterBlockAsm: match_extend_back_loop_encodeSnappyBetterBlockAsm: CMPL CX, SI - JLE match_extend_back_end_encodeSnappyBetterBlockAsm + JBE match_extend_back_end_encodeSnappyBetterBlockAsm MOVB -1(DX)(BX*1), DI MOVB -1(DX)(CX*1), R8 CMPB DI, R8 @@ -14383,7 +14473,7 @@ match_extend_back_end_encodeSnappyBetterBlockAsm: SUBL 12(SP), SI LEAQ 5(AX)(SI*1), SI CMPQ SI, (SP) - JL match_dst_size_check_encodeSnappyBetterBlockAsm + JB match_dst_size_check_encodeSnappyBetterBlockAsm MOVQ $0x00000000, ret+48(FP) RET @@ -14399,7 +14489,7 @@ match_dst_size_check_encodeSnappyBetterBlockAsm: // matchLen XORL R11, R11 CMPL DI, $0x08 - JL matchlen_match4_match_nolit_encodeSnappyBetterBlockAsm + JB matchlen_match4_match_nolit_encodeSnappyBetterBlockAsm matchlen_loopback_match_nolit_encodeSnappyBetterBlockAsm: MOVQ (R8)(R11*1), R10 @@ -14422,12 +14512,12 @@ matchlen_loop_match_nolit_encodeSnappyBetterBlockAsm: LEAL -8(DI), DI LEAL 8(R11), R11 CMPL DI, $0x08 - JGE matchlen_loopback_match_nolit_encodeSnappyBetterBlockAsm + JAE matchlen_loopback_match_nolit_encodeSnappyBetterBlockAsm JZ match_nolit_end_encodeSnappyBetterBlockAsm matchlen_match4_match_nolit_encodeSnappyBetterBlockAsm: CMPL DI, $0x04 - JL matchlen_match2_match_nolit_encodeSnappyBetterBlockAsm + JB matchlen_match2_match_nolit_encodeSnappyBetterBlockAsm MOVL (R8)(R11*1), R10 CMPL (R9)(R11*1), R10 JNE matchlen_match2_match_nolit_encodeSnappyBetterBlockAsm @@ -14436,7 +14526,7 @@ matchlen_match4_match_nolit_encodeSnappyBetterBlockAsm: matchlen_match2_match_nolit_encodeSnappyBetterBlockAsm: CMPL DI, $0x02 - JL matchlen_match1_match_nolit_encodeSnappyBetterBlockAsm + JB matchlen_match1_match_nolit_encodeSnappyBetterBlockAsm MOVW (R8)(R11*1), R10 CMPW (R9)(R11*1), R10 JNE matchlen_match1_match_nolit_encodeSnappyBetterBlockAsm @@ -14445,7 +14535,7 @@ matchlen_match2_match_nolit_encodeSnappyBetterBlockAsm: matchlen_match1_match_nolit_encodeSnappyBetterBlockAsm: CMPL DI, $0x01 - JL match_nolit_end_encodeSnappyBetterBlockAsm + JB match_nolit_end_encodeSnappyBetterBlockAsm MOVB (R8)(R11*1), R10 CMPB (R9)(R11*1), R10 JNE match_nolit_end_encodeSnappyBetterBlockAsm @@ -14457,9 +14547,9 @@ match_nolit_end_encodeSnappyBetterBlockAsm: // Check if repeat CMPL R11, $0x01 - JG match_length_ok_encodeSnappyBetterBlockAsm + JA match_length_ok_encodeSnappyBetterBlockAsm CMPL DI, $0x0000ffff - JLE match_length_ok_encodeSnappyBetterBlockAsm + JBE match_length_ok_encodeSnappyBetterBlockAsm MOVL 20(SP), CX INCL CX JMP search_loop_encodeSnappyBetterBlockAsm @@ -14475,13 +14565,13 @@ match_length_ok_encodeSnappyBetterBlockAsm: SUBL BX, R8 LEAL -1(R8), BX CMPL BX, $0x3c - JLT one_byte_match_emit_encodeSnappyBetterBlockAsm + JB one_byte_match_emit_encodeSnappyBetterBlockAsm CMPL BX, $0x00000100 - JLT two_bytes_match_emit_encodeSnappyBetterBlockAsm + JB two_bytes_match_emit_encodeSnappyBetterBlockAsm CMPL BX, $0x00010000 - JLT three_bytes_match_emit_encodeSnappyBetterBlockAsm + JB three_bytes_match_emit_encodeSnappyBetterBlockAsm CMPL BX, $0x01000000 - JLT four_bytes_match_emit_encodeSnappyBetterBlockAsm + JB four_bytes_match_emit_encodeSnappyBetterBlockAsm MOVB $0xfc, (AX) MOVL BX, 1(AX) ADDQ $0x05, AX @@ -14507,7 +14597,7 @@ two_bytes_match_emit_encodeSnappyBetterBlockAsm: MOVB BL, 1(AX) ADDQ $0x02, AX CMPL BX, $0x40 - JL memmove_match_emit_encodeSnappyBetterBlockAsm + JB memmove_match_emit_encodeSnappyBetterBlockAsm JMP memmove_long_match_emit_encodeSnappyBetterBlockAsm one_byte_match_emit_encodeSnappyBetterBlockAsm: @@ -14520,7 +14610,7 @@ memmove_match_emit_encodeSnappyBetterBlockAsm: // genMemMoveShort CMPQ R8, $0x08 - JLE emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm_memmove_move_8 + JBE emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm_memmove_move_8 CMPQ R8, $0x10 JBE emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm_memmove_move_8through16 CMPQ R8, $0x20 @@ -14611,17 +14701,17 @@ emit_literal_done_match_emit_encodeSnappyBetterBlockAsm: // emitCopy CMPL DI, $0x00010000 - JL two_byte_offset_match_nolit_encodeSnappyBetterBlockAsm + JB two_byte_offset_match_nolit_encodeSnappyBetterBlockAsm four_bytes_loop_back_match_nolit_encodeSnappyBetterBlockAsm: CMPL R11, $0x40 - JLE four_bytes_remain_match_nolit_encodeSnappyBetterBlockAsm + JBE four_bytes_remain_match_nolit_encodeSnappyBetterBlockAsm MOVB $0xff, (AX) MOVL DI, 1(AX) LEAL -64(R11), R11 ADDQ $0x05, AX CMPL R11, $0x04 - JL four_bytes_remain_match_nolit_encodeSnappyBetterBlockAsm + JB four_bytes_remain_match_nolit_encodeSnappyBetterBlockAsm JMP four_bytes_loop_back_match_nolit_encodeSnappyBetterBlockAsm four_bytes_remain_match_nolit_encodeSnappyBetterBlockAsm: @@ -14636,7 +14726,7 @@ four_bytes_remain_match_nolit_encodeSnappyBetterBlockAsm: two_byte_offset_match_nolit_encodeSnappyBetterBlockAsm: CMPL R11, $0x40 - JLE two_byte_offset_short_match_nolit_encodeSnappyBetterBlockAsm + JBE two_byte_offset_short_match_nolit_encodeSnappyBetterBlockAsm MOVB $0xee, (AX) MOVW DI, 1(AX) LEAL -60(R11), R11 @@ -14647,9 +14737,9 @@ two_byte_offset_short_match_nolit_encodeSnappyBetterBlockAsm: MOVL R11, BX SHLL $0x02, BX CMPL R11, $0x0c - JGE emit_copy_three_match_nolit_encodeSnappyBetterBlockAsm + JAE emit_copy_three_match_nolit_encodeSnappyBetterBlockAsm CMPL DI, $0x00000800 - JGE emit_copy_three_match_nolit_encodeSnappyBetterBlockAsm + JAE emit_copy_three_match_nolit_encodeSnappyBetterBlockAsm LEAL -15(BX), BX MOVB DI, 1(AX) SHRL $0x08, DI @@ -14667,9 +14757,9 @@ emit_copy_three_match_nolit_encodeSnappyBetterBlockAsm: match_nolit_emitcopy_end_encodeSnappyBetterBlockAsm: CMPL CX, 8(SP) - JGE emit_remainder_encodeSnappyBetterBlockAsm + JAE emit_remainder_encodeSnappyBetterBlockAsm CMPQ AX, (SP) - JL match_nolit_dst_ok_encodeSnappyBetterBlockAsm + JB match_nolit_dst_ok_encodeSnappyBetterBlockAsm MOVQ $0x00000000, ret+48(FP) RET @@ -14725,7 +14815,7 @@ emit_remainder_encodeSnappyBetterBlockAsm: SUBL 12(SP), CX LEAQ 5(AX)(CX*1), CX CMPQ CX, (SP) - JL emit_remainder_ok_encodeSnappyBetterBlockAsm + JB emit_remainder_ok_encodeSnappyBetterBlockAsm MOVQ $0x00000000, ret+48(FP) RET @@ -14740,13 +14830,13 @@ emit_remainder_ok_encodeSnappyBetterBlockAsm: SUBL BX, SI LEAL -1(SI), DX CMPL DX, $0x3c - JLT one_byte_emit_remainder_encodeSnappyBetterBlockAsm + JB one_byte_emit_remainder_encodeSnappyBetterBlockAsm CMPL DX, $0x00000100 - JLT two_bytes_emit_remainder_encodeSnappyBetterBlockAsm + JB two_bytes_emit_remainder_encodeSnappyBetterBlockAsm CMPL DX, $0x00010000 - JLT three_bytes_emit_remainder_encodeSnappyBetterBlockAsm + JB three_bytes_emit_remainder_encodeSnappyBetterBlockAsm CMPL DX, $0x01000000 - JLT four_bytes_emit_remainder_encodeSnappyBetterBlockAsm + JB four_bytes_emit_remainder_encodeSnappyBetterBlockAsm MOVB $0xfc, (AX) MOVL DX, 1(AX) ADDQ $0x05, AX @@ -14772,7 +14862,7 @@ two_bytes_emit_remainder_encodeSnappyBetterBlockAsm: MOVB DL, 1(AX) ADDQ $0x02, AX CMPL DX, $0x40 - JL memmove_emit_remainder_encodeSnappyBetterBlockAsm + JB memmove_emit_remainder_encodeSnappyBetterBlockAsm JMP memmove_long_emit_remainder_encodeSnappyBetterBlockAsm one_byte_emit_remainder_encodeSnappyBetterBlockAsm: @@ -14935,7 +15025,7 @@ search_loop_encodeSnappyBetterBlockAsm64K: SHRL $0x07, BX LEAL 1(CX)(BX*1), BX CMPL BX, 8(SP) - JGE emit_remainder_encodeSnappyBetterBlockAsm64K + JAE emit_remainder_encodeSnappyBetterBlockAsm64K MOVQ (DX)(CX*1), SI MOVL BX, 20(SP) MOVQ $0x00cf1bbcdcbfa563, R8 @@ -14990,7 +15080,7 @@ candidate_match_encodeSnappyBetterBlockAsm64K: match_extend_back_loop_encodeSnappyBetterBlockAsm64K: CMPL CX, SI - JLE match_extend_back_end_encodeSnappyBetterBlockAsm64K + JBE match_extend_back_end_encodeSnappyBetterBlockAsm64K MOVB -1(DX)(BX*1), DI MOVB -1(DX)(CX*1), R8 CMPB DI, R8 @@ -15005,7 +15095,7 @@ match_extend_back_end_encodeSnappyBetterBlockAsm64K: SUBL 12(SP), SI LEAQ 3(AX)(SI*1), SI CMPQ SI, (SP) - JL match_dst_size_check_encodeSnappyBetterBlockAsm64K + JB match_dst_size_check_encodeSnappyBetterBlockAsm64K MOVQ $0x00000000, ret+48(FP) RET @@ -15021,7 +15111,7 @@ match_dst_size_check_encodeSnappyBetterBlockAsm64K: // matchLen XORL R11, R11 CMPL DI, $0x08 - JL matchlen_match4_match_nolit_encodeSnappyBetterBlockAsm64K + JB matchlen_match4_match_nolit_encodeSnappyBetterBlockAsm64K matchlen_loopback_match_nolit_encodeSnappyBetterBlockAsm64K: MOVQ (R8)(R11*1), R10 @@ -15044,12 +15134,12 @@ matchlen_loop_match_nolit_encodeSnappyBetterBlockAsm64K: LEAL -8(DI), DI LEAL 8(R11), R11 CMPL DI, $0x08 - JGE matchlen_loopback_match_nolit_encodeSnappyBetterBlockAsm64K + JAE matchlen_loopback_match_nolit_encodeSnappyBetterBlockAsm64K JZ match_nolit_end_encodeSnappyBetterBlockAsm64K matchlen_match4_match_nolit_encodeSnappyBetterBlockAsm64K: CMPL DI, $0x04 - JL matchlen_match2_match_nolit_encodeSnappyBetterBlockAsm64K + JB matchlen_match2_match_nolit_encodeSnappyBetterBlockAsm64K MOVL (R8)(R11*1), R10 CMPL (R9)(R11*1), R10 JNE matchlen_match2_match_nolit_encodeSnappyBetterBlockAsm64K @@ -15058,7 +15148,7 @@ matchlen_match4_match_nolit_encodeSnappyBetterBlockAsm64K: matchlen_match2_match_nolit_encodeSnappyBetterBlockAsm64K: CMPL DI, $0x02 - JL matchlen_match1_match_nolit_encodeSnappyBetterBlockAsm64K + JB matchlen_match1_match_nolit_encodeSnappyBetterBlockAsm64K MOVW (R8)(R11*1), R10 CMPW (R9)(R11*1), R10 JNE matchlen_match1_match_nolit_encodeSnappyBetterBlockAsm64K @@ -15067,7 +15157,7 @@ matchlen_match2_match_nolit_encodeSnappyBetterBlockAsm64K: matchlen_match1_match_nolit_encodeSnappyBetterBlockAsm64K: CMPL DI, $0x01 - JL match_nolit_end_encodeSnappyBetterBlockAsm64K + JB match_nolit_end_encodeSnappyBetterBlockAsm64K MOVB (R8)(R11*1), R10 CMPB (R9)(R11*1), R10 JNE match_nolit_end_encodeSnappyBetterBlockAsm64K @@ -15088,9 +15178,12 @@ match_nolit_end_encodeSnappyBetterBlockAsm64K: SUBL BX, R8 LEAL -1(R8), BX CMPL BX, $0x3c - JLT one_byte_match_emit_encodeSnappyBetterBlockAsm64K + JB one_byte_match_emit_encodeSnappyBetterBlockAsm64K CMPL BX, $0x00000100 - JLT two_bytes_match_emit_encodeSnappyBetterBlockAsm64K + JB two_bytes_match_emit_encodeSnappyBetterBlockAsm64K + JB three_bytes_match_emit_encodeSnappyBetterBlockAsm64K + +three_bytes_match_emit_encodeSnappyBetterBlockAsm64K: MOVB $0xf4, (AX) MOVW BX, 1(AX) ADDQ $0x03, AX @@ -15101,7 +15194,7 @@ two_bytes_match_emit_encodeSnappyBetterBlockAsm64K: MOVB BL, 1(AX) ADDQ $0x02, AX CMPL BX, $0x40 - JL memmove_match_emit_encodeSnappyBetterBlockAsm64K + JB memmove_match_emit_encodeSnappyBetterBlockAsm64K JMP memmove_long_match_emit_encodeSnappyBetterBlockAsm64K one_byte_match_emit_encodeSnappyBetterBlockAsm64K: @@ -15114,7 +15207,7 @@ memmove_match_emit_encodeSnappyBetterBlockAsm64K: // genMemMoveShort CMPQ R8, $0x08 - JLE emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm64K_memmove_move_8 + JBE emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm64K_memmove_move_8 CMPQ R8, $0x10 JBE emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm64K_memmove_move_8through16 CMPQ R8, $0x20 @@ -15206,7 +15299,7 @@ emit_literal_done_match_emit_encodeSnappyBetterBlockAsm64K: // emitCopy two_byte_offset_match_nolit_encodeSnappyBetterBlockAsm64K: CMPL R11, $0x40 - JLE two_byte_offset_short_match_nolit_encodeSnappyBetterBlockAsm64K + JBE two_byte_offset_short_match_nolit_encodeSnappyBetterBlockAsm64K MOVB $0xee, (AX) MOVW DI, 1(AX) LEAL -60(R11), R11 @@ -15217,9 +15310,9 @@ two_byte_offset_short_match_nolit_encodeSnappyBetterBlockAsm64K: MOVL R11, BX SHLL $0x02, BX CMPL R11, $0x0c - JGE emit_copy_three_match_nolit_encodeSnappyBetterBlockAsm64K + JAE emit_copy_three_match_nolit_encodeSnappyBetterBlockAsm64K CMPL DI, $0x00000800 - JGE emit_copy_three_match_nolit_encodeSnappyBetterBlockAsm64K + JAE emit_copy_three_match_nolit_encodeSnappyBetterBlockAsm64K LEAL -15(BX), BX MOVB DI, 1(AX) SHRL $0x08, DI @@ -15237,9 +15330,9 @@ emit_copy_three_match_nolit_encodeSnappyBetterBlockAsm64K: match_nolit_emitcopy_end_encodeSnappyBetterBlockAsm64K: CMPL CX, 8(SP) - JGE emit_remainder_encodeSnappyBetterBlockAsm64K + JAE emit_remainder_encodeSnappyBetterBlockAsm64K CMPQ AX, (SP) - JL match_nolit_dst_ok_encodeSnappyBetterBlockAsm64K + JB match_nolit_dst_ok_encodeSnappyBetterBlockAsm64K MOVQ $0x00000000, ret+48(FP) RET @@ -15295,7 +15388,7 @@ emit_remainder_encodeSnappyBetterBlockAsm64K: SUBL 12(SP), CX LEAQ 3(AX)(CX*1), CX CMPQ CX, (SP) - JL emit_remainder_ok_encodeSnappyBetterBlockAsm64K + JB emit_remainder_ok_encodeSnappyBetterBlockAsm64K MOVQ $0x00000000, ret+48(FP) RET @@ -15310,9 +15403,12 @@ emit_remainder_ok_encodeSnappyBetterBlockAsm64K: SUBL BX, SI LEAL -1(SI), DX CMPL DX, $0x3c - JLT one_byte_emit_remainder_encodeSnappyBetterBlockAsm64K + JB one_byte_emit_remainder_encodeSnappyBetterBlockAsm64K CMPL DX, $0x00000100 - JLT two_bytes_emit_remainder_encodeSnappyBetterBlockAsm64K + JB two_bytes_emit_remainder_encodeSnappyBetterBlockAsm64K + JB three_bytes_emit_remainder_encodeSnappyBetterBlockAsm64K + +three_bytes_emit_remainder_encodeSnappyBetterBlockAsm64K: MOVB $0xf4, (AX) MOVW DX, 1(AX) ADDQ $0x03, AX @@ -15323,7 +15419,7 @@ two_bytes_emit_remainder_encodeSnappyBetterBlockAsm64K: MOVB DL, 1(AX) ADDQ $0x02, AX CMPL DX, $0x40 - JL memmove_emit_remainder_encodeSnappyBetterBlockAsm64K + JB memmove_emit_remainder_encodeSnappyBetterBlockAsm64K JMP memmove_long_emit_remainder_encodeSnappyBetterBlockAsm64K one_byte_emit_remainder_encodeSnappyBetterBlockAsm64K: @@ -15486,7 +15582,7 @@ search_loop_encodeSnappyBetterBlockAsm12B: SHRL $0x06, BX LEAL 1(CX)(BX*1), BX CMPL BX, 8(SP) - JGE emit_remainder_encodeSnappyBetterBlockAsm12B + JAE emit_remainder_encodeSnappyBetterBlockAsm12B MOVQ (DX)(CX*1), SI MOVL BX, 20(SP) MOVQ $0x0000cf1bbcdcbf9b, R8 @@ -15541,7 +15637,7 @@ candidate_match_encodeSnappyBetterBlockAsm12B: match_extend_back_loop_encodeSnappyBetterBlockAsm12B: CMPL CX, SI - JLE match_extend_back_end_encodeSnappyBetterBlockAsm12B + JBE match_extend_back_end_encodeSnappyBetterBlockAsm12B MOVB -1(DX)(BX*1), DI MOVB -1(DX)(CX*1), R8 CMPB DI, R8 @@ -15556,7 +15652,7 @@ match_extend_back_end_encodeSnappyBetterBlockAsm12B: SUBL 12(SP), SI LEAQ 3(AX)(SI*1), SI CMPQ SI, (SP) - JL match_dst_size_check_encodeSnappyBetterBlockAsm12B + JB match_dst_size_check_encodeSnappyBetterBlockAsm12B MOVQ $0x00000000, ret+48(FP) RET @@ -15572,7 +15668,7 @@ match_dst_size_check_encodeSnappyBetterBlockAsm12B: // matchLen XORL R11, R11 CMPL DI, $0x08 - JL matchlen_match4_match_nolit_encodeSnappyBetterBlockAsm12B + JB matchlen_match4_match_nolit_encodeSnappyBetterBlockAsm12B matchlen_loopback_match_nolit_encodeSnappyBetterBlockAsm12B: MOVQ (R8)(R11*1), R10 @@ -15595,12 +15691,12 @@ matchlen_loop_match_nolit_encodeSnappyBetterBlockAsm12B: LEAL -8(DI), DI LEAL 8(R11), R11 CMPL DI, $0x08 - JGE matchlen_loopback_match_nolit_encodeSnappyBetterBlockAsm12B + JAE matchlen_loopback_match_nolit_encodeSnappyBetterBlockAsm12B JZ match_nolit_end_encodeSnappyBetterBlockAsm12B matchlen_match4_match_nolit_encodeSnappyBetterBlockAsm12B: CMPL DI, $0x04 - JL matchlen_match2_match_nolit_encodeSnappyBetterBlockAsm12B + JB matchlen_match2_match_nolit_encodeSnappyBetterBlockAsm12B MOVL (R8)(R11*1), R10 CMPL (R9)(R11*1), R10 JNE matchlen_match2_match_nolit_encodeSnappyBetterBlockAsm12B @@ -15609,7 +15705,7 @@ matchlen_match4_match_nolit_encodeSnappyBetterBlockAsm12B: matchlen_match2_match_nolit_encodeSnappyBetterBlockAsm12B: CMPL DI, $0x02 - JL matchlen_match1_match_nolit_encodeSnappyBetterBlockAsm12B + JB matchlen_match1_match_nolit_encodeSnappyBetterBlockAsm12B MOVW (R8)(R11*1), R10 CMPW (R9)(R11*1), R10 JNE matchlen_match1_match_nolit_encodeSnappyBetterBlockAsm12B @@ -15618,7 +15714,7 @@ matchlen_match2_match_nolit_encodeSnappyBetterBlockAsm12B: matchlen_match1_match_nolit_encodeSnappyBetterBlockAsm12B: CMPL DI, $0x01 - JL match_nolit_end_encodeSnappyBetterBlockAsm12B + JB match_nolit_end_encodeSnappyBetterBlockAsm12B MOVB (R8)(R11*1), R10 CMPB (R9)(R11*1), R10 JNE match_nolit_end_encodeSnappyBetterBlockAsm12B @@ -15639,9 +15735,12 @@ match_nolit_end_encodeSnappyBetterBlockAsm12B: SUBL BX, R8 LEAL -1(R8), BX CMPL BX, $0x3c - JLT one_byte_match_emit_encodeSnappyBetterBlockAsm12B + JB one_byte_match_emit_encodeSnappyBetterBlockAsm12B CMPL BX, $0x00000100 - JLT two_bytes_match_emit_encodeSnappyBetterBlockAsm12B + JB two_bytes_match_emit_encodeSnappyBetterBlockAsm12B + JB three_bytes_match_emit_encodeSnappyBetterBlockAsm12B + +three_bytes_match_emit_encodeSnappyBetterBlockAsm12B: MOVB $0xf4, (AX) MOVW BX, 1(AX) ADDQ $0x03, AX @@ -15652,7 +15751,7 @@ two_bytes_match_emit_encodeSnappyBetterBlockAsm12B: MOVB BL, 1(AX) ADDQ $0x02, AX CMPL BX, $0x40 - JL memmove_match_emit_encodeSnappyBetterBlockAsm12B + JB memmove_match_emit_encodeSnappyBetterBlockAsm12B JMP memmove_long_match_emit_encodeSnappyBetterBlockAsm12B one_byte_match_emit_encodeSnappyBetterBlockAsm12B: @@ -15665,7 +15764,7 @@ memmove_match_emit_encodeSnappyBetterBlockAsm12B: // genMemMoveShort CMPQ R8, $0x08 - JLE emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm12B_memmove_move_8 + JBE emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm12B_memmove_move_8 CMPQ R8, $0x10 JBE emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm12B_memmove_move_8through16 CMPQ R8, $0x20 @@ -15757,7 +15856,7 @@ emit_literal_done_match_emit_encodeSnappyBetterBlockAsm12B: // emitCopy two_byte_offset_match_nolit_encodeSnappyBetterBlockAsm12B: CMPL R11, $0x40 - JLE two_byte_offset_short_match_nolit_encodeSnappyBetterBlockAsm12B + JBE two_byte_offset_short_match_nolit_encodeSnappyBetterBlockAsm12B MOVB $0xee, (AX) MOVW DI, 1(AX) LEAL -60(R11), R11 @@ -15768,9 +15867,9 @@ two_byte_offset_short_match_nolit_encodeSnappyBetterBlockAsm12B: MOVL R11, BX SHLL $0x02, BX CMPL R11, $0x0c - JGE emit_copy_three_match_nolit_encodeSnappyBetterBlockAsm12B + JAE emit_copy_three_match_nolit_encodeSnappyBetterBlockAsm12B CMPL DI, $0x00000800 - JGE emit_copy_three_match_nolit_encodeSnappyBetterBlockAsm12B + JAE emit_copy_three_match_nolit_encodeSnappyBetterBlockAsm12B LEAL -15(BX), BX MOVB DI, 1(AX) SHRL $0x08, DI @@ -15788,9 +15887,9 @@ emit_copy_three_match_nolit_encodeSnappyBetterBlockAsm12B: match_nolit_emitcopy_end_encodeSnappyBetterBlockAsm12B: CMPL CX, 8(SP) - JGE emit_remainder_encodeSnappyBetterBlockAsm12B + JAE emit_remainder_encodeSnappyBetterBlockAsm12B CMPQ AX, (SP) - JL match_nolit_dst_ok_encodeSnappyBetterBlockAsm12B + JB match_nolit_dst_ok_encodeSnappyBetterBlockAsm12B MOVQ $0x00000000, ret+48(FP) RET @@ -15846,7 +15945,7 @@ emit_remainder_encodeSnappyBetterBlockAsm12B: SUBL 12(SP), CX LEAQ 3(AX)(CX*1), CX CMPQ CX, (SP) - JL emit_remainder_ok_encodeSnappyBetterBlockAsm12B + JB emit_remainder_ok_encodeSnappyBetterBlockAsm12B MOVQ $0x00000000, ret+48(FP) RET @@ -15861,9 +15960,12 @@ emit_remainder_ok_encodeSnappyBetterBlockAsm12B: SUBL BX, SI LEAL -1(SI), DX CMPL DX, $0x3c - JLT one_byte_emit_remainder_encodeSnappyBetterBlockAsm12B + JB one_byte_emit_remainder_encodeSnappyBetterBlockAsm12B CMPL DX, $0x00000100 - JLT two_bytes_emit_remainder_encodeSnappyBetterBlockAsm12B + JB two_bytes_emit_remainder_encodeSnappyBetterBlockAsm12B + JB three_bytes_emit_remainder_encodeSnappyBetterBlockAsm12B + +three_bytes_emit_remainder_encodeSnappyBetterBlockAsm12B: MOVB $0xf4, (AX) MOVW DX, 1(AX) ADDQ $0x03, AX @@ -15874,7 +15976,7 @@ two_bytes_emit_remainder_encodeSnappyBetterBlockAsm12B: MOVB DL, 1(AX) ADDQ $0x02, AX CMPL DX, $0x40 - JL memmove_emit_remainder_encodeSnappyBetterBlockAsm12B + JB memmove_emit_remainder_encodeSnappyBetterBlockAsm12B JMP memmove_long_emit_remainder_encodeSnappyBetterBlockAsm12B one_byte_emit_remainder_encodeSnappyBetterBlockAsm12B: @@ -16037,7 +16139,7 @@ search_loop_encodeSnappyBetterBlockAsm10B: SHRL $0x05, BX LEAL 1(CX)(BX*1), BX CMPL BX, 8(SP) - JGE emit_remainder_encodeSnappyBetterBlockAsm10B + JAE emit_remainder_encodeSnappyBetterBlockAsm10B MOVQ (DX)(CX*1), SI MOVL BX, 20(SP) MOVQ $0x0000cf1bbcdcbf9b, R8 @@ -16092,7 +16194,7 @@ candidate_match_encodeSnappyBetterBlockAsm10B: match_extend_back_loop_encodeSnappyBetterBlockAsm10B: CMPL CX, SI - JLE match_extend_back_end_encodeSnappyBetterBlockAsm10B + JBE match_extend_back_end_encodeSnappyBetterBlockAsm10B MOVB -1(DX)(BX*1), DI MOVB -1(DX)(CX*1), R8 CMPB DI, R8 @@ -16107,7 +16209,7 @@ match_extend_back_end_encodeSnappyBetterBlockAsm10B: SUBL 12(SP), SI LEAQ 3(AX)(SI*1), SI CMPQ SI, (SP) - JL match_dst_size_check_encodeSnappyBetterBlockAsm10B + JB match_dst_size_check_encodeSnappyBetterBlockAsm10B MOVQ $0x00000000, ret+48(FP) RET @@ -16123,7 +16225,7 @@ match_dst_size_check_encodeSnappyBetterBlockAsm10B: // matchLen XORL R11, R11 CMPL DI, $0x08 - JL matchlen_match4_match_nolit_encodeSnappyBetterBlockAsm10B + JB matchlen_match4_match_nolit_encodeSnappyBetterBlockAsm10B matchlen_loopback_match_nolit_encodeSnappyBetterBlockAsm10B: MOVQ (R8)(R11*1), R10 @@ -16146,12 +16248,12 @@ matchlen_loop_match_nolit_encodeSnappyBetterBlockAsm10B: LEAL -8(DI), DI LEAL 8(R11), R11 CMPL DI, $0x08 - JGE matchlen_loopback_match_nolit_encodeSnappyBetterBlockAsm10B + JAE matchlen_loopback_match_nolit_encodeSnappyBetterBlockAsm10B JZ match_nolit_end_encodeSnappyBetterBlockAsm10B matchlen_match4_match_nolit_encodeSnappyBetterBlockAsm10B: CMPL DI, $0x04 - JL matchlen_match2_match_nolit_encodeSnappyBetterBlockAsm10B + JB matchlen_match2_match_nolit_encodeSnappyBetterBlockAsm10B MOVL (R8)(R11*1), R10 CMPL (R9)(R11*1), R10 JNE matchlen_match2_match_nolit_encodeSnappyBetterBlockAsm10B @@ -16160,7 +16262,7 @@ matchlen_match4_match_nolit_encodeSnappyBetterBlockAsm10B: matchlen_match2_match_nolit_encodeSnappyBetterBlockAsm10B: CMPL DI, $0x02 - JL matchlen_match1_match_nolit_encodeSnappyBetterBlockAsm10B + JB matchlen_match1_match_nolit_encodeSnappyBetterBlockAsm10B MOVW (R8)(R11*1), R10 CMPW (R9)(R11*1), R10 JNE matchlen_match1_match_nolit_encodeSnappyBetterBlockAsm10B @@ -16169,7 +16271,7 @@ matchlen_match2_match_nolit_encodeSnappyBetterBlockAsm10B: matchlen_match1_match_nolit_encodeSnappyBetterBlockAsm10B: CMPL DI, $0x01 - JL match_nolit_end_encodeSnappyBetterBlockAsm10B + JB match_nolit_end_encodeSnappyBetterBlockAsm10B MOVB (R8)(R11*1), R10 CMPB (R9)(R11*1), R10 JNE match_nolit_end_encodeSnappyBetterBlockAsm10B @@ -16190,9 +16292,12 @@ match_nolit_end_encodeSnappyBetterBlockAsm10B: SUBL BX, R8 LEAL -1(R8), BX CMPL BX, $0x3c - JLT one_byte_match_emit_encodeSnappyBetterBlockAsm10B + JB one_byte_match_emit_encodeSnappyBetterBlockAsm10B CMPL BX, $0x00000100 - JLT two_bytes_match_emit_encodeSnappyBetterBlockAsm10B + JB two_bytes_match_emit_encodeSnappyBetterBlockAsm10B + JB three_bytes_match_emit_encodeSnappyBetterBlockAsm10B + +three_bytes_match_emit_encodeSnappyBetterBlockAsm10B: MOVB $0xf4, (AX) MOVW BX, 1(AX) ADDQ $0x03, AX @@ -16203,7 +16308,7 @@ two_bytes_match_emit_encodeSnappyBetterBlockAsm10B: MOVB BL, 1(AX) ADDQ $0x02, AX CMPL BX, $0x40 - JL memmove_match_emit_encodeSnappyBetterBlockAsm10B + JB memmove_match_emit_encodeSnappyBetterBlockAsm10B JMP memmove_long_match_emit_encodeSnappyBetterBlockAsm10B one_byte_match_emit_encodeSnappyBetterBlockAsm10B: @@ -16216,7 +16321,7 @@ memmove_match_emit_encodeSnappyBetterBlockAsm10B: // genMemMoveShort CMPQ R8, $0x08 - JLE emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm10B_memmove_move_8 + JBE emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm10B_memmove_move_8 CMPQ R8, $0x10 JBE emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm10B_memmove_move_8through16 CMPQ R8, $0x20 @@ -16308,7 +16413,7 @@ emit_literal_done_match_emit_encodeSnappyBetterBlockAsm10B: // emitCopy two_byte_offset_match_nolit_encodeSnappyBetterBlockAsm10B: CMPL R11, $0x40 - JLE two_byte_offset_short_match_nolit_encodeSnappyBetterBlockAsm10B + JBE two_byte_offset_short_match_nolit_encodeSnappyBetterBlockAsm10B MOVB $0xee, (AX) MOVW DI, 1(AX) LEAL -60(R11), R11 @@ -16319,9 +16424,9 @@ two_byte_offset_short_match_nolit_encodeSnappyBetterBlockAsm10B: MOVL R11, BX SHLL $0x02, BX CMPL R11, $0x0c - JGE emit_copy_three_match_nolit_encodeSnappyBetterBlockAsm10B + JAE emit_copy_three_match_nolit_encodeSnappyBetterBlockAsm10B CMPL DI, $0x00000800 - JGE emit_copy_three_match_nolit_encodeSnappyBetterBlockAsm10B + JAE emit_copy_three_match_nolit_encodeSnappyBetterBlockAsm10B LEAL -15(BX), BX MOVB DI, 1(AX) SHRL $0x08, DI @@ -16339,9 +16444,9 @@ emit_copy_three_match_nolit_encodeSnappyBetterBlockAsm10B: match_nolit_emitcopy_end_encodeSnappyBetterBlockAsm10B: CMPL CX, 8(SP) - JGE emit_remainder_encodeSnappyBetterBlockAsm10B + JAE emit_remainder_encodeSnappyBetterBlockAsm10B CMPQ AX, (SP) - JL match_nolit_dst_ok_encodeSnappyBetterBlockAsm10B + JB match_nolit_dst_ok_encodeSnappyBetterBlockAsm10B MOVQ $0x00000000, ret+48(FP) RET @@ -16397,7 +16502,7 @@ emit_remainder_encodeSnappyBetterBlockAsm10B: SUBL 12(SP), CX LEAQ 3(AX)(CX*1), CX CMPQ CX, (SP) - JL emit_remainder_ok_encodeSnappyBetterBlockAsm10B + JB emit_remainder_ok_encodeSnappyBetterBlockAsm10B MOVQ $0x00000000, ret+48(FP) RET @@ -16412,9 +16517,12 @@ emit_remainder_ok_encodeSnappyBetterBlockAsm10B: SUBL BX, SI LEAL -1(SI), DX CMPL DX, $0x3c - JLT one_byte_emit_remainder_encodeSnappyBetterBlockAsm10B + JB one_byte_emit_remainder_encodeSnappyBetterBlockAsm10B CMPL DX, $0x00000100 - JLT two_bytes_emit_remainder_encodeSnappyBetterBlockAsm10B + JB two_bytes_emit_remainder_encodeSnappyBetterBlockAsm10B + JB three_bytes_emit_remainder_encodeSnappyBetterBlockAsm10B + +three_bytes_emit_remainder_encodeSnappyBetterBlockAsm10B: MOVB $0xf4, (AX) MOVW DX, 1(AX) ADDQ $0x03, AX @@ -16425,7 +16533,7 @@ two_bytes_emit_remainder_encodeSnappyBetterBlockAsm10B: MOVB DL, 1(AX) ADDQ $0x02, AX CMPL DX, $0x40 - JL memmove_emit_remainder_encodeSnappyBetterBlockAsm10B + JB memmove_emit_remainder_encodeSnappyBetterBlockAsm10B JMP memmove_long_emit_remainder_encodeSnappyBetterBlockAsm10B one_byte_emit_remainder_encodeSnappyBetterBlockAsm10B: @@ -16588,7 +16696,7 @@ search_loop_encodeSnappyBetterBlockAsm8B: SHRL $0x04, BX LEAL 1(CX)(BX*1), BX CMPL BX, 8(SP) - JGE emit_remainder_encodeSnappyBetterBlockAsm8B + JAE emit_remainder_encodeSnappyBetterBlockAsm8B MOVQ (DX)(CX*1), SI MOVL BX, 20(SP) MOVQ $0x0000cf1bbcdcbf9b, R8 @@ -16643,7 +16751,7 @@ candidate_match_encodeSnappyBetterBlockAsm8B: match_extend_back_loop_encodeSnappyBetterBlockAsm8B: CMPL CX, SI - JLE match_extend_back_end_encodeSnappyBetterBlockAsm8B + JBE match_extend_back_end_encodeSnappyBetterBlockAsm8B MOVB -1(DX)(BX*1), DI MOVB -1(DX)(CX*1), R8 CMPB DI, R8 @@ -16658,7 +16766,7 @@ match_extend_back_end_encodeSnappyBetterBlockAsm8B: SUBL 12(SP), SI LEAQ 3(AX)(SI*1), SI CMPQ SI, (SP) - JL match_dst_size_check_encodeSnappyBetterBlockAsm8B + JB match_dst_size_check_encodeSnappyBetterBlockAsm8B MOVQ $0x00000000, ret+48(FP) RET @@ -16674,7 +16782,7 @@ match_dst_size_check_encodeSnappyBetterBlockAsm8B: // matchLen XORL R11, R11 CMPL DI, $0x08 - JL matchlen_match4_match_nolit_encodeSnappyBetterBlockAsm8B + JB matchlen_match4_match_nolit_encodeSnappyBetterBlockAsm8B matchlen_loopback_match_nolit_encodeSnappyBetterBlockAsm8B: MOVQ (R8)(R11*1), R10 @@ -16697,12 +16805,12 @@ matchlen_loop_match_nolit_encodeSnappyBetterBlockAsm8B: LEAL -8(DI), DI LEAL 8(R11), R11 CMPL DI, $0x08 - JGE matchlen_loopback_match_nolit_encodeSnappyBetterBlockAsm8B + JAE matchlen_loopback_match_nolit_encodeSnappyBetterBlockAsm8B JZ match_nolit_end_encodeSnappyBetterBlockAsm8B matchlen_match4_match_nolit_encodeSnappyBetterBlockAsm8B: CMPL DI, $0x04 - JL matchlen_match2_match_nolit_encodeSnappyBetterBlockAsm8B + JB matchlen_match2_match_nolit_encodeSnappyBetterBlockAsm8B MOVL (R8)(R11*1), R10 CMPL (R9)(R11*1), R10 JNE matchlen_match2_match_nolit_encodeSnappyBetterBlockAsm8B @@ -16711,7 +16819,7 @@ matchlen_match4_match_nolit_encodeSnappyBetterBlockAsm8B: matchlen_match2_match_nolit_encodeSnappyBetterBlockAsm8B: CMPL DI, $0x02 - JL matchlen_match1_match_nolit_encodeSnappyBetterBlockAsm8B + JB matchlen_match1_match_nolit_encodeSnappyBetterBlockAsm8B MOVW (R8)(R11*1), R10 CMPW (R9)(R11*1), R10 JNE matchlen_match1_match_nolit_encodeSnappyBetterBlockAsm8B @@ -16720,7 +16828,7 @@ matchlen_match2_match_nolit_encodeSnappyBetterBlockAsm8B: matchlen_match1_match_nolit_encodeSnappyBetterBlockAsm8B: CMPL DI, $0x01 - JL match_nolit_end_encodeSnappyBetterBlockAsm8B + JB match_nolit_end_encodeSnappyBetterBlockAsm8B MOVB (R8)(R11*1), R10 CMPB (R9)(R11*1), R10 JNE match_nolit_end_encodeSnappyBetterBlockAsm8B @@ -16741,9 +16849,12 @@ match_nolit_end_encodeSnappyBetterBlockAsm8B: SUBL BX, R8 LEAL -1(R8), BX CMPL BX, $0x3c - JLT one_byte_match_emit_encodeSnappyBetterBlockAsm8B + JB one_byte_match_emit_encodeSnappyBetterBlockAsm8B CMPL BX, $0x00000100 - JLT two_bytes_match_emit_encodeSnappyBetterBlockAsm8B + JB two_bytes_match_emit_encodeSnappyBetterBlockAsm8B + JB three_bytes_match_emit_encodeSnappyBetterBlockAsm8B + +three_bytes_match_emit_encodeSnappyBetterBlockAsm8B: MOVB $0xf4, (AX) MOVW BX, 1(AX) ADDQ $0x03, AX @@ -16754,7 +16865,7 @@ two_bytes_match_emit_encodeSnappyBetterBlockAsm8B: MOVB BL, 1(AX) ADDQ $0x02, AX CMPL BX, $0x40 - JL memmove_match_emit_encodeSnappyBetterBlockAsm8B + JB memmove_match_emit_encodeSnappyBetterBlockAsm8B JMP memmove_long_match_emit_encodeSnappyBetterBlockAsm8B one_byte_match_emit_encodeSnappyBetterBlockAsm8B: @@ -16767,7 +16878,7 @@ memmove_match_emit_encodeSnappyBetterBlockAsm8B: // genMemMoveShort CMPQ R8, $0x08 - JLE emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm8B_memmove_move_8 + JBE emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm8B_memmove_move_8 CMPQ R8, $0x10 JBE emit_lit_memmove_match_emit_encodeSnappyBetterBlockAsm8B_memmove_move_8through16 CMPQ R8, $0x20 @@ -16859,7 +16970,7 @@ emit_literal_done_match_emit_encodeSnappyBetterBlockAsm8B: // emitCopy two_byte_offset_match_nolit_encodeSnappyBetterBlockAsm8B: CMPL R11, $0x40 - JLE two_byte_offset_short_match_nolit_encodeSnappyBetterBlockAsm8B + JBE two_byte_offset_short_match_nolit_encodeSnappyBetterBlockAsm8B MOVB $0xee, (AX) MOVW DI, 1(AX) LEAL -60(R11), R11 @@ -16870,7 +16981,7 @@ two_byte_offset_short_match_nolit_encodeSnappyBetterBlockAsm8B: MOVL R11, BX SHLL $0x02, BX CMPL R11, $0x0c - JGE emit_copy_three_match_nolit_encodeSnappyBetterBlockAsm8B + JAE emit_copy_three_match_nolit_encodeSnappyBetterBlockAsm8B LEAL -15(BX), BX MOVB DI, 1(AX) SHRL $0x08, DI @@ -16888,9 +16999,9 @@ emit_copy_three_match_nolit_encodeSnappyBetterBlockAsm8B: match_nolit_emitcopy_end_encodeSnappyBetterBlockAsm8B: CMPL CX, 8(SP) - JGE emit_remainder_encodeSnappyBetterBlockAsm8B + JAE emit_remainder_encodeSnappyBetterBlockAsm8B CMPQ AX, (SP) - JL match_nolit_dst_ok_encodeSnappyBetterBlockAsm8B + JB match_nolit_dst_ok_encodeSnappyBetterBlockAsm8B MOVQ $0x00000000, ret+48(FP) RET @@ -16946,7 +17057,7 @@ emit_remainder_encodeSnappyBetterBlockAsm8B: SUBL 12(SP), CX LEAQ 3(AX)(CX*1), CX CMPQ CX, (SP) - JL emit_remainder_ok_encodeSnappyBetterBlockAsm8B + JB emit_remainder_ok_encodeSnappyBetterBlockAsm8B MOVQ $0x00000000, ret+48(FP) RET @@ -16961,9 +17072,12 @@ emit_remainder_ok_encodeSnappyBetterBlockAsm8B: SUBL BX, SI LEAL -1(SI), DX CMPL DX, $0x3c - JLT one_byte_emit_remainder_encodeSnappyBetterBlockAsm8B + JB one_byte_emit_remainder_encodeSnappyBetterBlockAsm8B CMPL DX, $0x00000100 - JLT two_bytes_emit_remainder_encodeSnappyBetterBlockAsm8B + JB two_bytes_emit_remainder_encodeSnappyBetterBlockAsm8B + JB three_bytes_emit_remainder_encodeSnappyBetterBlockAsm8B + +three_bytes_emit_remainder_encodeSnappyBetterBlockAsm8B: MOVB $0xf4, (AX) MOVW DX, 1(AX) ADDQ $0x03, AX @@ -16974,7 +17088,7 @@ two_bytes_emit_remainder_encodeSnappyBetterBlockAsm8B: MOVB DL, 1(AX) ADDQ $0x02, AX CMPL DX, $0x40 - JL memmove_emit_remainder_encodeSnappyBetterBlockAsm8B + JB memmove_emit_remainder_encodeSnappyBetterBlockAsm8B JMP memmove_long_emit_remainder_encodeSnappyBetterBlockAsm8B one_byte_emit_remainder_encodeSnappyBetterBlockAsm8B: @@ -17137,7 +17251,7 @@ search_loop_calcBlockSize: SHRL $0x05, BX LEAL 4(CX)(BX*1), BX CMPL BX, 8(SP) - JGE emit_remainder_calcBlockSize + JAE emit_remainder_calcBlockSize MOVQ (DX)(CX*1), SI MOVL BX, 20(SP) MOVQ $0x0000cf1bbcdcbf9b, R8 @@ -17175,7 +17289,7 @@ search_loop_calcBlockSize: repeat_extend_back_loop_calcBlockSize: CMPL SI, BX - JLE repeat_extend_back_end_calcBlockSize + JBE repeat_extend_back_end_calcBlockSize MOVB -1(DX)(DI*1), R8 MOVB -1(DX)(SI*1), R9 CMPB R8, R9 @@ -17194,13 +17308,13 @@ repeat_extend_back_end_calcBlockSize: SUBL BX, DI LEAL -1(DI), BX CMPL BX, $0x3c - JLT one_byte_repeat_emit_calcBlockSize + JB one_byte_repeat_emit_calcBlockSize CMPL BX, $0x00000100 - JLT two_bytes_repeat_emit_calcBlockSize + JB two_bytes_repeat_emit_calcBlockSize CMPL BX, $0x00010000 - JLT three_bytes_repeat_emit_calcBlockSize + JB three_bytes_repeat_emit_calcBlockSize CMPL BX, $0x01000000 - JLT four_bytes_repeat_emit_calcBlockSize + JB four_bytes_repeat_emit_calcBlockSize ADDQ $0x05, AX JMP memmove_long_repeat_emit_calcBlockSize @@ -17215,7 +17329,7 @@ three_bytes_repeat_emit_calcBlockSize: two_bytes_repeat_emit_calcBlockSize: ADDQ $0x02, AX CMPL BX, $0x40 - JL memmove_repeat_emit_calcBlockSize + JB memmove_repeat_emit_calcBlockSize JMP memmove_long_repeat_emit_calcBlockSize one_byte_repeat_emit_calcBlockSize: @@ -17240,7 +17354,7 @@ emit_literal_done_repeat_emit_calcBlockSize: // matchLen XORL R10, R10 CMPL DI, $0x08 - JL matchlen_match4_repeat_extend_calcBlockSize + JB matchlen_match4_repeat_extend_calcBlockSize matchlen_loopback_repeat_extend_calcBlockSize: MOVQ (R8)(R10*1), R9 @@ -17263,12 +17377,12 @@ matchlen_loop_repeat_extend_calcBlockSize: LEAL -8(DI), DI LEAL 8(R10), R10 CMPL DI, $0x08 - JGE matchlen_loopback_repeat_extend_calcBlockSize + JAE matchlen_loopback_repeat_extend_calcBlockSize JZ repeat_extend_forward_end_calcBlockSize matchlen_match4_repeat_extend_calcBlockSize: CMPL DI, $0x04 - JL matchlen_match2_repeat_extend_calcBlockSize + JB matchlen_match2_repeat_extend_calcBlockSize MOVL (R8)(R10*1), R9 CMPL (BX)(R10*1), R9 JNE matchlen_match2_repeat_extend_calcBlockSize @@ -17277,7 +17391,7 @@ matchlen_match4_repeat_extend_calcBlockSize: matchlen_match2_repeat_extend_calcBlockSize: CMPL DI, $0x02 - JL matchlen_match1_repeat_extend_calcBlockSize + JB matchlen_match1_repeat_extend_calcBlockSize MOVW (R8)(R10*1), R9 CMPW (BX)(R10*1), R9 JNE matchlen_match1_repeat_extend_calcBlockSize @@ -17286,7 +17400,7 @@ matchlen_match2_repeat_extend_calcBlockSize: matchlen_match1_repeat_extend_calcBlockSize: CMPL DI, $0x01 - JL repeat_extend_forward_end_calcBlockSize + JB repeat_extend_forward_end_calcBlockSize MOVB (R8)(R10*1), R9 CMPB (BX)(R10*1), R9 JNE repeat_extend_forward_end_calcBlockSize @@ -17300,15 +17414,15 @@ repeat_extend_forward_end_calcBlockSize: // emitCopy CMPL SI, $0x00010000 - JL two_byte_offset_repeat_as_copy_calcBlockSize + JB two_byte_offset_repeat_as_copy_calcBlockSize four_bytes_loop_back_repeat_as_copy_calcBlockSize: CMPL BX, $0x40 - JLE four_bytes_remain_repeat_as_copy_calcBlockSize + JBE four_bytes_remain_repeat_as_copy_calcBlockSize LEAL -64(BX), BX ADDQ $0x05, AX CMPL BX, $0x04 - JL four_bytes_remain_repeat_as_copy_calcBlockSize + JB four_bytes_remain_repeat_as_copy_calcBlockSize JMP four_bytes_loop_back_repeat_as_copy_calcBlockSize four_bytes_remain_repeat_as_copy_calcBlockSize: @@ -17320,7 +17434,7 @@ four_bytes_remain_repeat_as_copy_calcBlockSize: two_byte_offset_repeat_as_copy_calcBlockSize: CMPL BX, $0x40 - JLE two_byte_offset_short_repeat_as_copy_calcBlockSize + JBE two_byte_offset_short_repeat_as_copy_calcBlockSize LEAL -60(BX), BX ADDQ $0x03, AX JMP two_byte_offset_repeat_as_copy_calcBlockSize @@ -17329,9 +17443,9 @@ two_byte_offset_short_repeat_as_copy_calcBlockSize: MOVL BX, DI SHLL $0x02, DI CMPL BX, $0x0c - JGE emit_copy_three_repeat_as_copy_calcBlockSize + JAE emit_copy_three_repeat_as_copy_calcBlockSize CMPL SI, $0x00000800 - JGE emit_copy_three_repeat_as_copy_calcBlockSize + JAE emit_copy_three_repeat_as_copy_calcBlockSize ADDQ $0x02, AX JMP repeat_end_emit_calcBlockSize @@ -17373,7 +17487,7 @@ candidate_match_calcBlockSize: match_extend_back_loop_calcBlockSize: CMPL CX, SI - JLE match_extend_back_end_calcBlockSize + JBE match_extend_back_end_calcBlockSize MOVB -1(DX)(BX*1), DI MOVB -1(DX)(CX*1), R8 CMPB DI, R8 @@ -17388,7 +17502,7 @@ match_extend_back_end_calcBlockSize: SUBL 12(SP), SI LEAQ 5(AX)(SI*1), SI CMPQ SI, (SP) - JL match_dst_size_check_calcBlockSize + JB match_dst_size_check_calcBlockSize MOVQ $0x00000000, ret+24(FP) RET @@ -17403,13 +17517,13 @@ match_dst_size_check_calcBlockSize: SUBL DI, R8 LEAL -1(R8), SI CMPL SI, $0x3c - JLT one_byte_match_emit_calcBlockSize + JB one_byte_match_emit_calcBlockSize CMPL SI, $0x00000100 - JLT two_bytes_match_emit_calcBlockSize + JB two_bytes_match_emit_calcBlockSize CMPL SI, $0x00010000 - JLT three_bytes_match_emit_calcBlockSize + JB three_bytes_match_emit_calcBlockSize CMPL SI, $0x01000000 - JLT four_bytes_match_emit_calcBlockSize + JB four_bytes_match_emit_calcBlockSize ADDQ $0x05, AX JMP memmove_long_match_emit_calcBlockSize @@ -17424,7 +17538,7 @@ three_bytes_match_emit_calcBlockSize: two_bytes_match_emit_calcBlockSize: ADDQ $0x02, AX CMPL SI, $0x40 - JL memmove_match_emit_calcBlockSize + JB memmove_match_emit_calcBlockSize JMP memmove_long_match_emit_calcBlockSize one_byte_match_emit_calcBlockSize: @@ -17452,7 +17566,7 @@ match_nolit_loop_calcBlockSize: // matchLen XORL R9, R9 CMPL SI, $0x08 - JL matchlen_match4_match_nolit_calcBlockSize + JB matchlen_match4_match_nolit_calcBlockSize matchlen_loopback_match_nolit_calcBlockSize: MOVQ (DI)(R9*1), R8 @@ -17475,12 +17589,12 @@ matchlen_loop_match_nolit_calcBlockSize: LEAL -8(SI), SI LEAL 8(R9), R9 CMPL SI, $0x08 - JGE matchlen_loopback_match_nolit_calcBlockSize + JAE matchlen_loopback_match_nolit_calcBlockSize JZ match_nolit_end_calcBlockSize matchlen_match4_match_nolit_calcBlockSize: CMPL SI, $0x04 - JL matchlen_match2_match_nolit_calcBlockSize + JB matchlen_match2_match_nolit_calcBlockSize MOVL (DI)(R9*1), R8 CMPL (BX)(R9*1), R8 JNE matchlen_match2_match_nolit_calcBlockSize @@ -17489,7 +17603,7 @@ matchlen_match4_match_nolit_calcBlockSize: matchlen_match2_match_nolit_calcBlockSize: CMPL SI, $0x02 - JL matchlen_match1_match_nolit_calcBlockSize + JB matchlen_match1_match_nolit_calcBlockSize MOVW (DI)(R9*1), R8 CMPW (BX)(R9*1), R8 JNE matchlen_match1_match_nolit_calcBlockSize @@ -17498,7 +17612,7 @@ matchlen_match2_match_nolit_calcBlockSize: matchlen_match1_match_nolit_calcBlockSize: CMPL SI, $0x01 - JL match_nolit_end_calcBlockSize + JB match_nolit_end_calcBlockSize MOVB (DI)(R9*1), R8 CMPB (BX)(R9*1), R8 JNE match_nolit_end_calcBlockSize @@ -17512,15 +17626,15 @@ match_nolit_end_calcBlockSize: // emitCopy CMPL BX, $0x00010000 - JL two_byte_offset_match_nolit_calcBlockSize + JB two_byte_offset_match_nolit_calcBlockSize four_bytes_loop_back_match_nolit_calcBlockSize: CMPL R9, $0x40 - JLE four_bytes_remain_match_nolit_calcBlockSize + JBE four_bytes_remain_match_nolit_calcBlockSize LEAL -64(R9), R9 ADDQ $0x05, AX CMPL R9, $0x04 - JL four_bytes_remain_match_nolit_calcBlockSize + JB four_bytes_remain_match_nolit_calcBlockSize JMP four_bytes_loop_back_match_nolit_calcBlockSize four_bytes_remain_match_nolit_calcBlockSize: @@ -17532,7 +17646,7 @@ four_bytes_remain_match_nolit_calcBlockSize: two_byte_offset_match_nolit_calcBlockSize: CMPL R9, $0x40 - JLE two_byte_offset_short_match_nolit_calcBlockSize + JBE two_byte_offset_short_match_nolit_calcBlockSize LEAL -60(R9), R9 ADDQ $0x03, AX JMP two_byte_offset_match_nolit_calcBlockSize @@ -17541,9 +17655,9 @@ two_byte_offset_short_match_nolit_calcBlockSize: MOVL R9, SI SHLL $0x02, SI CMPL R9, $0x0c - JGE emit_copy_three_match_nolit_calcBlockSize + JAE emit_copy_three_match_nolit_calcBlockSize CMPL BX, $0x00000800 - JGE emit_copy_three_match_nolit_calcBlockSize + JAE emit_copy_three_match_nolit_calcBlockSize ADDQ $0x02, AX JMP match_nolit_emitcopy_end_calcBlockSize @@ -17552,10 +17666,10 @@ emit_copy_three_match_nolit_calcBlockSize: match_nolit_emitcopy_end_calcBlockSize: CMPL CX, 8(SP) - JGE emit_remainder_calcBlockSize + JAE emit_remainder_calcBlockSize MOVQ -2(DX)(CX*1), SI CMPQ AX, (SP) - JL match_nolit_dst_ok_calcBlockSize + JB match_nolit_dst_ok_calcBlockSize MOVQ $0x00000000, ret+24(FP) RET @@ -17585,7 +17699,7 @@ emit_remainder_calcBlockSize: SUBL 12(SP), CX LEAQ 5(AX)(CX*1), CX CMPQ CX, (SP) - JL emit_remainder_ok_calcBlockSize + JB emit_remainder_ok_calcBlockSize MOVQ $0x00000000, ret+24(FP) RET @@ -17600,13 +17714,13 @@ emit_remainder_ok_calcBlockSize: SUBL BX, SI LEAL -1(SI), CX CMPL CX, $0x3c - JLT one_byte_emit_remainder_calcBlockSize + JB one_byte_emit_remainder_calcBlockSize CMPL CX, $0x00000100 - JLT two_bytes_emit_remainder_calcBlockSize + JB two_bytes_emit_remainder_calcBlockSize CMPL CX, $0x00010000 - JLT three_bytes_emit_remainder_calcBlockSize + JB three_bytes_emit_remainder_calcBlockSize CMPL CX, $0x01000000 - JLT four_bytes_emit_remainder_calcBlockSize + JB four_bytes_emit_remainder_calcBlockSize ADDQ $0x05, AX JMP memmove_long_emit_remainder_calcBlockSize @@ -17621,7 +17735,7 @@ three_bytes_emit_remainder_calcBlockSize: two_bytes_emit_remainder_calcBlockSize: ADDQ $0x02, AX CMPL CX, $0x40 - JL memmove_emit_remainder_calcBlockSize + JB memmove_emit_remainder_calcBlockSize JMP memmove_long_emit_remainder_calcBlockSize one_byte_emit_remainder_calcBlockSize: @@ -17677,7 +17791,7 @@ search_loop_calcBlockSizeSmall: SHRL $0x04, BX LEAL 4(CX)(BX*1), BX CMPL BX, 8(SP) - JGE emit_remainder_calcBlockSizeSmall + JAE emit_remainder_calcBlockSizeSmall MOVQ (DX)(CX*1), SI MOVL BX, 20(SP) MOVQ $0x9e3779b1, R8 @@ -17715,7 +17829,7 @@ search_loop_calcBlockSizeSmall: repeat_extend_back_loop_calcBlockSizeSmall: CMPL SI, BX - JLE repeat_extend_back_end_calcBlockSizeSmall + JBE repeat_extend_back_end_calcBlockSizeSmall MOVB -1(DX)(DI*1), R8 MOVB -1(DX)(SI*1), R9 CMPB R8, R9 @@ -17734,16 +17848,19 @@ repeat_extend_back_end_calcBlockSizeSmall: SUBL BX, DI LEAL -1(DI), BX CMPL BX, $0x3c - JLT one_byte_repeat_emit_calcBlockSizeSmall + JB one_byte_repeat_emit_calcBlockSizeSmall CMPL BX, $0x00000100 - JLT two_bytes_repeat_emit_calcBlockSizeSmall + JB two_bytes_repeat_emit_calcBlockSizeSmall + JB three_bytes_repeat_emit_calcBlockSizeSmall + +three_bytes_repeat_emit_calcBlockSizeSmall: ADDQ $0x03, AX JMP memmove_long_repeat_emit_calcBlockSizeSmall two_bytes_repeat_emit_calcBlockSizeSmall: ADDQ $0x02, AX CMPL BX, $0x40 - JL memmove_repeat_emit_calcBlockSizeSmall + JB memmove_repeat_emit_calcBlockSizeSmall JMP memmove_long_repeat_emit_calcBlockSizeSmall one_byte_repeat_emit_calcBlockSizeSmall: @@ -17768,7 +17885,7 @@ emit_literal_done_repeat_emit_calcBlockSizeSmall: // matchLen XORL R10, R10 CMPL DI, $0x08 - JL matchlen_match4_repeat_extend_calcBlockSizeSmall + JB matchlen_match4_repeat_extend_calcBlockSizeSmall matchlen_loopback_repeat_extend_calcBlockSizeSmall: MOVQ (R8)(R10*1), R9 @@ -17791,12 +17908,12 @@ matchlen_loop_repeat_extend_calcBlockSizeSmall: LEAL -8(DI), DI LEAL 8(R10), R10 CMPL DI, $0x08 - JGE matchlen_loopback_repeat_extend_calcBlockSizeSmall + JAE matchlen_loopback_repeat_extend_calcBlockSizeSmall JZ repeat_extend_forward_end_calcBlockSizeSmall matchlen_match4_repeat_extend_calcBlockSizeSmall: CMPL DI, $0x04 - JL matchlen_match2_repeat_extend_calcBlockSizeSmall + JB matchlen_match2_repeat_extend_calcBlockSizeSmall MOVL (R8)(R10*1), R9 CMPL (BX)(R10*1), R9 JNE matchlen_match2_repeat_extend_calcBlockSizeSmall @@ -17805,7 +17922,7 @@ matchlen_match4_repeat_extend_calcBlockSizeSmall: matchlen_match2_repeat_extend_calcBlockSizeSmall: CMPL DI, $0x02 - JL matchlen_match1_repeat_extend_calcBlockSizeSmall + JB matchlen_match1_repeat_extend_calcBlockSizeSmall MOVW (R8)(R10*1), R9 CMPW (BX)(R10*1), R9 JNE matchlen_match1_repeat_extend_calcBlockSizeSmall @@ -17814,7 +17931,7 @@ matchlen_match2_repeat_extend_calcBlockSizeSmall: matchlen_match1_repeat_extend_calcBlockSizeSmall: CMPL DI, $0x01 - JL repeat_extend_forward_end_calcBlockSizeSmall + JB repeat_extend_forward_end_calcBlockSizeSmall MOVB (R8)(R10*1), R9 CMPB (BX)(R10*1), R9 JNE repeat_extend_forward_end_calcBlockSizeSmall @@ -17829,7 +17946,7 @@ repeat_extend_forward_end_calcBlockSizeSmall: // emitCopy two_byte_offset_repeat_as_copy_calcBlockSizeSmall: CMPL BX, $0x40 - JLE two_byte_offset_short_repeat_as_copy_calcBlockSizeSmall + JBE two_byte_offset_short_repeat_as_copy_calcBlockSizeSmall LEAL -60(BX), BX ADDQ $0x03, AX JMP two_byte_offset_repeat_as_copy_calcBlockSizeSmall @@ -17838,7 +17955,7 @@ two_byte_offset_short_repeat_as_copy_calcBlockSizeSmall: MOVL BX, SI SHLL $0x02, SI CMPL BX, $0x0c - JGE emit_copy_three_repeat_as_copy_calcBlockSizeSmall + JAE emit_copy_three_repeat_as_copy_calcBlockSizeSmall ADDQ $0x02, AX JMP repeat_end_emit_calcBlockSizeSmall @@ -17880,7 +17997,7 @@ candidate_match_calcBlockSizeSmall: match_extend_back_loop_calcBlockSizeSmall: CMPL CX, SI - JLE match_extend_back_end_calcBlockSizeSmall + JBE match_extend_back_end_calcBlockSizeSmall MOVB -1(DX)(BX*1), DI MOVB -1(DX)(CX*1), R8 CMPB DI, R8 @@ -17895,7 +18012,7 @@ match_extend_back_end_calcBlockSizeSmall: SUBL 12(SP), SI LEAQ 3(AX)(SI*1), SI CMPQ SI, (SP) - JL match_dst_size_check_calcBlockSizeSmall + JB match_dst_size_check_calcBlockSizeSmall MOVQ $0x00000000, ret+24(FP) RET @@ -17910,16 +18027,19 @@ match_dst_size_check_calcBlockSizeSmall: SUBL DI, R8 LEAL -1(R8), SI CMPL SI, $0x3c - JLT one_byte_match_emit_calcBlockSizeSmall + JB one_byte_match_emit_calcBlockSizeSmall CMPL SI, $0x00000100 - JLT two_bytes_match_emit_calcBlockSizeSmall + JB two_bytes_match_emit_calcBlockSizeSmall + JB three_bytes_match_emit_calcBlockSizeSmall + +three_bytes_match_emit_calcBlockSizeSmall: ADDQ $0x03, AX JMP memmove_long_match_emit_calcBlockSizeSmall two_bytes_match_emit_calcBlockSizeSmall: ADDQ $0x02, AX CMPL SI, $0x40 - JL memmove_match_emit_calcBlockSizeSmall + JB memmove_match_emit_calcBlockSizeSmall JMP memmove_long_match_emit_calcBlockSizeSmall one_byte_match_emit_calcBlockSizeSmall: @@ -17947,7 +18067,7 @@ match_nolit_loop_calcBlockSizeSmall: // matchLen XORL R9, R9 CMPL SI, $0x08 - JL matchlen_match4_match_nolit_calcBlockSizeSmall + JB matchlen_match4_match_nolit_calcBlockSizeSmall matchlen_loopback_match_nolit_calcBlockSizeSmall: MOVQ (DI)(R9*1), R8 @@ -17970,12 +18090,12 @@ matchlen_loop_match_nolit_calcBlockSizeSmall: LEAL -8(SI), SI LEAL 8(R9), R9 CMPL SI, $0x08 - JGE matchlen_loopback_match_nolit_calcBlockSizeSmall + JAE matchlen_loopback_match_nolit_calcBlockSizeSmall JZ match_nolit_end_calcBlockSizeSmall matchlen_match4_match_nolit_calcBlockSizeSmall: CMPL SI, $0x04 - JL matchlen_match2_match_nolit_calcBlockSizeSmall + JB matchlen_match2_match_nolit_calcBlockSizeSmall MOVL (DI)(R9*1), R8 CMPL (BX)(R9*1), R8 JNE matchlen_match2_match_nolit_calcBlockSizeSmall @@ -17984,7 +18104,7 @@ matchlen_match4_match_nolit_calcBlockSizeSmall: matchlen_match2_match_nolit_calcBlockSizeSmall: CMPL SI, $0x02 - JL matchlen_match1_match_nolit_calcBlockSizeSmall + JB matchlen_match1_match_nolit_calcBlockSizeSmall MOVW (DI)(R9*1), R8 CMPW (BX)(R9*1), R8 JNE matchlen_match1_match_nolit_calcBlockSizeSmall @@ -17993,7 +18113,7 @@ matchlen_match2_match_nolit_calcBlockSizeSmall: matchlen_match1_match_nolit_calcBlockSizeSmall: CMPL SI, $0x01 - JL match_nolit_end_calcBlockSizeSmall + JB match_nolit_end_calcBlockSizeSmall MOVB (DI)(R9*1), R8 CMPB (BX)(R9*1), R8 JNE match_nolit_end_calcBlockSizeSmall @@ -18008,7 +18128,7 @@ match_nolit_end_calcBlockSizeSmall: // emitCopy two_byte_offset_match_nolit_calcBlockSizeSmall: CMPL R9, $0x40 - JLE two_byte_offset_short_match_nolit_calcBlockSizeSmall + JBE two_byte_offset_short_match_nolit_calcBlockSizeSmall LEAL -60(R9), R9 ADDQ $0x03, AX JMP two_byte_offset_match_nolit_calcBlockSizeSmall @@ -18017,7 +18137,7 @@ two_byte_offset_short_match_nolit_calcBlockSizeSmall: MOVL R9, BX SHLL $0x02, BX CMPL R9, $0x0c - JGE emit_copy_three_match_nolit_calcBlockSizeSmall + JAE emit_copy_three_match_nolit_calcBlockSizeSmall ADDQ $0x02, AX JMP match_nolit_emitcopy_end_calcBlockSizeSmall @@ -18026,10 +18146,10 @@ emit_copy_three_match_nolit_calcBlockSizeSmall: match_nolit_emitcopy_end_calcBlockSizeSmall: CMPL CX, 8(SP) - JGE emit_remainder_calcBlockSizeSmall + JAE emit_remainder_calcBlockSizeSmall MOVQ -2(DX)(CX*1), SI CMPQ AX, (SP) - JL match_nolit_dst_ok_calcBlockSizeSmall + JB match_nolit_dst_ok_calcBlockSizeSmall MOVQ $0x00000000, ret+24(FP) RET @@ -18059,7 +18179,7 @@ emit_remainder_calcBlockSizeSmall: SUBL 12(SP), CX LEAQ 3(AX)(CX*1), CX CMPQ CX, (SP) - JL emit_remainder_ok_calcBlockSizeSmall + JB emit_remainder_ok_calcBlockSizeSmall MOVQ $0x00000000, ret+24(FP) RET @@ -18074,16 +18194,19 @@ emit_remainder_ok_calcBlockSizeSmall: SUBL BX, SI LEAL -1(SI), CX CMPL CX, $0x3c - JLT one_byte_emit_remainder_calcBlockSizeSmall + JB one_byte_emit_remainder_calcBlockSizeSmall CMPL CX, $0x00000100 - JLT two_bytes_emit_remainder_calcBlockSizeSmall + JB two_bytes_emit_remainder_calcBlockSizeSmall + JB three_bytes_emit_remainder_calcBlockSizeSmall + +three_bytes_emit_remainder_calcBlockSizeSmall: ADDQ $0x03, AX JMP memmove_long_emit_remainder_calcBlockSizeSmall two_bytes_emit_remainder_calcBlockSizeSmall: ADDQ $0x02, AX CMPL CX, $0x40 - JL memmove_emit_remainder_calcBlockSizeSmall + JB memmove_emit_remainder_calcBlockSizeSmall JMP memmove_long_emit_remainder_calcBlockSizeSmall one_byte_emit_remainder_calcBlockSizeSmall: @@ -18111,13 +18234,13 @@ TEXT ·emitLiteral(SB), NOSPLIT, $0-56 MOVL DX, BX LEAL -1(DX), SI CMPL SI, $0x3c - JLT one_byte_standalone + JB one_byte_standalone CMPL SI, $0x00000100 - JLT two_bytes_standalone + JB two_bytes_standalone CMPL SI, $0x00010000 - JLT three_bytes_standalone + JB three_bytes_standalone CMPL SI, $0x01000000 - JLT four_bytes_standalone + JB four_bytes_standalone MOVB $0xfc, (AX) MOVL SI, 1(AX) ADDQ $0x05, BX @@ -18147,7 +18270,7 @@ two_bytes_standalone: ADDQ $0x02, BX ADDQ $0x02, AX CMPL SI, $0x40 - JL memmove_standalone + JB memmove_standalone JMP memmove_long_standalone one_byte_standalone: @@ -18278,19 +18401,19 @@ emit_repeat_again_standalone: MOVL DX, SI LEAL -4(DX), DX CMPL SI, $0x08 - JLE repeat_two_standalone + JBE repeat_two_standalone CMPL SI, $0x0c - JGE cant_repeat_two_offset_standalone + JAE cant_repeat_two_offset_standalone CMPL CX, $0x00000800 - JLT repeat_two_offset_standalone + JB repeat_two_offset_standalone cant_repeat_two_offset_standalone: CMPL DX, $0x00000104 - JLT repeat_three_standalone + JB repeat_three_standalone CMPL DX, $0x00010100 - JLT repeat_four_standalone + JB repeat_four_standalone CMPL DX, $0x0100ffff - JLT repeat_five_standalone + JB repeat_five_standalone LEAL -16842747(DX), DX MOVL $0xfffb001d, (AX) MOVB $0xff, 4(AX) @@ -18357,35 +18480,35 @@ TEXT ·emitCopy(SB), NOSPLIT, $0-48 // emitCopy CMPL CX, $0x00010000 - JL two_byte_offset_standalone + JB two_byte_offset_standalone CMPL DX, $0x40 - JLE four_bytes_remain_standalone + JBE four_bytes_remain_standalone MOVB $0xff, (AX) MOVL CX, 1(AX) LEAL -64(DX), DX ADDQ $0x05, BX ADDQ $0x05, AX CMPL DX, $0x04 - JL four_bytes_remain_standalone + JB four_bytes_remain_standalone // emitRepeat emit_repeat_again_standalone_emit_copy: MOVL DX, SI LEAL -4(DX), DX CMPL SI, $0x08 - JLE repeat_two_standalone_emit_copy + JBE repeat_two_standalone_emit_copy CMPL SI, $0x0c - JGE cant_repeat_two_offset_standalone_emit_copy + JAE cant_repeat_two_offset_standalone_emit_copy CMPL CX, $0x00000800 - JLT repeat_two_offset_standalone_emit_copy + JB repeat_two_offset_standalone_emit_copy cant_repeat_two_offset_standalone_emit_copy: CMPL DX, $0x00000104 - JLT repeat_three_standalone_emit_copy + JB repeat_three_standalone_emit_copy CMPL DX, $0x00010100 - JLT repeat_four_standalone_emit_copy + JB repeat_four_standalone_emit_copy CMPL DX, $0x0100ffff - JLT repeat_five_standalone_emit_copy + JB repeat_five_standalone_emit_copy LEAL -16842747(DX), DX MOVL $0xfffb001d, (AX) MOVB $0xff, 4(AX) @@ -18453,7 +18576,7 @@ four_bytes_remain_standalone: two_byte_offset_standalone: CMPL DX, $0x40 - JLE two_byte_offset_short_standalone + JBE two_byte_offset_short_standalone CMPL CX, $0x00000800 JAE long_offset_short_standalone MOVL $0x00000001, SI @@ -18476,19 +18599,19 @@ emit_repeat_again_standalone_emit_copy_short_2b: MOVL DX, SI LEAL -4(DX), DX CMPL SI, $0x08 - JLE repeat_two_standalone_emit_copy_short_2b + JBE repeat_two_standalone_emit_copy_short_2b CMPL SI, $0x0c - JGE cant_repeat_two_offset_standalone_emit_copy_short_2b + JAE cant_repeat_two_offset_standalone_emit_copy_short_2b CMPL CX, $0x00000800 - JLT repeat_two_offset_standalone_emit_copy_short_2b + JB repeat_two_offset_standalone_emit_copy_short_2b cant_repeat_two_offset_standalone_emit_copy_short_2b: CMPL DX, $0x00000104 - JLT repeat_three_standalone_emit_copy_short_2b + JB repeat_three_standalone_emit_copy_short_2b CMPL DX, $0x00010100 - JLT repeat_four_standalone_emit_copy_short_2b + JB repeat_four_standalone_emit_copy_short_2b CMPL DX, $0x0100ffff - JLT repeat_five_standalone_emit_copy_short_2b + JB repeat_five_standalone_emit_copy_short_2b LEAL -16842747(DX), DX MOVL $0xfffb001d, (AX) MOVB $0xff, 4(AX) @@ -18555,19 +18678,19 @@ emit_repeat_again_standalone_emit_copy_short: MOVL DX, SI LEAL -4(DX), DX CMPL SI, $0x08 - JLE repeat_two_standalone_emit_copy_short + JBE repeat_two_standalone_emit_copy_short CMPL SI, $0x0c - JGE cant_repeat_two_offset_standalone_emit_copy_short + JAE cant_repeat_two_offset_standalone_emit_copy_short CMPL CX, $0x00000800 - JLT repeat_two_offset_standalone_emit_copy_short + JB repeat_two_offset_standalone_emit_copy_short cant_repeat_two_offset_standalone_emit_copy_short: CMPL DX, $0x00000104 - JLT repeat_three_standalone_emit_copy_short + JB repeat_three_standalone_emit_copy_short CMPL DX, $0x00010100 - JLT repeat_four_standalone_emit_copy_short + JB repeat_four_standalone_emit_copy_short CMPL DX, $0x0100ffff - JLT repeat_five_standalone_emit_copy_short + JB repeat_five_standalone_emit_copy_short LEAL -16842747(DX), DX MOVL $0xfffb001d, (AX) MOVB $0xff, 4(AX) @@ -18626,9 +18749,9 @@ two_byte_offset_short_standalone: MOVL DX, SI SHLL $0x02, SI CMPL DX, $0x0c - JGE emit_copy_three_standalone + JAE emit_copy_three_standalone CMPL CX, $0x00000800 - JGE emit_copy_three_standalone + JAE emit_copy_three_standalone LEAL -15(SI), SI MOVB CL, 1(AX) SHRL $0x08, CX @@ -18659,18 +18782,18 @@ TEXT ·emitCopyNoRepeat(SB), NOSPLIT, $0-48 // emitCopy CMPL CX, $0x00010000 - JL two_byte_offset_standalone_snappy + JB two_byte_offset_standalone_snappy four_bytes_loop_back_standalone_snappy: CMPL DX, $0x40 - JLE four_bytes_remain_standalone_snappy + JBE four_bytes_remain_standalone_snappy MOVB $0xff, (AX) MOVL CX, 1(AX) LEAL -64(DX), DX ADDQ $0x05, BX ADDQ $0x05, AX CMPL DX, $0x04 - JL four_bytes_remain_standalone_snappy + JB four_bytes_remain_standalone_snappy JMP four_bytes_loop_back_standalone_snappy four_bytes_remain_standalone_snappy: @@ -18686,7 +18809,7 @@ four_bytes_remain_standalone_snappy: two_byte_offset_standalone_snappy: CMPL DX, $0x40 - JLE two_byte_offset_short_standalone_snappy + JBE two_byte_offset_short_standalone_snappy MOVB $0xee, (AX) MOVW CX, 1(AX) LEAL -60(DX), DX @@ -18698,9 +18821,9 @@ two_byte_offset_short_standalone_snappy: MOVL DX, SI SHLL $0x02, SI CMPL DX, $0x0c - JGE emit_copy_three_standalone_snappy + JAE emit_copy_three_standalone_snappy CMPL CX, $0x00000800 - JGE emit_copy_three_standalone_snappy + JAE emit_copy_three_standalone_snappy LEAL -15(SI), SI MOVB CL, 1(AX) SHRL $0x08, CX @@ -18732,7 +18855,7 @@ TEXT ·matchLen(SB), NOSPLIT, $0-56 // matchLen XORL SI, SI CMPL DX, $0x08 - JL matchlen_match4_standalone + JB matchlen_match4_standalone matchlen_loopback_standalone: MOVQ (AX)(SI*1), BX @@ -18755,12 +18878,12 @@ matchlen_loop_standalone: LEAL -8(DX), DX LEAL 8(SI), SI CMPL DX, $0x08 - JGE matchlen_loopback_standalone + JAE matchlen_loopback_standalone JZ gen_match_len_end matchlen_match4_standalone: CMPL DX, $0x04 - JL matchlen_match2_standalone + JB matchlen_match2_standalone MOVL (AX)(SI*1), BX CMPL (CX)(SI*1), BX JNE matchlen_match2_standalone @@ -18769,7 +18892,7 @@ matchlen_match4_standalone: matchlen_match2_standalone: CMPL DX, $0x02 - JL matchlen_match1_standalone + JB matchlen_match1_standalone MOVW (AX)(SI*1), BX CMPW (CX)(SI*1), BX JNE matchlen_match1_standalone @@ -18778,7 +18901,7 @@ matchlen_match2_standalone: matchlen_match1_standalone: CMPL DX, $0x01 - JL gen_match_len_end + JB gen_match_len_end MOVB (AX)(SI*1), BL CMPB (CX)(SI*1), BL JNE gen_match_len_end @@ -18837,13 +18960,13 @@ lz4_s2_ll_end: ADDQ R9, SI LEAL -1(R9), R11 CMPL R11, $0x3c - JLT one_byte_lz4_s2 + JB one_byte_lz4_s2 CMPL R11, $0x00000100 - JLT two_bytes_lz4_s2 + JB two_bytes_lz4_s2 CMPL R11, $0x00010000 - JLT three_bytes_lz4_s2 + JB three_bytes_lz4_s2 CMPL R11, $0x01000000 - JLT four_bytes_lz4_s2 + JB four_bytes_lz4_s2 MOVB $0xfc, (AX) MOVL R11, 1(AX) ADDQ $0x05, AX @@ -18869,7 +18992,7 @@ two_bytes_lz4_s2: MOVB R11, 1(AX) ADDQ $0x02, AX CMPL R11, $0x40 - JL memmove_lz4_s2 + JB memmove_lz4_s2 JMP memmove_long_lz4_s2 one_byte_lz4_s2: @@ -18882,7 +19005,7 @@ memmove_lz4_s2: // genMemMoveShort CMPQ R9, $0x08 - JLE emit_lit_memmove_lz4_s2_memmove_move_8 + JBE emit_lit_memmove_lz4_s2_memmove_move_8 CMPQ R9, $0x10 JBE emit_lit_memmove_lz4_s2_memmove_move_8through16 CMPQ R9, $0x20 @@ -19008,19 +19131,19 @@ emit_repeat_again_lz4_s2: MOVL R10, R8 LEAL -4(R10), R10 CMPL R8, $0x08 - JLE repeat_two_lz4_s2 + JBE repeat_two_lz4_s2 CMPL R8, $0x0c - JGE cant_repeat_two_offset_lz4_s2 + JAE cant_repeat_two_offset_lz4_s2 CMPL R9, $0x00000800 - JLT repeat_two_offset_lz4_s2 + JB repeat_two_offset_lz4_s2 cant_repeat_two_offset_lz4_s2: CMPL R10, $0x00000104 - JLT repeat_three_lz4_s2 + JB repeat_three_lz4_s2 CMPL R10, $0x00010100 - JLT repeat_four_lz4_s2 + JB repeat_four_lz4_s2 CMPL R10, $0x0100ffff - JLT repeat_five_lz4_s2 + JB repeat_five_lz4_s2 LEAL -16842747(R10), R10 MOVL $0xfffb001d, (AX) MOVB $0xff, 4(AX) @@ -19074,7 +19197,7 @@ lz4_s2_docopy: // emitCopy CMPL R10, $0x40 - JLE two_byte_offset_short_lz4_s2 + JBE two_byte_offset_short_lz4_s2 CMPL R9, $0x00000800 JAE long_offset_short_lz4_s2 MOVL $0x00000001, R8 @@ -19096,19 +19219,19 @@ emit_repeat_again_lz4_s2_emit_copy_short_2b: MOVL R10, R8 LEAL -4(R10), R10 CMPL R8, $0x08 - JLE repeat_two_lz4_s2_emit_copy_short_2b + JBE repeat_two_lz4_s2_emit_copy_short_2b CMPL R8, $0x0c - JGE cant_repeat_two_offset_lz4_s2_emit_copy_short_2b + JAE cant_repeat_two_offset_lz4_s2_emit_copy_short_2b CMPL R9, $0x00000800 - JLT repeat_two_offset_lz4_s2_emit_copy_short_2b + JB repeat_two_offset_lz4_s2_emit_copy_short_2b cant_repeat_two_offset_lz4_s2_emit_copy_short_2b: CMPL R10, $0x00000104 - JLT repeat_three_lz4_s2_emit_copy_short_2b + JB repeat_three_lz4_s2_emit_copy_short_2b CMPL R10, $0x00010100 - JLT repeat_four_lz4_s2_emit_copy_short_2b + JB repeat_four_lz4_s2_emit_copy_short_2b CMPL R10, $0x0100ffff - JLT repeat_five_lz4_s2_emit_copy_short_2b + JB repeat_five_lz4_s2_emit_copy_short_2b LEAL -16842747(R10), R10 MOVL $0xfffb001d, (AX) MOVB $0xff, 4(AX) @@ -19168,19 +19291,19 @@ emit_repeat_again_lz4_s2_emit_copy_short: MOVL R10, R8 LEAL -4(R10), R10 CMPL R8, $0x08 - JLE repeat_two_lz4_s2_emit_copy_short + JBE repeat_two_lz4_s2_emit_copy_short CMPL R8, $0x0c - JGE cant_repeat_two_offset_lz4_s2_emit_copy_short + JAE cant_repeat_two_offset_lz4_s2_emit_copy_short CMPL R9, $0x00000800 - JLT repeat_two_offset_lz4_s2_emit_copy_short + JB repeat_two_offset_lz4_s2_emit_copy_short cant_repeat_two_offset_lz4_s2_emit_copy_short: CMPL R10, $0x00000104 - JLT repeat_three_lz4_s2_emit_copy_short + JB repeat_three_lz4_s2_emit_copy_short CMPL R10, $0x00010100 - JLT repeat_four_lz4_s2_emit_copy_short + JB repeat_four_lz4_s2_emit_copy_short CMPL R10, $0x0100ffff - JLT repeat_five_lz4_s2_emit_copy_short + JB repeat_five_lz4_s2_emit_copy_short LEAL -16842747(R10), R10 MOVL $0xfffb001d, (AX) MOVB $0xff, 4(AX) @@ -19233,9 +19356,9 @@ two_byte_offset_short_lz4_s2: MOVL R10, R8 SHLL $0x02, R8 CMPL R10, $0x0c - JGE emit_copy_three_lz4_s2 + JAE emit_copy_three_lz4_s2 CMPL R9, $0x00000800 - JGE emit_copy_three_lz4_s2 + JAE emit_copy_three_lz4_s2 LEAL -15(R8), R8 MOVB R9, 1(AX) SHRL $0x08, R9 @@ -19320,13 +19443,13 @@ lz4s_s2_ll_end: ADDQ R9, SI LEAL -1(R9), R11 CMPL R11, $0x3c - JLT one_byte_lz4s_s2 + JB one_byte_lz4s_s2 CMPL R11, $0x00000100 - JLT two_bytes_lz4s_s2 + JB two_bytes_lz4s_s2 CMPL R11, $0x00010000 - JLT three_bytes_lz4s_s2 + JB three_bytes_lz4s_s2 CMPL R11, $0x01000000 - JLT four_bytes_lz4s_s2 + JB four_bytes_lz4s_s2 MOVB $0xfc, (AX) MOVL R11, 1(AX) ADDQ $0x05, AX @@ -19352,7 +19475,7 @@ two_bytes_lz4s_s2: MOVB R11, 1(AX) ADDQ $0x02, AX CMPL R11, $0x40 - JL memmove_lz4s_s2 + JB memmove_lz4s_s2 JMP memmove_long_lz4s_s2 one_byte_lz4s_s2: @@ -19365,7 +19488,7 @@ memmove_lz4s_s2: // genMemMoveShort CMPQ R9, $0x08 - JLE emit_lit_memmove_lz4s_s2_memmove_move_8 + JBE emit_lit_memmove_lz4s_s2_memmove_move_8 CMPQ R9, $0x10 JBE emit_lit_memmove_lz4s_s2_memmove_move_8through16 CMPQ R9, $0x20 @@ -19493,19 +19616,19 @@ emit_repeat_again_lz4_s2: MOVL R10, R8 LEAL -4(R10), R10 CMPL R8, $0x08 - JLE repeat_two_lz4_s2 + JBE repeat_two_lz4_s2 CMPL R8, $0x0c - JGE cant_repeat_two_offset_lz4_s2 + JAE cant_repeat_two_offset_lz4_s2 CMPL R9, $0x00000800 - JLT repeat_two_offset_lz4_s2 + JB repeat_two_offset_lz4_s2 cant_repeat_two_offset_lz4_s2: CMPL R10, $0x00000104 - JLT repeat_three_lz4_s2 + JB repeat_three_lz4_s2 CMPL R10, $0x00010100 - JLT repeat_four_lz4_s2 + JB repeat_four_lz4_s2 CMPL R10, $0x0100ffff - JLT repeat_five_lz4_s2 + JB repeat_five_lz4_s2 LEAL -16842747(R10), R10 MOVL $0xfffb001d, (AX) MOVB $0xff, 4(AX) @@ -19559,7 +19682,7 @@ lz4s_s2_docopy: // emitCopy CMPL R10, $0x40 - JLE two_byte_offset_short_lz4_s2 + JBE two_byte_offset_short_lz4_s2 CMPL R9, $0x00000800 JAE long_offset_short_lz4_s2 MOVL $0x00000001, R8 @@ -19581,19 +19704,19 @@ emit_repeat_again_lz4_s2_emit_copy_short_2b: MOVL R10, R8 LEAL -4(R10), R10 CMPL R8, $0x08 - JLE repeat_two_lz4_s2_emit_copy_short_2b + JBE repeat_two_lz4_s2_emit_copy_short_2b CMPL R8, $0x0c - JGE cant_repeat_two_offset_lz4_s2_emit_copy_short_2b + JAE cant_repeat_two_offset_lz4_s2_emit_copy_short_2b CMPL R9, $0x00000800 - JLT repeat_two_offset_lz4_s2_emit_copy_short_2b + JB repeat_two_offset_lz4_s2_emit_copy_short_2b cant_repeat_two_offset_lz4_s2_emit_copy_short_2b: CMPL R10, $0x00000104 - JLT repeat_three_lz4_s2_emit_copy_short_2b + JB repeat_three_lz4_s2_emit_copy_short_2b CMPL R10, $0x00010100 - JLT repeat_four_lz4_s2_emit_copy_short_2b + JB repeat_four_lz4_s2_emit_copy_short_2b CMPL R10, $0x0100ffff - JLT repeat_five_lz4_s2_emit_copy_short_2b + JB repeat_five_lz4_s2_emit_copy_short_2b LEAL -16842747(R10), R10 MOVL $0xfffb001d, (AX) MOVB $0xff, 4(AX) @@ -19653,19 +19776,19 @@ emit_repeat_again_lz4_s2_emit_copy_short: MOVL R10, R8 LEAL -4(R10), R10 CMPL R8, $0x08 - JLE repeat_two_lz4_s2_emit_copy_short + JBE repeat_two_lz4_s2_emit_copy_short CMPL R8, $0x0c - JGE cant_repeat_two_offset_lz4_s2_emit_copy_short + JAE cant_repeat_two_offset_lz4_s2_emit_copy_short CMPL R9, $0x00000800 - JLT repeat_two_offset_lz4_s2_emit_copy_short + JB repeat_two_offset_lz4_s2_emit_copy_short cant_repeat_two_offset_lz4_s2_emit_copy_short: CMPL R10, $0x00000104 - JLT repeat_three_lz4_s2_emit_copy_short + JB repeat_three_lz4_s2_emit_copy_short CMPL R10, $0x00010100 - JLT repeat_four_lz4_s2_emit_copy_short + JB repeat_four_lz4_s2_emit_copy_short CMPL R10, $0x0100ffff - JLT repeat_five_lz4_s2_emit_copy_short + JB repeat_five_lz4_s2_emit_copy_short LEAL -16842747(R10), R10 MOVL $0xfffb001d, (AX) MOVB $0xff, 4(AX) @@ -19718,9 +19841,9 @@ two_byte_offset_short_lz4_s2: MOVL R10, R8 SHLL $0x02, R8 CMPL R10, $0x0c - JGE emit_copy_three_lz4_s2 + JAE emit_copy_three_lz4_s2 CMPL R9, $0x00000800 - JGE emit_copy_three_lz4_s2 + JAE emit_copy_three_lz4_s2 LEAL -15(R8), R8 MOVB R9, 1(AX) SHRL $0x08, R9 @@ -19804,13 +19927,13 @@ lz4_snappy_ll_end: ADDQ R8, SI LEAL -1(R8), R10 CMPL R10, $0x3c - JLT one_byte_lz4_snappy + JB one_byte_lz4_snappy CMPL R10, $0x00000100 - JLT two_bytes_lz4_snappy + JB two_bytes_lz4_snappy CMPL R10, $0x00010000 - JLT three_bytes_lz4_snappy + JB three_bytes_lz4_snappy CMPL R10, $0x01000000 - JLT four_bytes_lz4_snappy + JB four_bytes_lz4_snappy MOVB $0xfc, (AX) MOVL R10, 1(AX) ADDQ $0x05, AX @@ -19836,7 +19959,7 @@ two_bytes_lz4_snappy: MOVB R10, 1(AX) ADDQ $0x02, AX CMPL R10, $0x40 - JL memmove_lz4_snappy + JB memmove_lz4_snappy JMP memmove_long_lz4_snappy one_byte_lz4_snappy: @@ -19849,7 +19972,7 @@ memmove_lz4_snappy: // genMemMoveShort CMPQ R8, $0x08 - JLE emit_lit_memmove_lz4_snappy_memmove_move_8 + JBE emit_lit_memmove_lz4_snappy_memmove_move_8 CMPQ R8, $0x10 JBE emit_lit_memmove_lz4_snappy_memmove_move_8through16 CMPQ R8, $0x20 @@ -19971,7 +20094,7 @@ lz4_snappy_ml_done: // emitCopy two_byte_offset_lz4_s2: CMPL R9, $0x40 - JLE two_byte_offset_short_lz4_s2 + JBE two_byte_offset_short_lz4_s2 MOVB $0xee, (AX) MOVW R8, 1(AX) LEAL -60(R9), R9 @@ -19984,9 +20107,9 @@ two_byte_offset_short_lz4_s2: MOVL R9, DI SHLL $0x02, DI CMPL R9, $0x0c - JGE emit_copy_three_lz4_s2 + JAE emit_copy_three_lz4_s2 CMPL R8, $0x00000800 - JGE emit_copy_three_lz4_s2 + JAE emit_copy_three_lz4_s2 LEAL -15(DI), DI MOVB R8, 1(AX) SHRL $0x08, R8 @@ -20070,13 +20193,13 @@ lz4s_snappy_ll_end: ADDQ R8, SI LEAL -1(R8), R10 CMPL R10, $0x3c - JLT one_byte_lz4s_snappy + JB one_byte_lz4s_snappy CMPL R10, $0x00000100 - JLT two_bytes_lz4s_snappy + JB two_bytes_lz4s_snappy CMPL R10, $0x00010000 - JLT three_bytes_lz4s_snappy + JB three_bytes_lz4s_snappy CMPL R10, $0x01000000 - JLT four_bytes_lz4s_snappy + JB four_bytes_lz4s_snappy MOVB $0xfc, (AX) MOVL R10, 1(AX) ADDQ $0x05, AX @@ -20102,7 +20225,7 @@ two_bytes_lz4s_snappy: MOVB R10, 1(AX) ADDQ $0x02, AX CMPL R10, $0x40 - JL memmove_lz4s_snappy + JB memmove_lz4s_snappy JMP memmove_long_lz4s_snappy one_byte_lz4s_snappy: @@ -20115,7 +20238,7 @@ memmove_lz4s_snappy: // genMemMoveShort CMPQ R8, $0x08 - JLE emit_lit_memmove_lz4s_snappy_memmove_move_8 + JBE emit_lit_memmove_lz4s_snappy_memmove_move_8 CMPQ R8, $0x10 JBE emit_lit_memmove_lz4s_snappy_memmove_move_8through16 CMPQ R8, $0x20 @@ -20239,7 +20362,7 @@ lz4s_snappy_ml_done: // emitCopy two_byte_offset_lz4_s2: CMPL R9, $0x40 - JLE two_byte_offset_short_lz4_s2 + JBE two_byte_offset_short_lz4_s2 MOVB $0xee, (AX) MOVW R8, 1(AX) LEAL -60(R9), R9 @@ -20252,9 +20375,9 @@ two_byte_offset_short_lz4_s2: MOVL R9, DI SHLL $0x02, DI CMPL R9, $0x0c - JGE emit_copy_three_lz4_s2 + JAE emit_copy_three_lz4_s2 CMPL R8, $0x00000800 - JGE emit_copy_three_lz4_s2 + JAE emit_copy_three_lz4_s2 LEAL -15(DI), DI MOVB R8, 1(AX) SHRL $0x08, R8 diff --git a/vendor/github.com/klauspost/compress/s2/reader.go b/vendor/github.com/klauspost/compress/s2/reader.go new file mode 100644 index 000000000..8b84baa6d --- /dev/null +++ b/vendor/github.com/klauspost/compress/s2/reader.go @@ -0,0 +1,1055 @@ +// Copyright 2011 The Snappy-Go Authors. All rights reserved. +// Copyright (c) 2019+ Klaus Post. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package s2 + +import ( + "errors" + "fmt" + "io" + "io/ioutil" + "math" + "runtime" + "sync" +) + +// ErrCantSeek is returned if the stream cannot be seeked. +type ErrCantSeek struct { + Reason string +} + +// Error returns the error as string. +func (e ErrCantSeek) Error() string { + return fmt.Sprintf("s2: Can't seek because %s", e.Reason) +} + +// NewReader returns a new Reader that decompresses from r, using the framing +// format described at +// https://github.com/google/snappy/blob/master/framing_format.txt with S2 changes. +func NewReader(r io.Reader, opts ...ReaderOption) *Reader { + nr := Reader{ + r: r, + maxBlock: maxBlockSize, + } + for _, opt := range opts { + if err := opt(&nr); err != nil { + nr.err = err + return &nr + } + } + nr.maxBufSize = MaxEncodedLen(nr.maxBlock) + checksumSize + if nr.lazyBuf > 0 { + nr.buf = make([]byte, MaxEncodedLen(nr.lazyBuf)+checksumSize) + } else { + nr.buf = make([]byte, MaxEncodedLen(defaultBlockSize)+checksumSize) + } + nr.readHeader = nr.ignoreStreamID + nr.paramsOK = true + return &nr +} + +// ReaderOption is an option for creating a decoder. +type ReaderOption func(*Reader) error + +// ReaderMaxBlockSize allows to control allocations if the stream +// has been compressed with a smaller WriterBlockSize, or with the default 1MB. +// Blocks must be this size or smaller to decompress, +// otherwise the decoder will return ErrUnsupported. +// +// For streams compressed with Snappy this can safely be set to 64KB (64 << 10). +// +// Default is the maximum limit of 4MB. +func ReaderMaxBlockSize(blockSize int) ReaderOption { + return func(r *Reader) error { + if blockSize > maxBlockSize || blockSize <= 0 { + return errors.New("s2: block size too large. Must be <= 4MB and > 0") + } + if r.lazyBuf == 0 && blockSize < defaultBlockSize { + r.lazyBuf = blockSize + } + r.maxBlock = blockSize + return nil + } +} + +// ReaderAllocBlock allows to control upfront stream allocations +// and not allocate for frames bigger than this initially. +// If frames bigger than this is seen a bigger buffer will be allocated. +// +// Default is 1MB, which is default output size. +func ReaderAllocBlock(blockSize int) ReaderOption { + return func(r *Reader) error { + if blockSize > maxBlockSize || blockSize < 1024 { + return errors.New("s2: invalid ReaderAllocBlock. Must be <= 4MB and >= 1024") + } + r.lazyBuf = blockSize + return nil + } +} + +// ReaderIgnoreStreamIdentifier will make the reader skip the expected +// stream identifier at the beginning of the stream. +// This can be used when serving a stream that has been forwarded to a specific point. +func ReaderIgnoreStreamIdentifier() ReaderOption { + return func(r *Reader) error { + r.ignoreStreamID = true + return nil + } +} + +// ReaderSkippableCB will register a callback for chuncks with the specified ID. +// ID must be a Reserved skippable chunks ID, 0x80-0xfd (inclusive). +// For each chunk with the ID, the callback is called with the content. +// Any returned non-nil error will abort decompression. +// Only one callback per ID is supported, latest sent will be used. +func ReaderSkippableCB(id uint8, fn func(r io.Reader) error) ReaderOption { + return func(r *Reader) error { + if id < 0x80 || id > 0xfd { + return fmt.Errorf("ReaderSkippableCB: Invalid id provided, must be 0x80-0xfd (inclusive)") + } + r.skippableCB[id] = fn + return nil + } +} + +// ReaderIgnoreCRC will make the reader skip CRC calculation and checks. +func ReaderIgnoreCRC() ReaderOption { + return func(r *Reader) error { + r.ignoreCRC = true + return nil + } +} + +// Reader is an io.Reader that can read Snappy-compressed bytes. +type Reader struct { + r io.Reader + err error + decoded []byte + buf []byte + skippableCB [0x80]func(r io.Reader) error + blockStart int64 // Uncompressed offset at start of current. + index *Index + + // decoded[i:j] contains decoded bytes that have not yet been passed on. + i, j int + // maximum block size allowed. + maxBlock int + // maximum expected buffer size. + maxBufSize int + // alloc a buffer this size if > 0. + lazyBuf int + readHeader bool + paramsOK bool + snappyFrame bool + ignoreStreamID bool + ignoreCRC bool +} + +// ensureBufferSize will ensure that the buffer can take at least n bytes. +// If false is returned the buffer exceeds maximum allowed size. +func (r *Reader) ensureBufferSize(n int) bool { + if n > r.maxBufSize { + r.err = ErrCorrupt + return false + } + if cap(r.buf) >= n { + return true + } + // Realloc buffer. + r.buf = make([]byte, n) + return true +} + +// Reset discards any buffered data, resets all state, and switches the Snappy +// reader to read from r. This permits reusing a Reader rather than allocating +// a new one. +func (r *Reader) Reset(reader io.Reader) { + if !r.paramsOK { + return + } + r.index = nil + r.r = reader + r.err = nil + r.i = 0 + r.j = 0 + r.blockStart = 0 + r.readHeader = r.ignoreStreamID +} + +func (r *Reader) readFull(p []byte, allowEOF bool) (ok bool) { + if _, r.err = io.ReadFull(r.r, p); r.err != nil { + if r.err == io.ErrUnexpectedEOF || (r.err == io.EOF && !allowEOF) { + r.err = ErrCorrupt + } + return false + } + return true +} + +// skippable will skip n bytes. +// If the supplied reader supports seeking that is used. +// tmp is used as a temporary buffer for reading. +// The supplied slice does not need to be the size of the read. +func (r *Reader) skippable(tmp []byte, n int, allowEOF bool, id uint8) (ok bool) { + if id < 0x80 { + r.err = fmt.Errorf("interbal error: skippable id < 0x80") + return false + } + if fn := r.skippableCB[id-0x80]; fn != nil { + rd := io.LimitReader(r.r, int64(n)) + r.err = fn(rd) + if r.err != nil { + return false + } + _, r.err = io.CopyBuffer(ioutil.Discard, rd, tmp) + return r.err == nil + } + if rs, ok := r.r.(io.ReadSeeker); ok { + _, err := rs.Seek(int64(n), io.SeekCurrent) + if err == nil { + return true + } + if err == io.ErrUnexpectedEOF || (r.err == io.EOF && !allowEOF) { + r.err = ErrCorrupt + return false + } + } + for n > 0 { + if n < len(tmp) { + tmp = tmp[:n] + } + if _, r.err = io.ReadFull(r.r, tmp); r.err != nil { + if r.err == io.ErrUnexpectedEOF || (r.err == io.EOF && !allowEOF) { + r.err = ErrCorrupt + } + return false + } + n -= len(tmp) + } + return true +} + +// Read satisfies the io.Reader interface. +func (r *Reader) Read(p []byte) (int, error) { + if r.err != nil { + return 0, r.err + } + for { + if r.i < r.j { + n := copy(p, r.decoded[r.i:r.j]) + r.i += n + return n, nil + } + if !r.readFull(r.buf[:4], true) { + return 0, r.err + } + chunkType := r.buf[0] + if !r.readHeader { + if chunkType != chunkTypeStreamIdentifier { + r.err = ErrCorrupt + return 0, r.err + } + r.readHeader = true + } + chunkLen := int(r.buf[1]) | int(r.buf[2])<<8 | int(r.buf[3])<<16 + + // The chunk types are specified at + // https://github.com/google/snappy/blob/master/framing_format.txt + switch chunkType { + case chunkTypeCompressedData: + r.blockStart += int64(r.j) + // Section 4.2. Compressed data (chunk type 0x00). + if chunkLen < checksumSize { + r.err = ErrCorrupt + return 0, r.err + } + if !r.ensureBufferSize(chunkLen) { + if r.err == nil { + r.err = ErrUnsupported + } + return 0, r.err + } + buf := r.buf[:chunkLen] + if !r.readFull(buf, false) { + return 0, r.err + } + checksum := uint32(buf[0]) | uint32(buf[1])<<8 | uint32(buf[2])<<16 | uint32(buf[3])<<24 + buf = buf[checksumSize:] + + n, err := DecodedLen(buf) + if err != nil { + r.err = err + return 0, r.err + } + if r.snappyFrame && n > maxSnappyBlockSize { + r.err = ErrCorrupt + return 0, r.err + } + + if n > len(r.decoded) { + if n > r.maxBlock { + r.err = ErrCorrupt + return 0, r.err + } + r.decoded = make([]byte, n) + } + if _, err := Decode(r.decoded, buf); err != nil { + r.err = err + return 0, r.err + } + if !r.ignoreCRC && crc(r.decoded[:n]) != checksum { + r.err = ErrCRC + return 0, r.err + } + r.i, r.j = 0, n + continue + + case chunkTypeUncompressedData: + r.blockStart += int64(r.j) + // Section 4.3. Uncompressed data (chunk type 0x01). + if chunkLen < checksumSize { + r.err = ErrCorrupt + return 0, r.err + } + if !r.ensureBufferSize(chunkLen) { + if r.err == nil { + r.err = ErrUnsupported + } + return 0, r.err + } + buf := r.buf[:checksumSize] + if !r.readFull(buf, false) { + return 0, r.err + } + checksum := uint32(buf[0]) | uint32(buf[1])<<8 | uint32(buf[2])<<16 | uint32(buf[3])<<24 + // Read directly into r.decoded instead of via r.buf. + n := chunkLen - checksumSize + if r.snappyFrame && n > maxSnappyBlockSize { + r.err = ErrCorrupt + return 0, r.err + } + if n > len(r.decoded) { + if n > r.maxBlock { + r.err = ErrCorrupt + return 0, r.err + } + r.decoded = make([]byte, n) + } + if !r.readFull(r.decoded[:n], false) { + return 0, r.err + } + if !r.ignoreCRC && crc(r.decoded[:n]) != checksum { + r.err = ErrCRC + return 0, r.err + } + r.i, r.j = 0, n + continue + + case chunkTypeStreamIdentifier: + // Section 4.1. Stream identifier (chunk type 0xff). + if chunkLen != len(magicBody) { + r.err = ErrCorrupt + return 0, r.err + } + if !r.readFull(r.buf[:len(magicBody)], false) { + return 0, r.err + } + if string(r.buf[:len(magicBody)]) != magicBody { + if string(r.buf[:len(magicBody)]) != magicBodySnappy { + r.err = ErrCorrupt + return 0, r.err + } else { + r.snappyFrame = true + } + } else { + r.snappyFrame = false + } + continue + } + + if chunkType <= 0x7f { + // Section 4.5. Reserved unskippable chunks (chunk types 0x02-0x7f). + // fmt.Printf("ERR chunktype: 0x%x\n", chunkType) + r.err = ErrUnsupported + return 0, r.err + } + // Section 4.4 Padding (chunk type 0xfe). + // Section 4.6. Reserved skippable chunks (chunk types 0x80-0xfd). + if chunkLen > maxChunkSize { + // fmt.Printf("ERR chunkLen: 0x%x\n", chunkLen) + r.err = ErrUnsupported + return 0, r.err + } + + // fmt.Printf("skippable: ID: 0x%x, len: 0x%x\n", chunkType, chunkLen) + if !r.skippable(r.buf, chunkLen, false, chunkType) { + return 0, r.err + } + } +} + +// DecodeConcurrent will decode the full stream to w. +// This function should not be combined with reading, seeking or other operations. +// Up to 'concurrent' goroutines will be used. +// If <= 0, runtime.NumCPU will be used. +// On success the number of bytes decompressed nil and is returned. +// This is mainly intended for bigger streams. +func (r *Reader) DecodeConcurrent(w io.Writer, concurrent int) (written int64, err error) { + if r.i > 0 || r.j > 0 || r.blockStart > 0 { + return 0, errors.New("DecodeConcurrent called after ") + } + if concurrent <= 0 { + concurrent = runtime.NumCPU() + } + + // Write to output + var errMu sync.Mutex + var aErr error + setErr := func(e error) (ok bool) { + errMu.Lock() + defer errMu.Unlock() + if e == nil { + return aErr == nil + } + if aErr == nil { + aErr = e + } + return false + } + hasErr := func() (ok bool) { + errMu.Lock() + v := aErr != nil + errMu.Unlock() + return v + } + + var aWritten int64 + toRead := make(chan []byte, concurrent) + writtenBlocks := make(chan []byte, concurrent) + queue := make(chan chan []byte, concurrent) + reUse := make(chan chan []byte, concurrent) + for i := 0; i < concurrent; i++ { + toRead <- make([]byte, 0, r.maxBufSize) + writtenBlocks <- make([]byte, 0, r.maxBufSize) + reUse <- make(chan []byte, 1) + } + // Writer + var wg sync.WaitGroup + wg.Add(1) + go func() { + defer wg.Done() + for toWrite := range queue { + entry := <-toWrite + reUse <- toWrite + if hasErr() { + writtenBlocks <- entry + continue + } + n, err := w.Write(entry) + want := len(entry) + writtenBlocks <- entry + if err != nil { + setErr(err) + continue + } + if n != want { + setErr(io.ErrShortWrite) + continue + } + aWritten += int64(n) + } + }() + + // Reader + defer func() { + close(queue) + if r.err != nil { + err = r.err + setErr(r.err) + } + wg.Wait() + if err == nil { + err = aErr + } + written = aWritten + }() + + for !hasErr() { + if !r.readFull(r.buf[:4], true) { + if r.err == io.EOF { + r.err = nil + } + return 0, r.err + } + chunkType := r.buf[0] + if !r.readHeader { + if chunkType != chunkTypeStreamIdentifier { + r.err = ErrCorrupt + return 0, r.err + } + r.readHeader = true + } + chunkLen := int(r.buf[1]) | int(r.buf[2])<<8 | int(r.buf[3])<<16 + + // The chunk types are specified at + // https://github.com/google/snappy/blob/master/framing_format.txt + switch chunkType { + case chunkTypeCompressedData: + r.blockStart += int64(r.j) + // Section 4.2. Compressed data (chunk type 0x00). + if chunkLen < checksumSize { + r.err = ErrCorrupt + return 0, r.err + } + if chunkLen > r.maxBufSize { + r.err = ErrCorrupt + return 0, r.err + } + orgBuf := <-toRead + buf := orgBuf[:chunkLen] + + if !r.readFull(buf, false) { + return 0, r.err + } + + checksum := uint32(buf[0]) | uint32(buf[1])<<8 | uint32(buf[2])<<16 | uint32(buf[3])<<24 + buf = buf[checksumSize:] + + n, err := DecodedLen(buf) + if err != nil { + r.err = err + return 0, r.err + } + if r.snappyFrame && n > maxSnappyBlockSize { + r.err = ErrCorrupt + return 0, r.err + } + + if n > r.maxBlock { + r.err = ErrCorrupt + return 0, r.err + } + wg.Add(1) + + decoded := <-writtenBlocks + entry := <-reUse + queue <- entry + go func() { + defer wg.Done() + decoded = decoded[:n] + _, err := Decode(decoded, buf) + toRead <- orgBuf + if err != nil { + writtenBlocks <- decoded + setErr(err) + return + } + if !r.ignoreCRC && crc(decoded) != checksum { + writtenBlocks <- decoded + setErr(ErrCRC) + return + } + entry <- decoded + }() + continue + + case chunkTypeUncompressedData: + + // Section 4.3. Uncompressed data (chunk type 0x01). + if chunkLen < checksumSize { + r.err = ErrCorrupt + return 0, r.err + } + if chunkLen > r.maxBufSize { + r.err = ErrCorrupt + return 0, r.err + } + // Grab write buffer + orgBuf := <-writtenBlocks + buf := orgBuf[:checksumSize] + if !r.readFull(buf, false) { + return 0, r.err + } + checksum := uint32(buf[0]) | uint32(buf[1])<<8 | uint32(buf[2])<<16 | uint32(buf[3])<<24 + // Read content. + n := chunkLen - checksumSize + + if r.snappyFrame && n > maxSnappyBlockSize { + r.err = ErrCorrupt + return 0, r.err + } + if n > r.maxBlock { + r.err = ErrCorrupt + return 0, r.err + } + // Read uncompressed + buf = orgBuf[:n] + if !r.readFull(buf, false) { + return 0, r.err + } + + if !r.ignoreCRC && crc(buf) != checksum { + r.err = ErrCRC + return 0, r.err + } + entry := <-reUse + queue <- entry + entry <- buf + continue + + case chunkTypeStreamIdentifier: + // Section 4.1. Stream identifier (chunk type 0xff). + if chunkLen != len(magicBody) { + r.err = ErrCorrupt + return 0, r.err + } + if !r.readFull(r.buf[:len(magicBody)], false) { + return 0, r.err + } + if string(r.buf[:len(magicBody)]) != magicBody { + if string(r.buf[:len(magicBody)]) != magicBodySnappy { + r.err = ErrCorrupt + return 0, r.err + } else { + r.snappyFrame = true + } + } else { + r.snappyFrame = false + } + continue + } + + if chunkType <= 0x7f { + // Section 4.5. Reserved unskippable chunks (chunk types 0x02-0x7f). + // fmt.Printf("ERR chunktype: 0x%x\n", chunkType) + r.err = ErrUnsupported + return 0, r.err + } + // Section 4.4 Padding (chunk type 0xfe). + // Section 4.6. Reserved skippable chunks (chunk types 0x80-0xfd). + if chunkLen > maxChunkSize { + // fmt.Printf("ERR chunkLen: 0x%x\n", chunkLen) + r.err = ErrUnsupported + return 0, r.err + } + + // fmt.Printf("skippable: ID: 0x%x, len: 0x%x\n", chunkType, chunkLen) + if !r.skippable(r.buf, chunkLen, false, chunkType) { + return 0, r.err + } + } + return 0, r.err +} + +// Skip will skip n bytes forward in the decompressed output. +// For larger skips this consumes less CPU and is faster than reading output and discarding it. +// CRC is not checked on skipped blocks. +// io.ErrUnexpectedEOF is returned if the stream ends before all bytes have been skipped. +// If a decoding error is encountered subsequent calls to Read will also fail. +func (r *Reader) Skip(n int64) error { + if n < 0 { + return errors.New("attempted negative skip") + } + if r.err != nil { + return r.err + } + + for n > 0 { + if r.i < r.j { + // Skip in buffer. + // decoded[i:j] contains decoded bytes that have not yet been passed on. + left := int64(r.j - r.i) + if left >= n { + tmp := int64(r.i) + n + if tmp > math.MaxInt32 { + return errors.New("s2: internal overflow in skip") + } + r.i = int(tmp) + return nil + } + n -= int64(r.j - r.i) + r.i = r.j + } + + // Buffer empty; read blocks until we have content. + if !r.readFull(r.buf[:4], true) { + if r.err == io.EOF { + r.err = io.ErrUnexpectedEOF + } + return r.err + } + chunkType := r.buf[0] + if !r.readHeader { + if chunkType != chunkTypeStreamIdentifier { + r.err = ErrCorrupt + return r.err + } + r.readHeader = true + } + chunkLen := int(r.buf[1]) | int(r.buf[2])<<8 | int(r.buf[3])<<16 + + // The chunk types are specified at + // https://github.com/google/snappy/blob/master/framing_format.txt + switch chunkType { + case chunkTypeCompressedData: + r.blockStart += int64(r.j) + // Section 4.2. Compressed data (chunk type 0x00). + if chunkLen < checksumSize { + r.err = ErrCorrupt + return r.err + } + if !r.ensureBufferSize(chunkLen) { + if r.err == nil { + r.err = ErrUnsupported + } + return r.err + } + buf := r.buf[:chunkLen] + if !r.readFull(buf, false) { + return r.err + } + checksum := uint32(buf[0]) | uint32(buf[1])<<8 | uint32(buf[2])<<16 | uint32(buf[3])<<24 + buf = buf[checksumSize:] + + dLen, err := DecodedLen(buf) + if err != nil { + r.err = err + return r.err + } + if dLen > r.maxBlock { + r.err = ErrCorrupt + return r.err + } + // Check if destination is within this block + if int64(dLen) > n { + if len(r.decoded) < dLen { + r.decoded = make([]byte, dLen) + } + if _, err := Decode(r.decoded, buf); err != nil { + r.err = err + return r.err + } + if crc(r.decoded[:dLen]) != checksum { + r.err = ErrCorrupt + return r.err + } + } else { + // Skip block completely + n -= int64(dLen) + r.blockStart += int64(dLen) + dLen = 0 + } + r.i, r.j = 0, dLen + continue + case chunkTypeUncompressedData: + r.blockStart += int64(r.j) + // Section 4.3. Uncompressed data (chunk type 0x01). + if chunkLen < checksumSize { + r.err = ErrCorrupt + return r.err + } + if !r.ensureBufferSize(chunkLen) { + if r.err != nil { + r.err = ErrUnsupported + } + return r.err + } + buf := r.buf[:checksumSize] + if !r.readFull(buf, false) { + return r.err + } + checksum := uint32(buf[0]) | uint32(buf[1])<<8 | uint32(buf[2])<<16 | uint32(buf[3])<<24 + // Read directly into r.decoded instead of via r.buf. + n2 := chunkLen - checksumSize + if n2 > len(r.decoded) { + if n2 > r.maxBlock { + r.err = ErrCorrupt + return r.err + } + r.decoded = make([]byte, n2) + } + if !r.readFull(r.decoded[:n2], false) { + return r.err + } + if int64(n2) < n { + if crc(r.decoded[:n2]) != checksum { + r.err = ErrCorrupt + return r.err + } + } + r.i, r.j = 0, n2 + continue + case chunkTypeStreamIdentifier: + // Section 4.1. Stream identifier (chunk type 0xff). + if chunkLen != len(magicBody) { + r.err = ErrCorrupt + return r.err + } + if !r.readFull(r.buf[:len(magicBody)], false) { + return r.err + } + if string(r.buf[:len(magicBody)]) != magicBody { + if string(r.buf[:len(magicBody)]) != magicBodySnappy { + r.err = ErrCorrupt + return r.err + } + } + + continue + } + + if chunkType <= 0x7f { + // Section 4.5. Reserved unskippable chunks (chunk types 0x02-0x7f). + r.err = ErrUnsupported + return r.err + } + if chunkLen > maxChunkSize { + r.err = ErrUnsupported + return r.err + } + // Section 4.4 Padding (chunk type 0xfe). + // Section 4.6. Reserved skippable chunks (chunk types 0x80-0xfd). + if !r.skippable(r.buf, chunkLen, false, chunkType) { + return r.err + } + } + return nil +} + +// ReadSeeker provides random or forward seeking in compressed content. +// See Reader.ReadSeeker +type ReadSeeker struct { + *Reader + readAtMu sync.Mutex +} + +// ReadSeeker will return an io.ReadSeeker and io.ReaderAt +// compatible version of the reader. +// If 'random' is specified the returned io.Seeker can be used for +// random seeking, otherwise only forward seeking is supported. +// Enabling random seeking requires the original input to support +// the io.Seeker interface. +// A custom index can be specified which will be used if supplied. +// When using a custom index, it will not be read from the input stream. +// The ReadAt position will affect regular reads and the current position of Seek. +// So using Read after ReadAt will continue from where the ReadAt stopped. +// No functions should be used concurrently. +// The returned ReadSeeker contains a shallow reference to the existing Reader, +// meaning changes performed to one is reflected in the other. +func (r *Reader) ReadSeeker(random bool, index []byte) (*ReadSeeker, error) { + // Read index if provided. + if len(index) != 0 { + if r.index == nil { + r.index = &Index{} + } + if _, err := r.index.Load(index); err != nil { + return nil, ErrCantSeek{Reason: "loading index returned: " + err.Error()} + } + } + + // Check if input is seekable + rs, ok := r.r.(io.ReadSeeker) + if !ok { + if !random { + return &ReadSeeker{Reader: r}, nil + } + return nil, ErrCantSeek{Reason: "input stream isn't seekable"} + } + + if r.index != nil { + // Seekable and index, ok... + return &ReadSeeker{Reader: r}, nil + } + + // Load from stream. + r.index = &Index{} + + // Read current position. + pos, err := rs.Seek(0, io.SeekCurrent) + if err != nil { + return nil, ErrCantSeek{Reason: "seeking input returned: " + err.Error()} + } + err = r.index.LoadStream(rs) + if err != nil { + if err == ErrUnsupported { + // If we don't require random seeking, reset input and return. + if !random { + _, err = rs.Seek(pos, io.SeekStart) + if err != nil { + return nil, ErrCantSeek{Reason: "resetting stream returned: " + err.Error()} + } + r.index = nil + return &ReadSeeker{Reader: r}, nil + } + return nil, ErrCantSeek{Reason: "input stream does not contain an index"} + } + return nil, ErrCantSeek{Reason: "reading index returned: " + err.Error()} + } + + // reset position. + _, err = rs.Seek(pos, io.SeekStart) + if err != nil { + return nil, ErrCantSeek{Reason: "seeking input returned: " + err.Error()} + } + return &ReadSeeker{Reader: r}, nil +} + +// Seek allows seeking in compressed data. +func (r *ReadSeeker) Seek(offset int64, whence int) (int64, error) { + if r.err != nil { + if !errors.Is(r.err, io.EOF) { + return 0, r.err + } + // Reset on EOF + r.err = nil + } + + // Calculate absolute offset. + absOffset := offset + + switch whence { + case io.SeekStart: + case io.SeekCurrent: + absOffset = r.blockStart + int64(r.i) + offset + case io.SeekEnd: + if r.index == nil { + return 0, ErrUnsupported + } + absOffset = r.index.TotalUncompressed + offset + default: + r.err = ErrUnsupported + return 0, r.err + } + + if absOffset < 0 { + return 0, errors.New("seek before start of file") + } + + if !r.readHeader { + // Make sure we read the header. + _, r.err = r.Read([]byte{}) + if r.err != nil { + return 0, r.err + } + } + + // If we are inside current block no need to seek. + // This includes no offset changes. + if absOffset >= r.blockStart && absOffset < r.blockStart+int64(r.j) { + r.i = int(absOffset - r.blockStart) + return r.blockStart + int64(r.i), nil + } + + rs, ok := r.r.(io.ReadSeeker) + if r.index == nil || !ok { + currOffset := r.blockStart + int64(r.i) + if absOffset >= currOffset { + err := r.Skip(absOffset - currOffset) + return r.blockStart + int64(r.i), err + } + return 0, ErrUnsupported + } + + // We can seek and we have an index. + c, u, err := r.index.Find(absOffset) + if err != nil { + return r.blockStart + int64(r.i), err + } + + // Seek to next block + _, err = rs.Seek(c, io.SeekStart) + if err != nil { + return 0, err + } + + r.i = r.j // Remove rest of current block. + r.blockStart = u - int64(r.j) // Adjust current block start for accounting. + if u < absOffset { + // Forward inside block + return absOffset, r.Skip(absOffset - u) + } + if u > absOffset { + return 0, fmt.Errorf("s2 seek: (internal error) u (%d) > absOffset (%d)", u, absOffset) + } + return absOffset, nil +} + +// ReadAt reads len(p) bytes into p starting at offset off in the +// underlying input source. It returns the number of bytes +// read (0 <= n <= len(p)) and any error encountered. +// +// When ReadAt returns n < len(p), it returns a non-nil error +// explaining why more bytes were not returned. In this respect, +// ReadAt is stricter than Read. +// +// Even if ReadAt returns n < len(p), it may use all of p as scratch +// space during the call. If some data is available but not len(p) bytes, +// ReadAt blocks until either all the data is available or an error occurs. +// In this respect ReadAt is different from Read. +// +// If the n = len(p) bytes returned by ReadAt are at the end of the +// input source, ReadAt may return either err == EOF or err == nil. +// +// If ReadAt is reading from an input source with a seek offset, +// ReadAt should not affect nor be affected by the underlying +// seek offset. +// +// Clients of ReadAt can execute parallel ReadAt calls on the +// same input source. This is however not recommended. +func (r *ReadSeeker) ReadAt(p []byte, offset int64) (int, error) { + r.readAtMu.Lock() + defer r.readAtMu.Unlock() + _, err := r.Seek(offset, io.SeekStart) + if err != nil { + return 0, err + } + n := 0 + for n < len(p) { + n2, err := r.Read(p[n:]) + if err != nil { + // This will include io.EOF + return n + n2, err + } + n += n2 + } + return n, nil +} + +// ReadByte satisfies the io.ByteReader interface. +func (r *Reader) ReadByte() (byte, error) { + if r.err != nil { + return 0, r.err + } + if r.i < r.j { + c := r.decoded[r.i] + r.i++ + return c, nil + } + var tmp [1]byte + for i := 0; i < 10; i++ { + n, err := r.Read(tmp[:]) + if err != nil { + return 0, err + } + if n == 1 { + return tmp[0], nil + } + } + return 0, io.ErrNoProgress +} + +// SkippableCB will register a callback for chunks with the specified ID. +// ID must be a Reserved skippable chunks ID, 0x80-0xfe (inclusive). +// For each chunk with the ID, the callback is called with the content. +// Any returned non-nil error will abort decompression. +// Only one callback per ID is supported, latest sent will be used. +// Sending a nil function will disable previous callbacks. +func (r *Reader) SkippableCB(id uint8, fn func(r io.Reader) error) error { + if id < 0x80 || id > chunkTypePadding { + return fmt.Errorf("ReaderSkippableCB: Invalid id provided, must be 0x80-0xfe (inclusive)") + } + r.skippableCB[id] = fn + return nil +} diff --git a/vendor/github.com/klauspost/compress/s2/writer.go b/vendor/github.com/klauspost/compress/s2/writer.go new file mode 100644 index 000000000..5a944068c --- /dev/null +++ b/vendor/github.com/klauspost/compress/s2/writer.go @@ -0,0 +1,1020 @@ +// Copyright 2011 The Snappy-Go Authors. All rights reserved. +// Copyright (c) 2019+ Klaus Post. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package s2 + +import ( + "crypto/rand" + "encoding/binary" + "errors" + "fmt" + "io" + "runtime" + "sync" +) + +const ( + levelUncompressed = iota + 1 + levelFast + levelBetter + levelBest +) + +// NewWriter returns a new Writer that compresses to w, using the +// framing format described at +// https://github.com/google/snappy/blob/master/framing_format.txt +// +// Users must call Close to guarantee all data has been forwarded to +// the underlying io.Writer and that resources are released. +// They may also call Flush zero or more times before calling Close. +func NewWriter(w io.Writer, opts ...WriterOption) *Writer { + w2 := Writer{ + blockSize: defaultBlockSize, + concurrency: runtime.GOMAXPROCS(0), + randSrc: rand.Reader, + level: levelFast, + } + for _, opt := range opts { + if err := opt(&w2); err != nil { + w2.errState = err + return &w2 + } + } + w2.obufLen = obufHeaderLen + MaxEncodedLen(w2.blockSize) + w2.paramsOK = true + w2.ibuf = make([]byte, 0, w2.blockSize) + w2.buffers.New = func() interface{} { + return make([]byte, w2.obufLen) + } + w2.Reset(w) + return &w2 +} + +// Writer is an io.Writer that can write Snappy-compressed bytes. +type Writer struct { + errMu sync.Mutex + errState error + + // ibuf is a buffer for the incoming (uncompressed) bytes. + ibuf []byte + + blockSize int + obufLen int + concurrency int + written int64 + uncompWritten int64 // Bytes sent to compression + output chan chan result + buffers sync.Pool + pad int + + writer io.Writer + randSrc io.Reader + writerWg sync.WaitGroup + index Index + customEnc func(dst, src []byte) int + + // wroteStreamHeader is whether we have written the stream header. + wroteStreamHeader bool + paramsOK bool + snappy bool + flushOnWrite bool + appendIndex bool + level uint8 +} + +type result struct { + b []byte + // Uncompressed start offset + startOffset int64 +} + +// err returns the previously set error. +// If no error has been set it is set to err if not nil. +func (w *Writer) err(err error) error { + w.errMu.Lock() + errSet := w.errState + if errSet == nil && err != nil { + w.errState = err + errSet = err + } + w.errMu.Unlock() + return errSet +} + +// Reset discards the writer's state and switches the Snappy writer to write to w. +// This permits reusing a Writer rather than allocating a new one. +func (w *Writer) Reset(writer io.Writer) { + if !w.paramsOK { + return + } + // Close previous writer, if any. + if w.output != nil { + close(w.output) + w.writerWg.Wait() + w.output = nil + } + w.errState = nil + w.ibuf = w.ibuf[:0] + w.wroteStreamHeader = false + w.written = 0 + w.writer = writer + w.uncompWritten = 0 + w.index.reset(w.blockSize) + + // If we didn't get a writer, stop here. + if writer == nil { + return + } + // If no concurrency requested, don't spin up writer goroutine. + if w.concurrency == 1 { + return + } + + toWrite := make(chan chan result, w.concurrency) + w.output = toWrite + w.writerWg.Add(1) + + // Start a writer goroutine that will write all output in order. + go func() { + defer w.writerWg.Done() + + // Get a queued write. + for write := range toWrite { + // Wait for the data to be available. + input := <-write + in := input.b + if len(in) > 0 { + if w.err(nil) == nil { + // Don't expose data from previous buffers. + toWrite := in[:len(in):len(in)] + // Write to output. + n, err := writer.Write(toWrite) + if err == nil && n != len(toWrite) { + err = io.ErrShortBuffer + } + _ = w.err(err) + w.err(w.index.add(w.written, input.startOffset)) + w.written += int64(n) + } + } + if cap(in) >= w.obufLen { + w.buffers.Put(in) + } + // close the incoming write request. + // This can be used for synchronizing flushes. + close(write) + } + }() +} + +// Write satisfies the io.Writer interface. +func (w *Writer) Write(p []byte) (nRet int, errRet error) { + if err := w.err(nil); err != nil { + return 0, err + } + if w.flushOnWrite { + return w.write(p) + } + // If we exceed the input buffer size, start writing + for len(p) > (cap(w.ibuf)-len(w.ibuf)) && w.err(nil) == nil { + var n int + if len(w.ibuf) == 0 { + // Large write, empty buffer. + // Write directly from p to avoid copy. + n, _ = w.write(p) + } else { + n = copy(w.ibuf[len(w.ibuf):cap(w.ibuf)], p) + w.ibuf = w.ibuf[:len(w.ibuf)+n] + w.write(w.ibuf) + w.ibuf = w.ibuf[:0] + } + nRet += n + p = p[n:] + } + if err := w.err(nil); err != nil { + return nRet, err + } + // p should always be able to fit into w.ibuf now. + n := copy(w.ibuf[len(w.ibuf):cap(w.ibuf)], p) + w.ibuf = w.ibuf[:len(w.ibuf)+n] + nRet += n + return nRet, nil +} + +// ReadFrom implements the io.ReaderFrom interface. +// Using this is typically more efficient since it avoids a memory copy. +// ReadFrom reads data from r until EOF or error. +// The return value n is the number of bytes read. +// Any error except io.EOF encountered during the read is also returned. +func (w *Writer) ReadFrom(r io.Reader) (n int64, err error) { + if err := w.err(nil); err != nil { + return 0, err + } + if len(w.ibuf) > 0 { + err := w.Flush() + if err != nil { + return 0, err + } + } + if br, ok := r.(byter); ok { + buf := br.Bytes() + if err := w.EncodeBuffer(buf); err != nil { + return 0, err + } + return int64(len(buf)), w.Flush() + } + for { + inbuf := w.buffers.Get().([]byte)[:w.blockSize+obufHeaderLen] + n2, err := io.ReadFull(r, inbuf[obufHeaderLen:]) + if err != nil { + if err == io.ErrUnexpectedEOF { + err = io.EOF + } + if err != io.EOF { + return n, w.err(err) + } + } + if n2 == 0 { + break + } + n += int64(n2) + err2 := w.writeFull(inbuf[:n2+obufHeaderLen]) + if w.err(err2) != nil { + break + } + + if err != nil { + // We got EOF and wrote everything + break + } + } + + return n, w.err(nil) +} + +// AddSkippableBlock will add a skippable block to the stream. +// The ID must be 0x80-0xfe (inclusive). +// Length of the skippable block must be <= 16777215 bytes. +func (w *Writer) AddSkippableBlock(id uint8, data []byte) (err error) { + if err := w.err(nil); err != nil { + return err + } + if len(data) == 0 { + return nil + } + if id < 0x80 || id > chunkTypePadding { + return fmt.Errorf("invalid skippable block id %x", id) + } + if len(data) > maxChunkSize { + return fmt.Errorf("skippable block excessed maximum size") + } + var header [4]byte + chunkLen := 4 + len(data) + header[0] = id + header[1] = uint8(chunkLen >> 0) + header[2] = uint8(chunkLen >> 8) + header[3] = uint8(chunkLen >> 16) + if w.concurrency == 1 { + write := func(b []byte) error { + n, err := w.writer.Write(b) + if err = w.err(err); err != nil { + return err + } + if n != len(data) { + return w.err(io.ErrShortWrite) + } + w.written += int64(n) + return w.err(nil) + } + if !w.wroteStreamHeader { + w.wroteStreamHeader = true + if w.snappy { + if err := write([]byte(magicChunkSnappy)); err != nil { + return err + } + } else { + if err := write([]byte(magicChunk)); err != nil { + return err + } + } + } + if err := write(header[:]); err != nil { + return err + } + if err := write(data); err != nil { + return err + } + } + + // Create output... + if !w.wroteStreamHeader { + w.wroteStreamHeader = true + hWriter := make(chan result) + w.output <- hWriter + if w.snappy { + hWriter <- result{startOffset: w.uncompWritten, b: []byte(magicChunkSnappy)} + } else { + hWriter <- result{startOffset: w.uncompWritten, b: []byte(magicChunk)} + } + } + + // Copy input. + inbuf := w.buffers.Get().([]byte)[:4] + copy(inbuf, header[:]) + inbuf = append(inbuf, data...) + + output := make(chan result, 1) + // Queue output. + w.output <- output + output <- result{startOffset: w.uncompWritten, b: inbuf} + + return nil +} + +// EncodeBuffer will add a buffer to the stream. +// This is the fastest way to encode a stream, +// but the input buffer cannot be written to by the caller +// until Flush or Close has been called when concurrency != 1. +// +// If you cannot control that, use the regular Write function. +// +// Note that input is not buffered. +// This means that each write will result in discrete blocks being created. +// For buffered writes, use the regular Write function. +func (w *Writer) EncodeBuffer(buf []byte) (err error) { + if err := w.err(nil); err != nil { + return err + } + + if w.flushOnWrite { + _, err := w.write(buf) + return err + } + // Flush queued data first. + if len(w.ibuf) > 0 { + err := w.Flush() + if err != nil { + return err + } + } + if w.concurrency == 1 { + _, err := w.writeSync(buf) + return err + } + + // Spawn goroutine and write block to output channel. + if !w.wroteStreamHeader { + w.wroteStreamHeader = true + hWriter := make(chan result) + w.output <- hWriter + if w.snappy { + hWriter <- result{startOffset: w.uncompWritten, b: []byte(magicChunkSnappy)} + } else { + hWriter <- result{startOffset: w.uncompWritten, b: []byte(magicChunk)} + } + } + + for len(buf) > 0 { + // Cut input. + uncompressed := buf + if len(uncompressed) > w.blockSize { + uncompressed = uncompressed[:w.blockSize] + } + buf = buf[len(uncompressed):] + // Get an output buffer. + obuf := w.buffers.Get().([]byte)[:len(uncompressed)+obufHeaderLen] + output := make(chan result) + // Queue output now, so we keep order. + w.output <- output + res := result{ + startOffset: w.uncompWritten, + } + w.uncompWritten += int64(len(uncompressed)) + go func() { + checksum := crc(uncompressed) + + // Set to uncompressed. + chunkType := uint8(chunkTypeUncompressedData) + chunkLen := 4 + len(uncompressed) + + // Attempt compressing. + n := binary.PutUvarint(obuf[obufHeaderLen:], uint64(len(uncompressed))) + n2 := w.encodeBlock(obuf[obufHeaderLen+n:], uncompressed) + + // Check if we should use this, or store as uncompressed instead. + if n2 > 0 { + chunkType = uint8(chunkTypeCompressedData) + chunkLen = 4 + n + n2 + obuf = obuf[:obufHeaderLen+n+n2] + } else { + // copy uncompressed + copy(obuf[obufHeaderLen:], uncompressed) + } + + // Fill in the per-chunk header that comes before the body. + obuf[0] = chunkType + obuf[1] = uint8(chunkLen >> 0) + obuf[2] = uint8(chunkLen >> 8) + obuf[3] = uint8(chunkLen >> 16) + obuf[4] = uint8(checksum >> 0) + obuf[5] = uint8(checksum >> 8) + obuf[6] = uint8(checksum >> 16) + obuf[7] = uint8(checksum >> 24) + + // Queue final output. + res.b = obuf + output <- res + }() + } + return nil +} + +func (w *Writer) encodeBlock(obuf, uncompressed []byte) int { + if w.customEnc != nil { + if ret := w.customEnc(obuf, uncompressed); ret >= 0 { + return ret + } + } + if w.snappy { + switch w.level { + case levelFast: + return encodeBlockSnappy(obuf, uncompressed) + case levelBetter: + return encodeBlockBetterSnappy(obuf, uncompressed) + case levelBest: + return encodeBlockBestSnappy(obuf, uncompressed) + } + return 0 + } + switch w.level { + case levelFast: + return encodeBlock(obuf, uncompressed) + case levelBetter: + return encodeBlockBetter(obuf, uncompressed) + case levelBest: + return encodeBlockBest(obuf, uncompressed, nil) + } + return 0 +} + +func (w *Writer) write(p []byte) (nRet int, errRet error) { + if err := w.err(nil); err != nil { + return 0, err + } + if w.concurrency == 1 { + return w.writeSync(p) + } + + // Spawn goroutine and write block to output channel. + for len(p) > 0 { + if !w.wroteStreamHeader { + w.wroteStreamHeader = true + hWriter := make(chan result) + w.output <- hWriter + if w.snappy { + hWriter <- result{startOffset: w.uncompWritten, b: []byte(magicChunkSnappy)} + } else { + hWriter <- result{startOffset: w.uncompWritten, b: []byte(magicChunk)} + } + } + + var uncompressed []byte + if len(p) > w.blockSize { + uncompressed, p = p[:w.blockSize], p[w.blockSize:] + } else { + uncompressed, p = p, nil + } + + // Copy input. + // If the block is incompressible, this is used for the result. + inbuf := w.buffers.Get().([]byte)[:len(uncompressed)+obufHeaderLen] + obuf := w.buffers.Get().([]byte)[:w.obufLen] + copy(inbuf[obufHeaderLen:], uncompressed) + uncompressed = inbuf[obufHeaderLen:] + + output := make(chan result) + // Queue output now, so we keep order. + w.output <- output + res := result{ + startOffset: w.uncompWritten, + } + w.uncompWritten += int64(len(uncompressed)) + + go func() { + checksum := crc(uncompressed) + + // Set to uncompressed. + chunkType := uint8(chunkTypeUncompressedData) + chunkLen := 4 + len(uncompressed) + + // Attempt compressing. + n := binary.PutUvarint(obuf[obufHeaderLen:], uint64(len(uncompressed))) + n2 := w.encodeBlock(obuf[obufHeaderLen+n:], uncompressed) + + // Check if we should use this, or store as uncompressed instead. + if n2 > 0 { + chunkType = uint8(chunkTypeCompressedData) + chunkLen = 4 + n + n2 + obuf = obuf[:obufHeaderLen+n+n2] + } else { + // Use input as output. + obuf, inbuf = inbuf, obuf + } + + // Fill in the per-chunk header that comes before the body. + obuf[0] = chunkType + obuf[1] = uint8(chunkLen >> 0) + obuf[2] = uint8(chunkLen >> 8) + obuf[3] = uint8(chunkLen >> 16) + obuf[4] = uint8(checksum >> 0) + obuf[5] = uint8(checksum >> 8) + obuf[6] = uint8(checksum >> 16) + obuf[7] = uint8(checksum >> 24) + + // Queue final output. + res.b = obuf + output <- res + + // Put unused buffer back in pool. + w.buffers.Put(inbuf) + }() + nRet += len(uncompressed) + } + return nRet, nil +} + +// writeFull is a special version of write that will always write the full buffer. +// Data to be compressed should start at offset obufHeaderLen and fill the remainder of the buffer. +// The data will be written as a single block. +// The caller is not allowed to use inbuf after this function has been called. +func (w *Writer) writeFull(inbuf []byte) (errRet error) { + if err := w.err(nil); err != nil { + return err + } + + if w.concurrency == 1 { + _, err := w.writeSync(inbuf[obufHeaderLen:]) + return err + } + + // Spawn goroutine and write block to output channel. + if !w.wroteStreamHeader { + w.wroteStreamHeader = true + hWriter := make(chan result) + w.output <- hWriter + if w.snappy { + hWriter <- result{startOffset: w.uncompWritten, b: []byte(magicChunkSnappy)} + } else { + hWriter <- result{startOffset: w.uncompWritten, b: []byte(magicChunk)} + } + } + + // Get an output buffer. + obuf := w.buffers.Get().([]byte)[:w.obufLen] + uncompressed := inbuf[obufHeaderLen:] + + output := make(chan result) + // Queue output now, so we keep order. + w.output <- output + res := result{ + startOffset: w.uncompWritten, + } + w.uncompWritten += int64(len(uncompressed)) + + go func() { + checksum := crc(uncompressed) + + // Set to uncompressed. + chunkType := uint8(chunkTypeUncompressedData) + chunkLen := 4 + len(uncompressed) + + // Attempt compressing. + n := binary.PutUvarint(obuf[obufHeaderLen:], uint64(len(uncompressed))) + n2 := w.encodeBlock(obuf[obufHeaderLen+n:], uncompressed) + + // Check if we should use this, or store as uncompressed instead. + if n2 > 0 { + chunkType = uint8(chunkTypeCompressedData) + chunkLen = 4 + n + n2 + obuf = obuf[:obufHeaderLen+n+n2] + } else { + // Use input as output. + obuf, inbuf = inbuf, obuf + } + + // Fill in the per-chunk header that comes before the body. + obuf[0] = chunkType + obuf[1] = uint8(chunkLen >> 0) + obuf[2] = uint8(chunkLen >> 8) + obuf[3] = uint8(chunkLen >> 16) + obuf[4] = uint8(checksum >> 0) + obuf[5] = uint8(checksum >> 8) + obuf[6] = uint8(checksum >> 16) + obuf[7] = uint8(checksum >> 24) + + // Queue final output. + res.b = obuf + output <- res + + // Put unused buffer back in pool. + w.buffers.Put(inbuf) + }() + return nil +} + +func (w *Writer) writeSync(p []byte) (nRet int, errRet error) { + if err := w.err(nil); err != nil { + return 0, err + } + if !w.wroteStreamHeader { + w.wroteStreamHeader = true + var n int + var err error + if w.snappy { + n, err = w.writer.Write([]byte(magicChunkSnappy)) + } else { + n, err = w.writer.Write([]byte(magicChunk)) + } + if err != nil { + return 0, w.err(err) + } + if n != len(magicChunk) { + return 0, w.err(io.ErrShortWrite) + } + w.written += int64(n) + } + + for len(p) > 0 { + var uncompressed []byte + if len(p) > w.blockSize { + uncompressed, p = p[:w.blockSize], p[w.blockSize:] + } else { + uncompressed, p = p, nil + } + + obuf := w.buffers.Get().([]byte)[:w.obufLen] + checksum := crc(uncompressed) + + // Set to uncompressed. + chunkType := uint8(chunkTypeUncompressedData) + chunkLen := 4 + len(uncompressed) + + // Attempt compressing. + n := binary.PutUvarint(obuf[obufHeaderLen:], uint64(len(uncompressed))) + n2 := w.encodeBlock(obuf[obufHeaderLen+n:], uncompressed) + + if n2 > 0 { + chunkType = uint8(chunkTypeCompressedData) + chunkLen = 4 + n + n2 + obuf = obuf[:obufHeaderLen+n+n2] + } else { + obuf = obuf[:8] + } + + // Fill in the per-chunk header that comes before the body. + obuf[0] = chunkType + obuf[1] = uint8(chunkLen >> 0) + obuf[2] = uint8(chunkLen >> 8) + obuf[3] = uint8(chunkLen >> 16) + obuf[4] = uint8(checksum >> 0) + obuf[5] = uint8(checksum >> 8) + obuf[6] = uint8(checksum >> 16) + obuf[7] = uint8(checksum >> 24) + + n, err := w.writer.Write(obuf) + if err != nil { + return 0, w.err(err) + } + if n != len(obuf) { + return 0, w.err(io.ErrShortWrite) + } + w.err(w.index.add(w.written, w.uncompWritten)) + w.written += int64(n) + w.uncompWritten += int64(len(uncompressed)) + + if chunkType == chunkTypeUncompressedData { + // Write uncompressed data. + n, err := w.writer.Write(uncompressed) + if err != nil { + return 0, w.err(err) + } + if n != len(uncompressed) { + return 0, w.err(io.ErrShortWrite) + } + w.written += int64(n) + } + w.buffers.Put(obuf) + // Queue final output. + nRet += len(uncompressed) + } + return nRet, nil +} + +// Flush flushes the Writer to its underlying io.Writer. +// This does not apply padding. +func (w *Writer) Flush() error { + if err := w.err(nil); err != nil { + return err + } + + // Queue any data still in input buffer. + if len(w.ibuf) != 0 { + if !w.wroteStreamHeader { + _, err := w.writeSync(w.ibuf) + w.ibuf = w.ibuf[:0] + return w.err(err) + } else { + _, err := w.write(w.ibuf) + w.ibuf = w.ibuf[:0] + err = w.err(err) + if err != nil { + return err + } + } + } + if w.output == nil { + return w.err(nil) + } + + // Send empty buffer + res := make(chan result) + w.output <- res + // Block until this has been picked up. + res <- result{b: nil, startOffset: w.uncompWritten} + // When it is closed, we have flushed. + <-res + return w.err(nil) +} + +// Close calls Flush and then closes the Writer. +// Calling Close multiple times is ok, +// but calling CloseIndex after this will make it not return the index. +func (w *Writer) Close() error { + _, err := w.closeIndex(w.appendIndex) + return err +} + +// CloseIndex calls Close and returns an index on first call. +// This is not required if you are only adding index to a stream. +func (w *Writer) CloseIndex() ([]byte, error) { + return w.closeIndex(true) +} + +func (w *Writer) closeIndex(idx bool) ([]byte, error) { + err := w.Flush() + if w.output != nil { + close(w.output) + w.writerWg.Wait() + w.output = nil + } + + var index []byte + if w.err(nil) == nil && w.writer != nil { + // Create index. + if idx { + compSize := int64(-1) + if w.pad <= 1 { + compSize = w.written + } + index = w.index.appendTo(w.ibuf[:0], w.uncompWritten, compSize) + // Count as written for padding. + if w.appendIndex { + w.written += int64(len(index)) + } + } + + if w.pad > 1 { + tmp := w.ibuf[:0] + if len(index) > 0 { + // Allocate another buffer. + tmp = w.buffers.Get().([]byte)[:0] + defer w.buffers.Put(tmp) + } + add := calcSkippableFrame(w.written, int64(w.pad)) + frame, err := skippableFrame(tmp, add, w.randSrc) + if err = w.err(err); err != nil { + return nil, err + } + n, err2 := w.writer.Write(frame) + if err2 == nil && n != len(frame) { + err2 = io.ErrShortWrite + } + _ = w.err(err2) + } + if len(index) > 0 && w.appendIndex { + n, err2 := w.writer.Write(index) + if err2 == nil && n != len(index) { + err2 = io.ErrShortWrite + } + _ = w.err(err2) + } + } + err = w.err(errClosed) + if err == errClosed { + return index, nil + } + return nil, err +} + +// calcSkippableFrame will return a total size to be added for written +// to be divisible by multiple. +// The value will always be > skippableFrameHeader. +// The function will panic if written < 0 or wantMultiple <= 0. +func calcSkippableFrame(written, wantMultiple int64) int { + if wantMultiple <= 0 { + panic("wantMultiple <= 0") + } + if written < 0 { + panic("written < 0") + } + leftOver := written % wantMultiple + if leftOver == 0 { + return 0 + } + toAdd := wantMultiple - leftOver + for toAdd < skippableFrameHeader { + toAdd += wantMultiple + } + return int(toAdd) +} + +// skippableFrame will add a skippable frame with a total size of bytes. +// total should be >= skippableFrameHeader and < maxBlockSize + skippableFrameHeader +func skippableFrame(dst []byte, total int, r io.Reader) ([]byte, error) { + if total == 0 { + return dst, nil + } + if total < skippableFrameHeader { + return dst, fmt.Errorf("s2: requested skippable frame (%d) < 4", total) + } + if int64(total) >= maxBlockSize+skippableFrameHeader { + return dst, fmt.Errorf("s2: requested skippable frame (%d) >= max 1<<24", total) + } + // Chunk type 0xfe "Section 4.4 Padding (chunk type 0xfe)" + dst = append(dst, chunkTypePadding) + f := uint32(total - skippableFrameHeader) + // Add chunk length. + dst = append(dst, uint8(f), uint8(f>>8), uint8(f>>16)) + // Add data + start := len(dst) + dst = append(dst, make([]byte, f)...) + _, err := io.ReadFull(r, dst[start:]) + return dst, err +} + +var errClosed = errors.New("s2: Writer is closed") + +// WriterOption is an option for creating a encoder. +type WriterOption func(*Writer) error + +// WriterConcurrency will set the concurrency, +// meaning the maximum number of decoders to run concurrently. +// The value supplied must be at least 1. +// By default this will be set to GOMAXPROCS. +func WriterConcurrency(n int) WriterOption { + return func(w *Writer) error { + if n <= 0 { + return errors.New("concurrency must be at least 1") + } + w.concurrency = n + return nil + } +} + +// WriterAddIndex will append an index to the end of a stream +// when it is closed. +func WriterAddIndex() WriterOption { + return func(w *Writer) error { + w.appendIndex = true + return nil + } +} + +// WriterBetterCompression will enable better compression. +// EncodeBetter compresses better than Encode but typically with a +// 10-40% speed decrease on both compression and decompression. +func WriterBetterCompression() WriterOption { + return func(w *Writer) error { + w.level = levelBetter + return nil + } +} + +// WriterBestCompression will enable better compression. +// EncodeBetter compresses better than Encode but typically with a +// big speed decrease on compression. +func WriterBestCompression() WriterOption { + return func(w *Writer) error { + w.level = levelBest + return nil + } +} + +// WriterUncompressed will bypass compression. +// The stream will be written as uncompressed blocks only. +// If concurrency is > 1 CRC and output will still be done async. +func WriterUncompressed() WriterOption { + return func(w *Writer) error { + w.level = levelUncompressed + return nil + } +} + +// WriterBlockSize allows to override the default block size. +// Blocks will be this size or smaller. +// Minimum size is 4KB and and maximum size is 4MB. +// +// Bigger blocks may give bigger throughput on systems with many cores, +// and will increase compression slightly, but it will limit the possible +// concurrency for smaller payloads for both encoding and decoding. +// Default block size is 1MB. +// +// When writing Snappy compatible output using WriterSnappyCompat, +// the maximum block size is 64KB. +func WriterBlockSize(n int) WriterOption { + return func(w *Writer) error { + if w.snappy && n > maxSnappyBlockSize || n < minBlockSize { + return errors.New("s2: block size too large. Must be <= 64K and >=4KB on for snappy compatible output") + } + if n > maxBlockSize || n < minBlockSize { + return errors.New("s2: block size too large. Must be <= 4MB and >=4KB") + } + w.blockSize = n + return nil + } +} + +// WriterPadding will add padding to all output so the size will be a multiple of n. +// This can be used to obfuscate the exact output size or make blocks of a certain size. +// The contents will be a skippable frame, so it will be invisible by the decoder. +// n must be > 0 and <= 4MB. +// The padded area will be filled with data from crypto/rand.Reader. +// The padding will be applied whenever Close is called on the writer. +func WriterPadding(n int) WriterOption { + return func(w *Writer) error { + if n <= 0 { + return fmt.Errorf("s2: padding must be at least 1") + } + // No need to waste our time. + if n == 1 { + w.pad = 0 + } + if n > maxBlockSize { + return fmt.Errorf("s2: padding must less than 4MB") + } + w.pad = n + return nil + } +} + +// WriterPaddingSrc will get random data for padding from the supplied source. +// By default crypto/rand is used. +func WriterPaddingSrc(reader io.Reader) WriterOption { + return func(w *Writer) error { + w.randSrc = reader + return nil + } +} + +// WriterSnappyCompat will write snappy compatible output. +// The output can be decompressed using either snappy or s2. +// If block size is more than 64KB it is set to that. +func WriterSnappyCompat() WriterOption { + return func(w *Writer) error { + w.snappy = true + if w.blockSize > 64<<10 { + // We choose 8 bytes less than 64K, since that will make literal emits slightly more effective. + // And allows us to skip some size checks. + w.blockSize = (64 << 10) - 8 + } + return nil + } +} + +// WriterFlushOnWrite will compress blocks on each call to the Write function. +// +// This is quite inefficient as blocks size will depend on the write size. +// +// Use WriterConcurrency(1) to also make sure that output is flushed. +// When Write calls return, otherwise they will be written when compression is done. +func WriterFlushOnWrite() WriterOption { + return func(w *Writer) error { + w.flushOnWrite = true + return nil + } +} + +// WriterCustomEncoder allows to override the encoder for blocks on the stream. +// The function must compress 'src' into 'dst' and return the bytes used in dst as an integer. +// Block size (initial varint) should not be added by the encoder. +// Returning value 0 indicates the block could not be compressed. +// Returning a negative value indicates that compression should be attempted. +// The function should expect to be called concurrently. +func WriterCustomEncoder(fn func(dst, src []byte) int) WriterOption { + return func(w *Writer) error { + w.customEnc = fn + return nil + } +} diff --git a/vendor/github.com/klauspost/compress/zstd/blockenc.go b/vendor/github.com/klauspost/compress/zstd/blockenc.go index 12e8f6f0b..fd4a36f73 100644 --- a/vendor/github.com/klauspost/compress/zstd/blockenc.go +++ b/vendor/github.com/klauspost/compress/zstd/blockenc.go @@ -473,7 +473,7 @@ func (b *blockEnc) encode(org []byte, raw, rawAllLits bool) error { return b.encodeLits(b.literals, rawAllLits) } // We want some difference to at least account for the headers. - saved := b.size - len(b.literals) - (b.size >> 5) + saved := b.size - len(b.literals) - (b.size >> 6) if saved < 16 { if org == nil { return errIncompressible @@ -779,10 +779,13 @@ func (b *blockEnc) encode(org []byte, raw, rawAllLits bool) error { } b.output = wr.out + // Maybe even add a bigger margin. if len(b.output)-3-bhOffset >= b.size { - // Maybe even add a bigger margin. + // Discard and encode as raw block. + b.output = b.encodeRawTo(b.output[:bhOffset], org) + b.popOffsets() b.litEnc.Reuse = huff0.ReusePolicyNone - return errIncompressible + return nil } // Size is output minus block header. diff --git a/vendor/github.com/klauspost/compress/zstd/decoder.go b/vendor/github.com/klauspost/compress/zstd/decoder.go index 7113e69ee..f04aaa21e 100644 --- a/vendor/github.com/klauspost/compress/zstd/decoder.go +++ b/vendor/github.com/klauspost/compress/zstd/decoder.go @@ -455,12 +455,7 @@ func (d *Decoder) nextBlock(blocking bool) (ok bool) { } if len(next.b) > 0 { - n, err := d.current.crc.Write(next.b) - if err == nil { - if n != len(next.b) { - d.current.err = io.ErrShortWrite - } - } + d.current.crc.Write(next.b) } if next.err == nil && next.d != nil && next.d.hasCRC { got := uint32(d.current.crc.Sum64()) diff --git a/vendor/github.com/klauspost/compress/zstd/enc_best.go b/vendor/github.com/klauspost/compress/zstd/enc_best.go index 07f657d36..9819d4145 100644 --- a/vendor/github.com/klauspost/compress/zstd/enc_best.go +++ b/vendor/github.com/klauspost/compress/zstd/enc_best.go @@ -34,7 +34,7 @@ type match struct { est int32 } -const highScore = 25000 +const highScore = maxMatchLen * 8 // estBits will estimate output bits from predefined tables. func (m *match) estBits(bitsPerByte int32) { @@ -159,7 +159,6 @@ func (e *bestFastEncoder) Encode(blk *blockEnc, src []byte) { // nextEmit is where in src the next emitLiteral should start from. nextEmit := s - cv := load6432(src, s) // Relative offsets offset1 := int32(blk.recentOffsets[0]) @@ -173,7 +172,6 @@ func (e *bestFastEncoder) Encode(blk *blockEnc, src []byte) { blk.literals = append(blk.literals, src[nextEmit:until]...) s.litLen = uint32(until - nextEmit) } - _ = addLiterals if debugEncoder { println("recent offsets:", blk.recentOffsets) @@ -188,7 +186,9 @@ encodeLoop: panic("offset0 was 0") } - const goodEnough = 100 + const goodEnough = 250 + + cv := load6432(src, s) nextHashL := hashLen(cv, bestLongTableBits, bestLongLen) nextHashS := hashLen(cv, bestShortTableBits, bestShortLen) @@ -201,11 +201,45 @@ encodeLoop: return } if debugAsserts { + if offset <= 0 { + panic(offset) + } if !bytes.Equal(src[s:s+4], src[offset:offset+4]) { panic(fmt.Sprintf("first match mismatch: %v != %v, first: %08x", src[s:s+4], src[offset:offset+4], first)) } } - cand := match{offset: offset, s: s, length: 4 + e.matchlen(s+4, offset+4, src), rep: rep} + // Try to quick reject if we already have a long match. + if m.length > 16 { + left := len(src) - int(m.s+m.length) + // If we are too close to the end, keep as is. + if left <= 0 { + return + } + checkLen := m.length - (s - m.s) - 8 + if left > 2 && checkLen > 4 { + // Check 4 bytes, 4 bytes from the end of the current match. + a := load3232(src, offset+checkLen) + b := load3232(src, s+checkLen) + if a != b { + return + } + } + } + l := 4 + e.matchlen(s+4, offset+4, src) + if rep < 0 { + // Extend candidate match backwards as far as possible. + tMin := s - e.maxMatchOff + if tMin < 0 { + tMin = 0 + } + for offset > tMin && s > nextEmit && src[offset-1] == src[s-1] && l < maxMatchLength { + s-- + offset-- + l++ + } + } + + cand := match{offset: offset, s: s, length: l, rep: rep} cand.estBits(bitsPerByte) if m.est >= highScore || cand.est-m.est+(cand.s-m.s)*bitsPerByte>>10 < 0 { *m = cand @@ -219,17 +253,29 @@ encodeLoop: improve(&best, candidateS.prev-e.cur, s, uint32(cv), -1) if canRepeat && best.length < goodEnough { - cv32 := uint32(cv >> 8) - spp := s + 1 - improve(&best, spp-offset1, spp, cv32, 1) - improve(&best, spp-offset2, spp, cv32, 2) - improve(&best, spp-offset3, spp, cv32, 3) - if best.length > 0 { - cv32 = uint32(cv >> 24) - spp += 2 + if s == nextEmit { + // Check repeats straight after a match. + improve(&best, s-offset2, s, uint32(cv), 1|4) + improve(&best, s-offset3, s, uint32(cv), 2|4) + if offset1 > 1 { + improve(&best, s-(offset1-1), s, uint32(cv), 3|4) + } + } + + // If either no match or a non-repeat match, check at + 1 + if best.rep <= 0 { + cv32 := uint32(cv >> 8) + spp := s + 1 improve(&best, spp-offset1, spp, cv32, 1) improve(&best, spp-offset2, spp, cv32, 2) improve(&best, spp-offset3, spp, cv32, 3) + if best.rep < 0 { + cv32 = uint32(cv >> 24) + spp += 2 + improve(&best, spp-offset1, spp, cv32, 1) + improve(&best, spp-offset2, spp, cv32, 2) + improve(&best, spp-offset3, spp, cv32, 3) + } } } // Load next and check... @@ -244,41 +290,44 @@ encodeLoop: if s >= sLimit { break encodeLoop } - cv = load6432(src, s) continue } - s++ candidateS = e.table[hashLen(cv>>8, bestShortTableBits, bestShortLen)] - cv = load6432(src, s) - cv2 := load6432(src, s+1) + cv = load6432(src, s+1) + cv2 := load6432(src, s+2) candidateL = e.longTable[hashLen(cv, bestLongTableBits, bestLongLen)] candidateL2 := e.longTable[hashLen(cv2, bestLongTableBits, bestLongLen)] // Short at s+1 - improve(&best, candidateS.offset-e.cur, s, uint32(cv), -1) + improve(&best, candidateS.offset-e.cur, s+1, uint32(cv), -1) // Long at s+1, s+2 - improve(&best, candidateL.offset-e.cur, s, uint32(cv), -1) - improve(&best, candidateL.prev-e.cur, s, uint32(cv), -1) - improve(&best, candidateL2.offset-e.cur, s+1, uint32(cv2), -1) - improve(&best, candidateL2.prev-e.cur, s+1, uint32(cv2), -1) + improve(&best, candidateL.offset-e.cur, s+1, uint32(cv), -1) + improve(&best, candidateL.prev-e.cur, s+1, uint32(cv), -1) + improve(&best, candidateL2.offset-e.cur, s+2, uint32(cv2), -1) + improve(&best, candidateL2.prev-e.cur, s+2, uint32(cv2), -1) if false { // Short at s+3. // Too often worse... - improve(&best, e.table[hashLen(cv2>>8, bestShortTableBits, bestShortLen)].offset-e.cur, s+2, uint32(cv2>>8), -1) + improve(&best, e.table[hashLen(cv2>>8, bestShortTableBits, bestShortLen)].offset-e.cur, s+3, uint32(cv2>>8), -1) } - // 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] - // 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 { - improve(&best, pos, best.s+skipBeginning, load3232(src, best.s+skipBeginning), -1) - if pos := candidateEnd.prev - e.cur - best.length + skipBeginning; pos >= 0 { - improve(&best, pos, best.s+skipBeginning, load3232(src, best.s+skipBeginning), -1) + + // Start check at a fixed offset to allow for a few mismatches. + // For this compression level 2 yields the best results. + // We cannot do this if we have already indexed this position. + const skipBeginning = 2 + if best.s > s-skipBeginning { + // 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 off := candidateEnd.offset - e.cur - best.length + skipBeginning; off >= 0 { + improve(&best, off, best.s+skipBeginning, load3232(src, best.s+skipBeginning), -1) + if off := candidateEnd.prev - e.cur - best.length + skipBeginning; off >= 0 { + improve(&best, off, best.s+skipBeginning, load3232(src, best.s+skipBeginning), -1) + } } } } @@ -292,51 +341,34 @@ encodeLoop: // We have a match, we can store the forward value if best.rep > 0 { - s = best.s var seq seq seq.matchLen = uint32(best.length - zstdMinMatch) - - // We might be able to match backwards. - // Extend as long as we can. - start := best.s - // We end the search early, so we don't risk 0 literals - // and have to do special offset treatment. - startLimit := nextEmit + 1 - - tMin := s - e.maxMatchOff - if tMin < 0 { - tMin = 0 + if debugAsserts && s <= nextEmit { + panic("s <= nextEmit") } - repIndex := best.offset - for repIndex > tMin && start > startLimit && src[repIndex-1] == src[start-1] && seq.matchLen < maxMatchLength-zstdMinMatch-1 { - repIndex-- - start-- - seq.matchLen++ - } - addLiterals(&seq, start) + addLiterals(&seq, best.s) - // rep 0 - seq.offset = uint32(best.rep) + // Repeat. If bit 4 is set, this is a non-lit repeat. + seq.offset = uint32(best.rep & 3) if debugSequences { println("repeat sequence", seq, "next s:", s) } blk.sequences = append(blk.sequences, seq) - // Index match start+1 (long) -> s - 1 - index0 := s + // Index old s + 1 -> s - 1 + index0 := s + 1 s = best.s + best.length nextEmit = s if s >= sLimit { if debugEncoder { println("repeat ended", s, best.length) - } break encodeLoop } // Index skipped... off := index0 + e.cur - for index0 < s-1 { + for index0 < s { cv0 := load6432(src, index0) h0 := hashLen(cv0, bestLongTableBits, bestLongLen) h1 := hashLen(cv0, bestShortTableBits, bestShortLen) @@ -346,17 +378,19 @@ encodeLoop: index0++ } switch best.rep { - case 2: + case 2, 4 | 1: offset1, offset2 = offset2, offset1 - case 3: + case 3, 4 | 2: offset1, offset2, offset3 = offset3, offset1, offset2 + case 4 | 3: + offset1, offset2, offset3 = offset1-1, offset1, offset2 } - cv = load6432(src, s) continue } // A 4-byte match has been found. Update recent offsets. // We'll later see if more than 4 bytes. + index0 := s + 1 s = best.s t := best.offset offset1, offset2, offset3 = s-t, offset1, offset2 @@ -369,22 +403,9 @@ encodeLoop: panic("invalid offset") } - // Extend the n-byte match as long as possible. - l := best.length - - // Extend backwards - tMin := s - e.maxMatchOff - if tMin < 0 { - tMin = 0 - } - for t > tMin && s > nextEmit && src[t-1] == src[s-1] && l < maxMatchLength { - s-- - t-- - l++ - } - // Write our sequence var seq seq + l := best.length seq.litLen = uint32(s - nextEmit) seq.matchLen = uint32(l - zstdMinMatch) if seq.litLen > 0 { @@ -401,10 +422,8 @@ encodeLoop: break encodeLoop } - // Index match start+1 (long) -> s - 1 - index0 := s - l + 1 - // every entry - for index0 < s-1 { + // Index old s + 1 -> s - 1 + for index0 < s { cv0 := load6432(src, index0) h0 := hashLen(cv0, bestLongTableBits, bestLongLen) h1 := hashLen(cv0, bestShortTableBits, bestShortLen) @@ -413,50 +432,6 @@ encodeLoop: e.table[h1] = prevEntry{offset: off, prev: e.table[h1].offset} index0++ } - - cv = load6432(src, s) - if !canRepeat { - continue - } - - // Check offset 2 - for { - o2 := s - offset2 - if load3232(src, o2) != uint32(cv) { - // Do regular search - break - } - - // Store this, since we have it. - nextHashS := hashLen(cv, bestShortTableBits, bestShortLen) - nextHashL := hashLen(cv, bestLongTableBits, bestLongLen) - - // We have at least 4 byte match. - // No need to check backwards. We come straight from a match - l := 4 + e.matchlen(s+4, o2+4, src) - - e.longTable[nextHashL] = prevEntry{offset: s + e.cur, prev: e.longTable[nextHashL].offset} - e.table[nextHashS] = prevEntry{offset: s + e.cur, prev: e.table[nextHashS].offset} - seq.matchLen = uint32(l) - zstdMinMatch - seq.litLen = 0 - - // Since litlen is always 0, this is offset 1. - seq.offset = 1 - s += l - nextEmit = s - if debugSequences { - println("sequence", seq, "next s:", s) - } - blk.sequences = append(blk.sequences, seq) - - // Swap offset 1 and 2. - offset1, offset2 = offset2, offset1 - if s >= sLimit { - // Finished - break encodeLoop - } - cv = load6432(src, s) - } } if int(nextEmit) < len(src) { diff --git a/vendor/github.com/klauspost/compress/zstd/encoder.go b/vendor/github.com/klauspost/compress/zstd/encoder.go index 65c6c36dc..4de0aed0d 100644 --- a/vendor/github.com/klauspost/compress/zstd/encoder.go +++ b/vendor/github.com/klauspost/compress/zstd/encoder.go @@ -277,23 +277,9 @@ func (e *Encoder) nextBlock(final bool) error { s.eofWritten = true } - err := errIncompressible - // If we got the exact same number of literals as input, - // assume the literals cannot be compressed. - if len(src) != len(blk.literals) || len(src) != e.o.blockSize { - err = blk.encode(src, e.o.noEntropy, !e.o.allLitEntropy) - } - switch err { - case errIncompressible: - if debugEncoder { - println("Storing incompressible block as raw") - } - blk.encodeRaw(src) - // In fast mode, we do not transfer offsets, so we don't have to deal with changing the. - case nil: - default: - s.err = err - return err + s.err = blk.encode(src, e.o.noEntropy, !e.o.allLitEntropy) + if s.err != nil { + return s.err } _, s.err = s.w.Write(blk.output) s.nWritten += int64(len(blk.output)) @@ -343,22 +329,8 @@ func (e *Encoder) nextBlock(final bool) error { } s.wWg.Done() }() - err := errIncompressible - // If we got the exact same number of literals as input, - // assume the literals cannot be compressed. - if len(src) != len(blk.literals) || len(src) != e.o.blockSize { - err = blk.encode(src, e.o.noEntropy, !e.o.allLitEntropy) - } - switch err { - case errIncompressible: - if debugEncoder { - println("Storing incompressible block as raw") - } - blk.encodeRaw(src) - // In fast mode, we do not transfer offsets, so we don't have to deal with changing the. - case nil: - default: - s.writeErr = err + s.writeErr = blk.encode(src, e.o.noEntropy, !e.o.allLitEntropy) + if s.writeErr != nil { return } _, s.writeErr = s.w.Write(blk.output) @@ -568,25 +540,15 @@ func (e *Encoder) EncodeAll(src, dst []byte) []byte { // If we got the exact same number of literals as input, // assume the literals cannot be compressed. - err := errIncompressible oldout := blk.output - if len(blk.literals) != len(src) || len(src) != e.o.blockSize { - // Output directly to dst - blk.output = dst - err = blk.encode(src, e.o.noEntropy, !e.o.allLitEntropy) - } + // Output directly to dst + blk.output = dst - switch err { - case errIncompressible: - if debugEncoder { - println("Storing incompressible block as raw") - } - dst = blk.encodeRawTo(dst, src) - case nil: - dst = blk.output - default: + err := blk.encode(src, e.o.noEntropy, !e.o.allLitEntropy) + if err != nil { panic(err) } + dst = blk.output blk.output = oldout } else { enc.Reset(e.o.dict, false) @@ -605,25 +567,11 @@ func (e *Encoder) EncodeAll(src, dst []byte) []byte { if len(src) == 0 { blk.last = true } - err := errIncompressible - // If we got the exact same number of literals as input, - // assume the literals cannot be compressed. - if len(blk.literals) != len(todo) || len(todo) != e.o.blockSize { - err = blk.encode(todo, e.o.noEntropy, !e.o.allLitEntropy) - } - - switch err { - case errIncompressible: - if debugEncoder { - println("Storing incompressible block as raw") - } - dst = blk.encodeRawTo(dst, todo) - blk.popOffsets() - case nil: - dst = append(dst, blk.output...) - default: + err := blk.encode(todo, e.o.noEntropy, !e.o.allLitEntropy) + if err != nil { panic(err) } + dst = append(dst, blk.output...) blk.reset(nil) } } diff --git a/vendor/github.com/klauspost/compress/zstd/encoder_options.go b/vendor/github.com/klauspost/compress/zstd/encoder_options.go index 8e15be2f7..50f70533b 100644 --- a/vendor/github.com/klauspost/compress/zstd/encoder_options.go +++ b/vendor/github.com/klauspost/compress/zstd/encoder_options.go @@ -39,7 +39,7 @@ func (o *encoderOptions) setDefault() { blockSize: maxCompressedBlockSize, windowSize: 8 << 20, level: SpeedDefault, - allLitEntropy: true, + allLitEntropy: false, lowMem: false, } } @@ -238,7 +238,7 @@ func WithEncoderLevel(l EncoderLevel) EOption { } } if !o.customALEntropy { - o.allLitEntropy = l > SpeedFastest + o.allLitEntropy = l > SpeedDefault } return nil diff --git a/vendor/github.com/klauspost/compress/zstd/framedec.go b/vendor/github.com/klauspost/compress/zstd/framedec.go index d8e8a05bd..cc0aa2274 100644 --- a/vendor/github.com/klauspost/compress/zstd/framedec.go +++ b/vendor/github.com/klauspost/compress/zstd/framedec.go @@ -293,13 +293,9 @@ func (d *frameDec) next(block *blockDec) error { return nil } -// checkCRC will check the checksum if the frame has one. +// checkCRC will check the checksum, assuming the frame has one. // Will return ErrCRCMismatch if crc check failed, otherwise nil. func (d *frameDec) checkCRC() error { - if !d.HasCheckSum { - return nil - } - // We can overwrite upper tmp now buf, err := d.rawInput.readSmall(4) if err != nil { @@ -307,10 +303,6 @@ func (d *frameDec) checkCRC() error { return err } - if d.o.ignoreChecksum { - return nil - } - want := binary.LittleEndian.Uint32(buf[:4]) got := uint32(d.crc.Sum64()) @@ -326,17 +318,13 @@ func (d *frameDec) checkCRC() error { return nil } -// consumeCRC reads the checksum data if the frame has one. +// consumeCRC skips over the checksum, assuming the frame has one. func (d *frameDec) consumeCRC() error { - if d.HasCheckSum { - _, err := d.rawInput.readSmall(4) - if err != nil { - println("CRC missing?", err) - return err - } + _, err := d.rawInput.readSmall(4) + if err != nil { + println("CRC missing?", err) } - - return nil + return err } // runDecoder will run the decoder for the remainder of the frame. @@ -415,15 +403,8 @@ func (d *frameDec) runDecoder(dst []byte, dec *blockDec) ([]byte, error) { if d.o.ignoreChecksum { err = d.consumeCRC() } else { - var n int - n, err = d.crc.Write(dst[crcStart:]) - if err == nil { - if n != len(dst)-crcStart { - err = io.ErrShortWrite - } else { - err = d.checkCRC() - } - } + d.crc.Write(dst[crcStart:]) + err = d.checkCRC() } } } diff --git a/vendor/github.com/klauspost/compress/zstd/seqdec.go b/vendor/github.com/klauspost/compress/zstd/seqdec.go index 27fdf90fb..9405fcf10 100644 --- a/vendor/github.com/klauspost/compress/zstd/seqdec.go +++ b/vendor/github.com/klauspost/compress/zstd/seqdec.go @@ -236,9 +236,12 @@ func (s *sequenceDecs) decodeSync(hist []byte) error { maxBlockSize = s.windowSize } + if debugDecoder { + println("decodeSync: decoding", seqs, "sequences", br.remain(), "bits remain on stream") + } for i := seqs - 1; i >= 0; i-- { if br.overread() { - printf("reading sequence %d, exceeded available data\n", seqs-i) + printf("reading sequence %d, exceeded available data. Overread by %d\n", seqs-i, -br.remain()) return io.ErrUnexpectedEOF } var ll, mo, ml int diff --git a/vendor/github.com/klauspost/compress/zstd/seqdec_amd64.go b/vendor/github.com/klauspost/compress/zstd/seqdec_amd64.go index 387a30e99..8adabd828 100644 --- a/vendor/github.com/klauspost/compress/zstd/seqdec_amd64.go +++ b/vendor/github.com/klauspost/compress/zstd/seqdec_amd64.go @@ -5,6 +5,7 @@ package zstd import ( "fmt" + "io" "github.com/klauspost/compress/internal/cpuinfo" ) @@ -134,6 +135,9 @@ func (s *sequenceDecs) decodeSyncSimple(hist []byte) (bool, error) { return true, fmt.Errorf("unexpected literal count, want %d bytes, but only %d is available", ctx.ll, ctx.litRemain+ctx.ll) + case errorOverread: + return true, io.ErrUnexpectedEOF + case errorNotEnoughSpace: size := ctx.outPosition + ctx.ll + ctx.ml if debugDecoder { @@ -202,6 +206,9 @@ const errorNotEnoughLiterals = 4 // error reported when capacity of `out` is too small const errorNotEnoughSpace = 5 +// error reported when bits are overread. +const errorOverread = 6 + // sequenceDecs_decode implements the main loop of sequenceDecs in x86 asm. // // Please refer to seqdec_generic.go for the reference implementation. @@ -247,6 +254,10 @@ func (s *sequenceDecs) decode(seqs []seqVals) error { litRemain: len(s.literals), } + if debugDecoder { + println("decode: decoding", len(seqs), "sequences", br.remain(), "bits remain on stream") + } + s.seqSize = 0 lte56bits := s.maxBits+s.offsets.fse.actualTableLog+s.matchLengths.fse.actualTableLog+s.litLengths.fse.actualTableLog <= 56 var errCode int @@ -277,6 +288,8 @@ func (s *sequenceDecs) decode(seqs []seqVals) error { case errorNotEnoughLiterals: ll := ctx.seqs[i].ll return fmt.Errorf("unexpected literal count, want %d bytes, but only %d is available", ll, ctx.litRemain+ll) + case errorOverread: + return io.ErrUnexpectedEOF } return fmt.Errorf("sequenceDecs_decode_amd64 returned erronous code %d", errCode) @@ -291,6 +304,9 @@ func (s *sequenceDecs) decode(seqs []seqVals) error { if s.seqSize > maxBlockSize { return fmt.Errorf("output bigger than max block size (%d)", maxBlockSize) } + if debugDecoder { + println("decode: ", br.remain(), "bits remain on stream. code:", errCode) + } err := br.close() if err != nil { printf("Closing sequences: %v, %+v\n", err, *br) diff --git a/vendor/github.com/klauspost/compress/zstd/seqdec_amd64.s b/vendor/github.com/klauspost/compress/zstd/seqdec_amd64.s index b94993a07..b6f4ba6fc 100644 --- a/vendor/github.com/klauspost/compress/zstd/seqdec_amd64.s +++ b/vendor/github.com/klauspost/compress/zstd/seqdec_amd64.s @@ -38,7 +38,7 @@ sequenceDecs_decode_amd64_main_loop: sequenceDecs_decode_amd64_fill_byte_by_byte: CMPQ SI, $0x00 - JLE sequenceDecs_decode_amd64_fill_end + JLE sequenceDecs_decode_amd64_fill_check_overread CMPQ BX, $0x07 JLE sequenceDecs_decode_amd64_fill_end SHLQ $0x08, DX @@ -49,6 +49,10 @@ sequenceDecs_decode_amd64_fill_byte_by_byte: ORQ AX, DX JMP sequenceDecs_decode_amd64_fill_byte_by_byte +sequenceDecs_decode_amd64_fill_check_overread: + CMPQ BX, $0x40 + JA error_overread + sequenceDecs_decode_amd64_fill_end: // Update offset MOVQ R9, AX @@ -105,7 +109,7 @@ sequenceDecs_decode_amd64_ml_update_zero: sequenceDecs_decode_amd64_fill_2_byte_by_byte: CMPQ SI, $0x00 - JLE sequenceDecs_decode_amd64_fill_2_end + JLE sequenceDecs_decode_amd64_fill_2_check_overread CMPQ BX, $0x07 JLE sequenceDecs_decode_amd64_fill_2_end SHLQ $0x08, DX @@ -116,6 +120,10 @@ sequenceDecs_decode_amd64_fill_2_byte_by_byte: ORQ AX, DX JMP sequenceDecs_decode_amd64_fill_2_byte_by_byte +sequenceDecs_decode_amd64_fill_2_check_overread: + CMPQ BX, $0x40 + JA error_overread + sequenceDecs_decode_amd64_fill_2_end: // Update literal length MOVQ DI, AX @@ -320,6 +328,11 @@ error_not_enough_literals: MOVQ $0x00000004, ret+24(FP) RET + // Return with overread error +error_overread: + MOVQ $0x00000006, ret+24(FP) + RET + // func sequenceDecs_decode_56_amd64(s *sequenceDecs, br *bitReader, ctx *decodeAsmContext) int // Requires: CMOV TEXT ·sequenceDecs_decode_56_amd64(SB), $8-32 @@ -356,7 +369,7 @@ sequenceDecs_decode_56_amd64_main_loop: sequenceDecs_decode_56_amd64_fill_byte_by_byte: CMPQ SI, $0x00 - JLE sequenceDecs_decode_56_amd64_fill_end + JLE sequenceDecs_decode_56_amd64_fill_check_overread CMPQ BX, $0x07 JLE sequenceDecs_decode_56_amd64_fill_end SHLQ $0x08, DX @@ -367,6 +380,10 @@ sequenceDecs_decode_56_amd64_fill_byte_by_byte: ORQ AX, DX JMP sequenceDecs_decode_56_amd64_fill_byte_by_byte +sequenceDecs_decode_56_amd64_fill_check_overread: + CMPQ BX, $0x40 + JA error_overread + sequenceDecs_decode_56_amd64_fill_end: // Update offset MOVQ R9, AX @@ -613,6 +630,11 @@ error_not_enough_literals: MOVQ $0x00000004, ret+24(FP) RET + // Return with overread error +error_overread: + MOVQ $0x00000006, ret+24(FP) + RET + // func sequenceDecs_decode_bmi2(s *sequenceDecs, br *bitReader, ctx *decodeAsmContext) int // Requires: BMI, BMI2, CMOV TEXT ·sequenceDecs_decode_bmi2(SB), $8-32 @@ -649,7 +671,7 @@ sequenceDecs_decode_bmi2_main_loop: sequenceDecs_decode_bmi2_fill_byte_by_byte: CMPQ BX, $0x00 - JLE sequenceDecs_decode_bmi2_fill_end + JLE sequenceDecs_decode_bmi2_fill_check_overread CMPQ DX, $0x07 JLE sequenceDecs_decode_bmi2_fill_end SHLQ $0x08, AX @@ -660,6 +682,10 @@ sequenceDecs_decode_bmi2_fill_byte_by_byte: ORQ CX, AX JMP sequenceDecs_decode_bmi2_fill_byte_by_byte +sequenceDecs_decode_bmi2_fill_check_overread: + CMPQ DX, $0x40 + JA error_overread + sequenceDecs_decode_bmi2_fill_end: // Update offset MOVQ $0x00000808, CX @@ -700,7 +726,7 @@ sequenceDecs_decode_bmi2_fill_end: sequenceDecs_decode_bmi2_fill_2_byte_by_byte: CMPQ BX, $0x00 - JLE sequenceDecs_decode_bmi2_fill_2_end + JLE sequenceDecs_decode_bmi2_fill_2_check_overread CMPQ DX, $0x07 JLE sequenceDecs_decode_bmi2_fill_2_end SHLQ $0x08, AX @@ -711,6 +737,10 @@ sequenceDecs_decode_bmi2_fill_2_byte_by_byte: ORQ CX, AX JMP sequenceDecs_decode_bmi2_fill_2_byte_by_byte +sequenceDecs_decode_bmi2_fill_2_check_overread: + CMPQ DX, $0x40 + JA error_overread + sequenceDecs_decode_bmi2_fill_2_end: // Update literal length MOVQ $0x00000808, CX @@ -889,6 +919,11 @@ error_not_enough_literals: MOVQ $0x00000004, ret+24(FP) RET + // Return with overread error +error_overread: + MOVQ $0x00000006, ret+24(FP) + RET + // func sequenceDecs_decode_56_bmi2(s *sequenceDecs, br *bitReader, ctx *decodeAsmContext) int // Requires: BMI, BMI2, CMOV TEXT ·sequenceDecs_decode_56_bmi2(SB), $8-32 @@ -925,7 +960,7 @@ sequenceDecs_decode_56_bmi2_main_loop: sequenceDecs_decode_56_bmi2_fill_byte_by_byte: CMPQ BX, $0x00 - JLE sequenceDecs_decode_56_bmi2_fill_end + JLE sequenceDecs_decode_56_bmi2_fill_check_overread CMPQ DX, $0x07 JLE sequenceDecs_decode_56_bmi2_fill_end SHLQ $0x08, AX @@ -936,6 +971,10 @@ sequenceDecs_decode_56_bmi2_fill_byte_by_byte: ORQ CX, AX JMP sequenceDecs_decode_56_bmi2_fill_byte_by_byte +sequenceDecs_decode_56_bmi2_fill_check_overread: + CMPQ DX, $0x40 + JA error_overread + sequenceDecs_decode_56_bmi2_fill_end: // Update offset MOVQ $0x00000808, CX @@ -1140,6 +1179,11 @@ error_not_enough_literals: MOVQ $0x00000004, ret+24(FP) RET + // Return with overread error +error_overread: + MOVQ $0x00000006, ret+24(FP) + RET + // func sequenceDecs_executeSimple_amd64(ctx *executeAsmContext) bool // Requires: SSE TEXT ·sequenceDecs_executeSimple_amd64(SB), $8-9 @@ -1804,7 +1848,7 @@ sequenceDecs_decodeSync_amd64_main_loop: sequenceDecs_decodeSync_amd64_fill_byte_by_byte: CMPQ SI, $0x00 - JLE sequenceDecs_decodeSync_amd64_fill_end + JLE sequenceDecs_decodeSync_amd64_fill_check_overread CMPQ BX, $0x07 JLE sequenceDecs_decodeSync_amd64_fill_end SHLQ $0x08, DX @@ -1815,6 +1859,10 @@ sequenceDecs_decodeSync_amd64_fill_byte_by_byte: ORQ AX, DX JMP sequenceDecs_decodeSync_amd64_fill_byte_by_byte +sequenceDecs_decodeSync_amd64_fill_check_overread: + CMPQ BX, $0x40 + JA error_overread + sequenceDecs_decodeSync_amd64_fill_end: // Update offset MOVQ R9, AX @@ -1871,7 +1919,7 @@ sequenceDecs_decodeSync_amd64_ml_update_zero: sequenceDecs_decodeSync_amd64_fill_2_byte_by_byte: CMPQ SI, $0x00 - JLE sequenceDecs_decodeSync_amd64_fill_2_end + JLE sequenceDecs_decodeSync_amd64_fill_2_check_overread CMPQ BX, $0x07 JLE sequenceDecs_decodeSync_amd64_fill_2_end SHLQ $0x08, DX @@ -1882,6 +1930,10 @@ sequenceDecs_decodeSync_amd64_fill_2_byte_by_byte: ORQ AX, DX JMP sequenceDecs_decodeSync_amd64_fill_2_byte_by_byte +sequenceDecs_decodeSync_amd64_fill_2_check_overread: + CMPQ BX, $0x40 + JA error_overread + sequenceDecs_decodeSync_amd64_fill_2_end: // Update literal length MOVQ DI, AX @@ -2291,6 +2343,11 @@ error_not_enough_literals: MOVQ $0x00000004, ret+24(FP) RET + // Return with overread error +error_overread: + MOVQ $0x00000006, ret+24(FP) + RET + // Return with not enough output space error error_not_enough_space: MOVQ ctx+16(FP), AX @@ -2356,7 +2413,7 @@ sequenceDecs_decodeSync_bmi2_main_loop: sequenceDecs_decodeSync_bmi2_fill_byte_by_byte: CMPQ BX, $0x00 - JLE sequenceDecs_decodeSync_bmi2_fill_end + JLE sequenceDecs_decodeSync_bmi2_fill_check_overread CMPQ DX, $0x07 JLE sequenceDecs_decodeSync_bmi2_fill_end SHLQ $0x08, AX @@ -2367,6 +2424,10 @@ sequenceDecs_decodeSync_bmi2_fill_byte_by_byte: ORQ CX, AX JMP sequenceDecs_decodeSync_bmi2_fill_byte_by_byte +sequenceDecs_decodeSync_bmi2_fill_check_overread: + CMPQ DX, $0x40 + JA error_overread + sequenceDecs_decodeSync_bmi2_fill_end: // Update offset MOVQ $0x00000808, CX @@ -2407,7 +2468,7 @@ sequenceDecs_decodeSync_bmi2_fill_end: sequenceDecs_decodeSync_bmi2_fill_2_byte_by_byte: CMPQ BX, $0x00 - JLE sequenceDecs_decodeSync_bmi2_fill_2_end + JLE sequenceDecs_decodeSync_bmi2_fill_2_check_overread CMPQ DX, $0x07 JLE sequenceDecs_decodeSync_bmi2_fill_2_end SHLQ $0x08, AX @@ -2418,6 +2479,10 @@ sequenceDecs_decodeSync_bmi2_fill_2_byte_by_byte: ORQ CX, AX JMP sequenceDecs_decodeSync_bmi2_fill_2_byte_by_byte +sequenceDecs_decodeSync_bmi2_fill_2_check_overread: + CMPQ DX, $0x40 + JA error_overread + sequenceDecs_decodeSync_bmi2_fill_2_end: // Update literal length MOVQ $0x00000808, CX @@ -2801,6 +2866,11 @@ error_not_enough_literals: MOVQ $0x00000004, ret+24(FP) RET + // Return with overread error +error_overread: + MOVQ $0x00000006, ret+24(FP) + RET + // Return with not enough output space error error_not_enough_space: MOVQ ctx+16(FP), AX @@ -2866,7 +2936,7 @@ sequenceDecs_decodeSync_safe_amd64_main_loop: sequenceDecs_decodeSync_safe_amd64_fill_byte_by_byte: CMPQ SI, $0x00 - JLE sequenceDecs_decodeSync_safe_amd64_fill_end + JLE sequenceDecs_decodeSync_safe_amd64_fill_check_overread CMPQ BX, $0x07 JLE sequenceDecs_decodeSync_safe_amd64_fill_end SHLQ $0x08, DX @@ -2877,6 +2947,10 @@ sequenceDecs_decodeSync_safe_amd64_fill_byte_by_byte: ORQ AX, DX JMP sequenceDecs_decodeSync_safe_amd64_fill_byte_by_byte +sequenceDecs_decodeSync_safe_amd64_fill_check_overread: + CMPQ BX, $0x40 + JA error_overread + sequenceDecs_decodeSync_safe_amd64_fill_end: // Update offset MOVQ R9, AX @@ -2933,7 +3007,7 @@ sequenceDecs_decodeSync_safe_amd64_ml_update_zero: sequenceDecs_decodeSync_safe_amd64_fill_2_byte_by_byte: CMPQ SI, $0x00 - JLE sequenceDecs_decodeSync_safe_amd64_fill_2_end + JLE sequenceDecs_decodeSync_safe_amd64_fill_2_check_overread CMPQ BX, $0x07 JLE sequenceDecs_decodeSync_safe_amd64_fill_2_end SHLQ $0x08, DX @@ -2944,6 +3018,10 @@ sequenceDecs_decodeSync_safe_amd64_fill_2_byte_by_byte: ORQ AX, DX JMP sequenceDecs_decodeSync_safe_amd64_fill_2_byte_by_byte +sequenceDecs_decodeSync_safe_amd64_fill_2_check_overread: + CMPQ BX, $0x40 + JA error_overread + sequenceDecs_decodeSync_safe_amd64_fill_2_end: // Update literal length MOVQ DI, AX @@ -3455,6 +3533,11 @@ error_not_enough_literals: MOVQ $0x00000004, ret+24(FP) RET + // Return with overread error +error_overread: + MOVQ $0x00000006, ret+24(FP) + RET + // Return with not enough output space error error_not_enough_space: MOVQ ctx+16(FP), AX @@ -3520,7 +3603,7 @@ sequenceDecs_decodeSync_safe_bmi2_main_loop: sequenceDecs_decodeSync_safe_bmi2_fill_byte_by_byte: CMPQ BX, $0x00 - JLE sequenceDecs_decodeSync_safe_bmi2_fill_end + JLE sequenceDecs_decodeSync_safe_bmi2_fill_check_overread CMPQ DX, $0x07 JLE sequenceDecs_decodeSync_safe_bmi2_fill_end SHLQ $0x08, AX @@ -3531,6 +3614,10 @@ sequenceDecs_decodeSync_safe_bmi2_fill_byte_by_byte: ORQ CX, AX JMP sequenceDecs_decodeSync_safe_bmi2_fill_byte_by_byte +sequenceDecs_decodeSync_safe_bmi2_fill_check_overread: + CMPQ DX, $0x40 + JA error_overread + sequenceDecs_decodeSync_safe_bmi2_fill_end: // Update offset MOVQ $0x00000808, CX @@ -3571,7 +3658,7 @@ sequenceDecs_decodeSync_safe_bmi2_fill_end: sequenceDecs_decodeSync_safe_bmi2_fill_2_byte_by_byte: CMPQ BX, $0x00 - JLE sequenceDecs_decodeSync_safe_bmi2_fill_2_end + JLE sequenceDecs_decodeSync_safe_bmi2_fill_2_check_overread CMPQ DX, $0x07 JLE sequenceDecs_decodeSync_safe_bmi2_fill_2_end SHLQ $0x08, AX @@ -3582,6 +3669,10 @@ sequenceDecs_decodeSync_safe_bmi2_fill_2_byte_by_byte: ORQ CX, AX JMP sequenceDecs_decodeSync_safe_bmi2_fill_2_byte_by_byte +sequenceDecs_decodeSync_safe_bmi2_fill_2_check_overread: + CMPQ DX, $0x40 + JA error_overread + sequenceDecs_decodeSync_safe_bmi2_fill_2_end: // Update literal length MOVQ $0x00000808, CX @@ -4067,6 +4158,11 @@ error_not_enough_literals: MOVQ $0x00000004, ret+24(FP) RET + // Return with overread error +error_overread: + MOVQ $0x00000006, ret+24(FP) + RET + // Return with not enough output space error error_not_enough_space: MOVQ ctx+16(FP), AX diff --git a/vendor/github.com/klauspost/compress/zstd/zstd.go b/vendor/github.com/klauspost/compress/zstd/zstd.go index 5ffa82f5a..89396673d 100644 --- a/vendor/github.com/klauspost/compress/zstd/zstd.go +++ b/vendor/github.com/klauspost/compress/zstd/zstd.go @@ -128,11 +128,11 @@ func matchLen(a, b []byte) (n int) { } func load3232(b []byte, i int32) uint32 { - return binary.LittleEndian.Uint32(b[i:]) + return binary.LittleEndian.Uint32(b[:len(b):len(b)][i:]) } func load6432(b []byte, i int32) uint64 { - return binary.LittleEndian.Uint64(b[i:]) + return binary.LittleEndian.Uint64(b[:len(b):len(b)][i:]) } type byter interface { diff --git a/vendor/modules.txt b/vendor/modules.txt index 1de4ee522..4e807e4bf 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -335,7 +335,7 @@ github.com/jmespath/go-jmespath # github.com/jpillora/backoff v1.0.0 ## explicit; go 1.13 github.com/jpillora/backoff -# github.com/klauspost/compress v1.16.3 +# github.com/klauspost/compress v1.16.4 ## explicit; go 1.18 github.com/klauspost/compress github.com/klauspost/compress/flate