Conversation
feat(coro): add runnable stackless scheduler and panic prototype
runtime(coro): add stable wait registration and cancellation
runtime(coro): add stable executor request gate
runtime(coro): bind executor driver to scheduler
runtime(coro): add handle-free terminal executor close
# Conflicts: # cl/compile.go # go.sum # internal/build/build.go # internal/build/collect.go # internal/build/fingerprint.go # internal/build/main_module.go # internal/crosscompile/crosscompile_test.go # internal/plan9asm/indexbyte_return_test.go # runtime/internal/lib/reflect/type.go # runtime/internal/lib/runtime/_wrap/runtime.c # ssa/abitype.go # ssa/stmt_builder.go
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
…over # Conflicts: # go.sum # internal/build/collect.go # internal/build/fingerprint.go
Owner
Author
|
Superseded by #46, which contains the completed ProgramIR/HostOp hard cutover, current native and WebAssembly event/stdlib validation, and a focused bounded CI matrix. The old run completed against obsolete code and its monolithic integration process accumulated LLVM residency until timeout. |
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
This is the integrated compiler/runtime implementation for xgo-dev#1546. It preserves ordinary Go synchronous source and standard-library call style, infers suspension transitively, and lowers only the selected functions to LLVM stackless coroutines.
A source function has one primary body. An additional callable descriptor/dispatch representation is emitted only when a value crosses an open dynamic boundary such as
any, an interface, a function value, reflection, or foreign code.What this adds
G,P, executor ownership, operation IDs, wait sets, result leases, select winner claims, cancellation, detach, and producer quiescence.time.Sleep, timers/tickers, direct file syscalls,os.File, and loopback TCP with deadlines.Managed callable and reflection boundary
The branch now completes the native equivalent of
ffi_call_llgowithout forking libffi or adding a new exported libffi symbol:runtime/internal/ffi.CallLLGoenters the compiler intrinsicllgo.coroFFICall.ffi_callinvokes an ordinary ABI descriptor thunk.env/ctxtinto the target body's LLVMnestorswiftselfparameter.{function-or-descriptor, environment}; no variable-sized Go runtime funcval is introduced.This path covers
reflect.Value.Call,CallSlice, methods, method values, interface methods,Type.Method.Func, and nativereflect.MakeFunc.MakeFunc's raw libffi callback is bounded: it copies arguments and starts a managed coroutine ramp, while the user callback runs under the LLGo scheduler rather than on the libffi callback stack.The ABI preserves aggregates, zero-sized/high-alignment results, variadic logical signatures, named function types, and the target-specific closure context convention. x86/ARM/RISC-V use
nest; affected AArch64 targets useswiftselfwhere required by the supported LLVM version; unsupported targets keep an explicit-context fallback.Architectural cutover
The core has completed the planned hard cutover:
EnableCoro*feature surface;The design and invariants are documented in:
doc/llvm-coro-runtime-design.mddoc/coro-ir-design.mddoc/coro-async-core-contract.mddoc/coro-callable-contract.mdValidation
The previous integrated head
db12c497bcompleted all nine pull-request workflows successfully:Build Cache,Coroutine,Docs,Format Check,Go,LLGo,Release Build,Stdlib Coverage, andTargets. The coroutine matrix passed LLVM 19--22 and the LLGo workflow passed all 18 jobs.Additional local validation for the managed-call head includes:
reflectmakefunccoroscalar/aggregate/type matrix;reflect.Value.Calland typed invocation of namedreflect.MakeFuncvalues that suspend on timers;closureallLIT contract and LLGo end-to-end test;Current CI is running for
5bd941ef8. The first run found two gofmt-only test differences; that feedback is fixed in this head and both affected LLGo tests pass locally.Scope boundaries
This PR lands the reusable core and proven vertical slices; it does not claim that every target or every GOROOT test is complete. Remaining work includes broader GOROOT compatibility, dynamic P sizing/work stealing, full timer GC/
synctest/asynctimerchansemantics, broader FD/process/signal coverage, ordinary JS/WASI reactor pumping, RTOS/bare-metal HAL adapters, precise moving-GC integration, and target-native/AOTreflect.MakeFunctrampolines where executable libffi closures are unavailable.Native
reflect.MakeFunccurrently depends on libffi executable closures. WASM and bare-metal retain the explicit-context ABI and compile path, but need bounded AOT trampoline allocation before claiming the same dynamic callback coverage.LLVM dependency
The module currently requires
github.com/xgo-dev/llvm v0.9.5and temporarily replaces it withgithub.com/cpunion/llvm v0.9.4-0.20260724133556-6dccb7285597. That cpunion branch supplies the missing LLVM 19--22 attribute inspection needed to preserve/remapnestandswiftselfacross C ABI and large-aggregate lowering.Tracks xgo-dev#1546. This implementation remains in
cpunion/llgofor fork validation and is not proposed for xgo-dev/llgo merge at this stage.