feat(os): Processor.describe on Arm64 Linux and macOS #789

Merged
argus merged 2 commits from loop/786-arm64-describe into main 2026-11-14 20:40:20 +00:00
Collaborator

Refs #127
Closes #786

Processor.describe() now answers on Arm64 Linux and Arm64 macOS (OS slice 3, step 2c). Arm64 Windows is step 2d and still answers OsError.Unsupported, as do FreeBSD and the browser.

Commits

  1. feat(os): Arm64 feature and cache readers for Linux and macOS - Linux.auxiliaryValue (getauxval, plain Direct native in runtime/os/linux.c), the pure parsers parseImplementer, parseModel, decodeFeatures, parseCache, the macOS featuresOf / cachesOf, tests on captured Asahi, Graviton and Raspberry Pi texts and an x86 file.
  2. feat(os): Processor.describe on Arm64 Linux and macOS - the .Arm64 arms, host tests, docs/standard-library/os.md with its skills/ copy, OS.md section 7 and the slice 3 row.

Choices

  • parseImplementer answers ARM for a missing or unknown code (the spec's fallback), so an x86 file answers ARM, not none; the tests assert that.
  • Sha needs both the SHA-1 and SHA-2 hwcap bits. On macOS Neon is listed unless the sysctl says 0; SVE is never listed there.
  • packages is 1 where parsePackageCount or hw.packages answer 0.
  • Frequencies stay None.

Not verified locally (CI only)

The author had no torb binary and ran no gate, build or test.

  • runtime/machine_natives.c, runtime/include/torb_natives.h and docs/design/NATIVES.md were edited by hand as the generator would (new thunk, renumbered, count 334, 205 keep / 549 total). A drift check or regeneration may differ.
  • skills/torbscript-standard-library/.../os.md was hand-edited like the docs copy.
  • Not run: torb check --every-target, torb format --check, the tests. Syntax or formatter slips are possible (None => {} arms, Int/Int64 parity of the native).
  • Seed impact is expected to be none (the native is reachable only through Processor.describe); CI's seed gate has the final word.
  • The macOS sysctl names and Arm64 hardware paths were not run on a Mac or on Arm hardware.
Refs #127 Closes #786 `Processor.describe()` now answers on Arm64 Linux and Arm64 macOS (OS slice 3, step 2c). Arm64 Windows is step 2d and still answers `OsError.Unsupported`, as do FreeBSD and the browser. ## Commits 1. `feat(os): Arm64 feature and cache readers for Linux and macOS` - `Linux.auxiliaryValue` (`getauxval`, plain Direct native in `runtime/os/linux.c`), the pure parsers `parseImplementer`, `parseModel`, `decodeFeatures`, `parseCache`, the macOS `featuresOf` / `cachesOf`, tests on captured Asahi, Graviton and Raspberry Pi texts and an x86 file. 2. `feat(os): Processor.describe on Arm64 Linux and macOS` - the `.Arm64` arms, host tests, `docs/standard-library/os.md` with its `skills/` copy, OS.md section 7 and the slice 3 row. ## Choices - `parseImplementer` answers `ARM` for a missing or unknown code (the spec's fallback), so an x86 file answers `ARM`, not none; the tests assert that. - `Sha` needs both the SHA-1 and SHA-2 hwcap bits. On macOS `Neon` is listed unless the sysctl says 0; SVE is never listed there. - `packages` is 1 where `parsePackageCount` or `hw.packages` answer 0. - Frequencies stay `None`. ## Not verified locally (CI only) The author had no `torb` binary and ran no gate, build or test. - `runtime/machine_natives.c`, `runtime/include/torb_natives.h` and `docs/design/NATIVES.md` were edited by hand as the generator would (new thunk, renumbered, count 334, 205 keep / 549 total). A drift check or regeneration may differ. - `skills/torbscript-standard-library/.../os.md` was hand-edited like the docs copy. - Not run: `torb check --every-target`, `torb format --check`, the tests. Syntax or formatter slips are possible (`None => {}` arms, `Int`/`Int64` parity of the native). - Seed impact is expected to be none (the native is reachable only through `Processor.describe`); CI's seed gate has the final word. - The macOS sysctl names and Arm64 hardware paths were not run on a Mac or on Arm hardware.
Adds what Processor.describe needs on Arm64, as pure functions and one plain
native, none of it wired into describe yet:

- Linux.auxiliaryValue (getauxval) in runtime/os/linux.c, with its manifest
  entry, prototype and the regenerated native table.
- linux/processor: parseImplementer (CPU implementer code to vendor), parseModel,
  decodeFeatures (AT_HWCAP and AT_HWCAP2 to ProcessorFeature), parseCache and the
  cpu0/cache/index* reader.
- macos/processor: featuresOf and cachesOf over hw.optional.* and hw.l*cachesize,
  and describeArm64 over the sysctl names.
- Tests over captured /proc/cpuinfo and /sys texts of an Asahi Linux, a Graviton2
  and a Raspberry Pi, and over made-up hwcap words with and without SVE.

Refs #127
feat(os): Processor.describe on Arm64 Linux and macOS
Some checks failed
ci / commit messages (pull_request) Successful in 5s
ci / what the change touches (pull_request) Successful in 6s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 10s
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 / bootstrap (linux-x64) (pull_request) Successful in 10m33s
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 / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 4m42s
ci / every host emits the same C (pull_request) Successful in 9m47s
ci / conformance (JavaScript under Node.js) (pull_request) Successful in 1m53s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 4m31s
ci / tier A (linux-x64) (pull_request) Failing after 45m54s
ci / tier B (linux-x64) (pull_request) Successful in 43m20s
ci / pack the seed (pull_request) Has been skipped
ci / archives (pull_request) Has been skipped
ci / conformance (PHP 5.6, 7.4 and 8.4) (pull_request) Successful in 6m47s
ci / gates (pull_request) Failing after 0s
fbc40cde57
Processor.describe() gets an .Arm64 arm on Linux and macOS, built from the
readers of the previous commit and the system's own counts; packages falls back
to 1 where the system answers 0. Arm64 Windows, FreeBSD and the browser stay
OsError.Unsupported (Arm64 Windows is step 2d).

The host tests expect a description with Neon and a cache on Arm64 Linux and
macOS. docs/standard-library/os.md, its skills/ copy and OS.md (section 7 "As
built" for 2c, the slice 3 row of section 10) say what it reads.

Closes #786
orion requested review from argus 2026-11-14 16:17:02 +00:00
Collaborator

CI red on fbc40cd: ci / tier A (linux-x64) failed after 45m54s and ci / gates failed with it (job logs are not readable with the reviewer token, so the failing test or check is not identified). Everything else that ran is green (bootstrap, tier B, same-C, conformance, pdisc). Please fix or re-run; the PR body already lists the hand-edited generated files (runtime/machine_natives.c, torb_natives.h, NATIVES.md) as unverified, so check those first. No review yet; the next CI run on a new head brings me back.

CI red on fbc40cd: `ci / tier A (linux-x64)` failed after 45m54s and `ci / gates` failed with it (job logs are not readable with the reviewer token, so the failing test or check is not identified). Everything else that ran is green (bootstrap, tier B, same-C, conformance, pdisc). Please fix or re-run; the PR body already lists the hand-edited generated files (`runtime/machine_natives.c`, `torb_natives.h`, `NATIVES.md`) as unverified, so check those first. No review yet; the next CI run on a new head brings me back.
style(os): format the Arm64 processor readers with torb format
Some checks failed
ci / commit messages (pull_request) Failing after 6s
ci / what the change touches (pull_request) Successful in 7s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 13s
ci / gates (pull_request) Has been cancelled
ci / which runners exist (pull_request) Has been cancelled
ci / bootstrap (linux-x64) (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 / bootstrap and conformance (windows-x64) (pull_request) Has been cancelled
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been cancelled
ci / bootstrap and conformance (macos-arm64) (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 / conformance (JavaScript under Node.js) (pull_request) Has been cancelled
ci / conformance (PHP 5.6, 7.4 and 8.4) (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
0e10e534c0
Author
Collaborator

CI on fbc40cd was red only because of the torb format --check . gate (3 of 1761 files would change: std/os/src/linux/processor.trb, std/os/src/macos/processor.trb, std/os/tests/processor.test.trb). All other tier A gates were green, and the hand-edited generated files (runtime/machine_natives.c, torb_natives.h, NATIVES.md) are not the cause. Fixed in 0e10e53 with torb format (layout only, no behaviour change). Please re-review.

CI on fbc40cd was red only because of the `torb format --check .` gate (3 of 1761 files would change: std/os/src/linux/processor.trb, std/os/src/macos/processor.trb, std/os/tests/processor.test.trb). All other tier A gates were green, and the hand-edited generated files (runtime/machine_natives.c, torb_natives.h, NATIVES.md) are not the cause. Fixed in 0e10e53 with `torb format` (layout only, no behaviour change). Please re-review.
orion force-pushed loop/786-arm64-describe from 0e10e534c0
Some checks failed
ci / commit messages (pull_request) Failing after 6s
ci / what the change touches (pull_request) Successful in 7s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 13s
ci / gates (pull_request) Has been cancelled
ci / which runners exist (pull_request) Has been cancelled
ci / bootstrap (linux-x64) (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 / bootstrap and conformance (windows-x64) (pull_request) Has been cancelled
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been cancelled
ci / bootstrap and conformance (macos-arm64) (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 / conformance (JavaScript under Node.js) (pull_request) Has been cancelled
ci / conformance (PHP 5.6, 7.4 and 8.4) (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
to 5d8feef0d5
All checks were successful
ci / commit messages (pull_request) Successful in 6s
ci / what the change touches (pull_request) Successful in 7s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 12s
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 / bootstrap (linux-x64) (pull_request) Successful in 5m17s
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 / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 4m40s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 4m55s
ci / conformance (JavaScript under Node.js) (pull_request) Successful in 2m16s
ci / every host emits the same C (pull_request) Successful in 10m20s
ci / conformance (PHP 5.6, 7.4 and 8.4) (pull_request) Successful in 5m27s
ci / tier B (linux-x64) (pull_request) Successful in 43m36s
ci / tier A (linux-x64) (pull_request) Successful in 44m35s
ci / pack the seed (pull_request) Has been skipped
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Successful in 0s
2026-11-14 19:32:54 +00:00
Compare
argus approved these changes 2026-11-14 20:40:17 +00:00
argus left a comment

Checklist on 5d8feef:

  • Tests: ok. Captured Asahi, Graviton, Raspberry Pi, Qualcomm and x86 cpuinfo texts, decodeFeatures bit cases (HWCAP bits 1/3/5+6/7/20/22, HWCAP2 bit 1 match <asm/hwcap.h>), parseCache edge cases, macOS featuresOf/cachesOf, host test extended for Arm64. CI green on exactly this head (tier A, tier B, same-C, conformance, pdisc, gates); the earlier red was the format gate only, fixed.
  • Correctness: ok. describeArm64 arms wired for Linux and macOS only; Windows, FreeBSD and the browser still answer Unsupported. Fallbacks (vendor ARM, packages >= 1, absent sysctl is no error) match the docs.
  • Scope: ok. Closes #786, Refs #127, nothing beyond the Arm64 Linux/macOS description.
  • Security/data: ok. One Direct native (getauxval, no input beyond an int), no secrets, no stored data.
  • Generated files: ok. machine_natives.c diff is the pure renumbering plus the new thunk, the count and NATIVES.md rows agree, and the drift gates are green in CI.
  • Docs: ok. docs/standard-library/os.md and its skills copy are identical, OS.md section 7 and the slice 3 row updated.

Non-blocking:

  • host.test.trb asserts !description.caches.isEmpty() on every Arm64 Linux host; a VM or container without /sys/devices/system/cpu/cpu0/cache would fail it. The linux-arm64 and macos-arm64 jobs were skipped here, so the Arm hardware paths ran nowhere yet; worth a look when those runners first execute this.
Checklist on 5d8feef: - Tests: ok. Captured Asahi, Graviton, Raspberry Pi, Qualcomm and x86 cpuinfo texts, `decodeFeatures` bit cases (HWCAP bits 1/3/5+6/7/20/22, HWCAP2 bit 1 match `<asm/hwcap.h>`), `parseCache` edge cases, macOS `featuresOf`/`cachesOf`, host test extended for Arm64. CI green on exactly this head (tier A, tier B, same-C, conformance, pdisc, gates); the earlier red was the format gate only, fixed. - Correctness: ok. `describeArm64` arms wired for Linux and macOS only; Windows, FreeBSD and the browser still answer `Unsupported`. Fallbacks (vendor `ARM`, `packages` >= 1, absent sysctl is no error) match the docs. - Scope: ok. Closes #786, Refs #127, nothing beyond the Arm64 Linux/macOS description. - Security/data: ok. One Direct native (`getauxval`, no input beyond an int), no secrets, no stored data. - Generated files: ok. `machine_natives.c` diff is the pure renumbering plus the new thunk, the count and `NATIVES.md` rows agree, and the drift gates are green in CI. - Docs: ok. `docs/standard-library/os.md` and its skills copy are identical, OS.md section 7 and the slice 3 row updated. Non-blocking: - `host.test.trb` asserts `!description.caches.isEmpty()` on every Arm64 Linux host; a VM or container without `/sys/devices/system/cpu/cpu0/cache` would fail it. The linux-arm64 and macos-arm64 jobs were skipped here, so the Arm hardware paths ran nowhere yet; worth a look when those runners first execute this.
argus merged commit 40bd5cabf6 into main 2026-11-14 20:40:20 +00:00
argus deleted branch loop/786-arm64-describe 2026-11-14 20:40:21 +00:00
Sign in to join this conversation.
No reviewers
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!789
No description provided.