Skip to content

bootstrap stage1 check --validate-all takes 15+ min at 7 GB RSS on a 20-line file (release binary: 0.07 s) #1315

Closed

Description

@ehartford

Found while hunting #1302 (branch fix-1302-match-field-move, base bbb9c5b).

out/bootstrap/bin/with-stage1 check q5.w --validate-all on the 20-line repro from #1302 ran >8 min at 99% CPU / 7.3 GB RSS before I killed it, and a second run hit a 15-minute timeout (744 s user). --validate-ownership behaves the same. A plain check and run on the same file with the same stage1 binary complete in seconds, and the fresh release binary (out/release/bin/with, same sources) completes both validators in 0.07 s:

$ time out/release/bin/with check q5.w --validate-all
validate-all: ok   0.07s user
$ timeout 900 out/bootstrap/bin/with-stage1 check q5.w --validate-all
(killed at 15:00, 744.27s user)

So it is not the validators' work; it is the seed-built stage1 binary itself on the validator path (an optimizer-exposed pathology or a stage1-only miscompile — the kind "it works at -O1 in the release binary" hides). Repro file:

error E = Bad
enum Tok { LBrace | S(str) }
type P { n: i32 = 0, cur: Option[Tok] = Some(.LBrace) }
extend P:
    mut fn bump():
        self.n += 1
        self.cur = Some(.S(f"s{self.n}"))
    mut fn outer():
        self.bump()
        let b = match self.cur:
            Some(.LBrace) => true
            _ => false
        print(f"{b}")
fn main:
    var p = P {}
    p.outer()

Route: sample/lldb attach on the stage1 process during the hang to name the loop, then diff the stage1 vs release codegen of that function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions