Skip to content

Resume singleton class super lookup in its metaclass chain - #403

Merged
284km merged 3 commits into
mainfrom
codex-rails1-singleton-class-super
Nov 28, 2026
Merged

284km merged 3 commits into
mainfrom
codex-rails1-singleton-class-super

Conversation

@284km

@284km 284km commented Nov 28, 2026

Copy link
Copy Markdown
Owner

Class.prepend wrappers calling super failed for singleton class receivers of modules/classes. ActiveSupport's descendants filter therefore stopped ActionMailer before any case ran. Start every Class receiver's super lookup in its metaclass chain, extending the existing value-singleton rule, and remove the now-unused predicate.

Local results on pure6791a772 versus mainc576; clean tools/ref_ruby.sh4.0.10/a704,Prism1.8.2,compiler9dec/mgz661a:

  • Extended943 plus942/94/955/959:40 exact comparisons across evaluator/VM × Hash ON/OFF × normalGC/GC32. Native subclasses, defined?(super), six singleton shapes and arity preserved; both main controls fail the target.
  • Corpus--both1035/1035;VM1035/0fallback/0FAIL/0list differences;12gates. Changed-record hygiene included.
  • Class/Module/Super whole files and Method evaluator: complete comparisons lose no prior PASS. Method VM initial before99complete1F1S,after MEMORY_LIMIT; isolated whole-file replays both MEMORY_LIMIT at2209552/2104912KiB. The related19-case selection completes on all5sides with the same known1Mere failure. This is not passing whole Method VM acceptance; all bounds remain unchanged.
  • Separate integrationd1ce15ee (85d7500b + only this fix/943), fresh native gems from that exact binary: fullMailer17files on both engines0MATCH/268MISSING/allMereINCOMPLETE → 248MATCH/20RED/zeroother, all17reference/MereCOMPLETE, no bounds. The20 residuals are17 Array-subclass attachment errors and3 keyword-forwarding errors, to be fixed separately.
  • ASJSON158cases,seed12345,3alternatingRSSpairs,all12pass: E median1560592→1507616KiB (ranges1426160–1579472 vs1478048–1591008);VM1203664→1303648 (1196272–1292576 vs1245088–1307264),+8.31%VM. Ranges overlap; no stable memory improvement claim.
  • Ordinary super instructions,3pairs,startupincluded: class methods+0.235%E/+0.349%VM; instance methods-0.121%E/+0.471%VM.

The integration contains reviewed unmerged#395/#399 and parser#402; it is distinguished from the pure PR runtime. Later main#398 is outside these frozen observations. Complete per-file states, times, inventories, native/source provenance, limits and isolated replays are in the record. Hosted/global holds and whole Method VM resource acceptance remain open; no merge is requested on incomplete evidence.

@284km 284km left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed head e89bb227 (m_eval_leaf.mere +2/-12 in super_base, corpus 943, record).

  • Any VClass receiver now starts its super lookup at its metaclass, (sng:c). Before, a singleton class of a class/module ((sng:Foo)) started at itself, so a super from a method prepended to Class missed Class/Module in the chain. Ruby's receiver class there is #<Class:#<Class:Foo>>, whose ancestors do reach Class and Module, so the uniform rule is correct. The old sng_of_value split only existed to special-case value singletons and is no longer needed.
  • Corpus 943 (with 942/94/955/959) covers native subclasses, defined?(super), six singleton shapes and arity: 40 exact comparisons, with both main controls failing the target.
  • ActionMailer on the integration goes from 0 MATCH / 268 MISSING to 248 MATCH / 20 RED, all files complete. The residual REDs are attributed to other gaps.

One non-blocking question: the Method file on the VM completed before (99, 1F 1S) but hit MEMORY_LIMIT after. The body says isolated whole-file replays hit MEMORY_LIMIT on both sides (2,209,552 / 2,104,912 KiB), so this looks like the known VM Method-lifetime problem rather than this change. If convenient, one alternating main/candidate pair under the same conditions would settle it. I am not blocking on it.

No findings from me. The merge waits for the automated reviewer on this head.

@284km 284km left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed exact head e89bb2270fb11adc4545ff2a97808bad3ebdad4a against fetched current main 8657f5b29918d9dc25f7ce6475584e73ebec8169, including the existing review and discussion. No new actionable findings.

The uniform metaclass starting point is consistent with Class-valued receivers and the surrounding ancestor/native-entry lookup. The added corpus usefully covers module/class singleton receivers, nested metaclasses, defined?(super), native arity, and ordinary subclasses.

Independent validation on Darwin arm64:

  • Fresh ordinary O2 builds of this exact head and current main, using pinned compiler 9dec2ff6 and mgz 661a01d8; clean reference Ruby 4.0.10 (a704b7cd95), Prism 1.8.2.
  • Corpus 943, 942, 94, 955 and 959: all 40 exact exit/stdout/stderr comparisons match across evaluator/strict VM × Hash index ON/OFF × normal GC/GC32.
  • An additional probe covering three singleton levels, Class prepend/extend, Method#super_method ownership/calls and a call after GC passes all eight conditions.
  • Current main reproduces the target super: no superclass method 'subclasses' failure on both engines; this head passes. Generated C SHA256 independently matches the submitted record (48c95834…).
  • Dead-definition, duplicate-definition, name-length, method-write and record-hygiene checks pass; diff whitespace check passes.

This does not establish whole Method VM or Rails resource acceptance. The submitted Method VM MEMORY_LIMIT observations remain explicitly incomplete; the separate Rails integration includes unmerged changes and is not evidence for this pure head on current main. I did not rerun those whole-file/framework resource suites. Hosted CI still has executing and queued jobs, and downstream coverage is unfinished. The recorded all-merge hold remains in force, so no merge is performed and the runner-queue exception does not apply.

@284km
284km merged commit 8edcf95 into main Nov 28, 2026
16 of 21 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.

1 participant