Skip to content

D100: the pub sweep over src/ (#2211) - #2463

Merged
ehartford merged 1 commit into
mainfrom
d100-pub-sweep
Oct 19, 2026
Merged

ehartford merged 1 commit into
mainfrom
d100-pub-sweep

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

Runs tools/pub_lint.w --apply over src/main.w: 1,763 pub removals across 109 files, each a byte edit at the declaration the with analyze facts name — a pub declaration nothing outside the program package references (D100: pub is what another package needs).

The 21 residual findings were generated Embedded*Data modules; their generators (build/runtime.w, build/clang_resource.w) no longer emit pub, so a re-run reports 0 of 10,868 declarations and is idempotent. docs/with-abi.sha256 is re-recorded because the sweep touched src/FnAbi.w/src/TypeLayout.w text (verified pub-only diff; the convention is unchanged, so no ABI version bump). Every .wo rebuilds once under the new hash.

lib/std is untouched by ruling: its pub is its API to consumers outside this compilation.

Evidence: :dev green before/after, the eight tools that import compiler modules all check, ceremony census diff ok, :gate rc=0 green (first run caught the abi-hash re-record, the only root). Battery result posted before ready.

… outside the package uses (#2211)

tools/pub_lint.w --apply over src/main.w: every reported pub removed by byte edit at the declaration the analyze facts name. The 21 residual findings were generated Embedded*Data modules; their generators (build/runtime.w, build/clang_resource.w) no longer emit pub, so the report now reads 0 of 10,868 declarations and a re-run is idempotent. lib/std is untouched: its pub is its API to consumers outside this compilation. Cross-package keeps verified by checking the eight tools that import compiler modules (all ok) before the gate.
@ehartford

Copy link
Copy Markdown
Contributor Author

Battery green on 6f88cee: battery rc=0 wall=346s, GREEN/BATTERY_DONE in out/battery/status.txt. pub_lint re-run reports 0 of 10,868. Marking ready and merging.

@ehartford
ehartford marked this pull request as ready for review October 19, 2026 05:26
@ehartford
ehartford merged commit ea58cf5 into main Oct 19, 2026
@ehartford
ehartford deleted the d100-pub-sweep branch October 19, 2026 05:26
ehartford pushed a commit that referenced this pull request Oct 21, 2026
…#2211)

#2463 swept src/ of the 1,763 `pub` the compiler proved nothing outside the
package uses; the lint re-run over current main reports 0 of 11,077
declarations. Nothing kept it that way: `pub-lint-check` runs
`tools/pub_lint.w src/main.w` with the release compiler (224 s, 3.1 GB:
battery-checks, not the gate) and fails on any reported `pub`, naming the
`--apply` that removes it. The D100 record gains its status: lib/std is not
swept, by ruling (Eric, 2026-10-19) — its `pub` is its API to consumers
outside the compilation.
ehartford added a commit that referenced this pull request Oct 21, 2026
…#2211) (#2501)

#2463 swept src/ of the 1,763 `pub` the compiler proved nothing outside the
package uses; the lint re-run over current main reports 0 of 11,077
declarations. Nothing kept it that way: `pub-lint-check` runs
`tools/pub_lint.w src/main.w` with the release compiler (224 s, 3.1 GB:
battery-checks, not the gate) and fails on any reported `pub`, naming the
`--apply` that removes it. The D100 record gains its status: lib/std is not
swept, by ruling (Eric, 2026-10-19) — its `pub` is its API to consumers
outside the compilation.

Co-authored-by: Eric Hartford <[email protected]>
ehartford added a commit that referenced this pull request Oct 29, 2026
* codegen: an element `++` copies takes its copy glue, not only a str's retain (D111)

`a ++ a` over a List[List[str]] appended the inner Lists by their bits:
two holders of each inner buffer with no count, freed twice (debug
allocator: DOUBLE FREE origin=List, first and second drop both
__drop_struct_760). mir_emit_list_extend_from now runs the element copy
glue over the appended range when the element has glue and is not a str
(the runtime's extend retains strs).

* emit-c: the C backend runs destructors and takes holds (#983)

The C backend emitted every drop as a comment, copied every value by its
bits and never blanked a move's source, so a C program ran no Drop impl
and freed nothing. It now follows the LLVM backend shape for shape:

- per-type drop and copy glue (__with_drop_<tid>, __with_copy_<tid>),
  declared before every body: a type's Drop impl then its fields in
  reverse, an enum's live payloads, Box, Rc/Arc, List, HashMap/HashSet,
  SlotMap, channel endpoints, closure cells; members guarded by the
  reset-on-move sentinel (§2.5.1)
- `drop(place)` and DropAndGoto call the glue, guarded when the local
  was ever moved (§2.5.2); the reset blank is a memset (padding included)
- MIR's operand holds (D111): a retained copy takes the copy glue, a
  taken copy hands the value over and blanks the source
- a Drop.drop receiver is the owner's place (FnAbi owned_place)
- a struct's hidden liveness byte is set when it is built (D72)
- make-unique copies take element glue (D120); clear, an overwriting
  insert, map remove and clear, ListSlot set drop what they end;
  ListSlot get and a map slot read take a hold; `++` holds its elements

Found on the way: List.remove's result was never written (typed as
returning nothing), `a ++ b`'s result was never stored, and the map
slot read's dead-slot panic was overwritten by the read.

The emit-C harness runs a fixture with an `//! expect-debug-alloc:` line
under the debug allocator; six new fixtures do, each at leak count=0.

Fixes #983

* emit-c: Atomic.new builds the cell, typed by its destination

The C backend had no lowering for the generic `new` an `Atomic.new(v)`
call is, and typed its result by another type's `new` (StringBuilder).
#985 made std.random's state an Atomic in a global's initializer, so
emit-c-test (the compiler emitted as C) stopped emitting: "emit-c does
not support generic intrinsic new" in __with_init_global_rng_state.

* emit-c: a map key that is not its bytes hashes and compares by its parts (#2180)

The C backend refused every map key but an integer, a bool, a pointer and
a str, so the compiler itself could not be emitted (Sema keeps a
HashMap[(i32, i32), _]). Per key type it now generates the hash and the
equality the runtime map calls (with_hashmap_new_keyed kind 2), part by
part in the LLVM backend's order (mir_emit_hash_ptrs, mir_emit_eq_ptrs):
tuples, arrays, structs, enums and Options by variant, Lists, Boxes, str;
a type with its own eq (derived or written) compares by it. A key
projection is refused, not compared by its parts.

The glue's two `insert(…, name)` then `name` sites are routed through
an observing helper, seed-bound: every pinned seed returns the blank a
last-use take left (fixed in this stack's MIR layer).

* emit-c-test: the bridges declare no public C ABI since D100; that is not a failure

The stub generator scanned LlvmBridge.w and ClangBridge.w for
`pub fn wl_*` and failed with "found no bridge exports" when there were
none. The D100 pub sweep (#2463) made every bridge function
package-internal: the emitted unit defines each wl_* itself. The scan now
reports whether it read and parsed every source, apart from what it
found, and an empty list writes a header and stubs that declare nothing.

---------

Co-authored-by: Eric Hartford <[email protected]>
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