summaryrefslogtreecommitdiff
path: root/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/hostmodule.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2024-08-15 00:08:55 +0000
committerLibravatar GitHub <noreply@github.com>2024-08-15 00:08:55 +0000
commit09f24e044653b1327ac1c40f3ab150e3f0184f23 (patch)
tree1d9984d053fa5c8d1203abaa49b8752a1532ff11 /vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/hostmodule.go
parentupdate go-fastcopy to v1.1.3 (#3200) (diff)
downloadgotosocial-09f24e044653b1327ac1c40f3ab150e3f0184f23.tar.xz
update go-ffmpreg to v0.2.5 (pulls in latest tetratelabs/wazero) (#3203)
Diffstat (limited to 'vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/hostmodule.go')
-rw-r--r--vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/hostmodule.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/hostmodule.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/hostmodule.go
index 8da7347a9..800a5d2a8 100644
--- a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/hostmodule.go
+++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/hostmodule.go
@@ -16,6 +16,7 @@ func buildHostModuleOpaque(m *wasm.Module, listeners []experimental.FunctionList
binary.LittleEndian.PutUint64(ret[0:], uint64(uintptr(unsafe.Pointer(m))))
if len(listeners) > 0 {
+ //nolint:staticcheck
sliceHeader := (*reflect.SliceHeader)(unsafe.Pointer(&listeners))
binary.LittleEndian.PutUint64(ret[8:], uint64(sliceHeader.Data))
binary.LittleEndian.PutUint64(ret[16:], uint64(sliceHeader.Len))
@@ -33,6 +34,7 @@ func buildHostModuleOpaque(m *wasm.Module, listeners []experimental.FunctionList
func hostModuleFromOpaque(opaqueBegin uintptr) *wasm.Module {
var opaqueViewOverSlice []byte
+ //nolint:staticcheck
sh := (*reflect.SliceHeader)(unsafe.Pointer(&opaqueViewOverSlice))
sh.Data = opaqueBegin
sh.Len = 32
@@ -42,6 +44,7 @@ func hostModuleFromOpaque(opaqueBegin uintptr) *wasm.Module {
func hostModuleListenersSliceFromOpaque(opaqueBegin uintptr) []experimental.FunctionListener {
var opaqueViewOverSlice []byte
+ //nolint:staticcheck
sh := (*reflect.SliceHeader)(unsafe.Pointer(&opaqueViewOverSlice))
sh.Data = opaqueBegin
sh.Len = 32
@@ -51,9 +54,11 @@ func hostModuleListenersSliceFromOpaque(opaqueBegin uintptr) []experimental.Func
l := binary.LittleEndian.Uint64(opaqueViewOverSlice[16:])
c := binary.LittleEndian.Uint64(opaqueViewOverSlice[24:])
var ret []experimental.FunctionListener
+ //nolint:staticcheck
sh = (*reflect.SliceHeader)(unsafe.Pointer(&ret))
sh.Data = uintptr(b)
- setSliceLimits(sh, uintptr(l), uintptr(c))
+ sh.Len = int(l)
+ sh.Cap = int(c)
return ret
}
@@ -62,6 +67,7 @@ func hostModuleGoFuncFromOpaque[T any](index int, opaqueBegin uintptr) T {
ptr := opaqueBegin + offset
var opaqueViewOverFunction []byte
+ //nolint:staticcheck
sh := (*reflect.SliceHeader)(unsafe.Pointer(&opaqueViewOverFunction))
sh.Data = ptr
sh.Len = 16