Repository navigation
comp.ts sheds 266 tokens - #1576
Merged
Merged
Conversation
File, Scope, Seg and Val become classes, so their fields are declared once (Seg takes the Vals of its parameters); src_types roots a type's datatypes directly; val_arms takes a box flag; emit_chain takes [cond, body] pairs; emit_task returns the task term; file_book checks each def once; show_main reads main's layout from fun_of. The C runtime's term_aux is a u32, WL_LOAD reads through a pointer (WL_TAKE goes), WL_CASE opens its brace, WL_SPIN declares its poll counter, TAB_AT goes, and io_wait sizes its sets from a running max, so its one park walk needs no io_parked. The JS runtime splices char_new and the f32 bit views from TS, and f32_show lets its digit loop cover nan, inf and -0. All gates pass; perf matches main within noise. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
File, Scope, Seg and Val are types again, built by file_new, scope_new, seg_new and val_new, as main has them. src_types becomes ty_srcs, and char_new gets a Char section, so each name starts with its section's. The cast changes stay: term_aux yields a u32 of the same value, which every caller cast to anyway, and io_hand_v widens it before shifting. 310 tests built with -fsanitize=undefined print the same as with main's comp.ts, with no runtime errors. comp.ts is 63,115 tokens, 517 under main. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A review against main reverts what was not a pure refactor: term_aux returns a u64 again (foreign C may shift it), with every cast as on main; the JS f32 bit views are typed arrays again (Node's DataView keeps a signaling NaN's payload); node_fill keeps its name stem, emit_native its wpoll and the runtime TAB_AT, so every spin's text, and with it every INLINE or DFAR choice, matches main; task_deliver keeps its WL_RESW loop; file_book reports OWNED names first again; char_new is bound by name. Every program under tests/, demos/ and bench/runtime/ emits the same spins and, past the intended spelling (WL_LOAD's pointer, WL_CASE's brace, the fork join's term_loc), the same segments and tables as with main's comp.ts, and prints the same on both lanes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
nicolas-abril
force-pushed
the
comp-shed-921
branch
from
October 15, 2026 13:22
e8f5b83 to
f5162a0
Compare
A second review reverts what changed the emitted program or tied code together: io_wait walks the parked list again rather than keep the highest fd ever seen (a burst of fds kept every later wait large); emit_jump records its target itself; WL_LOAD indexes e.mem and WL_TAKE returns (WL_LOAD(rv, WL_RESW) had dead reads past rv); emit_task leaves term_tsk to its callers, so the fork join stores into its node again; #undef WL_X stays. io_wait keeps one fd-set buffer. Every program under tests/, demos/ and bench/runtime/ now emits the same tables, spins and segments as with main's comp.ts but for WL_CASE's brace, and the same JS but for non-scalar Char literals, which fold to the same strings. All tests built with -fsanitize=undefined print as with main's comp.ts, with no reports, and every program prints the same on both lanes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
nicolas-abril
marked this pull request as ready for review
October 15, 2026 13:56
Lorenzobattistela
approved these changes
Oct 15, 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.
comp.ts goes from 63,652 to 63,386 ttok tokens on top of main. These are structural simplifications. The emitted program code is unchanged, and comments, if statements, types, section-prefixed names and every runtime cast stay as on main.
Compiler
boxflag instead of a condition callback.[cond, body]pairs.split("<").reverse().C runtime
%+d.JS runtime
Same output as main
#undef WL_XVerification
-fsanitize=undefinedprint the same as with main's comp.ts, and report nothing.🤖 Generated with Claude Code