Tags: ebitengine/purego
Tags
purego: fix arm64 argument corruption on alignment flush (#360) Fix a critical bug in ARM64 struct argument packing where the register value (val) and class were not being reset after flushing due to alignment requirements. When packing struct fields into registers, if a field's alignment causes shift >= 64, the current register is flushed. However, the code was not resetting 'val' and 'class' after the flush, causing subsequent fields to be ORed with stale data from previous fields. Example bug with FourInt32s{1, 2, 3, 4}: - Fields 0,1 packed: val = 0x0000000200000001 - Flush at field 2 due to shift >= 64 - BUG: val still contains 0x0000000200000001 - Field 2 packs: val |= 3 becomes 0x0000000200000003 (should be 0x03) - Field 3 packs: val |= (4<<32) becomes 0x0000000400000003 - Result: field 3 = 6 instead of 4 (bit 1 from field 1 leaked) This fix ensures val and class are properly reset after each flush, preventing data corruption between register boundaries. Closes #359
purego: fix arm64 argument corruption on alignment flush (#360) Fix a critical bug in ARM64 struct argument packing where the register value (val) and class were not being reset after flushing due to alignment requirements. When packing struct fields into registers, if a field's alignment causes shift >= 64, the current register is flushed. However, the code was not resetting 'val' and 'class' after the flush, causing subsequent fields to be ORed with stale data from previous fields. Example bug with FourInt32s{1, 2, 3, 4}: - Fields 0,1 packed: val = 0x0000000200000001 - Flush at field 2 due to shift >= 64 - BUG: val still contains 0x0000000200000001 - Field 2 packs: val |= 3 becomes 0x0000000200000003 (should be 0x03) - Field 3 packs: val |= (4<<32) becomes 0x0000000400000003 - Result: field 3 = 6 instead of 4 (bit 1 from field 1 leaked) This fix ensures val and class are properly reset after each flush, preventing data corruption between register boundaries. Closes #359
internal/fakecgo: deduplicate arch-agnostic code (#342) fakecgo contains multiple functions whose implementation is duplicated verbatim (excluding comments) for every supported GOOS/GOARCH pair. They can be deduplicated into arch-agnostic Go files.
all: more efficient type asserting (#341) Closes #340 Co-authored-by: Copilot <[email protected]>
all: add 32bit platforms to README (#339) 32bit Linux including Android are supported on a best-effort basis, so add them as Tier 2 platforms.
Add support for Objc blocks (#325) Adds new type, objc.Block, which is an objc.ID referencing an Objective-C "block" function pointer. Adds methods to create a Block from a Go function value, get a Go function value from a block, directly invoke a block function, and handle Objective-C memory management (e.g. Copy/Release). Mitigates pressure on purego Callback limit by relying on the fact the first argument passed to a block implementation is the block itself. This allows for a single callback to handle every block instance that has the same signature, by way of keeping an association between the Go func value and the block instance it was used to create. Was refactored from code in a different personal project to better fit the purego convetions and architecture. Closes #129 --------- Co-authored-by: James Welch <[email protected]>
PreviousNext