Skip to content

The ratchet moved by two events in one file: jit.t27 has function-pointer return types #2532

Description

@gHashTag

#2531 reverted reentrant struct-body parsing because the gate's totals got worse, and said the next attempt needs to know where the ratchet moves rather than just that it does. This is that measurement.

One spec, two events

The gate prints totals only. Capturing its own per-spec counters before and after the change — recovery-events and declarations-swallowed, which the parser itself reports on stderr — narrows 154 → 156 to a single file:

specs whose counters moved: 1
  events +2  swallowed +0   jit/jit.t27

Nothing else in 497 specs moved at all. "Worse on the ratchet" was two events in one file, not a broad regression, and the totals could never have said so.

The cause

recovery-at: Expected LBrace, got KwFn ('fn') at line 497:60
recovery-at: Expected LBrace, got KwFn ('fn') at line 517:62

specs/jit/jit.t27:497:

pub fn get_bind(self: *Self, dimension: usize) ?*const fn (*anyopaque, *anyopaque) void {

The return type is a function pointer. parse_fn_decl reads the return type, meets the keyword fn, and expects {.

This is a pre-existing limitation of parse_fn_decl, not damage from the reentrant change. The skip version never called parse_fn_decl on a method, so it never reached it — the same shape as the testgen.t27 string escaping in #2531, where parsing code that used to be discarded exposed a defect that had always been there.

Scope

files with `fn (` in a type:        2
occurrences:                        10
function-pointer RETURN types:      2

Small, and both in jit/jit.t27.

What this makes the next attempt

Not "try reentrant parsing again and hope". The order is now determined:

  1. Teach parse_fn_decl to read a function-pointer return type — 2 sites, both visible above.
  2. Escape newlines in string literals (Reentrant struct-body parsing: built, measured, worse on every axis, reverted #2531's second layer, in testgen.t27).
  3. Then re-apply reentrant struct-body parsing and measure. If the only two things that moved the ratchet are fixed first, it should hold.

The per-spec capture script is worth keeping for step 3; a totals-only gate cannot tell a two-event regression in one file from a systemic one, and that difference decided whether this thread continued.

Boundary

  • specs/jit/jit.t27

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-boundaryNo '## Boundary' section, so the Queen can reserve nothing for it and no bee can take it

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions