every_direct_word_skips_every_decoder_before_the_integer_one and
every_direct_word_skips_the_block_decoders run on all host threads in
release, at PCs 0, 0x1000, a user and a kernel address and the highest
word, where branch and literal targets overflow. They are the proof to
rerun when a decoder is added before the integer one or to the parse.
Profiled on 8 MiB of the macOS 26B123 kernel's __TEXT_EXEC (269,195
blocks): decoding took 23% (the common integer, load/store and branch
classes reached their decoder after ~25 refusals), allocation 18% (the
block buffer and parse list grew from empty; link-slot checks allocated),
and the vector cache rebuilt its occupied mask on every `Code::asm`.
- `skips_decoders` routes the common classes straight to their decoder
in `lift` and the block parse (STGP excluded: the parse takes it as a
tag access); the parse reserves 24 instructions;
- the block buffer starts at 1 KiB (`Code::new`), fault sites and
relocations at 8;
- the vector cache keeps `held` current, so `occupied` does not scan;
- `jump`/empty-link checks no longer allocate.
compile-throughput: 4368 -> 2972 ns/block; native_bytes unchanged
(87196315); the --emit dump of every block is SHA-256-identical, and the
new `lift` matches the old for all 2^32 words at 5 PCs. Linux: compiler
1568 passed, engine 1921 passed, 0 failed.
Rebased by Garvit Surana onto Stambha's base (upstream main of 11-20):
kept the direct integer path (skips_decoders, lift_direct, lift_integer)
in Decoder::lift and in the parse's Words::decode, the parse's room for
24 instructions, the 1 KiB buffer and room for 8 sites and relocations,
and the next instruction's vector use kept for its turn. Dropped as
upstream already covers them: the link slot, patch jump and empty-link
helpers (329b54fc3 writes them on the stack), the vector cache's held
mask (96fb55ad3 asks it only where needed, and occupied() returns early
when nothing is held), and the block buffer from Code::new (Code::asm
reserves room at a buffer's first instruction). Dropped as they no longer
fit: the padding byte filters of exit_word_of and is_direct_exit, whose
byte offsets upstream's exit layout (290ba1138) moved.
(upstream PR #247 by justpainful)
lock_path_costs times eight PEs on real_counter; run_loop_costs set its
own stamped flag to read the same TSC shifted seven bits. One switch is
enough, and the bench was rerun on it: every timing makes its two million
runs, one block a run.
`step` cloned the hub's Arc around `act_on` on every run: a locked
increment and decrement of one reference count every PE wrote at each
of its runs, a cache line the PEs then passed between them. perf put a
quarter of a run's cycles there with two PEs or more. The hub is now
borrowed before the act and again for `leave_active`; a machine's hub is
set once (`enter_parallel`/`start_parallel` refuse one that has it) and
nothing the act does takes it. No memory ordering changed.
New ignored `run_loop_costs` benchmark, ns per run (mean of 3):
br 2 PEs 234 -> 192, 4 PEs 274 -> 196; mrs+br 2 PEs 277 -> 210,
4 PEs 302 -> 230. Linux: engine 1921 passed; parallel x20 clean.
Rebased by Garvit Surana: the fake host's counter keeps upstream's
real_counter ahead of the stamped one this adds.
(upstream PR #246 by justpainful)
`LookupTable::insert_over` treats an entry whose context no lookup
reaches any more as a free place: the resident moves over a dead
neighbour, and a dead resident is the one out, before a live entry is
put out at random. A busy desktop's ITLB evicted live pages while dead
contexts' entries sat in their sets (16% of its misses). The eviction
counter no longer counts a live entry as lost when the dead resident
leaves. stela-engine on Linux: 1921 passed, 0 failed.
Rebased by Garvit Surana: insert_over keeps upstream's removal of the entry's
older self beside it (6a1fe6e33) ahead of the dead-context rule, so
keep_resident is beside empty, older self or dead, then dead resident out.
(upstream PR #248 by justpainful)
A lookup site over many targets (returns and indirect calls into shared
libraries) missed the 256-entry jump cache for most transfers and went
through the table probe: `transfer_path_costs` over 1024 targets ran
14.4 ns a transfer with 0.75 table probes; with 1024 entries 8.8 ns and
none (4096 gains nothing more). 64 KiB a PE; `forget_all_jumps`, the one
whole-cache walk, runs only on a table clear. Linux: engine 1921,
compiler 1568 passed, 0 failed.
(upstream PR #249 by justpainful)
A TLBI by VA removes the whole leaf at its address. Of 4 KiB leaves, the
TLBIs of the pages at 0x1000 and 0x3000 leave the global page at 0x2000,
but their merged range takes it in, and bridges() rounded both spans to
16 KiB and saw nothing between them. That is the finding an automated
review left on upstream PR #245, which the PR never answered. A fixed
4 KiB granule would instead count neighbouring 16 KiB pages, as macOS
maps them, as a bridge where the merge adds no entry. GlobalSpan now also
keeps the smallest leaf widen() took in, and bridges() rounds to it: a
global leaf the merged range reaches and neither TLBI does is at least
that size and aligned to it, so it lies between the granules the two
spans touch. Perf only: every kept scope still covers the TLBIs it
stands for, whatever the granule.
Once a PE's mailbox held 256 scopes, a new TLBI merged with the narrowest
of the last 16 at any distance, so an ASID-tagged scope below the shared
region and one above it became one range over it; global entries match
any ASID, and the mail read dropped every global ITLB entry the PE held
(about 874k drops per 10 s per PE on an i7-12700KF desktop, mostly on
idle PEs). Merges now prefer one that leaves the PE's lower-half global
span alone, falling back to the old choice; every kept scope still
covers the TLBIs it stands for. Two-PE benchmark: drop_global and
refills 1280 -> 0. stela-engine on Linux: 1921 passed, 0 failed.
(upstream PR #245 by justpainful)
The walk measures GTS as its fixed 0x40 bytes. A nonzero descriptor
count makes the unit longer, so a later capability inside that tail
would pass the overlap check, and if it decoded as ML its LCTL could be
written there. Until the descriptor geometry is known, such a layout is
refused again; the version-0 headers and the skipped alternate links
stay accepted.
(upstream PR #244 by justpainful)
8086:7a50 reports its multi-link capability header as version 0, which
the preflight refused, so no HD Audio controller started ("HOST DEVICE
FAILED ... UnsupportedExtendedCapability { id: 2, version: 0 }"). Linux
never checks the version. GTS geometry is never touched, and only the
first link is clocked, so later alternate links are left alone.
(upstream PR #244 by justpainful)
The install build is the RTL8852CE Wi-Fi branch (wifi/rtw8852c-m3, 999c0d361)
with upstream's GPT slot, TRIM and 32 MiB log fixes.
One conflict, in crates/stela-boot/src/engine/network.rs (HostNetwork::open):
the Wi-Fi adapter's address wait still runs through network_link::address,
so its connection keeper's failures are retried until the cut, and upstream's
DHCP and DNS notes (Stack::take_notes) are logged after that wait, before the
keeper's retry line. This matches wifi/rtw8852c-m3-test, without its
host-check-only `pub(crate) mod security`.