Repository navigation
Tags
Tags
release: v0.6.5 CHANGELOG: [Unreleased] becomes [0.6.5] - 2026-10-16. ROADMAP: current version v0.6.5, v0.6.6 planned (callback float ABI, go-webgpu#93). README no longer carries version numbers: the per-version roadmap table and the stale version footer point to ROADMAP.md, the milestones and the CHANGELOG instead, and the platform table says how each target is verified.
chore: prepare release v0.6.4 (go-webgpu#82) Ship goffi_static linking profile, struct examples, and matching docs.
fix: ARM64 handleHFAReturn checkptr crash + 9-16B struct corruption (c… …loses go-webgpu#67) (go-webgpu#68) handleHFAReturn cast (*[4]float64)(rvalue) was oversized for 2-3 element HFAs — checkptr detected the cast spanning beyond the rvalue allocation. Fix: per-element writes via unsafe.Add, matching existing single-element pattern. Also fix (*[2]uint64)(rvalue) for 9-16B struct returns — wrote 8 full bytes for hi word even when struct < 16 bytes. Fix: copy with exact remaining size, matching AMD64 pattern. Proactive — checkptr doesn't catch this (GC pads to 16) but packed C structs could corrupt.
docs: prepare v0.6.2 release — Windows float returns fix (go-webgpu#66)
docs: v0.6.1 release prep — Android preview, CODEOWNERS, changelog (g… …o-webgpu#64) - Add @besmpl as CODEOWNER for Android paths (*android* across ffi/, internal/dl/, internal/fakecgo/, internal/syscall/, docs, scripts) - CHANGELOG: v0.6.1 entry (Android ARM64, fakecgo cleanup, LICENSE/NOTICE) - README: add Android arm64 to platform table - ARCHITECTURE: add Android to platform support matrix - ROADMAP: add v0.6.1 milestone
feat!: errno always-capture — CallFunction returns (syscall.Errno, er… …ror) (v0.6.0) (go-webgpu#61) * feat: add CallFunctionErrno with assembly-level errno capture (closes go-webgpu#60) Add CallFunctionErrno/CallFunctionErrnoContext to the public API. Errno is captured inside the assembly trampoline immediately after the C function returns, before the Go runtime can migrate the goroutine to another OS thread. Architecture: - Extend syscallArgs struct with errno/errnoFn fields at the end (no ABI break) - AMD64 Unix: call __errno_location/__error in assembly after saving returns, guarded by TESTQ so regular CallFunction has zero extra cost - ARM64: same pattern using CBZ guard; R19/R20 are callee-saved across the call - FunctionCallerErrno optional interface allows type assertion without changing existing FunctionCaller; unsupported arches fall back to plain Execute - errno_stubs_amd64.s / errno_stubs_arm64.s: JMP trampolines to dynamic symbols goffi_errno_location (same pattern as internal/dl stubs) - Windows: stub returns errno=0; use GetLastError/syscall.SyscallN third return value for Win32 errors instead Platforms: Linux/macOS/FreeBSD amd64+arm64 (errno capture); Windows (stub). All 8 cross-compile targets verified. Tests: TestCallFunctionErrnoBasic validates ENOENT capture; TestCallFunctionErrnoSuccess validates zero errno. * feat!: CallFunction always captures errno (breaking API change) BREAKING: CallFunction/CallFunctionContext now return (syscall.Errno, error). Callers that don't need errno use: _, err := ffi.CallFunction(...) errno is captured inside the assembly trampoline immediately after the C function returns, before Go runtime can migrate to a different OS thread. Cost: ~3-5 ns per call (CALL __errno_location + MOVL). This makes goffi the first pure-Go FFI with correct errno capture on Linux. Opt-in CallFunctionErrno removed -- always-capture is the enterprise approach. * docs: update public docs for v0.6.0 errno always-capture - CHANGELOG: v0.6.0 entry with breaking changes and migration guide - README: update all CallFunction examples to (_, err) pattern, add errno feature - ARCHITECTURE: document errno capture in Layer 2 section - PERFORMANCE: document +3-5ns errno overhead
Fix callbacks that cause goroutine stack to grow (go-webgpu#59) * fix: keep the syscall arg/return block in non-moving memory CallNFloat built the syscall argument and return block on the goroutine stack and handed its address to runtime_cgocall. syscallN runs on g0 and writes the C return values back into that block after the call returns. If that call runs a callback that re-enters Go and grows the goroutine stack, the stack moves (copystack) and syscallN's write lands at the stale, pre-move address, so the first such call silently loses its return value. Take the block from a sync.Pool, so it lives on the heap and never sits on a moving stack, and pin it with runtime.Pinner across the cgocall. Pooling keeps the move-safe path allocation-free in steady state; the pin keeps it correct should the heap ever become movable. Add TestCallbackGrowStack, which drives a callback through CallFunction on a fresh small-stack goroutine and forces a large copystack from inside the callback, reproducing the lost-return-value bug deterministically instead of relying on process-global warmup state. Also note runtime.Pinner in CallFunctionContext's safety documentation. * test: cover >16B struct returns via sret and simplify sret setup Add return_struct_24 (a 24-byte struct) and TestStructReturn24B, which exercise the sret ABI path the existing struct-return tests (all <= 16 bytes) never reach: the caller provides the rvalue buffer and the callee writes the struct straight into it through the hidden return pointer (RDI on amd64, X8 on arm64). Simplify the sret setup on both architectures to point that hidden return pointer directly at rvalue. CallFunction already documents that the return buffer must be valid and large enough for the result, so there is no need to allocate a scratch buffer or special-case a nil rvalue. * perf: drop runtime.Pinner, keep sync.Pool only Pool alone guarantees heap residence — sufficient for Go's non-compacting GC (confirmed through Go 1.27 including Green Tea GC). Pinner added ~60ns overhead per call due to span.speciallock mutex (measured: +68% regression). cgocheck does not apply to goffi (uses //go:linkname, not cmd/cgo). Also removes //go:noescape from hot-path runtime_cgocall declarations since args is now heap-allocated via Pool. If Go ever ships a compacting GC, add runtime.Pinner back (4 lines). * docs: update public docs for v0.5.6 callback stack-move fix - CHANGELOG: v0.5.6 entry with bug description and credit to @tie - README: remove incorrect '0 allocs (Unix)' claim, document Pool - ARCHITECTURE: replace noescape description with Pool explanation - PERFORMANCE: update allocation description --------- Co-authored-by: Andrey Kolkov <a.kolkov@gmail.com>
PreviousNext