summaryrefslogtreecommitdiff
path: root/chapter11
diff options
context:
space:
mode:
Diffstat (limited to 'chapter11')
-rw-r--r--chapter11/Makefile111
-rw-r--r--chapter11/README.md500
-rw-r--r--chapter11/chapter11.iml28
-rw-r--r--chapter11/docs/10-grammar.md (renamed from chapter11/docs/11-grammar.md)0
-rw-r--r--chapter11/docs/example1.gv20
-rw-r--r--chapter11/docs/example1.json31
-rw-r--r--chapter11/docs/example1.svg155
-rw-r--r--chapter11/docs/example2a.gv17
-rw-r--r--chapter11/docs/example2a.json20
-rw-r--r--chapter11/docs/example2a.svg103
-rw-r--r--chapter11/docs/example2b-final.json251
-rw-r--r--chapter11/docs/example2b-final.svg110
-rw-r--r--chapter11/docs/example2b-merged.json339
-rw-r--r--chapter11/docs/example2b-merged.svg130
-rw-r--r--chapter11/docs/example2b-split-y.json486
-rw-r--r--chapter11/docs/example2b-split-y.svg157
-rw-r--r--chapter11/docs/example2b.gv19
-rw-r--r--chapter11/docs/example2b.json30
-rw-r--r--chapter11/docs/example2b.svg150
-rw-r--r--chapter11/docs/example2c.gv15
-rw-r--r--chapter11/docs/example2c.json23
-rw-r--r--chapter11/docs/example2c.svg121
-rw-r--r--chapter11/docs/graph1.gv79
-rw-r--r--chapter11/docs/graph1.json25
-rw-r--r--chapter11/docs/graph1.svg123
-rw-r--r--chapter11/docs/graph2.gv84
-rw-r--r--chapter11/docs/graph2.json25
-rw-r--r--chapter11/docs/graph2.svg123
-rw-r--r--chapter11/docs/graph3-snip.jpgbin19681 -> 0 bytes
-rw-r--r--chapter11/docs/graph3-snip.json17
-rw-r--r--chapter11/docs/graph3-snip.svg91
-rw-r--r--chapter11/docs/graph3.gv85
-rw-r--r--chapter11/docs/graph3.json26
-rw-r--r--chapter11/docs/graph3.svg128
-rw-r--r--chapter11/docs/graph4.gv110
-rw-r--r--chapter11/docs/graph4.json24
-rw-r--r--chapter11/docs/graph4.svg120
-rw-r--r--chapter11/docs/graph5.gv117
-rw-r--r--chapter11/docs/graph5.json24
-rw-r--r--chapter11/docs/graph5.svg120
-rw-r--r--chapter11/docs/graph6.gv117
-rw-r--r--chapter11/docs/graph6.json25
-rw-r--r--chapter11/docs/graph6.svg124
-rw-r--r--chapter11/docs/graph7.gv23
-rw-r--r--chapter11/docs/graph7.json16
-rw-r--r--chapter11/docs/graph7.svg78
-rw-r--r--chapter11/docs/graph8.gv45
-rw-r--r--chapter11/docs/graph8.json21
-rw-r--r--chapter11/docs/graph8.svg98
-rw-r--r--chapter11/docs/lattice.gv133
-rw-r--r--chapter11/docs/lattice.svg644
-rw-r--r--chapter11/src/main/java/com/seaofnodes/simple/GlobalCodeMotion.java272
-rw-r--r--chapter11/src/main/java/com/seaofnodes/simple/IRPrinter.java7
-rw-r--r--chapter11/src/main/java/com/seaofnodes/simple/IterPeeps.java1
-rw-r--r--chapter11/src/main/java/com/seaofnodes/simple/Parser.java52
-rw-r--r--chapter11/src/main/java/com/seaofnodes/simple/Utils.java7
-rw-r--r--chapter11/src/main/java/com/seaofnodes/simple/node/CFGNode.java95
-rw-r--r--chapter11/src/main/java/com/seaofnodes/simple/node/CProjNode.java62
-rw-r--r--chapter11/src/main/java/com/seaofnodes/simple/node/ConstantNode.java1
-rw-r--r--chapter11/src/main/java/com/seaofnodes/simple/node/IfNode.java18
-rw-r--r--chapter11/src/main/java/com/seaofnodes/simple/node/LoadNode.java4
-rw-r--r--chapter11/src/main/java/com/seaofnodes/simple/node/LoopNode.java60
-rw-r--r--chapter11/src/main/java/com/seaofnodes/simple/node/MemOpNode.java4
-rw-r--r--chapter11/src/main/java/com/seaofnodes/simple/node/MultiNode.java8
-rw-r--r--chapter11/src/main/java/com/seaofnodes/simple/node/NeverNode.java20
-rw-r--r--chapter11/src/main/java/com/seaofnodes/simple/node/NewNode.java1
-rw-r--r--chapter11/src/main/java/com/seaofnodes/simple/node/Node.java61
-rw-r--r--chapter11/src/main/java/com/seaofnodes/simple/node/OutNode.java7
-rw-r--r--chapter11/src/main/java/com/seaofnodes/simple/node/PhiNode.java9
-rw-r--r--chapter11/src/main/java/com/seaofnodes/simple/node/ProjNode.java18
-rw-r--r--chapter11/src/main/java/com/seaofnodes/simple/node/RegionNode.java29
-rw-r--r--chapter11/src/main/java/com/seaofnodes/simple/node/ReturnNode.java9
-rw-r--r--chapter11/src/main/java/com/seaofnodes/simple/node/StartNode.java21
-rw-r--r--chapter11/src/main/java/com/seaofnodes/simple/node/StopNode.java18
-rw-r--r--chapter11/src/main/java/com/seaofnodes/simple/node/StoreNode.java6
-rw-r--r--chapter11/src/main/java/com/seaofnodes/simple/node/SubNode.java1
-rw-r--r--chapter11/src/main/java/com/seaofnodes/simple/node/XCtrlNode.java14
-rw-r--r--chapter11/src/main/java/com/seaofnodes/simple/print/SimpleGraphAdapter.java8
-rw-r--r--chapter11/src/main/java/com/seaofnodes/simple/type/Field.java3
-rw-r--r--chapter11/src/main/java/com/seaofnodes/simple/type/TypeTuple.java3
-rw-r--r--chapter11/src/test/java/com/seaofnodes/simple/Chapter01Test.java2
-rw-r--r--chapter11/src/test/java/com/seaofnodes/simple/Chapter04Test.java2
-rw-r--r--chapter11/src/test/java/com/seaofnodes/simple/Chapter05Test.java14
-rw-r--r--chapter11/src/test/java/com/seaofnodes/simple/Chapter06Test.java16
-rw-r--r--chapter11/src/test/java/com/seaofnodes/simple/Chapter07Test.java48
-rw-r--r--chapter11/src/test/java/com/seaofnodes/simple/Chapter08Test.java24
-rw-r--r--chapter11/src/test/java/com/seaofnodes/simple/Chapter09Test.java33
-rw-r--r--chapter11/src/test/java/com/seaofnodes/simple/Chapter10Test.java30
-rw-r--r--chapter11/src/test/java/com/seaofnodes/simple/Chapter10bTest.java64
-rw-r--r--chapter11/src/test/java/com/seaofnodes/simple/Chapter11Test.java613
-rw-r--r--chapter11/src/test/java/com/seaofnodes/simple/FuzzerWrap.java2
-rw-r--r--chapter11/src/test/java/com/seaofnodes/simple/evaluator/Evaluator.java3
-rw-r--r--chapter11/src/test/java/com/seaofnodes/simple/evaluator/Scheduler.java14
93 files changed, 3477 insertions, 3668 deletions
diff --git a/chapter11/Makefile b/chapter11/Makefile
index 3f1e53ff..5ed21084 100644
--- a/chapter11/Makefile
+++ b/chapter11/Makefile
@@ -1,106 +1,7 @@
-SHELL := /bin/bash
-# Shared packaging target; included after chapter source variables below.
-.DELETE_ON_ERROR:
+# Standalone compiler snapshot; shared rules also work in linearized checkouts.
+include $(firstword $(wildcard ../build-support/early-chapter.mk build-support/early-chapter.mk))
+test_cp += com.seaofnodes.simple.FuzzerWrap
-# for printing variable values
-# usage: make print-VARIABLE
-# > VARIABLE = value_of_variable
-print-% : ; @echo $* = $($*)
-
-# literal space
-space := $() $()
-
-# Decide OS-specific questions
-# jar-file seperator
-ifeq ($(OS),Windows_NT)
- SEP = ;
-else
- SEP = :
-endif
-# Find a reasonable ctags.
-CTAGS = $(shell which ctags)
-# Hack for MacOS: /usr/bin/ctags is unfriendly, so look for ctags from brew
-ifeq ($(UNAME),Darwin)
- CTAGS = $(shell brew list ctags 2> /dev/null | grep bin/ctags)
-endif
-
-# Fun Args to javac. Mostly limit to java8 source definitions, and fairly
-# aggressive lint warnings.
-JAVAC_ARGS = -g
-
-# Source code
-SIMPLE := com/seaofnodes/simple
-SRC := src/main/java
-TST := src/test/java
-CLZDIR:= build/classes
-main_javas := $(wildcard $(SRC)/$(SIMPLE)/*java $(SRC)/$(SIMPLE)/*/*java)
-test_javas := $(wildcard $(TST)/$(SIMPLE)/*java $(TST)/$(SIMPLE)/*/*java)
-main_classes := $(patsubst $(SRC)/%java,$(CLZDIR)/main/%class,$(main_javas))
-include $(firstword $(wildcard ../graph/graph.mk graph/graph.mk))
-include $(firstword $(wildcard ../print/print.mk print/print.mk))
-test_classes := $(patsubst $(TST)/%java,$(CLZDIR)/test/%class,$(test_javas))
-test_cp := $(patsubst $(TST)/$(SIMPLE)/%.java,com.seaofnodes.simple.%,$(wildcard $(TST)/$(SIMPLE)/*Test.java))
-classes = $(main_classes) $(test_classes)
-# All the libraries
-libs = $(wildcard lib/*jar)
-jars = $(subst $(space),$(SEP),$(libs))
-
-
-default_targets := $(main_classes) $(test_classes)
-# Optionally add ctags to the default target if a reasonable one was found.
-ifneq ($(CTAGS),)
-default_targets += tags
-endif
-
-default: $(default_targets)
-
-# Compile just the out-of-date files
-$(main_classes): build/classes/main/%class: $(SRC)/%java $(graph_javas) $(print_javas)
- @echo "compiling " $@ " because " $?
- @[ -d $(CLZDIR)/main ] || mkdir -p $(CLZDIR)/main
- @javac $(JAVAC_ARGS) -cp "$(CLZDIR)/main$(SEP)$(jars)" -sourcepath $(SRC) -d $(CLZDIR)/main $(main_javas)
-
-$(test_classes): $(CLZDIR)/test/%class: $(TST)/%java $(main_classes)
- @echo "compiling " $@ " because " $?
- @[ -d $(CLZDIR)/test ] || mkdir -p $(CLZDIR)/test
- @javac $(JAVAC_ARGS) -cp "$(CLZDIR)/test$(SEP)$(CLZDIR)/main$(SEP)$(jars)" -sourcepath $(TST) -d $(CLZDIR)/test $(test_javas)
-
-# Base launch line for JVM tests
-JVM=nice java -ea -cp "build/classes/main${SEP}${jars}${SEP}$(CLZDIR)/test"
-
-tests: $(default_targets)
- @echo "testing " $(test_cp)
- @$(JVM) org.junit.runner.JUnitCore $(test_cp) com.seaofnodes.simple.FuzzerWrap
-
-fuzzer: $(default_targets)
- @echo "fuzzing " $(test_cp)
- @$(JVM) org.junit.runner.JUnitCore com.seaofnodes.simple.FuzzerWrap
-
-
-.PHONY: clean
-clean:
- rm -rf build
- rm -f TAGS
- (find . -name "*~" -exec rm {} \; 2>/dev/null; exit 0)
-
-# Download libs from maven
-lib: lib/junit-4.12.jar lib/hamcrest-core-1.3.jar
-
-# Jars
-lib/junit-4.12.jar:
- @[ -d lib ] || mkdir -p lib
- @(cd lib; wget https://repo1.maven.org/maven2/junit/junit/4.12/junit-4.12.jar)
-
-lib/hamcrest-core-1.3.jar:
- @[ -d lib ] || mkdir -p lib
- @(cd lib; wget https://repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar)
-
-# Build emacs tags (part of a tasty emacs ide experience)
-tags: $(main_javas) $(test_javas)
- @rm -f TAGS
- @$(CTAGS) -e --recurse=yes --extra=+q --fields=+fksaiS $(SRC) $(TST)
-
-include $(firstword $(wildcard ../build-support/chapter-release.mk build-support/chapter-release.mk))
-
-.PHONY: build
-build: $(main_classes)
+.PHONY: fuzzer
+fuzzer: $(test_classes)
+ java -ea -cp "$(CLZDIR)/main$(SEP)$(CLZDIR)/test$(SEP)$(jars)" org.junit.runner.JUnitCore com.seaofnodes.simple.FuzzerWrap
diff --git a/chapter11/README.md b/chapter11/README.md
index cd44f811..d3e8c7e1 100644
--- a/chapter11/README.md
+++ b/chapter11/README.md
@@ -1,366 +1,268 @@
-# Chapter 11: Global Code Motion
+# Chapter 11: Splitting Memory
-[Previous: Chapter 10b](../chapter10b/README.md) |
+[Previous: Chapter 10](../chapter10/README.md) |
[Next: Chapter 12](../chapter12/README.md)
-This chapter schedules the programs from [10b](../chapter10b/README.md),
-picking a slot#0 CFG input for all nodes lacking one.
+Chapter 10 made memory effects explicit with one SSA memory value. This
+chapter keeps exactly that parser model and recovers independent memory chains
+through graph rewrites. There is no new language syntax; the
+[grammar](docs/10-grammar.md), pointer types, and null checks are unchanged.
-Also in this chapter, we'll be presenting several fairly detailed graph
-algorithms. You might want to brush up on your graph theory!
-
-# Table of Contents
-
-1. [High Level Overview](#high-level-overview)
-2. [Scheduling Walk Through](#scheduling-walk-through)
-3. [Scheduling a Loop](#scheduling-a-loop)
-4. [Components of the Global Code Motion Algorithm](#components-of-the-global-code-motion-algorithm)
-5. [Identification of Basic Blocks in SoN graph](#identification-of-basic-blocks-in-son-graph)
-6. [Handling Infinite Loops](#handling-infinite-loops)
-7. [Dominators](#dominators)
-8. [Loop depth](#loop-depth)
-9. [Early Schedule](#early-schedule)
-10. [Late Schedule](#late-schedule)
-11. [Inserting Anti Dependencies](#inserting-anti-dependencies)
-12. [Video Walk Through](#video-walk-through)
-
-You can also read [this chapter](https://github.com/SeaOfNodes/Simple/tree/linear-chapter11) in a linear Git revision history on the [linear](https://github.com/SeaOfNodes/Simple/tree/linear) branch and [compare](https://github.com/SeaOfNodes/Simple/compare/linear-chapter10b...linear-chapter11) it to the previous chapter.
+## Why split memory?
+```java
+struct Point { int x; int y; }
+Point p = new Point;
+p.x = 42;
+while (arg > 0) {
+ p.y = p.y + arg;
+ arg = arg - 1;
+}
+return p.x;
+```
-The original input source program defines a sequence in which things happen. As
-we parse the program into Sea of Nodes representation and perform various
-optimizations, this sequence is not fully maintained. The optimized Sea of
-Nodes graph is driven by the dependencies between nodes rather than the
-sequence of instructions in the original source program.
+The loop changes `y`, so it cannot affect `x`. With one memory chain the load
+of `x` follows the loop's stores. Splitting the fields lets ordinary
+load-after-store forwarding turn the return value into 42.
-Our goal in this chapter is to look at how we can recover a schedule for executing instructions from an
-optimized Sea of Nodes graph. This schedule needs to preserve the semantics of the original source program,
-but is otherwise allowed to reorder the execution of instructions.
+![Independent field dependencies](docs/example1.svg)
-Since the scheduling algorithm works across the implicit Basic Blocks in the SoN Graph,
-we call this a Global Code Motion algorithm; the scheduler can move instructions across Basic Block boundaries.
+The graph shows the split chains before the final Load folds. Its memory input
+goes straight to the Store of 42, bypassing the loop's `y` chain. As in
+Chapter 10, small, detached True/False projections show the source branches
+gating Loads and Stores. Other control-flow context, including Loops and their
+Phi bindings, is omitted. The graph shows dependencies, not execution order.
-The primary reference for this algorithm is the GCM GVN paper [^1]. However, the implementation in Simple has some
-differences compared to the version described in the paper.
+## Equivalence-class aliasing
-Since this is a complex topic, we will present a high level summary first and then delve into the details.
+Each struct field has an integer alias identity. Two different fields receive
+different identities, even if they have the same spelling in different structs.
+Two instances of the *same* struct share their field aliases. Thus different
+classes never alias; accesses in the same class **may alias** (same-class does
+not mean same-address). You still need to check for pointer identity.
-## High Level Overview
+The parser assigns field identities at struct declarations, beginning at alias#2.
-The Sea of Nodes graph has two virtual graphs within it.
+We do not allocate a Start projection, scope binding, or loop Phi for every
+declared field or alias. Start supplies one memory value, Scope holds one
+`$mem` binding, and Return consumes all of memory: `{ctrl, $mem, result}`. As
+with Start's outputs, control is in slot 0 and memory in slot 1. The optimizer
+introduces slices only where graph operations require them.
-* There is a control flow graph, represented by certain node types, such as Start, If, Region, etc.
-* There is a data graph, primarily driven by Def-Use edges between nodes that produce or consume values or memory.
+## Three memory nodes
-From a scheduling point of view, the control flow graph is fixed, and immovable.
-However, the nodes that consume or produce data values/memory have some flexibility in terms of when they are executed. The goal of the
-scheduling algorithm is to find the best placement of these nodes so that they are both optimum and correct.
+| Node | Meaning |
+|---|---|
+| `MemMerge` | A complete memory state: a default plus precise alias overrides |
+| `MemPhi` | One alias selected according to the incoming control path |
+| `BulkMemPhi` | All aliases except an explicit exclusion set, selected by control |
-At its core, the scheduling algorithm works in two phases:
+`MemMerge` combines independent pieces of memory at one program point. It is
+not a control-flow merge. For example, after storing to alias `x`:
-* Schedule Early - in this phase, we do an upward DFS walk on the "inputs" of each Node, starting from the bottom (Stop). We schedule each data node to the
- first control block where they are dominated by their inputs.
-* Schedule Late - in this phase we work backwards from Stop, scheduling uses before definitions, and move data nodes to a block between the first block calculated above,
- and the last control block where they dominate all their uses. The placement is subject to the condition that it is in the shallowest loop nest possible, and is as control dependent as possible.
- Additionally, the placement of Load instructions must ensure correct ordering between Loads and Stores of the same memory location.
+```text
+prior = current memory
+store = Store_x(prior, pointer, value)
+current memory = MemMerge(default=prior, x=store)
+```
-## Scheduling Walk Through
+MemMerges have a default memory in slot 1, and precise aliases in other slots
+if they differ from the default. Loads, Stores and MemPhis select their
+precise input from any incoming MemMerge, using a precise alias input if
+possible.
-Before we describe the steps in detail, it is instructive to walk through an example and see the changes that occur to the SoN graph during scheduling.
+The explicit aliases override the default: the alias slices are disjoint,
+and their union covers all memory. Flattening stacked MemMerges preserves
+entries that the outer MemMerge has not replaced.
-To motivate the discussion, we will use this example program.
+The graph below shows `p.x = arg; p.y = 42; return p;` after redundant
+initialization stores have been removed. MemMerge takes the default memory
+in slot 1 and the `x` and `y` overrides in slots 2 and 3.
-```java
-struct S { int f; }
-S v=new S;
-v.f = 2;
-int i=new S.f;
-i=v.f;
-if (arg) v.f=1;
-return i;
-```
+![An aggregate preserves both updates](docs/example2a.svg)
-First let's look at the graph before scheduling.
-These walkthrough diagrams show the precise `S.f` chain and the final
-MemMerge consumed by Return. The unchanged default memory comes from Start;
-any redundant bulk Phis have folded away. As in 10a and 10b, the diagrams omit
-control-flow context, including Regions and their Phi bindings. Small,
-detached True/False projections remain where they gate a Load or Store.
-Unlike Chapter 10's schematic source gates, these figures show the actual
-scheduling inputs at each stage. Entry-block and Loop bindings are omitted.
+## Splitting a memory Phi
-![Graph1](./docs/graph1.svg)
+The Parser initially creates a BulkMemPhi wherever the ordinary SSA algorithm needs
+to merge memory. It starts by covering all aliases and an empty exclusion set
+while the merge point is finalized. Later, peeps will split out precise memory
+slices from the bulk memory, lazily on demand.
-Observe that
+Precise single aliases can be split out from the bulk by this transformation:
-* Control nodes are immovable. Most are omitted here.
-* New nodes already have control inputs, and Phis are bound to Regions;
- these bindings remain fixed even though they are not drawn.
-* The load `.f` and store `.f=` nodes are still "floating": they have no
- control input at this stage, so scheduling must choose their blocks.
+```text
+BulkPhi(R, left, right)
+ becomes
+MemMerge(
+ default = BulkPhi_except{x}(R, left, right),
+ x = MemPhi_x(R, slice(left,x), slice(right,x)))
+```
-Now, let's look at the graph after we run the early schedule.
+"A BulkPhi becomes a Merge of a BulkPhi (minus the alias) and MemPhi (of the alias)".
-![Graph2](./docs/graph2.svg)
+The new precise Phi and the remaining bulk Phi share a Region (omitted from the
+illustrations) and matching control-path indices. A loop uses the same
+transformation, with the backedge among those inputs. Each further split
+preserves all previously extracted slices (and peephole optimizations tidy up
+the stacked splits).
+Here the two branches store 3 or 4 into `p.x`, then return `p`. The graph shows
+the partition immediately after extracting `x`, before further simplification
+of the bulk Phi and its incoming aggregates.
-The early schedule puts the load `.f` and stores `.f=` in the first basic
-block, since their inputs are available there. These entry-block control
-bindings are omitted, so the memory view looks unchanged.
+```java
+struct Point { int x; int y; }
+Point p = new Point;
+if (arg) p.x = 3;
+else p.x = 4;
+return p;
+```
-The graph below focuses on memory and data dependencies after late scheduling.
-The control-flow scaffold, including the Region, is omitted. Store #22's
-control input remains visible as the red edge to the standalone True
-projection #8; the Store-to-Load anti-dependency and memory Phis are retained.
+![Precise and bulk Phis share a control merge](docs/example2b.svg)
-![Graph3](./docs/graph3.svg)
+Continuing from this graph, here is one order in which the peepholes can fire:
-The snip below shows the main changes in the graph:
+**Flatten the incoming MemMerges, then split `y`.** MemMerges #17 and #18
+inherit the `y` slice from #9, but their own `x` overrides win. Both now have
+Start's memory as their default, and #9 becomes unused. BulkMemPhi #21 excludes
+`x`, but still covers `y`, so it cannot simply bypass these MemMerges. It
+extracts MemPhi #24 for `y` and creates BulkMemPhi #25, excluding both fields.
+The extra MemMerge #26 combines these slices.
-![Store ordered after the earlier load](./docs/graph3-snip.svg)
+![After flattening the incoming aggregates and extracting y](docs/example2b-split-y.svg)
-* The store `.f=` now has an anti-dependency on the load `.f`; this ensures that the store is scheduled after the load, as required by program semantics. We discuss anti-dependencies in detail later.
-* Observe also that the store `.f=` is now bound to the True branch of the If node.
+**Fold the unchanged memory.** Both inputs of MemPhi #24 are the same
+initializing Store #8, so it becomes that Store. BulkMemPhi #25 can now look
+through #17 and #18: their explicit aliases are all excluded from its domain.
+Both remaining inputs become Start's memory, so this bulk Phi also folds.
+Flattening the outgoing aggregates leaves MemMerge #22 with default memory
+from Start, `x` from MemPhi #20, and `y` from Store #8.
-## Scheduling a Loop
+![Only the x memory Phi still needs the branch merge](docs/example2b-merged.svg)
-We show another example, this time involving a loop.
+**Factor the Stores, then remove the overwritten initialization.** With the
+bulk Phi and the incoming aggregates gone, Stores #14 and #16 are used only
+by MemPhi #20. They store to the same pointer and alias, and share the same
+incoming memory. `PhiNode` can pull the Store below the merge:
-```java
-struct S { int f; }
-S v = new S;
-int i = arg;
-while (arg > 0) {
- int j = i/3;
- if (arg == 5)
- v.f = j;
- arg = arg - 1;
-}
-return v;
+```text
+MemPhi_x(Store_x(mem, p, 3), Store_x(mem, p, 4))
+ becomes
+Store_x(mem, p, Phi(3, 4))
```
-The SoN graph prior to scheduling looks like this:
+In general, Phi refactoring can combine Loads or Stores as in Chapter 10 (pushing
+up or pulling down). The Phi new memory operands can use precise MemPhis for
+the alias. This peep requires precise aliases, and is otherwise blocked by
+BulkMems - and thus is a trigger for splitting a BulkMem.
-![Graph4](./docs/graph4.svg)
-Following early schedule generation, we get:
+Continuing with the example, the new value Phi #28 chooses 3 on the true arm
+and 4 on the false arm. Store
+#27 replaces both branch Stores and their memory Phi. Now the initial
+`p.x = 0` Store #7 has only that one Store as a user, so store-after-store
+elimination bypasses it. The `p.y = 0` Store #8 remains: we return the object,
+and its `y` field still needs initialization.
-![Graph5](./docs/graph5.svg)
+![Final graph: one x Store of a value Phi, and the y initialization](docs/example2b-final.svg)
-The early schedule places Store #31 at the loop header (its control binding
-is omitted). Late scheduling moves it to the True branch #15 of
-`if (arg == 5)`, shown by the red control edge:
+Thus the final graph has two Stores, one ordinary value Phi, and one MemMerge;
+neither a MemPhi nor a BulkMemPhi remains. Other worklists order can, for
+instance, bypass the original incoming MemMerges before flattening them,
+avoiding the temporary `y` split.
-![Graph6](./docs/graph6.svg)
+This memory splitting transform is invasive, and is disallowed from being
+called recursively; you can end up splitting around a loop (which is good) but
+then trying to split a mid-split loop head (which is bad). The new nodes from
+the split are put on the worklist and visited after the current split
+completes - safely allowing memory to be completely sliced around loops.
-The final execution schedule shows that the expression `i/3` can be performed outside the loop because it only depends on the
-original value of `arg`, and hence is loop invariant.
+Since bulk Phis merge a bunch of aliases, they have to take care when
+peepholing vs MemMerges: there cannot be any overlap between the MemMerge
+precise merges and the bulk Phi.
-## Components of the Global Code Motion Algorithm
+This also extends the worklist lesson from Chapter 9: a bulk Phi inspects its
+users, so changes to a user's partition must wake the producer - job for
+`addDep()`. Selecting a slice from a MemMerge can expose a new bulk-Phi
+user; that selected definition must be queued too. In short, any time we're
+working with MemMerge, MemPhi or BulkMemPhi we can expect some non-local
+dependencies.
-We have already alluded to several components of the GCM algorithm in passing above. Here we list them out as well as others we did not mention:
+Memory splitting can increase node count - but Phis (Mem, Bulk or otherwise)
+make no code. Progress comes from extracting an alias from a bulk Phi and
+removing some Loads and Stores, rather than from requiring every rewrite
+to shrink the graph. In other words, the total Load/Store count is going down
+even if the MemPhi count is going up.
-* The SoN graph has implicit basic blocks in the control flow nodes. For the GCM algo, we need to recognize these nodes more explicitly.
-* When a program has an infinite loop, it poses a problem for the algo, as nodes can be unreachable from the Stop node. To work around this issue, we need to discover
- infinite loops and create a dummy edge connecting the loop to the Stop node.
-* Loops are already identified in the Simple SoN graph, so we do not need a loop discovery step. However, we need to compute the loop depth associated with each CFG node.
-* In [Chapter 6](../chapter06/README.md) we explained the concept of Dominators. Dominators are key to the GCM algo, and we extend our incremental dominator discovery algo to
- ensure that it meets the requirements of the algo.
-* We already mentioned the two phases of the algo - the Early Scheduling and the Late Scheduling.
-* In addition, we need to add anti-dependency edges between Loads and Stores in certain scenarios to enforce correct execution order.
-* There are a few changes to our Node hierarchy to help us implement the GCM algo more conveniently. These changes do not conceptually alter the Node hierarchy we inherited from the previous chapters.
-## Identification of Basic Blocks in SoN graph
+## Types
-The Sea of Nodes graph already captures the program's control flow graph. This information is implicit in the control nodes and edges from control nodes to other types of nodes.
+The type lattice retains Chapter 10's six domains, colors, and notation:
+`⊤` means top, `⊥` means bottom, and a suffix names the domain. The other five
+domains are unchanged; however memory now adds a flat element `MEM#N` for each precise
+alias between memory top (`TypeMem.TOP`) and memory bottom (`TypeMem.BOT`).
-To recap, Control starts at the Start node, via a projection that is bound to the name `$ctrl`. As the control flows in the program, this name binding gets updated, and control is
-passed around, until it reaches the Stop node.
+![The type domains, including precise memory aliases](docs/lattice.svg)
-The Basic Block structure of the CFG can be easily constructed by recognizing that certain control nodes start a Basic Block, whereas certain others end a BB.
+The parallel `MEM#2`, `MEM#3`, and further alias elements describe independent
+field slices. For the first `Point` declaration above, these two aliases identify
+`Point.x` and `Point.y`. Meeting different aliases gives memory bottom; joining
+them gives memory top. Each precise alias is its own dual. (And the ellipsis stands
+for more parallel aliases, not a type representing a set of aliases).
-Here is the list of all control nodes:
-| Node | Starts a BB | Ends a BB |
-|--------|-----------------------------------------|-----------|
-| Start | Yes but only via the `$ctrl` projection | No |
-| CProj | Yes if input control is an If node | No |
-| Region | Yes | No |
-| If | No | Yes |
-| Return | No | Yes |
-| Stop | Yes | Yes |
+## Evaluation and ordering
-Changes to Node hierarchy in this chapter:
+MemMerge is a dependency node and not a clobber; it emits no code. Its
+evaluator result is a memory token, while Store actually mutates the object's
+fields. The scheduler must distinguish merging memory from overwriting memory.
+Stores in different alias classes do not impose load/store anti-dependencies,
+but Loads in the same class require anti-dependencies.
-* All control nodes above now extend a base class CFG Node. This allows us to place common functionality of control flow nodes in the base class.
-* The CProj node extends the regular Proj node and is used in following cases:
- * The `$ctrl` projection off Start
- * The True and False projections off If.
-* The Never node is a special sub class of If that is used to handle infinite loops as explained later.
-* The XCtrl node represents a dead control.
+In `int old = p.x; p.x = arg; p.y = arg; return old;`, the Load must precede
+the later `x` Store; the `y` Store has an independent memory chain. The graph
+retains the Load to show this scheduling requirement before local folding.
-## Handling Infinite Loops
+![Ordering applies within the affected alias](docs/example2c.svg)
-Here is an example of code that contains an infinite loop:
+There are a lot of tests in this chapter, to cover independent-field folding,
+parallel memory Phis, multiple field updates surviving at Return, early
+returns, nested loops with break/continue, and reads before subsequent stores
+through potentially aliased pointers.
-```java
-while (1) {}
-return 0;
-```
+## What remains for later chapters?
-First let's look at the graph resulting from this:
+Chapter 11 knows every access's alias while parsing. What is lazy here is the
+construction of memory partitions. Chapter 25 also allows an existing access's
+alias to become known *later* (using the same representation) and will allow
+more incomplete types, module aliases, seperate compilation and a host of other
+benefits.
-![Graph7](./docs/graph7.svg)
+Chapters 12-24 use this representation. Chapter 13 adds global code motion
+and load/store anti-dependencies. Chapter 15 adds allocation with partial memory and typed
+alias contents. Chapter 16 extends initialization to constructor values, and
+Chapter 18 carries whole memory across function calls.
-Now, look at the modified graph after we insert an edge from the infinite loop to Stop node.
+## Build and test
-![Graph8](./docs/graph8.svg)
+With JDK 21 or newer, from this directory:
-The implementation is in
-[`LoopNode.forceExit()`](src/main/java/com/seaofnodes/simple/node/LoopNode.java#L57).
-It walks the backedge's dominator chain to look for an exit. If none exists,
-it inserts a Never node and a never-taken return path, making the loop
-reachable to the scheduler's backward walk.
+```sh
+make lib
+make tests
+make release
+make view
+```
-## Dominators
+Make builds this complete snapshot without Maven. `make release` writes
+`build/release/simple.jar`; `make view` launches the shared graph viewer.
+Both the root Maven reactor and the supplied IDEA module descriptor include
+the chapter. From the repository root, test both halves with:
-In Simple, we compute Dominators incrementally. Our approach relies on the fact that we may delete parts of the graph during peepholes,
-but we never introduce new control structure via peepholes. This allows us to use a simple approach described below.
-
-The CFG node is the base class for all control nodes. It maintains a conservative approximation of dominator depth via `_idepth`. This field is a cached value representing
-the immediate dominator depth. Its initial value is `0`, which signifies that it has not yet been computed. The depth is computed on request.
+```sh
+make tests CHAPTERS="chapter10 chapter11"
+```
-See [`CFGNode.idepth()`](src/main/java/com/seaofnodes/simple/node/CFGNode.java#L51)
-for the default computation and cache. The overrides in
-[`RegionNode`](src/main/java/com/seaofnodes/simple/node/RegionNode.java#L94),
-[`LoopNode`](src/main/java/com/seaofnodes/simple/node/LoopNode.java#L31),
-[`StartNode`](src/main/java/com/seaofnodes/simple/node/StartNode.java#L36), and
-[`StopNode`](src/main/java/com/seaofnodes/simple/node/StopNode.java#L57)
-handle merges, loop entries, and the graph's endpoints.
-
-If portions of the control flow graph are deleted, then there will be gaps in the `_idepth`, but it still correctly reflects the
-invariant that the value of `_idepth` increases as we go down the dominator tree.
-
-Alongside the dominator depth, which is cached on first compute, a method is provided to get the immediate Dominator node. This
-value is not cached as it is only valid at a point in time, and is invalidated as the graph changes.
-
-[`CFGNode.idom()` and `domLCA()`](src/main/java/com/seaofnodes/simple/node/CFGNode.java#L60)
-provide the default immediate dominator and the walk that finds the least
-common ancestor of two dominators.
-[`RegionNode.idom()`](src/main/java/com/seaofnodes/simple/node/RegionNode.java#L103)
-combines the incoming paths; [`LoopNode.idom()`](src/main/java/com/seaofnodes/simple/node/LoopNode.java#L33)
-uses the loop entry. Start and Stop have no immediate dominator.
-
-## Loop Depth
-
-Simple's Sea of Nodes graph identifies loops explicitly via Loop nodes. Since the language provides a single way to create a loop, using the `while` statement,
-it is not necessary to implement a generic loop discovery process.
-
-We do however need to compute a loop depth. This is done similarly to how we compute the dominator depth.
-
-[`CFGNode.loopDepth()`](src/main/java/com/seaofnodes/simple/node/CFGNode.java#L77)
-inherits depth from its control input, while
-[`RegionNode.loopDepth()`](src/main/java/com/seaofnodes/simple/node/RegionNode.java#L116)
-uses an incoming path.
-[`LoopNode.loopDepth()`](src/main/java/com/seaofnodes/simple/node/LoopNode.java#L35)
-adds a nesting level and walks the backedge's dominator chain to mark loop exits.
-[`StartNode`](src/main/java/com/seaofnodes/simple/node/StartNode.java#L41) and
-[`StopNode`](src/main/java/com/seaofnodes/simple/node/StopNode.java#L67)
-establish the outermost depth of 1.
-
-## Early Schedule
-
-The GCM algorithm proper starts with the computation of the early schedule, during which we do an upward DFS walk on the "inputs" of each Node, starting from the bottom (Stop). We schedule each data node to the
-first control block where they are dominated by their inputs.
-
-A pre-condition of this is to ensure that infinite loops have been fixed as described earlier.
-
-The implementation starts in
-[`GlobalCodeMotion.schedEarly()`](src/main/java/com/seaofnodes/simple/GlobalCodeMotion.java#L59).
-[`_rpo_cfg()`](src/main/java/com/seaofnodes/simple/GlobalCodeMotion.java#L82)
-builds the CFG traversal order, and
-[`_schedEarly()`](src/main/java/com/seaofnodes/simple/GlobalCodeMotion.java#L91)
-recursively schedules data inputs. It skips recursion through Phi inputs to
-avoid entering a data cycle before its control has been scheduled.
-
-Existing control and Phi/Proj bindings are preserved. Floating nodes receive
-the deepest input block as their earliest placement. MemMerge follows this
-same rule, ignoring absent entries in its sparse alias table.
-
-## Late Schedule
-
-Late scheduling starts at Stop and uses a worklist to place uses before their
-definitions. CFG nodes, Phis, projections, and allocations provide fixed
-placements. Other nodes wait until their uses have been scheduled; a Load also
-waits for memory users that can overwrite or merge its alias. The chosen block
-lies between the early placement and the common dominator of all uses, favoring
-shallower loops and then deeper control flow.
-
-The implementation is divided into these steps:
-
-* [`schedLate()`](src/main/java/com/seaofnodes/simple/GlobalCodeMotion.java#L111)
- manages the placement tables and installs the final control inputs;
- [`breadth()`](src/main/java/com/seaofnodes/simple/GlobalCodeMotion.java#L126)
- drives the worklist and wakes definitions and waiting loads as uses finish.
-* [`_doSchedLate()`](src/main/java/com/seaofnodes/simple/GlobalCodeMotion.java#L172)
- finds the common dominator of uses, accounts for load anti-dependencies, and
- walks toward the early placement. It calls
- [`better()`](src/main/java/com/seaofnodes/simple/GlobalCodeMotion.java#L213)
- to compare candidate blocks.
-* [`use_block()`](src/main/java/com/seaofnodes/simple/GlobalCodeMotion.java#L200)
- handles Phi uses at their matching incoming control paths, rather than at
- the merge itself.
-
-## Inserting Anti Dependencies
-
-To ensure that Loads and Stores to the same memory location are correctly
-ordered, we insert an edge from the Store to the Load as described below: the
-Store must wait for the earlier Load. We call these edges anti-dependencies
-because they do not represent the Def-Use dependency that we normally capture
-in SoN, and are purely present as scheduling constraints.
-
-We compute anti-dependencies DURING running schedule late. This is because we rely on the early-schedule, and the late-schedule of the Load's uses (before scheduling the Load).
-
-Looking backwards from the Load, we follow its memory input to Start's memory
-projection, a memory Phi, or a Store. Optimization has already selected the
-Load's precise slice through any MemMerge. We inspect users of that memory
-definition, keeping only Stores and memory Phis that cover the Load's alias.
-Start's single memory projection may supply many aliases, so sharing a memory
-input alone does not imply an anti-dependency.
-
-MemMerge only packages slices; it does not overwrite any of them. Treating it
-as a write could make a Load wait for an aggregate which itself depends on the
-Load's result. The same alias filter is used both when deciding whether a Load
-is ready to schedule and when computing its anti-dependencies. A completed
-memory user wakes waiting loads even if their shared memory definition has
-already been scheduled.
-
-Since we're in the middle of `schedLate`, we have already computed all the late
-schedules of a Load's users, and we have the Loads *Least Common Ancestor* of
-uses, the LCA or late position. We inspect the set of mem-defs that might
-impact the Load, and either add an anti-dependency from Store to Load, or raise
-the Loads effective LCA. For Phi mem-defs, we look at the Phi inputs and place
-an effective use on that block; this will be used to raise the Load's LCA. For
-stores, we do the same - until/unless we find stores with the SAME block as the
-Load's LCA. Then we add the anti-dependency edge to force ordering within the
-same block.
-
-See [`antiUse()`](src/main/java/com/seaofnodes/simple/GlobalCodeMotion.java#L222)
-for the alias filter, and
-[`find_anti_dep()`](src/main/java/com/seaofnodes/simple/GlobalCodeMotion.java#L231)
-for marking the Load's candidate blocks and inspecting competing memory users.
-[`anti_dep()`](src/main/java/com/seaofnodes/simple/GlobalCodeMotion.java#L257)
-walks the competing operation's dominator interval, raises the Load's LCA,
-and adds a Store-to-Load edge when required. It checks the Store's full interval
-because the evaluator's scheduler may place that Store independently of GCM.
-
-## Video Walk Through
-
-Please watch the following video for a detailed walk through of the implementation.
-
-* [Coffee Compiler Club - 21 June 2024](https://youtu.be/5Po0gxfE7LA?feature=shared).
-* [Coffee Compiler Club - 26 June 2024](https://www.youtube.com/watch?v=HnN2YzmFb-8&t=0s)
-
-[^1]: Cliff Click. (1995).
- Global Code Motion Global Value Numbering.
+Next, [Chapter 12](../chapter12/README.md) adds reference fields and recursive
+structs while retaining this memory representation.
diff --git a/chapter11/chapter11.iml b/chapter11/chapter11.iml
new file mode 100644
index 00000000..92b9e5ca
--- /dev/null
+++ b/chapter11/chapter11.iml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" inherit-compiler-output="false">
+ <output url="file://$MODULE_DIR$/../build/idea/production/chapter11" />
+ <output-test url="file://$MODULE_DIR$/../build/idea/test/chapter11" />
+ <exclude-output />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
+ <excludeFolder url="file://$MODULE_DIR$/build" />
+ <excludeFolder url="file://$MODULE_DIR$/target" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="module" module-name="graph" />
+ <orderEntry type="module" module-name="print" />
+ <orderEntry type="module-library" scope="TEST">
+ <library name="JUnit4">
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/junit-4.12.jar!/" />
+ <root url="jar://$MODULE_DIR$/lib/hamcrest-core-1.3.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ </component>
+</module>
diff --git a/chapter11/docs/11-grammar.md b/chapter11/docs/10-grammar.md
index 5a3f3778..5a3f3778 100644
--- a/chapter11/docs/11-grammar.md
+++ b/chapter11/docs/10-grammar.md
diff --git a/chapter11/docs/example1.gv b/chapter11/docs/example1.gv
new file mode 100644
index 00000000..5e059d77
--- /dev/null
+++ b/chapter11/docs/example1.gv
@@ -0,0 +1,20 @@
+digraph Memory {
+ // IR styles match graph/web/render.js; arrows are use -> definition.
+ graph [bgcolor="#fafbfc" fontname="Helvetica" nodesep=0.35 ranksep=0.55 splines=ortho];
+ node [fontname="Helvetica" fontsize=12 color="#758191" fontcolor="#152330" shape=box style="rounded,filled" fillcolor="#edf3f7"];
+ edge [fontname="Helvetica" fontsize=9 color="#536477" fontcolor="#364352" arrowsize=0.7 penwidth=1.5];
+
+ rankdir=BT;
+
+ M [label="Initial memory" shape=octagon style="filled" fillcolor="#dcecff"];
+ X [label="Store x = 42" shape=octagon style="filled" fillcolor="#dcecff"];
+ Y [label="Loop: Store y" shape=octagon style="filled" fillcolor="#dcecff"];
+ L [label="Load x (42)" shape=box style="rounded,filled" fillcolor="#edf3f7"];
+ L -> X -> M [color="#2867b2"]; Y -> M [color="#2867b2"];
+ MemMerge -> X [color="#2867b2"]; MemMerge -> Y [color="#2867b2"];
+ Return -> MemMerge [color="#2867b2"]; Return -> L;
+ { rank=same; MemMerge -> L [style=invis]; }
+ Y -> X [style=invis]; // Layout only: keep the stores in code order.
+ Return [shape=box style="filled" fillcolor="#fff1c4"];
+ MemMerge [shape=octagon style="filled" fillcolor="#dcecff"];
+}
diff --git a/chapter11/docs/example1.json b/chapter11/docs/example1.json
new file mode 100644
index 00000000..c0c28450
--- /dev/null
+++ b/chapter11/docs/example1.json
@@ -0,0 +1,31 @@
+{
+ "ver": 1,
+ "comp": "chapter11/docs/example1.svg",
+ "step": 1,
+ "roots": [24],
+ "scope": 0,
+ "nodes": [
+ {"id": 1, "label": "Start", "type": null, "kind": "CTRL", "edges": [], "proj": null},
+ {"id": 3, "label": "$mem", "type": null, "kind": "MEM", "edges": [{"idx": 0, "def": 1, "role": "MEM", "label": null}], "proj": {"par": 1, "idx": 1}},
+ {"id": 4, "label": "arg", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 1, "role": "DATA", "label": null}], "proj": {"par": 1, "idx": 2}},
+ {"id": 5, "label": "new Point", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}], "proj": null},
+ {"id": 6, "label": "#0", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 1, "role": "ASSOC", "label": null}], "proj": null},
+ {"id": 7, "label": "#42", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 1, "role": "ASSOC", "label": null}], "proj": null},
+ {"id": 8, "label": "Store p.x", "type": "MEM#2", "kind": "MEM", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 3, "role": "MEM", "label": null}, {"idx": 2, "def": 5, "role": "DATA", "label": null}, {"idx": 3, "def": 7, "role": "DATA", "label": null}], "proj": null},
+ {"id": 9, "label": "Store p.y", "type": "MEM#3", "kind": "MEM", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 3, "role": "MEM", "label": null}, {"idx": 2, "def": 5, "role": "DATA", "label": null}, {"idx": 3, "def": 6, "role": "DATA", "label": null}], "proj": null},
+ {"id": 11, "label": "MemPhi y", "type": "MEM#3", "kind": "PHI", "edges": [{"idx": 0, "def": 0, "role": "ASSOC", "label": null}, {"idx": 1, "def": 9, "role": "MEM", "label": null}, {"idx": 2, "def": 19, "role": "MEM", "label": null}], "proj": null},
+ {"id": 12, "label": "Phi arg", "type": null, "kind": "PHI", "edges": [{"idx": 0, "def": 0, "role": "ASSOC", "label": null}, {"idx": 1, "def": 4, "role": "DATA", "label": null}, {"idx": 2, "def": 21, "role": "DATA", "label": null}], "proj": null},
+ {"id": 15, "label": "True", "type": null, "kind": "CTRL", "edges": [], "proj": {"par": 0, "idx": 0}},
+ {"id": 16, "label": "False", "type": null, "kind": "CTRL", "edges": [], "proj": {"par": 0, "idx": 1}},
+ {"id": 17, "label": "Load p.y", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 15, "role": "CTRL", "label": null}, {"idx": 1, "def": 11, "role": "MEM", "label": null}, {"idx": 2, "def": 5, "role": "DATA", "label": null}, {"idx": 3, "def": 0, "role": "DATA", "label": null}], "proj": null},
+ {"id": 18, "label": "+", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 17, "role": "DATA", "label": null}, {"idx": 2, "def": 12, "role": "DATA", "label": null}], "proj": null},
+ {"id": 19, "label": "Store p.y", "type": "MEM#3", "kind": "MEM", "edges": [{"idx": 0, "def": 15, "role": "CTRL", "label": null}, {"idx": 1, "def": 11, "role": "MEM", "label": null}, {"idx": 2, "def": 5, "role": "DATA", "label": null}, {"idx": 3, "def": 18, "role": "DATA", "label": null}], "proj": null},
+ {"id": 20, "label": "#1", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 1, "role": "ASSOC", "label": null}], "proj": null},
+ {"id": 21, "label": "-", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 12, "role": "DATA", "label": null}, {"idx": 2, "def": 20, "role": "DATA", "label": null}], "proj": null},
+ {"id": 22, "label": "MemMerge", "type": null, "kind": "MEM", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 3, "role": "MEM", "label": null}, {"idx": 2, "def": 8, "role": "MEM", "label": null}, {"idx": 3, "def": 11, "role": "MEM", "label": null}], "proj": null},
+ {"id": 23, "label": "Load p.x", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 16, "role": "CTRL", "label": null}, {"idx": 1, "def": 8, "role": "MEM", "label": null}, {"idx": 2, "def": 5, "role": "DATA", "label": null}, {"idx": 3, "def": 0, "role": "DATA", "label": null}], "proj": null},
+ {"id": 24, "label": "Return", "type": null, "kind": "CTRL", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 22, "role": "MEM", "label": null}, {"idx": 2, "def": 23, "role": "DATA", "label": null}], "proj": null}
+ ],
+ "groups": [
+ ]
+}
diff --git a/chapter11/docs/example1.svg b/chapter11/docs/example1.svg
new file mode 100644
index 00000000..46faf818
--- /dev/null
+++ b/chapter11/docs/example1.svg
@@ -0,0 +1,155 @@
+<svg aria-label="Compiler graph" width="929" height="674" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 929 674" style="font-family: sans-serif;"><style>
+ html, body { height:100%; margin:0; font-family:sans-serif; }
+ .viewer { height:100%; display:grid; grid-template-rows:auto minmax(0,1fr) auto; }
+ .source { padding:8px; border-bottom:1px solid #ccc; }
+ #program { width:min(600px,80vw); vertical-align:middle; }
+ #status { margin-top:4px; }
+ #graph { min-height:0; overflow:hidden; position:relative; background:#fafbfc; }
+ #elk { width:100%; height:100%; }
+ #graph svg { display:block; }
+ .tools { display:flex; flex-wrap:wrap; align-items:center; gap:14px; margin-top:8px; font-size:12px; }
+ .hint { color:#616c78; }
+ .ctrl { color:#b63838; } .mem { color:#2867b2; } .data { color:#536477; }
+ .edge { fill:none; stroke-width:1.5; }
+ .edge.CTRL { stroke-width:2; }
+ .edge.ASSOC { stroke-dasharray:4 4; }
+ .edge.PARSER { stroke-dasharray:5 4; }
+ .parser rect { fill:#f6f0ff; stroke:#7956a5; stroke-width:1.5; stroke-dasharray:5 4; }
+ .edge.selected { stroke-width:3.5; }
+ .edge.bundle { stroke-width:4; }
+ .edge.bundle.selected { stroke-width:6; }
+ .edge-hit { fill:none; stroke:transparent; stroke-width:12; vector-effect:non-scaling-stroke; pointer-events:stroke; cursor:pointer; }
+ .edge-jump { fill:transparent; pointer-events:all; cursor:pointer; }
+ .node { cursor:pointer; }
+ .box { stroke:#758191; stroke-width:1; }
+ .node.held .box { stroke-dasharray:5 3; }
+ .node.near .box { stroke:#c18221; stroke-width:2; }
+ .node.focus .box { stroke:#9c4900; stroke-width:3; }
+ .node.selected .box { stroke:#1569b9; stroke-width:3; }
+ .node.folded .box { stroke-width:4; }
+ .node.folding .box { fill:#f4ccd7; }
+ .fold-tag { font-size:9px; font-weight:700; fill:#963751; }
+ .peep-area { fill:#fff3d9; fill-opacity:.8; stroke:#c18221; stroke-width:2; pointer-events:none; }
+ .node.peep-edit .box { stroke:#9c4900; stroke-width:3; }
+ .node.error .box { stroke:#b42318; stroke-width:4; }
+ #event.error { color:#b42318; font-weight:600; white-space:pre-wrap; overflow-wrap:anywhere; }
+ .peep-ghosts { pointer-events:none; }
+ .region-box { stroke:#9da9b8; stroke-width:1.5; }
+ .fold-btn { cursor:pointer; }
+ .fold-btn rect { fill:white; stroke:#596674; }
+ .fold-btn text { font-size:14px; fill:#152330; }
+ .fold-btn:focus rect { stroke:#1569b9; stroke-width:2; }
+ .shortcut { cursor:pointer; }
+ .shortcut path { fill:none; stroke-width:1.5; }
+ .shortcut rect { fill:#fff8ec; stroke:#b63838; stroke-dasharray:3 2; }
+ .shortcut text { font-size:11px; fill:#783030; }
+ .shortcut.selected rect, .shortcut:focus rect { stroke-width:2.5; }
+ .label { font-size:12px; fill:#152330; font-weight:600; }
+ .node-id { font-size:10px; fill:#596674; font-weight:400; }
+ .type { font-size:11px; fill:#455768; }
+ .port { stroke:#536477; stroke-width:1; }
+ .row { stroke:#b6afcf; stroke-width:1; }
+ .bind { font-size:12px; fill:#152330; }
+ .slot { font-size:10px; fill:#364352; paint-order:stroke; stroke:#fafbfc; stroke-width:3; }
+ #detail { position:absolute; top:8px; right:8px; margin:0; padding:12px; max-width:320px;
+ max-height:45%; overflow:auto; white-space:pre-wrap; overflow-wrap:anywhere;
+ background:#fffffff2; border:1px solid #bac5d0; border-radius:4px; font-size:12px; }
+ .controls { display:flex; flex-wrap:wrap; justify-content:center; align-items:center; gap:6px; padding:6px; }
+ .button { color:white; background:black; font-size:20px; min-width:30px; }
+ .button:disabled { background:grey; }
+ .count { font-size:20px; min-width:35px; text-align:center; }
+ #N { width:6ch; }
+ #scrub { width:clamp(120px,35vw,600px); }
+ </style><defs><marker id="arrow-CTRL" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#b63838"/></marker><marker id="arrow-DATA" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#536477"/></marker><marker id="arrow-MEM" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#2867b2"/></marker><marker id="arrow-ASSOC" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#9396a3"/></marker><marker id="arrow-PARSER" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#7956a5"/></marker></defs><rect width="100%" height="100%" fill="rgb(250, 251, 252)"/><g><g class="regions" style="opacity: 1;"/><rect class="peep-area" rx="36" style="opacity: 0;"/><g class="edges"><path class="edge ASSOC" id="e6i0" d="M435,46 C435,70 682,41 682,65" stroke="#9396a3" marker-start="url(#arrow-ASSOC)" style="opacity: 1;"><title>#6[0] → #1 · ASSOC</title></path><path class="edge ASSOC" id="e7i0" d="M435,46 C435,70 100,41 100,65" stroke="#9396a3" marker-start="url(#arrow-ASSOC)" style="opacity: 1;"><title>#7[0] → #1 · ASSOC</title></path><path class="edge MEM" id="e8i1" d="M252,118 L252,168" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#8[1] → #3 · MEM</title></path><path class="edge DATA" id="e8i2" d="M530,118 L530,140 Q530,148 522,148 L284,148 Q276,148 276,156 L276,168" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#8[2] → #5 · DATA</title></path><path class="edge DATA" id="e8i3" d="M100,118 L100,150 Q100,158 108,158 L295,158 Q300,158 300,163 L300,168" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#8[3] → #7 · DATA</title></path><path class="edge MEM" id="e9i1" d="M252,118 L252,130 Q252,138 260,138 L385,138 Q393,138 393,146 L393,168" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#9[1] → #3 · MEM</title></path><path class="edge DATA" id="e9i2" d="M530,118 L530,140 Q530,148 522,148 L425,148 Q417,148 417,156 L417,168" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#9[2] → #5 · DATA</title></path><path class="edge DATA" id="e9i3" d="M682,118 L682,150 Q682,158 674,158 L446,158 Q441,158 441,163 L441,168" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#9[3] → #6 · DATA</title></path><path class="edge MEM" id="e11i1" d="M405,224 L405,272" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#11[1] → #9 · MEM</title></path><path class="edge MEM" id="e11i2" d="M777,640 L777,645 Q777,650 772,650 L32,650 Q24,650 24,642 L24,242 Q24,234 32,234 L437,234 Q445,234 445,242 L445,272" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#11[2] → #19 · MEM</title></path><path class="edge DATA" id="e12i1" d="M372,118 L372,123 Q372,128 377,128 L684,128 Q692,128 692,136 L692,168" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#12[1] → #4 · DATA</title></path><path class="edge DATA" id="e12i2" d="M620,328 L620,333 Q620,338 625,338 L682,338 Q690,338 690,330 L690,252 Q690,244 698,244 L774,244 Q782,244 782,236 L782,166 Q782,158 774,158 L737,158 Q732,158 732,163 L732,168" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#12[2] → #21 · DATA</title></path><path class="edge CTRL" id="e17i0" d="M741,328 L741,340 Q741,348 749,348 L790,348 Q798,348 798,356 L798,376" stroke="#b63838" marker-start="url(#arrow-CTRL)" style="opacity: 1;"><title>#17[0] → #15 · CTRL</title></path><path class="edge MEM" id="e17i1" d="M425,328 L425,350 Q425,358 433,358 L814,358 Q822,358 822,366 L822,376" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#17[1] → #11 · MEM</title></path><path class="edge DATA" id="e17i2" d="M530,118 L530,140 Q530,148 538,148 L784,148 Q792,148 792,156 L792,330 Q792,338 800,338 L838,338 Q846,338 846,346 L846,376" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#17[2] → #5 · DATA</title></path><path class="edge DATA" id="e18i1" d="M834,432 L834,480" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#18[1] → #17 · DATA</title></path><path class="edge DATA" id="e18i2" d="M712,224 L712,229 Q712,234 717,234 L896,234 Q904,234 904,242 L904,434 Q904,442 896,442 L872,442 Q864,442 864,450 L864,480" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#18[2] → #12 · DATA</title></path><path class="edge CTRL" id="e19i0" d="M741,328 L741,584" stroke="#b63838" marker-start="url(#arrow-CTRL)" style="opacity: 1;"><title>#19[0] → #15 · CTRL</title></path><path class="edge MEM" id="e19i1" d="M425,328 L425,350 Q425,358 433,358 L744,358 Q752,358 752,366 L752,549.5 Q752,556 758.5,556 L758.5,556 Q765,556 765,562.5 L765,584" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#19[1] → #11 · MEM</title></path><path class="edge DATA" id="e19i2" d="M530,118 L530,140 Q530,148 538,148 L784,148 Q792,148 792,156 L792,330 Q792,338 784,338 L771,338 Q763,338 763,346 L763,538 Q763,546 771,546 L781,546 Q789,546 789,554 L789,584" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#19[2] → #5 · DATA</title></path><path class="edge DATA" id="e19i3" d="M834,536 L834,541 Q834,546 829,546 L821,546 Q813,546 813,554 L813,584" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#19[3] → #18 · DATA</title></path><path class="edge ASSOC" id="e20i0" d="M435,46 C435,70 557,147 557,171" stroke="#9396a3" marker-start="url(#arrow-ASSOC)" style="opacity: 1;"><title>#20[0] → #1 · ASSOC</title></path><path class="edge DATA" id="e21i1" d="M712,224 L712,229 Q712,234 707,234 L628,234 Q620,234 620,242 L620,272" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#21[1] → #12 · DATA</title></path><path class="edge DATA" id="e21i2" d="M557,224 L557,236 Q557,244 565,244 L642,244 Q650,244 650,252 L650,272" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#21[2] → #20 · DATA</title></path><path class="edge MEM" id="e22i1" d="M252,118 L252,130 Q252,138 244,138 L82,138 Q74,138 74,146 L74,333.5 Q74,338 78.5,338 L78.5,338 Q83,338 83,342.5 L83,376" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#22[1] → #3 · MEM</title></path><path class="edge MEM" id="e22i2" d="M264,224 L264,236 Q264,244 256,244 L102,244 Q94,244 94,252 L94,331.5 Q94,338 100.5,338 L100.5,338 Q107,338 107,344.5 L107,376" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#22[2] → #8 · MEM</title></path><path class="edge MEM" id="e22i3" d="M425,328 L425,350 Q425,358 417,358 L139,358 Q131,358 131,366 L131,376" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#22[3] → #11 · MEM</title></path><path class="edge CTRL" id="e23i0" d="M129,224 L129,272" stroke="#b63838" marker-start="url(#arrow-CTRL)" style="opacity: 1;"><title>#23[0] → #16 · CTRL</title></path><path class="edge MEM" id="e23i1" d="M264,224 L264,236 Q264,244 256,244 L161,244 Q153,244 153,252 L153,272" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#23[1] → #8 · MEM</title></path><path class="edge DATA" id="e23i2" d="M530,118 L530,140 Q530,148 522,148 L342,148 Q334,148 334,156 L334,246 Q334,254 326,254 L185,254 Q177,254 177,262 L177,272" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#23[2] → #5 · DATA</title></path><path class="edge MEM" id="e24i1" d="M95,432 L95,437 Q95,442 100,442 L127,442 Q135,442 135,450 L135,480" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#24[1] → #22 · MEM</title></path><path class="edge DATA" id="e24i2" d="M165,328 L165,480" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#24[2] → #23 · DATA</title></path></g><g class="edge-hits"/><g class="parser" style="opacity: 1;"/><g class="nodes"><g class="node" id="n1" data-id="1" transform="translate(192,24)" style="opacity: 1;"><path class="box" d="M0,0H240V44H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="120" y="18"><tspan>Start</tspan><tspan class="node-id">  #1</tspan></text><text class="type" text-anchor="middle" y="35" x="120"/><title>#1 Start
+Type not computed
+
+</title></g><g class="node" id="n3" data-id="3" transform="translate(192,68)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>$mem</tspan><tspan class="node-id">  #3/1</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#3 $mem
+Projection 1 of #1
+Type not computed
+
+[0] → #1 MEM</title></g><g class="node" id="n4" data-id="4" transform="translate(312,68)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>arg</tspan><tspan class="node-id">  #4/2</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#4 arg
+Projection 2 of #1
+Type not computed
+
+[0] → #1 DATA</title></g><g class="node" id="n5" data-id="5" transform="translate(470,68)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>new Point</tspan><tspan class="node-id">  #5</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#5 new Point
+Type not computed
+
+[0] → — CTRL</title><circle class="port" cx="60" cy="-3" r="3" fill="white"/><text class="slot" x="60" y="-10" text-anchor="middle">0</text></g><g class="node" id="n6" data-id="6" transform="translate(622,68)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>#0</tspan><tspan class="node-id">  #6</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#6 #0
+Type not computed
+
+[0] → #1 ASSOC</title><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><text class="slot" x="60" y="-10" text-anchor="middle">0</text></g><g class="node" id="n7" data-id="7" transform="translate(40,68)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>#42</tspan><tspan class="node-id">  #7</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#7 #42
+Type not computed
+
+[0] → #1 ASSOC</title><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><text class="slot" x="60" y="-10" text-anchor="middle">0</text></g><g class="node" id="n8" data-id="8" transform="translate(204,174)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Store p.x</tspan><tspan class="node-id">  #8</tspan></text><text class="type" text-anchor="middle" y="35" x="60">MEM#2</text><title>#8 Store p.x
+MEM#2
+
+[0] → — CTRL
+[1] → #3 MEM
+[2] → #5 DATA
+[3] → #7 DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n9" data-id="9" transform="translate(345,174)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Store p.y</tspan><tspan class="node-id">  #9</tspan></text><text class="type" text-anchor="middle" y="35" x="60">MEM#3</text><title>#9 Store p.y
+MEM#3
+
+[0] → — CTRL
+[1] → #3 MEM
+[2] → #5 DATA
+[3] → #6 DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n11" data-id="11" transform="translate(365,278)" style="opacity: 1;"><path class="box" d="M12,0H108L120,22L108,44H12L0,22Z" fill="#f5e4fa"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>MemPhi y</tspan><tspan class="node-id">  #11</tspan></text><text class="type" text-anchor="middle" y="35" x="60">MEM#3</text><title>#11 MemPhi y
+MEM#3
+
+[0] → — ASSOC
+[1] → #9 MEM
+[2] → #19 MEM</title><circle class="port" cx="0" cy="-3" r="3" fill="white"/><circle class="port" cx="40" cy="-3" r="3" fill="#536477"/><circle class="port" cx="80" cy="-3" r="3" fill="#536477"/><text class="slot" x="0" y="-10" text-anchor="middle">0</text><text class="slot" x="40" y="-10" text-anchor="middle">1</text><text class="slot" x="80" y="-10" text-anchor="middle">2</text></g><g class="node" id="n12" data-id="12" transform="translate(652,174)" style="opacity: 1;"><path class="box" d="M12,0H108L120,22L108,44H12L0,22Z" fill="#f5e4fa"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Phi arg</tspan><tspan class="node-id">  #12</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#12 Phi arg
+Type not computed
+
+[0] → — ASSOC
+[1] → #4 DATA
+[2] → #21 DATA</title><circle class="port" cx="0" cy="-3" r="3" fill="white"/><circle class="port" cx="40" cy="-3" r="3" fill="#536477"/><circle class="port" cx="80" cy="-3" r="3" fill="#536477"/><text class="slot" x="0" y="-10" text-anchor="middle">0</text><text class="slot" x="40" y="-10" text-anchor="middle">1</text><text class="slot" x="80" y="-10" text-anchor="middle">2</text></g><g class="node" id="n15" data-id="15" transform="translate(700,296)" style="opacity: 1;"><path class="box" d="M0,0H82V26H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="41" y="17"><tspan>True</tspan><tspan class="node-id">  #15/0</tspan></text><text class="type" text-anchor="middle" y="35" x="41"/><title>#15 True
+Projection 0 of #0
+Type not computed
+
+</title></g><g class="node" id="n16" data-id="16" transform="translate(85,192)" style="opacity: 1;"><path class="box" d="M0,0H87V26H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="43.5" y="17"><tspan>False</tspan><tspan class="node-id">  #16/1</tspan></text><text class="type" text-anchor="middle" y="35" x="43.5"/><title>#16 False
+Projection 1 of #0
+Type not computed
+
+</title></g><g class="node" id="n17" data-id="17" transform="translate(774,382)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Load p.y</tspan><tspan class="node-id">  #17</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#17 Load p.y
+Type not computed
+
+[0] → #15 CTRL
+[1] → #11 MEM
+[2] → #5 DATA
+[3] → — DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="#536477"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="white"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n18" data-id="18" transform="translate(774,486)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>+</tspan><tspan class="node-id">  #18</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#18 +
+Type not computed
+
+[0] → — CTRL
+[1] → #17 DATA
+[2] → #12 DATA</title><circle class="port" cx="30" cy="-3" r="3" fill="white"/><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><circle class="port" cx="90" cy="-3" r="3" fill="#536477"/><text class="slot" x="30" y="-10" text-anchor="middle">0</text><text class="slot" x="60" y="-10" text-anchor="middle">1</text><text class="slot" x="90" y="-10" text-anchor="middle">2</text></g><g class="node" id="n19" data-id="19" transform="translate(717,590)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Store p.y</tspan><tspan class="node-id">  #19</tspan></text><text class="type" text-anchor="middle" y="35" x="60">MEM#3</text><title>#19 Store p.y
+MEM#3
+
+[0] → #15 CTRL
+[1] → #11 MEM
+[2] → #5 DATA
+[3] → #18 DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="#536477"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n20" data-id="20" transform="translate(497,174)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>#1</tspan><tspan class="node-id">  #20</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#20 #1
+Type not computed
+
+[0] → #1 ASSOC</title><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><text class="slot" x="60" y="-10" text-anchor="middle">0</text></g><g class="node" id="n21" data-id="21" transform="translate(560,278)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>-</tspan><tspan class="node-id">  #21</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#21 -
+Type not computed
+
+[0] → — CTRL
+[1] → #12 DATA
+[2] → #20 DATA</title><circle class="port" cx="30" cy="-3" r="3" fill="white"/><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><circle class="port" cx="90" cy="-3" r="3" fill="#536477"/><text class="slot" x="30" y="-10" text-anchor="middle">0</text><text class="slot" x="60" y="-10" text-anchor="middle">1</text><text class="slot" x="90" y="-10" text-anchor="middle">2</text></g><g class="node" id="n22" data-id="22" transform="translate(35,382)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>MemMerge</tspan><tspan class="node-id">  #22</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#22 MemMerge
+Type not computed
+
+[0] → — CTRL
+[1] → #3 MEM
+[2] → #8 MEM
+[3] → #11 MEM</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n23" data-id="23" transform="translate(105,278)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Load p.x</tspan><tspan class="node-id">  #23</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#23 Load p.x
+Type not computed
+
+[0] → #16 CTRL
+[1] → #8 MEM
+[2] → #5 DATA
+[3] → — DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="#536477"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="white"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n24" data-id="24" transform="translate(75,486)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Return</tspan><tspan class="node-id">  #24</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#24 Return
+Type not computed
+
+[0] → — CTRL
+[1] → #22 MEM
+[2] → #23 DATA</title><circle class="port" cx="30" cy="-3" r="3" fill="white"/><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><circle class="port" cx="90" cy="-3" r="3" fill="#536477"/><text class="slot" x="30" y="-10" text-anchor="middle">0</text><text class="slot" x="60" y="-10" text-anchor="middle">1</text><text class="slot" x="90" y="-10" text-anchor="middle">2</text></g></g><g class="region-heads" style="opacity: 1;"/><g class="shortcuts" style="opacity: 1;"/><g class="peep-ghosts" pointer-events="none"/></g></svg>
diff --git a/chapter11/docs/example2a.gv b/chapter11/docs/example2a.gv
new file mode 100644
index 00000000..187e63b9
--- /dev/null
+++ b/chapter11/docs/example2a.gv
@@ -0,0 +1,17 @@
+digraph Memory {
+ // IR styles match graph/web/render.js; arrows are use -> definition.
+ graph [bgcolor="#fafbfc" fontname="Helvetica" nodesep=0.35 ranksep=0.55 splines=ortho];
+ node [fontname="Helvetica" fontsize=12 color="#758191" fontcolor="#152330" shape=box style="rounded,filled" fillcolor="#edf3f7"];
+ edge [fontname="Helvetica" fontsize=9 color="#536477" fontcolor="#364352" arrowsize=0.7 penwidth=1.5];
+
+ rankdir=RL;
+
+ M [label="Default memory" shape=octagon style="filled" fillcolor="#dcecff"];
+ X [label="Store x" shape=octagon style="filled" fillcolor="#dcecff"];
+ Y [label="Store y" shape=octagon style="filled" fillcolor="#dcecff"];
+ X -> M [color="#2867b2"]; Y -> M [color="#2867b2"];
+ MemMerge -> M [xlabel="default",color="#2867b2"]; MemMerge -> X [xlabel="x",color="#2867b2"];
+ MemMerge -> Y [xlabel="y",color="#2867b2"]; Return -> MemMerge [color="#2867b2"];
+ Return [shape=box style="filled" fillcolor="#fff1c4"];
+ MemMerge [shape=octagon style="filled" fillcolor="#dcecff"];
+}
diff --git a/chapter11/docs/example2a.json b/chapter11/docs/example2a.json
new file mode 100644
index 00000000..b9e84d5a
--- /dev/null
+++ b/chapter11/docs/example2a.json
@@ -0,0 +1,20 @@
+{
+ "ver": 1,
+ "comp": "chapter11/docs/example2a.svg",
+ "step": 1,
+ "roots": [11],
+ "scope": 0,
+ "nodes": [
+ {"id": 1, "label": "Start", "type": null, "kind": "CTRL", "edges": [], "proj": null},
+ {"id": 3, "label": "$mem", "type": null, "kind": "MEM", "edges": [{"idx": 0, "def": 1, "role": "MEM", "label": null}], "proj": {"par": 1, "idx": 1}},
+ {"id": 4, "label": "arg", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 1, "role": "DATA", "label": null}], "proj": {"par": 1, "idx": 2}},
+ {"id": 5, "label": "new Point", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}], "proj": null},
+ {"id": 7, "label": "Store p.x", "type": "MEM#2", "kind": "MEM", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 3, "role": "MEM", "label": null}, {"idx": 2, "def": 5, "role": "DATA", "label": null}, {"idx": 3, "def": 4, "role": "DATA", "label": null}], "proj": null},
+ {"id": 8, "label": "#42", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 1, "role": "ASSOC", "label": null}], "proj": null},
+ {"id": 9, "label": "Store p.y", "type": "MEM#3", "kind": "MEM", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 3, "role": "MEM", "label": null}, {"idx": 2, "def": 5, "role": "DATA", "label": null}, {"idx": 3, "def": 8, "role": "DATA", "label": null}], "proj": null},
+ {"id": 10, "label": "MemMerge", "type": null, "kind": "MEM", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 3, "role": "MEM", "label": null}, {"idx": 2, "def": 7, "role": "MEM", "label": null}, {"idx": 3, "def": 9, "role": "MEM", "label": null}], "proj": null},
+ {"id": 11, "label": "Return", "type": null, "kind": "CTRL", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 10, "role": "MEM", "label": null}, {"idx": 2, "def": 5, "role": "DATA", "label": null}], "proj": null}
+ ],
+ "groups": [
+ ]
+}
diff --git a/chapter11/docs/example2a.svg b/chapter11/docs/example2a.svg
new file mode 100644
index 00000000..b43a55b4
--- /dev/null
+++ b/chapter11/docs/example2a.svg
@@ -0,0 +1,103 @@
+<svg aria-label="Compiler graph" width="598" height="454" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 598 454" style="font-family: sans-serif;"><style>
+ html, body { height:100%; margin:0; font-family:sans-serif; }
+ .viewer { height:100%; display:grid; grid-template-rows:auto minmax(0,1fr) auto; }
+ .source { padding:8px; border-bottom:1px solid #ccc; }
+ #program { width:min(600px,80vw); vertical-align:middle; }
+ #status { margin-top:4px; }
+ #graph { min-height:0; overflow:hidden; position:relative; background:#fafbfc; }
+ #elk { width:100%; height:100%; }
+ #graph svg { display:block; }
+ .tools { display:flex; flex-wrap:wrap; align-items:center; gap:14px; margin-top:8px; font-size:12px; }
+ .hint { color:#616c78; }
+ .ctrl { color:#b63838; } .mem { color:#2867b2; } .data { color:#536477; }
+ .edge { fill:none; stroke-width:1.5; }
+ .edge.CTRL { stroke-width:2; }
+ .edge.ASSOC { stroke-dasharray:4 4; }
+ .edge.PARSER { stroke-dasharray:5 4; }
+ .parser rect { fill:#f6f0ff; stroke:#7956a5; stroke-width:1.5; stroke-dasharray:5 4; }
+ .edge.selected { stroke-width:3.5; }
+ .edge.bundle { stroke-width:4; }
+ .edge.bundle.selected { stroke-width:6; }
+ .edge-hit { fill:none; stroke:transparent; stroke-width:12; vector-effect:non-scaling-stroke; pointer-events:stroke; cursor:pointer; }
+ .edge-jump { fill:transparent; pointer-events:all; cursor:pointer; }
+ .node { cursor:pointer; }
+ .box { stroke:#758191; stroke-width:1; }
+ .node.held .box { stroke-dasharray:5 3; }
+ .node.near .box { stroke:#c18221; stroke-width:2; }
+ .node.focus .box { stroke:#9c4900; stroke-width:3; }
+ .node.selected .box { stroke:#1569b9; stroke-width:3; }
+ .node.folded .box { stroke-width:4; }
+ .node.folding .box { fill:#f4ccd7; }
+ .fold-tag { font-size:9px; font-weight:700; fill:#963751; }
+ .peep-area { fill:#fff3d9; fill-opacity:.8; stroke:#c18221; stroke-width:2; pointer-events:none; }
+ .node.peep-edit .box { stroke:#9c4900; stroke-width:3; }
+ .node.error .box { stroke:#b42318; stroke-width:4; }
+ #event.error { color:#b42318; font-weight:600; white-space:pre-wrap; overflow-wrap:anywhere; }
+ .peep-ghosts { pointer-events:none; }
+ .region-box { stroke:#9da9b8; stroke-width:1.5; }
+ .fold-btn { cursor:pointer; }
+ .fold-btn rect { fill:white; stroke:#596674; }
+ .fold-btn text { font-size:14px; fill:#152330; }
+ .fold-btn:focus rect { stroke:#1569b9; stroke-width:2; }
+ .shortcut { cursor:pointer; }
+ .shortcut path { fill:none; stroke-width:1.5; }
+ .shortcut rect { fill:#fff8ec; stroke:#b63838; stroke-dasharray:3 2; }
+ .shortcut text { font-size:11px; fill:#783030; }
+ .shortcut.selected rect, .shortcut:focus rect { stroke-width:2.5; }
+ .label { font-size:12px; fill:#152330; font-weight:600; }
+ .node-id { font-size:10px; fill:#596674; font-weight:400; }
+ .type { font-size:11px; fill:#455768; }
+ .port { stroke:#536477; stroke-width:1; }
+ .row { stroke:#b6afcf; stroke-width:1; }
+ .bind { font-size:12px; fill:#152330; }
+ .slot { font-size:10px; fill:#364352; paint-order:stroke; stroke:#fafbfc; stroke-width:3; }
+ #detail { position:absolute; top:8px; right:8px; margin:0; padding:12px; max-width:320px;
+ max-height:45%; overflow:auto; white-space:pre-wrap; overflow-wrap:anywhere;
+ background:#fffffff2; border:1px solid #bac5d0; border-radius:4px; font-size:12px; }
+ .controls { display:flex; flex-wrap:wrap; justify-content:center; align-items:center; gap:6px; padding:6px; }
+ .button { color:white; background:black; font-size:20px; min-width:30px; }
+ .button:disabled { background:grey; }
+ .count { font-size:20px; min-width:35px; text-align:center; }
+ #N { width:6ch; }
+ #scrub { width:clamp(120px,35vw,600px); }
+ </style><defs><marker id="arrow-CTRL" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#b63838"/></marker><marker id="arrow-DATA" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#536477"/></marker><marker id="arrow-MEM" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#2867b2"/></marker><marker id="arrow-ASSOC" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#9396a3"/></marker><marker id="arrow-PARSER" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#7956a5"/></marker></defs><rect width="100%" height="100%" fill="rgb(250, 251, 252)"/><g><g class="regions" style="opacity: 1;"/><rect class="peep-area" rx="36" style="opacity: 0;"/><g class="edges"><path class="edge MEM" id="e7i1" d="M84,118 L84,140 Q84,148 92,148 L135,148 Q143,148 143,156 L143,166" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#7[1] → #3 · MEM</title></path><path class="edge DATA" id="e7i2" d="M362,118 L362,123 Q362,128 357,128 L175,128 Q167,128 167,136 L167,166" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#7[2] → #5 · DATA</title></path><path class="edge DATA" id="e7i3" d="M204,118 L204,131.5 Q204,138 197.5,138 L197.5,138 Q191,138 191,144.5 L191,166" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#7[3] → #4 · DATA</title></path><path class="edge ASSOC" id="e8i0" d="M267,46 C267,70 514,41 514,65" stroke="#9396a3" marker-start="url(#arrow-ASSOC)" style="opacity: 1;"><title>#8[0] → #1 · ASSOC</title></path><path class="edge MEM" id="e9i1" d="M84,118 L84,140 Q84,148 92,148 L287,148 Q295,148 295,156 L295,166" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#9[1] → #3 · MEM</title></path><path class="edge DATA" id="e9i2" d="M362,118 L362,123 Q362,128 357,128 L327,128 Q319,128 319,136 L319,166" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#9[2] → #5 · DATA</title></path><path class="edge DATA" id="e9i3" d="M514,118 L514,130 Q514,138 506,138 L351,138 Q343,138 343,146 L343,166" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#9[3] → #8 · DATA</title></path><path class="edge MEM" id="e10i1" d="M84,118 L84,224 Q84,232 92,232 L123,232 Q131,232 131,240 L131,270" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#10[1] → #3 · MEM</title></path><path class="edge MEM" id="e10i2" d="M155,222 L155,270" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#10[2] → #7 · MEM</title></path><path class="edge MEM" id="e10i3" d="M307,222 L307,227 Q307,232 302,232 L187,232 Q179,232 179,240 L179,270" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#10[3] → #9 · MEM</title></path><path class="edge MEM" id="e11i1" d="M143,326 L143,331 Q143,336 148,336 L339,336 Q347,336 347,344 L347,374" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#11[1] → #10 · MEM</title></path><path class="edge DATA" id="e11i2" d="M362,118 L362,123 Q362,128 367,128 L369.5,128 Q377,128 377,135.5 L377,374" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#11[2] → #5 · DATA</title></path></g><g class="edge-hits"/><g class="parser" style="opacity: 1;"/><g class="nodes"><g class="node" id="n1" data-id="1" transform="translate(24,24)" style="opacity: 1;"><path class="box" d="M0,0H240V44H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="120" y="18"><tspan>Start</tspan><tspan class="node-id">  #1</tspan></text><text class="type" text-anchor="middle" y="35" x="120"/><title>#1 Start
+Type not computed
+
+</title></g><g class="node" id="n3" data-id="3" transform="translate(24,68)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>$mem</tspan><tspan class="node-id">  #3/1</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#3 $mem
+Projection 1 of #1
+Type not computed
+
+[0] → #1 MEM</title></g><g class="node" id="n4" data-id="4" transform="translate(144,68)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>arg</tspan><tspan class="node-id">  #4/2</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#4 arg
+Projection 2 of #1
+Type not computed
+
+[0] → #1 DATA</title></g><g class="node" id="n5" data-id="5" transform="translate(302,68)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>new Point</tspan><tspan class="node-id">  #5</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#5 new Point
+Type not computed
+
+[0] → — CTRL</title><circle class="port" cx="60" cy="-3" r="3" fill="white"/><text class="slot" x="60" y="-10" text-anchor="middle">0</text></g><g class="node" id="n7" data-id="7" transform="translate(95,172)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Store p.x</tspan><tspan class="node-id">  #7</tspan></text><text class="type" text-anchor="middle" y="35" x="60">MEM#2</text><title>#7 Store p.x
+MEM#2
+
+[0] → — CTRL
+[1] → #3 MEM
+[2] → #5 DATA
+[3] → #4 DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n8" data-id="8" transform="translate(454,68)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>#42</tspan><tspan class="node-id">  #8</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#8 #42
+Type not computed
+
+[0] → #1 ASSOC</title><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><text class="slot" x="60" y="-10" text-anchor="middle">0</text></g><g class="node" id="n9" data-id="9" transform="translate(247,172)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Store p.y</tspan><tspan class="node-id">  #9</tspan></text><text class="type" text-anchor="middle" y="35" x="60">MEM#3</text><title>#9 Store p.y
+MEM#3
+
+[0] → — CTRL
+[1] → #3 MEM
+[2] → #5 DATA
+[3] → #8 DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n10" data-id="10" transform="translate(83,276)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>MemMerge</tspan><tspan class="node-id">  #10</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#10 MemMerge
+Type not computed
+
+[0] → — CTRL
+[1] → #3 MEM
+[2] → #7 MEM
+[3] → #9 MEM</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n11" data-id="11" transform="translate(287,380)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Return</tspan><tspan class="node-id">  #11</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#11 Return
+Type not computed
+
+[0] → — CTRL
+[1] → #10 MEM
+[2] → #5 DATA</title><circle class="port" cx="30" cy="-3" r="3" fill="white"/><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><circle class="port" cx="90" cy="-3" r="3" fill="#536477"/><text class="slot" x="30" y="-10" text-anchor="middle">0</text><text class="slot" x="60" y="-10" text-anchor="middle">1</text><text class="slot" x="90" y="-10" text-anchor="middle">2</text></g></g><g class="region-heads" style="opacity: 1;"/><g class="shortcuts" style="opacity: 1;"/><g class="peep-ghosts" pointer-events="none"/></g></svg>
diff --git a/chapter11/docs/example2b-final.json b/chapter11/docs/example2b-final.json
new file mode 100644
index 00000000..b0a7a2f3
--- /dev/null
+++ b/chapter11/docs/example2b-final.json
@@ -0,0 +1,251 @@
+{
+ "ver": 1,
+ "comp": "chapter11/docs/example2b-final.svg",
+ "step": 100,
+ "roots": [
+ 23
+ ],
+ "scope": 0,
+ "nodes": [
+ {
+ "id": 1,
+ "label": "Start",
+ "type": null,
+ "kind": "CTRL",
+ "edges": [],
+ "proj": null
+ },
+ {
+ "id": 3,
+ "label": "$mem",
+ "type": null,
+ "kind": "MEM",
+ "edges": [
+ {
+ "idx": 0,
+ "def": 1,
+ "role": "MEM",
+ "label": null
+ }
+ ],
+ "proj": {
+ "par": 1,
+ "idx": 1
+ }
+ },
+ {
+ "id": 5,
+ "label": "new Point",
+ "type": null,
+ "kind": "DATA",
+ "edges": [
+ {
+ "idx": 0,
+ "def": 0,
+ "role": "CTRL",
+ "label": null
+ }
+ ],
+ "proj": null
+ },
+ {
+ "id": 6,
+ "label": "#0",
+ "type": null,
+ "kind": "DATA",
+ "edges": [
+ {
+ "idx": 0,
+ "def": 1,
+ "role": "ASSOC",
+ "label": null
+ }
+ ],
+ "proj": null
+ },
+ {
+ "id": 8,
+ "label": "Store p.y",
+ "type": "MEM#3",
+ "kind": "MEM",
+ "edges": [
+ {
+ "idx": 0,
+ "def": 0,
+ "role": "CTRL",
+ "label": null
+ },
+ {
+ "idx": 1,
+ "def": 3,
+ "role": "MEM",
+ "label": null
+ },
+ {
+ "idx": 2,
+ "def": 5,
+ "role": "DATA",
+ "label": null
+ },
+ {
+ "idx": 3,
+ "def": 6,
+ "role": "DATA",
+ "label": null
+ }
+ ],
+ "proj": null
+ },
+ {
+ "id": 13,
+ "label": "#3",
+ "type": null,
+ "kind": "DATA",
+ "edges": [
+ {
+ "idx": 0,
+ "def": 1,
+ "role": "ASSOC",
+ "label": null
+ }
+ ],
+ "proj": null
+ },
+ {
+ "id": 15,
+ "label": "#4",
+ "type": null,
+ "kind": "DATA",
+ "edges": [
+ {
+ "idx": 0,
+ "def": 1,
+ "role": "ASSOC",
+ "label": null
+ }
+ ],
+ "proj": null
+ },
+ {
+ "id": 22,
+ "label": "MemMerge",
+ "type": null,
+ "kind": "MEM",
+ "edges": [
+ {
+ "idx": 0,
+ "def": 0,
+ "role": "CTRL",
+ "label": null
+ },
+ {
+ "idx": 1,
+ "def": 3,
+ "role": "MEM",
+ "label": null
+ },
+ {
+ "idx": 2,
+ "def": 27,
+ "role": "MEM",
+ "label": null
+ },
+ {
+ "idx": 3,
+ "def": 8,
+ "role": "MEM",
+ "label": null
+ }
+ ],
+ "proj": null
+ },
+ {
+ "id": 23,
+ "label": "Return",
+ "type": null,
+ "kind": "CTRL",
+ "edges": [
+ {
+ "idx": 0,
+ "def": 0,
+ "role": "CTRL",
+ "label": null
+ },
+ {
+ "idx": 1,
+ "def": 22,
+ "role": "MEM",
+ "label": null
+ },
+ {
+ "idx": 2,
+ "def": 5,
+ "role": "DATA",
+ "label": null
+ }
+ ],
+ "proj": null
+ },
+ {
+ "id": 27,
+ "label": "Store p.x",
+ "type": "MEM#2",
+ "kind": "MEM",
+ "edges": [
+ {
+ "idx": 0,
+ "def": 0,
+ "role": "CTRL",
+ "label": null
+ },
+ {
+ "idx": 1,
+ "def": 3,
+ "role": "MEM",
+ "label": null
+ },
+ {
+ "idx": 2,
+ "def": 5,
+ "role": "DATA",
+ "label": null
+ },
+ {
+ "idx": 3,
+ "def": 28,
+ "role": "DATA",
+ "label": null
+ }
+ ],
+ "proj": null
+ },
+ {
+ "id": 28,
+ "label": "Phi x value",
+ "type": null,
+ "kind": "PHI",
+ "edges": [
+ {
+ "idx": 0,
+ "def": 0,
+ "role": "ASSOC",
+ "label": null
+ },
+ {
+ "idx": 1,
+ "def": 13,
+ "role": "DATA",
+ "label": null
+ },
+ {
+ "idx": 2,
+ "def": 15,
+ "role": "DATA",
+ "label": null
+ }
+ ],
+ "proj": null
+ }
+ ],
+ "groups": []
+}
diff --git a/chapter11/docs/example2b-final.svg b/chapter11/docs/example2b-final.svg
new file mode 100644
index 00000000..163d7fce
--- /dev/null
+++ b/chapter11/docs/example2b-final.svg
@@ -0,0 +1,110 @@
+<svg aria-label="Compiler graph" width="633" height="558" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 633 558" style="font-family: sans-serif;"><style>
+ html, body { height:100%; margin:0; font-family:sans-serif; }
+ .viewer { height:100%; display:grid; grid-template-rows:auto minmax(0,1fr) auto; }
+ .source { padding:8px; border-bottom:1px solid #ccc; }
+ #program { width:min(600px,80vw); vertical-align:middle; }
+ #status { margin-top:4px; }
+ #graph { min-height:0; overflow:hidden; position:relative; background:#fafbfc; }
+ #elk { width:100%; height:100%; }
+ #graph svg { display:block; }
+ .tools { display:flex; flex-wrap:wrap; align-items:center; gap:14px; margin-top:8px; font-size:12px; }
+ .hint { color:#616c78; }
+ .ctrl { color:#b63838; } .mem { color:#2867b2; } .data { color:#536477; }
+ .edge { fill:none; stroke-width:1.5; }
+ .edge.CTRL { stroke-width:2; }
+ .edge.ASSOC { stroke-dasharray:4 4; }
+ .edge.PARSER { stroke-dasharray:5 4; }
+ .parser rect { fill:#f6f0ff; stroke:#7956a5; stroke-width:1.5; stroke-dasharray:5 4; }
+ .edge.selected { stroke-width:3.5; }
+ .edge.bundle { stroke-width:4; }
+ .edge.bundle.selected { stroke-width:6; }
+ .edge-hit { fill:none; stroke:transparent; stroke-width:12; vector-effect:non-scaling-stroke; pointer-events:stroke; cursor:pointer; }
+ .edge-jump { fill:transparent; pointer-events:all; cursor:pointer; }
+ .node { cursor:pointer; }
+ .box { stroke:#758191; stroke-width:1; }
+ .node.held .box { stroke-dasharray:5 3; }
+ .node.near .box { stroke:#c18221; stroke-width:2; }
+ .node.focus .box { stroke:#9c4900; stroke-width:3; }
+ .node.selected .box { stroke:#1569b9; stroke-width:3; }
+ .node.folded .box { stroke-width:4; }
+ .node.folding .box { fill:#f4ccd7; }
+ .fold-tag { font-size:9px; font-weight:700; fill:#963751; }
+ .peep-area { fill:#fff3d9; fill-opacity:.8; stroke:#c18221; stroke-width:2; pointer-events:none; }
+ .node.peep-edit .box { stroke:#9c4900; stroke-width:3; }
+ .node.error .box { stroke:#b42318; stroke-width:4; }
+ #event.error { color:#b42318; font-weight:600; white-space:pre-wrap; overflow-wrap:anywhere; }
+ .peep-ghosts { pointer-events:none; }
+ .region-box { stroke:#9da9b8; stroke-width:1.5; }
+ .fold-btn { cursor:pointer; }
+ .fold-btn rect { fill:white; stroke:#596674; }
+ .fold-btn text { font-size:14px; fill:#152330; }
+ .fold-btn:focus rect { stroke:#1569b9; stroke-width:2; }
+ .shortcut { cursor:pointer; }
+ .shortcut path { fill:none; stroke-width:1.5; }
+ .shortcut rect { fill:#fff8ec; stroke:#b63838; stroke-dasharray:3 2; }
+ .shortcut text { font-size:11px; fill:#783030; }
+ .shortcut.selected rect, .shortcut:focus rect { stroke-width:2.5; }
+ .label { font-size:12px; fill:#152330; font-weight:600; }
+ .node-id { font-size:10px; fill:#596674; font-weight:400; }
+ .type { font-size:11px; fill:#455768; }
+ .port { stroke:#536477; stroke-width:1; }
+ .row { stroke:#b6afcf; stroke-width:1; }
+ .bind { font-size:12px; fill:#152330; }
+ .slot { font-size:10px; fill:#364352; paint-order:stroke; stroke:#fafbfc; stroke-width:3; }
+ #detail { position:absolute; top:8px; right:8px; margin:0; padding:12px; max-width:320px;
+ max-height:45%; overflow:auto; white-space:pre-wrap; overflow-wrap:anywhere;
+ background:#fffffff2; border:1px solid #bac5d0; border-radius:4px; font-size:12px; }
+ .controls { display:flex; flex-wrap:wrap; justify-content:center; align-items:center; gap:6px; padding:6px; }
+ .button { color:white; background:black; font-size:20px; min-width:30px; }
+ .button:disabled { background:grey; }
+ .count { font-size:20px; min-width:35px; text-align:center; }
+ #N { width:6ch; }
+ #scrub { width:clamp(120px,35vw,600px); }
+ </style><defs><marker id="arrow-CTRL" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#b63838"/></marker><marker id="arrow-DATA" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#536477"/></marker><marker id="arrow-MEM" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#2867b2"/></marker><marker id="arrow-ASSOC" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#9396a3"/></marker><marker id="arrow-PARSER" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#7956a5"/></marker></defs><rect width="100%" height="100%" fill="rgb(250, 251, 252)"/><g><g class="regions" style="opacity: 1;"/><rect class="peep-area" rx="36" style="opacity: 0;"/><g class="edges"><path class="edge ASSOC" id="e6i0" d="M147,150 C147,174 549,145 549,169" stroke="#9396a3" marker-start="url(#arrow-ASSOC)" style="opacity: 1;"><title>#6[0] → #1 · ASSOC</title></path><path class="edge MEM" id="e8i1" d="M84,222 L84,244 Q84,252 92,252 L276,252 Q284,252 284,260 L284,270" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#8[1] → #3 · MEM</title></path><path class="edge DATA" id="e8i2" d="M242,222 L242,234 Q242,242 250,242 L300,242 Q308,242 308,250 L308,270" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#8[2] → #5 · DATA</title></path><path class="edge DATA" id="e8i3" d="M549,222 L549,234 Q549,242 541,242 L340,242 Q332,242 332,250 L332,270" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#8[3] → #6 · DATA</title></path><path class="edge ASSOC" id="e13i0" d="M147,150 C147,174 265,3 265,27" stroke="#9396a3" marker-start="url(#arrow-ASSOC)" style="opacity: 1;"><title>#13[0] → #1 · ASSOC</title></path><path class="edge ASSOC" id="e15i0" d="M147,150 C147,174 417,3 417,27" stroke="#9396a3" marker-start="url(#arrow-ASSOC)" style="opacity: 1;"><title>#15[0] → #1 · ASSOC</title></path><path class="edge MEM" id="e22i1" d="M84,222 L84,328 Q84,336 92,336 L123,336 Q131,336 131,344 L131,374" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#22[1] → #3 · MEM</title></path><path class="edge MEM" id="e22i2" d="M155,326 L155,374" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#22[2] → #27 · MEM</title></path><path class="edge MEM" id="e22i3" d="M296,326 L296,331 Q296,336 291,336 L187,336 Q179,336 179,344 L179,374" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#22[3] → #8 · MEM</title></path><path class="edge MEM" id="e23i1" d="M143,430 L143,435 Q143,440 148,440 L187,440 Q195,440 195,448 L195,478" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#23[1] → #22 · MEM</title></path><path class="edge DATA" id="e23i2" d="M242,222 L242,234 Q242,242 234,242 L233,242 Q225,242 225,250 L225,478" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#23[2] → #5 · DATA</title></path><path class="edge MEM" id="e27i1" d="M84,222 L84,244 Q84,252 92,252 L135,252 Q143,252 143,260 L143,270" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#27[1] → #3 · MEM</title></path><path class="edge DATA" id="e27i2" d="M242,222 L242,234 Q242,242 234,242 L175,242 Q167,242 167,250 L167,270" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#27[2] → #5 · DATA</title></path><path class="edge DATA" id="e27i3" d="M397,196.66666666666666 L397,224 Q397,232 389,232 L199,232 Q191,232 191,240 L191,270" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#27[3] → #28 · DATA</title></path><path class="edge DATA" id="e28i1" d="M265,80 L265,85 Q265,90 270,90 L369,90 Q377,90 377,98 L377,140.66666666666666" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#28[1] → #13 · DATA</title></path><path class="edge DATA" id="e28i2" d="M417,80 L417,140.66666666666666" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#28[2] → #15 · DATA</title></path></g><g class="edge-hits"/><g class="parser" style="opacity: 1;"/><g class="nodes"><g class="node" id="n1" data-id="1" transform="translate(24,128)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Start</tspan><tspan class="node-id">  #1</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#1 Start
+Type not computed
+
+</title></g><g class="node" id="n3" data-id="3" transform="translate(24,172)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>$mem</tspan><tspan class="node-id">  #3/1</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#3 $mem
+Projection 1 of #1
+Type not computed
+
+[0] → #1 MEM</title></g><g class="node" id="n5" data-id="5" transform="translate(182,172)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>new Point</tspan><tspan class="node-id">  #5</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#5 new Point
+Type not computed
+
+[0] → — CTRL</title><circle class="port" cx="60" cy="-3" r="3" fill="white"/><text class="slot" x="60" y="-10" text-anchor="middle">0</text></g><g class="node" id="n6" data-id="6" transform="translate(489,172)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>#0</tspan><tspan class="node-id">  #6</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#6 #0
+Type not computed
+
+[0] → #1 ASSOC</title><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><text class="slot" x="60" y="-10" text-anchor="middle">0</text></g><g class="node" id="n8" data-id="8" transform="translate(236,276)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Store p.y</tspan><tspan class="node-id">  #8</tspan></text><text class="type" text-anchor="middle" y="35" x="60">MEM#3</text><title>#8 Store p.y
+MEM#3
+
+[0] → — CTRL
+[1] → #3 MEM
+[2] → #5 DATA
+[3] → #6 DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n13" data-id="13" transform="translate(205,30)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>#3</tspan><tspan class="node-id">  #13</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#13 #3
+Type not computed
+
+[0] → #1 ASSOC</title><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><text class="slot" x="60" y="-10" text-anchor="middle">0</text></g><g class="node" id="n15" data-id="15" transform="translate(357,30)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>#4</tspan><tspan class="node-id">  #15</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#15 #4
+Type not computed
+
+[0] → #1 ASSOC</title><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><text class="slot" x="60" y="-10" text-anchor="middle">0</text></g><g class="node" id="n22" data-id="22" transform="translate(83,380)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>MemMerge</tspan><tspan class="node-id">  #22</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#22 MemMerge
+Type not computed
+
+[0] → — CTRL
+[1] → #3 MEM
+[2] → #27 MEM
+[3] → #8 MEM</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n23" data-id="23" transform="translate(135,484)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Return</tspan><tspan class="node-id">  #23</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#23 Return
+Type not computed
+
+[0] → — CTRL
+[1] → #22 MEM
+[2] → #5 DATA</title><circle class="port" cx="30" cy="-3" r="3" fill="white"/><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><circle class="port" cx="90" cy="-3" r="3" fill="#536477"/><text class="slot" x="30" y="-10" text-anchor="middle">0</text><text class="slot" x="60" y="-10" text-anchor="middle">1</text><text class="slot" x="90" y="-10" text-anchor="middle">2</text></g><g class="node" id="n27" data-id="27" transform="translate(95,276)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Store p.x</tspan><tspan class="node-id">  #27</tspan></text><text class="type" text-anchor="middle" y="35" x="60">MEM#2</text><title>#27 Store p.x
+MEM#2
+
+[0] → — CTRL
+[1] → #3 MEM
+[2] → #5 DATA
+[3] → #28 DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n28" data-id="28" transform="translate(337,146.66666666666666)" style="opacity: 1;"><path class="box" d="M12,0H108L120,22L108,44H12L0,22Z" fill="#f5e4fa"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Phi x value</tspan><tspan class="node-id">  #28</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#28 Phi x value
+Type not computed
+
+[0] → — ASSOC
+[1] → #13 DATA
+[2] → #15 DATA</title><circle class="port" cx="0" cy="-3" r="3" fill="white"/><circle class="port" cx="40" cy="-3" r="3" fill="#536477"/><circle class="port" cx="80" cy="-3" r="3" fill="#536477"/><text class="slot" x="0" y="-10" text-anchor="middle">0</text><text class="slot" x="40" y="-10" text-anchor="middle">1</text><text class="slot" x="80" y="-10" text-anchor="middle">2</text></g></g><g class="region-heads" style="opacity: 1;"/><g class="shortcuts" style="opacity: 1;"/><g class="peep-ghosts" pointer-events="none"/></g></svg>
diff --git a/chapter11/docs/example2b-merged.json b/chapter11/docs/example2b-merged.json
new file mode 100644
index 00000000..914b7cfb
--- /dev/null
+++ b/chapter11/docs/example2b-merged.json
@@ -0,0 +1,339 @@
+{
+ "ver": 1,
+ "comp": "chapter11/docs/example2b-merged.svg",
+ "step": 8,
+ "roots": [
+ 23
+ ],
+ "scope": 0,
+ "nodes": [
+ {
+ "id": 1,
+ "label": "Start",
+ "type": null,
+ "kind": "CTRL",
+ "edges": [],
+ "proj": null
+ },
+ {
+ "id": 3,
+ "label": "$mem",
+ "type": null,
+ "kind": "MEM",
+ "edges": [
+ {
+ "idx": 0,
+ "def": 1,
+ "role": "MEM",
+ "label": null
+ }
+ ],
+ "proj": {
+ "par": 1,
+ "idx": 1
+ }
+ },
+ {
+ "id": 5,
+ "label": "new Point",
+ "type": null,
+ "kind": "DATA",
+ "edges": [
+ {
+ "idx": 0,
+ "def": 0,
+ "role": "CTRL",
+ "label": null
+ }
+ ],
+ "proj": null
+ },
+ {
+ "id": 6,
+ "label": "#0",
+ "type": null,
+ "kind": "DATA",
+ "edges": [
+ {
+ "idx": 0,
+ "def": 1,
+ "role": "ASSOC",
+ "label": null
+ }
+ ],
+ "proj": null
+ },
+ {
+ "id": 7,
+ "label": "Store p.x",
+ "type": "MEM#2",
+ "kind": "MEM",
+ "edges": [
+ {
+ "idx": 0,
+ "def": 0,
+ "role": "CTRL",
+ "label": null
+ },
+ {
+ "idx": 1,
+ "def": 3,
+ "role": "MEM",
+ "label": null
+ },
+ {
+ "idx": 2,
+ "def": 5,
+ "role": "DATA",
+ "label": null
+ },
+ {
+ "idx": 3,
+ "def": 6,
+ "role": "DATA",
+ "label": null
+ }
+ ],
+ "proj": null
+ },
+ {
+ "id": 8,
+ "label": "Store p.y",
+ "type": "MEM#3",
+ "kind": "MEM",
+ "edges": [
+ {
+ "idx": 0,
+ "def": 0,
+ "role": "CTRL",
+ "label": null
+ },
+ {
+ "idx": 1,
+ "def": 3,
+ "role": "MEM",
+ "label": null
+ },
+ {
+ "idx": 2,
+ "def": 5,
+ "role": "DATA",
+ "label": null
+ },
+ {
+ "idx": 3,
+ "def": 6,
+ "role": "DATA",
+ "label": null
+ }
+ ],
+ "proj": null
+ },
+ {
+ "id": 11,
+ "label": "True",
+ "type": null,
+ "kind": "CTRL",
+ "edges": [],
+ "proj": {
+ "par": 0,
+ "idx": 0
+ }
+ },
+ {
+ "id": 12,
+ "label": "False",
+ "type": null,
+ "kind": "CTRL",
+ "edges": [],
+ "proj": {
+ "par": 0,
+ "idx": 1
+ }
+ },
+ {
+ "id": 13,
+ "label": "#3",
+ "type": null,
+ "kind": "DATA",
+ "edges": [
+ {
+ "idx": 0,
+ "def": 1,
+ "role": "ASSOC",
+ "label": null
+ }
+ ],
+ "proj": null
+ },
+ {
+ "id": 14,
+ "label": "Store p.x",
+ "type": "MEM#2",
+ "kind": "MEM",
+ "edges": [
+ {
+ "idx": 0,
+ "def": 11,
+ "role": "CTRL",
+ "label": null
+ },
+ {
+ "idx": 1,
+ "def": 7,
+ "role": "MEM",
+ "label": null
+ },
+ {
+ "idx": 2,
+ "def": 5,
+ "role": "DATA",
+ "label": null
+ },
+ {
+ "idx": 3,
+ "def": 13,
+ "role": "DATA",
+ "label": null
+ }
+ ],
+ "proj": null
+ },
+ {
+ "id": 15,
+ "label": "#4",
+ "type": null,
+ "kind": "DATA",
+ "edges": [
+ {
+ "idx": 0,
+ "def": 1,
+ "role": "ASSOC",
+ "label": null
+ }
+ ],
+ "proj": null
+ },
+ {
+ "id": 16,
+ "label": "Store p.x",
+ "type": "MEM#2",
+ "kind": "MEM",
+ "edges": [
+ {
+ "idx": 0,
+ "def": 12,
+ "role": "CTRL",
+ "label": null
+ },
+ {
+ "idx": 1,
+ "def": 7,
+ "role": "MEM",
+ "label": null
+ },
+ {
+ "idx": 2,
+ "def": 5,
+ "role": "DATA",
+ "label": null
+ },
+ {
+ "idx": 3,
+ "def": 15,
+ "role": "DATA",
+ "label": null
+ }
+ ],
+ "proj": null
+ },
+ {
+ "id": 20,
+ "label": "MemPhi x",
+ "type": "MEM#2",
+ "kind": "PHI",
+ "edges": [
+ {
+ "idx": 0,
+ "def": 0,
+ "role": "ASSOC",
+ "label": null
+ },
+ {
+ "idx": 1,
+ "def": 14,
+ "role": "MEM",
+ "label": null
+ },
+ {
+ "idx": 2,
+ "def": 16,
+ "role": "MEM",
+ "label": null
+ }
+ ],
+ "proj": null
+ },
+ {
+ "id": 22,
+ "label": "MemMerge",
+ "type": null,
+ "kind": "MEM",
+ "edges": [
+ {
+ "idx": 0,
+ "def": 0,
+ "role": "CTRL",
+ "label": null
+ },
+ {
+ "idx": 1,
+ "def": 3,
+ "role": "MEM",
+ "label": null
+ },
+ {
+ "idx": 2,
+ "def": 20,
+ "role": "MEM",
+ "label": null
+ },
+ {
+ "idx": 3,
+ "def": 8,
+ "role": "MEM",
+ "label": null
+ }
+ ],
+ "proj": null
+ },
+ {
+ "id": 23,
+ "label": "Return",
+ "type": null,
+ "kind": "CTRL",
+ "edges": [
+ {
+ "idx": 0,
+ "def": 0,
+ "role": "CTRL",
+ "label": null
+ },
+ {
+ "idx": 1,
+ "def": 22,
+ "role": "MEM",
+ "label": null
+ },
+ {
+ "idx": 2,
+ "def": 5,
+ "role": "DATA",
+ "label": null
+ }
+ ],
+ "proj": null
+ }
+ ],
+ "groups": []
+}
diff --git a/chapter11/docs/example2b-merged.svg b/chapter11/docs/example2b-merged.svg
new file mode 100644
index 00000000..21ae615e
--- /dev/null
+++ b/chapter11/docs/example2b-merged.svg
@@ -0,0 +1,130 @@
+<svg aria-label="Compiler graph" width="885" height="662" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 885 662" style="font-family: sans-serif;"><style>
+ html, body { height:100%; margin:0; font-family:sans-serif; }
+ .viewer { height:100%; display:grid; grid-template-rows:auto minmax(0,1fr) auto; }
+ .source { padding:8px; border-bottom:1px solid #ccc; }
+ #program { width:min(600px,80vw); vertical-align:middle; }
+ #status { margin-top:4px; }
+ #graph { min-height:0; overflow:hidden; position:relative; background:#fafbfc; }
+ #elk { width:100%; height:100%; }
+ #graph svg { display:block; }
+ .tools { display:flex; flex-wrap:wrap; align-items:center; gap:14px; margin-top:8px; font-size:12px; }
+ .hint { color:#616c78; }
+ .ctrl { color:#b63838; } .mem { color:#2867b2; } .data { color:#536477; }
+ .edge { fill:none; stroke-width:1.5; }
+ .edge.CTRL { stroke-width:2; }
+ .edge.ASSOC { stroke-dasharray:4 4; }
+ .edge.PARSER { stroke-dasharray:5 4; }
+ .parser rect { fill:#f6f0ff; stroke:#7956a5; stroke-width:1.5; stroke-dasharray:5 4; }
+ .edge.selected { stroke-width:3.5; }
+ .edge.bundle { stroke-width:4; }
+ .edge.bundle.selected { stroke-width:6; }
+ .edge-hit { fill:none; stroke:transparent; stroke-width:12; vector-effect:non-scaling-stroke; pointer-events:stroke; cursor:pointer; }
+ .edge-jump { fill:transparent; pointer-events:all; cursor:pointer; }
+ .node { cursor:pointer; }
+ .box { stroke:#758191; stroke-width:1; }
+ .node.held .box { stroke-dasharray:5 3; }
+ .node.near .box { stroke:#c18221; stroke-width:2; }
+ .node.focus .box { stroke:#9c4900; stroke-width:3; }
+ .node.selected .box { stroke:#1569b9; stroke-width:3; }
+ .node.folded .box { stroke-width:4; }
+ .node.folding .box { fill:#f4ccd7; }
+ .fold-tag { font-size:9px; font-weight:700; fill:#963751; }
+ .peep-area { fill:#fff3d9; fill-opacity:.8; stroke:#c18221; stroke-width:2; pointer-events:none; }
+ .node.peep-edit .box { stroke:#9c4900; stroke-width:3; }
+ .node.error .box { stroke:#b42318; stroke-width:4; }
+ #event.error { color:#b42318; font-weight:600; white-space:pre-wrap; overflow-wrap:anywhere; }
+ .peep-ghosts { pointer-events:none; }
+ .region-box { stroke:#9da9b8; stroke-width:1.5; }
+ .fold-btn { cursor:pointer; }
+ .fold-btn rect { fill:white; stroke:#596674; }
+ .fold-btn text { font-size:14px; fill:#152330; }
+ .fold-btn:focus rect { stroke:#1569b9; stroke-width:2; }
+ .shortcut { cursor:pointer; }
+ .shortcut path { fill:none; stroke-width:1.5; }
+ .shortcut rect { fill:#fff8ec; stroke:#b63838; stroke-dasharray:3 2; }
+ .shortcut text { font-size:11px; fill:#783030; }
+ .shortcut.selected rect, .shortcut:focus rect { stroke-width:2.5; }
+ .label { font-size:12px; fill:#152330; font-weight:600; }
+ .node-id { font-size:10px; fill:#596674; font-weight:400; }
+ .type { font-size:11px; fill:#455768; }
+ .port { stroke:#536477; stroke-width:1; }
+ .row { stroke:#b6afcf; stroke-width:1; }
+ .bind { font-size:12px; fill:#152330; }
+ .slot { font-size:10px; fill:#364352; paint-order:stroke; stroke:#fafbfc; stroke-width:3; }
+ #detail { position:absolute; top:8px; right:8px; margin:0; padding:12px; max-width:320px;
+ max-height:45%; overflow:auto; white-space:pre-wrap; overflow-wrap:anywhere;
+ background:#fffffff2; border:1px solid #bac5d0; border-radius:4px; font-size:12px; }
+ .controls { display:flex; flex-wrap:wrap; justify-content:center; align-items:center; gap:6px; padding:6px; }
+ .button { color:white; background:black; font-size:20px; min-width:30px; }
+ .button:disabled { background:grey; }
+ .count { font-size:20px; min-width:35px; text-align:center; }
+ #N { width:6ch; }
+ #scrub { width:clamp(120px,35vw,600px); }
+ </style><defs><marker id="arrow-CTRL" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#b63838"/></marker><marker id="arrow-DATA" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#536477"/></marker><marker id="arrow-MEM" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#2867b2"/></marker><marker id="arrow-ASSOC" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#9396a3"/></marker><marker id="arrow-PARSER" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#7956a5"/></marker></defs><rect width="100%" height="100%" fill="rgb(250, 251, 252)"/><g><g class="regions" style="opacity: 1;"/><rect class="peep-area" rx="36" style="opacity: 0;"/><g class="edges"><path class="edge ASSOC" id="e6i0" d="M248,46 C248,70 690,41 690,65" stroke="#9396a3" marker-start="url(#arrow-ASSOC)" style="opacity: 1;"><title>#6[0] → #1 · ASSOC</title></path><path class="edge MEM" id="e7i1" d="M185,118 L185,166" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#7[1] → #3 · MEM</title></path><path class="edge DATA" id="e7i2" d="M538,118 L538,140 Q538,148 530,148 L217,148 Q209,148 209,156 L209,166" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#7[2] → #5 · DATA</title></path><path class="edge DATA" id="e7i3" d="M690,118 L690,123 Q690,128 685,128 L241,128 Q233,128 233,136 L233,166" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#7[3] → #6 · DATA</title></path><path class="edge MEM" id="e8i1" d="M185,118 L185,130 Q185,138 193,138 L741,138 Q749,138 749,146 L749,166" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#8[1] → #3 · MEM</title></path><path class="edge DATA" id="e8i2" d="M538,118 L538,140 Q538,148 546,148 L765,148 Q773,148 773,156 L773,166" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#8[2] → #5 · DATA</title></path><path class="edge DATA" id="e8i3" d="M690,118 L690,123 Q690,128 695,128 L789,128 Q797,128 797,136 L797,166" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#8[3] → #6 · DATA</title></path><path class="edge ASSOC" id="e13i0" d="M248,46 C248,70 349,145 349,169" stroke="#9396a3" marker-start="url(#arrow-ASSOC)" style="opacity: 1;"><title>#13[0] → #1 · ASSOC</title></path><path class="edge CTRL" id="e14i0" d="M76,222 L76,270" stroke="#b63838" marker-start="url(#arrow-CTRL)" style="opacity: 1;"><title>#14[0] → #11 · CTRL</title></path><path class="edge MEM" id="e14i1" d="M197,222 L197,227 Q197,232 192,232 L108,232 Q100,232 100,240 L100,270" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#14[1] → #7 · MEM</title></path><path class="edge DATA" id="e14i2" d="M538,118 L538,140 Q538,148 530,148 L134,148 Q126,148 126,156 L126,241 Q126,242 125,242 L125,242 Q124,242 124,243 L124,270" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#14[2] → #5 · DATA</title></path><path class="edge DATA" id="e14i3" d="M349,222 L349,234 Q349,242 341,242 L156,242 Q148,242 148,250 L148,270" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#14[3] → #13 · DATA</title></path><path class="edge ASSOC" id="e15i0" d="M248,46 C248,70 609,145 609,169" stroke="#9396a3" marker-start="url(#arrow-ASSOC)" style="opacity: 1;"><title>#15[0] → #1 · ASSOC</title></path><path class="edge CTRL" id="e16i0" d="M485,222 L485,270" stroke="#b63838" marker-start="url(#arrow-CTRL)" style="opacity: 1;"><title>#16[0] → #12 · CTRL</title></path><path class="edge MEM" id="e16i1" d="M197,222 L197,227 Q197,232 202,232 L501,232 Q509,232 509,240 L509,270" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#16[1] → #7 · MEM</title></path><path class="edge DATA" id="e16i2" d="M538,118 L538,229.5 Q538,232 535.5,232 L535.5,232 Q533,232 533,234.5 L533,270" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#16[2] → #5 · DATA</title></path><path class="edge DATA" id="e16i3" d="M609,222 L609,227 Q609,232 604,232 L565,232 Q557,232 557,240 L557,270" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#16[3] → #15 · DATA</title></path><path class="edge MEM" id="e20i1" d="M112,326 L112,331 Q112,336 117,336 L473,336 Q481,336 481,344 L481,374" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#20[1] → #14 · MEM</title></path><path class="edge MEM" id="e20i2" d="M521,326 L521,374" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#20[2] → #16 · MEM</title></path><path class="edge MEM" id="e22i1" d="M185,118 L185,130 Q185,138 177,138 L32,138 Q24,138 24,146 L24,442 Q24,450 32,450 L705,450 Q713,450 713,458 L713,478" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#22[1] → #3 · MEM</title></path><path class="edge MEM" id="e22i2" d="M501,430 L501,435 Q501,440 506,440 L729,440 Q737,440 737,448 L737,478" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#22[2] → #20 · MEM</title></path><path class="edge MEM" id="e22i3" d="M761,222 L761,478" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#22[3] → #8 · MEM</title></path><path class="edge MEM" id="e23i1" d="M725,534 L725,539 Q725,544 730,544 L793,544 Q801,544 801,552 L801,582" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#23[1] → #22 · MEM</title></path><path class="edge DATA" id="e23i2" d="M538,118 L538,140 Q538,148 546,148 L823,148 Q831,148 831,156 L831,582" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#23[2] → #5 · DATA</title></path></g><g class="edge-hits"/><g class="parser" style="opacity: 1;"/><g class="nodes"><g class="node" id="n1" data-id="1" transform="translate(125,24)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Start</tspan><tspan class="node-id">  #1</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#1 Start
+Type not computed
+
+</title></g><g class="node" id="n3" data-id="3" transform="translate(125,68)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>$mem</tspan><tspan class="node-id">  #3/1</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#3 $mem
+Projection 1 of #1
+Type not computed
+
+[0] → #1 MEM</title></g><g class="node" id="n5" data-id="5" transform="translate(478,68)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>new Point</tspan><tspan class="node-id">  #5</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#5 new Point
+Type not computed
+
+[0] → — CTRL</title><circle class="port" cx="60" cy="-3" r="3" fill="white"/><text class="slot" x="60" y="-10" text-anchor="middle">0</text></g><g class="node" id="n6" data-id="6" transform="translate(630,68)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>#0</tspan><tspan class="node-id">  #6</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#6 #0
+Type not computed
+
+[0] → #1 ASSOC</title><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><text class="slot" x="60" y="-10" text-anchor="middle">0</text></g><g class="node" id="n7" data-id="7" transform="translate(137,172)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Store p.x</tspan><tspan class="node-id">  #7</tspan></text><text class="type" text-anchor="middle" y="35" x="60">MEM#2</text><title>#7 Store p.x
+MEM#2
+
+[0] → — CTRL
+[1] → #3 MEM
+[2] → #5 DATA
+[3] → #6 DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n8" data-id="8" transform="translate(701,172)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Store p.y</tspan><tspan class="node-id">  #8</tspan></text><text class="type" text-anchor="middle" y="35" x="60">MEM#3</text><title>#8 Store p.y
+MEM#3
+
+[0] → — CTRL
+[1] → #3 MEM
+[2] → #5 DATA
+[3] → #6 DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n11" data-id="11" transform="translate(35,190)" style="opacity: 1;"><path class="box" d="M0,0H81V26H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="40.5" y="17"><tspan>True</tspan><tspan class="node-id">  #11/0</tspan></text><text class="type" text-anchor="middle" y="35" x="40.5"/><title>#11 True
+Projection 0 of #0
+Type not computed
+
+</title></g><g class="node" id="n12" data-id="12" transform="translate(441,190)" style="opacity: 1;"><path class="box" d="M0,0H87V26H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="43.5" y="17"><tspan>False</tspan><tspan class="node-id">  #12/1</tspan></text><text class="type" text-anchor="middle" y="35" x="43.5"/><title>#12 False
+Projection 1 of #0
+Type not computed
+
+</title></g><g class="node" id="n13" data-id="13" transform="translate(289,172)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>#3</tspan><tspan class="node-id">  #13</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#13 #3
+Type not computed
+
+[0] → #1 ASSOC</title><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><text class="slot" x="60" y="-10" text-anchor="middle">0</text></g><g class="node" id="n14" data-id="14" transform="translate(52,276)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Store p.x</tspan><tspan class="node-id">  #14</tspan></text><text class="type" text-anchor="middle" y="35" x="60">MEM#2</text><title>#14 Store p.x
+MEM#2
+
+[0] → #11 CTRL
+[1] → #7 MEM
+[2] → #5 DATA
+[3] → #13 DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="#536477"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n15" data-id="15" transform="translate(549,172)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>#4</tspan><tspan class="node-id">  #15</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#15 #4
+Type not computed
+
+[0] → #1 ASSOC</title><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><text class="slot" x="60" y="-10" text-anchor="middle">0</text></g><g class="node" id="n16" data-id="16" transform="translate(461,276)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Store p.x</tspan><tspan class="node-id">  #16</tspan></text><text class="type" text-anchor="middle" y="35" x="60">MEM#2</text><title>#16 Store p.x
+MEM#2
+
+[0] → #12 CTRL
+[1] → #7 MEM
+[2] → #5 DATA
+[3] → #15 DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="#536477"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n20" data-id="20" transform="translate(441,380)" style="opacity: 1;"><path class="box" d="M12,0H108L120,22L108,44H12L0,22Z" fill="#f5e4fa"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>MemPhi x</tspan><tspan class="node-id">  #20</tspan></text><text class="type" text-anchor="middle" y="35" x="60">MEM#2</text><title>#20 MemPhi x
+MEM#2
+
+[0] → — ASSOC
+[1] → #14 MEM
+[2] → #16 MEM</title><circle class="port" cx="0" cy="-3" r="3" fill="white"/><circle class="port" cx="40" cy="-3" r="3" fill="#536477"/><circle class="port" cx="80" cy="-3" r="3" fill="#536477"/><text class="slot" x="0" y="-10" text-anchor="middle">0</text><text class="slot" x="40" y="-10" text-anchor="middle">1</text><text class="slot" x="80" y="-10" text-anchor="middle">2</text></g><g class="node" id="n22" data-id="22" transform="translate(665,484)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>MemMerge</tspan><tspan class="node-id">  #22</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#22 MemMerge
+Type not computed
+
+[0] → — CTRL
+[1] → #3 MEM
+[2] → #20 MEM
+[3] → #8 MEM</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n23" data-id="23" transform="translate(741,588)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Return</tspan><tspan class="node-id">  #23</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#23 Return
+Type not computed
+
+[0] → — CTRL
+[1] → #22 MEM
+[2] → #5 DATA</title><circle class="port" cx="30" cy="-3" r="3" fill="white"/><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><circle class="port" cx="90" cy="-3" r="3" fill="#536477"/><text class="slot" x="30" y="-10" text-anchor="middle">0</text><text class="slot" x="60" y="-10" text-anchor="middle">1</text><text class="slot" x="90" y="-10" text-anchor="middle">2</text></g></g><g class="region-heads" style="opacity: 1;"/><g class="shortcuts" style="opacity: 1;"/><g class="peep-ghosts" pointer-events="none"/></g></svg>
diff --git a/chapter11/docs/example2b-split-y.json b/chapter11/docs/example2b-split-y.json
new file mode 100644
index 00000000..fc3c8758
--- /dev/null
+++ b/chapter11/docs/example2b-split-y.json
@@ -0,0 +1,486 @@
+{
+ "ver": 1,
+ "comp": "chapter11/docs/example2b-split-y.svg",
+ "step": 3,
+ "roots": [
+ 23
+ ],
+ "scope": 0,
+ "nodes": [
+ {
+ "id": 1,
+ "label": "Start",
+ "type": null,
+ "kind": "CTRL",
+ "edges": [],
+ "proj": null
+ },
+ {
+ "id": 3,
+ "label": "$mem",
+ "type": null,
+ "kind": "MEM",
+ "edges": [
+ {
+ "idx": 0,
+ "def": 1,
+ "role": "MEM",
+ "label": null
+ }
+ ],
+ "proj": {
+ "par": 1,
+ "idx": 1
+ }
+ },
+ {
+ "id": 5,
+ "label": "new Point",
+ "type": null,
+ "kind": "DATA",
+ "edges": [
+ {
+ "idx": 0,
+ "def": 0,
+ "role": "CTRL",
+ "label": null
+ }
+ ],
+ "proj": null
+ },
+ {
+ "id": 6,
+ "label": "#0",
+ "type": null,
+ "kind": "DATA",
+ "edges": [
+ {
+ "idx": 0,
+ "def": 1,
+ "role": "ASSOC",
+ "label": null
+ }
+ ],
+ "proj": null
+ },
+ {
+ "id": 7,
+ "label": "Store p.x",
+ "type": "MEM#2",
+ "kind": "MEM",
+ "edges": [
+ {
+ "idx": 0,
+ "def": 0,
+ "role": "CTRL",
+ "label": null
+ },
+ {
+ "idx": 1,
+ "def": 3,
+ "role": "MEM",
+ "label": null
+ },
+ {
+ "idx": 2,
+ "def": 5,
+ "role": "DATA",
+ "label": null
+ },
+ {
+ "idx": 3,
+ "def": 6,
+ "role": "DATA",
+ "label": null
+ }
+ ],
+ "proj": null
+ },
+ {
+ "id": 8,
+ "label": "Store p.y",
+ "type": "MEM#3",
+ "kind": "MEM",
+ "edges": [
+ {
+ "idx": 0,
+ "def": 0,
+ "role": "CTRL",
+ "label": null
+ },
+ {
+ "idx": 1,
+ "def": 3,
+ "role": "MEM",
+ "label": null
+ },
+ {
+ "idx": 2,
+ "def": 5,
+ "role": "DATA",
+ "label": null
+ },
+ {
+ "idx": 3,
+ "def": 6,
+ "role": "DATA",
+ "label": null
+ }
+ ],
+ "proj": null
+ },
+ {
+ "id": 11,
+ "label": "True",
+ "type": null,
+ "kind": "CTRL",
+ "edges": [],
+ "proj": {
+ "par": 0,
+ "idx": 0
+ }
+ },
+ {
+ "id": 12,
+ "label": "False",
+ "type": null,
+ "kind": "CTRL",
+ "edges": [],
+ "proj": {
+ "par": 0,
+ "idx": 1
+ }
+ },
+ {
+ "id": 13,
+ "label": "#3",
+ "type": null,
+ "kind": "DATA",
+ "edges": [
+ {
+ "idx": 0,
+ "def": 1,
+ "role": "ASSOC",
+ "label": null
+ }
+ ],
+ "proj": null
+ },
+ {
+ "id": 14,
+ "label": "Store p.x",
+ "type": "MEM#2",
+ "kind": "MEM",
+ "edges": [
+ {
+ "idx": 0,
+ "def": 11,
+ "role": "CTRL",
+ "label": null
+ },
+ {
+ "idx": 1,
+ "def": 7,
+ "role": "MEM",
+ "label": null
+ },
+ {
+ "idx": 2,
+ "def": 5,
+ "role": "DATA",
+ "label": null
+ },
+ {
+ "idx": 3,
+ "def": 13,
+ "role": "DATA",
+ "label": null
+ }
+ ],
+ "proj": null
+ },
+ {
+ "id": 15,
+ "label": "#4",
+ "type": null,
+ "kind": "DATA",
+ "edges": [
+ {
+ "idx": 0,
+ "def": 1,
+ "role": "ASSOC",
+ "label": null
+ }
+ ],
+ "proj": null
+ },
+ {
+ "id": 16,
+ "label": "Store p.x",
+ "type": "MEM#2",
+ "kind": "MEM",
+ "edges": [
+ {
+ "idx": 0,
+ "def": 12,
+ "role": "CTRL",
+ "label": null
+ },
+ {
+ "idx": 1,
+ "def": 7,
+ "role": "MEM",
+ "label": null
+ },
+ {
+ "idx": 2,
+ "def": 5,
+ "role": "DATA",
+ "label": null
+ },
+ {
+ "idx": 3,
+ "def": 15,
+ "role": "DATA",
+ "label": null
+ }
+ ],
+ "proj": null
+ },
+ {
+ "id": 17,
+ "label": "MemMerge",
+ "type": null,
+ "kind": "MEM",
+ "edges": [
+ {
+ "idx": 0,
+ "def": 0,
+ "role": "CTRL",
+ "label": null
+ },
+ {
+ "idx": 1,
+ "def": 3,
+ "role": "MEM",
+ "label": null
+ },
+ {
+ "idx": 2,
+ "def": 14,
+ "role": "MEM",
+ "label": null
+ },
+ {
+ "idx": 3,
+ "def": 8,
+ "role": "MEM",
+ "label": null
+ }
+ ],
+ "proj": null
+ },
+ {
+ "id": 18,
+ "label": "MemMerge",
+ "type": null,
+ "kind": "MEM",
+ "edges": [
+ {
+ "idx": 0,
+ "def": 0,
+ "role": "CTRL",
+ "label": null
+ },
+ {
+ "idx": 1,
+ "def": 3,
+ "role": "MEM",
+ "label": null
+ },
+ {
+ "idx": 2,
+ "def": 16,
+ "role": "MEM",
+ "label": null
+ },
+ {
+ "idx": 3,
+ "def": 8,
+ "role": "MEM",
+ "label": null
+ }
+ ],
+ "proj": null
+ },
+ {
+ "id": 20,
+ "label": "MemPhi x",
+ "type": "MEM#2",
+ "kind": "PHI",
+ "edges": [
+ {
+ "idx": 0,
+ "def": 0,
+ "role": "ASSOC",
+ "label": null
+ },
+ {
+ "idx": 1,
+ "def": 14,
+ "role": "MEM",
+ "label": null
+ },
+ {
+ "idx": 2,
+ "def": 16,
+ "role": "MEM",
+ "label": null
+ }
+ ],
+ "proj": null
+ },
+ {
+ "id": 22,
+ "label": "MemMerge",
+ "type": null,
+ "kind": "MEM",
+ "edges": [
+ {
+ "idx": 0,
+ "def": 0,
+ "role": "CTRL",
+ "label": null
+ },
+ {
+ "idx": 1,
+ "def": 26,
+ "role": "MEM",
+ "label": null
+ },
+ {
+ "idx": 2,
+ "def": 20,
+ "role": "MEM",
+ "label": null
+ }
+ ],
+ "proj": null
+ },
+ {
+ "id": 23,
+ "label": "Return",
+ "type": null,
+ "kind": "CTRL",
+ "edges": [
+ {
+ "idx": 0,
+ "def": 0,
+ "role": "CTRL",
+ "label": null
+ },
+ {
+ "idx": 1,
+ "def": 22,
+ "role": "MEM",
+ "label": null
+ },
+ {
+ "idx": 2,
+ "def": 5,
+ "role": "DATA",
+ "label": null
+ }
+ ],
+ "proj": null
+ },
+ {
+ "id": 24,
+ "label": "MemPhi y",
+ "type": "MEM#3",
+ "kind": "PHI",
+ "edges": [
+ {
+ "idx": 0,
+ "def": 0,
+ "role": "ASSOC",
+ "label": null
+ },
+ {
+ "idx": 1,
+ "def": 8,
+ "role": "MEM",
+ "label": null
+ },
+ {
+ "idx": 2,
+ "def": 8,
+ "role": "MEM",
+ "label": null
+ }
+ ],
+ "proj": null
+ },
+ {
+ "id": 25,
+ "label": "BulkMemPhi except x,y",
+ "type": null,
+ "kind": "PHI",
+ "edges": [
+ {
+ "idx": 0,
+ "def": 0,
+ "role": "ASSOC",
+ "label": null
+ },
+ {
+ "idx": 1,
+ "def": 17,
+ "role": "MEM",
+ "label": null
+ },
+ {
+ "idx": 2,
+ "def": 18,
+ "role": "MEM",
+ "label": null
+ }
+ ],
+ "proj": null
+ },
+ {
+ "id": 26,
+ "label": "MemMerge",
+ "type": null,
+ "kind": "MEM",
+ "edges": [
+ {
+ "idx": 0,
+ "def": 0,
+ "role": "CTRL",
+ "label": null
+ },
+ {
+ "idx": 1,
+ "def": 25,
+ "role": "MEM",
+ "label": null
+ },
+ {
+ "idx": 2,
+ "def": 20,
+ "role": "MEM",
+ "label": null
+ },
+ {
+ "idx": 3,
+ "def": 24,
+ "role": "MEM",
+ "label": null
+ }
+ ],
+ "proj": null
+ }
+ ],
+ "groups": []
+}
diff --git a/chapter11/docs/example2b-split-y.svg b/chapter11/docs/example2b-split-y.svg
new file mode 100644
index 00000000..f4d4b9b6
--- /dev/null
+++ b/chapter11/docs/example2b-split-y.svg
@@ -0,0 +1,157 @@
+<svg aria-label="Compiler graph" width="945" height="872" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 945 872" style="font-family: sans-serif;"><style>
+ html, body { height:100%; margin:0; font-family:sans-serif; }
+ .viewer { height:100%; display:grid; grid-template-rows:auto minmax(0,1fr) auto; }
+ .source { padding:8px; border-bottom:1px solid #ccc; }
+ #program { width:min(600px,80vw); vertical-align:middle; }
+ #status { margin-top:4px; }
+ #graph { min-height:0; overflow:hidden; position:relative; background:#fafbfc; }
+ #elk { width:100%; height:100%; }
+ #graph svg { display:block; }
+ .tools { display:flex; flex-wrap:wrap; align-items:center; gap:14px; margin-top:8px; font-size:12px; }
+ .hint { color:#616c78; }
+ .ctrl { color:#b63838; } .mem { color:#2867b2; } .data { color:#536477; }
+ .edge { fill:none; stroke-width:1.5; }
+ .edge.CTRL { stroke-width:2; }
+ .edge.ASSOC { stroke-dasharray:4 4; }
+ .edge.PARSER { stroke-dasharray:5 4; }
+ .parser rect { fill:#f6f0ff; stroke:#7956a5; stroke-width:1.5; stroke-dasharray:5 4; }
+ .edge.selected { stroke-width:3.5; }
+ .edge.bundle { stroke-width:4; }
+ .edge.bundle.selected { stroke-width:6; }
+ .edge-hit { fill:none; stroke:transparent; stroke-width:12; vector-effect:non-scaling-stroke; pointer-events:stroke; cursor:pointer; }
+ .edge-jump { fill:transparent; pointer-events:all; cursor:pointer; }
+ .node { cursor:pointer; }
+ .box { stroke:#758191; stroke-width:1; }
+ .node.held .box { stroke-dasharray:5 3; }
+ .node.near .box { stroke:#c18221; stroke-width:2; }
+ .node.focus .box { stroke:#9c4900; stroke-width:3; }
+ .node.selected .box { stroke:#1569b9; stroke-width:3; }
+ .node.folded .box { stroke-width:4; }
+ .node.folding .box { fill:#f4ccd7; }
+ .fold-tag { font-size:9px; font-weight:700; fill:#963751; }
+ .peep-area { fill:#fff3d9; fill-opacity:.8; stroke:#c18221; stroke-width:2; pointer-events:none; }
+ .node.peep-edit .box { stroke:#9c4900; stroke-width:3; }
+ .node.error .box { stroke:#b42318; stroke-width:4; }
+ #event.error { color:#b42318; font-weight:600; white-space:pre-wrap; overflow-wrap:anywhere; }
+ .peep-ghosts { pointer-events:none; }
+ .region-box { stroke:#9da9b8; stroke-width:1.5; }
+ .fold-btn { cursor:pointer; }
+ .fold-btn rect { fill:white; stroke:#596674; }
+ .fold-btn text { font-size:14px; fill:#152330; }
+ .fold-btn:focus rect { stroke:#1569b9; stroke-width:2; }
+ .shortcut { cursor:pointer; }
+ .shortcut path { fill:none; stroke-width:1.5; }
+ .shortcut rect { fill:#fff8ec; stroke:#b63838; stroke-dasharray:3 2; }
+ .shortcut text { font-size:11px; fill:#783030; }
+ .shortcut.selected rect, .shortcut:focus rect { stroke-width:2.5; }
+ .label { font-size:12px; fill:#152330; font-weight:600; }
+ .node-id { font-size:10px; fill:#596674; font-weight:400; }
+ .type { font-size:11px; fill:#455768; }
+ .port { stroke:#536477; stroke-width:1; }
+ .row { stroke:#b6afcf; stroke-width:1; }
+ .bind { font-size:12px; fill:#152330; }
+ .slot { font-size:10px; fill:#364352; paint-order:stroke; stroke:#fafbfc; stroke-width:3; }
+ #detail { position:absolute; top:8px; right:8px; margin:0; padding:12px; max-width:320px;
+ max-height:45%; overflow:auto; white-space:pre-wrap; overflow-wrap:anywhere;
+ background:#fffffff2; border:1px solid #bac5d0; border-radius:4px; font-size:12px; }
+ .controls { display:flex; flex-wrap:wrap; justify-content:center; align-items:center; gap:6px; padding:6px; }
+ .button { color:white; background:black; font-size:20px; min-width:30px; }
+ .button:disabled { background:grey; }
+ .count { font-size:20px; min-width:35px; text-align:center; }
+ #N { width:6ch; }
+ #scrub { width:clamp(120px,35vw,600px); }
+ </style><defs><marker id="arrow-CTRL" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#b63838"/></marker><marker id="arrow-DATA" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#536477"/></marker><marker id="arrow-MEM" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#2867b2"/></marker><marker id="arrow-ASSOC" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#9396a3"/></marker><marker id="arrow-PARSER" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#7956a5"/></marker></defs><rect width="100%" height="100%" fill="rgb(250, 251, 252)"/><g><g class="regions" style="opacity: 1;"/><rect class="peep-area" rx="36" style="opacity: 0;"/><g class="edges"><path class="edge ASSOC" id="e6i0" d="M147,46 C147,70 716,41 716,65" stroke="#9396a3" marker-start="url(#arrow-ASSOC)" style="opacity: 1;"><title>#6[0] → #1 · ASSOC</title></path><path class="edge MEM" id="e7i1" d="M84,118 L84,140 Q84,148 92,148 L660,148 Q668,148 668,156 L668,166" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#7[1] → #3 · MEM</title></path><path class="edge DATA" id="e7i2" d="M564,118 L564,123 Q564,128 569,128 L684,128 Q692,128 692,136 L692,166" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#7[2] → #5 · DATA</title></path><path class="edge DATA" id="e7i3" d="M716,118 L716,166" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#7[3] → #6 · DATA</title></path><path class="edge MEM" id="e8i1" d="M84,118 L84,140 Q84,148 92,148 L389,148 Q397,148 397,156 L397,166" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#8[1] → #3 · MEM</title></path><path class="edge DATA" id="e8i2" d="M564,118 L564,123 Q564,128 559,128 L429,128 Q421,128 421,136 L421,166" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#8[2] → #5 · DATA</title></path><path class="edge DATA" id="e8i3" d="M716,118 L716,130 Q716,138 708,138 L453,138 Q445,138 445,146 L445,166" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#8[3] → #6 · DATA</title></path><path class="edge ASSOC" id="e13i0" d="M147,46 C147,70 257,145 257,169" stroke="#9396a3" marker-start="url(#arrow-ASSOC)" style="opacity: 1;"><title>#13[0] → #1 · ASSOC</title></path><path class="edge CTRL" id="e14i0" d="M136,222 L136,270" stroke="#b63838" marker-start="url(#arrow-CTRL)" style="opacity: 1;"><title>#14[0] → #11 · CTRL</title></path><path class="edge MEM" id="e14i1" d="M680,222 L680,227 Q680,232 675,232 L168,232 Q160,232 160,240 L160,270" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#14[1] → #7 · MEM</title></path><path class="edge DATA" id="e14i2" d="M564,118 L564,123 Q564,128 559,128 L194,128 Q186,128 186,136 L186,241 Q186,242 185,242 L185,242 Q184,242 184,243 L184,270" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#14[2] → #5 · DATA</title></path><path class="edge DATA" id="e14i3" d="M257,222 L257,234 Q257,242 249,242 L216,242 Q208,242 208,250 L208,270" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#14[3] → #13 · DATA</title></path><path class="edge ASSOC" id="e15i0" d="M147,46 C147,70 821,145 821,169" stroke="#9396a3" marker-start="url(#arrow-ASSOC)" style="opacity: 1;"><title>#15[0] → #1 · ASSOC</title></path><path class="edge CTRL" id="e16i0" d="M545,222 L545,270" stroke="#b63838" marker-start="url(#arrow-CTRL)" style="opacity: 1;"><title>#16[0] → #12 · CTRL</title></path><path class="edge MEM" id="e16i1" d="M680,222 L680,227 Q680,232 675,232 L577,232 Q569,232 569,240 L569,270" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#16[1] → #7 · MEM</title></path><path class="edge DATA" id="e16i2" d="M564,118 L564,123 Q564,128 569,128 L742,128 Q750,128 750,136 L750,234 Q750,242 742,242 L601,242 Q593,242 593,250 L593,270" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#16[2] → #5 · DATA</title></path><path class="edge DATA" id="e16i3" d="M821,222 L821,244 Q821,252 813,252 L625,252 Q617,252 617,260 L617,270" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#16[3] → #15 · DATA</title></path><path class="edge MEM" id="e17i1" d="M84,118 L84,358 Q84,366 92,366 L143,366 Q148,366 148,371 L148,376" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#17[1] → #3 · MEM</title></path><path class="edge MEM" id="e17i2" d="M172,326 L172,376" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#17[2] → #14 · MEM</title></path><path class="edge MEM" id="e17i3" d="M409,222 L409,234 Q409,242 401,242 L356,242 Q348,242 348,250 L348,348 Q348,356 340,356 L204,356 Q196,356 196,364 L196,376" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#17[3] → #8 · MEM</title></path><path class="edge MEM" id="e18i1" d="M84,118 L84,358 Q84,366 92,366 L295,366 Q300,366 300,371 L300,376" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#18[1] → #3 · MEM</title></path><path class="edge MEM" id="e18i2" d="M581,326 L581,358 Q581,366 573,366 L329,366 Q324,366 324,371 L324,376" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#18[2] → #16 · MEM</title></path><path class="edge MEM" id="e18i3" d="M409,222 L409,234 Q409,242 401,242 L356,242 Q348,242 348,250 L348,376" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#18[3] → #8 · MEM</title></path><path class="edge MEM" id="e20i1" d="M172,326 L172,338 Q172,346 180,346 L439,346 Q447,346 447,354 L447,376" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#20[1] → #14 · MEM</title></path><path class="edge MEM" id="e20i2" d="M581,326 L581,358 Q581,366 573,366 L492,366 Q487,366 487,371 L487,376" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#20[2] → #16 · MEM</title></path><path class="edge MEM" id="e22i1" d="M397,640 L397,645 Q397,650 402,650 L429,650 Q437,650 437,658 L437,688" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#22[1] → #26 · MEM</title></path><path class="edge MEM" id="e22i2" d="M467,432 L467,688" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#22[2] → #20 · MEM</title></path><path class="edge MEM" id="e23i1" d="M437,744 L437,749 Q437,754 442,754 L853,754 Q861,754 861,762 L861,792" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#23[1] → #22 · MEM</title></path><path class="edge DATA" id="e23i2" d="M564,118 L564,123 Q564,128 569,128 L883,128 Q891,128 891,136 L891,792" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#23[2] → #5 · DATA</title></path><path class="edge MEM" id="e24i1" d="M409,222 L409,270" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#24[1] → #8 · MEM</title></path><path class="edge MEM" id="e24i2" d="M409,222 L409,234 Q409,242 417,242 L441,242 Q449,242 449,250 L449,270" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#24[2] → #8 · MEM</title></path><path class="edge MEM" id="e25i1" d="M160,432 L160,437 Q160,442 165,442 L247,442 Q255,442 255,450 L255,480" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#25[1] → #17 · MEM</title></path><path class="edge MEM" id="e25i2" d="M312,432 L312,480" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#25[2] → #18 · MEM</title></path><path class="edge MEM" id="e26i1" d="M284,536 L284,541 Q284,546 289,546 L377,546 Q385,546 385,554 L385,584" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#26[1] → #25 · MEM</title></path><path class="edge MEM" id="e26i2" d="M467,432 L467,538 Q467,546 459,546 L417,546 Q409,546 409,554 L409,584" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#26[2] → #20 · MEM</title></path><path class="edge MEM" id="e26i3" d="M429,326 L429,331 Q429,336 434,336 L529,336 Q537,336 537,344 L537,548 Q537,556 529,556 L441,556 Q433,556 433,564 L433,584" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#26[3] → #24 · MEM</title></path></g><g class="edge-hits"/><g class="parser" style="opacity: 1;"/><g class="nodes"><g class="node" id="n1" data-id="1" transform="translate(24,24)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Start</tspan><tspan class="node-id">  #1</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#1 Start
+Type not computed
+
+</title></g><g class="node" id="n3" data-id="3" transform="translate(24,68)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>$mem</tspan><tspan class="node-id">  #3/1</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#3 $mem
+Projection 1 of #1
+Type not computed
+
+[0] → #1 MEM</title></g><g class="node" id="n5" data-id="5" transform="translate(504,68)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>new Point</tspan><tspan class="node-id">  #5</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#5 new Point
+Type not computed
+
+[0] → — CTRL</title><circle class="port" cx="60" cy="-3" r="3" fill="white"/><text class="slot" x="60" y="-10" text-anchor="middle">0</text></g><g class="node" id="n6" data-id="6" transform="translate(656,68)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>#0</tspan><tspan class="node-id">  #6</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#6 #0
+Type not computed
+
+[0] → #1 ASSOC</title><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><text class="slot" x="60" y="-10" text-anchor="middle">0</text></g><g class="node" id="n7" data-id="7" transform="translate(620,172)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Store p.x</tspan><tspan class="node-id">  #7</tspan></text><text class="type" text-anchor="middle" y="35" x="60">MEM#2</text><title>#7 Store p.x
+MEM#2
+
+[0] → — CTRL
+[1] → #3 MEM
+[2] → #5 DATA
+[3] → #6 DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n8" data-id="8" transform="translate(349,172)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Store p.y</tspan><tspan class="node-id">  #8</tspan></text><text class="type" text-anchor="middle" y="35" x="60">MEM#3</text><title>#8 Store p.y
+MEM#3
+
+[0] → — CTRL
+[1] → #3 MEM
+[2] → #5 DATA
+[3] → #6 DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n11" data-id="11" transform="translate(95,190)" style="opacity: 1;"><path class="box" d="M0,0H81V26H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="40.5" y="17"><tspan>True</tspan><tspan class="node-id">  #11/0</tspan></text><text class="type" text-anchor="middle" y="35" x="40.5"/><title>#11 True
+Projection 0 of #0
+Type not computed
+
+</title></g><g class="node" id="n12" data-id="12" transform="translate(501,190)" style="opacity: 1;"><path class="box" d="M0,0H87V26H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="43.5" y="17"><tspan>False</tspan><tspan class="node-id">  #12/1</tspan></text><text class="type" text-anchor="middle" y="35" x="43.5"/><title>#12 False
+Projection 1 of #0
+Type not computed
+
+</title></g><g class="node" id="n13" data-id="13" transform="translate(197,172)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>#3</tspan><tspan class="node-id">  #13</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#13 #3
+Type not computed
+
+[0] → #1 ASSOC</title><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><text class="slot" x="60" y="-10" text-anchor="middle">0</text></g><g class="node" id="n14" data-id="14" transform="translate(112,276)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Store p.x</tspan><tspan class="node-id">  #14</tspan></text><text class="type" text-anchor="middle" y="35" x="60">MEM#2</text><title>#14 Store p.x
+MEM#2
+
+[0] → #11 CTRL
+[1] → #7 MEM
+[2] → #5 DATA
+[3] → #13 DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="#536477"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n15" data-id="15" transform="translate(761,172)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>#4</tspan><tspan class="node-id">  #15</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#15 #4
+Type not computed
+
+[0] → #1 ASSOC</title><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><text class="slot" x="60" y="-10" text-anchor="middle">0</text></g><g class="node" id="n16" data-id="16" transform="translate(521,276)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Store p.x</tspan><tspan class="node-id">  #16</tspan></text><text class="type" text-anchor="middle" y="35" x="60">MEM#2</text><title>#16 Store p.x
+MEM#2
+
+[0] → #12 CTRL
+[1] → #7 MEM
+[2] → #5 DATA
+[3] → #15 DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="#536477"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n17" data-id="17" transform="translate(100,382)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>MemMerge</tspan><tspan class="node-id">  #17</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#17 MemMerge
+Type not computed
+
+[0] → — CTRL
+[1] → #3 MEM
+[2] → #14 MEM
+[3] → #8 MEM</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n18" data-id="18" transform="translate(252,382)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>MemMerge</tspan><tspan class="node-id">  #18</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#18 MemMerge
+Type not computed
+
+[0] → — CTRL
+[1] → #3 MEM
+[2] → #16 MEM
+[3] → #8 MEM</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n20" data-id="20" transform="translate(407,382)" style="opacity: 1;"><path class="box" d="M12,0H108L120,22L108,44H12L0,22Z" fill="#f5e4fa"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>MemPhi x</tspan><tspan class="node-id">  #20</tspan></text><text class="type" text-anchor="middle" y="35" x="60">MEM#2</text><title>#20 MemPhi x
+MEM#2
+
+[0] → — ASSOC
+[1] → #14 MEM
+[2] → #16 MEM</title><circle class="port" cx="0" cy="-3" r="3" fill="white"/><circle class="port" cx="40" cy="-3" r="3" fill="#536477"/><circle class="port" cx="80" cy="-3" r="3" fill="#536477"/><text class="slot" x="0" y="-10" text-anchor="middle">0</text><text class="slot" x="40" y="-10" text-anchor="middle">1</text><text class="slot" x="80" y="-10" text-anchor="middle">2</text></g><g class="node" id="n22" data-id="22" transform="translate(377,694)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>MemMerge</tspan><tspan class="node-id">  #22</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#22 MemMerge
+Type not computed
+
+[0] → — CTRL
+[1] → #26 MEM
+[2] → #20 MEM</title><circle class="port" cx="30" cy="-3" r="3" fill="white"/><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><circle class="port" cx="90" cy="-3" r="3" fill="#536477"/><text class="slot" x="30" y="-10" text-anchor="middle">0</text><text class="slot" x="60" y="-10" text-anchor="middle">1</text><text class="slot" x="90" y="-10" text-anchor="middle">2</text></g><g class="node" id="n23" data-id="23" transform="translate(801,798)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Return</tspan><tspan class="node-id">  #23</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#23 Return
+Type not computed
+
+[0] → — CTRL
+[1] → #22 MEM
+[2] → #5 DATA</title><circle class="port" cx="30" cy="-3" r="3" fill="white"/><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><circle class="port" cx="90" cy="-3" r="3" fill="#536477"/><text class="slot" x="30" y="-10" text-anchor="middle">0</text><text class="slot" x="60" y="-10" text-anchor="middle">1</text><text class="slot" x="90" y="-10" text-anchor="middle">2</text></g><g class="node" id="n24" data-id="24" transform="translate(369,276)" style="opacity: 1;"><path class="box" d="M12,0H108L120,22L108,44H12L0,22Z" fill="#f5e4fa"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>MemPhi y</tspan><tspan class="node-id">  #24</tspan></text><text class="type" text-anchor="middle" y="35" x="60">MEM#3</text><title>#24 MemPhi y
+MEM#3
+
+[0] → — ASSOC
+[1] → #8 MEM
+[2] → #8 MEM</title><circle class="port" cx="0" cy="-3" r="3" fill="white"/><circle class="port" cx="40" cy="-3" r="3" fill="#536477"/><circle class="port" cx="80" cy="-3" r="3" fill="#536477"/><text class="slot" x="0" y="-10" text-anchor="middle">0</text><text class="slot" x="40" y="-10" text-anchor="middle">1</text><text class="slot" x="80" y="-10" text-anchor="middle">2</text></g><g class="node" id="n25" data-id="25" transform="translate(197,486)" style="opacity: 1;"><path class="box" d="M12,0H161L173,22L161,44H12L0,22Z" fill="#f5e4fa"/><text class="label" text-anchor="middle" x="86.5" y="18"><tspan>BulkMemPhi except x,y</tspan><tspan class="node-id">  #25</tspan></text><text class="type" text-anchor="middle" y="35" x="86.5"/><title>#25 BulkMemPhi except x,y
+Type not computed
+
+[0] → — ASSOC
+[1] → #17 MEM
+[2] → #18 MEM</title><circle class="port" cx="0" cy="-3" r="3" fill="white"/><circle class="port" cx="58" cy="-3" r="3" fill="#536477"/><circle class="port" cx="115" cy="-3" r="3" fill="#536477"/><text class="slot" x="0" y="-10" text-anchor="middle">0</text><text class="slot" x="58" y="-10" text-anchor="middle">1</text><text class="slot" x="115" y="-10" text-anchor="middle">2</text></g><g class="node" id="n26" data-id="26" transform="translate(337,590)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>MemMerge</tspan><tspan class="node-id">  #26</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#26 MemMerge
+Type not computed
+
+[0] → — CTRL
+[1] → #25 MEM
+[2] → #20 MEM
+[3] → #24 MEM</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g></g><g class="region-heads" style="opacity: 1;"/><g class="shortcuts" style="opacity: 1;"/><g class="peep-ghosts" pointer-events="none"/></g></svg>
diff --git a/chapter11/docs/example2b.gv b/chapter11/docs/example2b.gv
new file mode 100644
index 00000000..39b87a6a
--- /dev/null
+++ b/chapter11/docs/example2b.gv
@@ -0,0 +1,19 @@
+digraph Memory {
+ // IR styles match graph/web/render.js; arrows are use -> definition.
+ graph [bgcolor="#fafbfc" fontname="Helvetica" nodesep=0.35 ranksep=0.55 splines=ortho];
+ node [fontname="Helvetica" fontsize=12 color="#758191" fontcolor="#152330" shape=box style="rounded,filled" fillcolor="#edf3f7"];
+ edge [fontname="Helvetica" fontsize=9 color="#536477" fontcolor="#364352" arrowsize=0.7 penwidth=1.5];
+
+ rankdir=RL;
+
+ P [label="MemPhi(x)" shape=hexagon style="filled" fillcolor="#f5e4fa"];
+ B [label="BulkMemPhi(All except x)" shape=hexagon style="filled" fillcolor="#f5e4fa"];
+ P -> Left [xlabel="slice x",color="#2867b2"]; P -> Right [xlabel="slice x",color="#2867b2"];
+ B -> Left [color="#2867b2"]; B -> Right [color="#2867b2"];
+ P -> Region [style=dashed,color="#9396a3"]; B -> Region [style=dashed,color="#9396a3"];
+ MemMerge -> P [xlabel="x",color="#2867b2"]; MemMerge -> B [xlabel="default",color="#2867b2"];
+ MemMerge [shape=octagon style="filled" fillcolor="#dcecff"];
+ Left [shape=octagon style="filled" fillcolor="#dcecff"];
+ Right [shape=octagon style="filled" fillcolor="#dcecff"];
+ Region [shape=trapezium style="filled" fillcolor="#fff1c4"];
+}
diff --git a/chapter11/docs/example2b.json b/chapter11/docs/example2b.json
new file mode 100644
index 00000000..702773ea
--- /dev/null
+++ b/chapter11/docs/example2b.json
@@ -0,0 +1,30 @@
+{
+ "ver": 1,
+ "comp": "chapter11/docs/example2b.svg",
+ "step": 1,
+ "roots": [23],
+ "scope": 0,
+ "nodes": [
+ {"id": 1, "label": "Start", "type": null, "kind": "CTRL", "edges": [], "proj": null},
+ {"id": 3, "label": "$mem", "type": null, "kind": "MEM", "edges": [{"idx": 0, "def": 1, "role": "MEM", "label": null}], "proj": {"par": 1, "idx": 1}},
+ {"id": 5, "label": "new Point", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}], "proj": null},
+ {"id": 6, "label": "#0", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 1, "role": "ASSOC", "label": null}], "proj": null},
+ {"id": 7, "label": "Store p.x", "type": "MEM#2", "kind": "MEM", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 3, "role": "MEM", "label": null}, {"idx": 2, "def": 5, "role": "DATA", "label": null}, {"idx": 3, "def": 6, "role": "DATA", "label": null}], "proj": null},
+ {"id": 8, "label": "Store p.y", "type": "MEM#3", "kind": "MEM", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 3, "role": "MEM", "label": null}, {"idx": 2, "def": 5, "role": "DATA", "label": null}, {"idx": 3, "def": 6, "role": "DATA", "label": null}], "proj": null},
+ {"id": 9, "label": "MemMerge", "type": null, "kind": "MEM", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 3, "role": "MEM", "label": null}, {"idx": 2, "def": 7, "role": "MEM", "label": null}, {"idx": 3, "def": 8, "role": "MEM", "label": null}], "proj": null},
+ {"id": 11, "label": "True", "type": null, "kind": "CTRL", "edges": [], "proj": {"par": 0, "idx": 0}},
+ {"id": 12, "label": "False", "type": null, "kind": "CTRL", "edges": [], "proj": {"par": 0, "idx": 1}},
+ {"id": 13, "label": "#3", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 1, "role": "ASSOC", "label": null}], "proj": null},
+ {"id": 14, "label": "Store p.x", "type": "MEM#2", "kind": "MEM", "edges": [{"idx": 0, "def": 11, "role": "CTRL", "label": null}, {"idx": 1, "def": 7, "role": "MEM", "label": null}, {"idx": 2, "def": 5, "role": "DATA", "label": null}, {"idx": 3, "def": 13, "role": "DATA", "label": null}], "proj": null},
+ {"id": 15, "label": "#4", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 1, "role": "ASSOC", "label": null}], "proj": null},
+ {"id": 16, "label": "Store p.x", "type": "MEM#2", "kind": "MEM", "edges": [{"idx": 0, "def": 12, "role": "CTRL", "label": null}, {"idx": 1, "def": 7, "role": "MEM", "label": null}, {"idx": 2, "def": 5, "role": "DATA", "label": null}, {"idx": 3, "def": 15, "role": "DATA", "label": null}], "proj": null},
+ {"id": 17, "label": "MemMerge", "type": null, "kind": "MEM", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 9, "role": "MEM", "label": null}, {"idx": 2, "def": 14, "role": "MEM", "label": null}], "proj": null},
+ {"id": 18, "label": "MemMerge", "type": null, "kind": "MEM", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 9, "role": "MEM", "label": null}, {"idx": 2, "def": 16, "role": "MEM", "label": null}], "proj": null},
+ {"id": 20, "label": "MemPhi x", "type": "MEM#2", "kind": "PHI", "edges": [{"idx": 0, "def": 0, "role": "ASSOC", "label": null}, {"idx": 1, "def": 14, "role": "MEM", "label": null}, {"idx": 2, "def": 16, "role": "MEM", "label": null}], "proj": null},
+ {"id": 21, "label": "BulkMemPhi except x", "type": null, "kind": "PHI", "edges": [{"idx": 0, "def": 0, "role": "ASSOC", "label": null}, {"idx": 1, "def": 17, "role": "MEM", "label": null}, {"idx": 2, "def": 18, "role": "MEM", "label": null}], "proj": null},
+ {"id": 22, "label": "MemMerge", "type": null, "kind": "MEM", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 21, "role": "MEM", "label": null}, {"idx": 2, "def": 20, "role": "MEM", "label": null}], "proj": null},
+ {"id": 23, "label": "Return", "type": null, "kind": "CTRL", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 22, "role": "MEM", "label": null}, {"idx": 2, "def": 5, "role": "DATA", "label": null}], "proj": null}
+ ],
+ "groups": [
+ ]
+}
diff --git a/chapter11/docs/example2b.svg b/chapter11/docs/example2b.svg
new file mode 100644
index 00000000..54ddad9d
--- /dev/null
+++ b/chapter11/docs/example2b.svg
@@ -0,0 +1,150 @@
+<svg aria-label="Compiler graph" width="886" height="768" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 886 768" style="font-family: sans-serif;"><style>
+ html, body { height:100%; margin:0; font-family:sans-serif; }
+ .viewer { height:100%; display:grid; grid-template-rows:auto minmax(0,1fr) auto; }
+ .source { padding:8px; border-bottom:1px solid #ccc; }
+ #program { width:min(600px,80vw); vertical-align:middle; }
+ #status { margin-top:4px; }
+ #graph { min-height:0; overflow:hidden; position:relative; background:#fafbfc; }
+ #elk { width:100%; height:100%; }
+ #graph svg { display:block; }
+ .tools { display:flex; flex-wrap:wrap; align-items:center; gap:14px; margin-top:8px; font-size:12px; }
+ .hint { color:#616c78; }
+ .ctrl { color:#b63838; } .mem { color:#2867b2; } .data { color:#536477; }
+ .edge { fill:none; stroke-width:1.5; }
+ .edge.CTRL { stroke-width:2; }
+ .edge.ASSOC { stroke-dasharray:4 4; }
+ .edge.PARSER { stroke-dasharray:5 4; }
+ .parser rect { fill:#f6f0ff; stroke:#7956a5; stroke-width:1.5; stroke-dasharray:5 4; }
+ .edge.selected { stroke-width:3.5; }
+ .edge.bundle { stroke-width:4; }
+ .edge.bundle.selected { stroke-width:6; }
+ .edge-hit { fill:none; stroke:transparent; stroke-width:12; vector-effect:non-scaling-stroke; pointer-events:stroke; cursor:pointer; }
+ .edge-jump { fill:transparent; pointer-events:all; cursor:pointer; }
+ .node { cursor:pointer; }
+ .box { stroke:#758191; stroke-width:1; }
+ .node.held .box { stroke-dasharray:5 3; }
+ .node.near .box { stroke:#c18221; stroke-width:2; }
+ .node.focus .box { stroke:#9c4900; stroke-width:3; }
+ .node.selected .box { stroke:#1569b9; stroke-width:3; }
+ .node.folded .box { stroke-width:4; }
+ .node.folding .box { fill:#f4ccd7; }
+ .fold-tag { font-size:9px; font-weight:700; fill:#963751; }
+ .peep-area { fill:#fff3d9; fill-opacity:.8; stroke:#c18221; stroke-width:2; pointer-events:none; }
+ .node.peep-edit .box { stroke:#9c4900; stroke-width:3; }
+ .node.error .box { stroke:#b42318; stroke-width:4; }
+ #event.error { color:#b42318; font-weight:600; white-space:pre-wrap; overflow-wrap:anywhere; }
+ .peep-ghosts { pointer-events:none; }
+ .region-box { stroke:#9da9b8; stroke-width:1.5; }
+ .fold-btn { cursor:pointer; }
+ .fold-btn rect { fill:white; stroke:#596674; }
+ .fold-btn text { font-size:14px; fill:#152330; }
+ .fold-btn:focus rect { stroke:#1569b9; stroke-width:2; }
+ .shortcut { cursor:pointer; }
+ .shortcut path { fill:none; stroke-width:1.5; }
+ .shortcut rect { fill:#fff8ec; stroke:#b63838; stroke-dasharray:3 2; }
+ .shortcut text { font-size:11px; fill:#783030; }
+ .shortcut.selected rect, .shortcut:focus rect { stroke-width:2.5; }
+ .label { font-size:12px; fill:#152330; font-weight:600; }
+ .node-id { font-size:10px; fill:#596674; font-weight:400; }
+ .type { font-size:11px; fill:#455768; }
+ .port { stroke:#536477; stroke-width:1; }
+ .row { stroke:#b6afcf; stroke-width:1; }
+ .bind { font-size:12px; fill:#152330; }
+ .slot { font-size:10px; fill:#364352; paint-order:stroke; stroke:#fafbfc; stroke-width:3; }
+ #detail { position:absolute; top:8px; right:8px; margin:0; padding:12px; max-width:320px;
+ max-height:45%; overflow:auto; white-space:pre-wrap; overflow-wrap:anywhere;
+ background:#fffffff2; border:1px solid #bac5d0; border-radius:4px; font-size:12px; }
+ .controls { display:flex; flex-wrap:wrap; justify-content:center; align-items:center; gap:6px; padding:6px; }
+ .button { color:white; background:black; font-size:20px; min-width:30px; }
+ .button:disabled { background:grey; }
+ .count { font-size:20px; min-width:35px; text-align:center; }
+ #N { width:6ch; }
+ #scrub { width:clamp(120px,35vw,600px); }
+ </style><defs><marker id="arrow-CTRL" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#b63838"/></marker><marker id="arrow-DATA" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#536477"/></marker><marker id="arrow-MEM" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#2867b2"/></marker><marker id="arrow-ASSOC" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#9396a3"/></marker><marker id="arrow-PARSER" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#7956a5"/></marker></defs><rect width="100%" height="100%" fill="rgb(250, 251, 252)"/><g><g class="regions" style="opacity: 1;"/><rect class="peep-area" rx="36" style="opacity: 0;"/><g class="edges"><path class="edge ASSOC" id="e6i0" d="M147,46 C147,70 279,41 279,65" stroke="#9396a3" marker-start="url(#arrow-ASSOC)" style="opacity: 1;"><title>#6[0] → #1 · ASSOC</title></path><path class="edge MEM" id="e7i1" d="M84,118 L84,140 Q84,148 92,148 L341,148 Q349,148 349,156 L349,166" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#7[1] → #3 · MEM</title></path><path class="edge DATA" id="e7i2" d="M431,118 L431,130 Q431,138 423,138 L381,138 Q373,138 373,146 L373,166" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#7[2] → #5 · DATA</title></path><path class="edge DATA" id="e7i3" d="M279,118 L279,123 Q279,128 284,128 L389,128 Q397,128 397,136 L397,166" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#7[3] → #6 · DATA</title></path><path class="edge MEM" id="e8i1" d="M84,118 L84,166" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#8[1] → #3 · MEM</title></path><path class="edge DATA" id="e8i2" d="M431,118 L431,130 Q431,138 423,138 L116,138 Q108,138 108,146 L108,166" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#8[2] → #5 · DATA</title></path><path class="edge DATA" id="e8i3" d="M279,118 L279,123 Q279,128 274,128 L140,128 Q132,128 132,136 L132,166" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#8[3] → #6 · DATA</title></path><path class="edge MEM" id="e9i1" d="M84,118 L84,140 Q84,148 76,148 L33,148 Q25,148 25,156 L25,234 Q25,242 33,242 L93,242 Q101,242 101,250 L101,272" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#9[1] → #3 · MEM</title></path><path class="edge MEM" id="e9i2" d="M361,222 L361,234 Q361,242 353,242 L133,242 Q125,242 125,250 L125,272" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#9[2] → #7 · MEM</title></path><path class="edge MEM" id="e9i3" d="M96,222 L96,227 Q96,232 101,232 L141,232 Q149,232 149,240 L149,272" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#9[3] → #8 · MEM</title></path><path class="edge ASSOC" id="e13i0" d="M147,46 C147,70 502,145 502,169" stroke="#9396a3" marker-start="url(#arrow-ASSOC)" style="opacity: 1;"><title>#13[0] → #1 · ASSOC</title></path><path class="edge CTRL" id="e14i0" d="M229,222 L229,272" stroke="#b63838" marker-start="url(#arrow-CTRL)" style="opacity: 1;"><title>#14[0] → #11 · CTRL</title></path><path class="edge MEM" id="e14i1" d="M361,222 L361,234 Q361,242 353,242 L261,242 Q253,242 253,250 L253,272" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#14[1] → #7 · MEM</title></path><path class="edge DATA" id="e14i2" d="M431,118 L431,244 Q431,252 423,252 L285,252 Q277,252 277,260 L277,272" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#14[2] → #5 · DATA</title></path><path class="edge DATA" id="e14i3" d="M502,222 L502,254 Q502,262 494,262 L306,262 Q301,262 301,267 L301,272" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#14[3] → #13 · DATA</title></path><path class="edge ASSOC" id="e15i0" d="M147,46 C147,70 762,145 762,169" stroke="#9396a3" marker-start="url(#arrow-ASSOC)" style="opacity: 1;"><title>#15[0] → #1 · ASSOC</title></path><path class="edge CTRL" id="e16i0" d="M638,222 L638,272" stroke="#b63838" marker-start="url(#arrow-CTRL)" style="opacity: 1;"><title>#16[0] → #12 · CTRL</title></path><path class="edge MEM" id="e16i1" d="M361,222 L361,234 Q361,242 369,242 L654,242 Q662,242 662,250 L662,272" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#16[1] → #7 · MEM</title></path><path class="edge DATA" id="e16i2" d="M431,118 L431,130 Q431,138 439,138 L683,138 Q691,138 691,146 L691,229.5 Q691,232 688.5,232 L688.5,232 Q686,232 686,234.5 L686,272" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#16[2] → #5 · DATA</title></path><path class="edge DATA" id="e16i3" d="M762,222 L762,227 Q762,232 757,232 L718,232 Q710,232 710,240 L710,272" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#16[3] → #15 · DATA</title></path><path class="edge MEM" id="e17i1" d="M113,328 L113,340 Q113,348 121,348 L227,348 Q235,348 235,356 L235,376" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#17[1] → #9 · MEM</title></path><path class="edge MEM" id="e17i2" d="M265,328 L265,376" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#17[2] → #14 · MEM</title></path><path class="edge MEM" id="e18i1" d="M113,328 L113,340 Q113,348 121,348 L491,348 Q499,348 499,356 L499,376" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#18[1] → #9 · MEM</title></path><path class="edge MEM" id="e18i2" d="M674,328 L674,340 Q674,348 666,348 L537,348 Q529,348 529,356 L529,376" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#18[2] → #16 · MEM</title></path><path class="edge MEM" id="e20i1" d="M265,328 L265,333 Q265,338 270,338 L626,338 Q634,338 634,346 L634,376" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#20[1] → #14 · MEM</title></path><path class="edge MEM" id="e20i2" d="M674,328 L674,376" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#20[2] → #16 · MEM</title></path><path class="edge MEM" id="e21i1" d="M235,432 L235,437 Q235,442 240,442 L436,442 Q444,442 444,450 L444,480" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#21[1] → #17 · MEM</title></path><path class="edge MEM" id="e21i2" d="M499,432 L499,480" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#21[2] → #18 · MEM</title></path><path class="edge MEM" id="e22i1" d="M472,536 L472,541 Q472,546 477,546 L616,546 Q624,546 624,554 L624,584" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#22[1] → #21 · MEM</title></path><path class="edge MEM" id="e22i2" d="M654,432 L654,584" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#22[2] → #20 · MEM</title></path><path class="edge MEM" id="e23i1" d="M624,640 L624,645 Q624,650 629,650 L794,650 Q802,650 802,658 L802,688" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#23[1] → #22 · MEM</title></path><path class="edge DATA" id="e23i2" d="M431,118 L431,130 Q431,138 439,138 L824,138 Q832,138 832,146 L832,688" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#23[2] → #5 · DATA</title></path></g><g class="edge-hits"/><g class="parser" style="opacity: 1;"/><g class="nodes"><g class="node" id="n1" data-id="1" transform="translate(24,24)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Start</tspan><tspan class="node-id">  #1</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#1 Start
+Type not computed
+
+</title></g><g class="node" id="n3" data-id="3" transform="translate(24,68)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>$mem</tspan><tspan class="node-id">  #3/1</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#3 $mem
+Projection 1 of #1
+Type not computed
+
+[0] → #1 MEM</title></g><g class="node" id="n5" data-id="5" transform="translate(371,68)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>new Point</tspan><tspan class="node-id">  #5</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#5 new Point
+Type not computed
+
+[0] → — CTRL</title><circle class="port" cx="60" cy="-3" r="3" fill="white"/><text class="slot" x="60" y="-10" text-anchor="middle">0</text></g><g class="node" id="n6" data-id="6" transform="translate(219,68)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>#0</tspan><tspan class="node-id">  #6</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#6 #0
+Type not computed
+
+[0] → #1 ASSOC</title><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><text class="slot" x="60" y="-10" text-anchor="middle">0</text></g><g class="node" id="n7" data-id="7" transform="translate(301,172)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Store p.x</tspan><tspan class="node-id">  #7</tspan></text><text class="type" text-anchor="middle" y="35" x="60">MEM#2</text><title>#7 Store p.x
+MEM#2
+
+[0] → — CTRL
+[1] → #3 MEM
+[2] → #5 DATA
+[3] → #6 DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n8" data-id="8" transform="translate(36,172)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Store p.y</tspan><tspan class="node-id">  #8</tspan></text><text class="type" text-anchor="middle" y="35" x="60">MEM#3</text><title>#8 Store p.y
+MEM#3
+
+[0] → — CTRL
+[1] → #3 MEM
+[2] → #5 DATA
+[3] → #6 DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n9" data-id="9" transform="translate(53,278)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>MemMerge</tspan><tspan class="node-id">  #9</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#9 MemMerge
+Type not computed
+
+[0] → — CTRL
+[1] → #3 MEM
+[2] → #7 MEM
+[3] → #8 MEM</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n11" data-id="11" transform="translate(188,190)" style="opacity: 1;"><path class="box" d="M0,0H81V26H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="40.5" y="17"><tspan>True</tspan><tspan class="node-id">  #11/0</tspan></text><text class="type" text-anchor="middle" y="35" x="40.5"/><title>#11 True
+Projection 0 of #0
+Type not computed
+
+</title></g><g class="node" id="n12" data-id="12" transform="translate(594,190)" style="opacity: 1;"><path class="box" d="M0,0H87V26H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="43.5" y="17"><tspan>False</tspan><tspan class="node-id">  #12/1</tspan></text><text class="type" text-anchor="middle" y="35" x="43.5"/><title>#12 False
+Projection 1 of #0
+Type not computed
+
+</title></g><g class="node" id="n13" data-id="13" transform="translate(442,172)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>#3</tspan><tspan class="node-id">  #13</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#13 #3
+Type not computed
+
+[0] → #1 ASSOC</title><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><text class="slot" x="60" y="-10" text-anchor="middle">0</text></g><g class="node" id="n14" data-id="14" transform="translate(205,278)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Store p.x</tspan><tspan class="node-id">  #14</tspan></text><text class="type" text-anchor="middle" y="35" x="60">MEM#2</text><title>#14 Store p.x
+MEM#2
+
+[0] → #11 CTRL
+[1] → #7 MEM
+[2] → #5 DATA
+[3] → #13 DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="#536477"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n15" data-id="15" transform="translate(702,172)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>#4</tspan><tspan class="node-id">  #15</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#15 #4
+Type not computed
+
+[0] → #1 ASSOC</title><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><text class="slot" x="60" y="-10" text-anchor="middle">0</text></g><g class="node" id="n16" data-id="16" transform="translate(614,278)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Store p.x</tspan><tspan class="node-id">  #16</tspan></text><text class="type" text-anchor="middle" y="35" x="60">MEM#2</text><title>#16 Store p.x
+MEM#2
+
+[0] → #12 CTRL
+[1] → #7 MEM
+[2] → #5 DATA
+[3] → #15 DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="#536477"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n17" data-id="17" transform="translate(175,382)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>MemMerge</tspan><tspan class="node-id">  #17</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#17 MemMerge
+Type not computed
+
+[0] → — CTRL
+[1] → #9 MEM
+[2] → #14 MEM</title><circle class="port" cx="30" cy="-3" r="3" fill="white"/><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><circle class="port" cx="90" cy="-3" r="3" fill="#536477"/><text class="slot" x="30" y="-10" text-anchor="middle">0</text><text class="slot" x="60" y="-10" text-anchor="middle">1</text><text class="slot" x="90" y="-10" text-anchor="middle">2</text></g><g class="node" id="n18" data-id="18" transform="translate(439,382)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>MemMerge</tspan><tspan class="node-id">  #18</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#18 MemMerge
+Type not computed
+
+[0] → — CTRL
+[1] → #9 MEM
+[2] → #16 MEM</title><circle class="port" cx="30" cy="-3" r="3" fill="white"/><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><circle class="port" cx="90" cy="-3" r="3" fill="#536477"/><text class="slot" x="30" y="-10" text-anchor="middle">0</text><text class="slot" x="60" y="-10" text-anchor="middle">1</text><text class="slot" x="90" y="-10" text-anchor="middle">2</text></g><g class="node" id="n20" data-id="20" transform="translate(594,382)" style="opacity: 1;"><path class="box" d="M12,0H108L120,22L108,44H12L0,22Z" fill="#f5e4fa"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>MemPhi x</tspan><tspan class="node-id">  #20</tspan></text><text class="type" text-anchor="middle" y="35" x="60">MEM#2</text><title>#20 MemPhi x
+MEM#2
+
+[0] → — ASSOC
+[1] → #14 MEM
+[2] → #16 MEM</title><circle class="port" cx="0" cy="-3" r="3" fill="white"/><circle class="port" cx="40" cy="-3" r="3" fill="#536477"/><circle class="port" cx="80" cy="-3" r="3" fill="#536477"/><text class="slot" x="0" y="-10" text-anchor="middle">0</text><text class="slot" x="40" y="-10" text-anchor="middle">1</text><text class="slot" x="80" y="-10" text-anchor="middle">2</text></g><g class="node" id="n21" data-id="21" transform="translate(390,486)" style="opacity: 1;"><path class="box" d="M12,0H151L163,22L151,44H12L0,22Z" fill="#f5e4fa"/><text class="label" text-anchor="middle" x="81.5" y="18"><tspan>BulkMemPhi except x</tspan><tspan class="node-id">  #21</tspan></text><text class="type" text-anchor="middle" y="35" x="81.5"/><title>#21 BulkMemPhi except x
+Type not computed
+
+[0] → — ASSOC
+[1] → #17 MEM
+[2] → #18 MEM</title><circle class="port" cx="0" cy="-3" r="3" fill="white"/><circle class="port" cx="54" cy="-3" r="3" fill="#536477"/><circle class="port" cx="109" cy="-3" r="3" fill="#536477"/><text class="slot" x="0" y="-10" text-anchor="middle">0</text><text class="slot" x="54" y="-10" text-anchor="middle">1</text><text class="slot" x="109" y="-10" text-anchor="middle">2</text></g><g class="node" id="n22" data-id="22" transform="translate(564,590)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>MemMerge</tspan><tspan class="node-id">  #22</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#22 MemMerge
+Type not computed
+
+[0] → — CTRL
+[1] → #21 MEM
+[2] → #20 MEM</title><circle class="port" cx="30" cy="-3" r="3" fill="white"/><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><circle class="port" cx="90" cy="-3" r="3" fill="#536477"/><text class="slot" x="30" y="-10" text-anchor="middle">0</text><text class="slot" x="60" y="-10" text-anchor="middle">1</text><text class="slot" x="90" y="-10" text-anchor="middle">2</text></g><g class="node" id="n23" data-id="23" transform="translate(742,694)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Return</tspan><tspan class="node-id">  #23</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#23 Return
+Type not computed
+
+[0] → — CTRL
+[1] → #22 MEM
+[2] → #5 DATA</title><circle class="port" cx="30" cy="-3" r="3" fill="white"/><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><circle class="port" cx="90" cy="-3" r="3" fill="#536477"/><text class="slot" x="30" y="-10" text-anchor="middle">0</text><text class="slot" x="60" y="-10" text-anchor="middle">1</text><text class="slot" x="90" y="-10" text-anchor="middle">2</text></g></g><g class="region-heads" style="opacity: 1;"/><g class="shortcuts" style="opacity: 1;"/><g class="peep-ghosts" pointer-events="none"/></g></svg>
diff --git a/chapter11/docs/example2c.gv b/chapter11/docs/example2c.gv
new file mode 100644
index 00000000..b32d186d
--- /dev/null
+++ b/chapter11/docs/example2c.gv
@@ -0,0 +1,15 @@
+digraph Memory {
+ // IR styles match graph/web/render.js; arrows are use -> definition.
+ graph [bgcolor="#fafbfc" fontname="Helvetica" nodesep=0.35 ranksep=0.55 splines=ortho];
+ node [fontname="Helvetica" fontsize=12 color="#758191" fontcolor="#152330" shape=box style="rounded,filled" fillcolor="#edf3f7"];
+ edge [fontname="Helvetica" fontsize=9 color="#536477" fontcolor="#364352" arrowsize=0.7 penwidth=1.5];
+
+ rankdir=RL;
+
+ M [label="Prior x memory" shape=octagon style="filled" fillcolor="#dcecff"];
+ L [label="Load p.x" shape=box style="rounded,filled" fillcolor="#edf3f7"];
+ S [label="Store p.x" shape=octagon style="filled" fillcolor="#dcecff"];
+ L -> M [color="#2867b2"]; S -> M [color="#2867b2"];
+ S -> L [style=dashed,xlabel="execute load first"];
+ Y [label="Store p.y: independent" shape=octagon style="filled" fillcolor="#dcecff"];
+}
diff --git a/chapter11/docs/example2c.json b/chapter11/docs/example2c.json
new file mode 100644
index 00000000..c25fa5b8
--- /dev/null
+++ b/chapter11/docs/example2c.json
@@ -0,0 +1,23 @@
+{
+ "ver": 1,
+ "comp": "chapter11/docs/example2c.svg",
+ "step": 1,
+ "roots": [13],
+ "scope": 0,
+ "nodes": [
+ {"id": 1, "label": "Start", "type": null, "kind": "CTRL", "edges": [], "proj": null},
+ {"id": 3, "label": "$mem", "type": null, "kind": "MEM", "edges": [{"idx": 0, "def": 1, "role": "MEM", "label": null}], "proj": {"par": 1, "idx": 1}},
+ {"id": 4, "label": "arg", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 1, "role": "DATA", "label": null}], "proj": {"par": 1, "idx": 2}},
+ {"id": 5, "label": "new Point", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}], "proj": null},
+ {"id": 6, "label": "#0", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 1, "role": "ASSOC", "label": null}], "proj": null},
+ {"id": 7, "label": "Store p.x", "type": "MEM#2", "kind": "MEM", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 3, "role": "MEM", "label": null}, {"idx": 2, "def": 5, "role": "DATA", "label": null}, {"idx": 3, "def": 6, "role": "DATA", "label": null}], "proj": null},
+ {"id": 8, "label": "Store p.y", "type": "MEM#3", "kind": "MEM", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 3, "role": "MEM", "label": null}, {"idx": 2, "def": 5, "role": "DATA", "label": null}, {"idx": 3, "def": 6, "role": "DATA", "label": null}], "proj": null},
+ {"id": 9, "label": "Load p.x", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 7, "role": "MEM", "label": null}, {"idx": 2, "def": 5, "role": "DATA", "label": null}, {"idx": 3, "def": 0, "role": "DATA", "label": null}], "proj": null},
+ {"id": 10, "label": "Store p.x", "type": "MEM#2", "kind": "MEM", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 7, "role": "MEM", "label": null}, {"idx": 2, "def": 5, "role": "DATA", "label": null}, {"idx": 3, "def": 4, "role": "DATA", "label": null}], "proj": null},
+ {"id": 11, "label": "Store p.y", "type": "MEM#3", "kind": "MEM", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 8, "role": "MEM", "label": null}, {"idx": 2, "def": 5, "role": "DATA", "label": null}, {"idx": 3, "def": 4, "role": "DATA", "label": null}], "proj": null},
+ {"id": 12, "label": "MemMerge", "type": null, "kind": "MEM", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 3, "role": "MEM", "label": null}, {"idx": 2, "def": 10, "role": "MEM", "label": null}, {"idx": 3, "def": 11, "role": "MEM", "label": null}], "proj": null},
+ {"id": 13, "label": "Return", "type": null, "kind": "CTRL", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 12, "role": "MEM", "label": null}, {"idx": 2, "def": 9, "role": "DATA", "label": null}], "proj": null}
+ ],
+ "groups": [
+ ]
+}
diff --git a/chapter11/docs/example2c.svg b/chapter11/docs/example2c.svg
new file mode 100644
index 00000000..01bbe10a
--- /dev/null
+++ b/chapter11/docs/example2c.svg
@@ -0,0 +1,121 @@
+<svg aria-label="Compiler graph" width="598" height="572" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 598 572" style="font-family: sans-serif;"><style>
+ html, body { height:100%; margin:0; font-family:sans-serif; }
+ .viewer { height:100%; display:grid; grid-template-rows:auto minmax(0,1fr) auto; }
+ .source { padding:8px; border-bottom:1px solid #ccc; }
+ #program { width:min(600px,80vw); vertical-align:middle; }
+ #status { margin-top:4px; }
+ #graph { min-height:0; overflow:hidden; position:relative; background:#fafbfc; }
+ #elk { width:100%; height:100%; }
+ #graph svg { display:block; }
+ .tools { display:flex; flex-wrap:wrap; align-items:center; gap:14px; margin-top:8px; font-size:12px; }
+ .hint { color:#616c78; }
+ .ctrl { color:#b63838; } .mem { color:#2867b2; } .data { color:#536477; }
+ .edge { fill:none; stroke-width:1.5; }
+ .edge.CTRL { stroke-width:2; }
+ .edge.ASSOC { stroke-dasharray:4 4; }
+ .edge.PARSER { stroke-dasharray:5 4; }
+ .parser rect { fill:#f6f0ff; stroke:#7956a5; stroke-width:1.5; stroke-dasharray:5 4; }
+ .edge.selected { stroke-width:3.5; }
+ .edge.bundle { stroke-width:4; }
+ .edge.bundle.selected { stroke-width:6; }
+ .edge-hit { fill:none; stroke:transparent; stroke-width:12; vector-effect:non-scaling-stroke; pointer-events:stroke; cursor:pointer; }
+ .edge-jump { fill:transparent; pointer-events:all; cursor:pointer; }
+ .node { cursor:pointer; }
+ .box { stroke:#758191; stroke-width:1; }
+ .node.held .box { stroke-dasharray:5 3; }
+ .node.near .box { stroke:#c18221; stroke-width:2; }
+ .node.focus .box { stroke:#9c4900; stroke-width:3; }
+ .node.selected .box { stroke:#1569b9; stroke-width:3; }
+ .node.folded .box { stroke-width:4; }
+ .node.folding .box { fill:#f4ccd7; }
+ .fold-tag { font-size:9px; font-weight:700; fill:#963751; }
+ .peep-area { fill:#fff3d9; fill-opacity:.8; stroke:#c18221; stroke-width:2; pointer-events:none; }
+ .node.peep-edit .box { stroke:#9c4900; stroke-width:3; }
+ .node.error .box { stroke:#b42318; stroke-width:4; }
+ #event.error { color:#b42318; font-weight:600; white-space:pre-wrap; overflow-wrap:anywhere; }
+ .peep-ghosts { pointer-events:none; }
+ .region-box { stroke:#9da9b8; stroke-width:1.5; }
+ .fold-btn { cursor:pointer; }
+ .fold-btn rect { fill:white; stroke:#596674; }
+ .fold-btn text { font-size:14px; fill:#152330; }
+ .fold-btn:focus rect { stroke:#1569b9; stroke-width:2; }
+ .shortcut { cursor:pointer; }
+ .shortcut path { fill:none; stroke-width:1.5; }
+ .shortcut rect { fill:#fff8ec; stroke:#b63838; stroke-dasharray:3 2; }
+ .shortcut text { font-size:11px; fill:#783030; }
+ .shortcut.selected rect, .shortcut:focus rect { stroke-width:2.5; }
+ .label { font-size:12px; fill:#152330; font-weight:600; }
+ .node-id { font-size:10px; fill:#596674; font-weight:400; }
+ .type { font-size:11px; fill:#455768; }
+ .port { stroke:#536477; stroke-width:1; }
+ .row { stroke:#b6afcf; stroke-width:1; }
+ .bind { font-size:12px; fill:#152330; }
+ .slot { font-size:10px; fill:#364352; paint-order:stroke; stroke:#fafbfc; stroke-width:3; }
+ #detail { position:absolute; top:8px; right:8px; margin:0; padding:12px; max-width:320px;
+ max-height:45%; overflow:auto; white-space:pre-wrap; overflow-wrap:anywhere;
+ background:#fffffff2; border:1px solid #bac5d0; border-radius:4px; font-size:12px; }
+ .controls { display:flex; flex-wrap:wrap; justify-content:center; align-items:center; gap:6px; padding:6px; }
+ .button { color:white; background:black; font-size:20px; min-width:30px; }
+ .button:disabled { background:grey; }
+ .count { font-size:20px; min-width:35px; text-align:center; }
+ #N { width:6ch; }
+ #scrub { width:clamp(120px,35vw,600px); }
+ </style><defs><marker id="arrow-CTRL" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#b63838"/></marker><marker id="arrow-DATA" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#536477"/></marker><marker id="arrow-MEM" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#2867b2"/></marker><marker id="arrow-ASSOC" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#9396a3"/></marker><marker id="arrow-PARSER" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#7956a5"/></marker></defs><rect width="100%" height="100%" fill="rgb(250, 251, 252)"/><g><g class="regions" style="opacity: 1;"/><rect class="peep-area" rx="36" style="opacity: 0;"/><g class="edges"><path class="edge ASSOC" id="e6i0" d="M267,46 C267,70 514,41 514,65" stroke="#9396a3" marker-start="url(#arrow-ASSOC)" style="opacity: 1;"><title>#6[0] → #1 · ASSOC</title></path><path class="edge MEM" id="e7i1" d="M84,118 L84,150 Q84,158 92,158 L181,158 Q186,158 186,163 L186,168" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#7[1] → #3 · MEM</title></path><path class="edge DATA" id="e7i2" d="M362,118 L362,140 Q362,148 354,148 L218,148 Q210,148 210,156 L210,168" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#7[2] → #5 · DATA</title></path><path class="edge DATA" id="e7i3" d="M514,118 L514,130 Q514,138 506,138 L242,138 Q234,138 234,146 L234,168" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#7[3] → #6 · DATA</title></path><path class="edge MEM" id="e8i1" d="M84,118 L84,150 Q84,158 92,158 L333,158 Q338,158 338,163 L338,168" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#8[1] → #3 · MEM</title></path><path class="edge DATA" id="e8i2" d="M362,118 L362,168" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#8[2] → #5 · DATA</title></path><path class="edge DATA" id="e8i3" d="M514,118 L514,130 Q514,138 506,138 L394,138 Q386,138 386,146 L386,168" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#8[3] → #6 · DATA</title></path><path class="edge MEM" id="e9i1" d="M198,224 L198,256 Q198,264 206,264 L439,264 Q447,264 447,272 L447,284" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#9[1] → #7 · MEM</title></path><path class="edge DATA" id="e9i2" d="M362,118 L362,140 Q362,148 370,148 L463,148 Q471,148 471,156 L471,284" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#9[2] → #5 · DATA</title></path><path class="edge MEM" id="e10i1" d="M198,224 L198,256 Q198,264 190,264 L151,264 Q143,264 143,272 L143,284" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#10[1] → #7 · MEM</title></path><path class="edge DATA" id="e10i2" d="M362,118 L362,140 Q362,148 354,148 L124,148 Q116,148 116,156 L116,266 Q116,274 124,274 L162,274 Q167,274 167,279 L167,284" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#10[2] → #5 · DATA</title></path><path class="edge DATA" id="e10i3" d="M204,118 L204,123 Q204,128 199,128 L135,128 Q127,128 127,136 L127,226 Q127,234 135,234 L183,234 Q191,234 191,242 L191,284" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#10[3] → #4 · DATA</title></path><path class="edge MEM" id="e11i1" d="M350,224 L350,229 Q350,234 345,234 L303,234 Q295,234 295,242 L295,284" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#11[1] → #8 · MEM</title></path><path class="edge DATA" id="e11i2" d="M362,118 L362,140 Q362,148 370,148 L412,148 Q420,148 420,156 L420,236 Q420,244 412,244 L327,244 Q319,244 319,252 L319,284" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#11[2] → #5 · DATA</title></path><path class="edge DATA" id="e11i3" d="M204,118 L204,123 Q204,128 209,128 L423,128 Q431,128 431,136 L431,246 Q431,254 423,254 L351,254 Q343,254 343,262 L343,284" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#11[3] → #4 · DATA</title></path><path class="edge MEM" id="e12i1" d="M84,118 L84,342 Q84,350 92,350 L123,350 Q131,350 131,358 L131,388" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#12[1] → #3 · MEM</title></path><path class="edge MEM" id="e12i2" d="M155,340 L155,388" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#12[2] → #10 · MEM</title></path><path class="edge MEM" id="e12i3" d="M307,340 L307,345 Q307,350 302,350 L187,350 Q179,350 179,358 L179,388" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#12[3] → #11 · MEM</title></path><path class="edge MEM" id="e13i1" d="M143,444 L143,449 Q143,454 148,454 L421,454 Q429,454 429,462 L429,492" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#13[1] → #12 · MEM</title></path><path class="edge DATA" id="e13i2" d="M459,340 L459,492" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#13[2] → #9 · DATA</title></path></g><g class="edge-hits"/><g class="parser" style="opacity: 1;"/><g class="nodes"><g class="node" id="n1" data-id="1" transform="translate(24,24)" style="opacity: 1;"><path class="box" d="M0,0H240V44H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="120" y="18"><tspan>Start</tspan><tspan class="node-id">  #1</tspan></text><text class="type" text-anchor="middle" y="35" x="120"/><title>#1 Start
+Type not computed
+
+</title></g><g class="node" id="n3" data-id="3" transform="translate(24,68)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>$mem</tspan><tspan class="node-id">  #3/1</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#3 $mem
+Projection 1 of #1
+Type not computed
+
+[0] → #1 MEM</title></g><g class="node" id="n4" data-id="4" transform="translate(144,68)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>arg</tspan><tspan class="node-id">  #4/2</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#4 arg
+Projection 2 of #1
+Type not computed
+
+[0] → #1 DATA</title></g><g class="node" id="n5" data-id="5" transform="translate(302,68)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>new Point</tspan><tspan class="node-id">  #5</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#5 new Point
+Type not computed
+
+[0] → — CTRL</title><circle class="port" cx="60" cy="-3" r="3" fill="white"/><text class="slot" x="60" y="-10" text-anchor="middle">0</text></g><g class="node" id="n6" data-id="6" transform="translate(454,68)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>#0</tspan><tspan class="node-id">  #6</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#6 #0
+Type not computed
+
+[0] → #1 ASSOC</title><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><text class="slot" x="60" y="-10" text-anchor="middle">0</text></g><g class="node" id="n7" data-id="7" transform="translate(138,174)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Store p.x</tspan><tspan class="node-id">  #7</tspan></text><text class="type" text-anchor="middle" y="35" x="60">MEM#2</text><title>#7 Store p.x
+MEM#2
+
+[0] → — CTRL
+[1] → #3 MEM
+[2] → #5 DATA
+[3] → #6 DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n8" data-id="8" transform="translate(290,174)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Store p.y</tspan><tspan class="node-id">  #8</tspan></text><text class="type" text-anchor="middle" y="35" x="60">MEM#3</text><title>#8 Store p.y
+MEM#3
+
+[0] → — CTRL
+[1] → #3 MEM
+[2] → #5 DATA
+[3] → #6 DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n9" data-id="9" transform="translate(399,290)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Load p.x</tspan><tspan class="node-id">  #9</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#9 Load p.x
+Type not computed
+
+[0] → — CTRL
+[1] → #7 MEM
+[2] → #5 DATA
+[3] → — DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="white"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n10" data-id="10" transform="translate(95,290)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Store p.x</tspan><tspan class="node-id">  #10</tspan></text><text class="type" text-anchor="middle" y="35" x="60">MEM#2</text><title>#10 Store p.x
+MEM#2
+
+[0] → — CTRL
+[1] → #7 MEM
+[2] → #5 DATA
+[3] → #4 DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n11" data-id="11" transform="translate(247,290)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Store p.y</tspan><tspan class="node-id">  #11</tspan></text><text class="type" text-anchor="middle" y="35" x="60">MEM#3</text><title>#11 Store p.y
+MEM#3
+
+[0] → — CTRL
+[1] → #8 MEM
+[2] → #5 DATA
+[3] → #4 DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n12" data-id="12" transform="translate(83,394)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>MemMerge</tspan><tspan class="node-id">  #12</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#12 MemMerge
+Type not computed
+
+[0] → — CTRL
+[1] → #3 MEM
+[2] → #10 MEM
+[3] → #11 MEM</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n13" data-id="13" transform="translate(369,498)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Return</tspan><tspan class="node-id">  #13</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#13 Return
+Type not computed
+
+[0] → — CTRL
+[1] → #12 MEM
+[2] → #9 DATA</title><circle class="port" cx="30" cy="-3" r="3" fill="white"/><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><circle class="port" cx="90" cy="-3" r="3" fill="#536477"/><text class="slot" x="30" y="-10" text-anchor="middle">0</text><text class="slot" x="60" y="-10" text-anchor="middle">1</text><text class="slot" x="90" y="-10" text-anchor="middle">2</text></g></g><g class="region-heads" style="opacity: 1;"/><g class="shortcuts" style="opacity: 1;"/><g class="peep-ghosts" pointer-events="none"/></g></svg>
diff --git a/chapter11/docs/graph1.gv b/chapter11/docs/graph1.gv
deleted file mode 100644
index 3554a572..00000000
--- a/chapter11/docs/graph1.gv
+++ /dev/null
@@ -1,79 +0,0 @@
-digraph chapter11 {
-/*
-struct S { int f; }
-S v=new S;
-v.f = 2;
-int i=new S.f;
-i=v.f;
-if (arg) v.f=1;
-return i;
-
-*/
- rankdir=BT;
- concentrate="true";
- compound="true";
- subgraph cluster_Nodes {
- Start2 [ shape=plaintext label=<
- <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
- <TR><TD BGCOLOR="yellow">Start</TD></TR>
- <TR><TD>
- <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
- <TR><TD PORT="p0" BGCOLOR="yellow">$ctrl</TD><TD PORT="p1">$mem</TD><TD PORT="p2">arg</TD></TR>
- </TABLE>
- </TD></TR>
- </TABLE>>
- ];
- MemMerge [ shape=box label="MemMerge" ];
- Stop3 [ shape=box style=filled fillcolor=yellow label="Stop" ];
- Con_4 [ label="#0" ];
- new9 [ label="new S" ];
- Con_11 [ label="#2" ];
- Store12 [ label=".f =" ];
- new13 [ label="new S" ];
- Store14 [ label=".f =" ];
- Load16 [ label=".f" ];
- If17 [ shape=plaintext label=<
- <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
- <TR><TD BGCOLOR="yellow">If</TD></TR>
- <TR><TD>
- <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
- <TR><TD PORT="p0" BGCOLOR="yellow">True</TD><TD PORT="p1" BGCOLOR="yellow">False</TD></TR>
- </TABLE>
- </TD></TR>
- </TABLE>>
- ];
- Con_21 [ label="#1" ];
- Store22 [ label=".f =" ];
- Region23 [ shape=box style=filled fillcolor=yellow label="Region" ];
- Phi_224 [ style=filled fillcolor=lightyellow label="MemPhi_2" ];
- Return25 [ shape=box style=filled fillcolor=yellow label="Return" ];
- { rank=same; Region23;Phi_224;}
- }
- edge [ fontname=Helvetica, fontsize=8 ];
- Stop3 -> Return25[taillabel=0 color=red];
- new9 -> Start2:p0[taillabel=0 color=green];
- Store12 -> Start2:p1[taillabel=1 color=blue];
- Store12 -> new9[taillabel=2];
- Store12 -> Con_11[taillabel=3];
- new13 -> Start2:p0[taillabel=0 color=green];
- Store14 -> Store12[taillabel=1 color=blue];
- Store14 -> new13[taillabel=2];
- Store14 -> Con_4[taillabel=3];
- Load16 -> Store14[taillabel=1 color=blue];
- Load16 -> new9[taillabel=2];
- If17 -> Start2:p0[taillabel=0 color=red];
- If17 -> Start2:p2[taillabel=1];
- Store22 -> Store14[taillabel=1 color=blue];
- Store22 -> new9[taillabel=2];
- Store22 -> Con_21[taillabel=3];
- Region23 -> If17:p0[taillabel=1 color=red];
- Region23 -> If17:p1[taillabel=2 color=red];
- Phi_224 -> Region23 [style=dotted taillabel=0];
- Phi_224 -> Store22[taillabel=1 color=blue];
- Phi_224 -> Store14[taillabel=2 color=blue constraint=false];
- Return25 -> Region23[taillabel=0 color=red];
- Return25 -> Load16[taillabel=2];
- Return25 -> MemMerge[taillabel=1 color=blue];
- MemMerge -> Start2:p1[taillabel=1 color=blue];
- MemMerge -> Phi_224[taillabel=2 color=blue];
-}
diff --git a/chapter11/docs/graph1.json b/chapter11/docs/graph1.json
deleted file mode 100644
index 2d58e0ba..00000000
--- a/chapter11/docs/graph1.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "ver": 1,
- "comp": "chapter11/docs/graph1.svg",
- "step": 1,
- "roots": [25],
- "scope": 0,
- "nodes": [
- {"id": 1, "label": "MemMerge", "type": null, "kind": "MEM", "edges": [{"idx": 0, "def": 0, "role": "DATA", "label": null}, {"idx": 1, "def": 6, "role": "MEM", "label": null}, {"idx": 2, "def": 224, "role": "MEM", "label": null}], "proj": null},
- {"id": 2, "label": "Start", "type": null, "kind": "CTRL", "edges": [], "proj": null},
- {"id": 4, "label": "#0", "type": null, "kind": "DATA", "edges": [], "proj": null},
- {"id": 6, "label": "$mem", "type": null, "kind": "MEM", "edges": [{"idx": 0, "def": 2, "role": "MEM", "label": null}], "proj": {"par": 2, "idx": 1}},
- {"id": 9, "label": "new S", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}], "proj": null},
- {"id": 11, "label": "#2", "type": null, "kind": "DATA", "edges": [], "proj": null},
- {"id": 12, "label": ".f =", "type": null, "kind": "MEM", "edges": [{"idx": 0, "def": 0, "role": "DATA", "label": null}, {"idx": 1, "def": 6, "role": "MEM", "label": null}, {"idx": 2, "def": 9, "role": "DATA", "label": null}, {"idx": 3, "def": 11, "role": "DATA", "label": null}], "proj": null},
- {"id": 13, "label": "new S", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}], "proj": null},
- {"id": 14, "label": ".f =", "type": null, "kind": "MEM", "edges": [{"idx": 0, "def": 0, "role": "DATA", "label": null}, {"idx": 1, "def": 12, "role": "MEM", "label": null}, {"idx": 2, "def": 13, "role": "DATA", "label": null}, {"idx": 3, "def": 4, "role": "DATA", "label": null}], "proj": null},
- {"id": 16, "label": ".f", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 0, "role": "DATA", "label": null}, {"idx": 1, "def": 14, "role": "MEM", "label": null}, {"idx": 2, "def": 9, "role": "DATA", "label": null}], "proj": null},
- {"id": 21, "label": "#1", "type": null, "kind": "DATA", "edges": [], "proj": null},
- {"id": 22, "label": ".f =", "type": null, "kind": "MEM", "edges": [{"idx": 0, "def": 0, "role": "DATA", "label": null}, {"idx": 1, "def": 14, "role": "MEM", "label": null}, {"idx": 2, "def": 9, "role": "DATA", "label": null}, {"idx": 3, "def": 21, "role": "DATA", "label": null}], "proj": null},
- {"id": 25, "label": "Return", "type": null, "kind": "CTRL", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 1, "role": "MEM", "label": null}, {"idx": 2, "def": 16, "role": "DATA", "label": null}], "proj": null},
- {"id": 224, "label": "MemPhi_2", "type": null, "kind": "PHI", "edges": [{"idx": 0, "def": 0, "role": "ASSOC", "label": null}, {"idx": 1, "def": 22, "role": "MEM", "label": null}, {"idx": 2, "def": 14, "role": "MEM", "label": null}], "proj": null}
- ],
- "groups": [
- ]
-}
diff --git a/chapter11/docs/graph1.svg b/chapter11/docs/graph1.svg
deleted file mode 100644
index 93a2a03f..00000000
--- a/chapter11/docs/graph1.svg
+++ /dev/null
@@ -1,123 +0,0 @@
-<svg aria-label="Compiler graph" width="565" height="766" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 565 766" style="font-family: sans-serif;"><style>
- html, body { height:100%; margin:0; font-family:sans-serif; }
- .viewer { height:100%; display:grid; grid-template-rows:auto minmax(0,1fr) auto; }
- .source { padding:8px; border-bottom:1px solid #ccc; }
- #program { width:min(600px,80vw); vertical-align:middle; }
- #status { margin-top:4px; }
- #graph { min-height:0; overflow:hidden; position:relative; background:#fafbfc; }
- #elk { width:100%; height:100%; }
- #graph svg { display:block; }
- .tools { display:flex; flex-wrap:wrap; align-items:center; gap:14px; margin-top:8px; font-size:12px; }
- .hint { color:#616c78; }
- .ctrl { color:#b63838; } .mem { color:#2867b2; } .data { color:#536477; }
- .edge { fill:none; stroke-width:1.5; }
- .edge.CTRL { stroke-width:2; }
- .edge.ASSOC { stroke-dasharray:4 4; }
- .edge.PARSER { stroke-dasharray:5 4; }
- .parser rect { fill:#f6f0ff; stroke:#7956a5; stroke-width:1.5; stroke-dasharray:5 4; }
- .edge.selected { stroke-width:3.5; }
- .edge.bundle { stroke-width:4; }
- .edge.bundle.selected { stroke-width:6; }
- .edge-hit { fill:none; stroke:transparent; stroke-width:12; vector-effect:non-scaling-stroke; pointer-events:stroke; cursor:pointer; }
- .edge-jump { fill:transparent; pointer-events:all; cursor:pointer; }
- .node { cursor:pointer; }
- .box { stroke:#758191; stroke-width:1; }
- .node.held .box { stroke-dasharray:5 3; }
- .node.near .box { stroke:#c18221; stroke-width:2; }
- .node.focus .box { stroke:#9c4900; stroke-width:3; }
- .node.selected .box { stroke:#1569b9; stroke-width:3; }
- .node.folded .box { stroke-width:4; }
- .node.folding .box { fill:#f4ccd7; }
- .fold-tag { font-size:9px; font-weight:700; fill:#963751; }
- .peep-area { fill:#fff3d9; fill-opacity:.8; stroke:#c18221; stroke-width:2; pointer-events:none; }
- .node.peep-edit .box { stroke:#9c4900; stroke-width:3; }
- .node.error .box { stroke:#b42318; stroke-width:4; }
- #event.error { color:#b42318; font-weight:600; white-space:pre-wrap; overflow-wrap:anywhere; }
- .peep-ghosts { pointer-events:none; }
- .region-box { stroke:#9da9b8; stroke-width:1.5; }
- .fold-btn { cursor:pointer; }
- .fold-btn rect { fill:white; stroke:#596674; }
- .fold-btn text { font-size:14px; fill:#152330; }
- .fold-btn:focus rect { stroke:#1569b9; stroke-width:2; }
- .shortcut { cursor:pointer; }
- .shortcut path { fill:none; stroke-width:1.5; }
- .shortcut rect { fill:#fff8ec; stroke:#b63838; stroke-dasharray:3 2; }
- .shortcut text { font-size:11px; fill:#783030; }
- .shortcut.selected rect, .shortcut:focus rect { stroke-width:2.5; }
- .label { font-size:12px; fill:#152330; font-weight:600; }
- .node-id { font-size:10px; fill:#596674; font-weight:400; }
- .type { font-size:11px; fill:#455768; }
- .port { stroke:#536477; stroke-width:1; }
- .row { stroke:#b6afcf; stroke-width:1; }
- .bind { font-size:12px; fill:#152330; }
- .slot { font-size:10px; fill:#364352; paint-order:stroke; stroke:#fafbfc; stroke-width:3; }
- #detail { position:absolute; top:8px; right:8px; margin:0; padding:12px; max-width:320px;
- max-height:45%; overflow:auto; white-space:pre-wrap; overflow-wrap:anywhere;
- background:#fffffff2; border:1px solid #bac5d0; border-radius:4px; font-size:12px; }
- .controls { display:flex; flex-wrap:wrap; justify-content:center; align-items:center; gap:6px; padding:6px; }
- .button { color:white; background:black; font-size:20px; min-width:30px; }
- .button:disabled { background:grey; }
- .count { font-size:20px; min-width:35px; text-align:center; }
- #N { width:6ch; }
- #scrub { width:clamp(120px,35vw,600px); }
- </style><defs><marker id="arrow-CTRL" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#b63838"/></marker><marker id="arrow-DATA" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#536477"/></marker><marker id="arrow-MEM" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#2867b2"/></marker><marker id="arrow-ASSOC" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#9396a3"/></marker><marker id="arrow-PARSER" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#7956a5"/></marker></defs><rect width="100%" height="100%" fill="rgb(250, 251, 252)"/><g><g class="regions" style="opacity: 1;"/><rect class="peep-area" rx="36" style="opacity: 0;"/><g class="edges"><path class="edge MEM" id="e1i1" d="M84,118 L84,536 Q84,544 92,544 L137,544 Q145,544 145,552 L145,582" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#1[1] → #6 · MEM</title></path><path class="edge MEM" id="e1i2" d="M175,534 L175,582" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#1[2] → #224 · MEM</title></path><path class="edge MEM" id="e12i1" d="M84,118 L84,130 Q84,138 92,138 L146,138 Q154,138 154,146 L154,166" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#12[1] → #6 · MEM</title></path><path class="edge DATA" id="e12i2" d="M242,118 L242,123 Q242,128 237,128 L186,128 Q178,128 178,136 L178,166" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#12[2] → #9 · DATA</title></path><path class="edge DATA" id="e12i3" d="M394,118 L394,130 Q394,138 386,138 L210,138 Q202,138 202,146 L202,166" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#12[3] → #11 · DATA</title></path><path class="edge MEM" id="e14i1" d="M166,222 L166,227 Q166,232 171,232 L298,232 Q306,232 306,240 L306,270" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#14[1] → #12 · MEM</title></path><path class="edge DATA" id="e14i2" d="M318,222 L318,227 Q318,232 323,232 L324,232 Q330,232 330,238 L330,270" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#14[2] → #13 · DATA</title></path><path class="edge DATA" id="e14i3" d="M470,222 L470,227 Q470,232 465,232 L362,232 Q354,232 354,240 L354,270" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#14[3] → #4 · DATA</title></path><path class="edge MEM" id="e16i1" d="M318,326 L318,374" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#16[1] → #14 · MEM</title></path><path class="edge DATA" id="e16i2" d="M242,118 L242,123 Q242,128 247,128 L532,128 Q540,128 540,136 L540,328 Q540,336 532,336 L356,336 Q348,336 348,344 L348,374" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#16[2] → #9 · DATA</title></path><path class="edge MEM" id="e22i1" d="M318,326 L318,338 Q318,346 310,346 L151,346 Q143,346 143,354 L143,374" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#22[1] → #14 · MEM</title></path><path class="edge DATA" id="e22i2" d="M242,118 L242,123 Q242,128 237,128 L103,128 Q95,128 95,136 L95,348 Q95,356 103,356 L159,356 Q167,356 167,364 L167,374" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#22[2] → #9 · DATA</title></path><path class="edge DATA" id="e22i3" d="M166,326 L166,331 Q166,336 171,336 L183,336 Q191,336 191,344 L191,374" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#22[3] → #21 · DATA</title></path><path class="edge MEM" id="e25i1" d="M145,638 L145,643 Q145,648 150,648 L280,648 Q288,648 288,656 L288,686" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#25[1] → #1 · MEM</title></path><path class="edge DATA" id="e25i2" d="M318,430 L318,686" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#25[2] → #16 · DATA</title></path><path class="edge MEM" id="e224i1" d="M155,430 L155,478" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#224[1] → #22 · MEM</title></path><path class="edge MEM" id="e224i2" d="M318,326 L318,338 Q318,346 310,346 L233,346 Q225,346 225,354 L225,432 Q225,440 217,440 L203,440 Q195,440 195,448 L195,478" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#224[2] → #14 · MEM</title></path></g><g class="edge-hits"/><g class="parser" style="opacity: 1;"/><g class="nodes"><g class="node" id="n1" data-id="1" transform="translate(85,588)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>MemMerge</tspan><tspan class="node-id">  #1</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#1 MemMerge
-Type not computed
-
-[0] → — DATA
-[1] → #6 MEM
-[2] → #224 MEM</title><circle class="port" cx="30" cy="-3" r="3" fill="white"/><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><circle class="port" cx="90" cy="-3" r="3" fill="#536477"/><text class="slot" x="30" y="-10" text-anchor="middle">0</text><text class="slot" x="60" y="-10" text-anchor="middle">1</text><text class="slot" x="90" y="-10" text-anchor="middle">2</text></g><g class="node" id="n2" data-id="2" transform="translate(24,24)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Start</tspan><tspan class="node-id">  #2</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#2 Start
-Type not computed
-
-</title></g><g class="node" id="n4" data-id="4" transform="translate(410,172)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>#0</tspan><tspan class="node-id">  #4</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#4 #0
-Type not computed
-
-</title></g><g class="node" id="n6" data-id="6" transform="translate(24,68)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>$mem</tspan><tspan class="node-id">  #6/1</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#6 $mem
-Projection 1 of #2
-Type not computed
-
-[0] → #2 MEM</title></g><g class="node" id="n9" data-id="9" transform="translate(182,68)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>new S</tspan><tspan class="node-id">  #9</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#9 new S
-Type not computed
-
-[0] → — CTRL</title><circle class="port" cx="60" cy="-3" r="3" fill="white"/><text class="slot" x="60" y="-10" text-anchor="middle">0</text></g><g class="node" id="n11" data-id="11" transform="translate(334,68)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>#2</tspan><tspan class="node-id">  #11</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#11 #2
-Type not computed
-
-</title></g><g class="node" id="n12" data-id="12" transform="translate(106,172)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>.f =</tspan><tspan class="node-id">  #12</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#12 .f =
-Type not computed
-
-[0] → — DATA
-[1] → #6 MEM
-[2] → #9 DATA
-[3] → #11 DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n13" data-id="13" transform="translate(258,172)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>new S</tspan><tspan class="node-id">  #13</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#13 new S
-Type not computed
-
-[0] → — CTRL</title><circle class="port" cx="60" cy="-3" r="3" fill="white"/><text class="slot" x="60" y="-10" text-anchor="middle">0</text></g><g class="node" id="n14" data-id="14" transform="translate(258,276)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>.f =</tspan><tspan class="node-id">  #14</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#14 .f =
-Type not computed
-
-[0] → — DATA
-[1] → #12 MEM
-[2] → #13 DATA
-[3] → #4 DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n16" data-id="16" transform="translate(258,380)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>.f</tspan><tspan class="node-id">  #16</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#16 .f
-Type not computed
-
-[0] → — DATA
-[1] → #14 MEM
-[2] → #9 DATA</title><circle class="port" cx="30" cy="-3" r="3" fill="white"/><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><circle class="port" cx="90" cy="-3" r="3" fill="#536477"/><text class="slot" x="30" y="-10" text-anchor="middle">0</text><text class="slot" x="60" y="-10" text-anchor="middle">1</text><text class="slot" x="90" y="-10" text-anchor="middle">2</text></g><g class="node" id="n21" data-id="21" transform="translate(106,276)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>#1</tspan><tspan class="node-id">  #21</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#21 #1
-Type not computed
-
-</title></g><g class="node" id="n22" data-id="22" transform="translate(95,380)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>.f =</tspan><tspan class="node-id">  #22</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#22 .f =
-Type not computed
-
-[0] → — DATA
-[1] → #14 MEM
-[2] → #9 DATA
-[3] → #21 DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n25" data-id="25" transform="translate(228,692)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Return</tspan><tspan class="node-id">  #25</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#25 Return
-Type not computed
-
-[0] → — CTRL
-[1] → #1 MEM
-[2] → #16 DATA</title><circle class="port" cx="30" cy="-3" r="3" fill="white"/><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><circle class="port" cx="90" cy="-3" r="3" fill="#536477"/><text class="slot" x="30" y="-10" text-anchor="middle">0</text><text class="slot" x="60" y="-10" text-anchor="middle">1</text><text class="slot" x="90" y="-10" text-anchor="middle">2</text></g><g class="node" id="n224" data-id="224" transform="translate(115,484)" style="opacity: 1;"><path class="box" d="M12,0H108L120,22L108,44H12L0,22Z" fill="#f5e4fa"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>MemPhi_2</tspan><tspan class="node-id">  #224</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#224 MemPhi_2
-Type not computed
-
-[0] → — ASSOC
-[1] → #22 MEM
-[2] → #14 MEM</title><circle class="port" cx="0" cy="-3" r="3" fill="white"/><circle class="port" cx="40" cy="-3" r="3" fill="#536477"/><circle class="port" cx="80" cy="-3" r="3" fill="#536477"/><text class="slot" x="0" y="-10" text-anchor="middle">0</text><text class="slot" x="40" y="-10" text-anchor="middle">1</text><text class="slot" x="80" y="-10" text-anchor="middle">2</text></g></g><g class="region-heads" style="opacity: 1;"/><g class="shortcuts" style="opacity: 1;"/><g class="peep-ghosts" pointer-events="none"/></g></svg>
diff --git a/chapter11/docs/graph2.gv b/chapter11/docs/graph2.gv
deleted file mode 100644
index 730cf845..00000000
--- a/chapter11/docs/graph2.gv
+++ /dev/null
@@ -1,84 +0,0 @@
-digraph chapter11 {
-/*
-struct S { int f; }
-S v=new S;
-v.f = 2;
-int i=new S.f;
-i=v.f;
-if (arg) v.f=1;
-return i;
-
-*/
- rankdir=BT;
- concentrate="true";
- compound="true";
- subgraph cluster_Nodes {
- Start2 [ shape=plaintext label=<
- <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
- <TR><TD BGCOLOR="yellow">Start</TD></TR>
- <TR><TD>
- <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
- <TR><TD PORT="p0" BGCOLOR="yellow">$ctrl</TD><TD PORT="p1">$mem</TD><TD PORT="p2">arg</TD></TR>
- </TABLE>
- </TD></TR>
- </TABLE>>
- ];
- MemMerge [ shape=box label="MemMerge" ];
- Stop3 [ shape=box style=filled fillcolor=yellow label="Stop" ];
- Con_4 [ label="#0" ];
- new9 [ label="new S" ];
- Con_11 [ label="#2" ];
- Store12 [ label=".f =" ];
- new13 [ label="new S" ];
- Store14 [ label=".f =" ];
- Load16 [ label=".f" ];
- If17 [ shape=plaintext label=<
- <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
- <TR><TD BGCOLOR="yellow">If</TD></TR>
- <TR><TD>
- <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
- <TR><TD PORT="p0" BGCOLOR="yellow">True</TD><TD PORT="p1" BGCOLOR="yellow">False</TD></TR>
- </TABLE>
- </TD></TR>
- </TABLE>>
- ];
- Con_21 [ label="#1" ];
- Store22 [ label=".f =" ];
- Region23 [ shape=box style=filled fillcolor=yellow label="Region" ];
- Phi_224 [ style=filled fillcolor=lightyellow label="MemPhi_2" ];
- Return25 [ shape=box style=filled fillcolor=yellow label="Return" ];
- { rank=same; Region23;Phi_224;}
- }
- edge [ fontname=Helvetica, fontsize=8 ];
- Stop3 -> Return25[taillabel=0 color=red];
- new9 -> Start2:p0[taillabel=0 color=green];
- Store12 -> Start2:p0[taillabel=0 color=red];
- Store12 -> Start2:p1[taillabel=1 color=blue];
- Store12 -> new9[taillabel=2];
- Store12 -> Con_11[taillabel=3];
- new13 -> Start2:p0[taillabel=0 color=green];
- Store14 -> Start2:p0[taillabel=0 color=red];
- Store14 -> Store12[taillabel=1 color=blue];
- Store14 -> new13[taillabel=2];
- Store14 -> Con_4[taillabel=3];
- Load16 -> Start2:p0[taillabel=0 color=red];
- Load16 -> Store14[taillabel=1 color=blue];
- Load16 -> new9[taillabel=2];
- If17 -> Start2:p0[taillabel=0 color=red];
- If17 -> Start2:p2[taillabel=1];
- Store22 -> Start2:p0[taillabel=0 color=red];
- Store22 -> Store14[taillabel=1 color=blue];
- Store22 -> new9[taillabel=2];
- Store22 -> Con_21[taillabel=3];
- Region23 -> If17:p0[taillabel=1 color=red];
- Region23 -> If17:p1[taillabel=2 color=red];
- Phi_224 -> Region23 [style=dotted taillabel=0];
- Phi_224 -> Store22[taillabel=1 color=blue];
- Phi_224 -> Store14[taillabel=2 color=blue constraint=false];
- Return25 -> Region23[taillabel=0 color=red];
- Return25 -> Load16[taillabel=2];
- Return25 -> MemMerge[taillabel=1 color=blue];
- MemMerge -> Start2:p1[taillabel=1 color=blue];
- MemMerge -> Phi_224[taillabel=2 color=blue];
- MemMerge -> Region23[taillabel=0 color=green];
-}
diff --git a/chapter11/docs/graph2.json b/chapter11/docs/graph2.json
deleted file mode 100644
index 602c1584..00000000
--- a/chapter11/docs/graph2.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "ver": 1,
- "comp": "chapter11/docs/graph2.svg",
- "step": 1,
- "roots": [25],
- "scope": 0,
- "nodes": [
- {"id": 1, "label": "MemMerge", "type": null, "kind": "MEM", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 6, "role": "MEM", "label": null}, {"idx": 2, "def": 224, "role": "MEM", "label": null}], "proj": null},
- {"id": 2, "label": "Start", "type": null, "kind": "CTRL", "edges": [], "proj": null},
- {"id": 4, "label": "#0", "type": null, "kind": "DATA", "edges": [], "proj": null},
- {"id": 6, "label": "$mem", "type": null, "kind": "MEM", "edges": [{"idx": 0, "def": 2, "role": "MEM", "label": null}], "proj": {"par": 2, "idx": 1}},
- {"id": 9, "label": "new S", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}], "proj": null},
- {"id": 11, "label": "#2", "type": null, "kind": "DATA", "edges": [], "proj": null},
- {"id": 12, "label": ".f =", "type": null, "kind": "MEM", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 6, "role": "MEM", "label": null}, {"idx": 2, "def": 9, "role": "DATA", "label": null}, {"idx": 3, "def": 11, "role": "DATA", "label": null}], "proj": null},
- {"id": 13, "label": "new S", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}], "proj": null},
- {"id": 14, "label": ".f =", "type": null, "kind": "MEM", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 12, "role": "MEM", "label": null}, {"idx": 2, "def": 13, "role": "DATA", "label": null}, {"idx": 3, "def": 4, "role": "DATA", "label": null}], "proj": null},
- {"id": 16, "label": ".f", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 14, "role": "MEM", "label": null}, {"idx": 2, "def": 9, "role": "DATA", "label": null}], "proj": null},
- {"id": 21, "label": "#1", "type": null, "kind": "DATA", "edges": [], "proj": null},
- {"id": 22, "label": ".f =", "type": null, "kind": "MEM", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 14, "role": "MEM", "label": null}, {"idx": 2, "def": 9, "role": "DATA", "label": null}, {"idx": 3, "def": 21, "role": "DATA", "label": null}], "proj": null},
- {"id": 25, "label": "Return", "type": null, "kind": "CTRL", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 1, "role": "MEM", "label": null}, {"idx": 2, "def": 16, "role": "DATA", "label": null}], "proj": null},
- {"id": 224, "label": "MemPhi_2", "type": null, "kind": "PHI", "edges": [{"idx": 0, "def": 0, "role": "ASSOC", "label": null}, {"idx": 1, "def": 22, "role": "MEM", "label": null}, {"idx": 2, "def": 14, "role": "MEM", "label": null}], "proj": null}
- ],
- "groups": [
- ]
-}
diff --git a/chapter11/docs/graph2.svg b/chapter11/docs/graph2.svg
deleted file mode 100644
index 05210749..00000000
--- a/chapter11/docs/graph2.svg
+++ /dev/null
@@ -1,123 +0,0 @@
-<svg aria-label="Compiler graph" width="565" height="766" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 565 766" style="font-family: sans-serif;"><style>
- html, body { height:100%; margin:0; font-family:sans-serif; }
- .viewer { height:100%; display:grid; grid-template-rows:auto minmax(0,1fr) auto; }
- .source { padding:8px; border-bottom:1px solid #ccc; }
- #program { width:min(600px,80vw); vertical-align:middle; }
- #status { margin-top:4px; }
- #graph { min-height:0; overflow:hidden; position:relative; background:#fafbfc; }
- #elk { width:100%; height:100%; }
- #graph svg { display:block; }
- .tools { display:flex; flex-wrap:wrap; align-items:center; gap:14px; margin-top:8px; font-size:12px; }
- .hint { color:#616c78; }
- .ctrl { color:#b63838; } .mem { color:#2867b2; } .data { color:#536477; }
- .edge { fill:none; stroke-width:1.5; }
- .edge.CTRL { stroke-width:2; }
- .edge.ASSOC { stroke-dasharray:4 4; }
- .edge.PARSER { stroke-dasharray:5 4; }
- .parser rect { fill:#f6f0ff; stroke:#7956a5; stroke-width:1.5; stroke-dasharray:5 4; }
- .edge.selected { stroke-width:3.5; }
- .edge.bundle { stroke-width:4; }
- .edge.bundle.selected { stroke-width:6; }
- .edge-hit { fill:none; stroke:transparent; stroke-width:12; vector-effect:non-scaling-stroke; pointer-events:stroke; cursor:pointer; }
- .edge-jump { fill:transparent; pointer-events:all; cursor:pointer; }
- .node { cursor:pointer; }
- .box { stroke:#758191; stroke-width:1; }
- .node.held .box { stroke-dasharray:5 3; }
- .node.near .box { stroke:#c18221; stroke-width:2; }
- .node.focus .box { stroke:#9c4900; stroke-width:3; }
- .node.selected .box { stroke:#1569b9; stroke-width:3; }
- .node.folded .box { stroke-width:4; }
- .node.folding .box { fill:#f4ccd7; }
- .fold-tag { font-size:9px; font-weight:700; fill:#963751; }
- .peep-area { fill:#fff3d9; fill-opacity:.8; stroke:#c18221; stroke-width:2; pointer-events:none; }
- .node.peep-edit .box { stroke:#9c4900; stroke-width:3; }
- .node.error .box { stroke:#b42318; stroke-width:4; }
- #event.error { color:#b42318; font-weight:600; white-space:pre-wrap; overflow-wrap:anywhere; }
- .peep-ghosts { pointer-events:none; }
- .region-box { stroke:#9da9b8; stroke-width:1.5; }
- .fold-btn { cursor:pointer; }
- .fold-btn rect { fill:white; stroke:#596674; }
- .fold-btn text { font-size:14px; fill:#152330; }
- .fold-btn:focus rect { stroke:#1569b9; stroke-width:2; }
- .shortcut { cursor:pointer; }
- .shortcut path { fill:none; stroke-width:1.5; }
- .shortcut rect { fill:#fff8ec; stroke:#b63838; stroke-dasharray:3 2; }
- .shortcut text { font-size:11px; fill:#783030; }
- .shortcut.selected rect, .shortcut:focus rect { stroke-width:2.5; }
- .label { font-size:12px; fill:#152330; font-weight:600; }
- .node-id { font-size:10px; fill:#596674; font-weight:400; }
- .type { font-size:11px; fill:#455768; }
- .port { stroke:#536477; stroke-width:1; }
- .row { stroke:#b6afcf; stroke-width:1; }
- .bind { font-size:12px; fill:#152330; }
- .slot { font-size:10px; fill:#364352; paint-order:stroke; stroke:#fafbfc; stroke-width:3; }
- #detail { position:absolute; top:8px; right:8px; margin:0; padding:12px; max-width:320px;
- max-height:45%; overflow:auto; white-space:pre-wrap; overflow-wrap:anywhere;
- background:#fffffff2; border:1px solid #bac5d0; border-radius:4px; font-size:12px; }
- .controls { display:flex; flex-wrap:wrap; justify-content:center; align-items:center; gap:6px; padding:6px; }
- .button { color:white; background:black; font-size:20px; min-width:30px; }
- .button:disabled { background:grey; }
- .count { font-size:20px; min-width:35px; text-align:center; }
- #N { width:6ch; }
- #scrub { width:clamp(120px,35vw,600px); }
- </style><defs><marker id="arrow-CTRL" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#b63838"/></marker><marker id="arrow-DATA" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#536477"/></marker><marker id="arrow-MEM" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#2867b2"/></marker><marker id="arrow-ASSOC" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#9396a3"/></marker><marker id="arrow-PARSER" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#7956a5"/></marker></defs><rect width="100%" height="100%" fill="rgb(250, 251, 252)"/><g><g class="regions" style="opacity: 1;"/><rect class="peep-area" rx="36" style="opacity: 0;"/><g class="edges"><path class="edge MEM" id="e1i1" d="M84,118 L84,536 Q84,544 92,544 L137,544 Q145,544 145,552 L145,582" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#1[1] → #6 · MEM</title></path><path class="edge MEM" id="e1i2" d="M175,534 L175,582" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#1[2] → #224 · MEM</title></path><path class="edge MEM" id="e12i1" d="M84,118 L84,130 Q84,138 92,138 L146,138 Q154,138 154,146 L154,166" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#12[1] → #6 · MEM</title></path><path class="edge DATA" id="e12i2" d="M242,118 L242,123 Q242,128 237,128 L186,128 Q178,128 178,136 L178,166" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#12[2] → #9 · DATA</title></path><path class="edge DATA" id="e12i3" d="M394,118 L394,130 Q394,138 386,138 L210,138 Q202,138 202,146 L202,166" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#12[3] → #11 · DATA</title></path><path class="edge MEM" id="e14i1" d="M166,222 L166,227 Q166,232 171,232 L298,232 Q306,232 306,240 L306,270" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#14[1] → #12 · MEM</title></path><path class="edge DATA" id="e14i2" d="M318,222 L318,227 Q318,232 323,232 L324,232 Q330,232 330,238 L330,270" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#14[2] → #13 · DATA</title></path><path class="edge DATA" id="e14i3" d="M470,222 L470,227 Q470,232 465,232 L362,232 Q354,232 354,240 L354,270" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#14[3] → #4 · DATA</title></path><path class="edge MEM" id="e16i1" d="M318,326 L318,374" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#16[1] → #14 · MEM</title></path><path class="edge DATA" id="e16i2" d="M242,118 L242,123 Q242,128 247,128 L532,128 Q540,128 540,136 L540,328 Q540,336 532,336 L356,336 Q348,336 348,344 L348,374" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#16[2] → #9 · DATA</title></path><path class="edge MEM" id="e22i1" d="M318,326 L318,338 Q318,346 310,346 L151,346 Q143,346 143,354 L143,374" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#22[1] → #14 · MEM</title></path><path class="edge DATA" id="e22i2" d="M242,118 L242,123 Q242,128 237,128 L103,128 Q95,128 95,136 L95,348 Q95,356 103,356 L159,356 Q167,356 167,364 L167,374" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#22[2] → #9 · DATA</title></path><path class="edge DATA" id="e22i3" d="M166,326 L166,331 Q166,336 171,336 L183,336 Q191,336 191,344 L191,374" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#22[3] → #21 · DATA</title></path><path class="edge MEM" id="e25i1" d="M145,638 L145,643 Q145,648 150,648 L280,648 Q288,648 288,656 L288,686" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#25[1] → #1 · MEM</title></path><path class="edge DATA" id="e25i2" d="M318,430 L318,686" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#25[2] → #16 · DATA</title></path><path class="edge MEM" id="e224i1" d="M155,430 L155,478" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#224[1] → #22 · MEM</title></path><path class="edge MEM" id="e224i2" d="M318,326 L318,338 Q318,346 310,346 L233,346 Q225,346 225,354 L225,432 Q225,440 217,440 L203,440 Q195,440 195,448 L195,478" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#224[2] → #14 · MEM</title></path></g><g class="edge-hits"/><g class="parser" style="opacity: 1;"/><g class="nodes"><g class="node" id="n1" data-id="1" transform="translate(85,588)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>MemMerge</tspan><tspan class="node-id">  #1</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#1 MemMerge
-Type not computed
-
-[0] → — CTRL
-[1] → #6 MEM
-[2] → #224 MEM</title><circle class="port" cx="30" cy="-3" r="3" fill="white"/><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><circle class="port" cx="90" cy="-3" r="3" fill="#536477"/><text class="slot" x="30" y="-10" text-anchor="middle">0</text><text class="slot" x="60" y="-10" text-anchor="middle">1</text><text class="slot" x="90" y="-10" text-anchor="middle">2</text></g><g class="node" id="n2" data-id="2" transform="translate(24,24)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Start</tspan><tspan class="node-id">  #2</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#2 Start
-Type not computed
-
-</title></g><g class="node" id="n4" data-id="4" transform="translate(410,172)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>#0</tspan><tspan class="node-id">  #4</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#4 #0
-Type not computed
-
-</title></g><g class="node" id="n6" data-id="6" transform="translate(24,68)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>$mem</tspan><tspan class="node-id">  #6/1</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#6 $mem
-Projection 1 of #2
-Type not computed
-
-[0] → #2 MEM</title></g><g class="node" id="n9" data-id="9" transform="translate(182,68)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>new S</tspan><tspan class="node-id">  #9</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#9 new S
-Type not computed
-
-[0] → — CTRL</title><circle class="port" cx="60" cy="-3" r="3" fill="white"/><text class="slot" x="60" y="-10" text-anchor="middle">0</text></g><g class="node" id="n11" data-id="11" transform="translate(334,68)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>#2</tspan><tspan class="node-id">  #11</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#11 #2
-Type not computed
-
-</title></g><g class="node" id="n12" data-id="12" transform="translate(106,172)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>.f =</tspan><tspan class="node-id">  #12</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#12 .f =
-Type not computed
-
-[0] → — CTRL
-[1] → #6 MEM
-[2] → #9 DATA
-[3] → #11 DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n13" data-id="13" transform="translate(258,172)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>new S</tspan><tspan class="node-id">  #13</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#13 new S
-Type not computed
-
-[0] → — CTRL</title><circle class="port" cx="60" cy="-3" r="3" fill="white"/><text class="slot" x="60" y="-10" text-anchor="middle">0</text></g><g class="node" id="n14" data-id="14" transform="translate(258,276)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>.f =</tspan><tspan class="node-id">  #14</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#14 .f =
-Type not computed
-
-[0] → — CTRL
-[1] → #12 MEM
-[2] → #13 DATA
-[3] → #4 DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n16" data-id="16" transform="translate(258,380)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>.f</tspan><tspan class="node-id">  #16</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#16 .f
-Type not computed
-
-[0] → — CTRL
-[1] → #14 MEM
-[2] → #9 DATA</title><circle class="port" cx="30" cy="-3" r="3" fill="white"/><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><circle class="port" cx="90" cy="-3" r="3" fill="#536477"/><text class="slot" x="30" y="-10" text-anchor="middle">0</text><text class="slot" x="60" y="-10" text-anchor="middle">1</text><text class="slot" x="90" y="-10" text-anchor="middle">2</text></g><g class="node" id="n21" data-id="21" transform="translate(106,276)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>#1</tspan><tspan class="node-id">  #21</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#21 #1
-Type not computed
-
-</title></g><g class="node" id="n22" data-id="22" transform="translate(95,380)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>.f =</tspan><tspan class="node-id">  #22</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#22 .f =
-Type not computed
-
-[0] → — CTRL
-[1] → #14 MEM
-[2] → #9 DATA
-[3] → #21 DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n25" data-id="25" transform="translate(228,692)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Return</tspan><tspan class="node-id">  #25</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#25 Return
-Type not computed
-
-[0] → — CTRL
-[1] → #1 MEM
-[2] → #16 DATA</title><circle class="port" cx="30" cy="-3" r="3" fill="white"/><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><circle class="port" cx="90" cy="-3" r="3" fill="#536477"/><text class="slot" x="30" y="-10" text-anchor="middle">0</text><text class="slot" x="60" y="-10" text-anchor="middle">1</text><text class="slot" x="90" y="-10" text-anchor="middle">2</text></g><g class="node" id="n224" data-id="224" transform="translate(115,484)" style="opacity: 1;"><path class="box" d="M12,0H108L120,22L108,44H12L0,22Z" fill="#f5e4fa"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>MemPhi_2</tspan><tspan class="node-id">  #224</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#224 MemPhi_2
-Type not computed
-
-[0] → — ASSOC
-[1] → #22 MEM
-[2] → #14 MEM</title><circle class="port" cx="0" cy="-3" r="3" fill="white"/><circle class="port" cx="40" cy="-3" r="3" fill="#536477"/><circle class="port" cx="80" cy="-3" r="3" fill="#536477"/><text class="slot" x="0" y="-10" text-anchor="middle">0</text><text class="slot" x="40" y="-10" text-anchor="middle">1</text><text class="slot" x="80" y="-10" text-anchor="middle">2</text></g></g><g class="region-heads" style="opacity: 1;"/><g class="shortcuts" style="opacity: 1;"/><g class="peep-ghosts" pointer-events="none"/></g></svg>
diff --git a/chapter11/docs/graph3-snip.jpg b/chapter11/docs/graph3-snip.jpg
deleted file mode 100644
index 804a32c4..00000000
--- a/chapter11/docs/graph3-snip.jpg
+++ /dev/null
Binary files differ
diff --git a/chapter11/docs/graph3-snip.json b/chapter11/docs/graph3-snip.json
deleted file mode 100644
index 7dade538..00000000
--- a/chapter11/docs/graph3-snip.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "ver": 1,
- "comp": "chapter11/docs/graph3-snip.svg",
- "step": 1,
- "roots": [22],
- "scope": 0,
- "nodes": [
- {"id": 8, "label": "True", "type": null, "kind": "CTRL", "edges": [], "proj": {"par": 0, "idx": 0}},
- {"id": 9, "label": "new S", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}], "proj": null},
- {"id": 14, "label": ".f =", "type": null, "kind": "MEM", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 0, "role": "MEM", "label": null}, {"idx": 2, "def": 0, "role": "DATA", "label": null}, {"idx": 3, "def": 0, "role": "DATA", "label": null}], "proj": null},
- {"id": 16, "label": ".f", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 14, "role": "MEM", "label": null}, {"idx": 2, "def": 9, "role": "DATA", "label": null}], "proj": null},
- {"id": 21, "label": "#1", "type": null, "kind": "DATA", "edges": [], "proj": null},
- {"id": 22, "label": ".f =", "type": null, "kind": "MEM", "edges": [{"idx": 0, "def": 8, "role": "CTRL", "label": null}, {"idx": 1, "def": 14, "role": "MEM", "label": null}, {"idx": 2, "def": 9, "role": "DATA", "label": null}, {"idx": 3, "def": 21, "role": "DATA", "label": null}, {"idx": 4, "def": 16, "role": "DATA", "label": null}], "proj": null}
- ],
- "groups": [
- ]
-}
diff --git a/chapter11/docs/graph3-snip.svg b/chapter11/docs/graph3-snip.svg
deleted file mode 100644
index 9f5218af..00000000
--- a/chapter11/docs/graph3-snip.svg
+++ /dev/null
@@ -1,91 +0,0 @@
-<svg aria-label="Compiler graph" width="427" height="314" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 427 314" style="font-family: sans-serif;"><style>
- html, body { height:100%; margin:0; font-family:sans-serif; }
- .viewer { height:100%; display:grid; grid-template-rows:auto minmax(0,1fr) auto; }
- .source { padding:8px; border-bottom:1px solid #ccc; }
- #program { width:min(600px,80vw); vertical-align:middle; }
- #status { margin-top:4px; }
- #graph { min-height:0; overflow:hidden; position:relative; background:#fafbfc; }
- #elk { width:100%; height:100%; }
- #graph svg { display:block; }
- .tools { display:flex; flex-wrap:wrap; align-items:center; gap:14px; margin-top:8px; font-size:12px; }
- .hint { color:#616c78; }
- .ctrl { color:#b63838; } .mem { color:#2867b2; } .data { color:#536477; }
- .edge { fill:none; stroke-width:1.5; }
- .edge.CTRL { stroke-width:2; }
- .edge.ASSOC { stroke-dasharray:4 4; }
- .edge.PARSER { stroke-dasharray:5 4; }
- .parser rect { fill:#f6f0ff; stroke:#7956a5; stroke-width:1.5; stroke-dasharray:5 4; }
- .edge.selected { stroke-width:3.5; }
- .edge.bundle { stroke-width:4; }
- .edge.bundle.selected { stroke-width:6; }
- .edge-hit { fill:none; stroke:transparent; stroke-width:12; vector-effect:non-scaling-stroke; pointer-events:stroke; cursor:pointer; }
- .edge-jump { fill:transparent; pointer-events:all; cursor:pointer; }
- .node { cursor:pointer; }
- .box { stroke:#758191; stroke-width:1; }
- .node.held .box { stroke-dasharray:5 3; }
- .node.near .box { stroke:#c18221; stroke-width:2; }
- .node.focus .box { stroke:#9c4900; stroke-width:3; }
- .node.selected .box { stroke:#1569b9; stroke-width:3; }
- .node.folded .box { stroke-width:4; }
- .node.folding .box { fill:#f4ccd7; }
- .fold-tag { font-size:9px; font-weight:700; fill:#963751; }
- .peep-area { fill:#fff3d9; fill-opacity:.8; stroke:#c18221; stroke-width:2; pointer-events:none; }
- .node.peep-edit .box { stroke:#9c4900; stroke-width:3; }
- .node.error .box { stroke:#b42318; stroke-width:4; }
- #event.error { color:#b42318; font-weight:600; white-space:pre-wrap; overflow-wrap:anywhere; }
- .peep-ghosts { pointer-events:none; }
- .region-box { stroke:#9da9b8; stroke-width:1.5; }
- .fold-btn { cursor:pointer; }
- .fold-btn rect { fill:white; stroke:#596674; }
- .fold-btn text { font-size:14px; fill:#152330; }
- .fold-btn:focus rect { stroke:#1569b9; stroke-width:2; }
- .shortcut { cursor:pointer; }
- .shortcut path { fill:none; stroke-width:1.5; }
- .shortcut rect { fill:#fff8ec; stroke:#b63838; stroke-dasharray:3 2; }
- .shortcut text { font-size:11px; fill:#783030; }
- .shortcut.selected rect, .shortcut:focus rect { stroke-width:2.5; }
- .label { font-size:12px; fill:#152330; font-weight:600; }
- .node-id { font-size:10px; fill:#596674; font-weight:400; }
- .type { font-size:11px; fill:#455768; }
- .port { stroke:#536477; stroke-width:1; }
- .row { stroke:#b6afcf; stroke-width:1; }
- .bind { font-size:12px; fill:#152330; }
- .slot { font-size:10px; fill:#364352; paint-order:stroke; stroke:#fafbfc; stroke-width:3; }
- #detail { position:absolute; top:8px; right:8px; margin:0; padding:12px; max-width:320px;
- max-height:45%; overflow:auto; white-space:pre-wrap; overflow-wrap:anywhere;
- background:#fffffff2; border:1px solid #bac5d0; border-radius:4px; font-size:12px; }
- .controls { display:flex; flex-wrap:wrap; justify-content:center; align-items:center; gap:6px; padding:6px; }
- .button { color:white; background:black; font-size:20px; min-width:30px; }
- .button:disabled { background:grey; }
- .count { font-size:20px; min-width:35px; text-align:center; }
- #N { width:6ch; }
- #scrub { width:clamp(120px,35vw,600px); }
- </style><defs><marker id="arrow-CTRL" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#b63838"/></marker><marker id="arrow-DATA" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#536477"/></marker><marker id="arrow-MEM" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#2867b2"/></marker><marker id="arrow-ASSOC" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#9396a3"/></marker><marker id="arrow-PARSER" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#7956a5"/></marker></defs><rect width="100%" height="100%" fill="rgb(250, 251, 252)"/><g><g class="regions" style="opacity: 1;"/><rect class="peep-area" rx="36" style="opacity: 0;"/><g class="edges"><path class="edge MEM" id="e16i1" d="M109,80 L109,92 Q109,100 117,100 L335,100 Q343,100 343,108 L343,128" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#16[1] → #14 · MEM</title></path><path class="edge DATA" id="e16i2" d="M261,80 L261,85 Q261,90 266,90 L365,90 Q373,90 373,98 L373,128" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#16[2] → #9 · DATA</title></path><path class="edge CTRL" id="e22i0" d="M62,184 L62,234" stroke="#b63838" marker-start="url(#arrow-CTRL)" style="opacity: 1;"><title>#22[0] → #8 · CTRL</title></path><path class="edge MEM" id="e22i1" d="M109,80 L109,186 Q109,194 101,194 L90,194 Q82,194 82,202 L82,234" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#22[1] → #14 · MEM</title></path><path class="edge DATA" id="e22i2" d="M261,80 L261,85 Q261,90 256,90 L128,90 Q120,90 120,98 L120,196 Q120,204 112,204 L110,204 Q102,204 102,212 L102,234" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#22[2] → #9 · DATA</title></path><path class="edge DATA" id="e22i3" d="M191,184 L191,206 Q191,214 183,214 L130,214 Q122,214 122,222 L122,234" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#22[3] → #21 · DATA</title></path><path class="edge DATA" id="e22i4" d="M343,184 L343,216 Q343,224 335,224 L147,224 Q142,224 142,229 L142,234" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#22[4] → #16 · DATA</title></path></g><g class="edge-hits"/><g class="parser" style="opacity: 1;"/><g class="nodes"><g class="node" id="n8" data-id="8" transform="translate(24,152)" style="opacity: 1;"><path class="box" d="M0,0H75V26H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="37.5" y="17"><tspan>True</tspan><tspan class="node-id">  #8/0</tspan></text><text class="type" text-anchor="middle" y="35" x="37.5"/><title>#8 True
-Projection 0 of #0
-Type not computed
-
-</title></g><g class="node" id="n9" data-id="9" transform="translate(201,30)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>new S</tspan><tspan class="node-id">  #9</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#9 new S
-Type not computed
-
-[0] → — CTRL</title><circle class="port" cx="60" cy="-3" r="3" fill="white"/><text class="slot" x="60" y="-10" text-anchor="middle">0</text></g><g class="node" id="n14" data-id="14" transform="translate(49,30)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>.f =</tspan><tspan class="node-id">  #14</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#14 .f =
-Type not computed
-
-[0] → — CTRL
-[1] → — MEM
-[2] → — DATA
-[3] → — DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="white"/><circle class="port" cx="72" cy="-3" r="3" fill="white"/><circle class="port" cx="96" cy="-3" r="3" fill="white"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n16" data-id="16" transform="translate(283,134)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>.f</tspan><tspan class="node-id">  #16</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#16 .f
-Type not computed
-
-[0] → — CTRL
-[1] → #14 MEM
-[2] → #9 DATA</title><circle class="port" cx="30" cy="-3" r="3" fill="white"/><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><circle class="port" cx="90" cy="-3" r="3" fill="#536477"/><text class="slot" x="30" y="-10" text-anchor="middle">0</text><text class="slot" x="60" y="-10" text-anchor="middle">1</text><text class="slot" x="90" y="-10" text-anchor="middle">2</text></g><g class="node" id="n21" data-id="21" transform="translate(131,134)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>#1</tspan><tspan class="node-id">  #21</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#21 #1
-Type not computed
-
-</title></g><g class="node" id="n22" data-id="22" transform="translate(42,240)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>.f =</tspan><tspan class="node-id">  #22</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#22 .f =
-Type not computed
-
-[0] → #8 CTRL
-[1] → #14 MEM
-[2] → #9 DATA
-[3] → #21 DATA
-[4] → #16 DATA</title><circle class="port" cx="20" cy="-3" r="3" fill="#536477"/><circle class="port" cx="40" cy="-3" r="3" fill="#536477"/><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><circle class="port" cx="80" cy="-3" r="3" fill="#536477"/><circle class="port" cx="100" cy="-3" r="3" fill="#536477"/><text class="slot" x="20" y="-10" text-anchor="middle">0</text><text class="slot" x="40" y="-10" text-anchor="middle">1</text><text class="slot" x="60" y="-10" text-anchor="middle">2</text><text class="slot" x="80" y="-10" text-anchor="middle">3</text><text class="slot" x="100" y="-10" text-anchor="middle">4</text></g></g><g class="region-heads" style="opacity: 1;"/><g class="shortcuts" style="opacity: 1;"/><g class="peep-ghosts" pointer-events="none"/></g></svg>
diff --git a/chapter11/docs/graph3.gv b/chapter11/docs/graph3.gv
deleted file mode 100644
index d89d0ed4..00000000
--- a/chapter11/docs/graph3.gv
+++ /dev/null
@@ -1,85 +0,0 @@
-digraph chapter11 {
-/*
-struct S { int f; }
-S v=new S;
-v.f = 2;
-int i=new S.f;
-i=v.f;
-if (arg) v.f=1;
-return i;
-
-*/
- rankdir=BT;
- concentrate="true";
- compound="true";
- subgraph cluster_Nodes {
- Start2 [ shape=plaintext label=<
- <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
- <TR><TD BGCOLOR="yellow">Start</TD></TR>
- <TR><TD>
- <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
- <TR><TD PORT="p0" BGCOLOR="yellow">$ctrl</TD><TD PORT="p1">$mem</TD><TD PORT="p2">arg</TD></TR>
- </TABLE>
- </TD></TR>
- </TABLE>>
- ];
- MemMerge [ shape=box label="MemMerge" ];
- Stop3 [ shape=box style=filled fillcolor=yellow label="Stop" ];
- Con_4 [ label="#0" ];
- new9 [ label="new S" ];
- Con_11 [ label="#2" ];
- Store12 [ label=".f =" ];
- new13 [ label="new S" ];
- Store14 [ label=".f =" ];
- Load16 [ label=".f" ];
- If17 [ shape=plaintext label=<
- <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
- <TR><TD BGCOLOR="yellow">If</TD></TR>
- <TR><TD>
- <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
- <TR><TD PORT="p0" BGCOLOR="yellow">True</TD><TD PORT="p1" BGCOLOR="yellow">False</TD></TR>
- </TABLE>
- </TD></TR>
- </TABLE>>
- ];
- Con_21 [ label="#1" ];
- Store22 [ label=".f =" ];
- Region23 [ shape=box style=filled fillcolor=yellow label="Region" ];
- Phi_224 [ style=filled fillcolor=lightyellow label="MemPhi_2" ];
- Return25 [ shape=box style=filled fillcolor=yellow label="Return" ];
- { rank=same; Region23;Phi_224;}
- }
- edge [ fontname=Helvetica, fontsize=8 ];
- Stop3 -> Return25[taillabel=0 color=red];
- new9 -> Start2:p0[taillabel=0 color=green];
- Store12 -> Start2:p0[taillabel=0 color=red];
- Store12 -> Start2:p1[taillabel=1 color=blue];
- Store12 -> new9[taillabel=2];
- Store12 -> Con_11[taillabel=3];
- new13 -> Start2:p0[taillabel=0 color=green];
- Store14 -> Start2:p0[taillabel=0 color=red];
- Store14 -> Store12[taillabel=1 color=blue];
- Store14 -> new13[taillabel=2];
- Store14 -> Con_4[taillabel=3];
- Load16 -> Start2:p0[taillabel=0 color=red];
- Load16 -> Store14[taillabel=1 color=blue];
- Load16 -> new9[taillabel=2];
- If17 -> Start2:p0[taillabel=0 color=red];
- If17 -> Start2:p2[taillabel=1];
- Store22 -> If17:p0[taillabel=0 color=red];
- Store22 -> Store14[taillabel=1 color=blue];
- Store22 -> new9[taillabel=2];
- Store22 -> Con_21[taillabel=3];
- Store22 -> Load16[taillabel=4];
- Region23 -> If17:p0[taillabel=1 color=red];
- Region23 -> If17:p1[taillabel=2 color=red];
- Phi_224 -> Region23 [style=dotted taillabel=0];
- Phi_224 -> Store22[taillabel=1 color=blue];
- Phi_224 -> Store14[taillabel=2 color=blue constraint=false];
- Return25 -> Region23[taillabel=0 color=red];
- Return25 -> Load16[taillabel=2];
- Return25 -> MemMerge[taillabel=1 color=blue];
- MemMerge -> Start2:p1[taillabel=1 color=blue];
- MemMerge -> Phi_224[taillabel=2 color=blue];
- MemMerge -> Region23[taillabel=0 color=green];
-}
diff --git a/chapter11/docs/graph3.json b/chapter11/docs/graph3.json
deleted file mode 100644
index 577d7c3b..00000000
--- a/chapter11/docs/graph3.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "ver": 1,
- "comp": "chapter11/docs/graph3.svg",
- "step": 1,
- "roots": [25],
- "scope": 0,
- "nodes": [
- {"id": 1, "label": "MemMerge", "type": null, "kind": "MEM", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 6, "role": "MEM", "label": null}, {"idx": 2, "def": 224, "role": "MEM", "label": null}], "proj": null},
- {"id": 2, "label": "Start", "type": null, "kind": "CTRL", "edges": [], "proj": null},
- {"id": 4, "label": "#0", "type": null, "kind": "DATA", "edges": [], "proj": null},
- {"id": 6, "label": "$mem", "type": null, "kind": "MEM", "edges": [{"idx": 0, "def": 2, "role": "MEM", "label": null}], "proj": {"par": 2, "idx": 1}},
- {"id": 8, "label": "True", "type": null, "kind": "CTRL", "edges": [], "proj": {"par": 0, "idx": 0}},
- {"id": 9, "label": "new S", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}], "proj": null},
- {"id": 11, "label": "#2", "type": null, "kind": "DATA", "edges": [], "proj": null},
- {"id": 12, "label": ".f =", "type": null, "kind": "MEM", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 6, "role": "MEM", "label": null}, {"idx": 2, "def": 9, "role": "DATA", "label": null}, {"idx": 3, "def": 11, "role": "DATA", "label": null}], "proj": null},
- {"id": 13, "label": "new S", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}], "proj": null},
- {"id": 14, "label": ".f =", "type": null, "kind": "MEM", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 12, "role": "MEM", "label": null}, {"idx": 2, "def": 13, "role": "DATA", "label": null}, {"idx": 3, "def": 4, "role": "DATA", "label": null}], "proj": null},
- {"id": 16, "label": ".f", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 14, "role": "MEM", "label": null}, {"idx": 2, "def": 9, "role": "DATA", "label": null}], "proj": null},
- {"id": 21, "label": "#1", "type": null, "kind": "DATA", "edges": [], "proj": null},
- {"id": 22, "label": ".f =", "type": null, "kind": "MEM", "edges": [{"idx": 0, "def": 8, "role": "CTRL", "label": null}, {"idx": 1, "def": 14, "role": "MEM", "label": null}, {"idx": 2, "def": 9, "role": "DATA", "label": null}, {"idx": 3, "def": 21, "role": "DATA", "label": null}, {"idx": 4, "def": 16, "role": "DATA", "label": null}], "proj": null},
- {"id": 25, "label": "Return", "type": null, "kind": "CTRL", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 1, "role": "MEM", "label": null}, {"idx": 2, "def": 16, "role": "DATA", "label": null}], "proj": null},
- {"id": 224, "label": "MemPhi_2", "type": null, "kind": "PHI", "edges": [{"idx": 0, "def": 0, "role": "ASSOC", "label": null}, {"idx": 1, "def": 22, "role": "MEM", "label": null}, {"idx": 2, "def": 14, "role": "MEM", "label": null}], "proj": null}
- ],
- "groups": [
- ]
-}
diff --git a/chapter11/docs/graph3.svg b/chapter11/docs/graph3.svg
deleted file mode 100644
index 0247b5c6..00000000
--- a/chapter11/docs/graph3.svg
+++ /dev/null
@@ -1,128 +0,0 @@
-<svg aria-label="Compiler graph" width="661" height="872" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 661 872" style="font-family: sans-serif;"><style>
- html, body { height:100%; margin:0; font-family:sans-serif; }
- .viewer { height:100%; display:grid; grid-template-rows:auto minmax(0,1fr) auto; }
- .source { padding:8px; border-bottom:1px solid #ccc; }
- #program { width:min(600px,80vw); vertical-align:middle; }
- #status { margin-top:4px; }
- #graph { min-height:0; overflow:hidden; position:relative; background:#fafbfc; }
- #elk { width:100%; height:100%; }
- #graph svg { display:block; }
- .tools { display:flex; flex-wrap:wrap; align-items:center; gap:14px; margin-top:8px; font-size:12px; }
- .hint { color:#616c78; }
- .ctrl { color:#b63838; } .mem { color:#2867b2; } .data { color:#536477; }
- .edge { fill:none; stroke-width:1.5; }
- .edge.CTRL { stroke-width:2; }
- .edge.ASSOC { stroke-dasharray:4 4; }
- .edge.PARSER { stroke-dasharray:5 4; }
- .parser rect { fill:#f6f0ff; stroke:#7956a5; stroke-width:1.5; stroke-dasharray:5 4; }
- .edge.selected { stroke-width:3.5; }
- .edge.bundle { stroke-width:4; }
- .edge.bundle.selected { stroke-width:6; }
- .edge-hit { fill:none; stroke:transparent; stroke-width:12; vector-effect:non-scaling-stroke; pointer-events:stroke; cursor:pointer; }
- .edge-jump { fill:transparent; pointer-events:all; cursor:pointer; }
- .node { cursor:pointer; }
- .box { stroke:#758191; stroke-width:1; }
- .node.held .box { stroke-dasharray:5 3; }
- .node.near .box { stroke:#c18221; stroke-width:2; }
- .node.focus .box { stroke:#9c4900; stroke-width:3; }
- .node.selected .box { stroke:#1569b9; stroke-width:3; }
- .node.folded .box { stroke-width:4; }
- .node.folding .box { fill:#f4ccd7; }
- .fold-tag { font-size:9px; font-weight:700; fill:#963751; }
- .peep-area { fill:#fff3d9; fill-opacity:.8; stroke:#c18221; stroke-width:2; pointer-events:none; }
- .node.peep-edit .box { stroke:#9c4900; stroke-width:3; }
- .node.error .box { stroke:#b42318; stroke-width:4; }
- #event.error { color:#b42318; font-weight:600; white-space:pre-wrap; overflow-wrap:anywhere; }
- .peep-ghosts { pointer-events:none; }
- .region-box { stroke:#9da9b8; stroke-width:1.5; }
- .fold-btn { cursor:pointer; }
- .fold-btn rect { fill:white; stroke:#596674; }
- .fold-btn text { font-size:14px; fill:#152330; }
- .fold-btn:focus rect { stroke:#1569b9; stroke-width:2; }
- .shortcut { cursor:pointer; }
- .shortcut path { fill:none; stroke-width:1.5; }
- .shortcut rect { fill:#fff8ec; stroke:#b63838; stroke-dasharray:3 2; }
- .shortcut text { font-size:11px; fill:#783030; }
- .shortcut.selected rect, .shortcut:focus rect { stroke-width:2.5; }
- .label { font-size:12px; fill:#152330; font-weight:600; }
- .node-id { font-size:10px; fill:#596674; font-weight:400; }
- .type { font-size:11px; fill:#455768; }
- .port { stroke:#536477; stroke-width:1; }
- .row { stroke:#b6afcf; stroke-width:1; }
- .bind { font-size:12px; fill:#152330; }
- .slot { font-size:10px; fill:#364352; paint-order:stroke; stroke:#fafbfc; stroke-width:3; }
- #detail { position:absolute; top:8px; right:8px; margin:0; padding:12px; max-width:320px;
- max-height:45%; overflow:auto; white-space:pre-wrap; overflow-wrap:anywhere;
- background:#fffffff2; border:1px solid #bac5d0; border-radius:4px; font-size:12px; }
- .controls { display:flex; flex-wrap:wrap; justify-content:center; align-items:center; gap:6px; padding:6px; }
- .button { color:white; background:black; font-size:20px; min-width:30px; }
- .button:disabled { background:grey; }
- .count { font-size:20px; min-width:35px; text-align:center; }
- #N { width:6ch; }
- #scrub { width:clamp(120px,35vw,600px); }
- </style><defs><marker id="arrow-CTRL" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#b63838"/></marker><marker id="arrow-DATA" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#536477"/></marker><marker id="arrow-MEM" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#2867b2"/></marker><marker id="arrow-ASSOC" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#9396a3"/></marker><marker id="arrow-PARSER" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#7956a5"/></marker></defs><rect width="100%" height="100%" fill="rgb(250, 251, 252)"/><g><g class="regions" style="opacity: 1;"/><rect class="peep-area" rx="36" style="opacity: 0;"/><g class="edges"><path class="edge MEM" id="e1i1" d="M84,118 L84,642 Q84,650 92,650 L387,650 Q395,650 395,658 L395,688" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#1[1] → #6 · MEM</title></path><path class="edge MEM" id="e1i2" d="M425,640 L425,688" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#1[2] → #224 · MEM</title></path><path class="edge MEM" id="e12i1" d="M84,118 L84,140 Q84,148 92,148 L242,148 Q250,148 250,156 L250,166" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#12[1] → #6 · MEM</title></path><path class="edge DATA" id="e12i2" d="M274,118 L274,166" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#12[2] → #9 · DATA</title></path><path class="edge DATA" id="e12i3" d="M426,118 L426,123 Q426,128 421,128 L306,128 Q298,128 298,136 L298,166" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#12[3] → #11 · DATA</title></path><path class="edge MEM" id="e14i1" d="M262,222 L262,227 Q262,232 267,232 L382,232 Q390,232 390,240 L390,270" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#14[1] → #12 · MEM</title></path><path class="edge DATA" id="e14i2" d="M414,222 L414,270" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#14[2] → #13 · DATA</title></path><path class="edge DATA" id="e14i3" d="M566,222 L566,227 Q566,232 561,232 L446,232 Q438,232 438,240 L438,270" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#14[3] → #4 · DATA</title></path><path class="edge MEM" id="e16i1" d="M402,326 L402,340 Q402,346 408,346 L408,346 Q414,346 414,352 L414,374" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#16[1] → #14 · MEM</title></path><path class="edge DATA" id="e16i2" d="M274,118 L274,130 Q274,138 282,138 L628,138 Q636,138 636,146 L636,328 Q636,336 628,336 L452,336 Q444,336 444,344 L444,374" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#16[2] → #9 · DATA</title></path><path class="edge CTRL" id="e22i0" d="M133,430 L133,480" stroke="#b63838" marker-start="url(#arrow-CTRL)" style="opacity: 1;"><title>#22[0] → #8 · CTRL</title></path><path class="edge MEM" id="e22i1" d="M402,326 L402,338 Q402,346 394,346 L188,346 Q180,346 180,354 L180,432 Q180,440 172,440 L161,440 Q153,440 153,448 L153,480" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#22[1] → #14 · MEM</title></path><path class="edge DATA" id="e22i2" d="M274,118 L274,130 Q274,138 266,138 L199,138 Q191,138 191,146 L191,442 Q191,450 183,450 L181,450 Q173,450 173,458 L173,480" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#22[2] → #9 · DATA</title></path><path class="edge DATA" id="e22i3" d="M262,430 L262,452 Q262,460 254,460 L201,460 Q193,460 193,468 L193,480" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#22[3] → #21 · DATA</title></path><path class="edge DATA" id="e22i4" d="M414,430 L414,462 Q414,470 406,470 L218,470 Q213,470 213,475 L213,480" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#22[4] → #16 · DATA</title></path><path class="edge MEM" id="e25i1" d="M395,744 L395,749 Q395,754 400,754 L457,754 Q465,754 465,762 L465,792" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#25[1] → #1 · MEM</title></path><path class="edge DATA" id="e25i2" d="M414,430 L414,462 Q414,470 422,470 L487,470 Q495,470 495,478 L495,792" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#25[2] → #16 · DATA</title></path><path class="edge MEM" id="e224i1" d="M173,536 L173,541 Q173,546 178,546 L397,546 Q405,546 405,554 L405,584" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#224[1] → #22 · MEM</title></path><path class="edge MEM" id="e224i2" d="M402,326 L402,338 Q402,346 410,346 L476,346 Q484,346 484,354 L484,432 Q484,440 476,440 L453,440 Q445,440 445,448 L445,584" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#224[2] → #14 · MEM</title></path></g><g class="edge-hits"/><g class="parser" style="opacity: 1;"/><g class="nodes"><g class="node" id="n1" data-id="1" transform="translate(335,694)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>MemMerge</tspan><tspan class="node-id">  #1</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#1 MemMerge
-Type not computed
-
-[0] → — CTRL
-[1] → #6 MEM
-[2] → #224 MEM</title><circle class="port" cx="30" cy="-3" r="3" fill="white"/><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><circle class="port" cx="90" cy="-3" r="3" fill="#536477"/><text class="slot" x="30" y="-10" text-anchor="middle">0</text><text class="slot" x="60" y="-10" text-anchor="middle">1</text><text class="slot" x="90" y="-10" text-anchor="middle">2</text></g><g class="node" id="n2" data-id="2" transform="translate(24,24)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Start</tspan><tspan class="node-id">  #2</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#2 Start
-Type not computed
-
-</title></g><g class="node" id="n4" data-id="4" transform="translate(506,172)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>#0</tspan><tspan class="node-id">  #4</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#4 #0
-Type not computed
-
-</title></g><g class="node" id="n6" data-id="6" transform="translate(24,68)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>$mem</tspan><tspan class="node-id">  #6/1</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#6 $mem
-Projection 1 of #2
-Type not computed
-
-[0] → #2 MEM</title></g><g class="node" id="n8" data-id="8" transform="translate(95,398)" style="opacity: 1;"><path class="box" d="M0,0H75V26H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="37.5" y="17"><tspan>True</tspan><tspan class="node-id">  #8/0</tspan></text><text class="type" text-anchor="middle" y="35" x="37.5"/><title>#8 True
-Projection 0 of #0
-Type not computed
-
-</title></g><g class="node" id="n9" data-id="9" transform="translate(214,68)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>new S</tspan><tspan class="node-id">  #9</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#9 new S
-Type not computed
-
-[0] → — CTRL</title><circle class="port" cx="60" cy="-3" r="3" fill="white"/><text class="slot" x="60" y="-10" text-anchor="middle">0</text></g><g class="node" id="n11" data-id="11" transform="translate(366,68)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>#2</tspan><tspan class="node-id">  #11</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#11 #2
-Type not computed
-
-</title></g><g class="node" id="n12" data-id="12" transform="translate(202,172)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>.f =</tspan><tspan class="node-id">  #12</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#12 .f =
-Type not computed
-
-[0] → — CTRL
-[1] → #6 MEM
-[2] → #9 DATA
-[3] → #11 DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n13" data-id="13" transform="translate(354,172)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>new S</tspan><tspan class="node-id">  #13</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#13 new S
-Type not computed
-
-[0] → — CTRL</title><circle class="port" cx="60" cy="-3" r="3" fill="white"/><text class="slot" x="60" y="-10" text-anchor="middle">0</text></g><g class="node" id="n14" data-id="14" transform="translate(342,276)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>.f =</tspan><tspan class="node-id">  #14</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#14 .f =
-Type not computed
-
-[0] → — CTRL
-[1] → #12 MEM
-[2] → #13 DATA
-[3] → #4 DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n16" data-id="16" transform="translate(354,380)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>.f</tspan><tspan class="node-id">  #16</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#16 .f
-Type not computed
-
-[0] → — CTRL
-[1] → #14 MEM
-[2] → #9 DATA</title><circle class="port" cx="30" cy="-3" r="3" fill="white"/><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><circle class="port" cx="90" cy="-3" r="3" fill="#536477"/><text class="slot" x="30" y="-10" text-anchor="middle">0</text><text class="slot" x="60" y="-10" text-anchor="middle">1</text><text class="slot" x="90" y="-10" text-anchor="middle">2</text></g><g class="node" id="n21" data-id="21" transform="translate(202,380)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>#1</tspan><tspan class="node-id">  #21</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#21 #1
-Type not computed
-
-</title></g><g class="node" id="n22" data-id="22" transform="translate(113,486)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>.f =</tspan><tspan class="node-id">  #22</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#22 .f =
-Type not computed
-
-[0] → #8 CTRL
-[1] → #14 MEM
-[2] → #9 DATA
-[3] → #21 DATA
-[4] → #16 DATA</title><circle class="port" cx="20" cy="-3" r="3" fill="#536477"/><circle class="port" cx="40" cy="-3" r="3" fill="#536477"/><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><circle class="port" cx="80" cy="-3" r="3" fill="#536477"/><circle class="port" cx="100" cy="-3" r="3" fill="#536477"/><text class="slot" x="20" y="-10" text-anchor="middle">0</text><text class="slot" x="40" y="-10" text-anchor="middle">1</text><text class="slot" x="60" y="-10" text-anchor="middle">2</text><text class="slot" x="80" y="-10" text-anchor="middle">3</text><text class="slot" x="100" y="-10" text-anchor="middle">4</text></g><g class="node" id="n25" data-id="25" transform="translate(405,798)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Return</tspan><tspan class="node-id">  #25</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#25 Return
-Type not computed
-
-[0] → — CTRL
-[1] → #1 MEM
-[2] → #16 DATA</title><circle class="port" cx="30" cy="-3" r="3" fill="white"/><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><circle class="port" cx="90" cy="-3" r="3" fill="#536477"/><text class="slot" x="30" y="-10" text-anchor="middle">0</text><text class="slot" x="60" y="-10" text-anchor="middle">1</text><text class="slot" x="90" y="-10" text-anchor="middle">2</text></g><g class="node" id="n224" data-id="224" transform="translate(365,590)" style="opacity: 1;"><path class="box" d="M12,0H108L120,22L108,44H12L0,22Z" fill="#f5e4fa"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>MemPhi_2</tspan><tspan class="node-id">  #224</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#224 MemPhi_2
-Type not computed
-
-[0] → — ASSOC
-[1] → #22 MEM
-[2] → #14 MEM</title><circle class="port" cx="0" cy="-3" r="3" fill="white"/><circle class="port" cx="40" cy="-3" r="3" fill="#536477"/><circle class="port" cx="80" cy="-3" r="3" fill="#536477"/><text class="slot" x="0" y="-10" text-anchor="middle">0</text><text class="slot" x="40" y="-10" text-anchor="middle">1</text><text class="slot" x="80" y="-10" text-anchor="middle">2</text></g></g><g class="region-heads" style="opacity: 1;"/><g class="shortcuts" style="opacity: 1;"/><g class="peep-ghosts" pointer-events="none"/></g></svg>
diff --git a/chapter11/docs/graph4.gv b/chapter11/docs/graph4.gv
deleted file mode 100644
index cf622aa1..00000000
--- a/chapter11/docs/graph4.gv
+++ /dev/null
@@ -1,110 +0,0 @@
-digraph chapter11 {
-/*
-struct S { int f; }
-S v = new S;
-int i = arg;
-while (arg > 0) {
- int j = i/3;
- if (arg == 5)
- v.f = j;
- arg = arg - 1;
-}
-return v;
-
-*/
- rankdir=BT;
- concentrate="true";
- compound="true";
- subgraph cluster_Nodes {
- Start2 [ shape=plaintext label=<
- <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
- <TR><TD BGCOLOR="yellow">Start</TD></TR>
- <TR><TD>
- <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
- <TR><TD PORT="p0" BGCOLOR="yellow">$ctrl</TD><TD PORT="p1">$mem</TD><TD PORT="p2">arg</TD></TR>
- </TABLE>
- </TD></TR>
- </TABLE>>
- ];
- MemMerge [ shape=box label="MemMerge" ];
- Stop3 [ shape=box style=filled fillcolor=yellow label="Stop" ];
- Con_4 [ label="#0" ];
- new9 [ label="new S" ];
- Store10 [ label=".f =" ];
- Loop11 [ shape=box style=filled fillcolor=yellow label="Loop" ];
- Phi_arg13 [ style=filled fillcolor=lightyellow label="&phi;_arg" ];
- LT14 [ label="<" ];
- If16 [ shape=plaintext label=<
- <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
- <TR><TD BGCOLOR="yellow">If</TD></TR>
- <TR><TD>
- <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
- <TR><TD PORT="p0" BGCOLOR="yellow">True</TD><TD PORT="p1" BGCOLOR="yellow">False</TD></TR>
- </TABLE>
- </TD></TR>
- </TABLE>>
- ];
- Div21 [ label="//" ];
- Con_22 [ label="#3" ];
- EQ23 [ label="==" ];
- Con_24 [ label="#5" ];
- If25 [ shape=plaintext label=<
- <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
- <TR><TD BGCOLOR="yellow">If</TD></TR>
- <TR><TD>
- <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
- <TR><TD PORT="p0" BGCOLOR="yellow">True</TD><TD PORT="p1" BGCOLOR="yellow">False</TD></TR>
- </TABLE>
- </TD></TR>
- </TABLE>>
- ];
- Phi_230 [ style=filled fillcolor=lightyellow label="MemPhi_2" ];
- Store31 [ label=".f =" ];
- Region32 [ shape=box style=filled fillcolor=yellow label="Region" ];
- Phi_233 [ style=filled fillcolor=lightyellow label="MemPhi_2" ];
- Sub35 [ label="-" ];
- Con_36 [ label="#1" ];
- Return37 [ shape=box style=filled fillcolor=yellow label="Return" ];
- { rank=same; Loop11;Phi_230;Phi_arg13;}
- { rank=same; Region32;Phi_233;}
- }
- edge [ fontname=Helvetica, fontsize=8 ];
- Stop3 -> Return37[taillabel=0 color=red];
- new9 -> Start2:p0[taillabel=0 color=green];
- Store10 -> Start2:p1[taillabel=1 color=blue];
- Store10 -> new9[taillabel=2];
- Store10 -> Con_4[taillabel=3];
- Loop11 -> Start2:p0[taillabel=1 color=red];
- Loop11 -> Region32[taillabel=2 color=red constraint=false];
- Phi_arg13 -> Loop11 [style=dotted taillabel=0];
- Phi_arg13 -> Start2:p2[taillabel=1];
- Phi_arg13 -> Sub35[taillabel=2 constraint=false];
- LT14 -> Con_4[taillabel=1];
- LT14 -> Phi_arg13[taillabel=2];
- If16 -> Loop11[taillabel=0 color=red];
- If16 -> LT14[taillabel=1];
- Div21 -> Start2:p2[taillabel=1];
- Div21 -> Con_22[taillabel=2];
- EQ23 -> Phi_arg13[taillabel=1];
- EQ23 -> Con_24[taillabel=2];
- If25 -> If16:p0[taillabel=0 color=red];
- If25 -> EQ23[taillabel=1];
- Phi_230 -> Loop11 [style=dotted taillabel=0];
- Phi_230 -> Store10[taillabel=1 color=blue];
- Phi_230 -> Phi_233[taillabel=2 color=blue constraint=false];
- Store31 -> Phi_230[taillabel=1 color=blue];
- Store31 -> new9[taillabel=2];
- Store31 -> Div21[taillabel=3];
- Region32 -> If25:p0[taillabel=1 color=red];
- Region32 -> If25:p1[taillabel=2 color=red];
- Phi_233 -> Region32 [style=dotted taillabel=0];
- Phi_233 -> Store31[taillabel=1 color=blue];
- Phi_233 -> Phi_230[taillabel=2 color=blue constraint=false];
- Sub35 -> Phi_arg13[taillabel=1];
- Sub35 -> Con_36[taillabel=2];
- Return37 -> If16:p1[taillabel=0 color=red];
- Return37 -> new9[taillabel=2];
- Return37 -> MemMerge[taillabel=1 color=blue];
- MemMerge -> Start2:p1[taillabel=1 color=blue];
- MemMerge -> Phi_230[taillabel=2 color=blue];
-}
diff --git a/chapter11/docs/graph4.json b/chapter11/docs/graph4.json
deleted file mode 100644
index 44c1c055..00000000
--- a/chapter11/docs/graph4.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "ver": 1,
- "comp": "chapter11/docs/graph4.svg",
- "step": 1,
- "roots": [37],
- "scope": 0,
- "nodes": [
- {"id": 1, "label": "MemMerge", "type": null, "kind": "MEM", "edges": [{"idx": 0, "def": 0, "role": "DATA", "label": null}, {"idx": 1, "def": 6, "role": "MEM", "label": null}, {"idx": 2, "def": 230, "role": "MEM", "label": null}], "proj": null},
- {"id": 2, "label": "Start", "type": null, "kind": "CTRL", "edges": [], "proj": null},
- {"id": 4, "label": "#0", "type": null, "kind": "DATA", "edges": [], "proj": null},
- {"id": 6, "label": "$mem", "type": null, "kind": "MEM", "edges": [{"idx": 0, "def": 2, "role": "MEM", "label": null}], "proj": {"par": 2, "idx": 1}},
- {"id": 7, "label": "arg", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 2, "role": "DATA", "label": null}], "proj": {"par": 2, "idx": 2}},
- {"id": 9, "label": "new S", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}], "proj": null},
- {"id": 10, "label": ".f =", "type": null, "kind": "MEM", "edges": [{"idx": 0, "def": 0, "role": "DATA", "label": null}, {"idx": 1, "def": 6, "role": "MEM", "label": null}, {"idx": 2, "def": 9, "role": "DATA", "label": null}, {"idx": 3, "def": 4, "role": "DATA", "label": null}], "proj": null},
- {"id": 21, "label": "//", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 0, "role": "DATA", "label": null}, {"idx": 1, "def": 7, "role": "DATA", "label": null}, {"idx": 2, "def": 22, "role": "DATA", "label": null}], "proj": null},
- {"id": 22, "label": "#3", "type": null, "kind": "DATA", "edges": [], "proj": null},
- {"id": 31, "label": ".f =", "type": null, "kind": "MEM", "edges": [{"idx": 0, "def": 0, "role": "DATA", "label": null}, {"idx": 1, "def": 230, "role": "MEM", "label": null}, {"idx": 2, "def": 9, "role": "DATA", "label": null}, {"idx": 3, "def": 21, "role": "DATA", "label": null}], "proj": null},
- {"id": 37, "label": "Return", "type": null, "kind": "CTRL", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 1, "role": "MEM", "label": null}, {"idx": 2, "def": 9, "role": "DATA", "label": null}], "proj": null},
- {"id": 230, "label": "MemPhi_2", "type": null, "kind": "PHI", "edges": [{"idx": 0, "def": 0, "role": "ASSOC", "label": null}, {"idx": 1, "def": 10, "role": "MEM", "label": null}, {"idx": 2, "def": 233, "role": "MEM", "label": null}], "proj": null},
- {"id": 233, "label": "MemPhi_2", "type": null, "kind": "PHI", "edges": [{"idx": 0, "def": 0, "role": "ASSOC", "label": null}, {"idx": 1, "def": 31, "role": "MEM", "label": null}, {"idx": 2, "def": 230, "role": "MEM", "label": null}], "proj": null}
- ],
- "groups": [
- ]
-}
diff --git a/chapter11/docs/graph4.svg b/chapter11/docs/graph4.svg
deleted file mode 100644
index 9ca92879..00000000
--- a/chapter11/docs/graph4.svg
+++ /dev/null
@@ -1,120 +0,0 @@
-<svg aria-label="Compiler graph" width="780" height="568" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 780 568" style="font-family: sans-serif;"><style>
- html, body { height:100%; margin:0; font-family:sans-serif; }
- .viewer { height:100%; display:grid; grid-template-rows:auto minmax(0,1fr) auto; }
- .source { padding:8px; border-bottom:1px solid #ccc; }
- #program { width:min(600px,80vw); vertical-align:middle; }
- #status { margin-top:4px; }
- #graph { min-height:0; overflow:hidden; position:relative; background:#fafbfc; }
- #elk { width:100%; height:100%; }
- #graph svg { display:block; }
- .tools { display:flex; flex-wrap:wrap; align-items:center; gap:14px; margin-top:8px; font-size:12px; }
- .hint { color:#616c78; }
- .ctrl { color:#b63838; } .mem { color:#2867b2; } .data { color:#536477; }
- .edge { fill:none; stroke-width:1.5; }
- .edge.CTRL { stroke-width:2; }
- .edge.ASSOC { stroke-dasharray:4 4; }
- .edge.PARSER { stroke-dasharray:5 4; }
- .parser rect { fill:#f6f0ff; stroke:#7956a5; stroke-width:1.5; stroke-dasharray:5 4; }
- .edge.selected { stroke-width:3.5; }
- .edge.bundle { stroke-width:4; }
- .edge.bundle.selected { stroke-width:6; }
- .edge-hit { fill:none; stroke:transparent; stroke-width:12; vector-effect:non-scaling-stroke; pointer-events:stroke; cursor:pointer; }
- .edge-jump { fill:transparent; pointer-events:all; cursor:pointer; }
- .node { cursor:pointer; }
- .box { stroke:#758191; stroke-width:1; }
- .node.held .box { stroke-dasharray:5 3; }
- .node.near .box { stroke:#c18221; stroke-width:2; }
- .node.focus .box { stroke:#9c4900; stroke-width:3; }
- .node.selected .box { stroke:#1569b9; stroke-width:3; }
- .node.folded .box { stroke-width:4; }
- .node.folding .box { fill:#f4ccd7; }
- .fold-tag { font-size:9px; font-weight:700; fill:#963751; }
- .peep-area { fill:#fff3d9; fill-opacity:.8; stroke:#c18221; stroke-width:2; pointer-events:none; }
- .node.peep-edit .box { stroke:#9c4900; stroke-width:3; }
- .node.error .box { stroke:#b42318; stroke-width:4; }
- #event.error { color:#b42318; font-weight:600; white-space:pre-wrap; overflow-wrap:anywhere; }
- .peep-ghosts { pointer-events:none; }
- .region-box { stroke:#9da9b8; stroke-width:1.5; }
- .fold-btn { cursor:pointer; }
- .fold-btn rect { fill:white; stroke:#596674; }
- .fold-btn text { font-size:14px; fill:#152330; }
- .fold-btn:focus rect { stroke:#1569b9; stroke-width:2; }
- .shortcut { cursor:pointer; }
- .shortcut path { fill:none; stroke-width:1.5; }
- .shortcut rect { fill:#fff8ec; stroke:#b63838; stroke-dasharray:3 2; }
- .shortcut text { font-size:11px; fill:#783030; }
- .shortcut.selected rect, .shortcut:focus rect { stroke-width:2.5; }
- .label { font-size:12px; fill:#152330; font-weight:600; }
- .node-id { font-size:10px; fill:#596674; font-weight:400; }
- .type { font-size:11px; fill:#455768; }
- .port { stroke:#536477; stroke-width:1; }
- .row { stroke:#b6afcf; stroke-width:1; }
- .bind { font-size:12px; fill:#152330; }
- .slot { font-size:10px; fill:#364352; paint-order:stroke; stroke:#fafbfc; stroke-width:3; }
- #detail { position:absolute; top:8px; right:8px; margin:0; padding:12px; max-width:320px;
- max-height:45%; overflow:auto; white-space:pre-wrap; overflow-wrap:anywhere;
- background:#fffffff2; border:1px solid #bac5d0; border-radius:4px; font-size:12px; }
- .controls { display:flex; flex-wrap:wrap; justify-content:center; align-items:center; gap:6px; padding:6px; }
- .button { color:white; background:black; font-size:20px; min-width:30px; }
- .button:disabled { background:grey; }
- .count { font-size:20px; min-width:35px; text-align:center; }
- #N { width:6ch; }
- #scrub { width:clamp(120px,35vw,600px); }
- </style><defs><marker id="arrow-CTRL" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#b63838"/></marker><marker id="arrow-DATA" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#536477"/></marker><marker id="arrow-MEM" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#2867b2"/></marker><marker id="arrow-ASSOC" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#9396a3"/></marker><marker id="arrow-PARSER" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#7956a5"/></marker></defs><rect width="100%" height="100%" fill="rgb(250, 251, 252)"/><g><g class="regions" style="opacity: 1;"/><rect class="peep-area" rx="36" style="opacity: 0;"/><g class="edges"><path class="edge MEM" id="e1i1" d="M266,118 L266,123 Q266,128 261,128 L193,128 Q185,128 185,136 L185,374" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#1[1] → #6 · MEM</title></path><path class="edge MEM" id="e1i2" d="M259,326 L259,338 Q259,346 251,346 L223,346 Q215,346 215,354 L215,374" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#1[2] → #230 · MEM</title></path><path class="edge MEM" id="e10i1" d="M266,118 L266,123 Q266,128 261,128 L252,128 Q244,128 244,136 L244,166" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#10[1] → #6 · MEM</title></path><path class="edge DATA" id="e10i2" d="M114,118 L114,130 Q114,138 122,138 L260,138 Q268,138 268,146 L268,166" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#10[2] → #9 · DATA</title></path><path class="edge DATA" id="e10i3" d="M544,118 L544,123 Q544,128 539,128 L300,128 Q292,128 292,136 L292,166" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#10[3] → #4 · DATA</title></path><path class="edge DATA" id="e21i1" d="M386,118 L386,130 Q386,138 394,138 L400,138 Q408,138 408,146 L408,166" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#21[1] → #7 · DATA</title></path><path class="edge DATA" id="e21i2" d="M696,118 L696,130 Q696,138 688,138 L446,138 Q438,138 438,146 L438,166" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#21[2] → #22 · DATA</title></path><path class="edge MEM" id="e31i1" d="M259,326 L259,338 Q259,346 267,346 L306,346 Q314,346 314,354 L314,374" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#31[1] → #230 · MEM</title></path><path class="edge DATA" id="e31i2" d="M114,118 L114,328 Q114,336 122,336 L330,336 Q338,336 338,344 L338,374" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#31[2] → #9 · DATA</title></path><path class="edge DATA" id="e31i3" d="M408,222 L408,328 Q408,336 400,336 L370,336 Q362,336 362,344 L362,374" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#31[3] → #21 · DATA</title></path><path class="edge MEM" id="e37i1" d="M185,430 L185,435 Q185,440 180,440 L92,440 Q84,440 84,448 L84,478" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#37[1] → #1 · MEM</title></path><path class="edge DATA" id="e37i2" d="M114,118 L114,478" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#37[2] → #9 · DATA</title></path><path class="edge MEM" id="e230i1" d="M256,222 L256,227 Q256,232 251,232 L247,232 Q239,232 239,240 L239,270" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#230[1] → #10 · MEM</title></path><path class="edge MEM" id="e230i2" d="M326,534 L326,539 Q326,544 331,544 L388,544 Q396,544 396,536 L396,240 Q396,232 388,232 L287,232 Q279,232 279,240 L279,270" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#230[2] → #233 · MEM</title></path><path class="edge MEM" id="e233i1" d="M326,430 L326,435 Q326,440 321,440 L314,440 Q306,440 306,448 L306,478" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#233[1] → #31 · MEM</title></path><path class="edge MEM" id="e233i2" d="M259,326 L259,344 Q259,346 257,346 L257,346 Q255,346 255,348 L255,442 Q255,450 263,450 L338,450 Q346,450 346,458 L346,478" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#233[2] → #230 · MEM</title></path></g><g class="edge-hits"/><g class="parser" style="opacity: 1;"/><g class="nodes"><g class="node" id="n1" data-id="1" transform="translate(125,380)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>MemMerge</tspan><tspan class="node-id">  #1</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#1 MemMerge
-Type not computed
-
-[0] → — DATA
-[1] → #6 MEM
-[2] → #230 MEM</title><circle class="port" cx="30" cy="-3" r="3" fill="white"/><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><circle class="port" cx="90" cy="-3" r="3" fill="#536477"/><text class="slot" x="30" y="-10" text-anchor="middle">0</text><text class="slot" x="60" y="-10" text-anchor="middle">1</text><text class="slot" x="90" y="-10" text-anchor="middle">2</text></g><g class="node" id="n2" data-id="2" transform="translate(206,24)" style="opacity: 1;"><path class="box" d="M0,0H240V44H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="120" y="18"><tspan>Start</tspan><tspan class="node-id">  #2</tspan></text><text class="type" text-anchor="middle" y="35" x="120"/><title>#2 Start
-Type not computed
-
-</title></g><g class="node" id="n4" data-id="4" transform="translate(484,68)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>#0</tspan><tspan class="node-id">  #4</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#4 #0
-Type not computed
-
-</title></g><g class="node" id="n6" data-id="6" transform="translate(206,68)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>$mem</tspan><tspan class="node-id">  #6/1</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#6 $mem
-Projection 1 of #2
-Type not computed
-
-[0] → #2 MEM</title></g><g class="node" id="n7" data-id="7" transform="translate(326,68)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>arg</tspan><tspan class="node-id">  #7/2</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#7 arg
-Projection 2 of #2
-Type not computed
-
-[0] → #2 DATA</title></g><g class="node" id="n9" data-id="9" transform="translate(54,68)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>new S</tspan><tspan class="node-id">  #9</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#9 new S
-Type not computed
-
-[0] → — CTRL</title><circle class="port" cx="60" cy="-3" r="3" fill="white"/><text class="slot" x="60" y="-10" text-anchor="middle">0</text></g><g class="node" id="n10" data-id="10" transform="translate(196,172)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>.f =</tspan><tspan class="node-id">  #10</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#10 .f =
-Type not computed
-
-[0] → — DATA
-[1] → #6 MEM
-[2] → #9 DATA
-[3] → #4 DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n21" data-id="21" transform="translate(348,172)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>//</tspan><tspan class="node-id">  #21</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#21 //
-Type not computed
-
-[0] → — DATA
-[1] → #7 DATA
-[2] → #22 DATA</title><circle class="port" cx="30" cy="-3" r="3" fill="white"/><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><circle class="port" cx="90" cy="-3" r="3" fill="#536477"/><text class="slot" x="30" y="-10" text-anchor="middle">0</text><text class="slot" x="60" y="-10" text-anchor="middle">1</text><text class="slot" x="90" y="-10" text-anchor="middle">2</text></g><g class="node" id="n22" data-id="22" transform="translate(636,68)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>#3</tspan><tspan class="node-id">  #22</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#22 #3
-Type not computed
-
-</title></g><g class="node" id="n31" data-id="31" transform="translate(266,380)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>.f =</tspan><tspan class="node-id">  #31</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#31 .f =
-Type not computed
-
-[0] → — DATA
-[1] → #230 MEM
-[2] → #9 DATA
-[3] → #21 DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n37" data-id="37" transform="translate(24,484)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Return</tspan><tspan class="node-id">  #37</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#37 Return
-Type not computed
-
-[0] → — CTRL
-[1] → #1 MEM
-[2] → #9 DATA</title><circle class="port" cx="30" cy="-3" r="3" fill="white"/><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><circle class="port" cx="90" cy="-3" r="3" fill="#536477"/><text class="slot" x="30" y="-10" text-anchor="middle">0</text><text class="slot" x="60" y="-10" text-anchor="middle">1</text><text class="slot" x="90" y="-10" text-anchor="middle">2</text></g><g class="node" id="n230" data-id="230" transform="translate(199,276)" style="opacity: 1;"><path class="box" d="M12,0H108L120,22L108,44H12L0,22Z" fill="#f5e4fa"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>MemPhi_2</tspan><tspan class="node-id">  #230</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#230 MemPhi_2
-Type not computed
-
-[0] → — ASSOC
-[1] → #10 MEM
-[2] → #233 MEM</title><circle class="port" cx="0" cy="-3" r="3" fill="white"/><circle class="port" cx="40" cy="-3" r="3" fill="#536477"/><circle class="port" cx="80" cy="-3" r="3" fill="#536477"/><text class="slot" x="0" y="-10" text-anchor="middle">0</text><text class="slot" x="40" y="-10" text-anchor="middle">1</text><text class="slot" x="80" y="-10" text-anchor="middle">2</text></g><g class="node" id="n233" data-id="233" transform="translate(266,484)" style="opacity: 1;"><path class="box" d="M12,0H108L120,22L108,44H12L0,22Z" fill="#f5e4fa"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>MemPhi_2</tspan><tspan class="node-id">  #233</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#233 MemPhi_2
-Type not computed
-
-[0] → — ASSOC
-[1] → #31 MEM
-[2] → #230 MEM</title><circle class="port" cx="0" cy="-3" r="3" fill="white"/><circle class="port" cx="40" cy="-3" r="3" fill="#536477"/><circle class="port" cx="80" cy="-3" r="3" fill="#536477"/><text class="slot" x="0" y="-10" text-anchor="middle">0</text><text class="slot" x="40" y="-10" text-anchor="middle">1</text><text class="slot" x="80" y="-10" text-anchor="middle">2</text></g></g><g class="region-heads" style="opacity: 1;"/><g class="shortcuts" style="opacity: 1;"/><g class="peep-ghosts" pointer-events="none"/></g></svg>
diff --git a/chapter11/docs/graph5.gv b/chapter11/docs/graph5.gv
deleted file mode 100644
index 0baa512f..00000000
--- a/chapter11/docs/graph5.gv
+++ /dev/null
@@ -1,117 +0,0 @@
-digraph chapter11 {
-/*
-struct S { int f; }
-S v = new S;
-int i = arg;
-while (arg > 0) {
- int j = i/3;
- if (arg == 5)
- v.f = j;
- arg = arg - 1;
-}
-return v;
-
-*/
- rankdir=BT;
- concentrate="true";
- compound="true";
- subgraph cluster_Nodes {
- Start2 [ shape=plaintext label=<
- <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
- <TR><TD BGCOLOR="yellow">Start</TD></TR>
- <TR><TD>
- <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
- <TR><TD PORT="p0" BGCOLOR="yellow">$ctrl</TD><TD PORT="p1">$mem</TD><TD PORT="p2">arg</TD></TR>
- </TABLE>
- </TD></TR>
- </TABLE>>
- ];
- MemMerge [ shape=box label="MemMerge" ];
- Stop3 [ shape=box style=filled fillcolor=yellow label="Stop" ];
- Con_4 [ label="#0" ];
- new9 [ label="new S" ];
- Store10 [ label=".f =" ];
- Loop11 [ shape=box style=filled fillcolor=yellow label="Loop" ];
- Phi_arg13 [ style=filled fillcolor=lightyellow label="&phi;_arg" ];
- LT14 [ label="<" ];
- If16 [ shape=plaintext label=<
- <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
- <TR><TD BGCOLOR="yellow">If</TD></TR>
- <TR><TD>
- <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
- <TR><TD PORT="p0" BGCOLOR="yellow">True</TD><TD PORT="p1" BGCOLOR="yellow">False</TD></TR>
- </TABLE>
- </TD></TR>
- </TABLE>>
- ];
- Div21 [ label="//" ];
- Con_22 [ label="#3" ];
- EQ23 [ label="==" ];
- Con_24 [ label="#5" ];
- If25 [ shape=plaintext label=<
- <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
- <TR><TD BGCOLOR="yellow">If</TD></TR>
- <TR><TD>
- <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
- <TR><TD PORT="p0" BGCOLOR="yellow">True</TD><TD PORT="p1" BGCOLOR="yellow">False</TD></TR>
- </TABLE>
- </TD></TR>
- </TABLE>>
- ];
- Phi_230 [ style=filled fillcolor=lightyellow label="MemPhi_2" ];
- Store31 [ label=".f =" ];
- Region32 [ shape=box style=filled fillcolor=yellow label="Region" ];
- Phi_233 [ style=filled fillcolor=lightyellow label="MemPhi_2" ];
- Sub35 [ label="-" ];
- Con_36 [ label="#1" ];
- Return37 [ shape=box style=filled fillcolor=yellow label="Return" ];
- { rank=same; Loop11;Phi_230;Phi_arg13;}
- { rank=same; Region32;Phi_233;}
- }
- edge [ fontname=Helvetica, fontsize=8 ];
- Stop3 -> Return37[taillabel=0 color=red];
- new9 -> Start2:p0[taillabel=0 color=green];
- Store10 -> Start2:p0[taillabel=0 color=red];
- Store10 -> Start2:p1[taillabel=1 color=blue];
- Store10 -> new9[taillabel=2];
- Store10 -> Con_4[taillabel=3];
- Loop11 -> Start2:p0[taillabel=1 color=red];
- Loop11 -> Region32[taillabel=2 color=red constraint=false];
- Phi_arg13 -> Loop11 [style=dotted taillabel=0];
- Phi_arg13 -> Start2:p2[taillabel=1];
- Phi_arg13 -> Sub35[taillabel=2 constraint=false];
- LT14 -> Loop11[taillabel=0 color=red];
- LT14 -> Con_4[taillabel=1];
- LT14 -> Phi_arg13[taillabel=2];
- If16 -> Loop11[taillabel=0 color=red];
- If16 -> LT14[taillabel=1];
- Div21 -> Start2[taillabel=0 color=red];
- Div21 -> Start2:p2[taillabel=1];
- Div21 -> Con_22[taillabel=2];
- EQ23 -> Loop11[taillabel=0 color=red];
- EQ23 -> Phi_arg13[taillabel=1];
- EQ23 -> Con_24[taillabel=2];
- If25 -> If16:p0[taillabel=0 color=red];
- If25 -> EQ23[taillabel=1];
- Phi_230 -> Loop11 [style=dotted taillabel=0];
- Phi_230 -> Store10[taillabel=1 color=blue];
- Phi_230 -> Phi_233[taillabel=2 color=blue constraint=false];
- Store31 -> Loop11[taillabel=0 color=red];
- Store31 -> Phi_230[taillabel=1 color=blue];
- Store31 -> new9[taillabel=2];
- Store31 -> Div21[taillabel=3];
- Region32 -> If25:p0[taillabel=1 color=red];
- Region32 -> If25:p1[taillabel=2 color=red];
- Phi_233 -> Region32 [style=dotted taillabel=0];
- Phi_233 -> Store31[taillabel=1 color=blue];
- Phi_233 -> Phi_230[taillabel=2 color=blue constraint=false];
- Sub35 -> Loop11[taillabel=0 color=red];
- Sub35 -> Phi_arg13[taillabel=1];
- Sub35 -> Con_36[taillabel=2];
- Return37 -> If16:p1[taillabel=0 color=red];
- Return37 -> new9[taillabel=2];
- Return37 -> MemMerge[taillabel=1 color=blue];
- MemMerge -> Start2:p1[taillabel=1 color=blue];
- MemMerge -> Phi_230[taillabel=2 color=blue];
- MemMerge -> Loop11[taillabel=0 color=green];
-}
diff --git a/chapter11/docs/graph5.json b/chapter11/docs/graph5.json
deleted file mode 100644
index 659384e0..00000000
--- a/chapter11/docs/graph5.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "ver": 1,
- "comp": "chapter11/docs/graph5.svg",
- "step": 1,
- "roots": [37],
- "scope": 0,
- "nodes": [
- {"id": 1, "label": "MemMerge", "type": null, "kind": "MEM", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 6, "role": "MEM", "label": null}, {"idx": 2, "def": 230, "role": "MEM", "label": null}], "proj": null},
- {"id": 2, "label": "Start", "type": null, "kind": "CTRL", "edges": [], "proj": null},
- {"id": 4, "label": "#0", "type": null, "kind": "DATA", "edges": [], "proj": null},
- {"id": 6, "label": "$mem", "type": null, "kind": "MEM", "edges": [{"idx": 0, "def": 2, "role": "MEM", "label": null}], "proj": {"par": 2, "idx": 1}},
- {"id": 7, "label": "arg", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 2, "role": "DATA", "label": null}], "proj": {"par": 2, "idx": 2}},
- {"id": 9, "label": "new S", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}], "proj": null},
- {"id": 10, "label": ".f =", "type": null, "kind": "MEM", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 6, "role": "MEM", "label": null}, {"idx": 2, "def": 9, "role": "DATA", "label": null}, {"idx": 3, "def": 4, "role": "DATA", "label": null}], "proj": null},
- {"id": 21, "label": "//", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 7, "role": "DATA", "label": null}, {"idx": 2, "def": 22, "role": "DATA", "label": null}], "proj": null},
- {"id": 22, "label": "#3", "type": null, "kind": "DATA", "edges": [], "proj": null},
- {"id": 31, "label": ".f =", "type": null, "kind": "MEM", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 230, "role": "MEM", "label": null}, {"idx": 2, "def": 9, "role": "DATA", "label": null}, {"idx": 3, "def": 21, "role": "DATA", "label": null}], "proj": null},
- {"id": 37, "label": "Return", "type": null, "kind": "CTRL", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 1, "role": "MEM", "label": null}, {"idx": 2, "def": 9, "role": "DATA", "label": null}], "proj": null},
- {"id": 230, "label": "MemPhi_2", "type": null, "kind": "PHI", "edges": [{"idx": 0, "def": 0, "role": "ASSOC", "label": null}, {"idx": 1, "def": 10, "role": "MEM", "label": null}, {"idx": 2, "def": 233, "role": "MEM", "label": null}], "proj": null},
- {"id": 233, "label": "MemPhi_2", "type": null, "kind": "PHI", "edges": [{"idx": 0, "def": 0, "role": "ASSOC", "label": null}, {"idx": 1, "def": 31, "role": "MEM", "label": null}, {"idx": 2, "def": 230, "role": "MEM", "label": null}], "proj": null}
- ],
- "groups": [
- ]
-}
diff --git a/chapter11/docs/graph5.svg b/chapter11/docs/graph5.svg
deleted file mode 100644
index c120550f..00000000
--- a/chapter11/docs/graph5.svg
+++ /dev/null
@@ -1,120 +0,0 @@
-<svg aria-label="Compiler graph" width="780" height="568" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 780 568" style="font-family: sans-serif;"><style>
- html, body { height:100%; margin:0; font-family:sans-serif; }
- .viewer { height:100%; display:grid; grid-template-rows:auto minmax(0,1fr) auto; }
- .source { padding:8px; border-bottom:1px solid #ccc; }
- #program { width:min(600px,80vw); vertical-align:middle; }
- #status { margin-top:4px; }
- #graph { min-height:0; overflow:hidden; position:relative; background:#fafbfc; }
- #elk { width:100%; height:100%; }
- #graph svg { display:block; }
- .tools { display:flex; flex-wrap:wrap; align-items:center; gap:14px; margin-top:8px; font-size:12px; }
- .hint { color:#616c78; }
- .ctrl { color:#b63838; } .mem { color:#2867b2; } .data { color:#536477; }
- .edge { fill:none; stroke-width:1.5; }
- .edge.CTRL { stroke-width:2; }
- .edge.ASSOC { stroke-dasharray:4 4; }
- .edge.PARSER { stroke-dasharray:5 4; }
- .parser rect { fill:#f6f0ff; stroke:#7956a5; stroke-width:1.5; stroke-dasharray:5 4; }
- .edge.selected { stroke-width:3.5; }
- .edge.bundle { stroke-width:4; }
- .edge.bundle.selected { stroke-width:6; }
- .edge-hit { fill:none; stroke:transparent; stroke-width:12; vector-effect:non-scaling-stroke; pointer-events:stroke; cursor:pointer; }
- .edge-jump { fill:transparent; pointer-events:all; cursor:pointer; }
- .node { cursor:pointer; }
- .box { stroke:#758191; stroke-width:1; }
- .node.held .box { stroke-dasharray:5 3; }
- .node.near .box { stroke:#c18221; stroke-width:2; }
- .node.focus .box { stroke:#9c4900; stroke-width:3; }
- .node.selected .box { stroke:#1569b9; stroke-width:3; }
- .node.folded .box { stroke-width:4; }
- .node.folding .box { fill:#f4ccd7; }
- .fold-tag { font-size:9px; font-weight:700; fill:#963751; }
- .peep-area { fill:#fff3d9; fill-opacity:.8; stroke:#c18221; stroke-width:2; pointer-events:none; }
- .node.peep-edit .box { stroke:#9c4900; stroke-width:3; }
- .node.error .box { stroke:#b42318; stroke-width:4; }
- #event.error { color:#b42318; font-weight:600; white-space:pre-wrap; overflow-wrap:anywhere; }
- .peep-ghosts { pointer-events:none; }
- .region-box { stroke:#9da9b8; stroke-width:1.5; }
- .fold-btn { cursor:pointer; }
- .fold-btn rect { fill:white; stroke:#596674; }
- .fold-btn text { font-size:14px; fill:#152330; }
- .fold-btn:focus rect { stroke:#1569b9; stroke-width:2; }
- .shortcut { cursor:pointer; }
- .shortcut path { fill:none; stroke-width:1.5; }
- .shortcut rect { fill:#fff8ec; stroke:#b63838; stroke-dasharray:3 2; }
- .shortcut text { font-size:11px; fill:#783030; }
- .shortcut.selected rect, .shortcut:focus rect { stroke-width:2.5; }
- .label { font-size:12px; fill:#152330; font-weight:600; }
- .node-id { font-size:10px; fill:#596674; font-weight:400; }
- .type { font-size:11px; fill:#455768; }
- .port { stroke:#536477; stroke-width:1; }
- .row { stroke:#b6afcf; stroke-width:1; }
- .bind { font-size:12px; fill:#152330; }
- .slot { font-size:10px; fill:#364352; paint-order:stroke; stroke:#fafbfc; stroke-width:3; }
- #detail { position:absolute; top:8px; right:8px; margin:0; padding:12px; max-width:320px;
- max-height:45%; overflow:auto; white-space:pre-wrap; overflow-wrap:anywhere;
- background:#fffffff2; border:1px solid #bac5d0; border-radius:4px; font-size:12px; }
- .controls { display:flex; flex-wrap:wrap; justify-content:center; align-items:center; gap:6px; padding:6px; }
- .button { color:white; background:black; font-size:20px; min-width:30px; }
- .button:disabled { background:grey; }
- .count { font-size:20px; min-width:35px; text-align:center; }
- #N { width:6ch; }
- #scrub { width:clamp(120px,35vw,600px); }
- </style><defs><marker id="arrow-CTRL" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#b63838"/></marker><marker id="arrow-DATA" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#536477"/></marker><marker id="arrow-MEM" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#2867b2"/></marker><marker id="arrow-ASSOC" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#9396a3"/></marker><marker id="arrow-PARSER" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#7956a5"/></marker></defs><rect width="100%" height="100%" fill="rgb(250, 251, 252)"/><g><g class="regions" style="opacity: 1;"/><rect class="peep-area" rx="36" style="opacity: 0;"/><g class="edges"><path class="edge MEM" id="e1i1" d="M266,118 L266,123 Q266,128 261,128 L193,128 Q185,128 185,136 L185,374" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#1[1] → #6 · MEM</title></path><path class="edge MEM" id="e1i2" d="M259,326 L259,338 Q259,346 251,346 L223,346 Q215,346 215,354 L215,374" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#1[2] → #230 · MEM</title></path><path class="edge MEM" id="e10i1" d="M266,118 L266,123 Q266,128 261,128 L252,128 Q244,128 244,136 L244,166" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#10[1] → #6 · MEM</title></path><path class="edge DATA" id="e10i2" d="M114,118 L114,130 Q114,138 122,138 L260,138 Q268,138 268,146 L268,166" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#10[2] → #9 · DATA</title></path><path class="edge DATA" id="e10i3" d="M544,118 L544,123 Q544,128 539,128 L300,128 Q292,128 292,136 L292,166" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#10[3] → #4 · DATA</title></path><path class="edge DATA" id="e21i1" d="M386,118 L386,130 Q386,138 394,138 L400,138 Q408,138 408,146 L408,166" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#21[1] → #7 · DATA</title></path><path class="edge DATA" id="e21i2" d="M696,118 L696,130 Q696,138 688,138 L446,138 Q438,138 438,146 L438,166" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#21[2] → #22 · DATA</title></path><path class="edge MEM" id="e31i1" d="M259,326 L259,338 Q259,346 267,346 L306,346 Q314,346 314,354 L314,374" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#31[1] → #230 · MEM</title></path><path class="edge DATA" id="e31i2" d="M114,118 L114,328 Q114,336 122,336 L330,336 Q338,336 338,344 L338,374" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#31[2] → #9 · DATA</title></path><path class="edge DATA" id="e31i3" d="M408,222 L408,328 Q408,336 400,336 L370,336 Q362,336 362,344 L362,374" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#31[3] → #21 · DATA</title></path><path class="edge MEM" id="e37i1" d="M185,430 L185,435 Q185,440 180,440 L92,440 Q84,440 84,448 L84,478" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#37[1] → #1 · MEM</title></path><path class="edge DATA" id="e37i2" d="M114,118 L114,478" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#37[2] → #9 · DATA</title></path><path class="edge MEM" id="e230i1" d="M256,222 L256,227 Q256,232 251,232 L247,232 Q239,232 239,240 L239,270" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#230[1] → #10 · MEM</title></path><path class="edge MEM" id="e230i2" d="M326,534 L326,539 Q326,544 331,544 L388,544 Q396,544 396,536 L396,240 Q396,232 388,232 L287,232 Q279,232 279,240 L279,270" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#230[2] → #233 · MEM</title></path><path class="edge MEM" id="e233i1" d="M326,430 L326,435 Q326,440 321,440 L314,440 Q306,440 306,448 L306,478" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#233[1] → #31 · MEM</title></path><path class="edge MEM" id="e233i2" d="M259,326 L259,344 Q259,346 257,346 L257,346 Q255,346 255,348 L255,442 Q255,450 263,450 L338,450 Q346,450 346,458 L346,478" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#233[2] → #230 · MEM</title></path></g><g class="edge-hits"/><g class="parser" style="opacity: 1;"/><g class="nodes"><g class="node" id="n1" data-id="1" transform="translate(125,380)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>MemMerge</tspan><tspan class="node-id">  #1</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#1 MemMerge
-Type not computed
-
-[0] → — CTRL
-[1] → #6 MEM
-[2] → #230 MEM</title><circle class="port" cx="30" cy="-3" r="3" fill="white"/><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><circle class="port" cx="90" cy="-3" r="3" fill="#536477"/><text class="slot" x="30" y="-10" text-anchor="middle">0</text><text class="slot" x="60" y="-10" text-anchor="middle">1</text><text class="slot" x="90" y="-10" text-anchor="middle">2</text></g><g class="node" id="n2" data-id="2" transform="translate(206,24)" style="opacity: 1;"><path class="box" d="M0,0H240V44H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="120" y="18"><tspan>Start</tspan><tspan class="node-id">  #2</tspan></text><text class="type" text-anchor="middle" y="35" x="120"/><title>#2 Start
-Type not computed
-
-</title></g><g class="node" id="n4" data-id="4" transform="translate(484,68)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>#0</tspan><tspan class="node-id">  #4</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#4 #0
-Type not computed
-
-</title></g><g class="node" id="n6" data-id="6" transform="translate(206,68)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>$mem</tspan><tspan class="node-id">  #6/1</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#6 $mem
-Projection 1 of #2
-Type not computed
-
-[0] → #2 MEM</title></g><g class="node" id="n7" data-id="7" transform="translate(326,68)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>arg</tspan><tspan class="node-id">  #7/2</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#7 arg
-Projection 2 of #2
-Type not computed
-
-[0] → #2 DATA</title></g><g class="node" id="n9" data-id="9" transform="translate(54,68)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>new S</tspan><tspan class="node-id">  #9</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#9 new S
-Type not computed
-
-[0] → — CTRL</title><circle class="port" cx="60" cy="-3" r="3" fill="white"/><text class="slot" x="60" y="-10" text-anchor="middle">0</text></g><g class="node" id="n10" data-id="10" transform="translate(196,172)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>.f =</tspan><tspan class="node-id">  #10</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#10 .f =
-Type not computed
-
-[0] → — CTRL
-[1] → #6 MEM
-[2] → #9 DATA
-[3] → #4 DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n21" data-id="21" transform="translate(348,172)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>//</tspan><tspan class="node-id">  #21</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#21 //
-Type not computed
-
-[0] → — CTRL
-[1] → #7 DATA
-[2] → #22 DATA</title><circle class="port" cx="30" cy="-3" r="3" fill="white"/><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><circle class="port" cx="90" cy="-3" r="3" fill="#536477"/><text class="slot" x="30" y="-10" text-anchor="middle">0</text><text class="slot" x="60" y="-10" text-anchor="middle">1</text><text class="slot" x="90" y="-10" text-anchor="middle">2</text></g><g class="node" id="n22" data-id="22" transform="translate(636,68)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>#3</tspan><tspan class="node-id">  #22</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#22 #3
-Type not computed
-
-</title></g><g class="node" id="n31" data-id="31" transform="translate(266,380)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>.f =</tspan><tspan class="node-id">  #31</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#31 .f =
-Type not computed
-
-[0] → — CTRL
-[1] → #230 MEM
-[2] → #9 DATA
-[3] → #21 DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n37" data-id="37" transform="translate(24,484)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Return</tspan><tspan class="node-id">  #37</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#37 Return
-Type not computed
-
-[0] → — CTRL
-[1] → #1 MEM
-[2] → #9 DATA</title><circle class="port" cx="30" cy="-3" r="3" fill="white"/><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><circle class="port" cx="90" cy="-3" r="3" fill="#536477"/><text class="slot" x="30" y="-10" text-anchor="middle">0</text><text class="slot" x="60" y="-10" text-anchor="middle">1</text><text class="slot" x="90" y="-10" text-anchor="middle">2</text></g><g class="node" id="n230" data-id="230" transform="translate(199,276)" style="opacity: 1;"><path class="box" d="M12,0H108L120,22L108,44H12L0,22Z" fill="#f5e4fa"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>MemPhi_2</tspan><tspan class="node-id">  #230</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#230 MemPhi_2
-Type not computed
-
-[0] → — ASSOC
-[1] → #10 MEM
-[2] → #233 MEM</title><circle class="port" cx="0" cy="-3" r="3" fill="white"/><circle class="port" cx="40" cy="-3" r="3" fill="#536477"/><circle class="port" cx="80" cy="-3" r="3" fill="#536477"/><text class="slot" x="0" y="-10" text-anchor="middle">0</text><text class="slot" x="40" y="-10" text-anchor="middle">1</text><text class="slot" x="80" y="-10" text-anchor="middle">2</text></g><g class="node" id="n233" data-id="233" transform="translate(266,484)" style="opacity: 1;"><path class="box" d="M12,0H108L120,22L108,44H12L0,22Z" fill="#f5e4fa"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>MemPhi_2</tspan><tspan class="node-id">  #233</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#233 MemPhi_2
-Type not computed
-
-[0] → — ASSOC
-[1] → #31 MEM
-[2] → #230 MEM</title><circle class="port" cx="0" cy="-3" r="3" fill="white"/><circle class="port" cx="40" cy="-3" r="3" fill="#536477"/><circle class="port" cx="80" cy="-3" r="3" fill="#536477"/><text class="slot" x="0" y="-10" text-anchor="middle">0</text><text class="slot" x="40" y="-10" text-anchor="middle">1</text><text class="slot" x="80" y="-10" text-anchor="middle">2</text></g></g><g class="region-heads" style="opacity: 1;"/><g class="shortcuts" style="opacity: 1;"/><g class="peep-ghosts" pointer-events="none"/></g></svg>
diff --git a/chapter11/docs/graph6.gv b/chapter11/docs/graph6.gv
deleted file mode 100644
index ff97eebc..00000000
--- a/chapter11/docs/graph6.gv
+++ /dev/null
@@ -1,117 +0,0 @@
-digraph chapter11 {
-/*
-struct S { int f; }
-S v = new S;
-int i = arg;
-while (arg > 0) {
- int j = i/3;
- if (arg == 5)
- v.f = j;
- arg = arg - 1;
-}
-return v;
-
-*/
- rankdir=BT;
- concentrate="true";
- compound="true";
- subgraph cluster_Nodes {
- Start2 [ shape=plaintext label=<
- <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
- <TR><TD BGCOLOR="yellow">Start</TD></TR>
- <TR><TD>
- <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
- <TR><TD PORT="p0" BGCOLOR="yellow">$ctrl</TD><TD PORT="p1">$mem</TD><TD PORT="p2">arg</TD></TR>
- </TABLE>
- </TD></TR>
- </TABLE>>
- ];
- MemMerge [ shape=box label="MemMerge" ];
- Stop3 [ shape=box style=filled fillcolor=yellow label="Stop" ];
- Con_4 [ label="#0" ];
- new9 [ label="new S" ];
- Store10 [ label=".f =" ];
- Loop11 [ shape=box style=filled fillcolor=yellow label="Loop" ];
- Phi_arg13 [ style=filled fillcolor=lightyellow label="&phi;_arg" ];
- LT14 [ label="<" ];
- If16 [ shape=plaintext label=<
- <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
- <TR><TD BGCOLOR="yellow">If</TD></TR>
- <TR><TD>
- <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
- <TR><TD PORT="p0" BGCOLOR="yellow">True</TD><TD PORT="p1" BGCOLOR="yellow">False</TD></TR>
- </TABLE>
- </TD></TR>
- </TABLE>>
- ];
- Div21 [ label="//" ];
- Con_22 [ label="#3" ];
- EQ23 [ label="==" ];
- Con_24 [ label="#5" ];
- If25 [ shape=plaintext label=<
- <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
- <TR><TD BGCOLOR="yellow">If</TD></TR>
- <TR><TD>
- <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
- <TR><TD PORT="p0" BGCOLOR="yellow">True</TD><TD PORT="p1" BGCOLOR="yellow">False</TD></TR>
- </TABLE>
- </TD></TR>
- </TABLE>>
- ];
- Phi_230 [ style=filled fillcolor=lightyellow label="MemPhi_2" ];
- Store31 [ label=".f =" ];
- Region32 [ shape=box style=filled fillcolor=yellow label="Region" ];
- Phi_233 [ style=filled fillcolor=lightyellow label="MemPhi_2" ];
- Sub35 [ label="-" ];
- Con_36 [ label="#1" ];
- Return37 [ shape=box style=filled fillcolor=yellow label="Return" ];
- { rank=same; Loop11;Phi_230;Phi_arg13;}
- { rank=same; Region32;Phi_233;}
- }
- edge [ fontname=Helvetica, fontsize=8 ];
- Stop3 -> Return37[taillabel=0 color=red];
- new9 -> Start2:p0[taillabel=0 color=green];
- Store10 -> Start2:p0[taillabel=0 color=red];
- Store10 -> Start2:p1[taillabel=1 color=blue];
- Store10 -> new9[taillabel=2];
- Store10 -> Con_4[taillabel=3];
- Loop11 -> Start2:p0[taillabel=1 color=red];
- Loop11 -> Region32[taillabel=2 color=red constraint=false];
- Phi_arg13 -> Loop11 [style=dotted taillabel=0];
- Phi_arg13 -> Start2:p2[taillabel=1];
- Phi_arg13 -> Sub35[taillabel=2 constraint=false];
- LT14 -> Loop11[taillabel=0 color=red];
- LT14 -> Con_4[taillabel=1];
- LT14 -> Phi_arg13[taillabel=2];
- If16 -> Loop11[taillabel=0 color=red];
- If16 -> LT14[taillabel=1];
- Div21 -> Start2:p0[taillabel=0 color=red];
- Div21 -> Start2:p2[taillabel=1];
- Div21 -> Con_22[taillabel=2];
- EQ23 -> If16:p0[taillabel=0 color=red];
- EQ23 -> Phi_arg13[taillabel=1];
- EQ23 -> Con_24[taillabel=2];
- If25 -> If16:p0[taillabel=0 color=red];
- If25 -> EQ23[taillabel=1];
- Phi_230 -> Loop11 [style=dotted taillabel=0];
- Phi_230 -> Store10[taillabel=1 color=blue];
- Phi_230 -> Phi_233[taillabel=2 color=blue constraint=false];
- Store31 -> If25:p0[taillabel=0 color=red];
- Store31 -> Phi_230[taillabel=1 color=blue];
- Store31 -> new9[taillabel=2];
- Store31 -> Div21[taillabel=3];
- Region32 -> If25:p0[taillabel=1 color=red];
- Region32 -> If25:p1[taillabel=2 color=red];
- Phi_233 -> Region32 [style=dotted taillabel=0];
- Phi_233 -> Store31[taillabel=1 color=blue];
- Phi_233 -> Phi_230[taillabel=2 color=blue constraint=false];
- Sub35 -> Region32[taillabel=0 color=red];
- Sub35 -> Phi_arg13[taillabel=1];
- Sub35 -> Con_36[taillabel=2];
- Return37 -> If16:p1[taillabel=0 color=red];
- Return37 -> new9[taillabel=2];
- Return37 -> MemMerge[taillabel=1 color=blue];
- MemMerge -> Start2:p1[taillabel=1 color=blue];
- MemMerge -> Phi_230[taillabel=2 color=blue];
- MemMerge -> If16:p1[taillabel=0 color=green];
-}
diff --git a/chapter11/docs/graph6.json b/chapter11/docs/graph6.json
deleted file mode 100644
index 512c308d..00000000
--- a/chapter11/docs/graph6.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "ver": 1,
- "comp": "chapter11/docs/graph6.svg",
- "step": 1,
- "roots": [37],
- "scope": 0,
- "nodes": [
- {"id": 1, "label": "MemMerge", "type": null, "kind": "MEM", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 6, "role": "MEM", "label": null}, {"idx": 2, "def": 230, "role": "MEM", "label": null}], "proj": null},
- {"id": 2, "label": "Start", "type": null, "kind": "CTRL", "edges": [], "proj": null},
- {"id": 4, "label": "#0", "type": null, "kind": "DATA", "edges": [], "proj": null},
- {"id": 6, "label": "$mem", "type": null, "kind": "MEM", "edges": [{"idx": 0, "def": 2, "role": "MEM", "label": null}], "proj": {"par": 2, "idx": 1}},
- {"id": 7, "label": "arg", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 2, "role": "DATA", "label": null}], "proj": {"par": 2, "idx": 2}},
- {"id": 9, "label": "new S", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}], "proj": null},
- {"id": 10, "label": ".f =", "type": null, "kind": "MEM", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 6, "role": "MEM", "label": null}, {"idx": 2, "def": 9, "role": "DATA", "label": null}, {"idx": 3, "def": 4, "role": "DATA", "label": null}], "proj": null},
- {"id": 15, "label": "True", "type": null, "kind": "CTRL", "edges": [], "proj": {"par": 0, "idx": 0}},
- {"id": 21, "label": "//", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 7, "role": "DATA", "label": null}, {"idx": 2, "def": 22, "role": "DATA", "label": null}], "proj": null},
- {"id": 22, "label": "#3", "type": null, "kind": "DATA", "edges": [], "proj": null},
- {"id": 31, "label": ".f =", "type": null, "kind": "MEM", "edges": [{"idx": 0, "def": 15, "role": "CTRL", "label": null}, {"idx": 1, "def": 230, "role": "MEM", "label": null}, {"idx": 2, "def": 9, "role": "DATA", "label": null}, {"idx": 3, "def": 21, "role": "DATA", "label": null}], "proj": null},
- {"id": 37, "label": "Return", "type": null, "kind": "CTRL", "edges": [{"idx": 0, "def": 0, "role": "CTRL", "label": null}, {"idx": 1, "def": 1, "role": "MEM", "label": null}, {"idx": 2, "def": 9, "role": "DATA", "label": null}], "proj": null},
- {"id": 230, "label": "MemPhi_2", "type": null, "kind": "PHI", "edges": [{"idx": 0, "def": 0, "role": "ASSOC", "label": null}, {"idx": 1, "def": 10, "role": "MEM", "label": null}, {"idx": 2, "def": 233, "role": "MEM", "label": null}], "proj": null},
- {"id": 233, "label": "MemPhi_2", "type": null, "kind": "PHI", "edges": [{"idx": 0, "def": 0, "role": "ASSOC", "label": null}, {"idx": 1, "def": 31, "role": "MEM", "label": null}, {"idx": 2, "def": 230, "role": "MEM", "label": null}], "proj": null}
- ],
- "groups": [
- ]
-}
diff --git a/chapter11/docs/graph6.svg b/chapter11/docs/graph6.svg
deleted file mode 100644
index d6dec88f..00000000
--- a/chapter11/docs/graph6.svg
+++ /dev/null
@@ -1,124 +0,0 @@
-<svg aria-label="Compiler graph" width="820" height="568" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 820 568" style="font-family: sans-serif;"><style>
- html, body { height:100%; margin:0; font-family:sans-serif; }
- .viewer { height:100%; display:grid; grid-template-rows:auto minmax(0,1fr) auto; }
- .source { padding:8px; border-bottom:1px solid #ccc; }
- #program { width:min(600px,80vw); vertical-align:middle; }
- #status { margin-top:4px; }
- #graph { min-height:0; overflow:hidden; position:relative; background:#fafbfc; }
- #elk { width:100%; height:100%; }
- #graph svg { display:block; }
- .tools { display:flex; flex-wrap:wrap; align-items:center; gap:14px; margin-top:8px; font-size:12px; }
- .hint { color:#616c78; }
- .ctrl { color:#b63838; } .mem { color:#2867b2; } .data { color:#536477; }
- .edge { fill:none; stroke-width:1.5; }
- .edge.CTRL { stroke-width:2; }
- .edge.ASSOC { stroke-dasharray:4 4; }
- .edge.PARSER { stroke-dasharray:5 4; }
- .parser rect { fill:#f6f0ff; stroke:#7956a5; stroke-width:1.5; stroke-dasharray:5 4; }
- .edge.selected { stroke-width:3.5; }
- .edge.bundle { stroke-width:4; }
- .edge.bundle.selected { stroke-width:6; }
- .edge-hit { fill:none; stroke:transparent; stroke-width:12; vector-effect:non-scaling-stroke; pointer-events:stroke; cursor:pointer; }
- .edge-jump { fill:transparent; pointer-events:all; cursor:pointer; }
- .node { cursor:pointer; }
- .box { stroke:#758191; stroke-width:1; }
- .node.held .box { stroke-dasharray:5 3; }
- .node.near .box { stroke:#c18221; stroke-width:2; }
- .node.focus .box { stroke:#9c4900; stroke-width:3; }
- .node.selected .box { stroke:#1569b9; stroke-width:3; }
- .node.folded .box { stroke-width:4; }
- .node.folding .box { fill:#f4ccd7; }
- .fold-tag { font-size:9px; font-weight:700; fill:#963751; }
- .peep-area { fill:#fff3d9; fill-opacity:.8; stroke:#c18221; stroke-width:2; pointer-events:none; }
- .node.peep-edit .box { stroke:#9c4900; stroke-width:3; }
- .node.error .box { stroke:#b42318; stroke-width:4; }
- #event.error { color:#b42318; font-weight:600; white-space:pre-wrap; overflow-wrap:anywhere; }
- .peep-ghosts { pointer-events:none; }
- .region-box { stroke:#9da9b8; stroke-width:1.5; }
- .fold-btn { cursor:pointer; }
- .fold-btn rect { fill:white; stroke:#596674; }
- .fold-btn text { font-size:14px; fill:#152330; }
- .fold-btn:focus rect { stroke:#1569b9; stroke-width:2; }
- .shortcut { cursor:pointer; }
- .shortcut path { fill:none; stroke-width:1.5; }
- .shortcut rect { fill:#fff8ec; stroke:#b63838; stroke-dasharray:3 2; }
- .shortcut text { font-size:11px; fill:#783030; }
- .shortcut.selected rect, .shortcut:focus rect { stroke-width:2.5; }
- .label { font-size:12px; fill:#152330; font-weight:600; }
- .node-id { font-size:10px; fill:#596674; font-weight:400; }
- .type { font-size:11px; fill:#455768; }
- .port { stroke:#536477; stroke-width:1; }
- .row { stroke:#b6afcf; stroke-width:1; }
- .bind { font-size:12px; fill:#152330; }
- .slot { font-size:10px; fill:#364352; paint-order:stroke; stroke:#fafbfc; stroke-width:3; }
- #detail { position:absolute; top:8px; right:8px; margin:0; padding:12px; max-width:320px;
- max-height:45%; overflow:auto; white-space:pre-wrap; overflow-wrap:anywhere;
- background:#fffffff2; border:1px solid #bac5d0; border-radius:4px; font-size:12px; }
- .controls { display:flex; flex-wrap:wrap; justify-content:center; align-items:center; gap:6px; padding:6px; }
- .button { color:white; background:black; font-size:20px; min-width:30px; }
- .button:disabled { background:grey; }
- .count { font-size:20px; min-width:35px; text-align:center; }
- #N { width:6ch; }
- #scrub { width:clamp(120px,35vw,600px); }
- </style><defs><marker id="arrow-CTRL" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#b63838"/></marker><marker id="arrow-DATA" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#536477"/></marker><marker id="arrow-MEM" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#2867b2"/></marker><marker id="arrow-ASSOC" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#9396a3"/></marker><marker id="arrow-PARSER" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#7956a5"/></marker></defs><rect width="100%" height="100%" fill="rgb(250, 251, 252)"/><g><g class="regions" style="opacity: 1;"/><rect class="peep-area" rx="36" style="opacity: 0;"/><g class="edges"><path class="edge MEM" id="e1i1" d="M306,118 L306,123 Q306,128 301,128 L151,128 Q143,128 143,136 L143,328 Q143,336 135,336 L92,336 Q84,336 84,344 L84,374" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#1[1] → #6 · MEM</title></path><path class="edge MEM" id="e1i2" d="M331,326 L331,338 Q331,346 323,346 L122,346 Q114,346 114,354 L114,374" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#1[2] → #230 · MEM</title></path><path class="edge MEM" id="e10i1" d="M306,118 L306,123 Q306,128 301,128 L270,128 Q262,128 262,136 L262,166" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#10[1] → #6 · MEM</title></path><path class="edge DATA" id="e10i2" d="M154,118 L154,130 Q154,138 162,138 L278,138 Q286,138 286,146 L286,166" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#10[2] → #9 · DATA</title></path><path class="edge DATA" id="e10i3" d="M584,118 L584,130 Q584,138 576,138 L318,138 Q310,138 310,146 L310,166" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#10[3] → #4 · DATA</title></path><path class="edge DATA" id="e21i1" d="M426,118 L426,166" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#21[1] → #7 · DATA</title></path><path class="edge DATA" id="e21i2" d="M736,118 L736,140 Q736,148 728,148 L464,148 Q456,148 456,156 L456,166" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#21[2] → #22 · DATA</title></path><path class="edge CTRL" id="e31i0" d="M206,326 L206,374" stroke="#b63838" marker-start="url(#arrow-CTRL)" style="opacity: 1;"><title>#31[0] → #15 · CTRL</title></path><path class="edge MEM" id="e31i1" d="M331,326 L331,338 Q331,346 323,346 L238,346 Q230,346 230,354 L230,374" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#31[1] → #230 · MEM</title></path><path class="edge DATA" id="e31i2" d="M154,118 L154,224 Q154,232 162,232 L249,232 Q257,232 257,240 L257,354.5 Q257,356 255.5,356 L255.5,356 Q254,356 254,357.5 L254,374" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#31[2] → #9 · DATA</title></path><path class="edge DATA" id="e31i3" d="M426,222 L426,234 Q426,242 418,242 L409,242 Q401,242 401,250 L401,348 Q401,356 393,356 L286,356 Q278,356 278,364 L278,374" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#31[3] → #21 · DATA</title></path><path class="edge MEM" id="e37i1" d="M84,430 L84,435 Q84,440 89,440 L116,440 Q124,440 124,448 L124,478" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#37[1] → #1 · MEM</title></path><path class="edge DATA" id="e37i2" d="M154,118 L154,478" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#37[2] → #9 · DATA</title></path><path class="edge MEM" id="e230i1" d="M274,222 L274,227 Q274,232 279,232 L303,232 Q311,232 311,240 L311,270" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#230[1] → #10 · MEM</title></path><path class="edge MEM" id="e230i2" d="M311,534 L311,539 Q311,544 316,544 L404,544 Q412,544 412,536 L412,240 Q412,232 404,232 L359,232 Q351,232 351,240 L351,270" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#230[2] → #233 · MEM</title></path><path class="edge MEM" id="e233i1" d="M242,430 L242,435 Q242,440 247,440 L283,440 Q291,440 291,448 L291,478" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#233[1] → #31 · MEM</title></path><path class="edge MEM" id="e233i2" d="M331,326 L331,478" stroke="#2867b2" marker-start="url(#arrow-MEM)" style="opacity: 1;"><title>#233[2] → #230 · MEM</title></path></g><g class="edge-hits"/><g class="parser" style="opacity: 1;"/><g class="nodes"><g class="node" id="n1" data-id="1" transform="translate(24,380)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>MemMerge</tspan><tspan class="node-id">  #1</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#1 MemMerge
-Type not computed
-
-[0] → — CTRL
-[1] → #6 MEM
-[2] → #230 MEM</title><circle class="port" cx="30" cy="-3" r="3" fill="white"/><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><circle class="port" cx="90" cy="-3" r="3" fill="#536477"/><text class="slot" x="30" y="-10" text-anchor="middle">0</text><text class="slot" x="60" y="-10" text-anchor="middle">1</text><text class="slot" x="90" y="-10" text-anchor="middle">2</text></g><g class="node" id="n2" data-id="2" transform="translate(246,24)" style="opacity: 1;"><path class="box" d="M0,0H240V44H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="120" y="18"><tspan>Start</tspan><tspan class="node-id">  #2</tspan></text><text class="type" text-anchor="middle" y="35" x="120"/><title>#2 Start
-Type not computed
-
-</title></g><g class="node" id="n4" data-id="4" transform="translate(524,68)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>#0</tspan><tspan class="node-id">  #4</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#4 #0
-Type not computed
-
-</title></g><g class="node" id="n6" data-id="6" transform="translate(246,68)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>$mem</tspan><tspan class="node-id">  #6/1</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#6 $mem
-Projection 1 of #2
-Type not computed
-
-[0] → #2 MEM</title></g><g class="node" id="n7" data-id="7" transform="translate(366,68)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>arg</tspan><tspan class="node-id">  #7/2</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#7 arg
-Projection 2 of #2
-Type not computed
-
-[0] → #2 DATA</title></g><g class="node" id="n9" data-id="9" transform="translate(94,68)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>new S</tspan><tspan class="node-id">  #9</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#9 new S
-Type not computed
-
-[0] → — CTRL</title><circle class="port" cx="60" cy="-3" r="3" fill="white"/><text class="slot" x="60" y="-10" text-anchor="middle">0</text></g><g class="node" id="n10" data-id="10" transform="translate(214,172)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>.f =</tspan><tspan class="node-id">  #10</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#10 .f =
-Type not computed
-
-[0] → — CTRL
-[1] → #6 MEM
-[2] → #9 DATA
-[3] → #4 DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n15" data-id="15" transform="translate(165,294)" style="opacity: 1;"><path class="box" d="M0,0H82V26H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="41" y="17"><tspan>True</tspan><tspan class="node-id">  #15/0</tspan></text><text class="type" text-anchor="middle" y="35" x="41"/><title>#15 True
-Projection 0 of #0
-Type not computed
-
-</title></g><g class="node" id="n21" data-id="21" transform="translate(366,172)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>//</tspan><tspan class="node-id">  #21</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#21 //
-Type not computed
-
-[0] → — CTRL
-[1] → #7 DATA
-[2] → #22 DATA</title><circle class="port" cx="30" cy="-3" r="3" fill="white"/><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><circle class="port" cx="90" cy="-3" r="3" fill="#536477"/><text class="slot" x="30" y="-10" text-anchor="middle">0</text><text class="slot" x="60" y="-10" text-anchor="middle">1</text><text class="slot" x="90" y="-10" text-anchor="middle">2</text></g><g class="node" id="n22" data-id="22" transform="translate(676,68)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>#3</tspan><tspan class="node-id">  #22</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#22 #3
-Type not computed
-
-</title></g><g class="node" id="n31" data-id="31" transform="translate(182,380)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#dcecff"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>.f =</tspan><tspan class="node-id">  #31</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#31 .f =
-Type not computed
-
-[0] → #15 CTRL
-[1] → #230 MEM
-[2] → #9 DATA
-[3] → #21 DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="#536477"/><circle class="port" cx="48" cy="-3" r="3" fill="#536477"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n37" data-id="37" transform="translate(64,484)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Return</tspan><tspan class="node-id">  #37</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#37 Return
-Type not computed
-
-[0] → — CTRL
-[1] → #1 MEM
-[2] → #9 DATA</title><circle class="port" cx="30" cy="-3" r="3" fill="white"/><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><circle class="port" cx="90" cy="-3" r="3" fill="#536477"/><text class="slot" x="30" y="-10" text-anchor="middle">0</text><text class="slot" x="60" y="-10" text-anchor="middle">1</text><text class="slot" x="90" y="-10" text-anchor="middle">2</text></g><g class="node" id="n230" data-id="230" transform="translate(271,276)" style="opacity: 1;"><path class="box" d="M12,0H108L120,22L108,44H12L0,22Z" fill="#f5e4fa"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>MemPhi_2</tspan><tspan class="node-id">  #230</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#230 MemPhi_2
-Type not computed
-
-[0] → — ASSOC
-[1] → #10 MEM
-[2] → #233 MEM</title><circle class="port" cx="0" cy="-3" r="3" fill="white"/><circle class="port" cx="40" cy="-3" r="3" fill="#536477"/><circle class="port" cx="80" cy="-3" r="3" fill="#536477"/><text class="slot" x="0" y="-10" text-anchor="middle">0</text><text class="slot" x="40" y="-10" text-anchor="middle">1</text><text class="slot" x="80" y="-10" text-anchor="middle">2</text></g><g class="node" id="n233" data-id="233" transform="translate(251,484)" style="opacity: 1;"><path class="box" d="M12,0H108L120,22L108,44H12L0,22Z" fill="#f5e4fa"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>MemPhi_2</tspan><tspan class="node-id">  #233</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#233 MemPhi_2
-Type not computed
-
-[0] → — ASSOC
-[1] → #31 MEM
-[2] → #230 MEM</title><circle class="port" cx="0" cy="-3" r="3" fill="white"/><circle class="port" cx="40" cy="-3" r="3" fill="#536477"/><circle class="port" cx="80" cy="-3" r="3" fill="#536477"/><text class="slot" x="0" y="-10" text-anchor="middle">0</text><text class="slot" x="40" y="-10" text-anchor="middle">1</text><text class="slot" x="80" y="-10" text-anchor="middle">2</text></g></g><g class="region-heads" style="opacity: 1;"/><g class="shortcuts" style="opacity: 1;"/><g class="peep-ghosts" pointer-events="none"/></g></svg>
diff --git a/chapter11/docs/graph7.gv b/chapter11/docs/graph7.gv
deleted file mode 100644
index 18be364b..00000000
--- a/chapter11/docs/graph7.gv
+++ /dev/null
@@ -1,23 +0,0 @@
-digraph chapter11 {
- rankdir=BT;
- concentrate="true";
- compound="true";
- subgraph cluster_Nodes {
- Start2 [ shape=plaintext label=<
- <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
- <TR><TD BGCOLOR="yellow">Start</TD></TR>
- <TR><TD>
- <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
- <TR><TD PORT="p0" BGCOLOR="yellow">$ctrl</TD></TR>
- </TABLE>
- </TD></TR>
- </TABLE>>
- ];
- Con_4 [ label="#0" ];
- Loop8 [ shape=box style=filled fillcolor=yellow label="Loop" ];
- { rank=same; Loop8;}
- }
- edge [ fontname=Helvetica, fontsize=8 ];
- Loop8 -> Start2:p0[taillabel=1 color=red];
- Loop8 -> Loop8[taillabel=2 color=red constraint=false];
-}
diff --git a/chapter11/docs/graph7.json b/chapter11/docs/graph7.json
deleted file mode 100644
index c1c86b07..00000000
--- a/chapter11/docs/graph7.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "ver": 1,
- "comp": "chapter11/docs/graph7.svg",
- "step": 1,
- "roots": [],
- "scope": 0,
- "nodes": [
- {"id": 1, "label": "$ctrl", "type": null, "kind": "CTRL", "edges": [{"idx": 0, "def": 2, "role": "CTRL", "label": null}], "proj": {"par": 2, "idx": 0}},
- {"id": 2, "label": "Start", "type": null, "kind": "CTRL", "edges": [], "proj": null},
- {"id": 4, "label": "#0", "type": null, "kind": "DATA", "edges": [], "proj": null},
- {"id": 8, "label": "Loop", "type": null, "kind": "LOOP", "edges": [{"idx": 0, "def": 0, "role": "DATA", "label": null}, {"idx": 1, "def": 1, "role": "CTRL", "label": null}, {"idx": 2, "def": 8, "role": "CTRL", "label": null}], "proj": null}
- ],
- "groups": [
- {"id": 8, "par": 0, "nodes": [8]}
- ]
-}
diff --git a/chapter11/docs/graph7.svg b/chapter11/docs/graph7.svg
deleted file mode 100644
index 15d886dc..00000000
--- a/chapter11/docs/graph7.svg
+++ /dev/null
@@ -1,78 +0,0 @@
-<svg aria-label="Compiler graph" width="364" height="325" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 364 325" style="font-family: sans-serif;"><style>
- html, body { height:100%; margin:0; font-family:sans-serif; }
- .viewer { height:100%; display:grid; grid-template-rows:auto minmax(0,1fr) auto; }
- .source { padding:8px; border-bottom:1px solid #ccc; }
- #program { width:min(600px,80vw); vertical-align:middle; }
- #status { margin-top:4px; }
- #graph { min-height:0; overflow:hidden; position:relative; background:#fafbfc; }
- #elk { width:100%; height:100%; }
- #graph svg { display:block; }
- .tools { display:flex; flex-wrap:wrap; align-items:center; gap:14px; margin-top:8px; font-size:12px; }
- .hint { color:#616c78; }
- .ctrl { color:#b63838; } .mem { color:#2867b2; } .data { color:#536477; }
- .edge { fill:none; stroke-width:1.5; }
- .edge.CTRL { stroke-width:2; }
- .edge.ASSOC { stroke-dasharray:4 4; }
- .edge.PARSER { stroke-dasharray:5 4; }
- .parser rect { fill:#f6f0ff; stroke:#7956a5; stroke-width:1.5; stroke-dasharray:5 4; }
- .edge.selected { stroke-width:3.5; }
- .edge.bundle { stroke-width:4; }
- .edge.bundle.selected { stroke-width:6; }
- .edge-hit { fill:none; stroke:transparent; stroke-width:12; vector-effect:non-scaling-stroke; pointer-events:stroke; cursor:pointer; }
- .edge-jump { fill:transparent; pointer-events:all; cursor:pointer; }
- .node { cursor:pointer; }
- .box { stroke:#758191; stroke-width:1; }
- .node.held .box { stroke-dasharray:5 3; }
- .node.near .box { stroke:#c18221; stroke-width:2; }
- .node.focus .box { stroke:#9c4900; stroke-width:3; }
- .node.selected .box { stroke:#1569b9; stroke-width:3; }
- .node.folded .box { stroke-width:4; }
- .node.folding .box { fill:#f4ccd7; }
- .fold-tag { font-size:9px; font-weight:700; fill:#963751; }
- .peep-area { fill:#fff3d9; fill-opacity:.8; stroke:#c18221; stroke-width:2; pointer-events:none; }
- .node.peep-edit .box { stroke:#9c4900; stroke-width:3; }
- .node.error .box { stroke:#b42318; stroke-width:4; }
- #event.error { color:#b42318; font-weight:600; white-space:pre-wrap; overflow-wrap:anywhere; }
- .peep-ghosts { pointer-events:none; }
- .region-box { stroke:#9da9b8; stroke-width:1.5; }
- .fold-btn { cursor:pointer; }
- .fold-btn rect { fill:white; stroke:#596674; }
- .fold-btn text { font-size:14px; fill:#152330; }
- .fold-btn:focus rect { stroke:#1569b9; stroke-width:2; }
- .shortcut { cursor:pointer; }
- .shortcut path { fill:none; stroke-width:1.5; }
- .shortcut rect { fill:#fff8ec; stroke:#b63838; stroke-dasharray:3 2; }
- .shortcut text { font-size:11px; fill:#783030; }
- .shortcut.selected rect, .shortcut:focus rect { stroke-width:2.5; }
- .label { font-size:12px; fill:#152330; font-weight:600; }
- .node-id { font-size:10px; fill:#596674; font-weight:400; }
- .type { font-size:11px; fill:#455768; }
- .port { stroke:#536477; stroke-width:1; }
- .row { stroke:#b6afcf; stroke-width:1; }
- .bind { font-size:12px; fill:#152330; }
- .slot { font-size:10px; fill:#364352; paint-order:stroke; stroke:#fafbfc; stroke-width:3; }
- #detail { position:absolute; top:8px; right:8px; margin:0; padding:12px; max-width:320px;
- max-height:45%; overflow:auto; white-space:pre-wrap; overflow-wrap:anywhere;
- background:#fffffff2; border:1px solid #bac5d0; border-radius:4px; font-size:12px; }
- .controls { display:flex; flex-wrap:wrap; justify-content:center; align-items:center; gap:6px; padding:6px; }
- .button { color:white; background:black; font-size:20px; min-width:30px; }
- .button:disabled { background:grey; }
- .count { font-size:20px; min-width:35px; text-align:center; }
- #N { width:6ch; }
- #scrub { width:clamp(120px,35vw,600px); }
- </style><defs><marker id="arrow-CTRL" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#b63838"/></marker><marker id="arrow-DATA" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#536477"/></marker><marker id="arrow-MEM" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#2867b2"/></marker><marker id="arrow-ASSOC" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#9396a3"/></marker><marker id="arrow-PARSER" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#7956a5"/></marker></defs><rect width="100%" height="100%" fill="rgb(250, 251, 252)"/><g><g class="regions" style="opacity: 1;"><g class="region" transform="translate(164,171)"><rect class="region-box" rx="8" width="176" height="130" fill="#f1f6fc"/></g></g><rect class="peep-area" rx="36" style="opacity: 0;"/><g class="edges"><path class="edge CTRL" id="e8i1" d="M236,118 L236,223" stroke="#b63838" marker-start="url(#arrow-CTRL)" style="opacity: 1;"><title>#8[1] → #1 · CTRL</title></path><path class="edge CTRL" id="e8i2" d="M236,276 L236,281 Q236,286 241,286 L320,286 Q328,286 328,278 L328,222 Q328,214 320,214 L272,214 Q266,214 266,220 L266,226" stroke="#b63838" marker-start="url(#arrow-CTRL)" style="opacity: 1;"><title>#8[2] → #8 · CTRL</title></path></g><g class="edge-hits"/><g class="parser" style="opacity: 1;"/><g class="nodes"><g class="node" id="n1" data-id="1" transform="translate(176,68)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>$ctrl</tspan><tspan class="node-id">  #1/0</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#1 $ctrl
-Projection 0 of #2
-Type not computed
-
-[0] → #2 CTRL</title></g><g class="node" id="n2" data-id="2" transform="translate(176,24)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Start</tspan><tspan class="node-id">  #2</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#2 Start
-Type not computed
-
-</title></g><g class="node" id="n4" data-id="4" transform="translate(24,49)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>#0</tspan><tspan class="node-id">  #4</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#4 #0
-Type not computed
-
-</title></g><g class="node" id="n8" data-id="8" transform="translate(176,229)" style="opacity: 1;"><path class="box" d="M20,0H100Q120,0 120,20V24Q120,44 100,44H20Q0,44 0,24V20Q0,0 20,0Z" fill="#ffe0ab"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Loop</tspan><tspan class="node-id">  #8</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#8 Loop
-Type not computed
-
-[0] → — DATA
-[1] → #1 CTRL
-[2] → #8 CTRL</title><circle class="port" cx="30" cy="-3" r="3" fill="white"/><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><circle class="port" cx="90" cy="-3" r="3" fill="#536477"/><text class="slot" x="30" y="-10" text-anchor="middle">0</text><text class="slot" x="60" y="-10" text-anchor="middle">1</text><text class="slot" x="90" y="-10" text-anchor="middle">2</text></g></g><g class="region-heads" style="opacity: 1;"><g class="region-head" transform="translate(164,171)"><text class="label" x="26" y="17"><tspan>Loop</tspan><tspan class="node-id">  #8</tspan></text><title>Loop · 1 nodes</title><g class="fold-btn" role="button" tabindex="0" transform="translate(4,4)" aria-label="Fold region #8"><rect width="16" height="16" rx="2"/><text x="8" y="12" text-anchor="middle">−</text><title>Fold region</title></g></g></g><g class="shortcuts" style="opacity: 1;"/><g class="peep-ghosts" pointer-events="none"/></g></svg>
diff --git a/chapter11/docs/graph8.gv b/chapter11/docs/graph8.gv
deleted file mode 100644
index 431cef46..00000000
--- a/chapter11/docs/graph8.gv
+++ /dev/null
@@ -1,45 +0,0 @@
-digraph chapter11 {
-/*
-while (1) {}
-return 0;
-
-*/
- rankdir=BT;
- concentrate="true";
- compound="true";
- subgraph cluster_Nodes {
- Never18 [ shape=plaintext label=<
- <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
- <TR><TD BGCOLOR="yellow">Never</TD></TR>
- <TR><TD>
- <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
- <TR><TD PORT="p0" BGCOLOR="yellow">True</TD><TD PORT="p1" BGCOLOR="yellow">False</TD></TR>
- </TABLE>
- </TD></TR>
- </TABLE>>
- ];
- Start2 [ shape=plaintext label=<
- <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
- <TR><TD BGCOLOR="yellow">Start</TD></TR>
- <TR><TD>
- <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
- <TR><TD PORT="p0" BGCOLOR="yellow">$ctrl</TD></TR>
- </TABLE>
- </TD></TR>
- </TABLE>>
- ];
- Stop3 [ shape=box style=filled fillcolor=yellow label="Stop" ];
- Con_4 [ label="#0" ];
- Return21 [ shape=box style=filled fillcolor=yellow label="Return" ];
- Loop8 [ shape=box style=filled fillcolor=yellow label="Loop" ];
- { rank=same; Loop8;}
- }
- edge [ fontname=Helvetica, fontsize=8 ];
- Never18 -> Loop8[taillabel=0 color=red];
- Never18 -> Con_4[taillabel=1];
- Stop3 -> Return21[taillabel=0 color=red];
- Return21 -> Never18:p0[taillabel=0 color=red];
- Return21 -> Con_4[taillabel=2];
- Loop8 -> Start2:p0[taillabel=1 color=red];
- Loop8 -> Never18:p1[taillabel=2 color=red constraint=false];
-}
diff --git a/chapter11/docs/graph8.json b/chapter11/docs/graph8.json
deleted file mode 100644
index ab2ef65c..00000000
--- a/chapter11/docs/graph8.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "ver": 1,
- "comp": "chapter11/docs/graph8.svg",
- "step": 1,
- "roots": [],
- "scope": 0,
- "nodes": [
- {"id": 1, "label": "True", "type": null, "kind": "CTRL", "edges": [{"idx": 0, "def": 18, "role": "CTRL", "label": null}], "proj": {"par": 18, "idx": 0}},
- {"id": 2, "label": "Start", "type": null, "kind": "CTRL", "edges": [], "proj": null},
- {"id": 3, "label": "Stop", "type": null, "kind": "STOP", "edges": [{"idx": 0, "def": 21, "role": "CTRL", "label": null}], "proj": null},
- {"id": 4, "label": "#0", "type": null, "kind": "DATA", "edges": [], "proj": null},
- {"id": 5, "label": "False", "type": null, "kind": "CTRL", "edges": [{"idx": 0, "def": 18, "role": "CTRL", "label": null}], "proj": {"par": 18, "idx": 1}},
- {"id": 6, "label": "$ctrl", "type": null, "kind": "CTRL", "edges": [{"idx": 0, "def": 2, "role": "CTRL", "label": null}], "proj": {"par": 2, "idx": 0}},
- {"id": 8, "label": "Loop", "type": null, "kind": "LOOP", "edges": [{"idx": 0, "def": 0, "role": "DATA", "label": null}, {"idx": 1, "def": 6, "role": "CTRL", "label": null}, {"idx": 2, "def": 5, "role": "CTRL", "label": null}], "proj": null},
- {"id": 18, "label": "Never", "type": null, "kind": "CTRL", "edges": [{"idx": 0, "def": 8, "role": "CTRL", "label": null}, {"idx": 1, "def": 4, "role": "DATA", "label": null}], "proj": null},
- {"id": 21, "label": "Return", "type": null, "kind": "CTRL", "edges": [{"idx": 0, "def": 1, "role": "CTRL", "label": null}, {"idx": 1, "def": 0, "role": "DATA", "label": null}, {"idx": 2, "def": 4, "role": "DATA", "label": null}], "proj": null}
- ],
- "groups": [
- {"id": 8, "par": 0, "nodes": [1, 5, 8, 18]}
- ]
-}
diff --git a/chapter11/docs/graph8.svg b/chapter11/docs/graph8.svg
deleted file mode 100644
index d96a9a7d..00000000
--- a/chapter11/docs/graph8.svg
+++ /dev/null
@@ -1,98 +0,0 @@
-<svg aria-label="Compiler graph" width="431" height="676" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 431 676" style="font-family: sans-serif;"><style>
- html, body { height:100%; margin:0; font-family:sans-serif; }
- .viewer { height:100%; display:grid; grid-template-rows:auto minmax(0,1fr) auto; }
- .source { padding:8px; border-bottom:1px solid #ccc; }
- #program { width:min(600px,80vw); vertical-align:middle; }
- #status { margin-top:4px; }
- #graph { min-height:0; overflow:hidden; position:relative; background:#fafbfc; }
- #elk { width:100%; height:100%; }
- #graph svg { display:block; }
- .tools { display:flex; flex-wrap:wrap; align-items:center; gap:14px; margin-top:8px; font-size:12px; }
- .hint { color:#616c78; }
- .ctrl { color:#b63838; } .mem { color:#2867b2; } .data { color:#536477; }
- .edge { fill:none; stroke-width:1.5; }
- .edge.CTRL { stroke-width:2; }
- .edge.ASSOC { stroke-dasharray:4 4; }
- .edge.PARSER { stroke-dasharray:5 4; }
- .parser rect { fill:#f6f0ff; stroke:#7956a5; stroke-width:1.5; stroke-dasharray:5 4; }
- .edge.selected { stroke-width:3.5; }
- .edge.bundle { stroke-width:4; }
- .edge.bundle.selected { stroke-width:6; }
- .edge-hit { fill:none; stroke:transparent; stroke-width:12; vector-effect:non-scaling-stroke; pointer-events:stroke; cursor:pointer; }
- .edge-jump { fill:transparent; pointer-events:all; cursor:pointer; }
- .node { cursor:pointer; }
- .box { stroke:#758191; stroke-width:1; }
- .node.held .box { stroke-dasharray:5 3; }
- .node.near .box { stroke:#c18221; stroke-width:2; }
- .node.focus .box { stroke:#9c4900; stroke-width:3; }
- .node.selected .box { stroke:#1569b9; stroke-width:3; }
- .node.folded .box { stroke-width:4; }
- .node.folding .box { fill:#f4ccd7; }
- .fold-tag { font-size:9px; font-weight:700; fill:#963751; }
- .peep-area { fill:#fff3d9; fill-opacity:.8; stroke:#c18221; stroke-width:2; pointer-events:none; }
- .node.peep-edit .box { stroke:#9c4900; stroke-width:3; }
- .node.error .box { stroke:#b42318; stroke-width:4; }
- #event.error { color:#b42318; font-weight:600; white-space:pre-wrap; overflow-wrap:anywhere; }
- .peep-ghosts { pointer-events:none; }
- .region-box { stroke:#9da9b8; stroke-width:1.5; }
- .fold-btn { cursor:pointer; }
- .fold-btn rect { fill:white; stroke:#596674; }
- .fold-btn text { font-size:14px; fill:#152330; }
- .fold-btn:focus rect { stroke:#1569b9; stroke-width:2; }
- .shortcut { cursor:pointer; }
- .shortcut path { fill:none; stroke-width:1.5; }
- .shortcut rect { fill:#fff8ec; stroke:#b63838; stroke-dasharray:3 2; }
- .shortcut text { font-size:11px; fill:#783030; }
- .shortcut.selected rect, .shortcut:focus rect { stroke-width:2.5; }
- .label { font-size:12px; fill:#152330; font-weight:600; }
- .node-id { font-size:10px; fill:#596674; font-weight:400; }
- .type { font-size:11px; fill:#455768; }
- .port { stroke:#536477; stroke-width:1; }
- .row { stroke:#b6afcf; stroke-width:1; }
- .bind { font-size:12px; fill:#152330; }
- .slot { font-size:10px; fill:#364352; paint-order:stroke; stroke:#fafbfc; stroke-width:3; }
- #detail { position:absolute; top:8px; right:8px; margin:0; padding:12px; max-width:320px;
- max-height:45%; overflow:auto; white-space:pre-wrap; overflow-wrap:anywhere;
- background:#fffffff2; border:1px solid #bac5d0; border-radius:4px; font-size:12px; }
- .controls { display:flex; flex-wrap:wrap; justify-content:center; align-items:center; gap:6px; padding:6px; }
- .button { color:white; background:black; font-size:20px; min-width:30px; }
- .button:disabled { background:grey; }
- .count { font-size:20px; min-width:35px; text-align:center; }
- #N { width:6ch; }
- #scrub { width:clamp(120px,35vw,600px); }
- </style><defs><marker id="arrow-CTRL" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#b63838"/></marker><marker id="arrow-DATA" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#536477"/></marker><marker id="arrow-MEM" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#2867b2"/></marker><marker id="arrow-ASSOC" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#9396a3"/></marker><marker id="arrow-PARSER" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#7956a5"/></marker></defs><rect width="100%" height="100%" fill="rgb(250, 251, 252)"/><g><g class="regions" style="opacity: 1;"><g class="region" transform="translate(24,171)"><rect class="region-box" rx="8" width="313" height="298" fill="#f1f6fc"/></g></g><rect class="peep-area" rx="36" style="opacity: 0;"/><g class="edges"><path class="edge CTRL" id="e3i0" d="M126,575 C126,599 215.5,602 215.5,626" stroke="#b63838" marker-start="url(#arrow-CTRL)" style="opacity: 1;"><title>#3[0] → #21 · CTRL</title></path><path class="edge CTRL" id="e8i1" d="M116,118 L116,233" stroke="#b63838" marker-start="url(#arrow-CTRL)" style="opacity: 1;"><title>#8[1] → #6 · CTRL</title></path><path class="edge CTRL" id="e8i2" d="M216,434 L216,439 Q216,444 221,444 L317,444 Q325,444 325,436 L325,232 Q325,224 317,224 L152,224 Q146,224 146,230 L146,236" stroke="#b63838" marker-start="url(#arrow-CTRL)" style="opacity: 1;"><title>#8[2] → #5 · CTRL</title></path><path class="edge CTRL" id="e18i0" d="M116,289 L116,337" stroke="#b63838" marker-start="url(#arrow-CTRL)" style="opacity: 1;"><title>#18[0] → #8 · CTRL</title></path><path class="edge DATA" id="e18i1" d="M347,118 L347,123 Q347,128 342,128 L310,128 Q302,128 302,136 L302,291 Q302,299 294,299 L204,299 Q196,299 196,307 L196,337" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#18[1] → #4 · DATA</title></path><path class="edge CTRL" id="e21i0" d="M96,437 L96,522" stroke="#b63838" marker-start="url(#arrow-CTRL)" style="opacity: 1;"><title>#21[0] → #1 · CTRL</title></path><path class="edge DATA" id="e21i2" d="M347,118 L347,476 Q347,484 339,484 L164,484 Q156,484 156,492 L156,522" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#21[2] → #4 · DATA</title></path></g><g class="edge-hits"/><g class="parser" style="opacity: 1;"/><g class="nodes"><g class="node" id="n1" data-id="1" transform="translate(36,387)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>True</tspan><tspan class="node-id">  #1/0</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#1 True
-Projection 0 of #18
-Type not computed
-
-[0] → #18 CTRL</title></g><g class="node" id="n2" data-id="2" transform="translate(56,24)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Start</tspan><tspan class="node-id">  #2</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#2 Start
-Type not computed
-
-</title></g><g class="node" id="n3" data-id="3" transform="translate(179.5,626)" style="opacity: 1;"><path class="box" d="M0,0H72V26H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="36" y="17"><tspan>Stop</tspan><tspan class="node-id">  #3</tspan></text><text class="type" text-anchor="middle" y="35" x="36"/><title>#3 Stop
-Type not computed
-
-[0] → #21 CTRL</title><circle class="port" cx="36" cy="0" r="3" fill="#536477"/><text class="slot" x="36" y="-7" text-anchor="middle">0</text></g><g class="node" id="n4" data-id="4" transform="translate(287,68)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>#0</tspan><tspan class="node-id">  #4</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#4 #0
-Type not computed
-
-</title></g><g class="node" id="n5" data-id="5" transform="translate(156,387)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>False</tspan><tspan class="node-id">  #5/1</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#5 False
-Projection 1 of #18
-Type not computed
-
-[0] → #18 CTRL</title></g><g class="node" id="n6" data-id="6" transform="translate(56,68)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>$ctrl</tspan><tspan class="node-id">  #6/0</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#6 $ctrl
-Projection 0 of #2
-Type not computed
-
-[0] → #2 CTRL</title></g><g class="node" id="n8" data-id="8" transform="translate(56,239)" style="opacity: 1;"><path class="box" d="M20,0H100Q120,0 120,20V24Q120,44 100,44H20Q0,44 0,24V20Q0,0 20,0Z" fill="#ffe0ab"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Loop</tspan><tspan class="node-id">  #8</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#8 Loop
-Type not computed
-
-[0] → — DATA
-[1] → #6 CTRL
-[2] → #5 CTRL</title><circle class="port" cx="30" cy="-3" r="3" fill="white"/><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><circle class="port" cx="90" cy="-3" r="3" fill="#536477"/><text class="slot" x="30" y="-10" text-anchor="middle">0</text><text class="slot" x="60" y="-10" text-anchor="middle">1</text><text class="slot" x="90" y="-10" text-anchor="middle">2</text></g><g class="node" id="n18" data-id="18" transform="translate(36,343)" style="opacity: 1;"><path class="box" d="M0,0H240V44H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="120" y="18"><tspan>Never</tspan><tspan class="node-id">  #18</tspan></text><text class="type" text-anchor="middle" y="35" x="120"/><title>#18 Never
-Type not computed
-
-[0] → #8 CTRL
-[1] → #4 DATA</title><circle class="port" cx="80" cy="-3" r="3" fill="#536477"/><circle class="port" cx="160" cy="-3" r="3" fill="#536477"/><text class="slot" x="80" y="-10" text-anchor="middle">0</text><text class="slot" x="160" y="-10" text-anchor="middle">1</text></g><g class="node" id="n21" data-id="21" transform="translate(66,528)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Return</tspan><tspan class="node-id">  #21</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#21 Return
-Type not computed
-
-[0] → #1 CTRL
-[1] → — DATA
-[2] → #4 DATA</title><circle class="port" cx="30" cy="-3" r="3" fill="#536477"/><circle class="port" cx="60" cy="-3" r="3" fill="white"/><circle class="port" cx="90" cy="-3" r="3" fill="#536477"/><text class="slot" x="30" y="-10" text-anchor="middle">0</text><text class="slot" x="60" y="-10" text-anchor="middle">1</text><text class="slot" x="90" y="-10" text-anchor="middle">2</text></g></g><g class="region-heads" style="opacity: 1;"><g class="region-head" transform="translate(24,171)"><text class="label" x="26" y="17"><tspan>Loop</tspan><tspan class="node-id">  #8</tspan></text><title>Loop · 4 nodes</title><g class="fold-btn" role="button" tabindex="0" transform="translate(4,4)" aria-label="Fold region #8"><rect width="16" height="16" rx="2"/><text x="8" y="12" text-anchor="middle">−</text><title>Fold region</title></g></g></g><g class="shortcuts" style="opacity: 1;"/><g class="peep-ghosts" pointer-events="none"/></g></svg>
diff --git a/chapter11/docs/lattice.gv b/chapter11/docs/lattice.gv
new file mode 100644
index 00000000..93d99dd8
--- /dev/null
+++ b/chapter11/docs/lattice.gv
@@ -0,0 +1,133 @@
+digraph Lattice {
+ rankdir=TB;
+ newrank=true;
+ // Preserve the same-rank ordering edges through cluster layout.
+ remincross=false;
+ nodesep=0.22;
+ ranksep=0.65;
+ node [shape=ellipse, style=filled, fontname="DejaVu Sans", fontsize=13];
+ edge [color="#555555", arrowsize=0.6];
+
+ // These arrows are lattice-order edges, not use/definition edges.
+ TOP [label="⊤", fillcolor=black, fontcolor=white];
+ BOT [label="⊥", fillcolor=black, fontcolor=white];
+
+ subgraph cluster_control {
+ label="Control"; fontname="Arial"; color="#cccccc";
+ node [fillcolor="#ffff00"];
+ XCTRL [label="⊤:ctrl"];
+ CTRL [label="⊥:ctrl"];
+ XCTRL -> CTRL;
+ }
+
+ subgraph cluster_integer {
+ label="Integer"; fontname="Arial"; color="#cccccc";
+ node [fillcolor="#add8e6"];
+ INT_TOP [label="⊤:int"];
+ INT_BOT [label="⊥:int"];
+ INT_NEG [label="… −2, −1"];
+ INT_ZERO [label="0"];
+ INT_POS [label="1, 2, …"];
+ {rank=same; INT_NEG; INT_ZERO; INT_POS;}
+ INT_NEG -> INT_ZERO -> INT_POS [style=invis];
+ INT_TOP -> {INT_NEG INT_ZERO INT_POS};
+ {INT_NEG INT_ZERO INT_POS} -> INT_BOT;
+ }
+
+ subgraph cluster_pointer {
+ label="Pointer = nullability × struct type";
+ fontname="Arial"; color="#cccccc";
+ node [fillcolor="#008000", fontcolor=white];
+ PTR_TOP [label="⊤:ptr\n[*⊤:struct]"];
+ PTR_BOT [label="⊥:ptr\n[*⊥:struct?]"];
+ PTR_NULL [label="null"];
+ PTR_ANY [label="*⊥:struct\n[ptr any struct]"];
+ PTR_PERSON [label="*Person"];
+ PTR_S1 [label="*s1"];
+ PTR_MORE [label="*s2, …"];
+ PTR_PERSON_NIL [label="*Person?"];
+ PTR_S1_NIL [label="*s1?"];
+ PTR_MORE_NIL [label="*s2?, …"];
+ {rank=same; PTR_PERSON; PTR_S1; PTR_MORE; PTR_NULL;}
+ {rank=same; PTR_ANY; PTR_PERSON_NIL; PTR_S1_NIL; PTR_MORE_NIL;}
+ PTR_PERSON -> PTR_S1 -> PTR_MORE -> PTR_NULL [style=invis];
+ PTR_ANY -> PTR_PERSON_NIL -> PTR_S1_NIL -> PTR_MORE_NIL [style=invis];
+ PTR_TOP -> {PTR_PERSON PTR_S1 PTR_MORE PTR_NULL};
+ {PTR_PERSON PTR_S1 PTR_MORE} -> PTR_ANY;
+ PTR_PERSON -> PTR_PERSON_NIL;
+ PTR_S1 -> PTR_S1_NIL;
+ PTR_MORE -> PTR_MORE_NIL;
+ PTR_NULL -> {PTR_PERSON_NIL PTR_S1_NIL PTR_MORE_NIL};
+ {PTR_ANY PTR_PERSON_NIL PTR_S1_NIL PTR_MORE_NIL} -> PTR_BOT;
+ }
+
+ subgraph cluster_struct {
+ label="Struct\nnamed collection of named scalar types";
+ fontname="Arial"; color="#cccccc";
+ node [fillcolor="#90ee90"];
+ STRUCT_TOP [label="⊤:struct\n[struct top]"];
+ STRUCT_BOT [label="⊥:struct\n[struct bottom]"];
+ STRUCT_PERSON [label="Person\nage: int", shape=box];
+ STRUCT_S1 [label="s1\nx: int", shape=box];
+ STRUCT_S2 [label="s2\nx: int, y: int", shape=box];
+ STRUCT_MORE [label="…", shape=box];
+ {rank=same; STRUCT_PERSON; STRUCT_S1; STRUCT_S2; STRUCT_MORE;}
+ STRUCT_PERSON -> STRUCT_S1 -> STRUCT_S2 -> STRUCT_MORE [style=invis];
+ STRUCT_TOP -> {STRUCT_PERSON STRUCT_S1 STRUCT_S2 STRUCT_MORE};
+ {STRUCT_PERSON STRUCT_S1 STRUCT_S2 STRUCT_MORE} -> STRUCT_BOT;
+ }
+
+ subgraph cluster_memory {
+ label="Memory\nprecise alias slices"; fontname="Arial"; color="#cccccc";
+ node [fillcolor="#00008b", fontcolor=white];
+ MEM_TOP [label="⊤:mem"];
+ MEM_BOT [label="⊥:mem"];
+ MEM_ALIAS2 [label="MEM#2"];
+ MEM_ALIAS3 [label="MEM#3"];
+ MEM_MORE [label="…"];
+ {rank=same; MEM_ALIAS2; MEM_ALIAS3; MEM_MORE;}
+ MEM_ALIAS2 -> MEM_ALIAS3 -> MEM_MORE [style=invis];
+ MEM_TOP -> {MEM_ALIAS2 MEM_ALIAS3 MEM_MORE};
+ {MEM_ALIAS2 MEM_ALIAS3 MEM_MORE} -> MEM_BOT;
+ }
+
+ subgraph cluster_tuple {
+ label="Tuple\ncollection of types";
+ fontname="Arial"; color="#cccccc";
+ node [fillcolor="#ffc0cb"];
+ TUPLE_TOP [label="⊤:tuple"];
+ TUPLE_BOT [label="⊥:tuple"];
+ // Each black element stands for a recursively nested type lattice.
+ TUPLE1 [shape=plain, label=<
+ <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
+ <TR><TD BGCOLOR="#ffc0cb">tuple</TD></TR>
+ <TR><TD BGCOLOR="black"><FONT COLOR="white">type</FONT></TD></TR>
+ </TABLE>
+ >];
+ TUPLE2 [shape=plain, label=<
+ <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
+ <TR><TD BGCOLOR="#ffc0cb">tuple</TD></TR>
+ <TR><TD BGCOLOR="black"><FONT COLOR="white">type</FONT></TD></TR>
+ <TR><TD BGCOLOR="black"><FONT COLOR="white">type</FONT></TD></TR>
+ </TABLE>
+ >];
+ TUPLEN [shape=plain, label=<
+ <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
+ <TR><TD BGCOLOR="#ffc0cb">tuple</TD></TR>
+ <TR><TD BGCOLOR="black"><FONT COLOR="white">type</FONT></TD></TR>
+ <TR><TD BGCOLOR="black"><FONT COLOR="white">…</FONT></TD></TR>
+ <TR><TD BGCOLOR="black"><FONT COLOR="white">type</FONT></TD></TR>
+ </TABLE>
+ >];
+ {rank=same; TUPLE1; TUPLE2; TUPLEN;}
+ TUPLE1 -> TUPLE2 -> TUPLEN [style=invis];
+ TUPLE_TOP -> {TUPLE1 TUPLE2 TUPLEN};
+ {TUPLE1 TUPLE2 TUPLEN} -> TUPLE_BOT;
+ }
+
+ TOP -> {XCTRL INT_TOP PTR_TOP STRUCT_TOP MEM_TOP TUPLE_TOP};
+ {CTRL INT_BOT PTR_BOT STRUCT_BOT MEM_BOT TUPLE_BOT} -> BOT;
+ {rank=same; XCTRL; INT_TOP; PTR_TOP; STRUCT_TOP; MEM_TOP; TUPLE_TOP;}
+ {rank=same; CTRL; INT_BOT; PTR_BOT; STRUCT_BOT; MEM_BOT; TUPLE_BOT;}
+ XCTRL -> INT_TOP -> PTR_TOP -> STRUCT_TOP -> MEM_TOP -> TUPLE_TOP [style=invis];
+}
diff --git a/chapter11/docs/lattice.svg b/chapter11/docs/lattice.svg
new file mode 100644
index 00000000..8d2e2875
--- /dev/null
+++ b/chapter11/docs/lattice.svg
@@ -0,0 +1,644 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<!-- Generated by graphviz version 12.2.0 (20241103.1931)
+ -->
+<!-- Title: Lattice Pages: 1 -->
+<svg width="1727pt" height="603pt"
+ viewBox="0.00 0.00 1727.00 603.45" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 599.45)">
+<title>Lattice</title>
+<polygon fill="white" stroke="none" points="-4,4 -4,-599.45 1723,-599.45 1723,4 -4,4"/>
+<g id="clust1" class="cluster">
+<title>cluster_control</title>
+<polygon fill="none" stroke="#cccccc" points="8,-85.99 8,-524.71 98,-524.71 98,-85.99 8,-85.99"/>
+<text text-anchor="middle" x="53" y="-507.41" font-family="Arial" font-size="14.00">Control</text>
+</g>
+<g id="clust2" class="cluster">
+<title>cluster_integer</title>
+<polygon fill="none" stroke="#cccccc" points="106,-85.99 106,-524.71 404,-524.71 404,-85.99 106,-85.99"/>
+<text text-anchor="middle" x="255" y="-507.41" font-family="Arial" font-size="14.00">Integer</text>
+</g>
+<g id="clust6" class="cluster">
+<title>cluster_pointer</title>
+<polygon fill="none" stroke="#cccccc" points="412,-75 412,-535.7 893,-535.7 893,-75 412,-75"/>
+<text text-anchor="middle" x="652.5" y="-518.4" font-family="Arial" font-size="14.00">Pointer = nullability × struct type</text>
+</g>
+<g id="clust13" class="cluster">
+<title>cluster_struct</title>
+<polygon fill="none" stroke="#cccccc" points="901,-75 901,-551.45 1233,-551.45 1233,-75 901,-75"/>
+<text text-anchor="middle" x="1067" y="-534.15" font-family="Arial" font-size="14.00">Struct</text>
+<text text-anchor="middle" x="1067" y="-518.4" font-family="Arial" font-size="14.00">named collection of named scalar types</text>
+</g>
+<g id="clust17" class="cluster">
+<title>cluster_memory</title>
+<polygon fill="none" stroke="#cccccc" points="1241,-85.99 1241,-540.46 1523,-540.46 1523,-85.99 1241,-85.99"/>
+<text text-anchor="middle" x="1382" y="-523.16" font-family="Arial" font-size="14.00">Memory</text>
+<text text-anchor="middle" x="1382" y="-507.41" font-family="Arial" font-size="14.00">precise alias slices</text>
+</g>
+<g id="clust21" class="cluster">
+<title>cluster_tuple</title>
+<polygon fill="none" stroke="#cccccc" points="1531,-85.99 1531,-540.46 1711,-540.46 1711,-85.99 1531,-85.99"/>
+<text text-anchor="middle" x="1621" y="-523.16" font-family="Arial" font-size="14.00">Tuple</text>
+<text text-anchor="middle" x="1621" y="-507.41" font-family="Arial" font-size="14.00">collection of types</text>
+</g>
+<!-- TOP -->
+<g id="node1" class="node">
+<title>TOP</title>
+<ellipse fill="black" stroke="black" cx="887" cy="-577.45" rx="27" ry="18"/>
+<text text-anchor="middle" x="887" y="-573.35" font-family="DejaVu Sans" font-size="13.00" fill="white">⊤</text>
+</g>
+<!-- XCTRL -->
+<g id="node3" class="node">
+<title>XCTRL</title>
+<ellipse fill="#ffff00" stroke="black" cx="53" cy="-474.96" rx="36.51" ry="18"/>
+<text text-anchor="middle" x="53" y="-470.86" font-family="DejaVu Sans" font-size="13.00">⊤:ctrl</text>
+</g>
+<!-- TOP&#45;&gt;XCTRL -->
+<g id="edge60" class="edge">
+<title>TOP&#45;&gt;XCTRL</title>
+<path fill="none" stroke="#555555" d="M859.92,-576.29C725.56,-575.4 135.66,-570.43 102,-551.45 82.17,-540.27 69.05,-517.37 61.41,-499.71"/>
+<polygon fill="#555555" stroke="#555555" points="63.45,-499.15 59.23,-494.39 59.57,-500.74 63.45,-499.15"/>
+</g>
+<!-- INT_TOP -->
+<g id="node5" class="node">
+<title>INT_TOP</title>
+<ellipse fill="#add8e6" stroke="black" cx="353" cy="-474.96" rx="33.44" ry="18"/>
+<text text-anchor="middle" x="353" y="-470.86" font-family="DejaVu Sans" font-size="13.00">⊤:int</text>
+</g>
+<!-- TOP&#45;&gt;INT_TOP -->
+<g id="edge61" class="edge">
+<title>TOP&#45;&gt;INT_TOP</title>
+<path fill="none" stroke="#555555" d="M859.8,-576.38C764.27,-575.97 447.72,-572.97 408,-551.45 387.23,-540.19 372.29,-517.31 363.27,-499.67"/>
+<polygon fill="#555555" stroke="#555555" points="365.18,-498.79 360.66,-494.32 361.41,-500.63 365.18,-498.79"/>
+</g>
+<!-- PTR_TOP -->
+<g id="node10" class="node">
+<title>PTR_TOP</title>
+<ellipse fill="#008000" stroke="black" cx="715" cy="-474.96" rx="61.7" ry="28.99"/>
+<text text-anchor="middle" x="715" y="-479.11" font-family="DejaVu Sans" font-size="13.00" fill="white">⊤:ptr</text>
+<text text-anchor="middle" x="715" y="-462.61" font-family="DejaVu Sans" font-size="13.00" fill="white">[*⊤:struct]</text>
+</g>
+<!-- TOP&#45;&gt;PTR_TOP -->
+<g id="edge62" class="edge">
+<title>TOP&#45;&gt;PTR_TOP</title>
+<path fill="none" stroke="#555555" d="M867.27,-564.92C841.1,-549.63 794.17,-522.21 759.3,-501.84"/>
+<polygon fill="#555555" stroke="#555555" points="760.48,-500.1 754.24,-498.88 758.36,-503.72 760.48,-500.1"/>
+</g>
+<!-- STRUCT_TOP -->
+<g id="node20" class="node">
+<title>STRUCT_TOP</title>
+<ellipse fill="#90ee90" stroke="black" cx="1020" cy="-474.96" rx="64.35" ry="28.99"/>
+<text text-anchor="middle" x="1020" y="-479.11" font-family="DejaVu Sans" font-size="13.00">⊤:struct</text>
+<text text-anchor="middle" x="1020" y="-462.61" font-family="DejaVu Sans" font-size="13.00">[struct top]</text>
+</g>
+<!-- TOP&#45;&gt;STRUCT_TOP -->
+<g id="edge63" class="edge">
+<title>TOP&#45;&gt;STRUCT_TOP</title>
+<path fill="none" stroke="#555555" d="M904.39,-563.31C923.88,-548.58 956.09,-524.25 981.56,-505"/>
+<polygon fill="#555555" stroke="#555555" points="982.82,-506.68 986.34,-501.39 980.29,-503.33 982.82,-506.68"/>
+</g>
+<!-- MEM_TOP -->
+<g id="node26" class="node">
+<title>MEM_TOP</title>
+<ellipse fill="#00008b" stroke="black" cx="1347" cy="-474.96" rx="44.7" ry="18"/>
+<text text-anchor="middle" x="1347" y="-470.86" font-family="DejaVu Sans" font-size="13.00" fill="white">⊤:mem</text>
+</g>
+<!-- TOP&#45;&gt;MEM_TOP -->
+<g id="edge64" class="edge">
+<title>TOP&#45;&gt;MEM_TOP</title>
+<path fill="none" stroke="#555555" d="M914.28,-576.34C985.84,-575.75 1177.55,-572.23 1237,-551.45 1270.57,-539.71 1303.45,-514.89 1324.38,-496.91"/>
+<polygon fill="#555555" stroke="#555555" points="1325.69,-498.56 1328.82,-493.03 1322.92,-495.39 1325.69,-498.56"/>
+</g>
+<!-- TUPLE_TOP -->
+<g id="node31" class="node">
+<title>TUPLE_TOP</title>
+<ellipse fill="#ffc0cb" stroke="black" cx="1584" cy="-474.96" rx="44.7" ry="18"/>
+<text text-anchor="middle" x="1584" y="-470.86" font-family="DejaVu Sans" font-size="13.00">⊤:tuple</text>
+</g>
+<!-- TOP&#45;&gt;TUPLE_TOP -->
+<g id="edge65" class="edge">
+<title>TOP&#45;&gt;TUPLE_TOP</title>
+<path fill="none" stroke="#555555" d="M914.19,-576.75C1029.19,-577.83 1472.18,-580.1 1527,-551.45 1548.39,-540.27 1564,-517.05 1573.43,-499.3"/>
+<polygon fill="#555555" stroke="#555555" points="1575.08,-500.68 1575.93,-494.38 1571.33,-498.78 1575.08,-500.68"/>
+</g>
+<!-- BOT -->
+<g id="node2" class="node">
+<title>BOT</title>
+<ellipse fill="black" stroke="black" cx="884" cy="-18" rx="27" ry="18"/>
+<text text-anchor="middle" x="884" y="-13.9" font-family="DejaVu Sans" font-size="13.00" fill="white">⊥</text>
+</g>
+<!-- CTRL -->
+<g id="node4" class="node">
+<title>CTRL</title>
+<ellipse fill="#ffff00" stroke="black" cx="53" cy="-111.99" rx="36.51" ry="18"/>
+<text text-anchor="middle" x="53" y="-107.89" font-family="DejaVu Sans" font-size="13.00">⊥:ctrl</text>
+</g>
+<!-- XCTRL&#45;&gt;CTRL -->
+<g id="edge1" class="edge">
+<title>XCTRL&#45;&gt;CTRL</title>
+<path fill="none" stroke="#555555" d="M53,-456.55C53,-397.7 53,-206.04 53,-137.58"/>
+<polygon fill="#555555" stroke="#555555" points="55.1,-137.74 53,-131.74 50.9,-137.74 55.1,-137.74"/>
+</g>
+<!-- XCTRL&#45;&gt;INT_TOP -->
+<!-- CTRL&#45;&gt;BOT -->
+<g id="edge66" class="edge">
+<title>CTRL&#45;&gt;BOT</title>
+<path fill="none" stroke="#555555" d="M69.29,-95.39C78.22,-87.83 89.91,-79.45 102,-75 242.26,-23.4 717.31,-19.12 849.57,-18.95"/>
+<polygon fill="#555555" stroke="#555555" points="849.19,-21.05 855.19,-18.94 849.18,-16.85 849.19,-21.05"/>
+</g>
+<!-- INT_NEG -->
+<g id="node7" class="node">
+<title>INT_NEG</title>
+<ellipse fill="#add8e6" stroke="black" cx="169" cy="-345.97" rx="55.45" ry="18"/>
+<text text-anchor="middle" x="169" y="-341.87" font-family="DejaVu Sans" font-size="13.00">… −2, −1</text>
+</g>
+<!-- INT_TOP&#45;&gt;INT_NEG -->
+<g id="edge4" class="edge">
+<title>INT_TOP&#45;&gt;INT_NEG</title>
+<path fill="none" stroke="#555555" d="M330.56,-461.28C305.82,-447.02 265.13,-422.74 232,-398.97 218.63,-389.37 204.44,-377.8 192.92,-368"/>
+<polygon fill="#555555" stroke="#555555" points="194.57,-366.65 188.64,-364.34 191.83,-369.84 194.57,-366.65"/>
+</g>
+<!-- INT_ZERO -->
+<g id="node8" class="node">
+<title>INT_ZERO</title>
+<ellipse fill="#add8e6" stroke="black" cx="267" cy="-345.97" rx="27" ry="18"/>
+<text text-anchor="middle" x="267" y="-341.87" font-family="DejaVu Sans" font-size="13.00">0</text>
+</g>
+<!-- INT_TOP&#45;&gt;INT_ZERO -->
+<g id="edge5" class="edge">
+<title>INT_TOP&#45;&gt;INT_ZERO</title>
+<path fill="none" stroke="#555555" d="M341.83,-457.59C331.49,-442.41 315.68,-419.18 302,-398.97 295.36,-389.15 288.04,-378.28 281.81,-369.03"/>
+<polygon fill="#555555" stroke="#555555" points="283.64,-367.97 278.55,-364.17 280.15,-370.32 283.64,-367.97"/>
+</g>
+<!-- INT_POS -->
+<g id="node9" class="node">
+<title>INT_POS</title>
+<ellipse fill="#add8e6" stroke="black" cx="353" cy="-345.97" rx="43.16" ry="18"/>
+<text text-anchor="middle" x="353" y="-341.87" font-family="DejaVu Sans" font-size="13.00">1, 2, …</text>
+</g>
+<!-- INT_TOP&#45;&gt;INT_POS -->
+<g id="edge6" class="edge">
+<title>INT_TOP&#45;&gt;INT_POS</title>
+<path fill="none" stroke="#555555" d="M353,-456.57C353,-434.53 353,-396.41 353,-371.44"/>
+<polygon fill="#555555" stroke="#555555" points="355.1,-371.66 353,-365.66 350.9,-371.66 355.1,-371.66"/>
+</g>
+<!-- INT_TOP&#45;&gt;PTR_TOP -->
+<!-- INT_BOT -->
+<g id="node6" class="node">
+<title>INT_BOT</title>
+<ellipse fill="#add8e6" stroke="black" cx="289" cy="-111.99" rx="33.44" ry="18"/>
+<text text-anchor="middle" x="289" y="-107.89" font-family="DejaVu Sans" font-size="13.00">⊥:int</text>
+</g>
+<!-- INT_BOT&#45;&gt;BOT -->
+<g id="edge67" class="edge">
+<title>INT_BOT&#45;&gt;BOT</title>
+<path fill="none" stroke="#555555" d="M316.06,-101.31C339.95,-93.13 375.88,-81.69 408,-75 571.35,-40.97 770.86,-25.89 849.65,-20.95"/>
+<polygon fill="#555555" stroke="#555555" points="849.52,-23.07 855.38,-20.6 849.26,-18.87 849.52,-23.07"/>
+</g>
+<!-- INT_NEG&#45;&gt;INT_BOT -->
+<g id="edge7" class="edge">
+<title>INT_NEG&#45;&gt;INT_BOT</title>
+<path fill="none" stroke="#555555" d="M177.82,-327.91C199.03,-286.92 252.87,-182.84 276.99,-136.21"/>
+<polygon fill="#555555" stroke="#555555" points="278.74,-137.4 279.63,-131.11 275.01,-135.47 278.74,-137.4"/>
+</g>
+<!-- INT_NEG&#45;&gt;INT_ZERO -->
+<!-- INT_ZERO&#45;&gt;INT_BOT -->
+<g id="edge8" class="edge">
+<title>INT_ZERO&#45;&gt;INT_BOT</title>
+<path fill="none" stroke="#555555" d="M268.65,-327.53C272.53,-286.71 282.19,-184.82 286.66,-137.66"/>
+<polygon fill="#555555" stroke="#555555" points="288.74,-137.99 287.21,-131.82 284.56,-137.59 288.74,-137.99"/>
+</g>
+<!-- INT_ZERO&#45;&gt;INT_POS -->
+<!-- INT_POS&#45;&gt;INT_BOT -->
+<g id="edge9" class="edge">
+<title>INT_POS&#45;&gt;INT_BOT</title>
+<path fill="none" stroke="#555555" d="M348.29,-327.91C337.06,-287.19 308.65,-184.2 295.66,-137.13"/>
+<polygon fill="#555555" stroke="#555555" points="297.74,-136.76 294.12,-131.53 293.69,-137.88 297.74,-136.76"/>
+</g>
+<!-- PTR_NULL -->
+<g id="node12" class="node">
+<title>PTR_NULL</title>
+<ellipse fill="#008000" stroke="black" cx="799" cy="-345.97" rx="27.3" ry="18"/>
+<text text-anchor="middle" x="799" y="-341.87" font-family="DejaVu Sans" font-size="13.00" fill="white">null</text>
+</g>
+<!-- PTR_TOP&#45;&gt;PTR_NULL -->
+<g id="edge16" class="edge">
+<title>PTR_TOP&#45;&gt;PTR_NULL</title>
+<path fill="none" stroke="#555555" d="M732.81,-447.03C748.16,-423.83 770.03,-390.77 784.37,-369.09"/>
+<polygon fill="#555555" stroke="#555555" points="785.98,-370.45 787.54,-364.29 782.48,-368.13 785.98,-370.45"/>
+</g>
+<!-- PTR_PERSON -->
+<g id="node14" class="node">
+<title>PTR_PERSON</title>
+<ellipse fill="#008000" stroke="black" cx="542" cy="-345.97" rx="45.72" ry="18"/>
+<text text-anchor="middle" x="542" y="-341.87" font-family="DejaVu Sans" font-size="13.00" fill="white">*Person</text>
+</g>
+<!-- PTR_TOP&#45;&gt;PTR_PERSON -->
+<g id="edge17" class="edge">
+<title>PTR_TOP&#45;&gt;PTR_PERSON</title>
+<path fill="none" stroke="#555555" d="M675.88,-452.05C651.99,-438.01 621.28,-418.77 596,-398.97 584.24,-389.76 572.18,-378.36 562.44,-368.58"/>
+<polygon fill="#555555" stroke="#555555" points="564.05,-367.22 558.35,-364.42 561.06,-370.17 564.05,-367.22"/>
+</g>
+<!-- PTR_S1 -->
+<g id="node15" class="node">
+<title>PTR_S1</title>
+<ellipse fill="#008000" stroke="black" cx="631" cy="-345.97" rx="27" ry="18"/>
+<text text-anchor="middle" x="631" y="-341.87" font-family="DejaVu Sans" font-size="13.00" fill="white">*s1</text>
+</g>
+<!-- PTR_TOP&#45;&gt;PTR_S1 -->
+<g id="edge18" class="edge">
+<title>PTR_TOP&#45;&gt;PTR_S1</title>
+<path fill="none" stroke="#555555" d="M697.19,-447.03C681.84,-423.83 659.97,-390.77 645.63,-369.09"/>
+<polygon fill="#555555" stroke="#555555" points="647.52,-368.13 642.46,-364.29 644.02,-370.45 647.52,-368.13"/>
+</g>
+<!-- PTR_MORE -->
+<g id="node16" class="node">
+<title>PTR_MORE</title>
+<ellipse fill="#008000" stroke="black" cx="715" cy="-345.97" rx="40.6" ry="18"/>
+<text text-anchor="middle" x="715" y="-341.87" font-family="DejaVu Sans" font-size="13.00" fill="white">*s2, …</text>
+</g>
+<!-- PTR_TOP&#45;&gt;PTR_MORE -->
+<g id="edge19" class="edge">
+<title>PTR_TOP&#45;&gt;PTR_MORE</title>
+<path fill="none" stroke="#555555" d="M715,-445.77C715,-423.52 715,-392.77 715,-371.51"/>
+<polygon fill="#555555" stroke="#555555" points="717.1,-371.66 715,-365.66 712.9,-371.66 717.1,-371.66"/>
+</g>
+<!-- PTR_TOP&#45;&gt;STRUCT_TOP -->
+<!-- PTR_BOT -->
+<g id="node11" class="node">
+<title>PTR_BOT</title>
+<ellipse fill="#008000" stroke="black" cx="748" cy="-111.99" rx="66.47" ry="28.99"/>
+<text text-anchor="middle" x="748" y="-116.14" font-family="DejaVu Sans" font-size="13.00" fill="white">⊥:ptr</text>
+<text text-anchor="middle" x="748" y="-99.64" font-family="DejaVu Sans" font-size="13.00" fill="white">[*⊥:struct?]</text>
+</g>
+<!-- PTR_BOT&#45;&gt;BOT -->
+<g id="edge68" class="edge">
+<title>PTR_BOT&#45;&gt;BOT</title>
+<path fill="none" stroke="#555555" d="M783.38,-87.06C807.3,-70.88 838.29,-49.92 859.52,-35.56"/>
+<polygon fill="#555555" stroke="#555555" points="860.46,-37.46 864.25,-32.36 858.1,-33.98 860.46,-37.46"/>
+</g>
+<!-- PTR_PERSON_NIL -->
+<g id="node17" class="node">
+<title>PTR_PERSON_NIL</title>
+<ellipse fill="#008000" stroke="black" cx="651" cy="-216.97" rx="50.33" ry="18"/>
+<text text-anchor="middle" x="651" y="-212.87" font-family="DejaVu Sans" font-size="13.00" fill="white">*Person?</text>
+</g>
+<!-- PTR_NULL&#45;&gt;PTR_PERSON_NIL -->
+<g id="edge26" class="edge">
+<title>PTR_NULL&#45;&gt;PTR_PERSON_NIL</title>
+<path fill="none" stroke="#555555" d="M790.34,-328.75C783.99,-317.83 774.65,-303.55 764,-292.97 740.64,-269.76 709.08,-249.53 685.25,-235.95"/>
+<polygon fill="#555555" stroke="#555555" points="686.33,-234.14 680.07,-233.04 684.27,-237.8 686.33,-234.14"/>
+</g>
+<!-- PTR_S1_NIL -->
+<g id="node18" class="node">
+<title>PTR_S1_NIL</title>
+<ellipse fill="#008000" stroke="black" cx="748" cy="-216.97" rx="30.37" ry="18"/>
+<text text-anchor="middle" x="748" y="-212.87" font-family="DejaVu Sans" font-size="13.00" fill="white">*s1?</text>
+</g>
+<!-- PTR_NULL&#45;&gt;PTR_S1_NIL -->
+<g id="edge27" class="edge">
+<title>PTR_NULL&#45;&gt;PTR_S1_NIL</title>
+<path fill="none" stroke="#555555" d="M792.23,-328.1C783.31,-305.9 767.59,-266.75 757.49,-241.6"/>
+<polygon fill="#555555" stroke="#555555" points="759.55,-241.1 755.36,-236.31 755.65,-242.66 759.55,-241.1"/>
+</g>
+<!-- PTR_MORE_NIL -->
+<g id="node19" class="node">
+<title>PTR_MORE_NIL</title>
+<ellipse fill="#008000" stroke="black" cx="840" cy="-216.97" rx="45.21" ry="18"/>
+<text text-anchor="middle" x="840" y="-212.87" font-family="DejaVu Sans" font-size="13.00" fill="white">*s2?, …</text>
+</g>
+<!-- PTR_NULL&#45;&gt;PTR_MORE_NIL -->
+<g id="edge28" class="edge">
+<title>PTR_NULL&#45;&gt;PTR_MORE_NIL</title>
+<path fill="none" stroke="#555555" d="M804.53,-327.84C811.65,-305.78 824.07,-267.3 832.17,-242.24"/>
+<polygon fill="#555555" stroke="#555555" points="834.12,-243.03 833.96,-236.68 830.12,-241.74 834.12,-243.03"/>
+</g>
+<!-- PTR_ANY -->
+<g id="node13" class="node">
+<title>PTR_ANY</title>
+<ellipse fill="#008000" stroke="black" cx="502" cy="-216.97" rx="82.38" ry="28.99"/>
+<text text-anchor="middle" x="502" y="-221.12" font-family="DejaVu Sans" font-size="13.00" fill="white">*⊥:struct</text>
+<text text-anchor="middle" x="502" y="-204.62" font-family="DejaVu Sans" font-size="13.00" fill="white">[ptr any struct]</text>
+</g>
+<!-- PTR_ANY&#45;&gt;PTR_BOT -->
+<g id="edge29" class="edge">
+<title>PTR_ANY&#45;&gt;PTR_BOT</title>
+<path fill="none" stroke="#555555" d="M554.17,-194.13C595.32,-176.91 652.51,-152.97 694.1,-135.56"/>
+<polygon fill="#555555" stroke="#555555" points="694.78,-137.55 699.5,-133.29 693.15,-133.67 694.78,-137.55"/>
+</g>
+<!-- PTR_ANY&#45;&gt;PTR_PERSON_NIL -->
+<!-- PTR_PERSON&#45;&gt;PTR_ANY -->
+<g id="edge20" class="edge">
+<title>PTR_PERSON&#45;&gt;PTR_ANY</title>
+<path fill="none" stroke="#555555" d="M536.61,-327.84C530.59,-308.74 520.69,-277.32 513.02,-252.97"/>
+<polygon fill="#555555" stroke="#555555" points="515.08,-252.52 511.28,-247.43 511.08,-253.78 515.08,-252.52"/>
+</g>
+<!-- PTR_PERSON&#45;&gt;PTR_S1 -->
+<!-- PTR_PERSON&#45;&gt;PTR_PERSON_NIL -->
+<g id="edge23" class="edge">
+<title>PTR_PERSON&#45;&gt;PTR_PERSON_NIL</title>
+<path fill="none" stroke="#555555" d="M556.03,-328.62C575.38,-306.08 610.32,-265.36 632,-240.11"/>
+<polygon fill="#555555" stroke="#555555" points="633.38,-241.73 635.7,-235.81 630.19,-238.99 633.38,-241.73"/>
+</g>
+<!-- PTR_S1&#45;&gt;PTR_ANY -->
+<g id="edge21" class="edge">
+<title>PTR_S1&#45;&gt;PTR_ANY</title>
+<path fill="none" stroke="#555555" d="M621.75,-328.57C615.28,-317.84 606.03,-303.85 596,-292.97 580.61,-276.28 561.35,-260.24 544.26,-247.31"/>
+<polygon fill="#555555" stroke="#555555" points="545.84,-245.87 539.78,-243.96 543.32,-249.23 545.84,-245.87"/>
+</g>
+<!-- PTR_S1&#45;&gt;PTR_MORE -->
+<!-- PTR_S1&#45;&gt;PTR_S1_NIL -->
+<g id="edge24" class="edge">
+<title>PTR_S1&#45;&gt;PTR_S1_NIL</title>
+<path fill="none" stroke="#555555" d="M640.49,-328.79C647.07,-318.15 656.34,-304.18 666,-292.97 684.1,-271.96 707.73,-250.9 724.97,-236.47"/>
+<polygon fill="#555555" stroke="#555555" points="726.11,-238.25 729.39,-232.8 723.43,-235.02 726.11,-238.25"/>
+</g>
+<!-- PTR_MORE&#45;&gt;PTR_NULL -->
+<!-- PTR_MORE&#45;&gt;PTR_ANY -->
+<g id="edge22" class="edge">
+<title>PTR_MORE&#45;&gt;PTR_ANY</title>
+<path fill="none" stroke="#555555" d="M702.63,-328.84C693.45,-317.69 680.11,-303.08 666,-292.97 635.59,-271.17 597.84,-253.38 566.22,-240.61"/>
+<polygon fill="#555555" stroke="#555555" points="567.33,-238.79 560.98,-238.52 565.78,-242.69 567.33,-238.79"/>
+</g>
+<!-- PTR_MORE&#45;&gt;PTR_MORE_NIL -->
+<g id="edge25" class="edge">
+<title>PTR_MORE&#45;&gt;PTR_MORE_NIL</title>
+<path fill="none" stroke="#555555" d="M729.86,-328.89C739.5,-318.54 752.38,-304.85 764,-292.97 782,-274.55 802.85,-254.03 818.15,-239.12"/>
+<polygon fill="#555555" stroke="#555555" points="819.6,-240.64 822.44,-234.95 816.67,-237.63 819.6,-240.64"/>
+</g>
+<!-- PTR_PERSON_NIL&#45;&gt;PTR_BOT -->
+<g id="edge30" class="edge">
+<title>PTR_PERSON_NIL&#45;&gt;PTR_BOT</title>
+<path fill="none" stroke="#555555" d="M666.58,-199.43C680.58,-184.56 701.51,-162.35 718.65,-144.16"/>
+<polygon fill="#555555" stroke="#555555" points="719.75,-146.05 722.33,-140.24 716.69,-143.17 719.75,-146.05"/>
+</g>
+<!-- PTR_PERSON_NIL&#45;&gt;PTR_S1_NIL -->
+<!-- PTR_S1_NIL&#45;&gt;PTR_BOT -->
+<g id="edge31" class="edge">
+<title>PTR_S1_NIL&#45;&gt;PTR_BOT</title>
+<path fill="none" stroke="#555555" d="M748,-198.5C748,-184.97 748,-165.76 748,-148.97"/>
+<polygon fill="#555555" stroke="#555555" points="750.1,-148.97 748,-142.97 745.9,-148.97 750.1,-148.97"/>
+</g>
+<!-- PTR_S1_NIL&#45;&gt;PTR_MORE_NIL -->
+<!-- PTR_MORE_NIL&#45;&gt;PTR_BOT -->
+<g id="edge32" class="edge">
+<title>PTR_MORE_NIL&#45;&gt;PTR_BOT</title>
+<path fill="none" stroke="#555555" d="M825.62,-199.88C812.53,-185.22 792.8,-163.14 776.51,-144.9"/>
+<polygon fill="#555555" stroke="#555555" points="778.14,-143.58 772.58,-140.51 775.01,-146.38 778.14,-143.58"/>
+</g>
+<!-- STRUCT_PERSON -->
+<g id="node22" class="node">
+<title>STRUCT_PERSON</title>
+<polygon fill="#90ee90" stroke="black" points="976.5,-237.47 909.5,-237.47 909.5,-196.47 976.5,-196.47 976.5,-237.47"/>
+<text text-anchor="middle" x="943" y="-221.12" font-family="DejaVu Sans" font-size="13.00">Person</text>
+<text text-anchor="middle" x="943" y="-204.62" font-family="DejaVu Sans" font-size="13.00">age: int</text>
+</g>
+<!-- STRUCT_TOP&#45;&gt;STRUCT_PERSON -->
+<g id="edge36" class="edge">
+<title>STRUCT_TOP&#45;&gt;STRUCT_PERSON</title>
+<path fill="none" stroke="#555555" d="M1011.61,-446.07C996.71,-396.53 965.8,-293.77 951.1,-244.91"/>
+<polygon fill="#555555" stroke="#555555" points="953.15,-244.41 949.41,-239.27 949.12,-245.62 953.15,-244.41"/>
+</g>
+<!-- STRUCT_S1 -->
+<g id="node23" class="node">
+<title>STRUCT_S1</title>
+<polygon fill="#90ee90" stroke="black" points="1047,-237.47 993,-237.47 993,-196.47 1047,-196.47 1047,-237.47"/>
+<text text-anchor="middle" x="1020" y="-221.12" font-family="DejaVu Sans" font-size="13.00">s1</text>
+<text text-anchor="middle" x="1020" y="-204.62" font-family="DejaVu Sans" font-size="13.00">x: int</text>
+</g>
+<!-- STRUCT_TOP&#45;&gt;STRUCT_S1 -->
+<g id="edge37" class="edge">
+<title>STRUCT_TOP&#45;&gt;STRUCT_S1</title>
+<path fill="none" stroke="#555555" d="M1020,-445.58C1020,-395.91 1020,-293.85 1020,-245.08"/>
+<polygon fill="#555555" stroke="#555555" points="1022.1,-245.25 1020,-239.25 1017.9,-245.25 1022.1,-245.25"/>
+</g>
+<!-- STRUCT_S2 -->
+<g id="node24" class="node">
+<title>STRUCT_S2</title>
+<polygon fill="#90ee90" stroke="black" points="1154.88,-237.47 1063.12,-237.47 1063.12,-196.47 1154.88,-196.47 1154.88,-237.47"/>
+<text text-anchor="middle" x="1109" y="-221.12" font-family="DejaVu Sans" font-size="13.00">s2</text>
+<text text-anchor="middle" x="1109" y="-204.62" font-family="DejaVu Sans" font-size="13.00">x: int, y: int</text>
+</g>
+<!-- STRUCT_TOP&#45;&gt;STRUCT_S2 -->
+<g id="edge38" class="edge">
+<title>STRUCT_TOP&#45;&gt;STRUCT_S2</title>
+<path fill="none" stroke="#555555" d="M1029.69,-446.07C1046.92,-396.53 1082.65,-293.77 1099.64,-244.91"/>
+<polygon fill="#555555" stroke="#555555" points="1101.62,-245.61 1101.6,-239.25 1097.65,-244.23 1101.62,-245.61"/>
+</g>
+<!-- STRUCT_MORE -->
+<g id="node25" class="node">
+<title>STRUCT_MORE</title>
+<polygon fill="#90ee90" stroke="black" points="1225,-234.97 1171,-234.97 1171,-198.97 1225,-198.97 1225,-234.97"/>
+<text text-anchor="middle" x="1198" y="-212.87" font-family="DejaVu Sans" font-size="13.00">…</text>
+</g>
+<!-- STRUCT_TOP&#45;&gt;STRUCT_MORE -->
+<g id="edge39" class="edge">
+<title>STRUCT_TOP&#45;&gt;STRUCT_MORE</title>
+<path fill="none" stroke="#555555" d="M1038.71,-447.05C1073.74,-396.68 1148.63,-288.97 1181.71,-241.39"/>
+<polygon fill="#555555" stroke="#555555" points="1183.35,-242.73 1185.05,-236.6 1179.9,-240.33 1183.35,-242.73"/>
+</g>
+<!-- STRUCT_TOP&#45;&gt;MEM_TOP -->
+<!-- STRUCT_BOT -->
+<g id="node21" class="node">
+<title>STRUCT_BOT</title>
+<ellipse fill="#90ee90" stroke="black" cx="1020" cy="-111.99" rx="82.91" ry="28.99"/>
+<text text-anchor="middle" x="1020" y="-116.14" font-family="DejaVu Sans" font-size="13.00">⊥:struct</text>
+<text text-anchor="middle" x="1020" y="-99.64" font-family="DejaVu Sans" font-size="13.00">[struct bottom]</text>
+</g>
+<!-- STRUCT_BOT&#45;&gt;BOT -->
+<g id="edge69" class="edge">
+<title>STRUCT_BOT&#45;&gt;BOT</title>
+<path fill="none" stroke="#555555" d="M982.84,-85.85C959.17,-69.85 929.19,-49.57 908.49,-35.56"/>
+<polygon fill="#555555" stroke="#555555" points="909.78,-33.9 903.63,-32.28 907.42,-37.38 909.78,-33.9"/>
+</g>
+<!-- STRUCT_PERSON&#45;&gt;STRUCT_BOT -->
+<g id="edge40" class="edge">
+<title>STRUCT_PERSON&#45;&gt;STRUCT_BOT</title>
+<path fill="none" stroke="#555555" d="M957.85,-196.12C968.43,-181.96 982.92,-162.59 995.24,-146.11"/>
+<polygon fill="#555555" stroke="#555555" points="996.85,-147.46 998.76,-141.4 993.49,-144.94 996.85,-147.46"/>
+</g>
+<!-- STRUCT_PERSON&#45;&gt;STRUCT_S1 -->
+<!-- STRUCT_S1&#45;&gt;STRUCT_BOT -->
+<g id="edge41" class="edge">
+<title>STRUCT_S1&#45;&gt;STRUCT_BOT</title>
+<path fill="none" stroke="#555555" d="M1020,-196.12C1020,-182.64 1020,-164.43 1020,-148.49"/>
+<polygon fill="#555555" stroke="#555555" points="1022.1,-148.87 1020,-142.87 1017.9,-148.87 1022.1,-148.87"/>
+</g>
+<!-- STRUCT_S1&#45;&gt;STRUCT_S2 -->
+<!-- STRUCT_S2&#45;&gt;STRUCT_BOT -->
+<g id="edge42" class="edge">
+<title>STRUCT_S2&#45;&gt;STRUCT_BOT</title>
+<path fill="none" stroke="#555555" d="M1091.84,-196.12C1079.5,-181.83 1062.57,-162.25 1048.25,-145.68"/>
+<polygon fill="#555555" stroke="#555555" points="1050,-144.5 1044.49,-141.33 1046.82,-147.24 1050,-144.5"/>
+</g>
+<!-- STRUCT_S2&#45;&gt;STRUCT_MORE -->
+<!-- STRUCT_MORE&#45;&gt;STRUCT_BOT -->
+<g id="edge43" class="edge">
+<title>STRUCT_MORE&#45;&gt;STRUCT_BOT</title>
+<path fill="none" stroke="#555555" d="M1177.76,-198.72C1173.05,-195 1167.95,-191.22 1163,-187.98 1135.19,-169.81 1102.49,-152.39 1075.38,-138.93"/>
+<polygon fill="#555555" stroke="#555555" points="1076.64,-137.21 1070.33,-136.44 1074.78,-140.97 1076.64,-137.21"/>
+</g>
+<!-- MEM_ALIAS2 -->
+<g id="node28" class="node">
+<title>MEM_ALIAS2</title>
+<ellipse fill="#00008b" stroke="black" cx="1294" cy="-216.97" rx="45.21" ry="18"/>
+<text text-anchor="middle" x="1294" y="-212.87" font-family="DejaVu Sans" font-size="13.00" fill="white">MEM#2</text>
+</g>
+<!-- MEM_TOP&#45;&gt;MEM_ALIAS2 -->
+<g id="edge46" class="edge">
+<title>MEM_TOP&#45;&gt;MEM_ALIAS2</title>
+<path fill="none" stroke="#555555" d="M1343.44,-456.76C1334.24,-412.32 1309.64,-293.5 1299.01,-242.16"/>
+<polygon fill="#555555" stroke="#555555" points="1301.12,-242.02 1297.85,-236.57 1297.01,-242.88 1301.12,-242.02"/>
+</g>
+<!-- MEM_ALIAS3 -->
+<g id="node29" class="node">
+<title>MEM_ALIAS3</title>
+<ellipse fill="#00008b" stroke="black" cx="1400" cy="-216.97" rx="45.21" ry="18"/>
+<text text-anchor="middle" x="1400" y="-212.87" font-family="DejaVu Sans" font-size="13.00" fill="white">MEM#3</text>
+</g>
+<!-- MEM_TOP&#45;&gt;MEM_ALIAS3 -->
+<g id="edge47" class="edge">
+<title>MEM_TOP&#45;&gt;MEM_ALIAS3</title>
+<path fill="none" stroke="#555555" d="M1350.56,-456.76C1359.76,-412.32 1384.36,-293.5 1394.99,-242.16"/>
+<polygon fill="#555555" stroke="#555555" points="1396.99,-242.88 1396.15,-236.57 1392.88,-242.02 1396.99,-242.88"/>
+</g>
+<!-- MEM_MORE -->
+<g id="node30" class="node">
+<title>MEM_MORE</title>
+<ellipse fill="#00008b" stroke="black" cx="1488" cy="-216.97" rx="27" ry="18"/>
+<text text-anchor="middle" x="1488" y="-212.87" font-family="DejaVu Sans" font-size="13.00" fill="white">…</text>
+</g>
+<!-- MEM_TOP&#45;&gt;MEM_MORE -->
+<g id="edge48" class="edge">
+<title>MEM_TOP&#45;&gt;MEM_MORE</title>
+<path fill="none" stroke="#555555" d="M1356.25,-457.16C1380.82,-412.56 1447.72,-291.1 1475.57,-240.54"/>
+<polygon fill="#555555" stroke="#555555" points="1477.29,-241.76 1478.35,-235.49 1473.62,-239.74 1477.29,-241.76"/>
+</g>
+<!-- MEM_TOP&#45;&gt;TUPLE_TOP -->
+<!-- MEM_BOT -->
+<g id="node27" class="node">
+<title>MEM_BOT</title>
+<ellipse fill="#00008b" stroke="black" cx="1347" cy="-111.99" rx="44.7" ry="18"/>
+<text text-anchor="middle" x="1347" y="-107.89" font-family="DejaVu Sans" font-size="13.00" fill="white">⊥:mem</text>
+</g>
+<!-- MEM_BOT&#45;&gt;BOT -->
+<g id="edge70" class="edge">
+<title>MEM_BOT&#45;&gt;BOT</title>
+<path fill="none" stroke="#555555" d="M1315.14,-99.08C1293.38,-91.31 1263.76,-81.46 1237,-75 1121.65,-47.17 981.66,-29.67 918.21,-22.6"/>
+<polygon fill="#555555" stroke="#555555" points="918.55,-20.52 912.36,-21.95 918.09,-24.7 918.55,-20.52"/>
+</g>
+<!-- MEM_ALIAS2&#45;&gt;MEM_BOT -->
+<g id="edge49" class="edge">
+<title>MEM_ALIAS2&#45;&gt;MEM_BOT</title>
+<path fill="none" stroke="#555555" d="M1302.75,-198.97C1311.5,-181.97 1325.02,-155.71 1334.81,-136.68"/>
+<polygon fill="#555555" stroke="#555555" points="1336.66,-137.66 1337.54,-131.37 1332.93,-135.74 1336.66,-137.66"/>
+</g>
+<!-- MEM_ALIAS2&#45;&gt;MEM_ALIAS3 -->
+<!-- MEM_ALIAS3&#45;&gt;MEM_BOT -->
+<g id="edge50" class="edge">
+<title>MEM_ALIAS3&#45;&gt;MEM_BOT</title>
+<path fill="none" stroke="#555555" d="M1391.25,-198.97C1382.5,-181.97 1368.98,-155.71 1359.19,-136.68"/>
+<polygon fill="#555555" stroke="#555555" points="1361.07,-135.74 1356.46,-131.37 1357.34,-137.66 1361.07,-135.74"/>
+</g>
+<!-- MEM_ALIAS3&#45;&gt;MEM_MORE -->
+<!-- MEM_MORE&#45;&gt;MEM_BOT -->
+<g id="edge51" class="edge">
+<title>MEM_MORE&#45;&gt;MEM_BOT</title>
+<path fill="none" stroke="#555555" d="M1471.42,-202.39C1465.65,-197.74 1459.09,-192.57 1453,-187.98 1426.93,-168.37 1396.47,-146.96 1374.9,-132.06"/>
+<polygon fill="#555555" stroke="#555555" points="1376.17,-130.38 1370.03,-128.71 1373.78,-133.84 1376.17,-130.38"/>
+</g>
+<!-- TUPLE1 -->
+<g id="node33" class="node">
+<title>TUPLE1</title>
+<polygon fill="#ffc0cb" stroke="none" points="1582.88,-372.47 1539.12,-372.47 1539.12,-319.47 1582.88,-319.47 1582.88,-372.47"/>
+<polygon fill="#ffc0cb" stroke="none" points="1539.12,-345.97 1539.12,-372.47 1582.88,-372.47 1582.88,-345.97 1539.12,-345.97"/>
+<polygon fill="none" stroke="black" points="1539.12,-345.97 1539.12,-372.47 1582.88,-372.47 1582.88,-345.97 1539.12,-345.97"/>
+<text text-anchor="start" x="1544.12" y="-355.12" font-family="DejaVu Sans" font-size="13.00">tuple</text>
+<polygon fill="black" stroke="none" points="1539.12,-319.47 1539.12,-345.97 1582.88,-345.97 1582.88,-319.47 1539.12,-319.47"/>
+<polygon fill="none" stroke="black" points="1539.12,-319.47 1539.12,-345.97 1582.88,-345.97 1582.88,-319.47 1539.12,-319.47"/>
+<text text-anchor="start" x="1546.38" y="-328.62" font-family="DejaVu Sans" font-size="13.00" fill="white">type</text>
+</g>
+<!-- TUPLE_TOP&#45;&gt;TUPLE1 -->
+<g id="edge54" class="edge">
+<title>TUPLE_TOP&#45;&gt;TUPLE1</title>
+<path fill="none" stroke="#555555" d="M1580.85,-456.57C1577.26,-436.74 1571.31,-403.91 1566.86,-379.34"/>
+<polygon fill="#555555" stroke="#555555" points="1568.94,-379.03 1565.81,-373.5 1564.81,-379.77 1568.94,-379.03"/>
+</g>
+<!-- TUPLE2 -->
+<g id="node34" class="node">
+<title>TUPLE2</title>
+<polygon fill="#ffc0cb" stroke="none" points="1642.88,-385.72 1599.12,-385.72 1599.12,-306.22 1642.88,-306.22 1642.88,-385.72"/>
+<polygon fill="#ffc0cb" stroke="none" points="1599.12,-359.22 1599.12,-385.72 1642.88,-385.72 1642.88,-359.22 1599.12,-359.22"/>
+<polygon fill="none" stroke="black" points="1599.12,-359.22 1599.12,-385.72 1642.88,-385.72 1642.88,-359.22 1599.12,-359.22"/>
+<text text-anchor="start" x="1604.12" y="-368.37" font-family="DejaVu Sans" font-size="13.00">tuple</text>
+<polygon fill="black" stroke="none" points="1599.12,-332.72 1599.12,-359.22 1642.88,-359.22 1642.88,-332.72 1599.12,-332.72"/>
+<polygon fill="none" stroke="black" points="1599.12,-332.72 1599.12,-359.22 1642.88,-359.22 1642.88,-332.72 1599.12,-332.72"/>
+<text text-anchor="start" x="1606.38" y="-341.87" font-family="DejaVu Sans" font-size="13.00" fill="white">type</text>
+<polygon fill="black" stroke="none" points="1599.12,-306.22 1599.12,-332.72 1642.88,-332.72 1642.88,-306.22 1599.12,-306.22"/>
+<polygon fill="none" stroke="black" points="1599.12,-306.22 1599.12,-332.72 1642.88,-332.72 1642.88,-306.22 1599.12,-306.22"/>
+<text text-anchor="start" x="1606.38" y="-315.37" font-family="DejaVu Sans" font-size="13.00" fill="white">type</text>
+</g>
+<!-- TUPLE_TOP&#45;&gt;TUPLE2 -->
+<g id="edge55" class="edge">
+<title>TUPLE_TOP&#45;&gt;TUPLE2</title>
+<path fill="none" stroke="#555555" d="M1588.99,-456.83C1593.76,-440.46 1601.17,-415.04 1607.65,-392.78"/>
+<polygon fill="#555555" stroke="#555555" points="1609.64,-393.48 1609.3,-387.13 1605.6,-392.3 1609.64,-393.48"/>
+</g>
+<!-- TUPLEN -->
+<g id="node35" class="node">
+<title>TUPLEN</title>
+<polygon fill="#ffc0cb" stroke="none" points="1702.88,-398.97 1659.12,-398.97 1659.12,-292.97 1702.88,-292.97 1702.88,-398.97"/>
+<polygon fill="#ffc0cb" stroke="none" points="1659.12,-372.47 1659.12,-398.97 1702.88,-398.97 1702.88,-372.47 1659.12,-372.47"/>
+<polygon fill="none" stroke="black" points="1659.12,-372.47 1659.12,-398.97 1702.88,-398.97 1702.88,-372.47 1659.12,-372.47"/>
+<text text-anchor="start" x="1664.12" y="-381.62" font-family="DejaVu Sans" font-size="13.00">tuple</text>
+<polygon fill="black" stroke="none" points="1659.12,-345.97 1659.12,-372.47 1702.88,-372.47 1702.88,-345.97 1659.12,-345.97"/>
+<polygon fill="none" stroke="black" points="1659.12,-345.97 1659.12,-372.47 1702.88,-372.47 1702.88,-345.97 1659.12,-345.97"/>
+<text text-anchor="start" x="1666.38" y="-355.12" font-family="DejaVu Sans" font-size="13.00" fill="white">type</text>
+<polygon fill="black" stroke="none" points="1659.12,-319.47 1659.12,-345.97 1702.88,-345.97 1702.88,-319.47 1659.12,-319.47"/>
+<polygon fill="none" stroke="black" points="1659.12,-319.47 1659.12,-345.97 1702.88,-345.97 1702.88,-319.47 1659.12,-319.47"/>
+<text text-anchor="start" x="1674.62" y="-328.62" font-family="DejaVu Sans" font-size="13.00" fill="white">…</text>
+<polygon fill="black" stroke="none" points="1659.12,-292.97 1659.12,-319.47 1702.88,-319.47 1702.88,-292.97 1659.12,-292.97"/>
+<polygon fill="none" stroke="black" points="1659.12,-292.97 1659.12,-319.47 1702.88,-319.47 1702.88,-292.97 1659.12,-292.97"/>
+<text text-anchor="start" x="1666.38" y="-302.12" font-family="DejaVu Sans" font-size="13.00" fill="white">type</text>
+</g>
+<!-- TUPLE_TOP&#45;&gt;TUPLEN -->
+<g id="edge56" class="edge">
+<title>TUPLE_TOP&#45;&gt;TUPLEN</title>
+<path fill="none" stroke="#555555" d="M1600.21,-457.82C1614.47,-443.17 1635.34,-420.61 1651,-398.97 1652.4,-397.02 1653.8,-395.01 1655.17,-392.95"/>
+<polygon fill="#555555" stroke="#555555" points="1656.91,-394.14 1658.41,-387.96 1653.38,-391.86 1656.91,-394.14"/>
+</g>
+<!-- TUPLE_BOT -->
+<g id="node32" class="node">
+<title>TUPLE_BOT</title>
+<ellipse fill="#ffc0cb" stroke="black" cx="1602" cy="-111.99" rx="44.7" ry="18"/>
+<text text-anchor="middle" x="1602" y="-107.89" font-family="DejaVu Sans" font-size="13.00">⊥:tuple</text>
+</g>
+<!-- TUPLE_BOT&#45;&gt;BOT -->
+<g id="edge71" class="edge">
+<title>TUPLE_BOT&#45;&gt;BOT</title>
+<path fill="none" stroke="#555555" d="M1577.54,-96.47C1563.29,-88.74 1544.69,-79.84 1527,-75 1410.53,-43.12 1034.45,-25.23 918.41,-20.37"/>
+<polygon fill="#555555" stroke="#555555" points="918.75,-18.28 912.67,-20.13 918.57,-22.48 918.75,-18.28"/>
+</g>
+<!-- TUPLE1&#45;&gt;TUPLE_BOT -->
+<g id="edge57" class="edge">
+<title>TUPLE1&#45;&gt;TUPLE_BOT</title>
+<path fill="none" stroke="#555555" d="M1565.47,-319.7C1573.39,-274.85 1589.82,-181.9 1597.66,-137.56"/>
+<polygon fill="#555555" stroke="#555555" points="1599.69,-138.14 1598.66,-131.86 1595.55,-137.4 1599.69,-138.14"/>
+</g>
+<!-- TUPLE1&#45;&gt;TUPLE2 -->
+<!-- TUPLE2&#45;&gt;TUPLE_BOT -->
+<g id="edge58" class="edge">
+<title>TUPLE2&#45;&gt;TUPLE_BOT</title>
+<path fill="none" stroke="#555555" d="M1617.84,-306.4C1613.91,-258.37 1607.3,-177.75 1604,-137.46"/>
+<polygon fill="#555555" stroke="#555555" points="1606.13,-137.74 1603.55,-131.93 1601.95,-138.08 1606.13,-137.74"/>
+</g>
+<!-- TUPLE2&#45;&gt;TUPLEN -->
+<!-- TUPLEN&#45;&gt;TUPLE_BOT -->
+<g id="edge59" class="edge">
+<title>TUPLEN&#45;&gt;TUPLE_BOT</title>
+<path fill="none" stroke="#555555" d="M1663.37,-293.19C1646.79,-244.5 1622.69,-173.75 1610.2,-137.07"/>
+<polygon fill="#555555" stroke="#555555" points="1612.27,-136.64 1608.35,-131.63 1608.3,-137.99 1612.27,-136.64"/>
+</g>
+</g>
+</svg>
diff --git a/chapter11/src/main/java/com/seaofnodes/simple/GlobalCodeMotion.java b/chapter11/src/main/java/com/seaofnodes/simple/GlobalCodeMotion.java
deleted file mode 100644
index 35b34576..00000000
--- a/chapter11/src/main/java/com/seaofnodes/simple/GlobalCodeMotion.java
+++ /dev/null
@@ -1,272 +0,0 @@
- package com.seaofnodes.simple;
-
-import com.seaofnodes.simple.IterPeeps.WorkList;
-import com.seaofnodes.simple.node.*;
-import com.seaofnodes.simple.type.*;
-import java.util.*;
-
-public abstract class GlobalCodeMotion {
-
- // Arrange that the existing isCFG() Nodes form a valid CFG. The
- // Node.use(0) is always a block tail (either IfNode or head of the
- // following block). There are no unreachable infinite loops.
- public static void buildCFG( StopNode stop ) {
- fixLoops(stop);
- schedEarly();
- Parser.SCHEDULED = true;
- schedLate(stop);
- }
-
- // ------------------------------------------------------------------------
- // Backwards walk on the CFG only, looking for unreachable code - which has
- // to be an infinite loop. Insert a bogus never-taken exit to Stop, so the
- // loop becomes reachable. Also, set loop nesting depth
- private static void fixLoops(StopNode stop) {
- // Backwards walk from Stop, looking for unreachable code
- BitSet visit = new BitSet();
- HashSet<CFGNode> unreach = new HashSet<>();
- unreach.add(Parser.START);
- for( Node ret : stop._inputs )
- ((ReturnNode)ret).walkUnreach(visit,unreach);
- if( unreach.isEmpty() ) return;
-
- // Forwards walk from unreachable, looking for loops with no exit test.
- visit.clear();
- for( CFGNode cfg : unreach )
- walkInfinite(cfg,visit,stop);
- // Set loop depth on remaining graph
- unreach.clear();
- visit.clear();
- for( Node ret : stop._inputs )
- ((ReturnNode)ret).walkUnreach(visit,unreach);
- assert unreach.isEmpty();
- }
-
-
- // Forwards walk over previously unreachable, looking for loops with no
- // exit test.
- static private void walkInfinite( CFGNode n, BitSet visit, StopNode stop ) {
- if( visit.get(n._nid) ) return; // Been there, done that
- visit.set(n._nid);
- if( n instanceof LoopNode loop )
- loop.forceExit(stop);
- for( Node use : n._outputs )
- if( use instanceof CFGNode cfg )
- walkInfinite(cfg,visit,stop);
- }
-
- // ------------------------------------------------------------------------
- private static void schedEarly() {
- ArrayList<CFGNode> rpo = new ArrayList<>();
- BitSet visit = new BitSet();
- _rpo_cfg(Parser.START, visit, rpo);
- // Reverse Post-Order on CFG
- for( int j=rpo.size()-1; j>=0; j-- ) {
- CFGNode cfg = rpo.get(j);
- cfg.loopDepth();
- for( Node n : cfg._inputs )
- _schedEarly(n,visit);
- // In dead infinite loops, entire code blocks may be unreachable
- // from below. Reach down from the CFG to their Phis so their
- // inputs are scheduled too.
- if( cfg instanceof RegionNode ) {
- int len = cfg.nOuts();
- for( int i=0; i<len; i++ )
- if( cfg.out(i) instanceof PhiNode phi )
- _schedEarly(phi,visit);
- }
- }
- }
-
- // Post-Order of CFG
- private static void _rpo_cfg(Node n, BitSet visit, ArrayList<CFGNode> rpo) {
- if( !(n instanceof CFGNode cfg) || visit.get(cfg._nid) )
- return; // Been there, done that
- visit.set(cfg._nid);
- for( Node use : cfg._outputs )
- _rpo_cfg(use,visit,rpo);
- rpo.add(cfg);
- }
-
- private static void _schedEarly(Node n, BitSet visit) {
- if( n==null || visit.get(n._nid) ) return; // Been there, done that
- visit.set(n._nid);
- // Schedule inputs first, except Phis: following their backedges would
- // enter a data cycle before its control has been scheduled.
- for( Node def : n._inputs )
- if( def!=null && !(def instanceof PhiNode) )
- _schedEarly(def,visit);
- // An existing edge 0 already supplies control (or a Phi/Proj binding).
- if( n.in(0)==null ) {
- // Schedule at deepest input
- CFGNode early = Parser.START; // Maximally early, lowest idepth
- for( int i=1; i<n.nIns(); i++ )
- if( n.in(i)!=null && n.in(i).cfg0().idepth() > early.idepth() )
- early = n.in(i).cfg0(); // Latest/deepest input
- n.setDef(0,early); // First place this can go
- }
- }
-
- // ------------------------------------------------------------------------
- private static void schedLate( StopNode stop) {
- CFGNode[] late = new CFGNode[Node.UID()];
- Node[] ns = new Node[Node.UID()];
- // Record Load NIDs at all their CFG block choices, then check against
- // Store block choices to force a Load above an anti-dependent Store.
- int[] anti = new int[Node.UID()];
- // Breadth-first scheduling
- breadth(stop,ns,late,anti);
-
- // Copy the best placement choice into the control slot
- for( int i=0; i<late.length; i++ )
- if( ns[i] != null && !(ns[i] instanceof ProjNode) )
- ns[i].setDef(0,late[i]);
- }
-
- private static void breadth(Node stop, Node[] ns, CFGNode[] late, int[] anti) {
- // Things on the worklist have some (but perhaps not all) uses done.
- WorkList<Node> work = new WorkList<>();
- work.push(stop);
- Node n;
- outer:
- while( (n = work.pop()) != null ) {
- assert late[n._nid]==null; // No double visit
- // These I know the late schedule of, and need to set early for loops
- if( n instanceof CFGNode cfg ) late[n._nid] = cfg.blockHead() ? cfg : cfg.cfg(0);
- else if( n instanceof PhiNode phi ) late[n._nid] = phi.region();
- // These nodes have a fixed late placement at their original control.
- else if( n instanceof ProjNode || n instanceof NewNode || n==Parser.ZERO ) late[n._nid] = n.cfg0();
- else {
-
- // All uses done?
- for( Node use : n._outputs )
- if( use!=null && late[use._nid]==null )
- continue outer; // Nope, await all uses done
-
- // Loads need their memory inputs' uses also done
- if( n instanceof LoadNode ld )
- for( Node memuse : ld.mem()._outputs )
- if( antiUse(ld,memuse) && late[memuse._nid]==null )
- continue outer;
-
- // All uses done, schedule
- _doSchedLate(n,ns,late,anti);
- }
-
- // A use just finished; reconsider its inputs and waiting loads,
- // even when the shared memory input was already scheduled.
- for( Node def : n._inputs ) {
- if( def==null ) continue;
- if( late[def._nid]==null ) work.push(def);
- for( Node out : def._outputs )
- if( out instanceof LoadNode ld && late[ld._nid]==null )
- work.push(ld);
- }
- if( n instanceof LoopNode loop )
- for( Node phi : loop._outputs )
- if( phi instanceof PhiNode && late[phi._nid]==null )
- work.push(phi);
- }
- }
-
- private static void _doSchedLate(Node n, Node[] ns, CFGNode[] late, int[] anti) {
- // Walk uses, gathering the LCA (Least Common Ancestor) of uses
- CFGNode early = n.in(0) instanceof CFGNode cfg ? cfg : n.in(0).cfg0();
- assert early != null;
- CFGNode lca = null;
- for( Node use : n._outputs )
- if( use != null )
- lca = use_block(n,use, late).domLCA(lca);
-
- // Loads may need anti-dependencies, raising their LCA
- if( n instanceof LoadNode load )
- lca = find_anti_dep(lca,load,early,late,anti);
-
- // Walk up from the LCA to the early, looking for best place. This is
- // the lowest execution frequency, approximated by least loop depth and
- // deepest control flow.
- CFGNode best = lca;
- lca = lca.idom(); // Already found best for starting LCA
- for( ; lca != early.idom(); lca = lca.idom() )
- if( better(lca,best) )
- best = lca;
- assert !(best instanceof IfNode);
- ns [n._nid] = n;
- late[n._nid] = best;
- }
-
- // Block of use. Normally from late[] schedule, except for Phis, which go
- // to the matching Region input.
- private static CFGNode use_block(Node n, Node use, CFGNode[] late) {
- if( !(use instanceof PhiNode phi) )
- return late[use._nid];
- CFGNode found=null;
- for( int i=1; i<phi.nIns(); i++ )
- if( phi.in(i)==n )
- found = phi.region().cfg(i).domLCA(found); // Can be more than one matching input.
- assert found!=null;
- return found;
- }
-
-
- // Least loop depth first, then largest idepth
- private static boolean better( CFGNode lca, CFGNode best ) {
- return lca.loopDepth() < best.loopDepth() ||
- lca instanceof NeverNode ||
- lca.idepth() > best.idepth() ||
- best instanceof IfNode;
- }
-
- // Only a store or memory Phi covering this alias can constrain a load.
- // MemMerge packages slices without overwriting them.
- private static boolean antiUse(LoadNode load, Node use) {
- return switch( use ) {
- case StoreNode st -> st._alias==load._alias;
- case MemPhiNode phi -> phi._alias==load._alias;
- case BulkMemPhiNode phi -> !phi.isSplit(load._alias);
- default -> false;
- };
- }
-
- private static CFGNode find_anti_dep(CFGNode lca, LoadNode load, CFGNode early, CFGNode[] late, int[] anti) {
- // We could skip final-field loads here.
- // Walk LCA->early, flagging Load's block location choices
- for( CFGNode cfg=lca; early!=null && cfg!=early.idom(); cfg = cfg.idom() )
- anti[cfg._nid] = load._nid;
- // Walk load->mem uses, looking for Stores causing an anti-dep
- for( Node mem : load.mem()._outputs ) {
- if( !antiUse(load,mem) ) continue;
- switch( mem ) {
- case StoreNode st:
- lca = anti_dep(load,late[st._nid],st.cfg0(),lca,st,anti);
- break;
- case PhiNode phi:
- // Repeat anti-dep for matching Phi inputs.
- // No anti-dep edges but may raise the LCA.
- for( int i=1; i<phi.nIns(); i++ )
- if( phi.in(i)==load.mem() )
- lca = anti_dep(load,phi.region().cfg(i),load.mem().cfg0(),lca,null,anti);
- break;
- default: throw Utils.TODO();
- }
- }
- return lca;
- }
-
- //
- private static CFGNode anti_dep( LoadNode load, CFGNode stblk, CFGNode defblk, CFGNode lca, Node st, int[] anti ) {
- // Preserve the full store range for the earlier evaluator scheduler.
- // It places nodes independently of GCM and may hoist this store.
- for( ; stblk != defblk.idom(); stblk = stblk.idom() ) {
- // Store and Load overlap, need anti-dependence
- if( anti[stblk._nid]==load._nid ) {
- lca = stblk.domLCA(lca); // Raise Loads LCA
- if( lca == stblk && st != null && Utils.find(st._inputs,load) == -1 ) // And if something moved,
- st.addDef(load); // Add anti-dep as well
- return lca; // Cap this stores' anti-dep to here
- }
- }
- return lca;
- }
-
-}
diff --git a/chapter11/src/main/java/com/seaofnodes/simple/IRPrinter.java b/chapter11/src/main/java/com/seaofnodes/simple/IRPrinter.java
index 7e93e9da..d5ab15fe 100644
--- a/chapter11/src/main/java/com/seaofnodes/simple/IRPrinter.java
+++ b/chapter11/src/main/java/com/seaofnodes/simple/IRPrinter.java
@@ -8,6 +8,7 @@ public final class IRPrinter extends IRAdapter<Node> {
private static final com.seaofnodes.print.IRPrinter<Node> PRINT =
new com.seaofnodes.print.IRPrinter<>(new IRPrinter());
@Override public String type(Node n) { return n._type==null ? "" : n._type.str(); }
+ @Override public int inputColumns() { return 3; }
@Override public String inputMark(Node n, Node def) { return n instanceof MemMergeNode && def instanceof MemMergeNode ? "^" : " "; }
@Override public Kind kind(Node n) {
if( n instanceof StartNode ) return Kind.START;
@@ -17,15 +18,13 @@ public final class IRPrinter extends IRAdapter<Node> {
if( n instanceof PhiNode ) return Kind.PHI;
if( n instanceof ReturnNode ) return Kind.RETURN;
if( n instanceof ConstantNode ) return Kind.CONSTANT;
- if( n instanceof CProjNode ) return Kind.CPROJ;
- if( n instanceof ProjNode ) return n instanceof CFGNode ? Kind.CPROJ : Kind.PROJ;
- if( n instanceof CFGNode ) return Kind.CTRL;
+ if( n instanceof ProjNode ) return n.isCFG() ? Kind.CPROJ : Kind.PROJ;
+ if( n.isCFG() ) return Kind.CTRL;
if( n instanceof MultiNode ) return Kind.MULTI;
return Kind.DATA;
}
@Override public int index(Node n) {
if( n instanceof ProjNode p ) return p._idx;
- if( n instanceof CProjNode p ) return p._idx;
return n._nid;
}
diff --git a/chapter11/src/main/java/com/seaofnodes/simple/IterPeeps.java b/chapter11/src/main/java/com/seaofnodes/simple/IterPeeps.java
index 9d2b913f..7075d526 100644
--- a/chapter11/src/main/java/com/seaofnodes/simple/IterPeeps.java
+++ b/chapter11/src/main/java/com/seaofnodes/simple/IterPeeps.java
@@ -98,7 +98,6 @@ public abstract class IterPeeps {
if( obs != null ) obs.after(n, x, true);
}
- GlobalCodeMotion.buildCFG(stop);
return stop;
}
diff --git a/chapter11/src/main/java/com/seaofnodes/simple/Parser.java b/chapter11/src/main/java/com/seaofnodes/simple/Parser.java
index fb4dfdf8..3b5f2721 100644
--- a/chapter11/src/main/java/com/seaofnodes/simple/Parser.java
+++ b/chapter11/src/main/java/com/seaofnodes/simple/Parser.java
@@ -31,18 +31,12 @@ public class Parser {
*/
public static StartNode START;
- public static ConstantNode ZERO;
- public static XCtrlNode XCTRL;
-
public StopNode STOP;
// Field identities are independent of the memory graph and Start's tuple.
private final HashMap<String,Integer> _aliases = new HashMap<>();
private int _alias = 2;
- // Debugger Printing.
- public static boolean SCHEDULED; // True if debug printer can use schedule info
-
// The Lexer. Thin wrapper over a byte[] buffer with a cursor.
private final Lexer _lexer;
@@ -96,14 +90,11 @@ public class Parser {
Node.reset();
IterPeeps.reset();
OBJS.clear();
- SCHEDULED = false;
_lexer = new Lexer(source);
_scope = new ScopeNode();
_continueScope = _breakScope = null;
START = new StartNode(new Type[]{ Type.CONTROL, TypeMem.BOT, arg });
STOP = new StopNode(source);
- ZERO = new ConstantNode(TypeInteger.constant(0)).peephole().keep();
- XCTRL= new XCtrlNode().peephole().keep();
}
public Parser(String source) {
@@ -126,12 +117,10 @@ public class Parser {
_xScopes.push(_scope);
// Enter a new scope for the initial control and arguments
_scope.push();
- _scope.define(ScopeNode.CTRL, Type.CONTROL , new CProjNode(START, 0, ScopeNode.CTRL).peephole());
- _scope.define(ScopeNode.ARG0, TypeInteger.BOT, new ProjNode(START, 2, ScopeNode.ARG0).peephole());
+ _scope.define(ScopeNode.CTRL, Type.CONTROL , new ProjNode(START, 0, ScopeNode.CTRL).peephole());
+ _scope.define(ScopeNode.ARG0, TypeInteger.BOT, new ProjNode(START, 2, ScopeNode.ARG0).peephole());
_scope.define("$mem", TypeMem.BOT, new ProjNode(START, 1, "$mem").peephole());
parseBlock();
- if( ctrl()._type==Type.CONTROL )
- STOP.addReturn(new ReturnNode(ctrl(), new ConstantNode(TypeInteger.constant(0)).peephole(), _scope).peephole());
_scope.pop();
_xScopes.pop();
if (!_lexer.isEOF()) throw error("Syntax error, unexpected " + _lexer.getAnyNextToken());
@@ -215,9 +204,9 @@ public class Parser {
require("}");
// Build and install the TypeStruct
TypeStruct ts = TypeStruct.make(typeName, fields);
- OBJS.put(typeName, ts); // Insert the struct name in the collection of all struct names
_aliases.put(typeName,_alias);
_alias += ts._fields.length;
+ OBJS.put(typeName, ts); // Insert the struct name in the collection of all struct names
return parseStatement();
}
@@ -259,8 +248,8 @@ public class Parser {
// IfNode takes current control and predicate
Node ifNode = new IfNode(ctrl(), pred).peephole();
// Setup projection nodes
- Node ifT = new CProjNode(ifNode. keep(), 0, "True" ).peephole().keep();
- Node ifF = new CProjNode(ifNode.unkeep(), 1, "False").peephole();
+ Node ifT = new ProjNode(ifNode. keep(), 0, "True" ).peephole().keep();
+ Node ifF = new ProjNode(ifNode.unkeep(), 1, "False").peephole();
// Clone the body Scope to create the break/exit Scope which accounts for any
// side effects in the predicate. The break/exit Scope will be the final
@@ -306,7 +295,7 @@ public class Parser {
private ScopeNode jumpTo(ScopeNode toScope) {
ScopeNode cur = _scope.dup();
- ctrl(XCTRL); // Kill current scope
+ ctrl(new ConstantNode(Type.XCONTROL).peephole()); // Kill current scope
// Prune nested lexical scopes that have depth > than the loop head
// We use _breakScope as a proxy for the loop head scope to obtain the depth
while( cur._scopes.size() > _breakScope._scopes.size() )
@@ -342,8 +331,8 @@ public class Parser {
// IfNode takes current control and predicate
Node ifNode = new IfNode(ctrl(), pred).peephole();
// Setup projection nodes
- Node ifT = new CProjNode(ifNode. keep(), 0, "True" ).peephole().keep();
- Node ifF = new CProjNode(ifNode.unkeep(), 1, "False").peephole().keep();
+ Node ifT = new ProjNode(ifNode. keep(), 0, "True" ).peephole().keep();
+ Node ifF = new ProjNode(ifNode.unkeep(), 1, "False").peephole().keep();
// In if true branch, the ifT proj node becomes the ctrl
// But first clone the scope and set it as current
int ndefs = _scope.nIns();
@@ -390,7 +379,7 @@ public class Parser {
private Node parseReturn() {
var expr = require(parseExpression(), ";");
Node ret = STOP.addReturn(new ReturnNode(ctrl(), expr, _scope).peephole());
- ctrl(XCTRL); // Kill control
+ ctrl(new ConstantNode(Type.XCONTROL).peephole()); // Kill control
return ret;
}
@@ -585,7 +574,7 @@ public class Parser {
if( _lexer.isNumber() ) return parseIntegerLiteral();
if( match("(") ) return require(parseExpression(), ")");
if( matchx("true" ) ) return new ConstantNode(TypeInteger.constant(1)).peephole();
- if( matchx("false") ) return ZERO;
+ if( matchx("false") ) return new ConstantNode(TypeInteger.constant(0)).peephole();
if( matchx("null" ) ) return new ConstantNode(TypeMemPtr.NULLPTR).peephole();
if( matchx("new") ) {
String structName = requireId();
@@ -603,11 +592,12 @@ public class Parser {
/**
* Return a NewNode but also generate instructions to initialize it.
*/
- private Node newStruct(TypeStruct obj) {
+ private Node newStruct( TypeStruct obj ) {
Node n = new NewNode(TypeMemPtr.make(obj), ctrl()).peephole().keep();
+ Node initValue = new ConstantNode(TypeInteger.constant(0)).peephole();
int alias = _aliases.get(obj._name);
for( Field field : obj._fields ) {
- store(field._fname,alias,n,ZERO);
+ store(field._fname,alias,n,initValue);
alias++;
}
return n.unkeep();
@@ -619,7 +609,7 @@ public class Parser {
private void store(String name, int alias, Node ptr, Node val) {
Node prior = mem().keep();
- Node st = new StoreNode(name,alias,ctrl(),prior,ptr,val).peephole();
+ Node st = new StoreNode(name,alias,prior,ptr,val).peephole();
mem(new MemMergeNode(prior,alias,st).peephole());
prior.unkeep();
}
@@ -759,16 +749,7 @@ public class Parser {
* Return the next non-white-space character
*/
private void skipWhiteSpace() {
- while( true ) {
- if( isWhiteSpace() ) _position++;
- // Skip // to end of line
- else if( _position+2 < _input.length &&
- _input[_position ] == '/' &&
- _input[_position+1] == '/') {
- _position += 2;
- while( !isEOF() && _input[_position] != '\n' ) _position++;
- } else break;
- }
+ while (isWhiteSpace()) _position++;
}
@@ -850,9 +831,8 @@ public class Parser {
return new String(_input, start, --_position - start);
}
- //
private boolean isPunctuation(char ch) {
- return "=;[]<>()+-/*".indexOf(ch) != -1;
+ return "=;[]<>(){}+-/*!".indexOf(ch) != -1;
}
private String parsePunctuation() {
diff --git a/chapter11/src/main/java/com/seaofnodes/simple/Utils.java b/chapter11/src/main/java/com/seaofnodes/simple/Utils.java
index f3ac25b1..4f2af769 100644
--- a/chapter11/src/main/java/com/seaofnodes/simple/Utils.java
+++ b/chapter11/src/main/java/com/seaofnodes/simple/Utils.java
@@ -55,4 +55,11 @@ public class Utils {
// Fold a 64bit hash into 32 bits
public static int fold( long x ) { return (int)((x>>32) ^ x); }
+
+ public static boolean eq(String s0, String s1) {
+ if( s0==s1 ) return true;
+ assert s0==s0.intern();
+ assert s1==s1.intern();
+ return false;
+ }
}
diff --git a/chapter11/src/main/java/com/seaofnodes/simple/node/CFGNode.java b/chapter11/src/main/java/com/seaofnodes/simple/node/CFGNode.java
deleted file mode 100644
index ea67d17d..00000000
--- a/chapter11/src/main/java/com/seaofnodes/simple/node/CFGNode.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package com.seaofnodes.simple.node;
-
-import com.seaofnodes.simple.Parser;
-import com.seaofnodes.simple.type.*;
-import com.seaofnodes.simple.Utils;
-
-import java.util.BitSet;
-import java.util.HashSet;
-import java.util.HashMap;
-
-/** Control Flow Graph Nodes
- * <p>
- * CFG nodes have a immediate dominator depth (idepth) and a loop nesting
- * depth(loop_depth).
- * <p>
- * idepth is computed lazily upon first request, and is valid even in the
- * Parser, and is used by peepholes during parsing and afterward.
- * <p>
- * loop_depth is computed after optimization as part of scheduling.
- *
- */
-public abstract class CFGNode extends Node {
-
- public CFGNode(Node... nodes) { super(nodes); }
-
- @Override public boolean isCFG() { return true; }
-
- public CFGNode cfg(int idx) { return (CFGNode)in(idx); }
-
- // Block head is Start, Region, CProj, but not e.g. If, Return, Stop
- public boolean blockHead() { return false; }
-
- // Should be exactly 1 tail from a block head
- public CFGNode blockTail() {
- assert blockHead();
- for( Node n : _outputs )
- if( n instanceof CFGNode cfg )
- return cfg;
- return null;
- }
-
- // ------------------------------------------------------------------------
- /**
- * Immediate dominator tree depth, used to approximate a real IDOM during
- * parsing where we do not have the whole program, and also peepholes
- * change the CFG incrementally.
- * <p>
- * See {@link <a href="https://en.wikipedia.org/wiki/Dominator_(graph_theory)">...</a>}
- */
- public char _idepth;
- public int idepth() { return _idepth!=0 ? _idepth : cacheIDepth(idom().idepth()+1); }
- // Zero depth means uncached. Check before narrowing so overflow cannot wrap.
- final int cacheIDepth(int depth) {
- assert 0 <= depth && depth <= Character.MAX_VALUE : "Dominator depth exceeds 65535";
- return _idepth = (char)depth;
- }
-
-
- // Return the immediate dominator of this Node and compute dom tree depth.
- public CFGNode idom() { return cfg(0); }
-
- // Return the LCA of two idoms
- public CFGNode domLCA(CFGNode rhs) {
- if( rhs==null ) return this;
- CFGNode lhs = this;
- while( lhs != rhs ) {
- if( lhs==null || rhs==null ) return null;
- int comp = lhs.idepth() - rhs.idepth();
- if( comp >= 0 ) lhs = lhs.idom();
- if( comp <= 0 ) rhs = rhs.idom();
- }
- return lhs;
- }
-
- // Loop nesting depth
- public int _loopDepth;
- public int loopDepth() { return _loopDepth==0 ? (_loopDepth = cfg(0).loopDepth()) : _loopDepth; }
-
- // ------------------------------------------------------------------------
- // Support routines for Global Code Motion
-
- // Tik-tok recursion pattern. This method is final, and every caller does
- // this work.
- public final void walkUnreach( BitSet visit, HashSet<CFGNode> unreach ) {
- if( visit.get(_nid) ) return;
- visit.set(_nid);
- _walkUnreach(visit,unreach);
- unreach.remove(this); // Since we reached here... Node was not unreachable
- }
-
- // Tik-tok recursion pattern; not-final; callers override this.
- void _walkUnreach( BitSet visit, HashSet<CFGNode> unreach ) {
- cfg(0).walkUnreach(visit,unreach);
- }
-}
diff --git a/chapter11/src/main/java/com/seaofnodes/simple/node/CProjNode.java b/chapter11/src/main/java/com/seaofnodes/simple/node/CProjNode.java
deleted file mode 100644
index ff5d1a76..00000000
--- a/chapter11/src/main/java/com/seaofnodes/simple/node/CProjNode.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package com.seaofnodes.simple.node;
-
-import com.seaofnodes.print.ExprPrinter;
-
-import com.seaofnodes.simple.Parser;
-import com.seaofnodes.simple.type.Type;
-import com.seaofnodes.simple.type.TypeMem;
-import com.seaofnodes.simple.type.TypeTuple;
-
-public class CProjNode extends CFGNode {
-
- // Which slice of the incoming multipart value
- public final int _idx;
-
- // Debugging label
- public final String _label;
-
- public CProjNode(Node ctrl, int idx, String label) {
- super(ctrl);
- _idx = idx;
- _label = label;
- }
-
- @Override public String label() { return _label; }
-
- @Override protected ExprPrinter<Node> _print1(ExprPrinter<Node> p) { return p.p(_label); }
-
- @Override public boolean isMultiTail() { return in(0).isMultiHead(); }
- @Override public boolean blockHead() { return true; }
-
- public CFGNode ctrl() { return cfg(0); }
-
- @Override
- public Type compute() {
- Type t = ctrl()._type;
- return t instanceof TypeTuple tt ? tt._types[_idx] : Type.BOTTOM;
- }
-
- @Override
- public Node idealize() {
- if ( ctrl() instanceof IfNode iff ) {
- if ( iff._type instanceof TypeTuple tt && tt._types[1 - _idx] == Type.XCONTROL )
- return iff.in(0); // We become our input control
-
- // Flip a negating if-test, to remove the not
- if( iff.pred().addDep(this) instanceof NotNode not )
- return new CProjNode(new IfNode(iff.ctrl(),not.in(1)).peephole(),1-_idx,_idx==0 ? "False" : "True");
- }
- return null;
- }
-
- @Override
- public Node getBlockStart() {
- return ctrl() instanceof IfNode ? this : ctrl().getBlockStart();
- }
- @Override
- boolean eq( Node n ) { return _idx == ((CProjNode)n)._idx; }
-
- @Override
- int hash() { return _idx; }
-
-}
diff --git a/chapter11/src/main/java/com/seaofnodes/simple/node/ConstantNode.java b/chapter11/src/main/java/com/seaofnodes/simple/node/ConstantNode.java
index 9ecd1152..426736ed 100644
--- a/chapter11/src/main/java/com/seaofnodes/simple/node/ConstantNode.java
+++ b/chapter11/src/main/java/com/seaofnodes/simple/node/ConstantNode.java
@@ -38,7 +38,6 @@ public class ConstantNode extends Node {
}
@Override public boolean isMultiTail() { return true; }
- // The special forever-zero is pinned, all others can sink
@Override
public Type compute() { return _con; }
diff --git a/chapter11/src/main/java/com/seaofnodes/simple/node/IfNode.java b/chapter11/src/main/java/com/seaofnodes/simple/node/IfNode.java
index 70340f7f..45f695a5 100644
--- a/chapter11/src/main/java/com/seaofnodes/simple/node/IfNode.java
+++ b/chapter11/src/main/java/com/seaofnodes/simple/node/IfNode.java
@@ -5,10 +5,8 @@ import com.seaofnodes.simple.IterPeeps;
import com.seaofnodes.simple.type.Type;
import com.seaofnodes.simple.type.TypeInteger;
import com.seaofnodes.simple.type.TypeTuple;
-import java.util.BitSet;
-import java.util.HashSet;
-public class IfNode extends CFGNode implements MultiNode {
+public class IfNode extends MultiNode {
public IfNode(Node ctrl, Node pred) {
super(ctrl, pred);
@@ -20,6 +18,7 @@ public class IfNode extends CFGNode implements MultiNode {
@Override protected String format() { return "if( %1 )"; }
+ @Override public boolean isCFG() { return true; }
@Override public boolean isMultiHead() { return true; }
public Node ctrl() { return in(0); }
@@ -49,20 +48,11 @@ public class IfNode extends CFGNode implements MultiNode {
// Hunt up the immediate dominator tree. If we find an identical if
// test on either the true or false branch, that side wins.
if( !pred()._type.isHighOrConst() )
- for( CFGNode dom = idom(), prior=this; dom!=null; prior = dom, dom = dom.idom() )
- if( dom.addDep(this) instanceof IfNode iff && iff.pred().addDep(this)==pred() && prior instanceof CProjNode prj ) {
+ for( Node dom = idom(), prior=this; dom!=null; prior = dom, dom = dom.idom() )
+ if( dom.addDep(this) instanceof IfNode iff && iff.pred().addDep(this)==pred() && prior instanceof ProjNode prj ) {
setDef(1,new ConstantNode(TypeInteger.make(true,prj._idx==0?1:0)).peephole());
return this;
}
return null;
}
-
- @Override void _walkUnreach( BitSet visit, HashSet<CFGNode> unreach ) {
- for( Node proj : _outputs )
- if( ((CProjNode)proj)._loopDepth == 0 )
- unreach.add((CProjNode)proj);
- super._walkUnreach(visit,unreach);
- }
-
- @Override public Node getBlockStart() { return ctrl().getBlockStart(); }
}
diff --git a/chapter11/src/main/java/com/seaofnodes/simple/node/LoadNode.java b/chapter11/src/main/java/com/seaofnodes/simple/node/LoadNode.java
index 386009b4..9bf36459 100644
--- a/chapter11/src/main/java/com/seaofnodes/simple/node/LoadNode.java
+++ b/chapter11/src/main/java/com/seaofnodes/simple/node/LoadNode.java
@@ -23,7 +23,7 @@ public class LoadNode extends MemOpNode {
* @param memPtr The ptr to the struct from where we load a field
*/
public LoadNode(String name, int alias, Type glb, Node memSlice, Node memPtr) {
- super(name, alias, null, memSlice, memPtr);
+ super(name, alias, memSlice, memPtr, null);
_declaredType = glb;
}
@@ -67,7 +67,7 @@ public class LoadNode extends MemOpNode {
// Simple Load-after-Store on same address.
if( mem() instanceof StoreNode st &&
ptr() == st.ptr() && _alias==st._alias ) { // Must check same object
- assert _name.equals(st._name); // Equiv class aliasing is perfect
+ assert Utils.eq(_name,st._name); // Equiv class aliasing is perfect
return st.val();
}
diff --git a/chapter11/src/main/java/com/seaofnodes/simple/node/LoopNode.java b/chapter11/src/main/java/com/seaofnodes/simple/node/LoopNode.java
index 45549f1d..a0ba973e 100644
--- a/chapter11/src/main/java/com/seaofnodes/simple/node/LoopNode.java
+++ b/chapter11/src/main/java/com/seaofnodes/simple/node/LoopNode.java
@@ -1,17 +1,15 @@
package com.seaofnodes.simple.node;
-import com.seaofnodes.simple.Parser;
-import com.seaofnodes.simple.Utils;
import com.seaofnodes.simple.type.Type;
-import com.seaofnodes.simple.type.TypeInteger;
+
import java.util.BitSet;
-import java.util.HashSet;
public class LoopNode extends RegionNode {
+
public LoopNode( Node entry ) { super(null,entry,null); }
- public CFGNode entry() { return cfg(1); }
- public CFGNode back () { return cfg(2); }
+ Node entry() { return in(1); }
+ Node back () { return in(2); }
@Override
public String label() { return "Loop"; }
@@ -27,51 +25,7 @@ public class LoopNode extends RegionNode {
return inProgress() ? null : super.idealize();
}
- // Bypass Region idom, same as the default idom() using use in(1) instead of in(0)
- @Override public int idepth() { return _idepth!=0 ? _idepth : cacheIDepth(entry().idepth()+1); }
- // Bypass Region idom, same as the default idom() using use in(1) instead of in(0)
- @Override public CFGNode idom() { return entry(); }
-
- @Override public int loopDepth() {
- if( _loopDepth!=0 ) return _loopDepth; // Was already set
- _loopDepth = entry()._loopDepth+1; // Entry depth plus one
- // One-time tag loop exits
- for( CFGNode idom = back(); idom!=this; idom = idom.idom() ) {
- // Walk idom in loop, setting depth
- idom._loopDepth = _loopDepth;
- // Loop exit hits the CProj before the If, instead of jumping from
- // Region directly to If.
- if( idom instanceof CProjNode proj ) {
- assert proj.in(0) instanceof IfNode; // Loop exit test
- // Find the loop exit CProj, and set loop_depth
- for( Node use : proj.in(0)._outputs )
- if( use instanceof CProjNode proj2 && proj2 != idom )
- proj2._loopDepth = _loopDepth-1;
- }
- }
- return _loopDepth;
- }
-
- // If this is an unreachable loop, it may not have an exit. If it does not
- // (i.e., infinite loop), force an exit to make it reachable.
- public void forceExit( StopNode stop ) {
- // Walk the backedge, then immediate dominator tree util we hit this
- // Loop again. If we ever hit a CProj from an If (as opposed to
- // directly on the If) we found our exit.
- CFGNode x = back();
- while( x != this ) {
- if( x instanceof CProjNode exit )
- return; // Found an exit, not an infinite loop
- x = x.idom();
- }
- // Found a no-exit loop. Insert an exit
- NeverNode iff = new NeverNode(back());
- for( Node use : _outputs )
- if( use instanceof PhiNode phi )
- iff.addDef(use);
- CProjNode t = new CProjNode(iff,0,"True" );
- CProjNode f = new CProjNode(iff,1,"False");
- setDef(2,f);
- stop.addDef(new ReturnNode(t,Parser.ZERO,null));
- }
+ // Bypass Region idom, same as the default idom() using use entry in(1) instead of in(0)
+ @Override int idepth() { return _idepth!=0 ? _idepth : cacheIDepth(entry().idepth()+1); }
+ @Override Node idom() { return entry(); }
}
diff --git a/chapter11/src/main/java/com/seaofnodes/simple/node/MemOpNode.java b/chapter11/src/main/java/com/seaofnodes/simple/node/MemOpNode.java
index 5a57a8c8..44304bcb 100644
--- a/chapter11/src/main/java/com/seaofnodes/simple/node/MemOpNode.java
+++ b/chapter11/src/main/java/com/seaofnodes/simple/node/MemOpNode.java
@@ -12,8 +12,8 @@ public abstract class MemOpNode extends Node {
public final String _name;
public final int _alias;
- public MemOpNode(String name, int alias, Node... nodes) {
- super(nodes);
+ public MemOpNode(String name, int alias, Node memSlice, Node memPtr, Node value) {
+ super(null, memSlice, memPtr, value);
_name = name;
_alias = alias;
}
diff --git a/chapter11/src/main/java/com/seaofnodes/simple/node/MultiNode.java b/chapter11/src/main/java/com/seaofnodes/simple/node/MultiNode.java
index 379e140d..2743bd19 100644
--- a/chapter11/src/main/java/com/seaofnodes/simple/node/MultiNode.java
+++ b/chapter11/src/main/java/com/seaofnodes/simple/node/MultiNode.java
@@ -1,10 +1,12 @@
package com.seaofnodes.simple.node;
-public interface MultiNode extends OutNode {
+public abstract class MultiNode extends Node {
+
+ public MultiNode(Node... inputs) { super(inputs); }
// Find a projection by index
- default ProjNode proj( int idx ) {
- for( Node out : outs() )
+ ProjNode proj( int idx ) {
+ for( Node out : _outputs )
if( out instanceof ProjNode prj && prj._idx==idx )
return prj;
return null;
diff --git a/chapter11/src/main/java/com/seaofnodes/simple/node/NeverNode.java b/chapter11/src/main/java/com/seaofnodes/simple/node/NeverNode.java
deleted file mode 100644
index 6eb7fe63..00000000
--- a/chapter11/src/main/java/com/seaofnodes/simple/node/NeverNode.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.seaofnodes.simple.node;
-
-import com.seaofnodes.print.ExprPrinter;
-
-import com.seaofnodes.simple.Parser;
-import com.seaofnodes.simple.type.TypeInteger;
-import com.seaofnodes.simple.type.Type;
-
-// "Never true" for infinite loop exits
-public class NeverNode extends IfNode {
- public NeverNode(Node ctrl) { super(ctrl,Parser.ZERO); }
-
- @Override public String label() { return "Never"; }
-
- @Override protected ExprPrinter<Node> _print1(ExprPrinter<Node> p) { return p.p("Never"); }
-
- @Override public Type compute() { return TypeInteger.BOT; }
-
- @Override public Node idealize() { return null; }
-}
diff --git a/chapter11/src/main/java/com/seaofnodes/simple/node/NewNode.java b/chapter11/src/main/java/com/seaofnodes/simple/node/NewNode.java
index 74ba5184..857920bc 100644
--- a/chapter11/src/main/java/com/seaofnodes/simple/node/NewNode.java
+++ b/chapter11/src/main/java/com/seaofnodes/simple/node/NewNode.java
@@ -22,7 +22,6 @@ public class NewNode extends Node {
return p.p("new ").p(_ptr._obj.str());
}
-
@Override
public Type compute() { return _ptr; }
diff --git a/chapter11/src/main/java/com/seaofnodes/simple/node/Node.java b/chapter11/src/main/java/com/seaofnodes/simple/node/Node.java
index 568c23cc..1d8e23f8 100644
--- a/chapter11/src/main/java/com/seaofnodes/simple/node/Node.java
+++ b/chapter11/src/main/java/com/seaofnodes/simple/node/Node.java
@@ -2,8 +2,9 @@ package com.seaofnodes.simple.node;
import com.seaofnodes.print.BaseNode;
-import com.seaofnodes.simple.IRPrinter;
import com.seaofnodes.simple.Parser;
+
+import com.seaofnodes.simple.IRPrinter;
import com.seaofnodes.simple.IterPeeps;
import com.seaofnodes.simple.Utils;
import com.seaofnodes.simple.type.Type;
@@ -16,7 +17,7 @@ import java.util.function.Function;
* The Node class provides common functionality used by all subtypes.
* Subtypes of Node specialize by overriding methods.
*/
-public abstract class Node extends BaseNode<Node> implements OutNode, Cloneable {
+public abstract class Node extends BaseNode<Node> implements Cloneable {
/**
* Inputs to the node. These are use-def references to Nodes.
@@ -82,7 +83,6 @@ public abstract class Node extends BaseNode<Node> implements OutNode, Cloneable
*/
public Node in(int i) { return _inputs.get(i); }
public Node out(int i) { return _outputs.get(i); }
- @Override public ArrayList<Node> outs() { return _outputs; }
public int nIns() { return _inputs.size(); }
@@ -90,7 +90,7 @@ public abstract class Node extends BaseNode<Node> implements OutNode, Cloneable
public boolean isUnused() { return nOuts() == 0; }
- public CFGNode cfg0() { return (CFGNode)in(0); }
+ public boolean isMem() { return false; }
/**
* Change a <em>def</em> into a Node. Keeps the edges correct, by removing
@@ -117,11 +117,11 @@ public abstract class Node extends BaseNode<Node> implements OutNode, Cloneable
// the new_def might get killed if the old node kills it recursively.
if( new_def != null )
new_def.addUse(this);
- // Set the new_def over the old (killed) edge
- _inputs.set(idx,new_def);
if( old_def != null && // If the old def exists, remove a def->use edge
old_def.delUse(this) ) // If we removed the last use, the old def is now dead
old_def.kill(); // Kill old def
+ // Set the new_def over the old (killed) edge
+ _inputs.set(idx,new_def);
moveDepsToWorklist();
// Return self for easy flow-coding
return new_def;
@@ -149,7 +149,7 @@ public abstract class Node extends BaseNode<Node> implements OutNode, Cloneable
* @param new_def the new definition, appended to the end of existing definitions
* @return new_def for flow coding
*/
- public Node addDef(Node new_def) {
+ Node addDef(Node new_def) {
unlock();
// Add use->def edge
_inputs.add(new_def);
@@ -268,8 +268,8 @@ public abstract class Node extends BaseNode<Node> implements OutNode, Cloneable
Type old = setType(compute());
// Replace constant computations from non-constants with a constant node
- if( !(this instanceof ConstantNode) && !(this instanceof XCtrlNode) && _type.isHighOrConst() )
- return (_type==Type.XCONTROL ? new XCtrlNode() : new ConstantNode(_type)).peepholeOpt();
+ if( !(this instanceof ConstantNode) && _type.isHighOrConst() )
+ return new ConstantNode(_type).peepholeOpt();
// Global Value Numbering
if( _hash==0 ) {
@@ -484,17 +484,6 @@ public abstract class Node extends BaseNode<Node> implements OutNode, Cloneable
int hash() { return 0; }
// ------------------------------------------------------------------------
- //
-
- /** Is this Node control-flow-graph related */
-
- /** Is this Node Memory related */
- public boolean isMem() { return false; }
-
- /** Return block start from a isCFG() */
- public Node getBlockStart() { return null; }
-
- // ------------------------------------------------------------------------
// Peephole utilities
// Swap inputs without letting either input go dead during the swap.
@@ -522,6 +511,38 @@ public abstract class Node extends BaseNode<Node> implements OutNode, Cloneable
return true;
}
+ /**
+ * Immediate dominator tree depth, used to approximate a real IDOM depth
+ * during parsing where we do not have the whole program, and also
+ * peepholes change the CFG incrementally.
+ * <p>
+ * See {@link <a href="https://en.wikipedia.org/wiki/Dominator_(graph_theory)">...</a>}
+ */
+ public char _idepth; // IDOM depth approx; Zero is unset; non-zero is cached legit
+
+ // Find the lowest common ancestor in the current dominator tree.
+ Node domLCA(Node rhs) {
+ if( rhs==null ) return this;
+ Node lhs = this;
+ while( lhs != rhs ) {
+ if( lhs==null || rhs==null ) return null;
+ int comp = lhs.idepth() - rhs.idepth();
+ if( comp >= 0 ) lhs = lhs.idom();
+ if( comp <= 0 ) rhs = rhs.idom();
+ }
+ return lhs;
+ }
+
+ int idepth() { return _idepth!=0 ? _idepth : cacheIDepth(idom().idepth()+1); }
+ // Zero depth means uncached. Check before narrowing so overflow cannot wrap.
+ final int cacheIDepth(int depth) {
+ assert 0 <= depth && depth <= Character.MAX_VALUE : "Dominator depth exceeds 65535";
+ return _idepth = (char)depth;
+ }
+
+ // Return the immediate dominator of this Node.
+ Node idom() { return in(0); }
+
// Make a shallow copy (same class) of this Node, with given inputs and
// empty outputs and a new Node ID. The original inputs are ignored.
// Does not need to be implemented in isCFG() nodes.
diff --git a/chapter11/src/main/java/com/seaofnodes/simple/node/OutNode.java b/chapter11/src/main/java/com/seaofnodes/simple/node/OutNode.java
deleted file mode 100644
index 7e531145..00000000
--- a/chapter11/src/main/java/com/seaofnodes/simple/node/OutNode.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.seaofnodes.simple.node;
-
-import java.util.ArrayList;
-
-public interface OutNode {
- ArrayList<Node> outs();
-}
diff --git a/chapter11/src/main/java/com/seaofnodes/simple/node/PhiNode.java b/chapter11/src/main/java/com/seaofnodes/simple/node/PhiNode.java
index 8f3cda9e..6995cc2f 100644
--- a/chapter11/src/main/java/com/seaofnodes/simple/node/PhiNode.java
+++ b/chapter11/src/main/java/com/seaofnodes/simple/node/PhiNode.java
@@ -32,9 +32,10 @@ public class PhiNode extends Node {
return p.unchar(',').close();
}
- public CFGNode region() { return (CFGNode)in(0); }
+ Node region() { return in(0); }
@Override public boolean isMultiTail() { return true; }
- @Override public boolean isMem() { return _declaredType instanceof TypeMem; }
+ @Override
+ public boolean isMem() { return _declaredType instanceof TypeMem; }
@Override
public Type compute() {
@@ -84,9 +85,9 @@ public class PhiNode extends Node {
Node val = in(3-nullx);
if( region().idom() instanceof IfNode iff && iff.pred().addDep(this)==val ) {
// Must walk the idom on the null side to make sure we hit False.
- CFGNode idom = (CFGNode)region().in(nullx);
+ Node idom = region().in(nullx);
while( idom.in(0) != iff ) idom = idom.idom();
- if( idom instanceof CProjNode proj && proj._idx==1 )
+ if( idom instanceof ProjNode proj && proj._idx==1 )
return val;
}
}
diff --git a/chapter11/src/main/java/com/seaofnodes/simple/node/ProjNode.java b/chapter11/src/main/java/com/seaofnodes/simple/node/ProjNode.java
index e82c69b3..a2632110 100644
--- a/chapter11/src/main/java/com/seaofnodes/simple/node/ProjNode.java
+++ b/chapter11/src/main/java/com/seaofnodes/simple/node/ProjNode.java
@@ -15,7 +15,7 @@ public class ProjNode extends Node {
// Debugging label
public final String _label;
- public ProjNode(Node ctrl, int idx, String label) {
+ public ProjNode(MultiNode ctrl, int idx, String label) {
super(ctrl);
_idx = idx;
_label = label;
@@ -27,16 +27,30 @@ public class ProjNode extends Node {
@Override
protected ExprPrinter<Node> _print1(ExprPrinter<Node> p) { return p.p(_label); }
+ @Override public boolean isCFG() { return _idx==0 || ctrl() instanceof IfNode; }
@Override public boolean isMultiTail() { return in(0).isMultiHead(); }
@Override public boolean isMem() { return _type instanceof TypeMem; }
+ public MultiNode ctrl() { return (MultiNode)in(0); }
+
@Override
public Type compute() {
Type t = in(0)._type;
return t instanceof TypeTuple tt ? tt._types[_idx] : Type.BOTTOM;
}
- @Override public Node idealize() { return null; }
+ @Override
+ public Node idealize() {
+ if ( ctrl() instanceof IfNode iff ) {
+ if ( iff._type instanceof TypeTuple tt && tt._types[1 - _idx] == Type.XCONTROL )
+ return iff.in(0); // We become our input control
+
+ // Flip a negating if-test, to remove the not
+ if( iff.pred().addDep(this) instanceof NotNode not )
+ return new ProjNode((MultiNode)new IfNode(iff.ctrl(),not.in(1)).peephole(),1-_idx,_idx==0 ? "False" : "True");
+ }
+ return null;
+ }
@Override
boolean eq( Node n ) { return _idx == ((ProjNode)n)._idx; }
diff --git a/chapter11/src/main/java/com/seaofnodes/simple/node/RegionNode.java b/chapter11/src/main/java/com/seaofnodes/simple/node/RegionNode.java
index f0808410..8b52494a 100644
--- a/chapter11/src/main/java/com/seaofnodes/simple/node/RegionNode.java
+++ b/chapter11/src/main/java/com/seaofnodes/simple/node/RegionNode.java
@@ -3,15 +3,13 @@ package com.seaofnodes.simple.node;
import com.seaofnodes.print.ExprPrinter;
import com.seaofnodes.simple.IterPeeps;
-import com.seaofnodes.simple.Parser;
import com.seaofnodes.simple.Utils;
import com.seaofnodes.simple.type.Type;
+
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.BitSet;
-import java.util.HashSet;
-public class RegionNode extends CFGNode {
+public class RegionNode extends Node {
public RegionNode(Node... nodes) { super(nodes); }
@@ -22,8 +20,8 @@ public class RegionNode extends CFGNode {
return p.p(label()).p(_nid);
}
+ @Override public boolean isCFG() { return true; }
@Override public boolean isMultiHead() { return true; }
- @Override public boolean blockHead() { return true; }
@Override
public Type compute() {
@@ -59,7 +57,7 @@ public class RegionNode extends CFGNode {
IterPeeps.addAll(phi._outputs);
}
}
- return isDead() ? Parser.XCTRL : delDef(path);
+ return isDead() ? new ConstantNode(Type.XCONTROL) : delDef(path);
}
// If down to a single input, become that input
if( nIns()==2 && !hasPhi() )
@@ -91,30 +89,23 @@ public class RegionNode extends CFGNode {
}
// Immediate dominator of Region is a little more complicated.
- @Override public int idepth() {
+ @Override int idepth() {
if( _idepth!=0 ) return _idepth;
int depth=0;
for( Node n : _inputs )
if( n!=null )
- depth = Math.max(depth,((CFGNode)n).idepth()+1);
+ depth = Math.max(depth,n.idepth()+1);
return cacheIDepth(depth);
}
- @Override public CFGNode idom() {
- CFGNode lca = null;
+ @Override Node idom() {
+ Node lca = null;
// Recompute from predecessors: CFG edits can change the dominator.
for( int i=1; i<nIns(); i++ )
- lca = cfg(i).domLCA(lca);
+ lca = in(i).domLCA(lca);
return lca;
}
- @Override void _walkUnreach( BitSet visit, HashSet<CFGNode> unreach ) {
- for( int i=1; i<nIns(); i++ )
- cfg(i).walkUnreach(visit,unreach);
- }
-
- @Override public int loopDepth() { return _loopDepth==0 ? (_loopDepth = cfg(1).loopDepth()) : _loopDepth; }
-
// True if last input is null
public final boolean inProgress() {
return nIns()>1 && in(nIns()-1) == null;
@@ -124,6 +115,4 @@ public class RegionNode extends CFGNode {
@Override boolean eq( Node n ) {
return !inProgress();
}
-
- @Override public Node getBlockStart() { return this; }
}
diff --git a/chapter11/src/main/java/com/seaofnodes/simple/node/ReturnNode.java b/chapter11/src/main/java/com/seaofnodes/simple/node/ReturnNode.java
index 161cc7d6..ef4ddb3a 100644
--- a/chapter11/src/main/java/com/seaofnodes/simple/node/ReturnNode.java
+++ b/chapter11/src/main/java/com/seaofnodes/simple/node/ReturnNode.java
@@ -6,11 +6,10 @@ import com.seaofnodes.simple.type.*;
/** Keeps all preceding memory effects and the return value alive: {ctrl, $mem, value}. */
-public class ReturnNode extends CFGNode {
+public class ReturnNode extends Node {
public ReturnNode(Node ctrl, Node data, ScopeNode scope) {
- // A synthetic never-taken loop exit has no source scope.
- super(ctrl, scope == null ? null : scope.lookup("$mem"), data);
+ super(ctrl, scope.lookup("$mem"), data);
}
public Node ctrl() { return in(0); }
@@ -27,6 +26,8 @@ public class ReturnNode extends CFGNode {
return p.p(";");
}
+ @Override public boolean isCFG() { return true; }
+
@Override
public Type compute() {
// Return exposes the complete memory state.
@@ -39,6 +40,4 @@ public class ReturnNode extends CFGNode {
return ctrl();
return null;
}
-
- @Override public Node getBlockStart() { return ctrl().getBlockStart(); }
}
diff --git a/chapter11/src/main/java/com/seaofnodes/simple/node/StartNode.java b/chapter11/src/main/java/com/seaofnodes/simple/node/StartNode.java
index c1b57915..3404f111 100644
--- a/chapter11/src/main/java/com/seaofnodes/simple/node/StartNode.java
+++ b/chapter11/src/main/java/com/seaofnodes/simple/node/StartNode.java
@@ -3,13 +3,10 @@ package com.seaofnodes.simple.node;
import com.seaofnodes.print.ExprPrinter;
import com.seaofnodes.simple.type.*;
-import java.util.BitSet;
-import java.util.HashSet;
-/** Start supplies control, whole memory, and the argument, in that order. */
-public class StartNode extends CFGNode implements MultiNode {
-
- private final TypeTuple _args;
+/** The entry tuple: control, initial whole-memory state, and argument. */
+public class StartNode extends MultiNode {
+ final TypeTuple _args;
public StartNode(Type[] args) {
super();
@@ -23,8 +20,8 @@ public class StartNode extends CFGNode implements MultiNode {
return p.p(label());
}
+ @Override public boolean isCFG() { return true; }
@Override public boolean isMultiHead() { return true; }
- @Override public boolean blockHead() { return true; }
@Override
public TypeTuple compute() { return _args; }
@@ -33,12 +30,6 @@ public class StartNode extends CFGNode implements MultiNode {
public Node idealize() { return null; }
// No immediate dominator, and idepth==0
- @Override public int idepth() { return 0; }
- @Override public CFGNode idom() { return null; }
-
- @Override void _walkUnreach( BitSet visit, HashSet<CFGNode> unreach ) { }
-
- @Override public int loopDepth() { return (_loopDepth=1); }
-
- @Override public Node getBlockStart() { return this; }
+ @Override int idepth() { return 0; }
+ @Override Node idom() { return null; }
}
diff --git a/chapter11/src/main/java/com/seaofnodes/simple/node/StopNode.java b/chapter11/src/main/java/com/seaofnodes/simple/node/StopNode.java
index 46cf51da..4b4e9615 100644
--- a/chapter11/src/main/java/com/seaofnodes/simple/node/StopNode.java
+++ b/chapter11/src/main/java/com/seaofnodes/simple/node/StopNode.java
@@ -8,7 +8,7 @@ import com.seaofnodes.simple.type.Type;
import com.seaofnodes.simple.IterPeeps;
-public class StopNode extends CFGNode {
+public class StopNode extends Node {
public final String _src;
@@ -31,7 +31,7 @@ public class StopNode extends CFGNode {
return p.p("]");
}
- @Override public boolean blockHead() { return true; }
+ @Override public boolean isCFG() { return true; }
// If a single Return, return it.
// Otherwise, null because ambiguous.
@@ -54,17 +54,7 @@ public class StopNode extends CFGNode {
return null;
}
- @Override public int idepth() {
- if( _idepth!=0 ) return _idepth;
- int d=0;
- for( Node n : _inputs )
- if( n!=null )
- d = Math.max(d,((CFGNode)n).idepth()+1);
- return cacheIDepth(d);
- }
- @Override public CFGNode idom() { return null; }
-
- @Override public int loopDepth() { return (_loopDepth=1); }
+ @Override public Node idom() { return null; }
public Node addReturn(Node node) {
return addDef(node);
@@ -82,6 +72,4 @@ public class StopNode extends CFGNode {
if( obs != null ) obs.phase("TypeCheck");
return this;
}
-
- @Override public Node getBlockStart() { return this; }
}
diff --git a/chapter11/src/main/java/com/seaofnodes/simple/node/StoreNode.java b/chapter11/src/main/java/com/seaofnodes/simple/node/StoreNode.java
index f61afe78..026d5c50 100644
--- a/chapter11/src/main/java/com/seaofnodes/simple/node/StoreNode.java
+++ b/chapter11/src/main/java/com/seaofnodes/simple/node/StoreNode.java
@@ -19,8 +19,8 @@ public class StoreNode extends MemOpNode {
* @param memPtr The ptr to the struct where we will store a value
* @param value Value to be stored
*/
- public StoreNode(String name, int alias, Node ctrl, Node memSlice, Node memPtr, Node value) {
- super(name, alias, ctrl, memSlice, memPtr, value);
+ public StoreNode(String name, int alias, Node memSlice, Node memPtr, Node value) {
+ super(name, alias, memSlice, memPtr, value);
}
@Override
@@ -53,7 +53,7 @@ public class StoreNode extends MemOpNode {
// Must have exactly one use of "this" or you get weird
// non-serializable memory effects in the worse case.
st.checkNoUseBeyond(this) ) {
- assert _name.equals(st._name); // Equiv class aliasing is perfect
+ assert Utils.eq(_name,st._name); // Equiv class aliasing is perfect
setDef(1,st.mem());
return this;
}
diff --git a/chapter11/src/main/java/com/seaofnodes/simple/node/SubNode.java b/chapter11/src/main/java/com/seaofnodes/simple/node/SubNode.java
index 7b4cff0b..6fa87a07 100644
--- a/chapter11/src/main/java/com/seaofnodes/simple/node/SubNode.java
+++ b/chapter11/src/main/java/com/seaofnodes/simple/node/SubNode.java
@@ -1,7 +1,6 @@
package com.seaofnodes.simple.node;
-import com.seaofnodes.simple.Parser;
import com.seaofnodes.simple.type.Type;
import com.seaofnodes.simple.type.TypeInteger;
diff --git a/chapter11/src/main/java/com/seaofnodes/simple/node/XCtrlNode.java b/chapter11/src/main/java/com/seaofnodes/simple/node/XCtrlNode.java
deleted file mode 100644
index 056dfba1..00000000
--- a/chapter11/src/main/java/com/seaofnodes/simple/node/XCtrlNode.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.seaofnodes.simple.node;
-
-import com.seaofnodes.print.ExprPrinter;
-
-import com.seaofnodes.simple.Parser;
-import com.seaofnodes.simple.type.Type;
-
-public class XCtrlNode extends CFGNode {
- public XCtrlNode( ) { super(Parser.START); }
- @Override public String label() { return "Xctrl"; }
- @Override protected ExprPrinter<Node> _print1(ExprPrinter<Node> p) { return p.p("Xctrl"); }
- @Override public Type compute() { return Type.XCONTROL; }
- @Override public Node idealize() { return null; }
-}
diff --git a/chapter11/src/main/java/com/seaofnodes/simple/print/SimpleGraphAdapter.java b/chapter11/src/main/java/com/seaofnodes/simple/print/SimpleGraphAdapter.java
index 89ef99bd..92d970d8 100644
--- a/chapter11/src/main/java/com/seaofnodes/simple/print/SimpleGraphAdapter.java
+++ b/chapter11/src/main/java/com/seaofnodes/simple/print/SimpleGraphAdapter.java
@@ -6,13 +6,13 @@ import com.seaofnodes.simple.node.*;
import com.seaofnodes.simple.node.Node;
import com.seaofnodes.simple.type.TypeMem;
-/** Chapter 11's view of the IR; browser, transport and layout are shared. */
+/** Chapter 10's view of the IR; browser, transport and layout are shared. */
public class SimpleGraphAdapter extends GraphAdapter<Node> {
@Override protected String[] edgeNames(Node n) {
return n instanceof ScopeNode scope && n.nIns()!=0 ? scope.reverseNames() : null;
}
- @Override protected int projectionIndex(Node n) { return n instanceof ProjNode p ? p._idx : n instanceof CProjNode p ? p._idx : -1; }
+ @Override protected int projectionIndex(Node n) { return n instanceof ProjNode p ? p._idx : -1; }
@Override protected Kind kind(Node n) {
if( n instanceof StopNode ) return Kind.STOP;
@@ -25,9 +25,9 @@ public class SimpleGraphAdapter extends GraphAdapter<Node> {
}
@Override protected Role role(Node n, int i) {
- if( n instanceof ScopeNode || n instanceof ConstantNode || n instanceof XCtrlNode ) return Role.ASSOC;
+ if( n instanceof ScopeNode || n instanceof ConstantNode ) return Role.ASSOC;
if( n instanceof PhiNode ) return i == 0 ? Role.ASSOC : isMem(n) ? Role.MEM : Role.DATA;
- if( n instanceof ProjNode || n instanceof CProjNode ) return n.isCFG() ? Role.CTRL : isMem(n) ? Role.MEM : Role.DATA;
+ if( n instanceof ProjNode ) return n.isCFG() ? Role.CTRL : isMem(n) ? Role.MEM : Role.DATA;
if( n instanceof RegionNode && i == 0 ) return Role.ASSOC;
if( i == 0 || n instanceof RegionNode || n instanceof StopNode ) return Role.CTRL;
if( i == 1 && (n instanceof MemOpNode || n instanceof ReturnNode) ) return Role.MEM;
diff --git a/chapter11/src/main/java/com/seaofnodes/simple/type/Field.java b/chapter11/src/main/java/com/seaofnodes/simple/type/Field.java
index b50a4fa6..cdc58215 100644
--- a/chapter11/src/main/java/com/seaofnodes/simple/type/Field.java
+++ b/chapter11/src/main/java/com/seaofnodes/simple/type/Field.java
@@ -20,7 +20,6 @@ public class Field extends Type {
_fname = fname;
_type = type;
}
- // Make with existing alias
public static Field make( String fname, Type type ) {
return new Field(fname,type).intern();
}
@@ -47,7 +46,7 @@ public class Field extends Type {
boolean eq(Type t) {
Field f = (Field)t;
- return _fname.equals(f._fname) && _type==f._type;
+ return Utils.eq(_fname,f._fname) && _type==f._type;
}
diff --git a/chapter11/src/main/java/com/seaofnodes/simple/type/TypeTuple.java b/chapter11/src/main/java/com/seaofnodes/simple/type/TypeTuple.java
index ec7390ca..0aa019a7 100644
--- a/chapter11/src/main/java/com/seaofnodes/simple/type/TypeTuple.java
+++ b/chapter11/src/main/java/com/seaofnodes/simple/type/TypeTuple.java
@@ -58,7 +58,8 @@ public class TypeTuple extends Type {
for( Type t : _types )
t.typeName(sb).append(",");
sb.setLength(sb.length()-1);
- return sb.append("]");
+ sb.append("]");
+ return sb;
}
public static final TypeTuple IF_BOTH = make(new Type[]{Type. CONTROL,Type. CONTROL});
diff --git a/chapter11/src/test/java/com/seaofnodes/simple/Chapter01Test.java b/chapter11/src/test/java/com/seaofnodes/simple/Chapter01Test.java
index c10dc510..89882b2f 100644
--- a/chapter11/src/test/java/com/seaofnodes/simple/Chapter01Test.java
+++ b/chapter11/src/test/java/com/seaofnodes/simple/Chapter01Test.java
@@ -15,7 +15,7 @@ public class Chapter01Test {
StartNode start = Parser.START;
ReturnNode ret = (ReturnNode)stop.in(0);
- assertTrue(ret.ctrl() instanceof CProjNode);
+ assertTrue(ret.ctrl() instanceof ProjNode);
Node expr = ret.expr();
if( expr instanceof ConstantNode con ) {
assertEquals(start,con.in(0));
diff --git a/chapter11/src/test/java/com/seaofnodes/simple/Chapter04Test.java b/chapter11/src/test/java/com/seaofnodes/simple/Chapter04Test.java
index 14d31245..edc62f50 100644
--- a/chapter11/src/test/java/com/seaofnodes/simple/Chapter04Test.java
+++ b/chapter11/src/test/java/com/seaofnodes/simple/Chapter04Test.java
@@ -83,7 +83,7 @@ public class Chapter04Test {
Parser parser = new Parser("return arg; ");
StopNode stop = parser.parse();
ReturnNode ret = stop.ret();
- assertTrue(ret.in(0) instanceof CProjNode);
+ assertTrue(ret.in(0) instanceof ProjNode);
assertTrue(ret.in(1) instanceof ProjNode);
assertEquals(1, ((ProjNode)ret.in(1))._idx);
assertTrue(ret.in(2) instanceof ProjNode);
diff --git a/chapter11/src/test/java/com/seaofnodes/simple/Chapter05Test.java b/chapter11/src/test/java/com/seaofnodes/simple/Chapter05Test.java
index 7beeb4d9..cf7bd6cf 100644
--- a/chapter11/src/test/java/com/seaofnodes/simple/Chapter05Test.java
+++ b/chapter11/src/test/java/com/seaofnodes/simple/Chapter05Test.java
@@ -22,7 +22,7 @@ else {
return a;""");
StopNode ret = parser.parse().iterate();
- assertEquals("return Phi(Region21,(arg+2),(arg-3));", ret.toString());
+ assertEquals("return Phi(Region19,(arg+2),(arg-3));", ret.toString());
}
@Test
@@ -37,7 +37,7 @@ if (arg == 1) {
}
return c;""", TypeInteger.BOT);
StopNode ret = parser.parse().iterate();
- assertEquals("return Phi(Region19,4,3);", ret.toString());
+ assertEquals("return Phi(Region17,4,3);", ret.toString());
}
@Test
@@ -65,7 +65,7 @@ else
b=a+1;
return a+b;""");
StopNode ret = parser.parse().iterate();
- assertEquals("return ((arg*2)+Phi(Region24,2,3));", ret.toString());
+ assertEquals("return ((arg*2)+Phi(Region22,2,3));", ret.toString());
}
@Test
@@ -80,7 +80,7 @@ else
a=b+1;
return a+b;""");
StopNode ret = parser.parse().iterate();
- assertEquals("return ((Phi(Region35,(arg*2),arg)+arg)+Phi(Region,4,5));", ret.toString());
+ assertEquals("return ((Phi(Region33,(arg*2),arg)+arg)+Phi(Region,4,5));", ret.toString());
}
@Test
@@ -100,7 +100,7 @@ else
return a;
""", TypeInteger.BOT);
StopNode stop = parser.parse().iterate();
- assertEquals("return Phi(Region39,Phi(Region25,2,3),Phi(Region37,4,5));", stop.toString());
+ assertEquals("return Phi(Region37,Phi(Region23,2,3),Phi(Region35,4,5));", stop.toString());
}
@Test
@@ -116,7 +116,7 @@ if( arg==0 )
return arg+a+b;
""", TypeInteger.BOT);
StopNode stop = parser.parse();
- assertEquals("return ((arg+Phi(Region16,1,0))+Phi(Region31,2,0));", stop.toString());
+ assertEquals("return ((arg+Phi(Region14,1,0))+Phi(Region29,2,0));", stop.toString());
}
@Test
@@ -130,7 +130,7 @@ if( arg==1 )
}
return a;""");
StopNode ret = parser.parse().iterate();
- assertEquals("return (arg==Phi(Region19,3,2));", ret.toString());
+ assertEquals("return (arg==Phi(Region17,3,2));", ret.toString());
}
@Test
diff --git a/chapter11/src/test/java/com/seaofnodes/simple/Chapter06Test.java b/chapter11/src/test/java/com/seaofnodes/simple/Chapter06Test.java
index df0f2848..920e26e3 100644
--- a/chapter11/src/test/java/com/seaofnodes/simple/Chapter06Test.java
+++ b/chapter11/src/test/java/com/seaofnodes/simple/Chapter06Test.java
@@ -17,7 +17,7 @@ return 1;
""");
StopNode stop = parser.parse().iterate();
assertEquals("return 2;", stop.toString());
- assertTrue(stop.ret().ctrl() instanceof CProjNode);
+ assertTrue(stop.ret().ctrl() instanceof ProjNode);
}
@Test
@@ -30,7 +30,7 @@ if (arg)
return (arg < a) < 3;
""");
StopNode stop = parser.parse().iterate();
- assertEquals("return ((arg<Phi(Region15,2,1))<3);", stop.toString());
+ assertEquals("return ((arg<Phi(Region13,2,1))<3);", stop.toString());
}
@Test
@@ -46,7 +46,7 @@ return a;
""");
StopNode stop = parser.parse().iterate();
assertEquals("return 2;", stop.toString());
- assertTrue(stop.ret().ctrl() instanceof CProjNode);
+ assertTrue(stop.ret().ctrl() instanceof ProjNode);
}
@Test
@@ -65,7 +65,7 @@ else
b=5;
return b;""", TypeInteger.BOT);
StopNode stop = parser.parse().iterate();
- assertEquals("return Phi(Region40,42,5);", stop.toString());
+ assertEquals("return Phi(Region38,42,5);", stop.toString());
}
@Test
@@ -84,7 +84,7 @@ else
b=5;
return b;""", TypeInteger.BOT);
StopNode stop = parser.parse().iterate();
- assertEquals("return Phi(Region33,2,5);", stop.toString());
+ assertEquals("return Phi(Region31,2,5);", stop.toString());
}
@Test
@@ -144,7 +144,7 @@ else
return a;
""", TypeInteger.BOT);
StopNode stop = parser.parse().iterate();
- assertEquals("return Phi(Region44,3,Phi(Region42,4,5));", stop.toString());
+ assertEquals("return Phi(Region42,3,Phi(Region40,4,5));", stop.toString());
}
@Test
@@ -200,7 +200,7 @@ if( arg ) {
return a+b;
""");
StopNode ret = parser.parse().iterate();
- assertEquals("return Phi(Region27,4,1);", ret.toString());
+ assertEquals("return Phi(Region25,4,1);", ret.toString());
}
@@ -251,7 +251,7 @@ if( arg ) {
return a+b+c;
""");
StopNode ret = parser.parse().iterate();
- assertEquals("return (Phi(Region39,Phi(Region26,2,3),0)+Phi(Region,3,1));", ret.toString());
+ assertEquals("return (Phi(Region37,Phi(Region24,2,3),0)+Phi(Region,3,1));", ret.toString());
}
diff --git a/chapter11/src/test/java/com/seaofnodes/simple/Chapter07Test.java b/chapter11/src/test/java/com/seaofnodes/simple/Chapter07Test.java
index 222982e7..ff0ca599 100644
--- a/chapter11/src/test/java/com/seaofnodes/simple/Chapter07Test.java
+++ b/chapter11/src/test/java/com/seaofnodes/simple/Chapter07Test.java
@@ -18,8 +18,8 @@ public class Chapter07Test {
return arg;
""");
StopNode stop = parser.parse();
- assertEquals("return Phi(Loop9,arg,(Phi_arg+1));", stop.toString());
- assertTrue(stop.ret().ctrl() instanceof CProjNode);
+ assertEquals("return Phi(Loop7,arg,(Phi_arg+1));", stop.toString());
+ assertTrue(stop.ret().ctrl() instanceof ProjNode);
}
@Test
@@ -35,7 +35,7 @@ if(arg){}else{
return a;
""");
StopNode stop = parser.parse().iterate();
- assertEquals("return Phi(Region27,1,Phi(Loop16,1,(Phi_a+1)));", stop.toString());
+ assertEquals("return Phi(Region25,1,Phi(Loop14,1,(Phi_a+1)));", stop.toString());
}
@Test
@@ -55,7 +55,7 @@ while(i < arg) {
return sum;
""");
StopNode stop = parser.parse().iterate();
- assertEquals("return Phi(Loop11,0,Phi(Loop23,Phi_sum,(Phi_sum+Phi(Loop,0,(Phi_j+1)))));", stop.toString());
+ assertEquals("return Phi(Loop9,0,Phi(Loop21,Phi_sum,(Phi_sum+Phi(Loop,0,(Phi_j+1)))));", stop.toString());
}
@Test
@@ -71,8 +71,8 @@ while(a < 10) {
return b;
""");
StopNode stop = parser.parse();
- assertEquals("return Phi(Loop11,2,Phi(Region30,Phi_b,4));", stop.toString());
- assertTrue(stop.ret().ctrl() instanceof CProjNode);
+ assertEquals("return Phi(Loop9,2,Phi(Region28,Phi_b,4));", stop.toString());
+ assertTrue(stop.ret().ctrl() instanceof ProjNode);
}
@Test
@@ -90,8 +90,8 @@ while(a < 10) {
return b;
""");
StopNode stop = parser.parse().iterate();
- assertEquals("return Phi(Loop11,2,(Phi(Region30,Phi_b,4)+1));", stop.toString());
- assertTrue(stop.ret().ctrl() instanceof CProjNode);
+ assertEquals("return Phi(Loop9,2,(Phi(Region28,Phi_b,4)+1));", stop.toString());
+ assertTrue(stop.ret().ctrl() instanceof ProjNode);
}
@@ -107,8 +107,8 @@ while(a < 10) {
return a;
""");
StopNode stop = parser.parse();
- assertEquals("return Phi(Loop10,1,(Phi_a+3));", stop.toString());
- assertTrue(stop.ret().ctrl() instanceof CProjNode);
+ assertEquals("return Phi(Loop8,1,(Phi_a+3));", stop.toString());
+ assertTrue(stop.ret().ctrl() instanceof ProjNode);
}
@Test
@@ -123,8 +123,8 @@ while(a < 10) {
return a;
""");
StopNode stop = parser.parse().iterate();
- assertEquals("return Phi(Loop10,1,(Phi_a+3));", stop.toString());
- assertTrue(stop.ret().ctrl() instanceof CProjNode);
+ assertEquals("return Phi(Loop8,1,(Phi_a+3));", stop.toString());
+ assertTrue(stop.ret().ctrl() instanceof ProjNode);
}
@Test
@@ -136,8 +136,8 @@ while(arg) a = 2;
return a;
""");
StopNode stop = parser.parse();
- assertEquals("return Phi(Loop10,1,2);", stop.toString());
- assertTrue(stop.ret().ctrl() instanceof CProjNode);
+ assertEquals("return Phi(Loop8,1,2);", stop.toString());
+ assertTrue(stop.ret().ctrl() instanceof ProjNode);
}
@Test
@@ -149,8 +149,8 @@ while(arg) a = 2;
return a;
""");
StopNode stop = parser.parse().iterate();
- assertEquals("return Phi(Loop10,1,2);", stop.toString());
- assertTrue(stop.ret().ctrl() instanceof CProjNode);
+ assertEquals("return Phi(Loop8,1,2);", stop.toString());
+ assertTrue(stop.ret().ctrl() instanceof ProjNode);
}
@Test
@@ -165,8 +165,8 @@ while(a < 10) {
return a;
""");
StopNode stop = parser.parse();
- assertEquals("return Phi(Loop10,1,(Phi_a+3));", stop.toString());
- assertTrue(stop.ret().ctrl() instanceof CProjNode);
+ assertEquals("return Phi(Loop8,1,(Phi_a+3));", stop.toString());
+ assertTrue(stop.ret().ctrl() instanceof ProjNode);
}
@Test
@@ -181,8 +181,8 @@ while(a < 10) {
return a;
""");
StopNode stop = parser.parse().iterate();
- assertEquals("return Phi(Loop10,1,(Phi_a+3));", stop.toString());
- assertTrue(stop.ret().ctrl() instanceof CProjNode);
+ assertEquals("return Phi(Loop8,1,(Phi_a+3));", stop.toString());
+ assertTrue(stop.ret().ctrl() instanceof ProjNode);
}
@Test
@@ -198,8 +198,8 @@ while(a < 10) {
return a;
""");
StopNode stop = parser.parse();
- assertEquals("return Phi(Loop11,1,(Phi_a+3));", stop.toString());
- assertTrue(stop.ret().ctrl() instanceof CProjNode);
+ assertEquals("return Phi(Loop9,1,(Phi_a+3));", stop.toString());
+ assertTrue(stop.ret().ctrl() instanceof ProjNode);
}
@Test
@@ -215,8 +215,8 @@ while(a < 10) {
return a;
""");
StopNode stop = parser.parse().iterate();
- assertEquals("return Phi(Loop11,1,(Phi_a+3));", stop.toString());
- assertTrue(stop.ret().ctrl() instanceof CProjNode);
+ assertEquals("return Phi(Loop9,1,(Phi_a+3));", stop.toString());
+ assertTrue(stop.ret().ctrl() instanceof ProjNode);
}
}
diff --git a/chapter11/src/test/java/com/seaofnodes/simple/Chapter08Test.java b/chapter11/src/test/java/com/seaofnodes/simple/Chapter08Test.java
index 8fcb29a0..4fa08bd9 100644
--- a/chapter11/src/test/java/com/seaofnodes/simple/Chapter08Test.java
+++ b/chapter11/src/test/java/com/seaofnodes/simple/Chapter08Test.java
@@ -24,7 +24,7 @@ while(arg < 10) {
return arg;
""");
StopNode stop = parser.parse().iterate();
- assertEquals("return Phi(Region37,Phi(Region27,Phi(Loop9,arg,(Phi_arg+1)),Add),Add);", stop.toString());
+ assertEquals("return Phi(Region37,Phi(Region26,Phi(Loop7,arg,(Phi_arg+1)),Add),Add);", stop.toString());
assertTrue(stop.ret().ctrl() instanceof RegionNode);
Assert.assertEquals(5L, Evaluator.evaluate(stop, 1));
Assert.assertEquals(10L, Evaluator.evaluate(stop, 6));
@@ -47,8 +47,8 @@ while(arg < 10) {
return a;
""");
StopNode stop = parser.parse().iterate();
- assertEquals("return Phi(Loop10,1,Phi(Region42,Phi_a,(Phi_a+1)));", stop.toString());
- assertTrue(stop.ret().ctrl() instanceof CProjNode);
+ assertEquals("return Phi(Loop8,1,Phi(Region43,Phi_a,(Phi_a+1)));", stop.toString());
+ assertTrue(stop.ret().ctrl() instanceof ProjNode);
}
@@ -66,7 +66,7 @@ while(arg < 10) {
return arg;
""");
StopNode stop = parser.parse().iterate();
- assertEquals("return Phi(Region35,Phi(Loop9,arg,(Phi_arg+1)),Add);", stop.toString());
+ assertEquals("return Phi(Region35,Phi(Loop7,arg,(Phi_arg+1)),Add);", stop.toString());
assertTrue(stop.ret().ctrl() instanceof RegionNode);
}
@@ -82,7 +82,7 @@ while(arg < 10) {
return arg;
""");
StopNode stop = parser.parse().iterate();
- assertEquals("return Phi(Region27,Phi(Loop9,arg,(Phi_arg+1)),Add);", stop.toString());
+ assertEquals("return Phi(Region26,Phi(Loop7,arg,(Phi_arg+1)),Add);", stop.toString());
assertTrue(stop.ret().ctrl() instanceof RegionNode);
}
@@ -101,8 +101,8 @@ while(arg < 10) {
return arg;
""");
StopNode stop = parser.parse().iterate();
- assertEquals("return Phi(Loop9,arg,(Phi_arg+1));", stop.toString());
- assertTrue(stop.ret().ctrl() instanceof CProjNode);
+ assertEquals("return Phi(Loop7,arg,(Phi_arg+1));", stop.toString());
+ assertTrue(stop.ret().ctrl() instanceof ProjNode);
}
@@ -118,8 +118,8 @@ while(arg < 10) {
return arg;
""");
StopNode stop = parser.parse().iterate();
- assertEquals("return Phi(Loop9,arg,(Phi_arg+1));", stop.toString());
- assertTrue(stop.ret().ctrl() instanceof CProjNode);
+ assertEquals("return Phi(Loop7,arg,(Phi_arg+1));", stop.toString());
+ assertTrue(stop.ret().ctrl() instanceof ProjNode);
}
@Test
@@ -186,7 +186,7 @@ while(arg < 10) {
return a;
""");
StopNode stop = parser.parse().iterate();
- assertEquals("return Phi(Region30,Phi(Loop10,1,(Phi_a+1)),Add);", stop.toString());
+ assertEquals("return Phi(Region29,Phi(Loop8,1,(Phi_a+1)),Add);", stop.toString());
assertTrue(stop.ret().ctrl() instanceof RegionNode);
}
@@ -202,8 +202,8 @@ while(1) {
return a;
""");
StopNode stop = parser.parse().iterate();
- assertEquals("return (Phi(Loop10,1,Add)+1);", stop.toString());
- assertTrue(stop.ret().ctrl() instanceof CProjNode prj && prj._idx==1 );
+ assertEquals("return (Phi(Loop8,1,Add)+1);", stop.toString());
+ assertTrue(stop.ret().ctrl() instanceof ProjNode prj && prj._idx==1 );
}
}
diff --git a/chapter11/src/test/java/com/seaofnodes/simple/Chapter09Test.java b/chapter11/src/test/java/com/seaofnodes/simple/Chapter09Test.java
index 7af2fa3d..1b1920e8 100644
--- a/chapter11/src/test/java/com/seaofnodes/simple/Chapter09Test.java
+++ b/chapter11/src/test/java/com/seaofnodes/simple/Chapter09Test.java
@@ -70,7 +70,7 @@ while (arg < 10) {
return arg;
""");
StopNode stop = parser.parse().iterate();
- assertEquals("return Phi(Loop10,arg,(Phi_arg+2));", stop.toString());
+ assertEquals("return Phi(Loop8,arg,(Phi_arg+2));", stop.toString());
Assert.assertEquals(11L, Evaluator.evaluate(stop, 1));
}
@@ -87,7 +87,7 @@ while (arg < 10) {
return arg;
""");
StopNode stop = parser.parse().iterate();
- assertEquals("return Phi(Loop11,arg,(Phi_arg+4));", stop.toString());
+ assertEquals("return Phi(Loop9,arg,(Phi_arg+4));", stop.toString());
Assert.assertEquals(13L, Evaluator.evaluate(stop, 1));
}
@@ -116,7 +116,7 @@ while (arg) {
return arg;
""");
StopNode stop = parser.parse().iterate();
- assertEquals("return Phi(Loop17,arg,(Phi_arg+1));", stop.toString());
+ assertEquals("return Phi(Loop15,arg,(Phi_arg+1));", stop.toString());
}
@Test
@@ -134,14 +134,14 @@ while(v1+arg) {
}
""");
StopNode stop = parser.parse().iterate();
- assertEquals("Stop[ return 0; return 0; ]", stop.toString());
+ assertEquals("Stop[ ]", stop.toString());
}
@Test
public void testWhile0() {
Parser parser = new Parser("while(0) continue; if(0) arg=0;");
StopNode stop = parser.parse().iterate();
- assertEquals("return 0;", stop.toString());
+ assertEquals("Stop[ ]", stop.toString());
}
@Test
@@ -153,7 +153,7 @@ if(0) while(0) {
}
""");
StopNode stop = parser.parse().iterate();
- assertEquals("return 0;", stop.toString());
+ assertEquals("Stop[ ]", stop.toString());
}
@@ -186,7 +186,7 @@ while(arg) {
return a;
""");
StopNode stop = parser.parse().iterate();
- assertEquals("return Phi(Loop12,0,(-(Phi_a+3)));", stop.toString());
+ assertEquals("return Phi(Loop10,0,(-(Phi_a+3)));", stop.toString());
}
@Test
@@ -200,7 +200,7 @@ int v0=0!=0<-0;
return -0+0+0;
""");
StopNode stop = parser.parse().iterate();
- assertEquals("return 0;", stop.toString());
+ assertEquals("Stop[ ]", stop.toString());
}
@@ -215,7 +215,7 @@ return -0+0+0;
public void testFuzz3() {
Parser parser = new Parser("int v0=0; while(0==69) while(v0) return 0;");
StopNode stop = parser.parse().iterate();
- assertEquals("return 0;", stop.toString());
+ assertEquals("Stop[ ]", stop.toString());
}
@Test
@@ -227,7 +227,7 @@ while(1) {
}
""");
StopNode stop = parser.parse().iterate();
- assertEquals("return 0;", stop.toString());
+ assertEquals("Stop[ ]", stop.toString());
}
@Test
@@ -249,19 +249,18 @@ while(1) {
return 0!=0;
""");
StopNode stop = parser.parse().iterate();
- assertEquals("return 0;", stop.toString());
+ assertEquals("Stop[ ]", stop.toString());
}
@Test
public void testFuzz6() {
- Parser parser = new Parser(
-"""
+ Parser parser = new Parser("""
int v0=0;
while(0==1) while(v0)
v0=1+v0;
-""");
+ """);
StopNode stop = parser.parse().iterate();
- assertEquals("return 0;", stop.toString());
+ assertEquals("Stop[ ]", stop.toString());
}
@Test
@@ -277,14 +276,14 @@ while(1)
return v1+v0;
""");
StopNode stop = parser.parse().iterate();
- assertEquals("return 0;", stop.toString());
+ assertEquals("Stop[ ]", stop.toString());
}
@Test
public void testFuzz8() {
Parser parser = new Parser("while(arg) arg = arg - 1; return arg;");
StopNode stop = parser.parse().iterate();
- assertEquals("return Phi(Loop9,arg,(Phi_arg-1));", stop.toString());
+ assertEquals("return Phi(Loop7,arg,(Phi_arg-1));", stop.toString());
}
@Test
diff --git a/chapter11/src/test/java/com/seaofnodes/simple/Chapter10Test.java b/chapter11/src/test/java/com/seaofnodes/simple/Chapter10Test.java
index 0da695a0..8bf1debe 100644
--- a/chapter11/src/test/java/com/seaofnodes/simple/Chapter10Test.java
+++ b/chapter11/src/test/java/com/seaofnodes/simple/Chapter10Test.java
@@ -2,11 +2,15 @@ package com.seaofnodes.simple;
import com.seaofnodes.simple.node.Node;
import com.seaofnodes.simple.node.StopNode;
+import com.seaofnodes.simple.type.*;
import com.seaofnodes.simple.node.LoadNode;
import com.seaofnodes.simple.node.StoreNode;
import com.seaofnodes.simple.evaluator.Evaluator;
import java.util.BitSet;
import org.junit.Test;
+
+import java.util.Arrays;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
@@ -165,7 +169,7 @@ while (arg) {
return bar.a;
""");
StopNode stop = parser.parse().iterate();
- assertEquals("return Phi(Loop12,0,(Phi_a+2));", stop.toString());
+ assertEquals("return Phi(Loop11,0,(Phi_a+2));", stop.toString());
}
@Test
@@ -217,7 +221,7 @@ if( bar ) bar.a = 1;
return bar;
""");
StopNode stop = parser.parse().iterate();
- assertEquals("return Phi(Region17,null,new Bar);", stop.toString());
+ assertEquals("return Phi(Region16,null,new Bar);", stop.toString());
}
@Test
@@ -233,7 +237,7 @@ else bar.a = 1;
return rez;
""");
StopNode stop = parser.parse().iterate();
- assertEquals("return Phi(Region35,4,3);", stop.toString());
+ assertEquals("return Phi(Region34,4,3);", stop.toString());
}
@Test
@@ -250,8 +254,7 @@ while(arg) {
return ret;
""");
try { parser.parse().iterate(); fail(); }
- catch( Exception e ) {
- assertEquals("Might be null accessing 'v0'", e.getMessage()); }
+ catch( Exception e ) { assertEquals("Might be null accessing 'v0'", e.getMessage()); }
}
@Test
@@ -287,7 +290,7 @@ while( i.x < i.len ) {
return sum;
""");
StopNode stop = parser.parse().iterate();
- assertEquals("return Phi(Loop17,0,(Phi(Loop,0,(Phi_x+1))+Phi_sum));", stop.toString());
+ assertEquals("return Phi(Loop16,0,(Phi(Loop,0,(Phi_x+1))+Phi_sum));", stop.toString());
}
@@ -303,12 +306,11 @@ while(arg) {
v0.v0 = arg;
arg = arg-1;
if (arg==5) ret=v0;
-
}
return ret;
""");
StopNode stop = parser.parse().iterate();
- assertEquals("return Phi(Loop12,new s0,Phi(Region34,new s0,Phi_ret));", stop.toString());
+ assertEquals("return Phi(Loop11,new s0,Phi(Region34,new s0,Phi_ret));", stop.toString());
}
@Test
@@ -321,7 +323,6 @@ while(arg) {
v0.v0 = arg;
arg = arg-1;
if (arg==5) ret=v0;
-
}
return ret;
""");
@@ -343,7 +344,7 @@ while(arg < 10) {
return ret;
""");
StopNode stop = parser.parse().iterate();
- assertEquals("return Phi(Loop12,new s0,Phi(Region32,new s0,Phi_ret));", stop.toString());
+ assertEquals("return Phi(Loop11,new s0,Phi(Region32,new s0,Phi_ret));", stop.toString());
}
@Test
@@ -373,7 +374,7 @@ if(0) {
}
""");
StopNode stop = parser.parse().iterate();
- assertEquals("return 0;", stop.toString());
+ assertEquals("Stop[ ]", stop.toString());
}
@Test
@@ -447,7 +448,7 @@ while(0) {}
}
""");
StopNode stop = parser.parse().iterate();
- assertEquals("return 0;", stop.toString());
+ assertEquals("Stop[ ]", stop.toString());
}
@Test
@@ -461,6 +462,7 @@ return 0;
assertEquals("return 0;", stop.toString());
}
+
@Test public void testReadBeforeStores() {
var stop = new Parser("""
struct S { int x; int y; }
@@ -547,8 +549,8 @@ return 0;
if (arg) s.x=arg+1; else s.x=arg+2;
return s;
""").parse().iterate();
- // These chapters still bind struct Stores to branch control.
- assertEquals(3,countMemoryNodes(stop,StoreNode.class,new BitSet()));
+ // The initializing slice also remains live as the aggregate default.
+ assertEquals(2,countMemoryNodes(stop,StoreNode.class,new BitSet()));
assertEquals(2L,((Evaluator.Obj)Evaluator.evaluate(stop,0)).fields()[0]);
assertEquals(4L,((Evaluator.Obj)Evaluator.evaluate(stop,3)).fields()[0]);
}
diff --git a/chapter11/src/test/java/com/seaofnodes/simple/Chapter10bTest.java b/chapter11/src/test/java/com/seaofnodes/simple/Chapter10bTest.java
deleted file mode 100644
index 6f094cfb..00000000
--- a/chapter11/src/test/java/com/seaofnodes/simple/Chapter10bTest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package com.seaofnodes.simple;
-
-import com.seaofnodes.simple.node.*;
-import com.seaofnodes.simple.evaluator.Evaluator;
-import org.junit.Test;
-import static org.junit.Assert.*;
-
-public class Chapter10bTest {
- @Test public void testIndependentField() {
- var stop = new Parser("""
- struct S { int x; int y; }
- S s = new S;
- s.x = 42;
- while (arg > 0) { s.y = s.y + arg; arg = arg - 1; }
- return s.x;
- """).parse().iterate();
- assertEquals("return 42;",stop.toString());
- assertEquals(42L,Evaluator.evaluate(stop,5));
- assertNull(stop.walk(n -> n instanceof LoadNode ? n : null));
- }
-
- @Test public void testParallelMemoryPhis() {
- var stop = new Parser("""
- struct S { int x; int y; int z; }
- S a = new S; S b = new S;
- S p = a; if (arg) p = b;
- while (arg > 0) {
- a.x = p.x + arg;
- a.y = p.y + 2;
- a.z = p.z + 3;
- arg = arg - 1;
- }
- return a;
- """).parse().iterate();
- int[] phis = {0};
- stop.walk(n -> {
- if (n instanceof MemPhiNode) phis[0]++;
- if (n instanceof MemMergeNode m && m.in(1) instanceof BulkMemPhiNode b)
- for(int a=b._aliases.nextSetBit(0); a>=0; a=b._aliases.nextSetBit(a+1))
- assertTrue(a<m.nIns() && m.in(a)!=null);
- assertFalse(n instanceof PhiNode && n.isMem() &&
- !(n instanceof MemPhiNode) && !(n instanceof BulkMemPhiNode));
- return null;
- });
- assertTrue(phis[0]>=3);
- assertArrayEquals(new Object[]{1L,2L,3L},((Evaluator.Obj)Evaluator.evaluate(stop,4)).fields());
- }
-
- @Test public void testLateSliceWorklist() throws ReflectiveOperationException {
- // Seed 97 exposed a store selecting a bulk predecessor without queuing
- // it. Keep both the worklist assertion and the final heap check.
- for (int seed : new int[]{0,97,123,456}) {
- var parser = new Parser(Chapter10Test.NESTED_MEMORY);
- var field = IterPeeps.class.getDeclaredField("WORK");
- field.setAccessible(true);
- Object work = field.get(null);
- field = work.getClass().getDeclaredField("_R");
- field.setAccessible(true);
- ((java.util.Random)field.get(work)).setSeed(seed);
- var stop = parser.parse().iterate();
- assertArrayEquals(new Object[]{9L,25L,17L},((Evaluator.Obj)Evaluator.evaluate(stop,4)).fields());
- }
- }
-}
diff --git a/chapter11/src/test/java/com/seaofnodes/simple/Chapter11Test.java b/chapter11/src/test/java/com/seaofnodes/simple/Chapter11Test.java
index 4c2b42f1..5f92c9c1 100644
--- a/chapter11/src/test/java/com/seaofnodes/simple/Chapter11Test.java
+++ b/chapter11/src/test/java/com/seaofnodes/simple/Chapter11Test.java
@@ -1,567 +1,64 @@
package com.seaofnodes.simple;
-
+import com.seaofnodes.simple.node.*;
import com.seaofnodes.simple.evaluator.Evaluator;
-import com.seaofnodes.simple.node.StopNode;
import org.junit.Test;
-
-
-import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.*;
public class Chapter11Test {
-
- // A placeholder test used to rapidly rotate through fuzzer produced issues
- @Test
- public void testFuzzer() {
- Parser parser = new Parser(
-"""
-while(-----arg) {
- while(-arg) {
- while(-----arg*---0) {
- int N=--false==false<--arg;
- while(N<-4==N) {
- N=N+N;
- }
- }
- {
- int kzEl_r7EYz=3*----0!=-arg<(37*--97!=0/arg==arg)<=-(--arg!=0);
- while(kzEl_r7EYz<---1) {
- kzEl_r7EYz=kzEl_r7EYz+kzEl_r7EYz*arg>=24;
- if(7) continue;
- kzEl_r7EYz=false;
- if(-kzEl_r7EYz+arg<-3) continue;
- else {
- while(kzEl_r7EYz) continue;
- arg=----3;
- kzEl_r7EYz=-(-----arg*1>-kzEl_r7EYz);
- int v2uF_4ba=9;
- }
- }
- }
- int pjcp7rv=arg;
- {
- int m2ya3=--arg-pjcp7rv;
- while(m2ya3<-----pjcp7rv>=pjcp7rv+--pjcp7rv!=---pjcp7rv!=-arg<---(-m2ya3)>m2ya3<=-----true>14!=--m2ya3) {
- m2ya3=m2ya3+-(--0<=false<pjcp7rv/arg<=-true);
- while((--m2ya3)<--arg<-----arg*false!=arg<pjcp7rv*arg) {
- pjcp7rv=-3+-arg;
- break;
- }
- while(-3) {
- while(67+0-61) m2ya3=m2ya3;
- if(----pjcp7rv==---(---arg)) pjcp7rv=0!=-23;
- else pjcp7rv=----89;
- while(m2ya3!=m2ya3<pjcp7rv) m2ya3=1;
- while(--arg<=pjcp7rv) pjcp7rv=-32<=-m2ya3+62;
- }
- break;
- }
- }
- {
- int arg=-1<-9!=(-arg>=-pjcp7rv>=arg<=arg);
- while(arg<-arg) {
- arg=arg+--arg;
- {
- while((--93)--pjcp7rv*-pjcp7rv+arg) arg=0-(6>=(--(---41/(0))!=--pjcp7rv)>=---2*33);
- pjcp7rv=11;
- int c=pjcp7rv;
- if(--107) break;
- else break;
- }
- }
- }
- pjcp7rv=pjcp7rv;
- int aR0Wkua=-pjcp7rv==pjcp7rv;
- {
- if(-0!=-0) while(-true) break;
- else {
- while(aR0Wkua) pjcp7rv=-0/pjcp7rv;
- pjcp7rv=pjcp7rv;
- }
- }
- }
- if(-arg) {
- {
- int Isdlt0fr91=0!=arg;
- while(Isdlt0fr91<-Isdlt0fr91==-Isdlt0fr91+true) {
- Isdlt0fr91=Isdlt0fr91+-1!=true;
- if(-arg) if(--arg<=Isdlt0fr91) Isdlt0fr91=-Isdlt0fr91;
- int i=---arg<---arg!=--40;
- {
- int jVX43Ln4Dm=-(6)==-Isdlt0fr91/----0;
- while(jVX43Ln4Dm<--(3-3)) {
- jVX43Ln4Dm=jVX43Ln4Dm+-0<25;
- i=24<--(jVX43Ln4Dm);
- }
- }
- i=(arg!=----false>=7);
- int Te=5>-arg;
- break;
- }
- }
- arg=arg!=--true/arg;
- {
- int UX=arg;
- while(UX<-3*arg) {
- UX=UX+arg/-1;
- arg=-3--(-UX--47<arg==--arg==arg)/arg--UX>=-arg;
- if(---12) while(-UX) break;
- break;
- }
- }
- continue;
- }
- if(arg) arg=--0;
- else if(1) continue;
- int DtTlhjYq=19==arg;
- {
- arg=--DtTlhjYq<=(DtTlhjYq/---DtTlhjYq<=-DtTlhjYq);
- if(---arg) continue;
- else {
- int Zsl=40;
- while(Zsl<--Zsl--false>((Zsl))==Zsl!=--DtTlhjYq-DtTlhjYq-DtTlhjYq) {
- Zsl=Zsl+arg;
- }
- }
- if((arg)) if(-DtTlhjYq) {
- }
- else while(((2)==3*arg/DtTlhjYq)<=0==---arg) return false;
- else {
- int lwbF=arg>=0;
- while(lwbF<57) {
- lwbF=lwbF+--(-arg+lwbF)>=-2>=arg!=arg;
- arg=----0+0;
- while(49) break;
- if(true) DtTlhjYq=-----arg;
- DtTlhjYq=0!=-----(0);
- }
- }
- arg=---arg!=DtTlhjYq/--0;
- DtTlhjYq=-DtTlhjYq/(--arg<arg);
- if(32) {
- int q=-DtTlhjYq;
- while(q<arg*(0*q)/0) {
- q=q+DtTlhjYq;
- DtTlhjYq=arg;
- }
- }
- else if(--arg) if(15) break;
- else arg=0==arg<=-55>DtTlhjYq;
- else {
- }
- DtTlhjYq=-0;
- {
- while((0)<-arg) DtTlhjYq=-DtTlhjYq;
- }
- if(30/--(arg)>=0) DtTlhjYq=-0>=arg;
- else {
- int Y2wcIQJ=--DtTlhjYq*---11;
- if(arg==arg) {
- Y2wcIQJ=-----Y2wcIQJ;
- Y2wcIQJ=Y2wcIQJ<7;
- if(DtTlhjYq) arg=arg;
- else break;
- while(-arg!=-31==(false<=-15>=-DtTlhjYq+--6*-----Y2wcIQJ<=---arg!=-Y2wcIQJ<=---0<-arg*--Y2wcIQJ)) DtTlhjYq=arg!=3;
- }
- continue;
- }
- arg=DtTlhjYq;
- arg=--3/(---arg)>=80>=-DtTlhjYq<=DtTlhjYq;
- arg=51+---(-true)!=arg!=----1==-DtTlhjYq;
- if(11<=arg) if((arg)+79<32+(-arg)) continue;
- else if(true==DtTlhjYq) break;
- break;
- }
-}
-if(arg!=62==arg) {
- while(---arg) {
- {
- int bhmDacPM=arg/arg;
- while(bhmDacPM<arg) {
- bhmDacPM=bhmDacPM+80*((-bhmDacPM)/---bhmDacPM>1)<bhmDacPM-2!=7;
- arg=-0;
- arg=bhmDacPM>=-arg+-arg;
- break;
- }
- }
- int arg=true;
- arg=arg<=arg;
- {
- int KlC=30;
- while(KlC<-2) {
- KlC=KlC+-1!=25<=-KlC>KlC>----0;
- int Ij=arg>=-arg<=---10;
- {
- int LAbgurVa2R=-arg!=Ij;
- while(LAbgurVa2R<-true) {
- LAbgurVa2R=LAbgurVa2R+Ij;
- KlC=-LAbgurVa2R;
- Ij=42*(-Ij>true);
- while(Ij) arg=KlC;
- KlC=-----7>-(--KlC<--7)==-LAbgurVa2R;
- }
- }
- int a=Ij<=-KlC;
- if(Ij) {
- int r1W=a!=-false;
- }
- else {
- arg=56>=Ij;
- while(54) break;
- arg=8>=-(a<--Ij)/a>=-a-KlC;
- }
- int Yt_T=KlC;
- arg=KlC;
- }
- }
- if(----false/--arg/12+-----0) if(-9+-arg) while(arg!=(arg)) arg=--1>=-71-arg!=---(--arg*11+102)/--arg;
- else if(----arg) continue;
- if(-arg-arg) {
- arg=-(-arg)*--(-3)<(-7==-arg----arg);
- {
- int arg=arg;
- while(arg<-0>arg==-arg-(-arg>1+11)) {
- arg=arg+6-arg!=--0>---30>=---arg<=arg/(3)+---arg;
- }
- }
- arg=-arg+arg;
- arg=--47+-arg<1>arg*(-arg==-arg--0>3);
- arg=(----arg)!=arg+--59;
- arg=--4+arg==-(arg)-arg;
- }
- else {
- while(--true-----true*-25+-18>arg>=-----(-arg)---13) {
- arg=-0+--true<false;
- continue;
- }
- arg=true<=arg;
- break;
- }
- arg=arg*22<--(0+-arg);
- {
- continue;
- }
- }
- arg=1*---((3<=true)==---2);
- arg=7+-(-1);
- return arg+--true;
-}
-else {
- int o3ypEsewxM=-(---arg);
- int vzXB=(-(---11<=--o3ypEsewxM>=--0))<=-0/-arg;
- int L=-arg;
- int B4mHcrf=---vzXB;
- int oZWGdzZl=-o3ypEsewxM;
- int K6tQqa1=11;
- while(0!=--L) {
- int sdZfTM=vzXB*true+K6tQqa1;
- while(sdZfTM<false) {
- sdZfTM=sdZfTM+arg;
- sdZfTM=oZWGdzZl;
- K6tQqa1=-K6tQqa1;
- arg=---K6tQqa1;
- while((3+-K6tQqa1)<oZWGdzZl) {
- if(-----(-1)) sdZfTM=-false;
- {}
- }
- K6tQqa1=vzXB!=-(B4mHcrf+-7>false);
- sdZfTM=vzXB;
- }
- }
- L=false;
- while(31) B4mHcrf=arg;
- oZWGdzZl=-0<--oZWGdzZl<=--2;
- if(K6tQqa1>=20<=46) {
- if(-1+-L) if(oZWGdzZl) {
- int wmhv=-----0;
- }
- int arg=0;
- o3ypEsewxM=---(oZWGdzZl);
- return -oZWGdzZl/0;
- }
- else if(arg) {
- int yKk5=B4mHcrf>=4>K6tQqa1<-B4mHcrf/o3ypEsewxM;
- return -K6tQqa1;
- }
- else {
- if(---0) {
- {}
- {}
- }
- return o3ypEsewxM;
+ @Test public void testIndependentField() {
+ var stop = new Parser("""
+ struct S { int x; int y; }
+ S s = new S;
+ s.x = 42;
+ while (arg > 0) { s.y = s.y + arg; arg = arg - 1; }
+ return s.x;
+ """).parse().iterate();
+ assertEquals("return 42;",stop.toString());
+ assertEquals(42L,Evaluator.evaluate(stop,5));
+ assertNull(stop.walk(n -> n instanceof LoadNode ? n : null));
+ }
+
+ @Test public void testParallelMemoryPhis() {
+ var stop = new Parser("""
+ struct S { int x; int y; int z; }
+ S a = new S; S b = new S;
+ S p = a; if (arg) p = b;
+ while (arg > 0) {
+ a.x = p.x + arg;
+ a.y = p.y + 2;
+ a.z = p.z + 3;
+ arg = arg - 1;
+ }
+ return a;
+ """).parse().iterate();
+ int[] phis = {0};
+ stop.walk(n -> {
+ if (n instanceof MemPhiNode) phis[0]++;
+ if (n instanceof MemMergeNode m && m.in(1) instanceof BulkMemPhiNode b)
+ for(int a=b._aliases.nextSetBit(0); a>=0; a=b._aliases.nextSetBit(a+1))
+ assertTrue(a<m.nIns() && m.in(a)!=null);
+ assertFalse(n instanceof PhiNode && n.isMem() &&
+ !(n instanceof MemPhiNode) && !(n instanceof BulkMemPhiNode));
+ return null;
+ });
+ assertTrue(phis[0]>=3);
+ assertArrayEquals(new Object[]{1L,2L,3L},((Evaluator.Obj)Evaluator.evaluate(stop,4)).fields());
+ }
+
+ @Test public void testLateSliceWorklist() throws ReflectiveOperationException {
+ // Seed 97 exposed a store selecting a bulk predecessor without queuing
+ // it. Keep both the worklist assertion and the final heap check.
+ for (int seed : new int[]{0,97,123,456}) {
+ var parser = new Parser(Chapter10Test.NESTED_MEMORY);
+ var field = IterPeeps.class.getDeclaredField("WORK");
+ field.setAccessible(true);
+ Object work = field.get(null);
+ field = work.getClass().getDeclaredField("_R");
+ field.setAccessible(true);
+ ((java.util.Random)field.get(work)).setSeed(seed);
+ var stop = parser.parse().iterate();
+ assertArrayEquals(new Object[]{9L,25L,17L},((Evaluator.Obj)Evaluator.evaluate(stop,4)).fields());
}
-}
-""");
- StopNode stop = parser.parse().iterate();
- assertEquals("Stop[ return 9; return 0; return 0; ]", stop.toString());
- }
-
-
-
- @Test
- public void testPrimes() {
- Parser parser = new Parser(
-"""
-if( arg < 2 ) return 0;
-int primeCount = 1;
-int prime = 3;
-while( prime <= arg ) {
- int isPrime = 1;
- // Check for even case, so the next loop need only check odds
- if( (prime/2)*2 == prime )
- continue;
- // Check odds up to sqrt of prime
- int j = 3;
- while( j*j <= prime ) {
- if( (prime/j)*j == prime ) {
- isPrime = 0;
- break;
- }
- j = j + 2;
- }
- if( isPrime )
- primeCount = primeCount + 1;
- prime = prime + 2;
-}
-return primeCount;
-""");
- StopNode stop = parser.parse().iterate();
- assertEquals("Stop[ return 0; return Phi(Loop20,1,Phi(Region82,Phi_primeCount,Phi(Region77,(Phi_primeCount+1),Phi_primeCount))); ]", stop.toString());
- assertEquals(0L, Evaluator.evaluate(stop, 1)); // No primes 1 or below
- assertEquals(1L, Evaluator.evaluate(stop, 2)); // 2
- assertEquals(2L, Evaluator.evaluate(stop, 3)); // 2, 3
- assertEquals(2L, Evaluator.evaluate(stop, 4)); // 2, 3
- assertEquals(3L, Evaluator.evaluate(stop, 5)); // 2, 3, 5
- assertEquals(4L, Evaluator.evaluate(stop, 10)); // 2, 3, 5, 7
- }
-
- @Test
- public void testAntiDeps1() {
- Parser parser = new Parser(
-"""
-struct S { int f; }
-S v=new S;
-v.f = 2;
-int i=new S.f;
-i=v.f;
-if (arg) v.f=1;
-return i;
-""");
- StopNode stop = parser.parse().iterate();
- assertEquals("return .f;", stop.toString());
- }
-
- @Test
- public void testAntiDeps2() {
- Parser parser = new Parser(
-"""
-struct S { int f; }
-S v = new S;
-S t = new S;
-int i = 0;
-if (arg) {
- if (arg+1) v = t;
- i = v.f;
-} else {
- v.f = 2;
-}
-return i;
-""");
- StopNode stop = parser.parse().iterate();
- assertEquals("return Phi(Region34,.f,0);", stop.toString());
- }
-
- @Test
- public void testAntiDeps3() {
- Parser parser = new Parser(
-"""
-struct S { int f; }
-S v0 = new S;
-S? v1;
-if (arg) v1 = new S;
-if (v1) {
- v0.f = v1.f;
-} else {
- v0.f = 2;
-}
-return v0;
-""");
- StopNode stop = parser.parse().iterate();
- assertEquals("return new S;", stop.toString());
- }
-
-
- @Test
- public void testAntiDeps4() {
- Parser parser = new Parser(
-"""
-struct S { int f; }
-S v = new S;
-S t = new S;
-int i = v.f;
-if (arg+1) arg= 0;
-while (arg) v.f = 2;
-return i;
-""");
- StopNode stop = parser.parse().iterate();
- assertEquals("return .f;", stop.toString());
- }
-
- @Test
- public void testAntiDeps5() {
- Parser parser = new Parser(
-"""
-struct S { int f; }
-S v = new S;
-while(1) {
- while(arg+1) { arg=arg-1; }
- if (arg) break;
- v.f = 2;
-}
-return v;
-""");
- StopNode stop = parser.parse().iterate();
- assertEquals("return new S;", stop.toString());
- }
-
- @Test
- public void testAntiDeps6() {
- Parser parser = new Parser(
-"""
-struct s { int v; }
-s ptr=new s;
-while( -arg )
- ptr = new s;
-while(1)
- arg = arg+ptr.v;
-""");
- StopNode stop = parser.parse().iterate();
- assertEquals("return 0;", stop.toString());
- }
-
- @Test
- public void testAntiDeps7() {
- Parser parser = new Parser(
-"""
-struct S { int f; }
-S v = new S;
-S t = new S;
-int i = v.f;
-while (arg) {
- v.f = arg;
- arg = arg-1;
-}
-return i;
-""");
- StopNode stop = parser.parse().iterate();
- assertEquals("return .f;", stop.toString());
- }
-
- @Test
- public void testAntiDeps8() {
- Parser parser = new Parser(
-"""
-struct S { int f; }
-S v = new S;
-S t = new S;
-while(arg) {
- arg=arg-1;
- int f = v.f;
- v.f = 2;
- if (arg) arg = f;
- else v.f = 3;
-}
-return arg;
-""");
- StopNode stop = parser.parse().iterate();
- assertEquals("return Phi(Loop15,arg,Phi(Region39,.f,0));", stop.toString());
- }
-
- @Test
- public void testAntiDeps9() {
- Parser parser = new Parser(
-"""
-struct S { int f; }
-S v = new S;
-S t = new S;
-if (arg) {
- v.f=2;
- int i=t.f;
- v.f=i;
-}
-return v;
-""");
- StopNode stop = parser.parse().iterate();
- assertEquals("return new S;", stop.toString());
- }
-
- @Test
- public void testExample2() {
- Parser parser = new Parser(
- """
-struct S { int f; }
-S v = new S;
-int i = arg;
-while (arg > 0) {
- int j = i/3;
- if (arg == 5)
- v.f = j;
- arg = arg - 1;
-}
-return v;
-""");
- StopNode stop = parser.parse().iterate();
- //assertEquals("return new S;", stop.toString());
- }
-
- @Test
- public void testSplit() {
- Parser parser = new Parser(
- """
-struct S { int f; }
-S s = new S;
-if( arg==0 ) s.f = 1;
-else if (arg == 1) s.f = 1;
-return s.f;
-""");
- StopNode stop = parser.parse().iterate();
- assertEquals("return Phi(Region41,1,Phi(Region36,1,0));", stop.toString());
- assertEquals(1L, Evaluator.evaluate(stop, 0));
- assertEquals(1L, Evaluator.evaluate(stop, 1));
- assertEquals(0L, Evaluator.evaluate(stop, 2));
- }
-
- @Test
- public void testScheduleUse() {
- Parser parser = new Parser(
-"""
-int v0=0;
-while(0>=0) {
- int v1=0;
- v1=v0;
- if(v1*0)
- v0=-v1;
-}
-return 0;
-""");
- StopNode stop = parser.parse().iterate();
- assertEquals("return 0;", stop.toString());
- }
-
- @Test
- public void testLoopCarriedDep() {
- Parser parser = new Parser(
-"""
-int v0=0;
-{
- int v1=0;
- while(v1) {
- v1=1+(v0!=0);
- v0=v1/0;
- }
-}
-""");
- StopNode stop = parser.parse().iterate();
- assertEquals("return 0;", stop.toString());
}
}
diff --git a/chapter11/src/test/java/com/seaofnodes/simple/FuzzerWrap.java b/chapter11/src/test/java/com/seaofnodes/simple/FuzzerWrap.java
index 52c2a014..019140ad 100644
--- a/chapter11/src/test/java/com/seaofnodes/simple/FuzzerWrap.java
+++ b/chapter11/src/test/java/com/seaofnodes/simple/FuzzerWrap.java
@@ -29,8 +29,8 @@ public class FuzzerWrap {
fuzzer.fuzzPeepsRegression(seed);
}
- @Ignore
@Test
+ @Ignore
public void fuzzPeepsLarge() {
var fuzzer = new Fuzzer();
for (int i=0; i<1000000; i++)
diff --git a/chapter11/src/test/java/com/seaofnodes/simple/evaluator/Evaluator.java b/chapter11/src/test/java/com/seaofnodes/simple/evaluator/Evaluator.java
index 355d906b..ac7c5e09 100644
--- a/chapter11/src/test/java/com/seaofnodes/simple/evaluator/Evaluator.java
+++ b/chapter11/src/test/java/com/seaofnodes/simple/evaluator/Evaluator.java
@@ -140,8 +140,7 @@ public class Evaluator {
case StoreNode store -> store(store);
case MemMergeNode merge -> MEMORY;
case NewNode alloc -> alloc(alloc);
- case CProjNode cproj -> ((Object[])val(cproj.ctrl()))[cproj._idx];
- case ProjNode proj -> ((Object[])val( proj.in(0) ))[ proj._idx];
+ case ProjNode proj -> ((Object[])val(proj.ctrl()))[proj._idx];
default -> throw new AssertionError("Unexpected node " + node);
};
}
diff --git a/chapter11/src/test/java/com/seaofnodes/simple/evaluator/Scheduler.java b/chapter11/src/test/java/com/seaofnodes/simple/evaluator/Scheduler.java
index d16f4300..48ac0562 100644
--- a/chapter11/src/test/java/com/seaofnodes/simple/evaluator/Scheduler.java
+++ b/chapter11/src/test/java/com/seaofnodes/simple/evaluator/Scheduler.java
@@ -164,7 +164,7 @@ public class Scheduler {
* @return true if the node is not XCtrl.
*/
private static boolean isNotXCtrl(Node node) {
- return !(node instanceof ConstantNode c && c.compute() == Type.XCONTROL) && !(node instanceof XCtrlNode);
+ return !(node instanceof ConstantNode c && c.compute() == Type.XCONTROL);
}
/**
@@ -215,7 +215,7 @@ public class Scheduler {
private void refinePlacement(NodeData data, BasicBlock block) {
assert !isPinnedNode(data);
data.block = data.block == null ? block : dom(data.block, block);
- assert isValid(data);
+ assert isValid(data) : data.node.uniqueName()+" at "+data.block.entry.uniqueName();
}
/**
@@ -328,8 +328,6 @@ public class Scheduler {
for(int i=1; i<r.nIns(); i++) {
if (od(r.in(i)).map(d->d.block==null).orElse(false)) return false;
}
- } else if (node instanceof XCtrlNode) {
- return false;
} else {
assert d(node.in(0)).block != null;
}
@@ -405,7 +403,7 @@ public class Scheduler {
}
}
if (!(node instanceof ReturnNode))
- for (Node n:node._outputs) if (n!=null && n.isCFG() && isCFGNodeReady(n) && d(n).block == null) queue.push(d(n));
+ for (Node n:node._outputs) if (n.isCFG() && isCFGNodeReady(n) && d(n).block == null) queue.push(d(n));
var b = block;
for(var in:data.node._inputs) od(in).ifPresent(d->update(d, b));
}
@@ -451,7 +449,7 @@ public class Scheduler {
node = data.node;
assert node.isCFG();
if (!(node instanceof ReturnNode)) {
- for (var out : node._outputs) if (out!=null && out.isCFG() && isNotXCtrl(out)) markAlive(cfgQueue, out, true);
+ for (var out : node._outputs) if (out.isCFG() && isNotXCtrl(out)) markAlive(cfgQueue, out, true);
}
for (var in : node._inputs) if(in!=null && !in.isCFG() && isNotXCtrl(in)) markAlive(dataQueue, in, false);
}
@@ -505,7 +503,7 @@ public class Scheduler {
*/
private static Node findSingleCFGOut(Node node) {
if (node instanceof StartNode) {
- for(var n:node._outputs) if (n instanceof CProjNode p && p._idx==0) return p;
+ for(var n:node._outputs) if (n instanceof ProjNode p && p._idx==0) return p;
return null;
}
assert node._outputs.stream().filter(Node::isCFG).limit(2).count()<=1;
@@ -572,7 +570,7 @@ public class Scheduler {
switch(block.exit) {
case null: break;
case IfNode i:
- for(var out:i._outputs) if (out instanceof CProjNode p) block.next[p._idx] = blocks.get(p);
+ for(var out:i._outputs) if (out instanceof ProjNode p) block.next[p._idx] = blocks.get(p);
break;
case RegionNode r:
block.next[0] = blocks.get(r);