Repository navigation
Bump bootstrap to ab4bad9c and restore the FloatToString peephole fold - #1688
Merged
Merged
Conversation
mbouaziz
enabled auto-merge
November 17, 2026 10:55
mbouaziz
disabled auto-merge
November 17, 2026 11:01
skc rejects an option passed twice, so the release profile adding --split-support-module (c5ff01a) breaks any build that also forwards it via --skcopt -- e.g. the compiler Makefile, which passes it to the bootstrap skargo. That made every stage2+ build fail, including the stage3 verification in bin/bump_bootstrap.sh, so the bootstrap could not be rebuilt. Skc.process now takes the profile options and drops them from the forwarded extra options. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai> Co-Authored-By: Claude Opus 5.5 (Anthropic, via Mistral Vibe; thinking: high) <noreply@anthropic.com>
Rebuilt from ab4bad9 (main + the skargo --skcopt dedup fix) with bin/bump_bootstrap.sh: clean self-hosting rebuild through stage3 with an identical fixpoint, and the full compiler test suite (1766/1766) against the new stage0. The promoted IR carries the Ryu-based Float.toString from #1288, so the bootstrap compiler now formats floats exactly like the current runtime. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai> Co-Authored-By: Claude Opus 5.5 (Anthropic, via Mistral Vibe; thinking: high) <noreply@anthropic.com>
Fold FloatToString(ConstantFloat) to a constant string again. This was safe once the bootstrap carries the same Float.toString as the target runtime: the bootstrap is only published after a compiler rebuilt from it passes the full test suite (bin/bump_bootstrap.sh), and the bump in this PR promotes an IR built from the Ryu-based prelude (#1288). Adds a Runtime test pinning the folded output of constant Float.toString (including -0.0, nan and inf) to the runtime's shortest round-trip form. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai> Co-Authored-By: Claude Opus 5.5 (Anthropic, via Mistral Vibe; thinking: high) <noreply@anthropic.com>
Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai> Co-Authored-By: Claude Opus 5.5 (Anthropic, via Mistral Vibe; thinking: high) <noreply@anthropic.com>
mbouaziz
force-pushed
the
bootstrap-float-tostring
branch
from
November 17, 2026 11:02
5034cf7 to
fa7438e
Compare
mbouaziz
enabled auto-merge
November 17, 2026 11:02
This was referenced Nov 17, 2026
mbouaziz
added a commit
that referenced
this pull request
Nov 19, 2026
…tod fallback (#1714) ## What Unifies `String.toFloat` parsing across native and Wasm, and removes a locale hazard on native: - **Native now uses Ryu `s2d` as the primary path** (previously libc `atof`), exactly like Wasm — correctly rounded and locale-independent. - **Locale safety**: `atof`/`strtod` honor the process locale (under `de_DE.UTF-8`, `strtod("1.5")` returns `1.0`). The fallback now rewrites the input's `.` to `localeconv()->decimal_point` before calling `strtod`, so parsing is correct under any installed locale. (The grammar is validated in `String.toFloatOption` to be decimal-only, so `.` is the only separator that can appear.) - **>17-nonzero-digit inputs** (an upstream Ryu `s2d` limit) fall back to `strtod` on native and JS `Number()` on Wasm; both are correctly rounded for decimal input, so native and Wasm agree bit for bit. ## Tests - New `runtime/tests/to_float_raw_native.c`, wired into `run.sh` **before** the Linux-only section so it runs on macOS too: s2d-path values, the `>17`-digit fallback, `-0.0`, overflow/underflow, and a real comma-decimal locale (`de_DE.UTF-8` when installed). Verified locally on macOS: under `de_DE`, plain `strtod("1.5")` gives 1.0 while the runtime gives 1.5. - `string_to_float.mjs` (Wasm s2d harness): new accepted edge forms (`"5."`, `"0."`, `"1e0"`, `"10e-1"`, `"-0.0e0"`) checked against JS `Number()`, plus more `>17`-digit rejection cases documenting the fallback trigger. Passed in the Linux container (100k random inputs included). - `tests/Float.sk`: grammar pins (`toFloatOption` rejects whitespace, hex `0x1p4`, `Infinity`/`INF`, leading `+`, `.5`, `1,5`, `00`, `1e+`; accepts `5.`, `0e0`, `1E5`, `10e-1`), long-digit rounding (`"0.1000000000000000000000000000001"` -> `0.1`, `"123456789012345678"` -> `123456789012345680.0`), the subnormal boundary (`"2.2250738585072011e-308"` -> largest subnormal `2.2250738585072009e-308`), and a toString round-trip. ## Validation - `prelude/runtime/tests/run.sh` passes on macOS (native toFloat test incl. the real `de_DE.UTF-8` locale branch) and in the Linux container (full suite incl. Wasm s2d vs `Number()` on 100k random inputs). - `string.c` compiles cleanly on both platforms (`-Wall -Wextra -Werror`). - `make check-fmt` failure on the first push was diagnosed and fixed in `ae47d93b`: `tests/Float.sk` needed one `expectEq` on a single line. Re-verified locally with the pinned tool versions — skfmt (stage0 binary), clang-format 20 on both `.c` files, prettier 3.4.1 on the `.mjs`, shellcheck on `run.sh` — all clean. - Full stage1 compiler build runs on macOS (gmake 4.4.1; the earlier local build failure was GNU make 3.81 not supporting grouped `&:` targets, causing two skargo runs to race on `state.db`); prelude suite with the new runtime is run against stage1 locally. ## Notes - Rebased on latest main (which already carries the `std` 0.7.0 bump, so this PR no longer touches `Skargo.toml`). - Runtime-C-only change, so no bootstrap bump needed (the C runtime is compiled from source at every stage0 link). CI images republish (already pending from #1688) will carry it. - AI assistance: commits generated with Mistral Vibe (Co-Authored-By trailers); validation performed in-session as described above.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
SkipLabs/skiplang-bootstrap@2ef40fd, promoted fromab4bad9c(= currentmain+ the skargo fix below) withbin/bump_bootstrap.sh. The promoted IR carries the Ryu-basedFloat.toStringfrom prelude: Float.toString via Ryu (round-trip-safe, shortest representation) #1288, so the bootstrap compiler now formats floats exactly like the current runtime.FloatToStringpeephole constant fold (FloatToString(ConstantFloat)-> constant string), removed in prelude: Float.toString via Ryu (round-trip-safe, shortest representation) #1288 because the old bootstrap folded with the old formatter while the runtime printed the new one. With the bumped bootstrap, compiler and target share the sameFloat.toString, so folding is consistent again. A newRuntime/FloatToStringtest pins the folded output of constantFloat.toString(0.1,-0.0,1.0e+100,nan,-inf, ...) to the runtime's shortest round-trip form.--split-support-moduleto skc itself (c5ff01a), while the compiler Makefile still forwarded it via--skcopt(needed only by the older bootstrap skargo). skc rejects a duplicated option, so every stage2+ build failed — including the stage3 verification inbump_bootstrap.sh.Skc.processnow drops from--skcoptwhatever the profile already sets, with regression tests.Validation
bin/bump_bootstrap.shonab4bad9c: clean rebuild from the promoted IR through stage3 with an identical self-hosting fixpoint (stage2/stage3 skc IR byte-identical); new stage0 reportsskc 0.4.1 (ab4bad9c); full compiler test suite 1766/1766 against the new stage0. IR pushed toSkipLabs/skiplang-bootstrap@2ef40fd(Update to ab4bad9c), fast-forwarded on itsmainexactly asbump-bootstrap.ymldoes.make clean, stage0 rebuilt from the new bootstrap IR):make stage1+make test1767/1767 (includes the new FloatToString test), prelude 131/131, skargo 15/15 (the 6 local failures seen with the stale systemskc0.3.3 on PATH pass with the freshly built skc), and the prelude runtime regression script passes ("Wasm Float.toString matches JS digits").Notes