Skip to content

Vm test cleanup - #4

Merged
cuzzo merged 4 commits into
masterfrom
vm-test-cleanup
Aug 1, 2026
Merged

Vm test cleanup#4
cuzzo merged 4 commits into
masterfrom
vm-test-cleanup

Conversation

@cuzzo

@cuzzo cuzzo commented Aug 1, 2026

Copy link
Copy Markdown
Owner

No description provided.

cuzzo and others added 4 commits August 1, 2026 11:07
CLAUDE.md named the stack machine as the active MiniVM, which is exactly
backwards: the register machine is the only supported target. It also
left `bc_emitter` as the subject of the no-Zig-strings rule. Both now
name the register emitter, and the note that `target: :bc` is the
bytecode lowering mode -- shared by the register machine, not a
stack-machine flag -- is written down so `bc_target?` is not mistaken for
dead code during the stack removal.

bc_lower_coverage only re-lowered the corpus with target: :bc and never
emitted, while its comments explained themselves in terms of the
incomplete `_bc_runner`. Drive RegisterBcEmitter over each lowered
program so the emitter's own arms are covered too. Emission failures are
rescued separately from lowering failures, so the existing accounting is
unchanged: shard 0/40 reports 121 lowered / 27 raised both before and
after.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AkBJZMTAuVZCVrghaLWXEh
Deletes bc_emitter.rb and _bc_runner.clear, and with them the stack
disassembler, Bytecode struct, and StackTarget in vm_golden_harness.rb.
MiniVM::Golden.targets is now register-only.

bc_run.rb and run_tests.rb are kept, not deleted: both are the shared
entry points the register machine runs through -- the golden harness
shells out to `bc_run.rb <path> --run --vm=register`. Their stack
branches are stripped and `--vm=` is accepted-and-ignored so existing
callers keep working.

The 19 CI-pending specs are gone with the reason for them. They were
skipped because building vm.clear to a native binary timed out on
GitHub runners; all 13 register-debugger specs and the 6 golden-harness
run specs now execute unconditionally, and the golden-harness suite is
130 examples / 0 failures locally.

No compiler changes. Both VMs lowered with `target: :bc`, so bc_target?
and its 43 lowering sites belong to the register machine and stay.

`--vm=register --min-pass=245` reports 237 passed / 39 pending / 0
failed both before and after this commit: that ratchet drifted while the
Register-VM allowlist job sat disabled, and is not touched here.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AkBJZMTAuVZCVrghaLWXEh
The gate asserted --min-pass=245, but the job has been `if: false` since
the native-binary compile started timing out on hosted runners, so the
ratchet went unenforced while the corpus moved under it. Actual state is
237 passed / 39 pending / 0 failed -- nothing fails, 8 entries went
pending.

Measured identically with and without the stack-machine removal, so this
records where the corpus is rather than conceding ground: `--min-pass=237`
now exits 0 with "baseline OK: 237 >= 237", and the ratchet can rise
again from a number that is true.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AkBJZMTAuVZCVrghaLWXEh
Three problems, all costing cold compiles on every run.

The six actions/cache steps store identical paths but keyed off four
different prefixes -- clear-build-, clear-examples-coverage-,
clear-fuzz-, clear-bench-leak-. restore-keys only matches its own
prefix, so examples, benchmarks, and fuzz each maintained a private pool
of the same content and none of them could warm from a sibling job. The
extra per-job hashFiles inputs (examples/**/*.clear, tools/fuzz/**,
benchmarks/**/*.clear) only narrowed the key; `./clear build` already
keys each entry off its own source SHA, so a shared pool cannot serve a
stale artifact -- it just carries entries a given job will not read.
They now share the clear-build- prefix and its compiler/runtime inputs.

examples/minivm/vm sits outside both cached paths, so the register VM
binary was rebuilt on every fresh checkout even on a cache hit. Cached
alongside them.

bc_run.rb guards that build with an exclusive flock. Under prspec with
32 workers the first worker builds while the other 31 block, inside the
parallel run. ruby-integration now warms it in a serial step first.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AkBJZMTAuVZCVrghaLWXEh
@codecov-commenter

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown

🐰 Bencher Report

ProjectCLEAR
Branchvm-test-cleanup
Testbedubuntu-latest

⚠️ WARNING: No Threshold found!

Without a Threshold, no Alerts will ever be generated.

Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the --ci-only-thresholds flag.

Click to view all benchmark results
Benchmarkleak-build-msMeasure (units) x 1e3leak-countMeasure (units)leak-run-msMeasure (units)
benchmarks/concurrent/01_socket_throughput/bench📈 view plot
⚠️ NO THRESHOLD
6.37 units x 1e3📈 view plot
⚠️ NO THRESHOLD
0.00 units📈 view plot
⚠️ NO THRESHOLD
8.37 units
benchmarks/concurrent/06_dynamic_spawn/bench📈 view plot
⚠️ NO THRESHOLD
6.35 units x 1e3📈 view plot
⚠️ NO THRESHOLD
0.00 units📈 view plot
⚠️ NO THRESHOLD
36.47 units
benchmarks/concurrent/11_parallel_aggregation/bench📈 view plot
⚠️ NO THRESHOLD
6.26 units x 1e3📈 view plot
⚠️ NO THRESHOLD
0.00 units📈 view plot
⚠️ NO THRESHOLD
16.03 units
benchmarks/concurrent/18_atomic_counter/bench📈 view plot
⚠️ NO THRESHOLD
6.31 units x 1e3📈 view plot
⚠️ NO THRESHOLD
0.00 units📈 view plot
⚠️ NO THRESHOLD
6.12 units
benchmarks/inter-clear/04_concurrent_mvcc_fat_struct/bench📈 view plot
⚠️ NO THRESHOLD
6.55 units x 1e3📈 view plot
⚠️ NO THRESHOLD
0.00 units📈 view plot
⚠️ NO THRESHOLD
166.95 units
benchmarks/sequential/03_alloc_throughput/bench📈 view plot
⚠️ NO THRESHOLD
5.99 units x 1e3📈 view plot
⚠️ NO THRESHOLD
0.00 units📈 view plot
⚠️ NO THRESHOLD
7.86 units
benchmarks/sequential/08_sort/bench📈 view plot
⚠️ NO THRESHOLD
6.18 units x 1e3📈 view plot
⚠️ NO THRESHOLD
0.00 units📈 view plot
⚠️ NO THRESHOLD
5.41 units
benchmarks/sequential/13_soa_layout/bench📈 view plot
⚠️ NO THRESHOLD
6.11 units x 1e3📈 view plot
⚠️ NO THRESHOLD
0.00 units📈 view plot
⚠️ NO THRESHOLD
746.80 units
benchmarks/server/03_pathological/server📈 view plot
⚠️ NO THRESHOLD
6.32 units x 1e3📈 view plot
⚠️ NO THRESHOLD
0.00 units📈 view plot
⚠️ NO THRESHOLD
1,002.85 units
🐰 View full continuous benchmarking report in Bencher

Comment on lines +185 to +189
RegisterBcEmitter.new(fe, source: File.read(path), importer: imp).compile(program)
rescue StandardError, ScriptError
# Same accounting as lowering: reaching an unsupported arm still
# covered it. A file that lowers but does not emit stays "lowered".
nil
results = MiniVM::Golden.update_snapshots(root: dir, targets: [:stack])
snapshot_path = File.join(fixture_dir, "return_i64.stack.bc")
results = MiniVM::Golden.update_snapshots(root: dir, targets: [:register])
snapshot_path = File.join(fixture_dir, "return_i64.register.bc")

expect(results.map(&:status)).to eq([:written])
expect(File.read(snapshot_path)).to include("instructions:\n0000 LOAD_CONST_I64")
expect(File.read(snapshot_path)).to include("register instructions:\n0000 ICONST r0 0")
FileUtils.mkdir_p(fixture_dir)
FileUtils.cp(source_path, File.join(fixture_dir, "return_i64.clear"))
snapshot_path = File.join(fixture_dir, "return_i64.stack.bc")
snapshot_path = File.join(fixture_dir, "return_i64.register.bc")
Comment thread examples/minivm/bc_run.rb
vm_target = "stack" if vm_target == "bc"
# The register machine is the only VM. --vm= is accepted and ignored so
# existing callers keep working.
ARGV.reject! { |arg| arg == "--vm" || arg =~ /\A--vm=\w+\z/ }
puts
puts " ruby examples/minivm/run_tests.rb --golden"
puts " Runs the stack/register VM golden harness specs"
puts " Runs the register VM golden harness specs"
puts " Runs the register VM golden harness specs"
puts
puts " ruby examples/minivm/run_tests.rb --vm=stack|register [tests...]"
puts " ruby examples/minivm/run_tests.rb --vm=register [tests...]"
end

def self.update_snapshots(root: File.join(ROOT, "examples", "minivm", "vm-tests"), targets: [:stack], check: false)
def self.update_snapshots(root: File.join(ROOT, "examples", "minivm", "vm-tests"), targets: [:register], check: false)
Comment on lines +185 to +189
RegisterBcEmitter.new(fe, source: File.read(path), importer: imp).compile(program)
rescue StandardError, ScriptError
# Same accounting as lowering: reaching an unsupported arm still
# covered it. A file that lowers but does not emit stays "lowered".
nil
program = lo.lower_program(fe.ast)
lowered += 1
begin
RegisterBcEmitter.new(fe, source: File.read(path), importer: imp).compile(program)
@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown

Diff Coverage Buckets

Diff base: origin/master...HEAD

bucket files additions deletions line cov additions branch cov additions
total 11 78 11542
compiler/ruby/**/*.rb public functions 0 0 0
compiler/ruby/**/*.rb private functions 0 0 0
compiler/ruby/**/*.rb OTHER 0 0 0
zig/**/*.zig prod 0 0 0
compiler/spec/ 2 8 31 not tracked not tracked
transpile-tests/ 0 0 0
tools/ 1 17 9 not tracked not tracked
gems/ 0 0 0
zig/**/*-test.zig + vopr/loom harness 0 0 0
*.md 1 4 2
other 7 49 11500

Src Ruby Visibility Breakdown

Scope: compiler/ruby/**/*.rb

Files: 213

Counts are nonblank, non-comment Ruby source lines. Protected methods are grouped into OTHER.

bucket lines share
public functions 32198 32.1%
private functions 42815 42.7%
OTHER 25367 25.3%
total 100380 100.0%

Zig Special Coverage Alerts

No added production Zig lines require missing Loom/VOPR/wait-loop coverage alerts.

@cuzzo
cuzzo merged commit 298c57d into master Aug 1, 2026
100 of 101 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants