Skip to content

Pinned seed v0.15.2.0 lacks #1325's owned-specialization fix: stage1 links only when a cross-unit specialization lands next to a caller #1359

Closed

Description

@ehartford

The pinned seed (seed.lock version=v0.15.2.0) predates 00bab6e (#1325), which added Codegen.gen_owned_specializations and made ensure_concrete_mir_function define a specialization only in the unit that owns its MIR body. In the seed, src/Codegen.w:6021 (at v0.15.2.0) generates the body unconditionally in whichever unit reaches a call, and unit_demote_foreign_definitions (:1356) deletes it in every unit that doesn't own it. So an instance whose callers all sit outside its owning unit is defined by no unit.

Stage1 is compiled by that seed at 16 codegen units (build/compiler.w:452). Whether stage1 links depends on how the MIR bodies happen to be packed into units. PR #1353 hit this: a Vec[i32].clone() in src/MirCore.w failed the stage1 link with undefined symbol: _Vec.clone__receiver__94_3, and a copy loop was put in to avoid it. with check can't catch this because it never runs codegen.

Repro (seed = src/main at the pinned version):

WITH_CODEGEN_UNITS=8 src/main run test/behavior/behav_codegen_units_owned_receiver_specialization.w
Undefined symbols: "_Vec.clone__receiver__94_3", referenced from ___wcu$146$Holder.dup in ...o.u6.o

It fails at 3, 7, 8, 12 and 16 units. A stage1 built from current source runs it correctly at every unit count. With 3, 8 and 16 units, nm on stage1's unit objects shows exactly one unit defining T _Vec.clone__receiver__224_3 and the others referencing it U.

Fix: cut a seed that contains #1325 and bump seed.lock (with run tools/bump_seed_pins.w, with build :seed). Until then, any compiler-source change that adds a new cross-unit generic instance can break the stage1 link, depending on how the bodies are packed.

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