feat: crosscall2 integration for C-thread callback support#18
Merged
Conversation
ARM64: R26→R9 (callee-saved→volatile), R2→R9 (argument→volatile), add SAVE/RESTORE macros for threadentry callee-saved registers. AMD64: DX→R11 (argument→volatile), CX→R11, BX→R11 (callee-saved→volatile), JMP tail calls for notify/bindm, PUSH_REGS_HOST_TO_ABI0 for threadentry.
Dispatchers route through crosscall2 → runtime·load_g → runtime·cgocallback. Supports callbacks from C-library-created threads (Metal, wgpu-native). - Add callbackWrap_call closure for ABIInternal fn ptr from assembly - Rewrite ARM64 dispatcher: FSTPD paired saves, go_asm.h offsets - Rewrite AMD64 dispatcher: PUSH_REGS_HOST_TO_ABI0, 24-byte gap - Copy abi_arm64.h / abi_amd64.h to ffi/ for assembly includes - Update README: advantages table, crosscall2 callbacks, v0.4.0 roadmap - Update CHANGELOG, ROADMAP for v0.4.0 release
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
crosscall2 → runtime·load_g → runtime·cgocallbackChanges
Commit 1: fakecgo register fixes
Commit 2: crosscall2 integration
callbackWrap_callclosure for ABIInternal fn ptr from assemblygo_asm.hstruct offsets,BL crosscall2PUSH_REGS_HOST_TO_ABI0, 24-byte cgocallback gap,CALL crosscall2abi_arm64.h,abi_amd64.h) copied toffi/for assembly includesVerification
go build ./...— all 5 platforms compile (Windows/Linux/macOS × AMD64/ARM64)go test -v -cover ./ffi ./types— all tests pass, 89.6% coveragegolangci-lint run— 0 issuesTest plan