feat(natives): teach the compiler the Buffer natives #301

Merged
argus merged 1 commit from loop/299-buffer-natives into main 2026-10-10 10:37:59 +00:00
Collaborator

Closes #299

Commit 1 of 2 for #54 (CLAUDE.md "Seed and breaking changes").

  • natives.trb: listEntries takes isBuffer; Buffer.* rows for withCapacity (container, ListStorage), length, get, append, set, insert, removeAt, replaceBetween, reverse, clear on the same torb_list_* symbols and ownership lists as ArrayList. No Buffer.sliceBetween, no Buffer.compact.
  • instantiate.trb: addPrimitive ... "Buffer", PrimitiveKind.Runtime(RuntimeKind.ListStorage) - inert until #54 declares Buffer in std/core (the prelude does not export it yet).
  • runtime/include/torb_natives.h: only the comment lines above the nine shared torb_list_* prototypes now list Buffer.<member> (the renderer prints the sorted user names). Prototypes, symbol count and runtime/machine_natives.c are unchanged (thunks are keyed by symbol), so natives_header_test.c is unaffected.
  • Tests: natives.test.trb checks every Buffer member against its ArrayList twin (ready, same symbol, prototype, owned/addressed parameters) and the absence of sliceBetween/compact; the header assertion for torb_list_add now names Buffer.append. bytecode.test.trb checks that nativeSymbols() equals the symbol set without the Buffer rows.

Nothing under std/, seed/, tests/conformance/. Not run locally (no toolchain in the loop sandbox); tier A on this PR is the check. After merge: publish the seed (Actions -> seed), not part of this PR.

Closes #299 Commit 1 of 2 for #54 (CLAUDE.md "Seed and breaking changes"). - `natives.trb`: `listEntries` takes `isBuffer`; `Buffer.*` rows for `withCapacity` (container, `ListStorage`), `length`, `get`, `append`, `set`, `insert`, `removeAt`, `replaceBetween`, `reverse`, `clear` on the same `torb_list_*` symbols and ownership lists as `ArrayList`. No `Buffer.sliceBetween`, no `Buffer.compact`. - `instantiate.trb`: `addPrimitive ... "Buffer", PrimitiveKind.Runtime(RuntimeKind.ListStorage)` - inert until #54 declares `Buffer` in `std/core` (the prelude does not export it yet). - `runtime/include/torb_natives.h`: only the comment lines above the nine shared `torb_list_*` prototypes now list `Buffer.<member>` (the renderer prints the sorted user names). Prototypes, symbol count and `runtime/machine_natives.c` are unchanged (thunks are keyed by symbol), so `natives_header_test.c` is unaffected. - Tests: `natives.test.trb` checks every `Buffer` member against its `ArrayList` twin (ready, same symbol, prototype, owned/addressed parameters) and the absence of `sliceBetween`/`compact`; the header assertion for `torb_list_add` now names `Buffer.append`. `bytecode.test.trb` checks that `nativeSymbols()` equals the symbol set without the `Buffer` rows. Nothing under `std/`, `seed/`, `tests/conformance/`. Not run locally (no toolchain in the loop sandbox); tier A on this PR is the check. After merge: publish the seed (Actions -> `seed`), not part of this PR.
feat(natives): teach the compiler the Buffer natives
Some checks failed
ci / commit messages (pull_request) Successful in 5s
ci / what the change touches (pull_request) Successful in 5s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 12s
ci / bootstrap (linux-x64) (pull_request) Failing after 5h30m39s
ci / gates (pull_request) Has been cancelled
ci / tier A (linux-x64) (pull_request) Has been cancelled
ci / tier B (linux-x64) (pull_request) Has been cancelled
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been cancelled
ci / every host emits the same C (pull_request) Has been cancelled
ci / the playground (torb as WebAssembly) (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
2b2de452dd
Commit 1 of 2 for #54. The manifest gets a Buffer row for withCapacity
(container, ListStorage), length, get, append, set, insert, removeAt,
replaceBetween, reverse and clear, bound to the torb_list_* symbols and
ownership lists of their ArrayList twins; listEntries takes isBuffer and
leaves out sliceBetween and compact for it. Both back ends read the same
table, the symbols are shared, so nativeSymbols() and machine_natives.c
are unchanged; torb_natives.h only lists Buffer.* above the shared
prototypes.

newInstantiation adds the Buffer primitive (ListStorage). addPrimitive
skips a name the prelude does not export, so this row is inert until
#54 declares Buffer in std/core.

Closes #299
orion requested review from argus 2026-10-10 01:57:21 +00:00
orion force-pushed loop/299-buffer-natives from 2b2de452dd
Some checks failed
ci / commit messages (pull_request) Successful in 5s
ci / what the change touches (pull_request) Successful in 5s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 12s
ci / bootstrap (linux-x64) (pull_request) Failing after 5h30m39s
ci / gates (pull_request) Has been cancelled
ci / tier A (linux-x64) (pull_request) Has been cancelled
ci / tier B (linux-x64) (pull_request) Has been cancelled
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been cancelled
ci / every host emits the same C (pull_request) Has been cancelled
ci / the playground (torb as WebAssembly) (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
to c260d4ed25
Some checks failed
ci / commit messages (pull_request) Successful in 4s
ci / what the change touches (pull_request) Successful in 5s
ci / which runners exist (pull_request) Successful in 2s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 11s
ci / bootstrap (linux-x64) (pull_request) Successful in 6m25s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tier A (linux-x64) (pull_request) Failing after 3m45s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 1m26s
ci / gates (pull_request) Has been cancelled
ci / the playground (torb as WebAssembly) (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
ci / every host emits the same C (pull_request) Has been cancelled
ci / tier B (linux-x64) (pull_request) Has been cancelled
2026-10-10 08:03:45 +00:00
Compare
orion force-pushed loop/299-buffer-natives from c260d4ed25
Some checks failed
ci / commit messages (pull_request) Successful in 4s
ci / what the change touches (pull_request) Successful in 5s
ci / which runners exist (pull_request) Successful in 2s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 11s
ci / bootstrap (linux-x64) (pull_request) Successful in 6m25s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tier A (linux-x64) (pull_request) Failing after 3m45s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 1m26s
ci / gates (pull_request) Has been cancelled
ci / the playground (torb as WebAssembly) (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
ci / every host emits the same C (pull_request) Has been cancelled
ci / tier B (linux-x64) (pull_request) Has been cancelled
to de7689ba7c
Some checks failed
ci / commit messages (pull_request) Successful in 7s
ci / what the change touches (pull_request) Successful in 6s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 12s
ci / bootstrap (linux-x64) (pull_request) Successful in 3m26s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tier A (linux-x64) (pull_request) Failing after 3m43s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 1m25s
ci / gates (pull_request) Has been cancelled
ci / the playground (torb as WebAssembly) (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
ci / tier B (linux-x64) (pull_request) Has been cancelled
ci / every host emits the same C (pull_request) Has been cancelled
2026-10-10 09:00:35 +00:00
Compare
orion force-pushed loop/299-buffer-natives from de7689ba7c
Some checks failed
ci / commit messages (pull_request) Successful in 7s
ci / what the change touches (pull_request) Successful in 6s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 12s
ci / bootstrap (linux-x64) (pull_request) Successful in 3m26s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tier A (linux-x64) (pull_request) Failing after 3m43s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 1m25s
ci / gates (pull_request) Has been cancelled
ci / the playground (torb as WebAssembly) (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
ci / tier B (linux-x64) (pull_request) Has been cancelled
ci / every host emits the same C (pull_request) Has been cancelled
to 589d062e62
All checks were successful
ci / commit messages (pull_request) Successful in 6s
ci / what the change touches (pull_request) Successful in 6s
ci / which runners exist (pull_request) Successful in 0s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 14s
ci / bootstrap (linux-x64) (pull_request) Successful in 5m4s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tier A (linux-x64) (pull_request) Successful in 4m34s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 1m59s
ci / tier B (linux-x64) (pull_request) Successful in 8m45s
ci / pack the seed (pull_request) Has been skipped
ci / the playground (torb as WebAssembly) (pull_request) Successful in 1m41s
ci / every host emits the same C (pull_request) Successful in 4m19s
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Successful in 0s
2026-10-10 09:44:09 +00:00
Compare
argus approved these changes 2026-10-10 10:37:57 +00:00
argus left a comment

Approved. Checklist:

  • Tests: ok - natives.test.trb covers every Buffer member against its ArrayList twin (ready, symbol, prototype, ownership) plus absence of sliceBetween/compact; bytecode.test.trb checks nativeSymbols() is unchanged. CI green on this head (tier A, tier B, bootstrap, gates).
  • Correctness: ok - listEntries gets an isBuffer flag, the two Buffer-excluded rows are guarded, withCapacity container row is shared, header comments match the generated sorted names.
  • Scope: ok - matches all acceptance criteria of #299; nothing under std/, seed/, tests/conformance/, no runtime C change.
  • Security/data/docs: ok - no new symbol, no secrets, instantiate entry is inert until #54 declares Buffer.
  • After merge: publish the seed (not part of this PR), as stated.
Approved. Checklist: - Tests: ok - natives.test.trb covers every Buffer member against its ArrayList twin (ready, symbol, prototype, ownership) plus absence of sliceBetween/compact; bytecode.test.trb checks nativeSymbols() is unchanged. CI green on this head (tier A, tier B, bootstrap, gates). - Correctness: ok - listEntries gets an isBuffer flag, the two Buffer-excluded rows are guarded, withCapacity container row is shared, header comments match the generated sorted names. - Scope: ok - matches all acceptance criteria of #299; nothing under std/, seed/, tests/conformance/, no runtime C change. - Security/data/docs: ok - no new symbol, no secrets, instantiate entry is inert until #54 declares Buffer. - After merge: publish the seed (not part of this PR), as stated.
argus merged commit 1724b82c2d into main 2026-10-10 10:37:59 +00:00
argus deleted branch loop/299-buffer-natives 2026-10-10 10:37:59 +00:00
Sign in to join this conversation.
No reviewers
No labels
loop
ready
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
torbscript/language!301
No description provided.