mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[chore] Upgrade wasm-sqlite to v0.16.2 (#2997)
This commit is contained in:
3
vendor/github.com/tetratelabs/wazero/internal/wasm/engine.go
generated
vendored
3
vendor/github.com/tetratelabs/wazero/internal/wasm/engine.go
generated
vendored
@ -69,4 +69,7 @@ type ModuleEngine interface {
|
||||
// FunctionInstanceReference returns Reference for the given Index for a FunctionInstance. The returned values are used by
|
||||
// the initialization via ElementSegment.
|
||||
FunctionInstanceReference(funcIndex Index) Reference
|
||||
|
||||
// MemoryGrown notifies the engine that the memory has grown.
|
||||
MemoryGrown()
|
||||
}
|
||||
|
7
vendor/github.com/tetratelabs/wazero/internal/wasm/func_validation.go
generated
vendored
7
vendor/github.com/tetratelabs/wazero/internal/wasm/func_validation.go
generated
vendored
@ -67,11 +67,6 @@ func (m *Module) validateFunctionWithMaxStackValues(
|
||||
declaredFunctionIndexes map[Index]struct{},
|
||||
br *bytes.Reader,
|
||||
) error {
|
||||
nonStaticLocals := make(map[Index]struct{})
|
||||
if len(m.NonStaticLocals) > 0 {
|
||||
m.NonStaticLocals[idx] = nonStaticLocals
|
||||
}
|
||||
|
||||
functionType := &m.TypeSection[m.FunctionSection[idx]]
|
||||
code := &m.CodeSection[idx]
|
||||
body := code.Body
|
||||
@ -357,7 +352,6 @@ func (m *Module) validateFunctionWithMaxStackValues(
|
||||
return fmt.Errorf("invalid local index for %s %d >= %d(=len(locals)+len(parameters))",
|
||||
OpcodeLocalSetName, index, l)
|
||||
}
|
||||
nonStaticLocals[index] = struct{}{}
|
||||
var expType ValueType
|
||||
if index < inputLen {
|
||||
expType = functionType.Params[index]
|
||||
@ -373,7 +367,6 @@ func (m *Module) validateFunctionWithMaxStackValues(
|
||||
return fmt.Errorf("invalid local index for %s %d >= %d(=len(locals)+len(parameters))",
|
||||
OpcodeLocalTeeName, index, l)
|
||||
}
|
||||
nonStaticLocals[index] = struct{}{}
|
||||
var expType ValueType
|
||||
if index < inputLen {
|
||||
expType = functionType.Params[index]
|
||||
|
23
vendor/github.com/tetratelabs/wazero/internal/wasm/memory.go
generated
vendored
23
vendor/github.com/tetratelabs/wazero/internal/wasm/memory.go
generated
vendored
@ -59,11 +59,14 @@ type MemoryInstance struct {
|
||||
// with a fixed weight of 1 and no spurious notifications.
|
||||
waiters sync.Map
|
||||
|
||||
// ownerModuleEngine is the module engine that owns this memory instance.
|
||||
ownerModuleEngine ModuleEngine
|
||||
|
||||
expBuffer experimental.LinearMemory
|
||||
}
|
||||
|
||||
// NewMemoryInstance creates a new instance based on the parameters in the SectionIDMemory.
|
||||
func NewMemoryInstance(memSec *Memory, allocator experimental.MemoryAllocator) *MemoryInstance {
|
||||
func NewMemoryInstance(memSec *Memory, allocator experimental.MemoryAllocator, moduleEngine ModuleEngine) *MemoryInstance {
|
||||
minBytes := MemoryPagesToBytesNum(memSec.Min)
|
||||
capBytes := MemoryPagesToBytesNum(memSec.Cap)
|
||||
maxBytes := MemoryPagesToBytesNum(memSec.Max)
|
||||
@ -89,12 +92,13 @@ func NewMemoryInstance(memSec *Memory, allocator experimental.MemoryAllocator) *
|
||||
buffer = make([]byte, minBytes, capBytes)
|
||||
}
|
||||
return &MemoryInstance{
|
||||
Buffer: buffer,
|
||||
Min: memSec.Min,
|
||||
Cap: memoryBytesNumToPages(uint64(cap(buffer))),
|
||||
Max: memSec.Max,
|
||||
Shared: memSec.IsShared,
|
||||
expBuffer: expBuffer,
|
||||
Buffer: buffer,
|
||||
Min: memSec.Min,
|
||||
Cap: memoryBytesNumToPages(uint64(cap(buffer))),
|
||||
Max: memSec.Max,
|
||||
Shared: memSec.IsShared,
|
||||
expBuffer: expBuffer,
|
||||
ownerModuleEngine: moduleEngine,
|
||||
}
|
||||
}
|
||||
|
||||
@ -247,14 +251,12 @@ func (m *MemoryInstance) Grow(delta uint32) (result uint32, ok bool) {
|
||||
m.Buffer = buffer
|
||||
m.Cap = newPages
|
||||
}
|
||||
return currentPages, true
|
||||
} else if newPages > m.Cap { // grow the memory.
|
||||
if m.Shared {
|
||||
panic("shared memory cannot be grown, this is a bug in wazero")
|
||||
}
|
||||
m.Buffer = append(m.Buffer, make([]byte, MemoryPagesToBytesNum(delta))...)
|
||||
m.Cap = newPages
|
||||
return currentPages, true
|
||||
} else { // We already have the capacity we need.
|
||||
if m.Shared {
|
||||
// We assume grow is called under a guest lock.
|
||||
@ -264,8 +266,9 @@ func (m *MemoryInstance) Grow(delta uint32) (result uint32, ok bool) {
|
||||
} else {
|
||||
m.Buffer = m.Buffer[:MemoryPagesToBytesNum(newPages)]
|
||||
}
|
||||
return currentPages, true
|
||||
}
|
||||
m.ownerModuleEngine.MemoryGrown()
|
||||
return currentPages, true
|
||||
}
|
||||
|
||||
// Pages implements the same method as documented on api.Memory.
|
||||
|
7
vendor/github.com/tetratelabs/wazero/internal/wasm/module.go
generated
vendored
7
vendor/github.com/tetratelabs/wazero/internal/wasm/module.go
generated
vendored
@ -185,9 +185,6 @@ type Module struct {
|
||||
// as described in https://yurydelendik.github.io/webassembly-dwarf/, though it is not specified in the Wasm
|
||||
// specification: https://github.com/WebAssembly/debugging/issues/1
|
||||
DWARFLines *wasmdebug.DWARFLines
|
||||
|
||||
// NonStaticLocals collects the local indexes that will change its value through either local.get or local.tee.
|
||||
NonStaticLocals []map[Index]struct{}
|
||||
}
|
||||
|
||||
// ModuleID represents sha256 hash value uniquely assigned to Module.
|
||||
@ -366,8 +363,6 @@ func (m *Module) validateFunctions(enabledFeatures api.CoreFeatures, functions [
|
||||
br := bytes.NewReader(nil)
|
||||
// Also, we reuse the stacks across multiple function validations to reduce allocations.
|
||||
vs := &stacks{}
|
||||
// Non-static locals are gathered during validation and used in the down-stream compilation.
|
||||
m.NonStaticLocals = make([]map[Index]struct{}, len(m.FunctionSection))
|
||||
for idx, typeIndex := range m.FunctionSection {
|
||||
if typeIndex >= typeCount {
|
||||
return fmt.Errorf("invalid %s: type section index %d out of range", m.funcDesc(SectionIDFunction, Index(idx)), typeIndex)
|
||||
@ -655,7 +650,7 @@ func paramNames(localNames IndirectNameMap, funcIdx uint32, paramLen int) []stri
|
||||
func (m *ModuleInstance) buildMemory(module *Module, allocator experimental.MemoryAllocator) {
|
||||
memSec := module.MemorySection
|
||||
if memSec != nil {
|
||||
m.MemoryInstance = NewMemoryInstance(memSec, allocator)
|
||||
m.MemoryInstance = NewMemoryInstance(memSec, allocator, m.Engine)
|
||||
m.MemoryInstance.definition = &module.MemoryDefinitionSection[0]
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user