Skip to content

docs: add inlineDemo tracing example (inline showcase)#232

Merged
gnidan merged 1 commit into
transform-contextfrom
compiler-inline-demo
Jul 13, 2026
Merged

docs: add inlineDemo tracing example (inline showcase)#232
gnidan merged 1 commit into
transform-contextfrom
compiler-inline-demo

Conversation

@gnidan

@gnidan gnidan commented Jul 3, 2026

Copy link
Copy Markdown
Member

Adds the inlineDemo tracing example — a dedicated showcase for the
inline transform, the way tailRecursiveSum/tailRecursiveFactorial
showcase tailcall.

The program

A leaf helper square(x) -> x * x called from two sites:

sumOfSquares = square(a) + square(b);   // a = 3, b = 4

Args are storage reads (a, b), not constants — so L1 fold can't
collapse the inlined bodies, keeping the two virtual activations visible
in the tracer at O2/O3.

Verified against bugc (this branch)

Scope of this PR

Data only — the inlineDemo export. Prose + the <TraceExample> block
in tracing.mdx will follow from writer/docs (coordinating placement
with the #227 Explore/trace-playground reorg).

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-07-13 03:28 UTC

@gnidan gnidan force-pushed the transform-context branch 3 times, most recently from 8ee5883 to e9d29df Compare July 13, 2026 02:59
A small leaf helper square(x) called from two sites with
storage-read args. At O2/O3 both sites inline into the caller ->
two virtual activations in the tracer (the inline showcase, as
sum/factorial were for tailcall). Args are non-constant (storage
reads) so L1 fold can't collapse the inlined bodies.

Verified against bugc: correct result (3^2 + 4^2 = 25) at O0-O3;
zero inline marks at O0/O1, both sites inlined at O2 (108 -> 50
runtime instrs) and O3.

Prose + TraceExample wiring to follow (writer/docs).
@gnidan gnidan force-pushed the compiler-inline-demo branch from 1898f00 to 1b5efc3 Compare July 13, 2026 03:22
@gnidan gnidan merged commit 589c12a into transform-context Jul 13, 2026
4 checks passed
@gnidan gnidan deleted the compiler-inline-demo branch July 13, 2026 03:23
gnidan added a commit that referenced this pull request Jul 13, 2026
A small leaf helper square(x) called from two sites with
storage-read args. At O2/O3 both sites inline into the caller ->
two virtual activations in the tracer (the inline showcase, as
sum/factorial were for tailcall). Args are non-constant (storage
reads) so L1 fold can't collapse the inlined bodies.

Verified against bugc: correct result (3^2 + 4^2 = 25) at O0-O3;
zero inline marks at O0/O1, both sites inlined at O2 (108 -> 50
runtime instrs) and O3.

Prose + TraceExample wiring to follow (writer/docs).
gnidan added a commit that referenced this pull request Jul 13, 2026
A small leaf helper square(x) called from two sites with
storage-read args. At O2/O3 both sites inline into the caller ->
two virtual activations in the tracer (the inline showcase, as
sum/factorial were for tailcall). Args are non-constant (storage
reads) so L1 fold can't collapse the inlined bodies.

Verified against bugc: correct result (3^2 + 4^2 = 25) at O0-O3;
zero inline marks at O0/O1, both sites inlined at O2 (108 -> 50
runtime instrs) and O3.

Prose + TraceExample wiring to follow (writer/docs).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant