Repository navigation
Fixed
-
Build memory grows linearly with the size of the app (#350). The type
checker and the lowerer kept one copy of a large type (such as theModel
record) for each signature, each use and each def that named it, so the
memory of a build grew about as the square of the app. They now share one
copy: declared signatures live in one hash-consed store, a ground type is one
union-find slot per use, every def of a lowering shares one type table, the
lowerer keeps Go types (not Sky types) per def, and the Sky.Spa split shares
theModelfield types between its wire records. The emitted Go is the
same byte for byte as that of a base made from v0.32.4's compiler with this
release's runtime and stdlib (xtask emit-diff), apart from the grouped
hold-free list below. The runtime's reader of that list changed with it.
Peak heap of the synthetic large Sky.Spa app of the
memory gate at N = 320 fields and arms, v0.32.4 then v0.32.5 (growth ratio
over N = 24 / 160 / 320 in brackets, 2.18 is linear):Phase v0.32.4 v0.32.5 parent check 109.5 MB (3.03) 55 MB (2.03) split 38.9 MB (3.31) 7 MB (2.23) backend leg front end 223.3 MB (2.88) 103 MB (2.11) frontend leg front end 223.4 MB (3.17) 89 MB (2.12) The figures and their causes are in
docs/perf/runs/build-memory-20261129/README.md. -
The memory gate asserts linear growth in all four phases.
spa_split_front_end_memorynow fails when the peak heap of the parent
check, the split, the backend leg or the frontend leg grows faster than
linear, on four shapes of the generated app (xtask bench-genwith
--distinct-types,--point-freeand--tuple-results). It also asserts
linear growth of the type layer's work counters. CI and the release workflow
run it. -
A type alias too large to expand is an
[E2001]error, not an
out-of-memory build. A chain of aliases where each uses the one before it
more than once (type alias T2 = ( T1, T1, T1 )) grows at each step, and
the checker built the whole expanded type before any check ran. A type that
expands to more than 2^20 (1 048 576) nodes is now[E2001]"too large to
check" at each place that names it. Make one step a custom type, or shorten
the chain (docs/errors/E2001-type-too-large.md). -
An alias more than 40 levels deep expands. The expander stopped at a
depth of 40 and left the rest unexpanded, which gave a falserecord vs T
type mismatch. The depth limit is gone. Only the size is limited. -
A very large type is freed without deep recursion. The new shared type
descriptors are freed with an explicit stack, so the record constructor of a
12 000-field codec (about 12 000 curried arguments) does not overflow a
2 MiB thread, as the language server'sdeep_expressiontests check. -
The Sky.Spa hold-free list is grouped. The split wrote one
Spa.withHoldFreestring per(hold, input)pair (11 626 strings at
N = 320 in the gate's app). It now writes one"<Hold> … | <Input> …"entry
per group of holds that allow the same inputs (9 entries there), and the
client allows every listed input during every listed hold: the same table.
The runtime's reader of the list (runtime-go/rt/spa_rpcqueue.go) reads
both forms. This changes generated code only. No change to your code is
necessary. -
A very deep or very wide type is checked without a quadratic walk. A
ground type is one union-find slot per use (above), and finding one of its
nodes walked down from the root one level at a time, and found its frozen
range by a search over every range of the run. A 12 000-field record codec
(a constructor type 12 000 arrows deep) took minutes to check. A deep node
now jumps along its heaviest path, a range is found from a per-block index,
and a record's occurs bound is read from the record, not from each of its
fields, when a variable or a field accessor is bound to it. That codec
checks in 0.9 s in a debug build (1.05 s in v0.32.4, 10.1 s before this
fix), and the fourdeep_expressioncases take 1.82 s (1.88 s in
v0.32.4). -
The process-tree memory gate builds the legs in order. The grouped
hold-free list made the frontend leg's generated source of the gate's
1400-field app three times smaller, so on a machine with 16 GB the build
now runs the two legs beside each other (183 s, not 547 s, on the release
runner), and the tree then holds both legs' Gomaincompiles at once
(3.9 GB there). A machine with less memory still builds them in order.
spa_build_tree_peaknow builds withSKY_BUILD_SERIAL=1, checks that the
legs ran in order, and bounds the peak at 2940 MB (2556 MB measured, the
wasmmaincompile, plus 15%). v0.32.4's serial peak was 2876 MB, with
each legskyat 2.2 to 2.7 GB. They are now under 0.6 GB. The gate then
builds the app again with the default leg plan and checks that the tree
peak stays within the plan's own estimate of both legs and within 4490 MB
(the runner's 3904 MB parallel peak plus 15%), so a parallel build cannot
use more memory than the plan counted on.
Security
- Runtime Go dependencies are on patched versions. Every Sky app links
the runtime's Go modules, and the versions in v0.32.4 had published
advisories:golang.org/x/crypto0.49.0 (seven critical),golang.org/x/net
0.52.0,golang.org/x/image0.23.0,google.golang.org/grpc1.80.0,
github.com/golang-jwt/jwt/v55.2.1,github.com/klauspost/compress
1.17.11,github.com/jackc/pgx/v55.9.1 and the OpenTelemetry OTLP trace
exporters and SDK 1.43.0 (the SDK let an attribute value pass its length
limit). The runtime now uses x/crypto 0.57.0, x/net 0.59.0, x/image
0.41.0, grpc 1.83.2, jwt 5.2.2, compress 1.18.7, pgx 5.9.2 and
OpenTelemetry 1.47.0. OpenTelemetry 1.47 needs Go 1.26, so Sky now needs
Go 1.26 or later (see Migration). Rebuild an app with this release to take
the fixes.
Migration
- Sky now needs Go 1.26 or later. The runtime's
go.mod, and so every
generated app'sgo.mod, saysgo 1.26.0(it saidgo 1.25.0), andsky doctorreports a Go older than 1.26 as an error. Go 1.25 no longer gets
security fixes. Install Go 1.26 or later from https://go.dev/dl/, and
move a Dockerfile or CI image that builds a Sky app to it (for example
golang:1.26, orgo-version: '1.26'inactions/setup-go). With
GOTOOLCHAIN=localan older Go refuses to build the app; with the default
GOTOOLCHAIN=autoit downloads Go 1.26 first. No Sky source changes.