mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
update go-ffmpreg to v0.2.5 (pulls in latest tetratelabs/wazero) (#3203)
This commit is contained in:
10
vendor/github.com/tetratelabs/wazero/internal/wasm/memory.go
generated
vendored
10
vendor/github.com/tetratelabs/wazero/internal/wasm/memory.go
generated
vendored
@ -52,7 +52,8 @@ type MemoryInstance struct {
|
||||
definition api.MemoryDefinition
|
||||
|
||||
// Mux is used in interpreter mode to prevent overlapping calls to atomic instructions,
|
||||
// introduced with WebAssembly threads proposal.
|
||||
// introduced with WebAssembly threads proposal, and in compiler mode to make memory modifications
|
||||
// within Grow non-racy for the Go race detector.
|
||||
Mux sync.Mutex
|
||||
|
||||
// waiters implements atomic wait and notify. It is implemented similarly to golang.org/x/sync/semaphore,
|
||||
@ -227,6 +228,11 @@ func MemoryPagesToBytesNum(pages uint32) (bytesNum uint64) {
|
||||
|
||||
// Grow implements the same method as documented on api.Memory.
|
||||
func (m *MemoryInstance) Grow(delta uint32) (result uint32, ok bool) {
|
||||
if m.Shared {
|
||||
m.Mux.Lock()
|
||||
defer m.Mux.Unlock()
|
||||
}
|
||||
|
||||
currentPages := m.Pages()
|
||||
if delta == 0 {
|
||||
return currentPages, true
|
||||
@ -299,6 +305,7 @@ func PagesToUnitOfBytes(pages uint32) string {
|
||||
|
||||
// Uses atomic write to update the length of a slice.
|
||||
func atomicStoreLengthAndCap(slice *[]byte, length uintptr, cap uintptr) {
|
||||
//nolint:staticcheck
|
||||
slicePtr := (*reflect.SliceHeader)(unsafe.Pointer(slice))
|
||||
capPtr := (*uintptr)(unsafe.Pointer(&slicePtr.Cap))
|
||||
atomic.StoreUintptr(capPtr, cap)
|
||||
@ -308,6 +315,7 @@ func atomicStoreLengthAndCap(slice *[]byte, length uintptr, cap uintptr) {
|
||||
|
||||
// Uses atomic write to update the length of a slice.
|
||||
func atomicStoreLength(slice *[]byte, length uintptr) {
|
||||
//nolint:staticcheck
|
||||
slicePtr := (*reflect.SliceHeader)(unsafe.Pointer(slice))
|
||||
lenPtr := (*uintptr)(unsafe.Pointer(&slicePtr.Len))
|
||||
atomic.StoreUintptr(lenPtr, length)
|
||||
|
Reference in New Issue
Block a user