Conversation
cs01
added a commit
that referenced
this pull request
Feb 19, 2026
This was referenced Mar 19, 2026
3 tasks
This was referenced Apr 10, 2026
This was referenced Apr 13, 2026
Merged
cs01
added a commit
that referenced
this pull request
Apr 19, 2026
…DE.md rule #5) stage1 self-compiled binary crashed on Array.isArray because inserting a new field mid-class shifted GEP indices for subsequent fields (most notably lastInlineLambdaEnvPtr in BaseGenerator, although the same rule applies to LLVMGenerator's own fields). moving trampolineEmitter to the END of both IGeneratorContext and LLVMGenerator's field lists restores the expected struct layout and unblocks stage2 self-hosting.
cs01
added a commit
that referenced
this pull request
Apr 19, 2026
…PR2 of closure-cabi series) (#564) * feat(runtime): wire closures to child_process.spawn via trampolines, remove spawnTagged (pr2 of closure-cabi series) arrow-function callbacks now work with child_process.spawn(). captured variables are lifted into a gc-allocated env struct, registered with the trampoline slot table (pr1 infrastructure), and dispatched through a per-shape trampoline that the c bridge invokes after recovering env via cs_tramp_get(handle). this removes a long-standing constraint that spawn callbacks had to be named function references. multi-session demuxing (formerly spawnTagged, which is hard-removed here) is now a natural capture: child_process.spawn(cmd, args, (d) => onOut(sessionId, d), (d) => onErr(sessionId, d), (c) => onExit(sessionId, c)) changes: - c_bridges/child-process-spawn.c: cs_spawn_v2 takes per-callback {fn_ptr, tramp_handle} pairs. handle == -1 keeps the legacy bare-fn path; handle >= 0 routes through the trampoline. slots freed in the pipe-close / post-exit callbacks. - src/codegen/stdlib/child-process.ts: spawn() accepts arrow functions alongside variable refs; generates trampoline env + cs_tramp_alloc. - src/codegen/infrastructure/trampoline-emitter.ts: instantiated on the llvm generator, emitAll() called after lifted lambdas. stores user fn as i8* to sidestep the store-type validator. - chadscript.d.ts, llvm-declarations.ts: spawnTagged and cs_spawn_tagged removed. spawn signatures updated to document closure support. - src/codegen/expressions/method-calls/named-object-dispatch.ts: emits a clear compile error if anyone still calls spawnTagged. - tests/fixtures/closures-cabi/: three new fixtures cover single-session closure capture, multi-session demux, and named-fn back-compat. - tests/fixtures/builtins/cp-spawn-tagged.ts removed (closure form subsumes it). * fix(codegen): move trampolineEmitter to end of class field list (CLAUDE.md rule #5) stage1 self-compiled binary crashed on Array.isArray because inserting a new field mid-class shifted GEP indices for subsequent fields (most notably lastInlineLambdaEnvPtr in BaseGenerator, although the same rule applies to LLVMGenerator's own fields). moving trampolineEmitter to the END of both IGeneratorContext and LLVMGenerator's field lists restores the expected struct layout and unblocks stage2 self-hosting. --------- Co-authored-by: cs01 <cs01@users.noreply.github.com>
This was referenced Apr 19, 2026
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.
add support for cross compilation (eg from mac -> linux or linux -> mac)