Skip to content

std.png: migrate libspng v0.7.4 over std.engines.zlib and support bundle dependencies (#3013) - #3655

Merged
ehartford merged 1 commit into
mainfrom
uat-expect-image-3013
Nov 27, 2026
Merged

ehartford merged 1 commit into
mainfrom
uat-expect-image-3013

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

Part of #3013 (implements Eric's 2026-11-25 ruling for the std.png engine: randy408/libspng v0.7.4 migrated over std.engines.zlib, confirming both zlib-backed inflate/deflate and PNG encoding before promotion).

Confirmed against pinned libspng v0.7.4

  • Uses std.engines.zlib (one inflate/deflate in std): spng.c calls only 9 zlib functions (crc32, inflateInit2_, inflateValidate, inflate, inflateEnd, deflateInit2_, deflateBound, deflate, deflateEnd), all bound directly to std.engines.zlib via zlib_bridge.with with zero duplicated zlib code in libspng.o.
  • Full PNG encoder and decoder: verified in both the migrated C harness (libspng-test) and std.png (behav_3013_std_png.with) with RGBA8 encode -> PNG signature check -> RGBA8 decode pixel-exact round-trips and corrupt-input rejection.

Summary

  • Compiler / bundle-dependency support:
    • src/compiler/Link.with: fixed-point transitive embedded .wo bundle selection in link_stage_select_embedded_bundles so a corpus bundle (libspng) that calls another corpus bundle (zlib) links its dependency on demand across all 6 targets.
    • src/compiler/Frontend.with: read foreign corpus bundle interfaces on demand during non-tree corpus bundle builds (keeping rt.wi read-whole) so colliding names displace cleanly.
    • src/compiler/Compilation.with: accept linked/embedded dependency bundle prefixes in --emit-bundle-manifest.
    • lib/std/libc.with, src/CImport.with: add std.libc.abs (pure With) and std.libc.INT32_MAX (D90) needed by libspng's Paeth and filter-selection functions.
  • Build & corpus:
    • build/corpus.with, build/wo.with, build/corpora.with, build.with: general bundle_deps: List[str] on Corpus and WoBundle (wires --link-bundle and deps across host, cross, and wasm32 bundles).
    • build/libspng.with, lib/std/engines/libspng/: 8th corpus, D112 first promotion of libspng-0.7.4 (SPNG_DISABLE_OPT, portable across all 6 targets), with libspng-test lane.
  • Stdlib & tests:
    • lib/std/png.with: safe std.png facade (PngError, Image, decode_rgba, encode_rgba, read_rgba, write_rgba).
    • test/behavior/behav_3013_std_png.with: in-memory and on-disk binary RGBA8 PNG encode/decode round-trip and error-path tests.

Next step on #3013

  • with uat expect image: + --record-images + §18.5d spec words (and spiral --capture) follow in the next PR once a seed carrying §29.11 (keywords as struct fields, used by migrated libspng/defs.with) is pinned.

Verification

  • src/main build :libspng-promote: promoted 5 modules, stamped D112 first promotion, all 6 target bundles green
  • src/main build :libspng-test :libspng-wo-drift :libspng-bundle-root-check :libspng-integrity :libc-surface-check: all green
  • out/release/bin/with test test/behavior/behav_3013_std_png.with: passed
  • Seed-driven battery + :release-checks pending (will post verdicts below before marking ready).

@ehartford

Copy link
Copy Markdown
Contributor Author

Seed-driven battery and :release-checks both green on a13bff6da:

  • Seed-driven battery (WITH=$PWD/src/main with run tools/battery.with, wall=897s):
    out/battery/battery.log: rc=0 green
    
  • :release-checks (WITH=$PWD/src/main src/main build :release-checks, wall=593.7s):
    • seed-driver: pinned seed nightly-20261122-45071765995-1-8a5befa0e423
    • rt-bundle-fixpoint: stage1 == stage2 across all 6 targets
    • wo-drift: all 8 corpora (including libspng-wo-drift) green
    • [fixpoint]: stage2 == stage3 over all 16 units of the compiler
    • EMIT-C OK + EMIT-C FIXPOINT
    • survey: all targets green

@ehartford
ehartford marked this pull request as ready for review November 27, 2026 15:11
@ehartford
ehartford merged commit 94d6a63 into main Nov 27, 2026
1 check passed
@ehartford
ehartford deleted the uat-expect-image-3013 branch November 27, 2026 15:12
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