Repository navigation
Conversation
|
Thank you @oxura for taking this on after #1015, and for the drop test we asked for. It was the most useful part of the review. We're closing this in favour of #1068, which fixes #991 closer to the root. Your Your branch works: every probe we ran agreed across the interpreter, JS and C, and the drop test prints
So #1068 lets a constructor past 247 words take that array walk. Its Two things came up while testing your branch that might be useful:
Note: this comment was written by an AI after it reported the issue to me and I made the decision. If anything here is wrong, reply and I will review it myself. |
…47 words as an array (#1068) term_drop frees a tree without a stack, packing each node's position, child index and arity into one word, 8 bits each: that packing, not the language, capped a node at 255 words, so a record of 256 one-word fields was checked, interpreted and run on JS but refused by C (#991). The same walker already frees an array of any size, taking its cell count from the size class and keeping its index in the node's own slot 1. A constructor past 247 words is padded to its size class, the pad written as zero like every unset word of a constructor, and keeps 240 plus log2 of its size in its u8 CID_ARITY_T entry; term_drop walks it as an array. WIDE drops to 247 for flat layouts and segments, so only a constructor's entry can pass it, and a value past WIDE words travels boxed. Datatypes no longer box multi-word fields to fit a node; a def's parameters still do (#944), inlined in sig_def. A program without such a node emits the same C but for one line in term_drop. tests/reg/wide_record_drop comes from #1044; wide_record_stale drops padded 250-field nodes in blocks that still hold String pointers. The headers of arity_wall, record_wide_node and record_deep_boxed and SHADERS.md's segment limit say what the compiler does now. Closes #991. Co-authored-by: oxura <[email protected]> Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Fixes #991; replaces the closed #1015. That proposal widened
CID_ARITY_T, but the native node walker also packs arity and field index into eight bits. This version keeps every constructor arity andCID_ARITY_Tentry within 255 instead. Once multi-word fields have been boxed, a remaining run of one-word fields is represented by a boxed sub-node with its own bounded arity. Construction, pattern matches, layout conversions and pure-value display use the same source-field mapping.tests/reg/record_256_fields.bendchecks first/last fields at the boundary;tests/reg/wide_record_drop.benddrops a whole unopened list of six 256-field records before building six 300-field records and checks the last result. An existing 255-field case and the prior nested-wide constructor fixture still pass. Locally I also exercised a 512-field record, shared wide records containing strings, a multi-constructor wide datatype and native/JS agreement when printing a wide value.Verification: interpreted JS, emitted JS and native C produced
501/501on the drop regression; 256 and 512 fields and the existing nested-wide case compile and run natively; the new fixtures pass--checkup;bun gates/repo.tsreports PASS 46/46. The cluster gate and macOS build were unavailable. Segment arity remains independently bounded at 255 words.