Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
76c95a6
chore(quest): claim quest/m2/ts-mir.md
kixelated Oct 25, 2026
4340fb1
feat(ts)!: lower every body from MIR, deleting the THIR lowering
kixelated Oct 25, 2026
4ca3517
perf(ts): return values in place and drop trailing void returns
kixelated Oct 25, 2026
687f90a
perf(ts): step array loops in place and fold more temporaries
kixelated Oct 26, 2026
ea9a24d
perf(ts): step ranges in place and fold arrays passed by reference
kixelated Oct 26, 2026
fbe76c1
perf(ts): fold reads of unchanging locals' fields and skip empty swit…
kixelated Oct 26, 2026
a19e2d2
perf(ts): convert a residual made in place without a variable
kixelated Oct 26, 2026
a8b3d8e
perf(ts): bounds-check slices with rt.idx and inline constant locals
kixelated Oct 26, 2026
65ffb1f
test(ts): signed division and remainder by a constant
kixelated Oct 26, 2026
40a62cd
feat(ts): `?` on a Result in a function returning Poll
kixelated Oct 26, 2026
22721cc
feat(ts): constant inclusive ranges
kixelated Oct 26, 2026
f4955b0
test(ts): move the drops MIR lowers out of the reject fixture
kixelated Oct 26, 2026
01e1447
Merge origin/main into quest/m2/ts-mir
kixelated Oct 26, 2026
df6e811
perf(ts): step iterators in place in two variables, not an object
kixelated Oct 26, 2026
14f1a24
docs(ts): describe the MIR lowering, and finish the ts-mir quest
kixelated Oct 26, 2026
4d43223
Merge origin/main into quest/m2/ts-mir
kixelated Oct 26, 2026
9c1a2d9
chore(ts): remove rustc crash dumps committed by mistake
kixelated Oct 26, 2026
8c72de6
Merge origin/main into quest/m2/ts-mir
kixelated Oct 26, 2026
5f930c9
Merge origin/main into quest/m2/ts-mir
kixelated Oct 26, 2026
24b608b
fix(ts): keep the reads of arithmetic that can panic, even unread
kixelated Oct 26, 2026
adfa30a
docs(ts): measure MIR against THIR again after the wide-integer merge
kixelated Oct 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions driver/src/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ pub struct Args {
pub manifest: PathBuf,
/// Passed on to `cargo check`.
pub cargo: Vec<String>,
/// The driver's own options, each with its value.
pub options: Vec<(String, String)>,
}

/// What a driver writes, absolute.
Expand All @@ -29,11 +27,9 @@ pub enum Output {

impl Args {
/// Parse `args`, without the program name, or `None` after printing `usage` for
/// `--help`. `options` are the driver's own, each taking a value. An error ends with
/// `usage`.
pub fn parse(args: &[String], usage: &str, options: &[&str]) -> Result<Option<Self>, String> {
/// `--help`. An error ends with `usage`.
pub fn parse(args: &[String], usage: &str) -> Result<Option<Self>, String> {
let mut config = None;
let mut own = Vec::new();
let mut out = None;
let mut census = None;
let mut manifest = None;
Expand All @@ -55,13 +51,6 @@ impl Args {
};
*slot = Some(absolute(Path::new(value))?);
}
option if options.contains(&option) => {
let [value, tail @ ..] = rest else {
return Err(format!("{arg} needs a value\n\n{usage}"));
};
rest = tail;
own.push((option.to_string(), value.clone()));
}
"--" => {
cargo = rest;
break;
Expand Down Expand Up @@ -91,7 +80,6 @@ impl Args {
output,
manifest,
cargo: cargo.to_vec(),
options: own,
}))
}
}
Expand Down
2 changes: 1 addition & 1 deletion ffi/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub fn run(args: &[String]) -> ExitCode {
}

fn try_run(args: &[String]) -> Result<ExitCode, String> {
let Some(args) = Args::parse(args, USAGE, &[])? else {
let Some(args) = Args::parse(args, USAGE)? else {
return Ok(ExitCode::SUCCESS);
};
let config = Config::load(&args.config)?;
Expand Down
3 changes: 2 additions & 1 deletion quest/m2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ The fork's feature quests folded into the [exporter](/quest/m1/ffi-export.md);

## Required

- [Lower bodies from MIR](/quest/m2/ts-mir.md) - the MIR spike's prototype becomes the only lowering, and the THIR one goes
- [Cheaper byte slices](/quest/m2/ts-byte-views.md) - splitting a `&[u8]` stops making a `Uint8Array` view per split
- [MIR's own census refusals](/quest/m2/ts-mir-census.md) - the census refuses no function THIR translated, and points type refusals at their locals
- [Smaller output from MIR](/quest/m2/ts-mir-size.md) - the bench's bundles shrink back to THIR's sizes, coroutine classes first
- [Wide-integer runtime off bigint](/quest/m2/ts-wide-bigint.md) - checked sums, 128-bit quotients, and comparisons with numbers stop going through `bigint`, kept only if measured faster
- [Drop in the TypeScript translator](/quest/m2/ts-drop.md) - every value that drops in moq-net and kio drops where Rust drops it
- [Async in the TypeScript translator](/quest/m2/ts-async.md) - moq-net's and kio's async code translates with Rust's lazy futures
Expand Down
2 changes: 0 additions & 2 deletions quest/m2/ts-async.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ What moq-net still needs, by its census from MIR at the pinned revision:
`map_err`), `pin!` (50 with `PinMacroHelper`), `poll_fn` (31), `future::pending`
(5), and `Box::pin` (29, a boxed future that binds to hand-written TS at the
boundary, per the [model](/quest/m2/ts-model.md)).
- `?` inside a function that returns `Poll`, as `ready!(..)?` writes it: 284 sites.
- Async closures.
- kio's own API, reached across crates (`Pending`, `Consumer::poll`,
`Waiter::poll_future`, `Tasks`), with the atomics, `OnceLock`, and coop budget behind
Expand All @@ -38,5 +37,4 @@ Public API: the translator's output for async code.

## Required

- [Lower bodies from MIR](/quest/m2/ts-mir.md) - async bodies come from the coroutine transform
- [Drop in the TypeScript translator](/quest/m2/ts-drop.md) - async bodies hold the values that drop it still refuses
4 changes: 0 additions & 4 deletions quest/m2/ts-drop.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,3 @@ before each call that can panic and wraps its body in a `try`; measure any chang
the [TS benchmark](/ts/README.md#bench).

Public API: the translator's output for values that drop.

## Required

- [Lower bodies from MIR](/quest/m2/ts-mir.md) - drops come from MIR's elaboration
30 changes: 30 additions & 0 deletions quest/m2/ts-mir-census.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# [S] MIR's own census refusals

## Goal

[rust2-ts](/ts/README.md)'s census of moq-net and kio refuses no function the THIR
lowering translated, and each refusal of a type points at the local or expression that
holds it rather than at its function.

## Plan

At the move to MIR, 16 function instances of moq-net and kio that THIR translated
clean, before collections landed, are refused:

- `unsupported type ... from another crate` for temporaries THIR never declared
(`Patterns`, `Duration`, kio's `Mut`, `Shared`, and `Consumer`, an atomic,
`MaybeUninit`), reported at the function's span. Each should carry its local's span,
from `local_decls`.
- Drops THIR's scopes never saw: `Option<Rank<..>>`, `AdapterSend`, `Box<[..]>`,
`Box<L>`'s `Drop`, and an `Option<Error>` replaced through a `&mut`.

MIR also refuses constructs THIR wrote differently:

- `ControlFlow` values other than the one `?` makes (27 sites): pick a representation,
such as `rt.Result`'s shape or a tagged object, by what `try_fold` and moq's own uses
need.
- A switch on, or a field of, a type from another crate without a mapping
(`kio::Unused`, `Bound`, `MaybeUninit`, `ManuallyDrop`).
- A switch on `char` (6), once `char` has a representation.

Public API: the translator's output for the functions it newly translates.
26 changes: 26 additions & 0 deletions quest/m2/ts-mir-size.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# [M] Smaller output from MIR

## Goal

[rust2-ts](/ts/README.md)'s bundles on `just ts bench` are no larger than the THIR
lowering's were, without giving up the speed MIR gained: the codec's at most 27483
bytes minified and 8437 gzipped, and the async handoff's at most 10901 and 3446.

## Plan

At the move to MIR, the codec's bundle was 27750 bytes minified and 8876 gzipped (+1%,
+5%), and the async handoff's 18258 and 3993 (+67%, +16%), against THIR's numbers
above. Each candidate is measured on the bench's sizes and timings before it lands:

- A coroutine's class, about 520 bytes minified each against about 140 for a THIR
generator: a base class in the runtime for the state and `poll` scaffolding, fields
only for what lives across an `.await`, and a resume function structured where the
graph allows (a dispatch at each loop header it enters) rather than a `switch` over
every block. Generators stay out: they measured 1.4-5.5x slower on the handoff.
- Tuple temporaries a destructuring `const [a, b] = ..` would avoid, and the `let`
list at the top of each function, where a local assigned once could be declared at
its assignment.
- The codec's `fill`, `encodeFrames`, and `decodeSplit`, whose blocks nest deeper than
THIR's loops did.

Public API: the translator's output, which changes shape but not behavior.
49 changes: 0 additions & 49 deletions quest/m2/ts-mir.md

This file was deleted.

Loading