Repository navigation
capi_check runs on the ISeq VM with --vm; a rescue clause clears C's errinfo there - #313
Merged
Merged
Conversation
…errinfo there capi_check started every run with the caller's MERE_RUBY_* removed, so `MERE_RUBY_VM=1 capi_check.py` ran the evaluator. --vm now gives each mere-ruby run MERE_RUBY_VM=report and fails a run whose contract script the VM did not take. CI runs capi_check again with --vm on macOS and Linux. On the VM, api.rb stopped at the rb_errinfo contract inside a rescue: vm_checkmatch now clears C's errinfo when a rescue clause is taken, as the evaluator's run_rescues does.
284km
commented
Nov 26, 2026
284km
left a comment
Owner
Author
There was a problem hiding this comment.
Reviewed 8008397. No Critical / Major / Minor findings.
- The VM fix is one place: when
vm_checkmatchtakes a rescue clause (ty == 3and a match), it clears what C'srb_errinfoanswers, as the evaluator'srun_rescuesdoes. That was the only contract the VM stopped at (api.rb around line 643). With it, the rest of api.rb passes on the VM (api 405). tools/capi_check.py --vmmakes the VM explicit. Every mere-ruby run (contracts, stress, negative controls) getsMERE_RUBY_VM=report. A contract script the VM did not take itself (so the evaluator ran it) fails the check; "the native compiler declined" is correctly not counted as a refusal. So a pass under--vmis the VM's. A negative control must also fail on the VM, not by being refused.- The description says up front that earlier "capi_check on the VM" numbers (#278, #284, #286, #292) were the evaluator's, because the tool clears
MERE_RUBY_*. Good to have that on record. - CI: one extra
capi_check.py ... --vmline in the macOS and the Linux C API steps. This touches.github/workflows/ci.yml, so it goes to the owner before merge. - The author's results: capi_check 6/6 on the evaluator and on the VM, the same under stress, the 6 negative controls failing on both; corpus
--both961/961 andMERE_RUBY_VM=1961/961; spec, mkmf, the 17 gems and headers. Linux--vmwill be seen in CI. git merge-treeagainst main: clean. No mere-pr-review-watch inline comments.
This was referenced Nov 26, 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.
Summary
Before the VM becomes the default, C extensions need to be shown to work on it. This PR does two things:
capi_checkactually able to run on the ISeq VM.Earlier "capi_check under the VM" results were the evaluator's.
tools/capi_check.pyremoves all of the caller'sMERE_RUBY_*variables before every run, soMERE_RUBY_VM=1 python3 tools/capi_check.py ...ran the evaluator. Any record that reported capi_check results underMERE_RUBY_VM=1was reporting the evaluator. That includes the notes in #278, #284, #286 and #292.Running the six contract scripts on the VM directly, on main 85da98f:
api.rbstops at line 643. Inside a Rubyrescue, a C method'srb_errinfo()must answer nil. On the VM it answered the ArgumentError that an earlierrb_protecthad left.Changes
vm_checkmatch(main.mere): when a rescue clause is taken (checkmatch type 3 answers true), it clears C's errinfo withcapi_errinfo_clear.run_rescues, and CRuby's clearing ofec->errinfoon entering a rescue.mr_capi_bootedtest.capi_check.py --vm: every mere-ruby run getsMERE_RUBY_VM=report. That covers the contracts, stress and the six negative controls.mere-ruby (VM).--vmin both the macOS and Linux steps.capi/README.mddescribes--vmand why the environment variable does nothing.loop/2026-11-26-capi-vm-check.md.Checked
Branch 8008397 (main 85da98f + this change), mere 9dec2ff6, reference ruby 4.0.10.
capi_check.py(evaluator): ensure 58, typeddata 115, loader 49 (48 + mere-ruby's own one), numeric 13, fiber 16, api 405.capi_check.py --vm: the same counts with mere-ruby's side on the VM, also under stress.The six negative controls fail with the same messages as on the evaluator:
BEGIN { }was put at the top of numeric.rb.--vmthen failed with "the VM did not take numeric.rb, the evaluator ran it", for the contracts and for stress.run_corpus.sh --bothpasses the gates, then 961/961 with the hash index on and off.MERE_RUBY_VM=1 run_corpus.sh --bothgives 961/961.Not done
capi_spec_check,capi_mkmf_checkandcapi_gem_checkstill run only the evaluator. Whether each of them needs--vmis a separate question.🤖 Generated with Claude Code