Skip to content

Bit 0.35.0

Choose a tag to compare

@mdwekat mdwekat released this 02 Oct 22:36
6da4a0c

Bit 0.35.0

Breaking

  • std/http, std/http2, std/http3 and std/smtp construct through constructors, not newX functions: Client(), Client(tls = cfg), Encoder(...), Decoder(...), Transport(...), Request(...), Response(...), Message(...), Attachment(...), Options(...), ByteStream(...). The 18 newX functions are removed.
  • std/http2 Conn.roundTrip and roundTripStream take an optional deadlineNs per request.
  • Spec §11.11: a module-level let or const may run a non-constant initializer at startup, before main, in import order. A failing initializer exits with code 3. Assigning a module const is E0185; x++, x-- and tuple-pattern writes to a local const are E0062.

Highlights

  • std/http Client keeps a keep-alive pool per origin, shares one HTTP/2 connection per origin with multiplexed streams, and caps connections per host (PoolLimits.maxConnsPerHost). 10000 sequential requests: 1 connection instead of 10000, about 3x the requests per second.
  • The scheduler's monitor parks while no task runs: an idle server goes from 465 wakeups per second to 0. Windows now starts the monitor, so CPU-bound tasks are preempted on Windows too.
  • pkg/toml indexes wide tables: config.toml parses with 21.8% fewer cycles, a 1024-key table with 82% fewer.
  • The garbage collector runs up to 3 helper threads during a collection on heaps of 8 MiB and up (toml, yaml and json parses about 13-15% faster in wall time), and helpers no longer pay a stack check per marked object.
  • x86-64: a float live across an asm block that calls is preserved; it was overwritten.
  • A stop-the-world that times out on one thread retries as soon as that thread responds.

Compiler

  • asm clobber: a named caller-saved register is a clobber point at the block, not a whole-function exclusion (0e62bfe)
  • checker: judge argument types of a method's own-type-parameter calls (0488ffc)
  • x64 asm clobbers: exclusion and point sets are convention-independent (0e3be22)
  • checker: a generic method's own type parameter that nothing binds is E0068 (352e456)
  • compiler: prologues zero every frame word not written before the first scan point (346c3fd)
  • arm64 prologue: pair the first zero word with the last saved GPR (3fec0fd)
  • bit fmt: keep the parens a catch operand, a loop iterable, an arrow body and a < operand need; add test-fmt-prec-matrix (16faa5b)
  • bit fmt: wrap a for-of iterable only when it ends in 'catch IDENT'; format fmtwrap.bit (efd6c30)
  • Make a write through a stale kidsOf view impossible (7b88844)
  • Track a variadic parameter's rows through the relation proof (89f90f6)
  • parser: move the import-declaration parsers out of parsertype.bit into parserimport.bit (bf6dd0e)
  • x64: rematerialize spilled integer constants, sharing arm64's remat predicate (c38a7ef)
  • optloopcand: cite isRematConst in regallocremat.bit, where moved it (b889561)
  • x64compile: cite the loop-weighted rank, the rule on main, where the remat mark's comment named the (8ce49fd)
  • Resolve a member call on a type parameter against every bound of its & list (0856aa7)
  • Judge a generic class's type-parameter bounds at a written instantiation (E0051); infer a bare class literal's arguments from its fields and sibling bounds (6b73fdf)
  • Type every bare generic class literal in checkCompositeLitType: a declared target pins it, else its fields and sibling bounds infer it, else E0068 (b2bc231)
  • opt: fold len and the null guard of a string literal threaded through a loop (7f13bae)
  • x64align: align every loop header to 32 bytes (085eb5f)
  • opt: hoist the data pointer of a string literal out of a loop (c29d5c3)
  • opt: BIT_CONST_STRING_FOLD pins the fold off for the post-opt IR differential (ebdbfc0)
  • opt: BIT_CONST_STRING_FOLD also gates the literal-pointer hoist (dc9007a)
  • Win64: save the nonvolatile XMMs a function can write, all 128 bits, including xmm14/xmm15 (c952e0f)
  • x64align: pad jumps with CS prefixes on the preceding instructions before NOPs (db569bc)
  • x64align: bind xPadJump's unused result in xPadJumpCx (772c413)
  • Split constStringSources under complexity 10; size the stress module bound for growth (3f90daf)
  • x64: store an imm32 constant to a frame word with one C7 /0 instead of mov r11 + store (120fd6e)
  • x64: zero the Win64 home area at each call; pair prologue zero stores into movups (6dd06ff)
  • x64align: prefix setcc/movzx/SSE forms and take a poll-only back edge on the poll's je (191eca2)
  • optstrbox: admit a literal's const_int len word as its own handle (2df66f7)
  • optstrbox: gate the join-param box reuse behind BIT_STRBOX_JOIN (f882821)

Runtime

  • schedSwitch: arm64 keeps its original clobber list; document why x64 names r8/r9 (37a0d30)
  • sched: clear the resumed context in one block, from the resumer's new (2f7d137)
  • sched: x64 clears the words its switch saves; P5 fills every saved register (af90976)
  • sched: schedSwitchAway's comment states what the *new == sp check cannot see (c7cf1f5)
  • sched: schedSwitchAway traps a resume from a copy of the task's block (5f12231)
  • runtime/stw: bit_rt_safepoint zeroes every SafepointFrame word it does not store (eb903ea)
  • runtime/sched: count a timer producer that did not claim an armed worker 0 (d4b4b38)
  • Bound the world-stop retry by wall time, name the stuck slot once, hold the next attempt off (2427963)
  • runtime/sched: trace a channel timer's wake and attribute a late one to the OS (8bf2978)
  • runtime/sched/linux: rundelay picks openat by onX64() and stores the fd plus one, so fd 0 is not reopened per call (faf2694)
  • runtime/sched/linux: open the schedstat descriptor O_CLOEXEC (9f990f0)
  • runtime/gc: sweep a bitmap word in registers, no call per slot (61be377)
  • runtime/sched: the poller cell is a token, schedPollerArm is a CAS take that reports whether it won (70f680e)
  • runtime/root: drop the wkId import bootworker no longer uses (ce9bf19)
  • runtime/windows: any idle worker takes the poller token and blocks in the completion port (2939223)
  • gc: GC-only mark/sweep helper threads for a pool that has none (03774b6)
  • gc: cap GC-only helpers at three (f4839ed)
  • gc: end the STW retry hold-off when the stuck slot answers; bracket parkdarwin's kernel waits (d2dfa78)
  • runtime/sched: park sysmon while no task is in flight (7fabf95)
  • gc: an idle mark member sleeps on a work word after a bounded spin (1afaa23)
  • stwhelper: rename the stwHelpersWanted local 'cap' to 'gang' (E0048) (b19de68)
  • gc: probe the stack once per mark join, not once per marked object (3f4197c)
  • windows: start a sysmon thread so compute-bound green tasks are preempted (8fb2e65)
  • gc: count mark sleeps that time out after termination, report latewakes= and fail the stress gate on it (3829844)

Standard library

  • stdlib/http: headerBlockScan agrees with a plain byte loop at every length, position and address alignment (a17b5ae)
  • stdlib/http: the real-header-blocks agreement test asserts every address residue was exercised, instead of discarding it (E0215) (5ae9ef4)
  • std/http: follow redirects safely by default, one typed Redirects policy (dc6b54f)
  • std/http client: HTTP/1.1 keep-alive idle pool per Client (31b79a8)
  • std/http: one shared h2 connection per origin, requests multiplexed as streams (f85a541)
  • http: PoolLimits.maxConnsPerHost caps HTTP/1.1 connections open per origin (bc12d7e)
  • stdlib http/http2/http3/smtp: replace the 18 newX factories with constructors (daa9c32)

Tests

  • sched stress: P6 probe, nothing lives in a caller-saved register across schedSwitch (f55c276)
  • checker, lowerer: support a static call through a namespace-qualified class (99bdc60)
  • test-no-warnings: check the dependency-resolving units in generated scratch projects, not exempt (b4028b8)
  • checker: judge T.name when T is a type name, and a namespace-qualified type used as a value (e001f83)
  • re-point SPEC.md:4358 to 4379; delete the paid E0203 compiler/check.bit lint-debt entry (fdbb172)
  • checker: E0058 for static-method type arguments, trait member types, a bare generic interface bound and an imported alias (befef0f)
  • Add test-call-shapes: receiver x callee x argument shape matrix, bit check and bit build must agree (b8230c4)
  • callshapes: rename mainText so test-no-warnings does not read cells.bit as a second program (1608834)
  • callshapes: re-derive known.bit on main 22a1781: fixed 234 cells and all 54, 108 still disagree (0c7f8e1)
  • gates: test-relation-shapes, a generated matrix of every way a row reaches a relation read (09ec16f)
  • stress/sched: bind main's unused dqPushBottom result to _ (lint unused-binding, found under ) (ce6c432)
  • lowerIf: lower && / (| conditions as a branch chain behind BIT_IF_BRANCHCHAIN, default off (#5926)|82e44a2ae)
  • chantimerwake/chantimerresetwake judge the timer against a plain OS sleep of the same run (762f21f)
  • fix: the auto-load splice wrote the new receiver through a stale kidsOf view (3e80017)
  • golden census: dRun 596, and each added one run case against 594 and merged to the same 595 (d86cac2)
  • Thread the live locals through the && / (| and ?: joins and the if-chain exits when a catch in the rhs/arm reassigns one (#6415)|676f252cc)
  • gcretention: stale_min512 pins that a dead frame's spills root nothing (b70a47a)
  • golden census: dRun 597, the run case merged onto the 596 as a clean 596 (5744318)
  • T(...) through a type parameter is E0184, and lowering refuses it (3d35e07)
  • netdnsfallback: bracket the stub's kernel waits and print the cause on failure (69f7521)
  • Relations: the proof walks test blocks and parameter defaults like function bodies (9b78a90)
  • checkercases: test_block keeps the bound catch variable the first test uses (11e8b1d)
  • checkercases: re-point the two SPEC.md:4413 citations after the 3-line section 10.5 addition (0bb6dd4)
  • Generic interface bounds: fn f<S: Store>(s: S), fn load<T, S: Store> (10f16b7)
  • baselinesmacostail: re-point the BIT_GC_MIN_KB citation after the ABI.md edit (3fc65e6)
  • checker: reject member calls on a function, ns function calls off-signature, static through a value, namespace called (4ea85e8)
  • Judge a pinned or inferred bare class literal's field values against its type through vLitFieldInit, as W{ v = 300 } is (4044cdc)
  • Fix the x merge: vValueMember passes its nameNode to vBoundMember and vStaticThroughValue resolves the receiver by member name; re-derive expectedCases 277 and dRun 600 (cf9078f)
  • Resolve a static call through a type parameter against every bound in written order (d2e18e6)
  • Declare 6428-bare-literal-instantiated (types) and 6432-static-bound-oracle-declines (ir/iropt) oracle lag; fmt the checkercase and golden case (0db0544)
  • staticmethods: static_through_value now expects the E0057 at check, not the IR verifier's arity error (99f360e)
  • parkdarwin: churn 4096 small strings while the property results are live, so BIT_GC=stress always collects (was timing-dependent, flagged 'collector never ran') (bedbc44)
  • fmt run_generic_class_literal_infer.bit (f24befe)
  • Reject an asm block that calls out without declaring the caller-saved clobbers (6be663f)
  • runtime/sched: any idle worker takes the poller token and blocks to the next deadline (dd9e4f5)
  • runtime/sched: a chan-timer sweep reads the slot high-water mark under the same lock hold as its sequence (77bde0d)
  • stress: chantimerwake and chantimerresetwake keep their 50ms overshoot budget (fc0e441)
  • stress: chantimerbusyworker0 judges on missedWake == 0 and the 50ms budget (a5f3133)
  • Panic boundary: save and restore all 128 bits of xmm6..xmm15 on x64 (dfd7bda)
  • ABI.md 9.1: every x86_64-windows foreign-to-Bit entry and the xmm6..xmm15 rule; winxmm smoke fixture (0242fa2)
  • winxmm: panic (exit 2) on a mismatch so the exit code fails the gate (d582931)
  • checkerdiag, golden: reject a panic: line in an // error case's expected or actual output (0fe32c5)
  • gcretention: paced rows sweep 4 fewer objects (576ef11)
  • A calling asm block is a clobber point whatever its clobber list names (4a9cb78)
  • Re-point the three SPEC.md line citations the 8-line §11.6 insert moved (f440d54)
  • optparams: fold field_get [8] of a one-literal string to its byte count (aeb9e29)
  • releasesurface: allow std/http2 Conn.roundTrip's defaulted deadline parameter (89efc92)
  • gcretention: move the generated fixtures into a sibling file; the gate is now a directory module (71c1711)
  • benchgate: re-baseline the macOS object counts for the threadStart (-4 on every case) (658bcb7)
  • benchgate: re-point the BIT_GC_MIN_KB citation the ABI.md paragraph moved (d8f1382)
  • Lower let (_, ok) = m[k] to the map probe alone (fb5939b)
  • optstrbox: read box words through join block params in boxWordsAreOwnHandle (68a1fd4)
  • Checker: traced module let/const and startup initializers outside runtime/ (01c99bd)
  • Checker: de-duplicate type-node diagnostics in startup initializers; retire check_const_nonconst (635c6d1)
  • resolve: reject ++, -- and tuple-pattern writes to a local const (E0062) (b18a3c5)
  • Run module startup initializers before main, imported modules first (d1a2d5f)
  • spec: §11.11 module-level state holds any type, runs startup initializers before main (e4caeb9)
  • Add a BIT_GC=stress case for a startup initializer that allocates (36fbe37)

Documentation

  • relations load when read; docs teach the rule as ruled, E0300 with its real hint (ab6bddc)
  • pkg locks: re-pin web/v0.8.0, mysql/v0.1.1, postgres/v0.1.1 and mysql/v0.2.0 to their tags' commits after the history rewrite (same trees) (936d043)
  • pkg/yaml: classify a plain scalar and decode an escape without allocating (fcb8cff)
  • pkg/yaml: simpleEscapeLetter allocates nothing (7207ccc)
  • docs: std/http redirects section, policy and Response.url reference (41e5fb5)
  • pkg/web: README benchmark block readable at a glance; tables and method move to bench/RESULTS.md (894439b)
  • pkg/toml bench: README block is a summary sentence, a faster/slower table, a memory line and a link; method and raw tables move to RESULTS.md (0bb353f)
  • pkg/toml bench: machine and date line reads 'Measured on , , with ' (6281e58)
  • pkg/yaml bench: README block is a summary sentence, a faster/slower table, a memory line and a link; method and raw tables move to RESULTS.md (353a627)
  • docs: std/http says a bodyless 307/308 to another origin is followed, credentials removed (e360fff)
  • docs/stdlib/http.md: client connection pool, PoolLimits, Client.setPool, Client.close (ac29d7a)
  • pkg/toml: index table keys past 32 entries so hasEntry/findOpen stop scanning (4fda9df)
  • ABI.md: the STW retry hold-off ends when the stuck slot answers (17d095c)
  • pkg/toml: test indexed before calling indexLast so a narrow table's append pays one compare (4524ca5)
  • pkg/toml: keep WTable at 32 bytes with an i32 depth so narrow tables do not pay for the index field (8cfb8d4)
  • docs/stdlib/http2: document Conn.peerMaxStreams and roundTrip's deadlineNs (bfd4ca4)
  • pkg/toml: build the key index on the first lookup at keyIndexMin, in an i32 slot array (36323e5)
  • pkg/toml: key index slots are []int, so no width needs an i32 guard (e6bd644)
  • spec §11.11: name the startup-failure exit code, 3 (19f6616)
  • spec §11.11: state the const field-write rule in prose; the text fence read as a hidden grammar block (9081a0e)
  • spec §11.11: keep the field-write paragraph at the old block's line count so line citations hold (5c7c39d)

Build and tooling

  • stage0: repin to 0.34.0, retire eleven oracle-lag signatures (e580203)
  • gates: split gateTableG out of gateTableF, which and together took to 90 lines past the 80-line E0201 ceiling (326cfc2)
  • selfhost-ir-signatures: declare 6415-catch-assign-join-args, the file-scoped oracle lag of run_shortcircuit_catch_assign under ir/iropt until the next repin (1550cda)
  • selfhost-ir-signatures: declare 6396-generic-bound-type-args-presyntax, the 0.34.0 oracle's parse cascade on a bound with type arguments (diags, fuzz, types) until the next repin (18822ce)
  • selfhost-ir-signatures-selfcheck: call the rejection fixtures pair by pair, a diag dump is full of the old separator (e2f4354)
  • selfhost-ir-signatures: widen the types anchor to a class bound, retire the (ab5a4f9)

Benchmarks

  • bench: README block is a plain verdict, full tables and method move to RESULTS.md (8dca079)
  • bench: regenerate for 0.35.0 (af97f84)

Artifacts

Published for aarch64-linux, aarch64-macos, x86_64-linux and x86_64-windows.
See dist/README.md for the full target table, the archive layout,
the required BIT_STDLIB/BIT_LIBBITRT environment, and the
SHA256SUMS format.

Verify a download before running it:

sha256sum --check --ignore-missing SHA256SUMS   # shasum -a 256 on macOS

Full commit log: v0.34.0..HEAD