diff options
Diffstat (limited to 'vendor/github.com/ncruces/go-sqlite3')
| -rw-r--r-- | vendor/github.com/ncruces/go-sqlite3/embed/build.sh | 7 | ||||
| -rw-r--r-- | vendor/github.com/ncruces/go-sqlite3/embed/sqlite3.wasm | bin | 1404349 -> 1403811 bytes | |||
| -rw-r--r-- | vendor/github.com/ncruces/go-sqlite3/internal/alloc/alloc_unix.go | 32 | ||||
| -rw-r--r-- | vendor/github.com/ncruces/go-sqlite3/internal/alloc/alloc_windows.go | 34 | ||||
| -rw-r--r-- | vendor/github.com/ncruces/go-sqlite3/util/sql3util/wasm/sql3parse_table.wasm | bin | 16007 -> 15997 bytes |
5 files changed, 45 insertions, 28 deletions
diff --git a/vendor/github.com/ncruces/go-sqlite3/embed/build.sh b/vendor/github.com/ncruces/go-sqlite3/embed/build.sh index e078c1065..85a9e4de9 100644 --- a/vendor/github.com/ncruces/go-sqlite3/embed/build.sh +++ b/vendor/github.com/ncruces/go-sqlite3/embed/build.sh @@ -27,8 +27,9 @@ trap 'rm -f sqlite3.tmp' EXIT $(awk '{print "-Wl,--export="$0}' exports.txt) "$BINARYEN/wasm-ctor-eval" -g -c _initialize sqlite3.wasm -o sqlite3.tmp -"$BINARYEN/wasm-opt" -g --strip --strip-producers -c -O3 \ - sqlite3.tmp -o sqlite3.wasm --low-memory-unused \ +"$BINARYEN/wasm-opt" -g sqlite3.tmp -o sqlite3.wasm \ + --low-memory-unused --gufa --generate-global-effects --converge -O3 \ --enable-mutable-globals --enable-nontrapping-float-to-int \ --enable-simd --enable-bulk-memory --enable-sign-ext \ - --enable-reference-types --enable-multivalue
\ No newline at end of file + --enable-reference-types --enable-multivalue \ + --strip --strip-producers
\ No newline at end of file diff --git a/vendor/github.com/ncruces/go-sqlite3/embed/sqlite3.wasm b/vendor/github.com/ncruces/go-sqlite3/embed/sqlite3.wasm Binary files differindex f8c8f5f86..e44b2cc9f 100644 --- a/vendor/github.com/ncruces/go-sqlite3/embed/sqlite3.wasm +++ b/vendor/github.com/ncruces/go-sqlite3/embed/sqlite3.wasm diff --git a/vendor/github.com/ncruces/go-sqlite3/internal/alloc/alloc_unix.go b/vendor/github.com/ncruces/go-sqlite3/internal/alloc/alloc_unix.go index a00dbbf24..203d8471a 100644 --- a/vendor/github.com/ncruces/go-sqlite3/internal/alloc/alloc_unix.go +++ b/vendor/github.com/ncruces/go-sqlite3/internal/alloc/alloc_unix.go @@ -9,24 +9,31 @@ import ( "golang.org/x/sys/unix" ) -func NewMemory(_, max uint64) experimental.LinearMemory { +func NewMemory(cap, max uint64) experimental.LinearMemory { // Round up to the page size. rnd := uint64(unix.Getpagesize() - 1) - max = (max + rnd) &^ rnd + res := (max + rnd) &^ rnd - if max > math.MaxInt { - // This ensures int(max) overflows to a negative value, + if res > math.MaxInt { + // This ensures int(res) overflows to a negative value, // and unix.Mmap returns EINVAL. - max = math.MaxUint64 + res = math.MaxUint64 } - // Reserve max bytes of address space, to ensure we won't need to move it. + com := res + prot := unix.PROT_READ | unix.PROT_WRITE + if cap < max { // Commit memory only if cap=max. + com = 0 + prot = unix.PROT_NONE + } + + // Reserve res bytes of address space, to ensure we won't need to move it. // A protected, private, anonymous mapping should not commit memory. - b, err := unix.Mmap(-1, 0, int(max), unix.PROT_NONE, unix.MAP_PRIVATE|unix.MAP_ANON) + b, err := unix.Mmap(-1, 0, int(res), prot, unix.MAP_PRIVATE|unix.MAP_ANON) if err != nil { panic(err) } - return &mmappedMemory{buf: b[:0]} + return &mmappedMemory{buf: b[:com]} } // The slice covers the entire mmapped memory: @@ -40,9 +47,11 @@ func (m *mmappedMemory) Reallocate(size uint64) []byte { com := uint64(len(m.buf)) res := uint64(cap(m.buf)) if com < size && size <= res { - // Round up to the page size. + // Grow geometrically, round up to the page size. rnd := uint64(unix.Getpagesize() - 1) - new := (size + rnd) &^ rnd + new := com + com>>3 + new = min(max(size, new), res) + new = (new + rnd) &^ rnd // Commit additional memory up to new bytes. err := unix.Mprotect(m.buf[com:new], unix.PROT_READ|unix.PROT_WRITE) @@ -50,8 +59,7 @@ func (m *mmappedMemory) Reallocate(size uint64) []byte { return nil } - // Update committed memory. - m.buf = m.buf[:new] + m.buf = m.buf[:new] // Update committed memory. } // Limit returned capacity because bytes beyond // len(m.buf) have not yet been committed. diff --git a/vendor/github.com/ncruces/go-sqlite3/internal/alloc/alloc_windows.go b/vendor/github.com/ncruces/go-sqlite3/internal/alloc/alloc_windows.go index 6bfc73a0c..ef83f0184 100644 --- a/vendor/github.com/ncruces/go-sqlite3/internal/alloc/alloc_windows.go +++ b/vendor/github.com/ncruces/go-sqlite3/internal/alloc/alloc_windows.go @@ -9,20 +9,26 @@ import ( "golang.org/x/sys/windows" ) -func NewMemory(_, max uint64) experimental.LinearMemory { +func NewMemory(cap, max uint64) experimental.LinearMemory { // Round up to the page size. rnd := uint64(windows.Getpagesize() - 1) - max = (max + rnd) &^ rnd + res := (max + rnd) &^ rnd - if max > math.MaxInt { - // This ensures uintptr(max) overflows to a large value, + if res > math.MaxInt { + // This ensures uintptr(res) overflows to a large value, // and windows.VirtualAlloc returns an error. - max = math.MaxUint64 + res = math.MaxUint64 } - // Reserve max bytes of address space, to ensure we won't need to move it. - // This does not commit memory. - r, err := windows.VirtualAlloc(0, uintptr(max), windows.MEM_RESERVE, windows.PAGE_READWRITE) + com := res + kind := windows.MEM_COMMIT + if cap < max { // Commit memory only if cap=max. + com = 0 + kind = windows.MEM_RESERVE + } + + // Reserve res bytes of address space, to ensure we won't need to move it. + r, err := windows.VirtualAlloc(0, uintptr(res), uint32(kind), windows.PAGE_READWRITE) if err != nil { panic(err) } @@ -30,8 +36,9 @@ func NewMemory(_, max uint64) experimental.LinearMemory { mem := virtualMemory{addr: r} // SliceHeader, although deprecated, avoids a go vet warning. sh := (*reflect.SliceHeader)(unsafe.Pointer(&mem.buf)) - sh.Cap = int(max) sh.Data = r + sh.Len = int(com) + sh.Cap = int(res) return &mem } @@ -47,9 +54,11 @@ func (m *virtualMemory) Reallocate(size uint64) []byte { com := uint64(len(m.buf)) res := uint64(cap(m.buf)) if com < size && size <= res { - // Round up to the page size. + // Grow geometrically, round up to the page size. rnd := uint64(windows.Getpagesize() - 1) - new := (size + rnd) &^ rnd + new := com + com>>3 + new = min(max(size, new), res) + new = (new + rnd) &^ rnd // Commit additional memory up to new bytes. _, err := windows.VirtualAlloc(m.addr, uintptr(new), windows.MEM_COMMIT, windows.PAGE_READWRITE) @@ -57,8 +66,7 @@ func (m *virtualMemory) Reallocate(size uint64) []byte { return nil } - // Update committed memory. - m.buf = m.buf[:new] + m.buf = m.buf[:new] // Update committed memory. } // Limit returned capacity because bytes beyond // len(m.buf) have not yet been committed. diff --git a/vendor/github.com/ncruces/go-sqlite3/util/sql3util/wasm/sql3parse_table.wasm b/vendor/github.com/ncruces/go-sqlite3/util/sql3util/wasm/sql3parse_table.wasm Binary files differindex 996541e76..824a7bf97 100644 --- a/vendor/github.com/ncruces/go-sqlite3/util/sql3util/wasm/sql3parse_table.wasm +++ b/vendor/github.com/ncruces/go-sqlite3/util/sql3util/wasm/sql3parse_table.wasm |
