From 28c37143e9f3ef9c4c61ccac1b94c02f365ded7e Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Sun, 25 Oct 2026 12:40:53 +0000 Subject: [PATCH] docs: a guide to -mm=own and its decorators docs/own-memory-model.md: owners, moves and borrows; the errors and their fixes; strings, closures and Shared; @keeps, @lends, @record, @borrows, @immortalizes, @nodrops, @final and @value, each with an example compiled under -mm=own; --own-facts and separate compilation; __MEMORY_MODEL__; current limits. The README links it and no longer says the default library has no -mm=own build. Co-Authored-By: Claude Opus 5.5 --- README.md | 17 +- docs/memory-models.md | 3 + docs/own-memory-model.md | 710 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 726 insertions(+), 4 deletions(-) create mode 100644 docs/own-memory-model.md diff --git a/README.md b/README.md index fd469227f..e5f5f88ad 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,7 @@ It is a good place to see how TypeScript code drives a native C++ framework: the - [As WebAssembly](#compiling-as-wasm) - [C bindings with tsbindgen](#c-bindings-with-tsbindgen) - [Memory models](#memory-models) + - [`-mm=own`](#-mmown) ([guide](docs/own-memory-model.md)) - [Building from source](#build) - [For Android](#build-for-android) - [Community](#chat-room) @@ -49,7 +50,7 @@ It is a good place to see how TypeScript code drives a native C++ framework: the ## What's new -- New memory model **`-mm=own`**: single ownership inferred at compile time, like Rust's borrow checker. There is no collector and no reference counting, and a program whose ownership cannot be proven is a compile error. Shared ownership is opt-in with `Shared`. See [Memory models](#memory-models) +- New memory model **`-mm=own`**: single ownership inferred at compile time, like Rust's borrow checker. There is no collector and no reference counting, and a program whose ownership cannot be proven is a compile error. Shared ownership is opt-in with `Shared`. See [Memory models](#memory-models) and the [`-mm=own` guide](docs/own-memory-model.md) - **Android** targets (`arm64-v8a`, `armeabi-v7a`, `x86_64`, API 29+): executables and shared libraries linked through the Android NDK. The release zip carries the collector, async runtime and default library for all three ABIs. See [Compile for Android](#compile-for-android) - Implemented `try/catch` exception handling in the **JIT** on Windows (x64 SEH unwinding via a custom LLJIT runtime) - Migrared to **LLVM 22.1.8** @@ -754,7 +755,7 @@ against garbage collection's 5.8 - but **objects that refer to each other in a c freed under it**, which is the same trade Swift makes with ARC. See **[docs/memory-models.md](docs/memory-models.md)** for which shapes leak, which do not, and -what to do about it. +what to do about it, and **[docs/own-memory-model.md](docs/own-memory-model.md)** for `-mm=own`. ### Performance @@ -826,8 +827,16 @@ const b = a; // both share the Node print(a.value.value, b.value.value, Shared.count(a)); // 1 1 2 ``` -`-mm=own` is still in development: some valid TypeScript does not compile under it yet. The -default library has no `-mm=own` build yet, so compile with `--no-default-lib`. +Inside a module ownership is inferred. What a function another module calls does with its +parameters is said in its signature with `@keeps`, `@lends`, `@record`, `@borrows` and +`@immortalizes`; `@nodrops` marks a C function that frees nothing, and `@final` and `@value` +classes make calls direct and values copies. + +`-mm=own` is still in development: some valid TypeScript does not compile under it yet (the +default library's `Map` and `Set` among it). + +See **[docs/own-memory-model.md](docs/own-memory-model.md)** for the rules, the errors and how to +fix them, `Shared`, every decorator, and separate compilation. ## Build diff --git a/docs/memory-models.md b/docs/memory-models.md index d049cbdf4..7dfe98b5d 100644 --- a/docs/memory-models.md +++ b/docs/memory-models.md @@ -8,6 +8,9 @@ The compiler can manage heap memory in three ways, selected with `-mm=`: | `-mm=rc` | **Reference counting.** Objects are freed the moment the last reference to them goes away. No collector, no pauses, no runtime dependency on libgc. | Predictable latency, WebAssembly, or shipping without libgc — **provided you read the cycles section below.** | | `-mm=none` | **Nothing is ever freed.** | Short-lived programs where the process exits before memory matters. | +A fourth, `-mm=own`, infers a single owner for every object at compile time, with no collector +and no counting; it has a page of its own, [own-memory-model.md](own-memory-model.md). + `-mm=gc` is the default and stays the default. Everything below is about what changes if you choose `-mm=rc`. diff --git a/docs/own-memory-model.md b/docs/own-memory-model.md new file mode 100644 index 000000000..6caae447e --- /dev/null +++ b/docs/own-memory-model.md @@ -0,0 +1,710 @@ +# The `-mm=own` memory model + +`-mm=own` frees memory the way Rust does: every heap block has exactly one owner, and the +compiler works out at compile time where each block is freed. There is no collector and no +reference count at run time. When the compiler cannot prove a single owner, it rejects the +program instead of compiling it with a leak or a double free. + +```bash +tslang --emit=exe -mm=own hello.ts +``` + +There are no lifetime annotations. Inside a module the compiler infers everything. A few +decorators state, in a function's or a class's signature, what another module needs to know +about it, and `Shared` gives opt-in shared ownership. + +- [Owners, moves and borrows](#owners-moves-and-borrows) +- [Reading the errors](#reading-the-errors) +- [Strings](#strings) +- [Closures](#closures) +- [Shared ownership: `Shared`](#shared-ownership-sharedt) +- [Decorators](#decorators) + - [`@keeps`](#keeps) - the parameters a function keeps + - [`@lends`](#lends) - the arguments a result borrows + - [`@record`](#record) - a result that is a box of borrows + - [`@borrows`](#borrows) - the arguments a generator borrows + - [`@immortalizes`](#immortalizes) - the parameters a function keeps for good + - [`@nodrops`](#nodrops) - a C function that frees nothing + - [`@final`](#final) - a class nobody extends + - [`@value`](#value) - a type that is copied, not shared +- [Separate compilation](#separate-compilation) +- [Code for one memory model](#code-for-one-memory-model) +- [Current limits](#current-limits) + +Every example below compiles (or fails, where it says so) with +`tslang -mm=own --emit=jit example.ts`, and the output shown is the compiler's. + +## Owners, moves and borrows + +The owner of a block is a local, a field, an array element or a global. The owner frees the +block when it gives it up: when its scope ends, when it is overwritten, or when the block is +removed from its container (`pop`, `shift`, `splice`, `delete`). + +Where a second reference would be made, the compiler decides one of three things: + +1. **Move.** The source is not used afterwards, so it gives the block up. "Moved" is a + compile-time fact; nothing happens at run time. +2. **Borrow.** The new reference owns nothing. It is valid only while the owner keeps the block: + it may not be used after the owner frees or overwrites it, and it may not be stored in a + longer-lived place, returned or captured by a closure that escapes. +3. **Error.** Neither is possible. + +Three rules follow: + +- **Arguments are borrowed.** A function lends its arguments to the function it calls. +- **Results are owned.** The caller owns what a call returns. +- **Containers own.** A store into a field, an element or a global moves the value in: the value + must be fresh (a `new`, a literal, a call's result) or not used again. A read out of a + container is a borrow. + +```typescript +class Node { constructor(public value: number) {} } +class Holder { node: Node = new Node(0); } + +function sum(n: Node, m: Node) { return n.value + m.value; } // arguments are borrowed +function make(v: number) { return new Node(v); } // the caller owns the result + +function main() { + const h = new Holder(); + const n = make(1); + print(sum(n, h.node)); // n and h.node are lent to sum, and still owned here + const first = h.node; // a borrow of the field: first owns nothing + print(first.value); + h.node = n; // n moves into h; the old Node is freed here + const list: Node[] = []; + list.push(make(2)); // a fresh value moves into the array + list.push(new Node(3)); + print(list[0].value + list[1].value, h.node.value); +} // h, list and what they own are freed here +``` + +```text +1 +0 +5 1 +``` + +Inside a module the compiler also infers each function's facts from its body: a function that +stores a parameter keeps it, so its callers have to move the argument in; a function that +returns a field of its argument returns a borrow, so its callers may only borrow the result. +Callers in other modules cannot see the body, which is what the [decorators](#decorators) are for. + +## Reading the errors + +A value is named `'this value'` in the messages below; the position points at it. + +**Used after a move.** The `Node` moved into `h.node`, so `n` no longer owns it: + +```typescript +class Node { constructor(public value: number) {} } +class Holder { node: Node; } + +function main() { + const h = new Holder(); + const g = new Holder(); + const n = new Node(1); + h.node = n; // the Node moves into h + g.node = n; // a second owner: compile error + print(h.node.value); +} +``` + +```text +e1_move.ts:9:5: error: 'this value' is used here after its value was moved + g.node = n; // a second owner: compile error + ^ +e1_move.ts:8:5: note: value moved here + h.node = n; // the Node moves into h + ^ +``` + +The next two use the second example's classes, with `node` initialized. + +**A borrow stored.** `h.node` is still `h`'s, so it cannot become `g`'s too: + +```typescript +function main() { + const h = new Holder(); + const g = new Holder(); + g.node = h.node; // a borrow of h.node stored in g: compile error + print(g.node.value); +} +``` + +```text +e3_field_borrow.ts:7:5: error: 'this value' borrows a field and cannot be stored, returned or captured + g.node = h.node; // a borrow of h.node stored in g: compile error + ^ +``` + +**A borrow used after its owner let go.** Overwriting `h.node` frees the `Node` that `first` +borrows: + +```typescript +function main() { + const h = new Holder(); + const first = h.node; // borrows the Node h owns + h.node = new Node(1); // frees that Node while first still names it: compile error + print(first.value); +} +``` + +```text +e4_overwrite.ts:8:11: error: 'this value' borrows a field but is used here after it may be released or overwritten + print(first.value); + ^ +e4_overwrite.ts:7:5: note: it may be released or overwritten here + h.node = new Node(1); // frees that Node while first still names it: compile error + ^ +``` + +A call can free things too. A call of a function that may overwrite or free what the caller +borrows ends the borrow, and the note then points at the call. A call of a function the compiler +knows nothing about - a C function, a virtual method another module may override - may free +anything (see [`@nodrops`](#nodrops), [`@final`](#final) and +[Separate compilation](#separate-compilation)). + +The usual ways out are the Rust ones: move instead of borrowing (give the value up), store a +fresh value (`new`, a copy), keep the borrow shorter than its owner, or share the object with +[`Shared`](#shared-ownership-sharedt). + +## Strings + +A string is immutable, so a copy cannot be told apart from sharing. Where the compiler cannot +prove a move or a borrow of a string, it copies it instead of reporting an error: + +```typescript +class Person { constructor(public name: string) {} } + +function main() { + const p = new Person("Ann" + 1); + const q = new Person(""); + q.name = p.name; // a string is copied, not shared + p.name = "Bob"; + print(p.name, q.name); +} +``` + +```text +Bob Ann1 +``` + +A string passed to a parameter the callee keeps is not copied, because the callers rely on that +fact: `new Person(p.name)` is an error. Pass a string you give up, or a fresh one +(`new Person(p.name + "")`). String literals are constant data and are never freed or copied. + +## Closures + +A closure that does not escape borrows what it captures. A closure that escapes - returned, +stored, or given to a function that keeps it - takes its captured variables with it, and the +frame that made it may not use them afterwards. + +```typescript +function counter() { + let n = 0; + return () => ++n; // the closure escapes and takes n's cell with it +} + +function main() { + const values = [1, 2, 3]; + let total = 0; + values.forEach(v => { total += v; }); // a closure that does not escape borrows + const next = counter(); + next(); + print(total, next()); +} +``` + +```text +6 2 +``` + +A closure kept for good, in an array that is only ever pushed onto, is covered by +[`@immortalizes`](#immortalizes). + +## Shared ownership: `Shared` + +A graph that a tree of owners cannot express - two objects that both need a third, a list that +hands out its nodes - uses `Shared`. A `Shared` is a counted handle: copying it makes a +second handle to the same object, and the object is freed when the last handle goes. `.value` +reads or writes the object inside. + +```typescript +class Node { constructor(public value: number) {} } +class Holder { node: Shared | null = null; } + +function main() { + const a = new Shared(new Node(1)); + const b = a; // a second handle to the same Node + const h = new Holder(); + h.node = a; // and a third + b.value.value = 5; // .value is the object inside + print(a.value.value, a === b, Shared.count(a)); + b.value = new Node(7); // replaces the Node all handles share + if (h.node) print(h.node.value.value); +} +``` + +```text +5 true 3 +7 +``` + +- `===` and `!==` compare handles: two handles are equal when they hold the same object. +- `Shared.count(s)` is the number of handles. Under `-mm=gc` and `-mm=none`, where `Shared` + is a plain reference, it is `-1`. +- Only the handles are counted; the rest of the program keeps single owners. +- **Cycles are never freed**, as under `-mm=rc`: two objects whose `Shared` fields point at each + other keep each other alive. The program still runs correctly. + +`Shared` is also the answer to an array method that would give its elements a second owner. +`filter` over class instances keeps each element it selects in the result while the source +still owns it, which is an error; over handles it is not: + +```typescript +class Node { constructor(public value: number) {} } + +function main() { + const all = [new Shared(new Node(1)), new Shared(new Node(2))]; + const big = all.filter(n => n.value.value > 1); // copies of the handles + print(big.length, Shared.count(big[0])); +} +``` + +```text +1 2 +``` + +## Decorators + +Inside one module the compiler infers what each function does with its parameters. A function +another module can call - an exported function, a method of an exported class - is called from +code that sees only its declaration, so what its callers rely on has to be in its signature. +The compiler says so when it is missing, and checks the body against what the signature says. + +The other memory models ignore `@keeps`, `@lends`, `@record`, `@borrows`, `@immortalizes` and +`@nodrops`, so the same source compiles under all of them. A method that overrides another has to +say the same `@keeps`, `@borrows`, `@lends` and `@record` as the method it overrides. + +Each takes the names of parameters, as strings; `"this"` names the receiver. + +### `@keeps` + +`@keeps("p")`: the function keeps parameter `p` - stores it in a field, an element or a +global - so its callers move the argument in and may not use it afterwards. + +Without it, an exported constructor that stores its parameter is an error: + +```typescript +export class Tag { constructor(public name: string) {} } + +export class Holder { + tag: Tag; + constructor(tag: Tag) { + this.tag = tag; + } +} +``` + +```text +m1_keeps_err.ts:6:9: error: 'this value' is a parameter, kept here, but -mm=own cannot make the callers of 'Holder.constructor' give it up + this.tag = tag; + ^ +m1_keeps_err.ts:5:5: note: 'Holder.constructor' could return a borrow or keep a parameter, but it can be called from another module; '@lends' or '@keeps' would say it in its signature + constructor(tag: Tag) { + ^ +``` + +With it: + +```typescript +export class Tag { constructor(public name: string) {} } + +export class Holder { + tag: Tag; + + @keeps("tag") + constructor(tag: Tag) { + this.tag = tag; + } + + @keeps("tag") + replace(tag: Tag) { + this.tag = tag; + } +} + +function main() { + const h = new Holder(new Tag("first")); + const t = new Tag("second"); + h.replace(t); // t moves into h: t may not be used after this + print(h.tag.name); +} +``` + +```text +second +``` + +`@keeps` also goes on a setter that stores its value (`@keeps("n") set rebase(n: Node)`). + +### `@lends` + +`@lends("p")`: the result is a borrow of parameter `p` (or of `"this"`): the caller owns +nothing, and may use the result only while `p`'s owner keeps it. + +Without it, returning a field of an argument from an exported function is an error: + +```typescript +export class Node { constructor(public v: number) {} } +export class List { first: Node = new Node(1); } + +export function firstOf(l: List): Node { + return l.first; +} +``` + +```text +m2_lends_err.ts:5:5: error: 'this value' borrows a field and cannot be stored, returned or captured + return l.first; + ^ +m2_lends_err.ts:4:1: note: 'firstOf' could return a borrow or keep a parameter, but it can be called from another module; '@lends' or '@keeps' would say it in its signature +export function firstOf(l: List): Node { +^ +``` + +With it: + +```typescript +export class Node { constructor(public v: number) {} } + +@final +export class List { + first: Node = new Node(1); + + @lends("this") + peek(): Node { + return this.first; + } +} + +@lends("l") +export function firstOf(l: List): Node { + return l.first; +} + +function main() { + const l = new List(); + const a = firstOf(l); // a borrow of l's Node: valid while l is + const b = l.peek(); + print(a.v + b.v); +} +``` + +```text +2 +``` + +`@lends` with one name is a plain borrow. With several, the result is a record that borrows each +of them, and it needs [`@record`](#record). + +### `@record` + +`@record`, always beside `@lends`: the result is a *borrowing record* - a new object the caller +owns and frees, whose fields borrow the arguments `@lends` names. The record may not outlive any +of them. + +```typescript +export class Node { constructor(public v: number) {} } + +export interface Pair { + a: Node; + b: Node; +} + +@lends("a", "b") +@record +export function pairOf(a: Node, b: Node): Pair { + return { a: a, b: b }; +} + +function main() { + const x = new Node(1); + const y = new Node(2); + const p = pairOf(x, y); // the caller owns the record; p.a and p.b borrow x and y + print(p.a.v + p.b.v); +} +``` + +```text +3 +``` + +Without `@record`, a caller in another module would take the result for a plain borrow and never +free the record, so leaving it out of an exported function is an error: + +```text +m4_record_err.ts:8:1: error: 'pairOf' returns a record that borrows 'a', 'b', which another module can learn only from '@record' beside its '@lends' +@lends("a", "b") +^ +``` + +### `@borrows` + +`@borrows("p")`, on a generator: the generator's state borrows `p` (or `"this"`). The caller owns +the generator, but it may not outlive `p`. It also goes on a function that returns such a +generator. On anything else it is an error. + +```typescript +@final +export class Word { + constructor(public text: string) {} + + @borrows("this") + *letters() { + for (const c of this.text) yield c; + } +} + +@borrows("w") +export function *lettersOf(w: Word) { + for (const c of w.text) yield c; +} + +function main() { + const w = new Word("abc"); + let s = ""; + for (const c of lettersOf(w)) s += c; // the generator may not outlive w + for (const c of w.letters()) s += c; + print(s); +} +``` + +```text +abcabc +``` + +### `@immortalizes` + +A module-level array that is only ever pushed onto - a *keeper*, such as a list of registered +callbacks - holds what it is given until the program ends. A value pushed into one is made +*immortal*: its owner's release frees nothing, and neither does the release of anything a closure +or a bound method in it relies on. + +Inside a module the compiler finds the keepers itself. `@immortalizes("p")` says, for callers in +other modules, that the function keeps parameter `p` in one; each caller then makes its argument +immortal. + +```typescript +type Callback = (n: number) => void; +let handlers: Callback[] = []; // only ever pushed onto: a keeper + +@immortalizes("h") +export function onTick(h: Callback): void { + handlers.push(h); +} + +function setup(): void { + const total = [0.0]; + onTick((n: number) => { total[0] += n; print(total[0]); }); +} // total outlives setup: the closure keeps it + +function main() { + setup(); + for (const h of handlers) h(1); + for (const h of handlers) h(2); +} +``` + +```text +1 +3 +``` + +Without it, the exported function is an error: + +```text +m5_immortal_err.ts:4:1: error: 'onTick' keeps '#0' for good, but -mm=own cannot tell its callers in other modules; '@immortalizes' would say it in its signature +``` + +On a `declare function` it is trusted as written: say it on a C function that keeps a callback. + +### `@nodrops` + +`@nodrops declare function f(...)`: a function defined outside TypeScript - a C function - that +frees nothing a TypeScript caller can reach. A call of a declared function without it may free +anything, so a borrow cannot be lent to it. + +```typescript +@nodrops declare function strlen(s: string): index; + +class W { + constructor(private text: string) {} + + size(): int { + return strlen(this.text); // lends a field to a C function + } +} + +function main() { + print(new W("abc").size()); +} +``` + +```text +3 +``` + +Without `@nodrops`: + +```text +m6_nodrops_err.ts:7:21: error: 'this value' borrows a field but is used here after it may be released or overwritten + return strlen(this.text); // lends a field to a C function + ^ +``` + +A declaration has no body to check, so this is the declaration's word. Never put it on a function +that can run TypeScript code (one that takes a callback). + +### `@final` + +`@final class C`: no class may extend `C`. It works under every memory model: a call on a value +of type `C` is a direct call, with no vtable lookup +([design](../tslang/docs/superpowers/specs/2026-10-19-final-classes-design.md)). + +Under `-mm=own` it matters more. A method of an exported class that is not `@final` may be +overridden in another module, by a method that frees anything; the compiler cannot see that +method, so a call of it ends every borrow the caller holds, and its result is not known to be +fresh: + +```typescript +export class S { + color: string = "red"; + w: number = 2; + area() { + return this.w * 2; + } + + describe() { + return `${this.color} area=${this.area()}`; + } +} + +function main() { + print(new S().describe()); +} +``` + +```text +m8_virtual_err.ts:11:16: error: 'this value' borrows a field but is used here after it may be released or overwritten + return `${this.color} area=${this.area()}`; + ^ +m8_virtual_err.ts:11:38: note: it may be released or overwritten here + return `${this.color} area=${this.area()}`; + ^ +``` + +With `@final export class S` it compiles and prints `red area=4`. Mark exported classes `@final` +unless another module has to extend them. + +### `@value` + +`@value class C` and `@value interface R`: a type whose values are copied, like numbers, not +shared. It has no identity, no vtable and no base class, and its values are not heap blocks, so +they need no owner at all +([design](../tslang/docs/superpowers/specs/2026-10-24-value-types-design.md)). It suits small +immutable types such as vectors and colors, and it works under every memory model. + +```typescript +@value +class Vector { + constructor(public readonly x: number, public readonly y: number) {} + + plus(v: Vector) { return new Vector(this.x + v.x, this.y + v.y); } +} + +@value +interface Ray { + readonly start: Vector; + readonly dir: Vector; +} + +function main() { + let p = new Vector(0, 0); + const r: Ray = { start: p, dir: new Vector(1, 2) }; + for (let i = 0; i < 3; i++) p = p.plus(r.dir); // no allocation: Vectors are copied + print(p.x, p.y, r.start.x); +} +``` + +```text +3 6 0 +``` + +A `@value` record may hold a reference to a class object; under `-mm=own` that field is a +borrow, so the record may not outlive the object it names (the ray tracer's `Intersection`, +which names the object it hit). + +## Separate compilation + +A module imported as source (`import './lib'`) is read as declarations: the importer sees the +decorators above, and nothing of the bodies. Everything else about another module's functions is +unknown, so a call of one may free anything. + +A module compiled under `-mm=own` also records, in its object file, what each exported function +frees: nothing, or only certain fields, and whether its result is fresh. Give the objects of the +modules a program imports to `--own-facts`, and calls into them keep the caller's borrows they do +not touch: + +```bash +tslang --emit=obj -mm=own camera.ts -o camera.obj +tslang --emit=exe -mm=own --own-facts=camera.obj --obj=camera.obj main.ts -o main.exe +``` + +A shared library built under `-mm=own` carries the same facts, which an importer reads from the +loaded library. A module built under another memory model is unknown to `-mm=own`, and objects +that cross from it are never freed (see [Mixing modules](memory-models.md#mixing-modules)). + +## Code for one memory model + +`__MEMORY_MODEL__` is the memory model a module is compiled for, as a string. A comparison with it +is decided at compile time, and only the branch taken is compiled: + +```typescript +function main() { + if (__MEMORY_MODEL__ === "own") { + print("single owner"); + } else { + print("model:", __MEMORY_MODEL__); + } + print(__OS__, __ARCH__); +} +``` + +```text +single owner +win32 x64 +``` + +`__OS__` and `__ARCH__` are the target's OS and architecture, named as Node's `process.platform` +and `process.arch` name them. + +`--verify-ownership` is a debugging aid for the compiler itself: it checks that every slot taking +a reference gives it back on every path out of a function. + +## Current limits + +`-mm=own` is still in development, and some valid TypeScript does not compile under it yet. + +- The default library has an `-mm=own` build, and arrays, strings and their methods work, but + `Map` and `Set` do not compile under `-mm=own` yet. +- Array methods that keep elements of the source in a new array (`filter` over class instances) + give each such element a second owner, which is an error by design. Use `Shared` elements, + or build the result from copies. +- `Shared` cycles are never freed. +- There are no lifetime annotations: a borrow that the compiler cannot follow is an error, even + when the program would be correct. The fix is usually a move, a fresh value or `Shared`. + +The ray tracer benchmark ([tslang/benchmarks/raytrace](../tslang/benchmarks/raytrace/README.md)) +compiles under `-mm=own`; its timings against the other memory models are in the +[README](../README.md#performance).