diff --git a/go.mod b/go.mod index 59d675720..3bcfc90fe 100644 --- a/go.mod +++ b/go.mod @@ -69,7 +69,7 @@ require ( golang.org/x/text v0.13.0 gopkg.in/mcuadros/go-syslog.v2 v2.3.0 gopkg.in/yaml.v3 v3.0.1 - modernc.org/sqlite v1.26.0 + modernc.org/sqlite v1.27.0 mvdan.cc/xurls/v2 v2.5.0 ) @@ -172,9 +172,9 @@ require ( lukechampine.com/uint128 v1.2.0 // indirect modernc.org/cc/v3 v3.40.0 // indirect modernc.org/ccgo/v3 v3.16.13 // indirect - modernc.org/libc v1.24.1 // indirect - modernc.org/mathutil v1.5.0 // indirect - modernc.org/memory v1.6.0 // indirect + modernc.org/libc v1.29.0 // indirect + modernc.org/mathutil v1.6.0 // indirect + modernc.org/memory v1.7.2 // indirect modernc.org/opt v0.1.3 // indirect modernc.org/strutil v1.1.3 // indirect modernc.org/token v1.0.1 // indirect diff --git a/go.sum b/go.sum index 75310e968..59a33934f 100644 --- a/go.sum +++ b/go.sum @@ -433,7 +433,6 @@ github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/quasoft/memstore v0.0.0-20191010062613-2bce066d2b0b h1:aUNXCGgukb4gtY99imuIeoh8Vr0GSwAlYxPAhqZrpFc= github.com/quasoft/memstore v0.0.0-20191010062613-2bce066d2b0b/go.mod h1:wTPjTepVu7uJBYgZ0SdWHQlIas582j6cn2jgk4DDdlg= -github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= @@ -987,16 +986,16 @@ modernc.org/ccorpus v1.11.6 h1:J16RXiiqiCgua6+ZvQot4yUuUy8zxgqbqEEUuGPlISk= modernc.org/ccorpus v1.11.6/go.mod h1:2gEUTrWqdpH2pXsmTM1ZkjeSrUWDpjMu2T6m29L/ErQ= modernc.org/httpfs v1.0.6 h1:AAgIpFZRXuYnkjftxTAZwMIiwEqAfk8aVB2/oA6nAeM= modernc.org/httpfs v1.0.6/go.mod h1:7dosgurJGp0sPaRanU53W4xZYKh14wfzX420oZADeHM= -modernc.org/libc v1.24.1 h1:uvJSeCKL/AgzBo2yYIPPTy82v21KgGnizcGYfBHaNuM= -modernc.org/libc v1.24.1/go.mod h1:FmfO1RLrU3MHJfyi9eYYmZBfi/R+tqZ6+hQ3yQQUkak= -modernc.org/mathutil v1.5.0 h1:rV0Ko/6SfM+8G+yKiyI830l3Wuz1zRutdslNoQ0kfiQ= -modernc.org/mathutil v1.5.0/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= -modernc.org/memory v1.6.0 h1:i6mzavxrE9a30whzMfwf7XWVODx2r5OYXvU46cirX7o= -modernc.org/memory v1.6.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU= +modernc.org/libc v1.29.0 h1:tTFRFq69YKCF2QyGNuRUQxKBm1uZZLubf6Cjh/pVHXs= +modernc.org/libc v1.29.0/go.mod h1:DaG/4Q3LRRdqpiLyP0C2m1B8ZMGkQ+cCgOIjEtQlYhQ= +modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4= +modernc.org/mathutil v1.6.0/go.mod h1:Ui5Q9q1TR2gFm0AQRqQUaBWFLAhQpCwNcuhBOSedWPo= +modernc.org/memory v1.7.2 h1:Klh90S215mmH8c9gO98QxQFsY+W451E8AnzjoE2ee1E= +modernc.org/memory v1.7.2/go.mod h1:NO4NVCQy0N7ln+T9ngWqOQfi7ley4vpwvARR+Hjw95E= modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4= modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= -modernc.org/sqlite v1.26.0 h1:SocQdLRSYlA8W99V8YH0NES75thx19d9sB/aFc4R8Lw= -modernc.org/sqlite v1.26.0/go.mod h1:FL3pVXie73rg3Rii6V/u5BoHlSoyeZeIgKZEgHARyCU= +modernc.org/sqlite v1.27.0 h1:MpKAHoyYB7xqcwnUwkuD+npwEa0fojF0B5QRbN+auJ8= +modernc.org/sqlite v1.27.0/go.mod h1:Qxpazz0zH8Z1xCFyi5GSL3FzbtZ3fvbjmywNogldEW0= modernc.org/strutil v1.1.3 h1:fNMm+oJklMGYfU9Ylcywl0CO5O6nTfaowNsh2wpPjzY= modernc.org/strutil v1.1.3/go.mod h1:MEHNA7PdEnEwLvspRMtWTNnp2nnyvMfkimT1NKNAGbw= modernc.org/tcl v1.15.2 h1:C4ybAYCGJw968e+Me18oW55kD/FexcHbqH2xak1ROSY= diff --git a/vendor/modernc.org/libc/Makefile b/vendor/modernc.org/libc/Makefile index 8664cd6d5..33e582f66 100644 --- a/vendor/modernc.org/libc/Makefile +++ b/vendor/modernc.org/libc/Makefile @@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. -.PHONY: all bench build_all_targets clean cover cpu editor internalError later mem nuke todo edit devbench \ +.PHONY: all bench build_all_targets clean cover cpu editor internalError later mem nuke todo edit work devbench \ darwin_amd64 \ darwin_arm64 \ linux_386 \ @@ -164,7 +164,7 @@ cpu: clean edit: @touch log - @if [ -f "Session.vim" ]; then gvim -S & else gvim -p Makefile *.go & fi + @if [ -f "Session.vim" ]; then novim -S & else novim -p Makefile libc.go & fi editor: # go generate 2>&1 | tee log @@ -189,3 +189,11 @@ todo: @grep -nr $(grep) BUG * | grep -v $(ngrep) || true @grep -nr $(grep) [^[:alpha:]]println * | grep -v $(ngrep) || true @grep -nir $(grep) 'work.*progress' || true + +work: + rm -f go.work* + go work init + go work use . + go work use ../ccgo/v4 + go work use ../ccgo/v3 + go work use ../cc/v4 diff --git a/vendor/modernc.org/libc/etc.go b/vendor/modernc.org/libc/etc.go index ca1880726..c8a64bd7c 100644 --- a/vendor/modernc.org/libc/etc.go +++ b/vendor/modernc.org/libc/etc.go @@ -9,6 +9,7 @@ "io" "os" "path/filepath" + "reflect" "runtime" "runtime/debug" "sort" @@ -436,7 +437,10 @@ func VaList(p uintptr, args ...interface{}) (r uintptr) { case uintptr: *(*uintptr)(unsafe.Pointer(p)) = x default: - panic(todo("invalid VaList argument type: %T", x)) + sz := reflect.TypeOf(v).Size() + copy(unsafe.Slice((*byte)(unsafe.Pointer(p)), sz), unsafe.Slice((*byte)(unsafe.Pointer((*[2]uintptr)(unsafe.Pointer(&v))[1])), sz)) + p += roundup(sz, 8) + continue } p += 8 } @@ -459,6 +463,18 @@ func NewVaList(args ...interface{}) (va_list uintptr) { return VaList(NewVaListN(len(args)), args...) } +func VaOther(app *uintptr, sz uint64) (r uintptr) { + ap := *(*uintptr)(unsafe.Pointer(app)) + if ap == 0 { + return 0 + } + + r = ap + ap = roundup(ap+uintptr(sz), 8) + *(*uintptr)(unsafe.Pointer(app)) = ap + return r +} + func VaInt32(app *uintptr) int32 { ap := *(*uintptr)(unsafe.Pointer(app)) if ap == 0 { @@ -584,6 +600,8 @@ func GoBytes(s uintptr, len int) []byte { return (*RawMem)(unsafe.Pointer(s))[:len:len] } +func Bool(v bool) bool { return v } + func Bool32(b bool) int32 { if b { return 1 diff --git a/vendor/modernc.org/libc/libc.go b/vendor/modernc.org/libc/libc.go index 01d6793a8..e932e0819 100644 --- a/vendor/modernc.org/libc/libc.go +++ b/vendor/modernc.org/libc/libc.go @@ -40,6 +40,10 @@ "modernc.org/mathutil" ) +const ( + ENOENT = errno.ENOENT +) + type ( // RawMem64 represents the biggest uint64 array the runtime can handle. RawMem64 [unsafe.Sizeof(RawMem{}) / unsafe.Sizeof(uint64(0))]uint64 @@ -409,13 +413,6 @@ func X__builtin_object_size(t *TLS, p uintptr, typ int32) types.Size_t { var atomicLoadStore16 sync.Mutex -func AtomicLoadNUint16(ptr uintptr, memorder int32) uint16 { - atomicLoadStore16.Lock() - r := *(*uint16)(unsafe.Pointer(ptr)) - atomicLoadStore16.Unlock() - return r -} - func AtomicStoreNUint16(ptr uintptr, val uint16, memorder int32) { atomicLoadStore16.Lock() *(*uint16)(unsafe.Pointer(ptr)) = val @@ -472,6 +469,10 @@ func Xvsnprintf(t *TLS, str uintptr, size types.Size_t, format, va uintptr) int3 return Xsnprintf(t, str, size, format, va) } +func X__builtin_vsnprintf(t *TLS, str uintptr, size types.Size_t, format, va uintptr) int32 { + return Xvsnprintf(t, str, size, format, va) +} + // int obstack_vprintf (struct obstack *obstack, const char *template, va_list ap) func Xobstack_vprintf(t *TLS, obstack, template, va uintptr) int32 { panic(todo("")) @@ -613,6 +614,7 @@ func Xlog(t *TLS, x float64) float64 { return math.Log(x) } func Xlog10(t *TLS, x float64) float64 { return math.Log10(x) } func Xlog2(t *TLS, x float64) float64 { return math.Log2(x) } func Xround(t *TLS, x float64) float64 { return math.Round(x) } +func X__builtin_round(t *TLS, x float64) float64 { return math.Round(x) } func Xsin(t *TLS, x float64) float64 { return math.Sin(x) } func Xsinf(t *TLS, x float32) float32 { return float32(math.Sin(float64(x))) } func Xsinh(t *TLS, x float64) float64 { return math.Sinh(x) } @@ -918,6 +920,7 @@ func Xputc(t *TLS, c int32, fp uintptr) int32 { // int atoi(const char *nptr); func Xatoi(t *TLS, nptr uintptr) int32 { + _, neg, _, n, _ := strToUint64(t, nptr, 10) switch { case neg: @@ -1443,3 +1446,42 @@ func Xisascii(t *TLS, c int32) int32 { func X__builtin_isunordered(t *TLS, a, b float64) int32 { return Bool32(math.IsNaN(a) || math.IsNaN(b)) } + +func AtomicLoadNUint16(ptr uintptr, memorder int32) uint16 { + atomicLoadStore16.Lock() + r := *(*uint16)(unsafe.Pointer(ptr)) + atomicLoadStore16.Unlock() + return r +} + +func PreIncAtomicInt32P(p uintptr, d int32) int32 { + return atomic.AddInt32((*int32)(unsafe.Pointer(p)), d) +} + +func PreIncAtomicInt64P(p uintptr, d int64) int64 { + return atomic.AddInt64((*int64)(unsafe.Pointer(p)), d) +} + +func PreIncAtomicUint32P(p uintptr, d uint32) uint32 { + return atomic.AddUint32((*uint32)(unsafe.Pointer(p)), d) +} + +func PreIncAtomicUint64P(p uintptr, d uint64) uint64 { + return atomic.AddUint64((*uint64)(unsafe.Pointer(p)), d) +} + +func PreInrAtomicUintptrP(p uintptr, d uintptr) uintptr { + return atomic.AddUintptr((*uintptr)(unsafe.Pointer(p)), d) +} + +func X__builtin_ffs(tls *TLS, i int32) (r int32) { + return Xffs(tls, i) +} + +func Xffs(tls *TLS, i int32) (r int32) { + if i == 0 { + return 0 + } + + return int32(mbits.TrailingZeros32(uint32(i))) + 1 +} diff --git a/vendor/modernc.org/libc/libc32.go b/vendor/modernc.org/libc/libc32.go index 060728489..c66732e48 100644 --- a/vendor/modernc.org/libc/libc32.go +++ b/vendor/modernc.org/libc/libc32.go @@ -7,6 +7,13 @@ package libc // import "modernc.org/libc" +import ( + "unsafe" + + "modernc.org/libc/limits" + "modernc.org/libc/sys/types" +) + const ( heapSize = 1 << 30 // Adjust for your debugging session requirements and system RAM size. ) @@ -28,3 +35,44 @@ func newBits(n int) (r bits) { return make(bits, (n+31)>>5) } func (b bits) has(n int) bool { return b != nil && b[n>>5]&(1<>5] |= 1 << uint(n&31) } + +func x___strchrnul(tls *TLS, s uintptr, c int32) (r uintptr) { + var k types.Size_t + var w uintptr + _, _ = k, w + c = int32(uint8(c)) + if !(c != 0) { + return s + uintptr(Xstrlen(tls, s)) + } + for { + if !(uint32(s)%Uint32FromInt64(4) != 0) { + break + } + if !(*(*int8)(unsafe.Pointer(s)) != 0) || int32(*(*uint8)(unsafe.Pointer(s))) == c { + return s + } + goto _1 + _1: + s++ + } + k = uint32(-Int32FromInt32(1)) / Uint32FromInt32(limits.UCHAR_MAX) * uint32(c) + w = s + for { + if !(!((*(*uint32)(unsafe.Pointer(w))-uint32(-Int32FromInt32(1))/Uint32FromInt32(limits.UCHAR_MAX)) & ^*(*uint32)(unsafe.Pointer(w)) & (uint32(-Int32FromInt32(1))/Uint32FromInt32(limits.UCHAR_MAX)*uint32(Int32FromInt32(limits.UCHAR_MAX)/Int32FromInt32(2)+Int32FromInt32(1))) != 0) && !((*(*uint32)(unsafe.Pointer(w))^k-uint32(-Int32FromInt32(1))/Uint32FromInt32(limits.UCHAR_MAX)) & ^(*(*uint32)(unsafe.Pointer(w))^k) & (uint32(-Int32FromInt32(1))/Uint32FromInt32(limits.UCHAR_MAX)*uint32(Int32FromInt32(limits.UCHAR_MAX)/Int32FromInt32(2)+Int32FromInt32(1))) != 0)) { + break + } + goto _2 + _2: + w += 4 + } + s = w + for { + if !(*(*int8)(unsafe.Pointer(s)) != 0 && int32(*(*uint8)(unsafe.Pointer(s))) != c) { + break + } + goto _3 + _3: + s++ + } + return s +} diff --git a/vendor/modernc.org/libc/libc64.go b/vendor/modernc.org/libc/libc64.go index 01690fe8e..6047a5ec4 100644 --- a/vendor/modernc.org/libc/libc64.go +++ b/vendor/modernc.org/libc/libc64.go @@ -7,6 +7,13 @@ package libc // import "modernc.org/libc" +import ( + "unsafe" + + "modernc.org/libc/limits" + "modernc.org/libc/sys/types" +) + const ( heapSize = 2 << 30 // Adjust for your debugging session requirements and system RAM size. ) @@ -26,3 +33,44 @@ func newBits(n int) (r bits) { return make(bits, (n+63)>>6) } func (b bits) has(n int) bool { return b != nil && b[n>>6]&(1<>6] |= 1 << uint(n&63) } + +func Xstrchrnul(tls *TLS, s uintptr, c int32) (r uintptr) { + var k types.Size_t + var w uintptr + _, _ = k, w + c = int32(uint8(uint8(c))) + if !(c != 0) { + return s + uintptr(Xstrlen(tls, s)) + } + for { + if !(uint64(uint64(s))%Uint64FromInt64(8) != 0) { + break + } + if !(*(*int8)(unsafe.Pointer(s)) != 0) || int32(*(*uint8)(unsafe.Pointer(s))) == c { + return s + } + goto _1 + _1: + s++ + } + k = uint64(-Int32FromInt32(1)) / Uint64FromInt32(limits.UCHAR_MAX) * uint64(uint64(c)) + w = s + for { + if !(!((*(*uint64)(unsafe.Pointer(w))-uint64(-Int32FromInt32(1))/Uint64FromInt32(limits.UCHAR_MAX)) & ^*(*uint64)(unsafe.Pointer(w)) & (uint64(-Int32FromInt32(1))/Uint64FromInt32(limits.UCHAR_MAX)*uint64(Int32FromInt32(limits.UCHAR_MAX)/Int32FromInt32(2)+Int32FromInt32(1))) != 0) && !((*(*uint64)(unsafe.Pointer(w))^k-uint64(-Int32FromInt32(1))/Uint64FromInt32(limits.UCHAR_MAX)) & ^(*(*uint64)(unsafe.Pointer(w))^k) & (uint64(-Int32FromInt32(1))/Uint64FromInt32(limits.UCHAR_MAX)*uint64(Int32FromInt32(limits.UCHAR_MAX)/Int32FromInt32(2)+Int32FromInt32(1))) != 0)) { + break + } + goto _2 + _2: + w += 8 + } + s = w + for { + if !(*(*int8)(unsafe.Pointer(s)) != 0 && int32(*(*uint8)(unsafe.Pointer(s))) != c) { + break + } + goto _3 + _3: + s++ + } + return s +} diff --git a/vendor/modernc.org/libc/libc_amd64.go b/vendor/modernc.org/libc/libc_amd64.go new file mode 100644 index 000000000..c17aee5c1 --- /dev/null +++ b/vendor/modernc.org/libc/libc_amd64.go @@ -0,0 +1,24 @@ +// Copyright 2023 The Libc Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package libc // import "modernc.org/libc" + +import ( + "fmt" + "unsafe" +) + +// Byte loads are atomic on this CPU. +func a_load_8(addr uintptr) uint32 { + return uint32(*(*byte)(unsafe.Pointer(addr))) +} + +// int16 loads are atomic on this CPU when properly aligned. +func a_load_16(addr uintptr) uint32 { + if addr&1 != 0 { + panic(fmt.Errorf("unaligned atomic 16 bit access at %#0x", addr)) + } + + return uint32(*(*uint16)(unsafe.Pointer(addr))) +} diff --git a/vendor/modernc.org/libc/libc_linux.go b/vendor/modernc.org/libc/libc_linux.go index 08f67be82..c150af547 100644 --- a/vendor/modernc.org/libc/libc_linux.go +++ b/vendor/modernc.org/libc/libc_linux.go @@ -37,6 +37,11 @@ "modernc.org/libc/uuid/uuid" ) +const ( + // musl/src/internal/stdio_impl.h:16:#define F_EOF 16 + m_F_EOF = 16 +) + var ( in6_addr_any in.In6_addr _ = X__ctype_b_loc @@ -49,10 +54,13 @@ type file uintptr -func (f file) fd() int32 { return (*stdio.FILE)(unsafe.Pointer(f)).F_fileno } -func (f file) setFd(fd int32) { (*stdio.FILE)(unsafe.Pointer(f)).F_fileno = fd } -func (f file) err() bool { return (*stdio.FILE)(unsafe.Pointer(f)).F_flags2&stdio.X_IO_ERR_SEEN != 0 } -func (f file) setErr() { (*stdio.FILE)(unsafe.Pointer(f)).F_flags2 |= stdio.X_IO_ERR_SEEN } +func (f file) fd() int32 { return (*stdio.FILE)(unsafe.Pointer(f)).F_fileno } +func (f file) setFd(fd int32) { (*stdio.FILE)(unsafe.Pointer(f)).F_fileno = fd } +func (f file) err() bool { return (*stdio.FILE)(unsafe.Pointer(f)).F_flags2&stdio.X_IO_ERR_SEEN != 0 } +func (f file) setErr() { (*stdio.FILE)(unsafe.Pointer(f)).F_flags2 |= stdio.X_IO_ERR_SEEN } +func (f file) flags() int32 { return (*stdio.FILE)(unsafe.Pointer(f)).F_flags } +func (f file) orFlags(n int32) { (*stdio.FILE)(unsafe.Pointer(f)).F_flags |= n } +func (f file) xorFlags(n int32) { (*stdio.FILE)(unsafe.Pointer(f)).F_flags ^= n } func (f file) close(t *TLS) int32 { r := Xclose(t, f.fd()) @@ -1065,6 +1073,9 @@ func Xfflush(t *TLS, stream uintptr) int32 { // size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream); func Xfread(t *TLS, ptr uintptr, size, nmemb types.Size_t, stream uintptr) types.Size_t { m, _, err := unix.Syscall(unix.SYS_READ, uintptr(file(stream).fd()), ptr, uintptr(size*nmemb)) + if m == 0 { + file(stream).orFlags(m_F_EOF) + } if err != 0 { file(stream).setErr() return 0 @@ -1119,6 +1130,7 @@ func Xfseek(t *TLS, stream uintptr, offset long, whence int32) int32 { // if dmesgs { // dmesg("%v: fd %v, off %#x, whence %v: ok", origin(1), file(stream).fd(), offset, whenceStr(whence)) // } + file(stream).xorFlags(m_F_EOF) return 0 } @@ -1423,6 +1435,7 @@ func Xfgetc(t *TLS, stream uintptr) int32 { return int32(buf[0]) } + file(stream).orFlags(m_F_EOF) return stdio.EOF } @@ -1581,3 +1594,10 @@ func Xnanosleep(t *TLS, req, rem uintptr) int32 { time.Sleep(time.Second*time.Duration(v.Ftv_sec) + time.Duration(v.Ftv_nsec)) return 0 } + +func Xfeof(t *TLS, f uintptr) (r int32) { + X__lockfile(t, f) + r = BoolInt32(!!((*stdio.FILE)(unsafe.Pointer(f)).F_flags&Int32FromInt32(m_F_EOF) != 0)) + X__unlockfile(t, f) + return r +} diff --git a/vendor/modernc.org/libc/libc_linux_amd64.go b/vendor/modernc.org/libc/libc_linux_amd64.go index 4d3bf1a50..af96124d0 100644 --- a/vendor/modernc.org/libc/libc_linux_amd64.go +++ b/vendor/modernc.org/libc/libc_linux_amd64.go @@ -7,6 +7,7 @@ import ( "os" "strings" + gotime "time" "unicode" "unsafe" @@ -14,10 +15,16 @@ "modernc.org/libc/errno" "modernc.org/libc/fcntl" "modernc.org/libc/signal" + "modernc.org/libc/stdio" "modernc.org/libc/sys/types" + "modernc.org/libc/time" "modernc.org/libc/wctype" ) +var ( + startTime = gotime.Now() // For clock(3) +) + // int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact); func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 { // musl/arch/x86_64/ksigaction.h @@ -475,3 +482,178 @@ func Xsetrlimit64(t *TLS, resource int32, rlim uintptr) int32 { return 0 } + +func AtomicLoadPInt8(addr uintptr) (val int8) { + return int8(a_load_8(addr)) +} + +func AtomicLoadPInt16(addr uintptr) (val int16) { + return int16(a_load_16(addr)) +} + +func AtomicLoadPUint8(addr uintptr) byte { + return byte(a_load_8(addr)) +} + +func AtomicLoadPUint16(addr uintptr) uint16 { + return uint16(a_load_16(addr)) +} + +func AtomicLoadNUint8(ptr uintptr, memorder int32) uint8 { + return byte(a_load_8(ptr)) +} + +var _table1 = [384]int32{ + 129: int32(1), + 130: int32(2), + 131: int32(3), + 132: int32(4), + 133: int32(5), + 134: int32(6), + 135: int32(7), + 136: int32(8), + 137: int32(9), + 138: int32(10), + 139: int32(11), + 140: int32(12), + 141: int32(13), + 142: int32(14), + 143: int32(15), + 144: int32(16), + 145: int32(17), + 146: int32(18), + 147: int32(19), + 148: int32(20), + 149: int32(21), + 150: int32(22), + 151: int32(23), + 152: int32(24), + 153: int32(25), + 154: int32(26), + 155: int32(27), + 156: int32(28), + 157: int32(29), + 158: int32(30), + 159: int32(31), + 160: int32(32), + 161: int32(33), + 162: int32(34), + 163: int32(35), + 164: int32(36), + 165: int32(37), + 166: int32(38), + 167: int32(39), + 168: int32(40), + 169: int32(41), + 170: int32(42), + 171: int32(43), + 172: int32(44), + 173: int32(45), + 174: int32(46), + 175: int32(47), + 176: int32(48), + 177: int32(49), + 178: int32(50), + 179: int32(51), + 180: int32(52), + 181: int32(53), + 182: int32(54), + 183: int32(55), + 184: int32(56), + 185: int32(57), + 186: int32(58), + 187: int32(59), + 188: int32(60), + 189: int32(61), + 190: int32(62), + 191: int32(63), + 192: int32(64), + 193: int32('a'), + 194: int32('b'), + 195: int32('c'), + 196: int32('d'), + 197: int32('e'), + 198: int32('f'), + 199: int32('g'), + 200: int32('h'), + 201: int32('i'), + 202: int32('j'), + 203: int32('k'), + 204: int32('l'), + 205: int32('m'), + 206: int32('n'), + 207: int32('o'), + 208: int32('p'), + 209: int32('q'), + 210: int32('r'), + 211: int32('s'), + 212: int32('t'), + 213: int32('u'), + 214: int32('v'), + 215: int32('w'), + 216: int32('x'), + 217: int32('y'), + 218: int32('z'), + 219: int32(91), + 220: int32(92), + 221: int32(93), + 222: int32(94), + 223: int32(95), + 224: int32(96), + 225: int32('a'), + 226: int32('b'), + 227: int32('c'), + 228: int32('d'), + 229: int32('e'), + 230: int32('f'), + 231: int32('g'), + 232: int32('h'), + 233: int32('i'), + 234: int32('j'), + 235: int32('k'), + 236: int32('l'), + 237: int32('m'), + 238: int32('n'), + 239: int32('o'), + 240: int32('p'), + 241: int32('q'), + 242: int32('r'), + 243: int32('s'), + 244: int32('t'), + 245: int32('u'), + 246: int32('v'), + 247: int32('w'), + 248: int32('x'), + 249: int32('y'), + 250: int32('z'), + 251: int32(123), + 252: int32(124), + 253: int32(125), + 254: int32(126), + 255: int32(127), +} + +var _ptable1 = uintptr(unsafe.Pointer(&_table1)) + uintptr(128)*4 + +func X__ctype_tolower_loc(tls *TLS) (r uintptr) { + return uintptr(unsafe.Pointer(&_ptable1)) +} + +type Tin6_addr = struct { + F__in6_union struct { + F__s6_addr16 [0][8]uint16 + F__s6_addr32 [0][4]uint32 + F__s6_addr [16]uint8 + } +} + +var Xin6addr_any = Tin6_addr{} + +func Xrewinddir(tls *TLS, f uintptr) { + Xfseek(tls, f, 0, stdio.SEEK_SET) +} + +// clock_t clock(void); +func Xclock(t *TLS) time.Clock_t { + return time.Clock_t(gotime.Since(startTime) * gotime.Duration(time.CLOCKS_PER_SEC) / gotime.Second) +} diff --git a/vendor/modernc.org/libc/libc_linux_loong64.go b/vendor/modernc.org/libc/libc_linux_loong64.go index 5dc8d5e08..9dfea4572 100644 --- a/vendor/modernc.org/libc/libc_linux_loong64.go +++ b/vendor/modernc.org/libc/libc_linux_loong64.go @@ -5,10 +5,10 @@ package libc // import "modernc.org/libc" import ( - "unicode" - "unsafe" "os" "strings" + "unicode" + "unsafe" "golang.org/x/sys/unix" "modernc.org/libc/errno" diff --git a/vendor/modernc.org/libc/mem.go b/vendor/modernc.org/libc/mem.go index 50056c75c..3d50a7b33 100644 --- a/vendor/modernc.org/libc/mem.go +++ b/vendor/modernc.org/libc/mem.go @@ -86,6 +86,18 @@ func Xfree(t *TLS, p uintptr) { allocator.UintptrFree(p) } +func Xmalloc_usable_size(tls *TLS, p uintptr) (r types.Size_t) { + if p == 0 { + return 0 + } + + allocMu.Lock() + + defer allocMu.Unlock() + + return types.Size_t(memory.UintptrUsableSize(p)) +} + func UsableSize(p uintptr) types.Size_t { allocMu.Lock() diff --git a/vendor/modernc.org/libc/musl_linux_amd64.go b/vendor/modernc.org/libc/musl_linux_amd64.go index 7921d9927..bb9918f1b 100644 --- a/vendor/modernc.org/libc/musl_linux_amd64.go +++ b/vendor/modernc.org/libc/musl_linux_amd64.go @@ -460,6 +460,10 @@ func Xisprint(tls *TLS, c int32) int32 { /* isprint.c:4:5: */ return Bool32(uint32(c)-uint32(0x20) < uint32(0x5f)) } +func X__builtin_isprint(tls *TLS, c int32) int32 { /* isprint.c:4:5: */ + return Bool32(uint32(c)-uint32(0x20) < uint32(0x5f)) +} + func X__isprint_l(tls *TLS, c int32, l locale_t) int32 { /* isprint.c:9:5: */ return Xisprint(tls, c) } diff --git a/vendor/modernc.org/libc/printf.go b/vendor/modernc.org/libc/printf.go index a26ad40e4..d6de15d5d 100644 --- a/vendor/modernc.org/libc/printf.go +++ b/vendor/modernc.org/libc/printf.go @@ -141,7 +141,7 @@ func printfConversion(buf *bytes.Buffer, format uintptr, args *uintptr) uintptr mod = modNone } switch mod { - case modL, modLL, mod64: + case modL, modLL, mod64, modJ: arg = VaInt64(args) case modH: arg = int64(int16(VaInt32(args))) @@ -149,6 +149,8 @@ func printfConversion(buf *bytes.Buffer, format uintptr, args *uintptr) uintptr arg = int64(int8(VaInt32(args))) case mod32, modNone: arg = int64(VaInt32(args)) + case modT: + arg = int64(VaInt64(args)) default: panic(todo("", mod)) } @@ -185,6 +187,8 @@ func printfConversion(buf *bytes.Buffer, format uintptr, args *uintptr) uintptr arg = uint64(uint8(VaInt32(args))) case mod32: arg = uint64(VaInt32(args)) + case modZ: + arg = uint64(VaInt64(args)) default: panic(todo("", mod)) } @@ -609,13 +613,18 @@ func parseLengthModifier(format uintptr) (_ uintptr, n int) { n = modLD return format, n case 'j': - panic(todo("")) + format++ + n = modJ + return format, n case 'z': - panic(todo("")) + format++ + return format, modZ case 'Z': - panic(todo("")) + format++ + return format, modCapitalZ case 't': - panic(todo("")) + format++ + return format, modT default: return format, 0 } diff --git a/vendor/modernc.org/libc/pthread.go b/vendor/modernc.org/libc/pthread.go index 06792905c..528b83f9c 100644 --- a/vendor/modernc.org/libc/pthread.go +++ b/vendor/modernc.org/libc/pthread.go @@ -34,7 +34,9 @@ // Thread local storage. type TLS struct { - errnop uintptr + errnop uintptr + allocaStack [][]uintptr + allocas []uintptr pthreadData stack stackHeader @@ -61,6 +63,33 @@ func newTLS(detached bool) *TLS { return t } +func (t *TLS) alloca(n size_t) (r uintptr) { + r = Xmalloc(t, n) + t.allocas = append(t.allocas, r) + return r +} + +func (t *TLS) FreeAlloca() func() { + t.allocaStack = append(t.allocaStack, t.allocas) + t.allocas = nil + return func() { + for _, v := range t.allocas { + Xfree(t, v) + } + n := len(t.allocaStack) + t.allocas = t.allocaStack[n-1] + t.allocaStack = t.allocaStack[:n-1] + } +} + +func Xalloca(tls *TLS, size size_t) uintptr { + return tls.alloca(size) +} + +func X__builtin_alloca(tls *TLS, size size_t) uintptr { + return Xalloca(tls, size) +} + // Pthread specific part of a TLS. type pthreadData struct { done chan struct{} diff --git a/vendor/modernc.org/libc/time/time_linux_amd64.go b/vendor/modernc.org/libc/time/time_linux_amd64.go index e7f73f0dd..1e08a9c98 100644 --- a/vendor/modernc.org/libc/time/time_linux_amd64.go +++ b/vendor/modernc.org/libc/time/time_linux_amd64.go @@ -61,6 +61,9 @@ X_T_SIZE_ = 0 // stddef.h:185:1: Linux = 1 // :231:1: Unix = 1 // :177:1: + + // #define CLOCKS_PER_SEC ((__clock_t) 1000000) + CLOCKS_PER_SEC = 1000000 ) type Ptrdiff_t = int64 /* :3:26 */ diff --git a/vendor/modernc.org/memory/memory.go b/vendor/modernc.org/memory/memory.go index bbfaffcf7..c6d02df80 100644 --- a/vendor/modernc.org/memory/memory.go +++ b/vendor/modernc.org/memory/memory.go @@ -4,118 +4,53 @@ // Package memory implements a memory allocator. // -// Build status +// # Build status // // available at https://modern-c.appspot.com/-/builder/?importpath=modernc.org%2fmemory // -// Changelog +// # Changelog // // 2017-10-03 Added alternative, unsafe.Pointer-based API. // // Package memory implements a memory allocator. // -// Changelog +// # Changelog // // 2017-10-03 Added alternative, unsafe.Pointer-based API. // -// Benchmarks +// # Benchmarks // -// AMD Ryzen 9 3900X 12-Core Processor × 24 -// -// jnml@3900x:~/src/modernc.org/memory$ date ; go version ; go test -run @ -bench . -benchmem |& tee log -// Fri Nov 20 17:23:04 CET 2020 -// go version go1.15.5 linux/amd64 -// goos: linux -// goarch: amd64 -// pkg: modernc.org/memory -// BenchmarkFree16-24 141188362 8.26 ns/op 0 B/op 0 allocs/op -// BenchmarkFree32-24 100000000 11.4 ns/op 0 B/op 0 allocs/op -// BenchmarkFree64-24 67160647 18.3 ns/op 0 B/op 0 allocs/op -// BenchmarkCalloc16-24 60612698 19.8 ns/op 0 B/op 0 allocs/op -// BenchmarkCalloc32-24 47968105 23.8 ns/op 0 B/op 0 allocs/op -// BenchmarkCalloc64-24 40752181 28.6 ns/op 0 B/op 0 allocs/op -// BenchmarkGoCalloc16-24 66487354 17.8 ns/op 16 B/op 1 allocs/op -// BenchmarkGoCalloc32-24 56009206 21.2 ns/op 32 B/op 1 allocs/op -// BenchmarkGoCalloc64-24 52086571 23.4 ns/op 64 B/op 1 allocs/op -// BenchmarkMalloc16-24 113943390 10.2 ns/op 0 B/op 0 allocs/op -// BenchmarkMalloc32-24 113520471 10.2 ns/op 0 B/op 0 allocs/op -// BenchmarkMalloc64-24 108787056 10.7 ns/op 0 B/op 0 allocs/op -// BenchmarkUintptrFree16-24 146110286 7.94 ns/op 0 B/op 0 allocs/op -// BenchmarkUintptrFree32-24 93052707 12.0 ns/op 0 B/op 0 allocs/op -// BenchmarkUintptrFree64-24 69805262 17.3 ns/op 0 B/op 0 allocs/op -// BenchmarkUintptrCalloc16-24 85282725 13.7 ns/op 0 B/op 0 allocs/op -// BenchmarkUintptrCalloc32-24 66489789 17.9 ns/op 0 B/op 0 allocs/op -// BenchmarkUintptrCalloc64-24 53561092 22.7 ns/op 0 B/op 0 allocs/op -// BenchmarkUintptrMalloc16-24 222978858 5.28 ns/op 0 B/op 0 allocs/op -// BenchmarkUintptrMalloc32-24 210443384 5.30 ns/op 0 B/op 0 allocs/op -// BenchmarkUintptrMalloc64-24 213706227 5.47 ns/op 0 B/op 0 allocs/op -// PASS -// ok modernc.org/memory 70.528s -// jnml@3900x:~/src/modernc.org/memory$ -// -// Intel® Core™ i5-4670 CPU @ 3.40GHz × 4 -// -// ==== jnml@4670:~/src/modernc.org/memory> date ; go version ; go test -run @ -bench . -benchmem |& tee log -// Sat Dec 8 12:56:53 CET 2018 -// go version go1.11.2 linux/amd64 -// goos: linux -// goarch: amd64 -// pkg: modernc.org/memory -// BenchmarkFree16-4 100000000 14.7 ns/op 0 B/op 0 allocs/op -// BenchmarkFree32-4 100000000 20.5 ns/op 0 B/op 0 allocs/op -// BenchmarkFree64-4 50000000 32.8 ns/op 0 B/op 0 allocs/op -// BenchmarkCalloc16-4 50000000 24.4 ns/op 0 B/op 0 allocs/op -// BenchmarkCalloc32-4 50000000 29.2 ns/op 0 B/op 0 allocs/op -// BenchmarkCalloc64-4 50000000 35.7 ns/op 0 B/op 0 allocs/op -// BenchmarkGoCalloc16-4 50000000 27.0 ns/op 16 B/op 1 allocs/op -// BenchmarkGoCalloc32-4 50000000 27.3 ns/op 32 B/op 1 allocs/op -// BenchmarkGoCalloc64-4 30000000 37.9 ns/op 64 B/op 1 allocs/op -// BenchmarkMalloc16-4 100000000 12.9 ns/op 0 B/op 0 allocs/op -// BenchmarkMalloc32-4 100000000 12.9 ns/op 0 B/op 0 allocs/op -// BenchmarkMalloc64-4 100000000 13.2 ns/op 0 B/op 0 allocs/op -// BenchmarkUintptrFree16-4 100000000 12.0 ns/op 0 B/op 0 allocs/op -// BenchmarkUintptrFree32-4 100000000 17.5 ns/op 0 B/op 0 allocs/op -// BenchmarkUintptrFree64-4 50000000 28.9 ns/op 0 B/op 0 allocs/op -// BenchmarkUintptrCalloc16-4 100000000 17.8 ns/op 0 B/op 0 allocs/op -// BenchmarkUintptrCalloc32-4 100000000 22.9 ns/op 0 B/op 0 allocs/op -// BenchmarkUintptrCalloc64-4 50000000 29.6 ns/op 0 B/op 0 allocs/op -// BenchmarkUintptrMalloc16-4 200000000 7.31 ns/op 0 B/op 0 allocs/op -// BenchmarkUintptrMalloc32-4 200000000 7.47 ns/op 0 B/op 0 allocs/op -// BenchmarkUintptrMalloc64-4 200000000 7.68 ns/op 0 B/op 0 allocs/op -// PASS -// ok modernc.org/memory 73.859s -// // -// Intel® Xeon(R) CPU E5-1650 v2 @ 3.50GHz × 12 -// -// ==== jnml@e5-1650:~/src/modernc.org/memory> date ; go version ; go test -run @ -bench . -benchmem -// Fri Dec 7 14:18:50 CET 2018 -// go version go1.11.2 linux/amd64 -// goos: linux -// goarch: amd64 -// pkg: modernc.org/memory -// BenchmarkFree16-12 100000000 16.7 ns/op 0 B/op 0 allocs/op -// BenchmarkFree32-12 50000000 25.0 ns/op 0 B/op 0 allocs/op -// BenchmarkFree64-12 30000000 39.7 ns/op 0 B/op 0 allocs/op -// BenchmarkCalloc16-12 50000000 26.3 ns/op 0 B/op 0 allocs/op -// BenchmarkCalloc32-12 50000000 33.4 ns/op 0 B/op 0 allocs/op -// BenchmarkCalloc64-12 30000000 38.3 ns/op 0 B/op 0 allocs/op -// BenchmarkGoCalloc16-12 50000000 26.6 ns/op 16 B/op 1 allocs/op -// BenchmarkGoCalloc32-12 50000000 26.8 ns/op 32 B/op 1 allocs/op -// BenchmarkGoCalloc64-12 30000000 35.1 ns/op 64 B/op 1 allocs/op -// BenchmarkMalloc16-12 100000000 13.5 ns/op 0 B/op 0 allocs/op -// BenchmarkMalloc32-12 100000000 13.4 ns/op 0 B/op 0 allocs/op -// BenchmarkMalloc64-12 100000000 14.1 ns/op 0 B/op 0 allocs/op -// BenchmarkUintptrFree16-12 100000000 14.4 ns/op 0 B/op 0 allocs/op -// BenchmarkUintptrFree32-12 100000000 21.7 ns/op 0 B/op 0 allocs/op -// BenchmarkUintptrFree64-12 50000000 36.7 ns/op 0 B/op 0 allocs/op -// BenchmarkUintptrCalloc16-12 100000000 20.4 ns/op 0 B/op 0 allocs/op -// BenchmarkUintptrCalloc32-12 50000000 27.1 ns/op 0 B/op 0 allocs/op -// BenchmarkUintptrCalloc64-12 50000000 33.4 ns/op 0 B/op 0 allocs/op -// BenchmarkUintptrMalloc16-12 200000000 8.02 ns/op 0 B/op 0 allocs/op -// BenchmarkUintptrMalloc32-12 200000000 8.28 ns/op 0 B/op 0 allocs/op -// BenchmarkUintptrMalloc64-12 200000000 8.29 ns/op 0 B/op 0 allocs/op -// PASS -// ok modernc.org/memory 80.896s +// jnml@3900x:~/src/modernc.org/memory$ date ; go version ; go test -run @ -bench . -benchmem |& tee log +// Mon Sep 25 16:02:02 CEST 2023 +// go version go1.21.1 linux/amd64 +// goos: linux +// goarch: amd64 +// pkg: modernc.org/memory +// cpu: AMD Ryzen 9 3900X 12-Core Processor +// BenchmarkFree16-24 123506772 9.802 ns/op 0 B/op 0 allocs/op +// BenchmarkFree32-24 73853230 15.08 ns/op 0 B/op 0 allocs/op +// BenchmarkFree64-24 43070334 25.15 ns/op 0 B/op 0 allocs/op +// BenchmarkCalloc16-24 59353304 18.92 ns/op 0 B/op 0 allocs/op +// BenchmarkCalloc32-24 39415004 29.00 ns/op 0 B/op 0 allocs/op +// BenchmarkCalloc64-24 35825725 32.02 ns/op 0 B/op 0 allocs/op +// BenchmarkGoCalloc16-24 38274313 26.99 ns/op 16 B/op 1 allocs/op +// BenchmarkGoCalloc32-24 44590477 33.06 ns/op 32 B/op 1 allocs/op +// BenchmarkGoCalloc64-24 44233016 37.20 ns/op 64 B/op 1 allocs/op +// BenchmarkMalloc16-24 145736911 7.720 ns/op 0 B/op 0 allocs/op +// BenchmarkMalloc32-24 128898334 7.887 ns/op 0 B/op 0 allocs/op +// BenchmarkMalloc64-24 149569483 7.994 ns/op 0 B/op 0 allocs/op +// BenchmarkUintptrFree16-24 117043012 9.205 ns/op 0 B/op 0 allocs/op +// BenchmarkUintptrFree32-24 77399617 14.20 ns/op 0 B/op 0 allocs/op +// BenchmarkUintptrFree64-24 48770785 25.04 ns/op 0 B/op 0 allocs/op +// BenchmarkUintptrCalloc16-24 79257636 15.44 ns/op 0 B/op 0 allocs/op +// BenchmarkUintptrCalloc32-24 49644562 23.62 ns/op 0 B/op 0 allocs/op +// BenchmarkUintptrCalloc64-24 39854710 28.22 ns/op 0 B/op 0 allocs/op +// BenchmarkUintptrMalloc16-24 252987727 4.525 ns/op 0 B/op 0 allocs/op +// BenchmarkUintptrMalloc32-24 241423840 4.433 ns/op 0 B/op 0 allocs/op +// BenchmarkUintptrMalloc64-24 256450324 4.669 ns/op 0 B/op 0 allocs/op +// PASS +// ok modernc.org/memory 93.178s +// jnml@3900x:~/src/modernc.org/memory$ package memory // import "modernc.org/memory" import ( @@ -370,7 +305,7 @@ func (a *Allocator) UintptrRealloc(p uintptr, size int) (r uintptr, err error) { } us := UintptrUsableSize(p) - if us > size { + if us >= size { return p, nil } diff --git a/vendor/modernc.org/sqlite/AUTHORS b/vendor/modernc.org/sqlite/AUTHORS index 25e2c4599..e724f81cb 100644 --- a/vendor/modernc.org/sqlite/AUTHORS +++ b/vendor/modernc.org/sqlite/AUTHORS @@ -24,3 +24,4 @@ Michael Rykov Ross Light Saed SayedAhmed Steffen Butzer +W. Michael Petullo diff --git a/vendor/modernc.org/sqlite/CONTRIBUTORS b/vendor/modernc.org/sqlite/CONTRIBUTORS index b3e654918..ba51f0568 100644 --- a/vendor/modernc.org/sqlite/CONTRIBUTORS +++ b/vendor/modernc.org/sqlite/CONTRIBUTORS @@ -30,4 +30,5 @@ Ross Light Saed SayedAhmed Sean McGivern Steffen Butzer +W. Michael Petullo Yaacov Akiba Slama diff --git a/vendor/modules.txt b/vendor/modules.txt index 954816bea..64bd37650 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1022,8 +1022,8 @@ modernc.org/cc/v3 # modernc.org/ccgo/v3 v3.16.13 ## explicit; go 1.17 modernc.org/ccgo/v3/lib -# modernc.org/libc v1.24.1 -## explicit; go 1.18 +# modernc.org/libc v1.29.0 +## explicit; go 1.20 modernc.org/libc modernc.org/libc/errno modernc.org/libc/fcntl @@ -1050,17 +1050,17 @@ modernc.org/libc/utime modernc.org/libc/uuid modernc.org/libc/uuid/uuid modernc.org/libc/wctype -# modernc.org/mathutil v1.5.0 -## explicit; go 1.13 +# modernc.org/mathutil v1.6.0 +## explicit; go 1.18 modernc.org/mathutil -# modernc.org/memory v1.6.0 +# modernc.org/memory v1.7.2 ## explicit; go 1.18 modernc.org/memory # modernc.org/opt v0.1.3 ## explicit; go 1.13 modernc.org/opt -# modernc.org/sqlite v1.26.0 -## explicit; go 1.18 +# modernc.org/sqlite v1.27.0 +## explicit; go 1.19 modernc.org/sqlite modernc.org/sqlite/lib # modernc.org/strutil v1.1.3