summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chapter10/README.md45
-rw-r--r--chapter10/docs/build-graphs.sh3
-rw-r--r--chapter10/docs/example1.drawio234
-rw-r--r--chapter10/docs/example1.gv72
-rw-r--r--chapter10/docs/example1.svg435
-rw-r--r--chapter10/docs/example2a.gv65
-rw-r--r--chapter10/docs/example2a.svg249
-rw-r--r--chapter10/docs/example2b.gv56
-rw-r--r--chapter10/docs/example2b.svg189
-rw-r--r--chapter10/docs/example2c.gv53
-rw-r--r--chapter10/docs/example2c.svg168
-rw-r--r--chapter10/src/main/java/com/seaofnodes/simple/node/LoadNode.java22
-rw-r--r--chapter10/src/main/java/com/seaofnodes/simple/node/MemOpNode.java1
-rw-r--r--chapter10/src/main/java/com/seaofnodes/simple/node/Node.java13
-rw-r--r--chapter10/src/main/java/com/seaofnodes/simple/node/PhiNode.java3
-rw-r--r--chapter10/src/main/java/com/seaofnodes/simple/node/ScopeNode.java2
-rw-r--r--chapter10/src/main/java/com/seaofnodes/simple/node/StoreNode.java26
-rw-r--r--chapter10/src/test/java/com/seaofnodes/simple/Chapter10Test.java33
18 files changed, 1149 insertions, 520 deletions
diff --git a/chapter10/README.md b/chapter10/README.md
index c4045513..a25ff011 100644
--- a/chapter10/README.md
+++ b/chapter10/README.md
@@ -254,12 +254,7 @@ To enable this behaviour, we make following enhancements.
ptr. When the input is a `null` we convert to `1` and when is a not `null`
ptr value, we convert to `0`. See `NotNode.compute()`.
-
-## Examples
-
-We now look at some examples.
-
-### Example 1
+## Memory Operations Example
This is a simple example illustrating how loads and stores are ordered based on aliasing.
@@ -279,6 +274,44 @@ The graph from above will have the shape:
![Graph1](./docs/example1.svg)
+## Additional Peephole Optimizations
+
+The equivalence aliasing makes it possible to optimize following scenarios:
+
+* Store followed by another Store to the same field inside an object; the first Store is redundant if there are no other references to the first Store
+* Load followed by a Store to a field inside an Object; the Load can be eliminated and the input value of the Store passed through.
+
+Both of these examples are illustrated in the example below:
+
+```java
+struct Bar {
+ int a;
+ int b;
+}
+struct Foo {
+ int x;
+}
+Foo? foo = null;
+Bar bar = new Bar;
+bar.a = 1;
+bar.a = 2;
+return bar.a;
+```
+
+Before the peephole optimizations, we get:
+
+![Graph2a](./docs/example2a.svg)
+
+After enabling Store-Store peephole we get:
+
+![Graph2b](./docs/example2b.svg)
+
+After load-after-store elision:
+
+![Graph2c](./docs/example2c.svg)
+
+Note that at this stage the `bar` object is dead therefore the allocation of bar can be dropped.
+
[^1]: Diwan A., McKinley K.S., Moss J.E.B. (1998).
Type Based Alias Analysis. \ No newline at end of file
diff --git a/chapter10/docs/build-graphs.sh b/chapter10/docs/build-graphs.sh
index 853f50f7..8f6afed7 100644
--- a/chapter10/docs/build-graphs.sh
+++ b/chapter10/docs/build-graphs.sh
@@ -1,3 +1,6 @@
dot -Tsvg example1.gv > example1.svg
+dot -Tsvg example2a.gv > example2a.svg
+dot -Tsvg example2b.gv > example2b.svg
+dot -Tsvg example2c.gv > example2c.svg
dot -Tsvg lattice.gv > lattice.svg
diff --git a/chapter10/docs/example1.drawio b/chapter10/docs/example1.drawio
deleted file mode 100644
index b3b408c5..00000000
--- a/chapter10/docs/example1.drawio
+++ /dev/null
@@ -1,234 +0,0 @@
-<mxfile host="65bd71144e">
- <diagram id="pVfa21MziEbxiRWqA5Sa" name="Page-1">
- <mxGraphModel dx="1780" dy="907" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
- <root>
- <mxCell id="0"/>
- <mxCell id="1" parent="0"/>
- <mxCell id="2" value="" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
- <mxGeometry x="280" y="20" width="160" height="90" as="geometry"/>
- </mxCell>
- <mxCell id="3" value="Start" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#e3c800;fontColor=#000000;strokeColor=#B09500;" vertex="1" parent="1">
- <mxGeometry x="280" y="20" width="160" height="40" as="geometry"/>
- </mxCell>
- <mxCell id="4" value="$ctrl" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#e3c800;fontColor=#000000;strokeColor=#B09500;" vertex="1" parent="1">
- <mxGeometry x="290" y="70" width="40" height="30" as="geometry"/>
- </mxCell>
- <mxCell id="5" value="arg" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
- <mxGeometry x="340" y="70" width="40" height="30" as="geometry"/>
- </mxCell>
- <mxCell id="6" value="Mem" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
- <mxGeometry x="390" y="70" width="40" height="30" as="geometry"/>
- </mxCell>
- <mxCell id="8" style="edgeStyle=none;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="7" target="6">
- <mxGeometry relative="1" as="geometry"/>
- </mxCell>
- <mxCell id="7" value="new Vec2D" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
- <mxGeometry x="360" y="210" width="100" height="40" as="geometry"/>
- </mxCell>
- <mxCell id="9" value="#1" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;" vertex="1" parent="1">
- <mxGeometry x="720" y="200" width="80" height="80" as="geometry"/>
- </mxCell>
- <mxCell id="12" style="edgeStyle=none;html=1;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="10" target="51">
- <mxGeometry relative="1" as="geometry">
- <mxPoint x="385" y="270" as="targetPoint"/>
- <Array as="points">
- <mxPoint x="550" y="360"/>
- </Array>
- </mxGeometry>
- </mxCell>
- <mxCell id="13" style="edgeStyle=none;html=1;exitX=0.75;exitY=0;exitDx=0;exitDy=0;" edge="1" parent="1" source="10" target="9">
- <mxGeometry relative="1" as="geometry">
- <mxPoint x="550" y="230" as="targetPoint"/>
- </mxGeometry>
- </mxCell>
- <mxCell id="10" value="Store .x" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
- <mxGeometry x="650" y="350" width="120" height="60" as="geometry"/>
- </mxCell>
- <mxCell id="11" value="alias 1" style="endArrow=classic;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;" edge="1" parent="1" source="10" target="52">
- <mxGeometry width="50" height="50" relative="1" as="geometry">
- <mxPoint x="420" y="290" as="sourcePoint"/>
- <mxPoint x="470" y="240" as="targetPoint"/>
- <Array as="points">
- <mxPoint x="610" y="290"/>
- </Array>
- </mxGeometry>
- </mxCell>
- <mxCell id="14" value="" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
- <mxGeometry x="275" y="410" width="90" height="80" as="geometry"/>
- </mxCell>
- <mxCell id="15" value="" style="curved=1;endArrow=classic;html=1;" edge="1" parent="1" source="39" target="5">
- <mxGeometry width="50" height="50" relative="1" as="geometry">
- <mxPoint x="170" y="200" as="sourcePoint"/>
- <mxPoint x="450" y="370" as="targetPoint"/>
- <Array as="points"/>
- </mxGeometry>
- </mxCell>
- <mxCell id="16" value="If" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#e3c800;fontColor=#000000;strokeColor=#B09500;" vertex="1" parent="1">
- <mxGeometry x="275" y="410" width="90" height="30" as="geometry"/>
- </mxCell>
- <mxCell id="17" value="T" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#e3c800;fontColor=#000000;strokeColor=#B09500;" vertex="1" parent="1">
- <mxGeometry x="285" y="450" width="30" height="30" as="geometry"/>
- </mxCell>
- <mxCell id="18" value="F" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#e3c800;fontColor=#000000;strokeColor=#B09500;" vertex="1" parent="1">
- <mxGeometry x="325" y="450" width="30" height="30" as="geometry"/>
- </mxCell>
- <mxCell id="19" value="Store .y" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
- <mxGeometry x="110" y="430" width="120" height="60" as="geometry"/>
- </mxCell>
- <mxCell id="20" value="" style="endArrow=classic;html=1;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="19" target="52">
- <mxGeometry width="50" height="50" relative="1" as="geometry">
- <mxPoint x="170" y="480" as="sourcePoint"/>
- <mxPoint x="220" y="430" as="targetPoint"/>
- <Array as="points">
- <mxPoint x="290" y="360"/>
- </Array>
- </mxGeometry>
- </mxCell>
- <mxCell id="21" value="alias 2" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="20">
- <mxGeometry x="-0.2147" y="-1" relative="1" as="geometry">
- <mxPoint x="-15" y="30" as="offset"/>
- </mxGeometry>
- </mxCell>
- <mxCell id="22" value="#2" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;" vertex="1" parent="1">
- <mxGeometry x="60" y="295" width="80" height="80" as="geometry"/>
- </mxCell>
- <mxCell id="23" value="" style="endArrow=classic;html=1;" edge="1" parent="1" source="19" target="22">
- <mxGeometry width="50" height="50" relative="1" as="geometry">
- <mxPoint x="140" y="430" as="sourcePoint"/>
- <mxPoint x="190" y="380" as="targetPoint"/>
- </mxGeometry>
- </mxCell>
- <mxCell id="24" value="" style="endArrow=classic;html=1;" edge="1" parent="1" source="19" target="51">
- <mxGeometry width="50" height="50" relative="1" as="geometry">
- <mxPoint x="200" y="430" as="sourcePoint"/>
- <mxPoint x="380" y="280" as="targetPoint"/>
- <Array as="points">
- <mxPoint x="270" y="290"/>
- </Array>
- </mxGeometry>
- </mxCell>
- <mxCell id="29" style="edgeStyle=none;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="25" target="27">
- <mxGeometry relative="1" as="geometry"/>
- </mxCell>
- <mxCell id="25" value="Store .y" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
- <mxGeometry x="440" y="490" width="90" height="60" as="geometry"/>
- </mxCell>
- <mxCell id="26" value="" style="endArrow=classic;html=1;" edge="1" parent="1" source="25" target="51">
- <mxGeometry width="50" height="50" relative="1" as="geometry">
- <mxPoint x="400" y="420" as="sourcePoint"/>
- <mxPoint x="430" y="300" as="targetPoint"/>
- </mxGeometry>
- </mxCell>
- <mxCell id="27" value="#3" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;" vertex="1" parent="1">
- <mxGeometry x="540" y="420" width="80" height="80" as="geometry"/>
- </mxCell>
- <mxCell id="28" value="alias 2" style="endArrow=classic;html=1;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="25" target="52">
- <mxGeometry width="50" height="50" relative="1" as="geometry">
- <mxPoint x="320" y="520" as="sourcePoint"/>
- <mxPoint x="350" y="450" as="targetPoint"/>
- <Array as="points">
- <mxPoint x="480" y="350"/>
- </Array>
- </mxGeometry>
- </mxCell>
- <mxCell id="30" value="Region" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#e3c800;fontColor=#000000;strokeColor=#B09500;" vertex="1" parent="1">
- <mxGeometry x="250" y="600" width="120" height="60" as="geometry"/>
- </mxCell>
- <mxCell id="31" value="" style="endArrow=classic;html=1;entryX=0.5;entryY=1;entryDx=0;entryDy=0;exitX=0.392;exitY=-0.064;exitDx=0;exitDy=0;exitPerimeter=0;fillColor=#a20025;strokeColor=#6F0000;" edge="1" parent="1" source="30" target="17">
- <mxGeometry width="50" height="50" relative="1" as="geometry">
- <mxPoint x="265" y="570" as="sourcePoint"/>
- <mxPoint x="315" y="520" as="targetPoint"/>
- </mxGeometry>
- </mxCell>
- <mxCell id="32" value="" style="endArrow=classic;html=1;exitX=0.75;exitY=0;exitDx=0;exitDy=0;fillColor=#a20025;strokeColor=#6F0000;" edge="1" parent="1" source="30" target="18">
- <mxGeometry width="50" height="50" relative="1" as="geometry">
- <mxPoint x="310" y="570" as="sourcePoint"/>
- <mxPoint x="360" y="520" as="targetPoint"/>
- </mxGeometry>
- </mxCell>
- <mxCell id="35" style="edgeStyle=none;html=1;exitX=1;exitY=1;exitDx=0;exitDy=0;" edge="1" parent="1" source="33" target="30">
- <mxGeometry relative="1" as="geometry"/>
- </mxCell>
- <mxCell id="33" value="phi" style="ellipse;whiteSpace=wrap;html=1;fillColor=#fad7ac;strokeColor=#b46504;fontColor=#0e0101;" vertex="1" parent="1">
- <mxGeometry x="90" y="540" width="120" height="80" as="geometry"/>
- </mxCell>
- <mxCell id="36" value="" style="endArrow=classic;html=1;" edge="1" parent="1" source="33" target="19">
- <mxGeometry width="50" height="50" relative="1" as="geometry">
- <mxPoint x="170" y="560" as="sourcePoint"/>
- <mxPoint x="220" y="510" as="targetPoint"/>
- </mxGeometry>
- </mxCell>
- <mxCell id="37" value="" style="endArrow=classic;html=1;" edge="1" parent="1" source="33" target="25">
- <mxGeometry width="50" height="50" relative="1" as="geometry">
- <mxPoint x="170" y="560" as="sourcePoint"/>
- <mxPoint x="220" y="510" as="targetPoint"/>
- </mxGeometry>
- </mxCell>
- <mxCell id="38" value="" style="curved=1;endArrow=classic;html=1;startArrow=none;fillColor=#a20025;strokeColor=#6F0000;" edge="1" parent="1" source="16" target="4">
- <mxGeometry width="50" height="50" relative="1" as="geometry">
- <mxPoint x="295" y="330" as="sourcePoint"/>
- <mxPoint x="307.14285714285734" y="80" as="targetPoint"/>
- <Array as="points"/>
- </mxGeometry>
- </mxCell>
- <mxCell id="39" value="==" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;" vertex="1" parent="1">
- <mxGeometry x="130" y="180" width="80" height="80" as="geometry"/>
- </mxCell>
- <mxCell id="41" value="#1" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;" vertex="1" parent="1">
- <mxGeometry x="50" y="60" width="80" height="80" as="geometry"/>
- </mxCell>
- <mxCell id="42" value="" style="endArrow=classic;html=1;" edge="1" parent="1" source="39" target="41">
- <mxGeometry width="50" height="50" relative="1" as="geometry">
- <mxPoint x="140" y="150" as="sourcePoint"/>
- <mxPoint x="190" y="100" as="targetPoint"/>
- </mxGeometry>
- </mxCell>
- <mxCell id="49" style="edgeStyle=none;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;fontColor=default;fillColor=#e51400;strokeColor=#B20000;" edge="1" parent="1" source="43" target="30">
- <mxGeometry relative="1" as="geometry"/>
- </mxCell>
- <mxCell id="43" value="Return" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#e3c800;fontColor=#000000;strokeColor=#B09500;" vertex="1" parent="1">
- <mxGeometry x="250" y="850" width="120" height="60" as="geometry"/>
- </mxCell>
- <mxCell id="44" value="Merge Mem" style="rounded=0;whiteSpace=wrap;html=1;fontColor=default;" vertex="1" parent="1">
- <mxGeometry x="365" y="730" width="120" height="60" as="geometry"/>
- </mxCell>
- <mxCell id="45" value="" style="endArrow=classic;html=1;fontColor=default;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" target="51">
- <mxGeometry width="50" height="50" relative="1" as="geometry">
- <mxPoint x="410" y="730" as="sourcePoint"/>
- <mxPoint x="400" y="300" as="targetPoint"/>
- </mxGeometry>
- </mxCell>
- <mxCell id="46" value="" style="endArrow=classic;html=1;fontColor=default;" edge="1" parent="1" source="44" target="10">
- <mxGeometry width="50" height="50" relative="1" as="geometry">
- <mxPoint x="600" y="680" as="sourcePoint"/>
- <mxPoint x="650" y="630" as="targetPoint"/>
- </mxGeometry>
- </mxCell>
- <mxCell id="47" value="" style="endArrow=classic;html=1;fontColor=default;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="44" target="33">
- <mxGeometry width="50" height="50" relative="1" as="geometry">
- <mxPoint x="160" y="800" as="sourcePoint"/>
- <mxPoint x="210" y="750" as="targetPoint"/>
- </mxGeometry>
- </mxCell>
- <mxCell id="50" value="" style="endArrow=classic;html=1;fontColor=default;" edge="1" parent="1" source="43" target="44">
- <mxGeometry width="50" height="50" relative="1" as="geometry">
- <mxPoint x="305" y="860" as="sourcePoint"/>
- <mxPoint x="355" y="810" as="targetPoint"/>
- </mxGeometry>
- </mxCell>
- <mxCell id="51" value="ptr" style="rounded=0;whiteSpace=wrap;html=1;fontColor=default;" vertex="1" parent="1">
- <mxGeometry x="365" y="250" width="40" height="30" as="geometry"/>
- </mxCell>
- <mxCell id="52" value="mem" style="rounded=0;whiteSpace=wrap;html=1;fontColor=default;" vertex="1" parent="1">
- <mxGeometry x="405" y="250" width="40" height="30" as="geometry"/>
- </mxCell>
- <mxCell id="55" value="" style="endArrow=classic;html=1;fontColor=default;" edge="1" parent="1" source="16" target="39">
- <mxGeometry width="50" height="50" relative="1" as="geometry">
- <mxPoint x="400" y="490" as="sourcePoint"/>
- <mxPoint x="450" y="440" as="targetPoint"/>
- </mxGeometry>
- </mxCell>
- </root>
- </mxGraphModel>
- </diagram>
-</mxfile> \ No newline at end of file
diff --git a/chapter10/docs/example1.gv b/chapter10/docs/example1.gv
index fcc24154..cbb12cb5 100644
--- a/chapter10/docs/example1.gv
+++ b/chapter10/docs/example1.gv
@@ -1,8 +1,7 @@
digraph chapter10 {
/*
-struct Vec2D { int x; int y; }
-
-Vec2D v = new Vec2D;
+struct Vector2D { int x; int y; }
+Vector2D v = new Vector2D;
v.x = 1;
if (arg)
v.y = 2;
@@ -12,7 +11,6 @@ return v;
*/
rankdir=BT;
- ordering="in";
concentrate="true";
compound="true";
subgraph cluster_Nodes {
@@ -21,18 +19,17 @@ return v;
<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">arg</TD><TD PORT="p2">$Vec2D_x</TD><TD PORT="p3">$Vec2D_y</TD></TR>
+ <TR><TD PORT="p0" BGCOLOR="yellow">$ctrl</TD><TD PORT="p1">arg</TD><TD PORT="p2">$2</TD><TD PORT="p3">$3</TD></TR>
</TABLE>
</TD></TR>
</TABLE>>
];
Stop3 [ shape=box style=filled fillcolor=yellow label="Stop" ];
- New8 [ label="new Vec2D" ];
+ new8 [ label="new Vector2D" ];
Con_9 [ label="#0" ];
- Store10 [ label="Store" ];
- Store11 [ label="Store" ];
+ Store11 [ label=".y =" ];
Con_12 [ label="#1" ];
- Store13 [ label="Store" ];
+ Store13 [ label=".x =" ];
If14 [ shape=plaintext label=<
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
<TR><TD BGCOLOR="yellow">If</TD></TR>
@@ -44,41 +41,38 @@ return v;
</TABLE>>
];
Con_18 [ label="#2" ];
- Store19 [ label="Store" ];
- Con_20 [ label="#3" ];
- Store21 [ label="Store" ];
- Region22 [ shape=box style=filled fillcolor=yellow label="Region" ];
- Phi_Vec2D_y23 [ style=filled fillcolor=lightyellow label="&phi;_$Vec2D_y" ];
- Return24 [ shape=box style=filled fillcolor=yellow label="Return" ];
- { rank=same; Region22;Phi_Vec2D_y23;}
+ Store19 [ label=".y =" ];
+ Con_22 [ label="#3" ];
+ Store23 [ label=".y =" ];
+ Region24 [ shape=box style=filled fillcolor=yellow label="Region" ];
+ Phi_326 [ style=filled fillcolor=lightyellow label="&phi;_$3" ];
+ Return27 [ shape=box style=filled fillcolor=yellow label="Return" ];
+ { rank=same; Region24;Phi_326;}
}
edge [ fontname=Helvetica, fontsize=8 ];
- Stop3 -> Return24[taillabel=0 color=red];
- New8 -> Start2:p0[taillabel=0 color=green];
- Store10 -> Start2:p2[taillabel=1];
- Store10 -> New8[taillabel=2];
- Store10 -> Con_9[taillabel=3];
- Store11 -> Start2:p3[taillabel=1];
- Store11 -> New8[taillabel=2];
+ Stop3 -> Return27[taillabel=0 color=red];
+ new8 -> Start2:p0[taillabel=0 color=green];
+ Store11 -> Start2:p3[taillabel=1 color=blue];
+ Store11 -> new8[taillabel=2];
Store11 -> Con_9[taillabel=3];
- Store13 -> Store10[taillabel=1];
- Store13 -> New8[taillabel=2];
+ Store13 -> Start2:p2[taillabel=1 color=blue];
+ Store13 -> new8[taillabel=2];
Store13 -> Con_12[taillabel=3];
If14 -> Start2:p0[taillabel=0 color=red];
If14 -> Start2:p1[taillabel=1];
- Store19 -> Store11[taillabel=1];
- Store19 -> New8[taillabel=2];
+ Store19 -> Store11[taillabel=1 color=blue];
+ Store19 -> new8[taillabel=2];
Store19 -> Con_18[taillabel=3];
- Store21 -> Store11[taillabel=1];
- Store21 -> New8[taillabel=2];
- Store21 -> Con_20[taillabel=3];
- Region22 -> If14:p0[taillabel=1 color=red];
- Region22 -> If14:p1[taillabel=2 color=red];
- Phi_Vec2D_y23 -> Region22 [style=dotted taillabel=0];
- Phi_Vec2D_y23 -> Store19[taillabel=1];
- Phi_Vec2D_y23 -> Store21[taillabel=2 constraint=false];
- Return24 -> Region22[taillabel=0 color=red];
- Return24 -> New8[taillabel=1];
- Return24 -> Store13[taillabel=2];
- Return24 -> Phi_Vec2D_y23[taillabel=3];
+ Store23 -> Store11[taillabel=1 color=blue];
+ Store23 -> new8[taillabel=2];
+ Store23 -> Con_22[taillabel=3];
+ Region24 -> If14:p0[taillabel=1 color=red];
+ Region24 -> If14:p1[taillabel=2 color=red];
+ Phi_326 -> Region24 [style=dotted taillabel=0];
+ Phi_326 -> Store19[taillabel=1 color=blue];
+ Phi_326 -> Store23[taillabel=2 color=blue constraint=false];
+ Return27 -> Region24[taillabel=0 color=red];
+ Return27 -> new8[taillabel=1];
+ Return27 -> Store13[taillabel=2 color=blue];
+ Return27 -> Phi_326[taillabel=3 color=blue];
}
diff --git a/chapter10/docs/example1.svg b/chapter10/docs/example1.svg
index 0c2dfa4d..6f493e7e 100644
--- a/chapter10/docs/example1.svg
+++ b/chapter10/docs/example1.svg
@@ -4,318 +4,291 @@
<!-- Generated by graphviz version 2.43.0 (0)
-->
<!-- Title: chapter10 Pages: 1 -->
-<svg width="518pt" height="564pt"
- viewBox="0.00 0.00 518.00 564.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<svg width="394pt" height="564pt"
+ viewBox="0.00 0.00 394.00 564.00" 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 560)">
<title>chapter10</title>
-<polygon fill="white" stroke="transparent" points="-4,4 -4,-560 514,-560 514,4 -4,4"/>
+<polygon fill="white" stroke="transparent" points="-4,4 -4,-560 390,-560 390,4 -4,4"/>
<g id="clust1" class="cluster">
<title>cluster_Nodes</title>
-<polygon fill="none" stroke="black" points="8,-8 8,-548 502,-548 502,-8 8,-8"/>
+<polygon fill="none" stroke="black" points="8,-8 8,-548 378,-548 378,-8 8,-8"/>
</g>
<!-- Start2 -->
<g id="node1" class="node">
<title>Start2</title>
-<polygon fill="yellow" stroke="transparent" points="212,-511 212,-536 487,-536 487,-511 212,-511"/>
-<polygon fill="none" stroke="black" points="212,-511 212,-536 487,-536 487,-511 212,-511"/>
-<text text-anchor="start" x="331" y="-519.8" font-family="Times,serif" font-size="14.00">Start</text>
-<polygon fill="none" stroke="black" points="212,-480 212,-511 487,-511 487,-480 212,-480"/>
-<polygon fill="yellow" stroke="transparent" points="217,-485 217,-506 257,-506 257,-485 217,-485"/>
-<polygon fill="none" stroke="black" points="217,-485 217,-506 257,-506 257,-485 217,-485"/>
-<text text-anchor="start" x="220" y="-491.8" font-family="Times,serif" font-size="14.00">$ctrl</text>
-<polygon fill="none" stroke="black" points="257,-485 257,-506 288,-506 288,-485 257,-485"/>
-<text text-anchor="start" x="260" y="-491.8" font-family="Times,serif" font-size="14.00">arg</text>
-<polygon fill="none" stroke="black" points="288,-485 288,-506 385,-506 385,-485 288,-485"/>
-<text text-anchor="start" x="291" y="-491.8" font-family="Times,serif" font-size="14.00">$Vector2D_x</text>
-<polygon fill="none" stroke="black" points="385,-485 385,-506 482,-506 482,-485 385,-485"/>
-<text text-anchor="start" x="388" y="-491.8" font-family="Times,serif" font-size="14.00">$Vector2D_y</text>
+<polygon fill="yellow" stroke="transparent" points="25,-511 25,-536 156,-536 156,-511 25,-511"/>
+<polygon fill="none" stroke="black" points="25,-511 25,-536 156,-536 156,-511 25,-511"/>
+<text text-anchor="start" x="72" y="-519.8" font-family="Times,serif" font-size="14.00">Start</text>
+<polygon fill="none" stroke="black" points="25,-480 25,-511 156,-511 156,-480 25,-480"/>
+<polygon fill="yellow" stroke="transparent" points="30,-485 30,-506 70,-506 70,-485 30,-485"/>
+<polygon fill="none" stroke="black" points="30,-485 30,-506 70,-506 70,-485 30,-485"/>
+<text text-anchor="start" x="33" y="-491.8" font-family="Times,serif" font-size="14.00">$ctrl</text>
+<polygon fill="none" stroke="black" points="70,-485 70,-506 101,-506 101,-485 70,-485"/>
+<text text-anchor="start" x="73" y="-491.8" font-family="Times,serif" font-size="14.00">arg</text>
+<polygon fill="none" stroke="black" points="101,-485 101,-506 126,-506 126,-485 101,-485"/>
+<text text-anchor="start" x="104" y="-491.8" font-family="Times,serif" font-size="14.00">$2</text>
+<polygon fill="none" stroke="black" points="126,-485 126,-506 151,-506 151,-485 126,-485"/>
+<text text-anchor="start" x="129" y="-491.8" font-family="Times,serif" font-size="14.00">$3</text>
</g>
<!-- Stop3 -->
<g id="node2" class="node">
<title>Stop3</title>
-<polygon fill="yellow" stroke="black" points="386,-52 332,-52 332,-16 386,-16 386,-52"/>
-<text text-anchor="middle" x="359" y="-30.3" font-family="Times,serif" font-size="14.00">Stop</text>
+<polygon fill="yellow" stroke="black" points="201,-52 147,-52 147,-16 201,-16 201,-52"/>
+<text text-anchor="middle" x="174" y="-30.3" font-family="Times,serif" font-size="14.00">Stop</text>
</g>
-<!-- Return24 -->
-<g id="node16" class="node">
-<title>Return24</title>
-<polygon fill="yellow" stroke="black" points="392,-124 326,-124 326,-88 392,-88 392,-124"/>
-<text text-anchor="middle" x="359" y="-102.3" font-family="Times,serif" font-size="14.00">Return</text>
+<!-- Return27 -->
+<g id="node15" class="node">
+<title>Return27</title>
+<polygon fill="yellow" stroke="black" points="207,-124 141,-124 141,-88 207,-88 207,-124"/>
+<text text-anchor="middle" x="174" y="-102.3" font-family="Times,serif" font-size="14.00">Return</text>
</g>
-<!-- Stop3&#45;&gt;Return24 -->
+<!-- Stop3&#45;&gt;Return27 -->
<g id="edge1" class="edge">
-<title>Stop3&#45;&gt;Return24</title>
-<path fill="none" stroke="red" d="M359,-52.3C359,-60.02 359,-69.29 359,-77.89"/>
-<polygon fill="red" stroke="red" points="355.5,-77.9 359,-87.9 362.5,-77.9 355.5,-77.9"/>
-<text text-anchor="middle" x="356" y="-54.9" font-family="Helvetica,sans-Serif" font-size="8.00">0</text>
+<title>Stop3&#45;&gt;Return27</title>
+<path fill="none" stroke="red" d="M174,-52.3C174,-60.02 174,-69.29 174,-77.89"/>
+<polygon fill="red" stroke="red" points="170.5,-77.9 174,-87.9 177.5,-77.9 170.5,-77.9"/>
+<text text-anchor="middle" x="171" y="-54.9" font-family="Helvetica,sans-Serif" font-size="8.00">0</text>
</g>
-<!-- New8 -->
+<!-- new8 -->
<g id="node3" class="node">
-<title>New8</title>
-<ellipse fill="none" stroke="black" cx="247" cy="-408" rx="98.58" ry="18"/>
-<text text-anchor="middle" x="247" y="-404.3" font-family="Times,serif" font-size="14.00">New Ptr(Vector2D)</text>
+<title>new8</title>
+<ellipse fill="none" stroke="black" cx="203" cy="-422" rx="75.29" ry="18"/>
+<text text-anchor="middle" x="203" y="-418.3" font-family="Times,serif" font-size="14.00">new Vector2D</text>
</g>
-<!-- New8&#45;&gt;Start2 -->
+<!-- new8&#45;&gt;Start2 -->
<g id="edge2" class="edge">
-<title>New8&#45;&gt;Start2:p0</title>
-<path fill="none" stroke="green" d="M243.39,-426.19C241,-438.85 238.14,-456.79 237.27,-474"/>
-<polygon fill="green" stroke="green" points="233.77,-473.91 237,-484 240.76,-474.1 233.77,-473.91"/>
-<text text-anchor="middle" x="240.39" y="-428.79" font-family="Helvetica,sans-Serif" font-size="8.00">0</text>
+<title>new8&#45;&gt;Start2:p0</title>
+<path fill="none" stroke="green" d="M147.76,-434.26C110.79,-443.18 66.61,-456.99 53.71,-474.14"/>
+<polygon fill="green" stroke="green" points="50.24,-473.41 50,-484 56.79,-475.87 50.24,-473.41"/>
+<text text-anchor="middle" x="144.76" y="-436.86" font-family="Helvetica,sans-Serif" font-size="8.00">0</text>
</g>
<!-- Con_9 -->
<g id="node4" class="node">
<title>Con_9</title>
-<ellipse fill="none" stroke="black" cx="103" cy="-408" rx="27" ry="18"/>
-<text text-anchor="middle" x="103" y="-404.3" font-family="Times,serif" font-size="14.00">#0</text>
-</g>
-<!-- Store10 -->
-<g id="node5" class="node">
-<title>Store10</title>
-<ellipse fill="none" stroke="black" cx="124" cy="-322" rx="36.29" ry="18"/>
-<text text-anchor="middle" x="124" y="-318.3" font-family="Times,serif" font-size="14.00">Store</text>
-</g>
-<!-- Store10&#45;&gt;Start2 -->
-<g id="edge3" class="edge">
-<title>Store10&#45;&gt;Start2:p2</title>
-<path fill="none" stroke="black" d="M102.14,-336.54C89.28,-345.86 74.18,-359.52 67,-376 55.64,-402.08 48.58,-418.32 67,-440 103.77,-483.27 308.02,-430.84 333.41,-474.03"/>
-<polygon fill="black" stroke="black" points="330.1,-475.2 336,-484 336.87,-473.44 330.1,-475.2"/>
-<text text-anchor="middle" x="99.14" y="-339.14" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
-</g>
-<!-- Store10&#45;&gt;New8 -->
-<g id="edge4" class="edge">
-<title>Store10&#45;&gt;New8</title>
-<path fill="none" stroke="black" d="M144.59,-337.06C163.55,-350.01 191.99,-369.44 214.1,-384.53"/>
-<polygon fill="black" stroke="black" points="212.3,-387.54 222.53,-390.29 216.25,-381.76 212.3,-387.54"/>
-<text text-anchor="middle" x="141.59" y="-339.66" font-family="Helvetica,sans-Serif" font-size="8.00">2</text>
-</g>
-<!-- Store10&#45;&gt;Con_9 -->
-<g id="edge5" class="edge">
-<title>Store10&#45;&gt;Con_9</title>
-<path fill="none" stroke="black" d="M119.75,-340C116.88,-351.5 113.02,-366.93 109.73,-380.08"/>
-<polygon fill="black" stroke="black" points="106.27,-379.48 107.24,-390.03 113.06,-381.17 106.27,-379.48"/>
-<text text-anchor="middle" x="116.75" y="-342.6" font-family="Helvetica,sans-Serif" font-size="8.00">3</text>
+<ellipse fill="none" stroke="black" cx="63" cy="-422" rx="27" ry="18"/>
+<text text-anchor="middle" x="63" y="-418.3" font-family="Times,serif" font-size="14.00">#0</text>
</g>
<!-- Store11 -->
-<g id="node6" class="node">
+<g id="node5" class="node">
<title>Store11</title>
-<ellipse fill="none" stroke="black" cx="326" cy="-322" rx="36.29" ry="18"/>
-<text text-anchor="middle" x="326" y="-318.3" font-family="Times,serif" font-size="14.00">Store</text>
+<ellipse fill="none" stroke="black" cx="170" cy="-350" rx="29.8" ry="18"/>
+<text text-anchor="middle" x="170" y="-346.3" font-family="Times,serif" font-size="14.00">.y =</text>
</g>
<!-- Store11&#45;&gt;Start2 -->
-<g id="edge6" class="edge">
+<g id="edge3" class="edge">
<title>Store11&#45;&gt;Start2:p3</title>
-<path fill="none" stroke="black" d="M336.29,-339.76C342.27,-349.98 349.67,-363.45 355,-376 366.65,-403.43 357.77,-415.68 375,-440 391.62,-463.46 424.6,-454.4 432.35,-474.07"/>
-<polygon fill="black" stroke="black" points="428.9,-474.71 434,-484 435.81,-473.56 428.9,-474.71"/>
-<text text-anchor="middle" x="333.29" y="-342.36" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
+<path fill="none" stroke="blue" d="M151.42,-364.19C139.69,-373.74 125.54,-387.77 119,-404 113.02,-418.84 115.61,-424.36 119,-440 122.69,-457.06 133.59,-461.26 137.54,-473.76"/>
+<polygon fill="blue" stroke="blue" points="134.13,-474.59 139,-484 141.06,-473.61 134.13,-474.59"/>
+<text text-anchor="middle" x="148.42" y="-366.79" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
</g>
-<!-- Store11&#45;&gt;New8 -->
-<g id="edge7" class="edge">
-<title>Store11&#45;&gt;New8</title>
-<path fill="none" stroke="black" d="M311.14,-338.8C299.53,-351.15 283.18,-368.53 269.89,-382.66"/>
-<polygon fill="black" stroke="black" points="267.18,-380.44 262.88,-390.12 272.28,-385.23 267.18,-380.44"/>
-<text text-anchor="middle" x="308.14" y="-341.4" font-family="Helvetica,sans-Serif" font-size="8.00">2</text>
+<!-- Store11&#45;&gt;new8 -->
+<g id="edge4" class="edge">
+<title>Store11&#45;&gt;new8</title>
+<path fill="none" stroke="black" d="M177.82,-367.59C181.67,-375.75 186.4,-385.78 190.71,-394.93"/>
+<polygon fill="black" stroke="black" points="187.58,-396.49 195.01,-404.04 193.91,-393.51 187.58,-396.49"/>
+<text text-anchor="middle" x="174.82" y="-370.19" font-family="Helvetica,sans-Serif" font-size="8.00">2</text>
</g>
<!-- Store11&#45;&gt;Con_9 -->
-<g id="edge8" class="edge">
+<g id="edge5" class="edge">
<title>Store11&#45;&gt;Con_9</title>
-<path fill="none" stroke="black" d="M294.91,-331.44C243.56,-345.42 145.98,-372.24 139,-376 134.01,-378.69 129.1,-382.17 124.59,-385.82"/>
-<polygon fill="black" stroke="black" points="122.22,-383.24 116.98,-392.45 126.82,-388.52 122.22,-383.24"/>
-<text text-anchor="middle" x="291.91" y="-334.04" font-family="Helvetica,sans-Serif" font-size="8.00">3</text>
+<path fill="none" stroke="black" d="M150.37,-363.84C133.5,-374.88 108.99,-390.92 90.22,-403.2"/>
+<polygon fill="black" stroke="black" points="88.24,-400.31 81.78,-408.71 92.07,-406.17 88.24,-400.31"/>
+<text text-anchor="middle" x="153.37" y="-366.44" font-family="Helvetica,sans-Serif" font-size="8.00">3</text>
</g>
<!-- Con_12 -->
-<g id="node7" class="node">
+<g id="node6" class="node">
<title>Con_12</title>
-<ellipse fill="none" stroke="black" cx="43" cy="-322" rx="27" ry="18"/>
-<text text-anchor="middle" x="43" y="-318.3" font-family="Times,serif" font-size="14.00">#1</text>
+<ellipse fill="none" stroke="black" cx="323" cy="-422" rx="27" ry="18"/>
+<text text-anchor="middle" x="323" y="-418.3" font-family="Times,serif" font-size="14.00">#1</text>
</g>
<!-- Store13 -->
-<g id="node8" class="node">
+<g id="node7" class="node">
<title>Store13</title>
-<ellipse fill="none" stroke="black" cx="146" cy="-250" rx="36.29" ry="18"/>
-<text text-anchor="middle" x="146" y="-246.3" font-family="Times,serif" font-size="14.00">Store</text>
+<ellipse fill="none" stroke="black" cx="340" cy="-350" rx="29.8" ry="18"/>
+<text text-anchor="middle" x="340" y="-346.3" font-family="Times,serif" font-size="14.00">.x =</text>
</g>
-<!-- Store13&#45;&gt;New8 -->
-<g id="edge10" class="edge">
-<title>Store13&#45;&gt;New8</title>
-<path fill="none" stroke="black" d="M153.54,-267.95C163.49,-290.05 180.7,-327.38 189,-340 198.92,-355.08 211.92,-370.41 223.11,-382.59"/>
-<polygon fill="black" stroke="black" points="220.75,-385.2 230.14,-390.11 225.86,-380.41 220.75,-385.2"/>
-<text text-anchor="middle" x="150.54" y="-270.55" font-family="Helvetica,sans-Serif" font-size="8.00">2</text>
+<!-- Store13&#45;&gt;Start2 -->
+<g id="edge6" class="edge">
+<title>Store13&#45;&gt;Start2:p2</title>
+<path fill="none" stroke="blue" d="M350.63,-367.07C362.03,-386.53 376.33,-419.28 359,-440 290.38,-522.04 125.44,-383.17 114.57,-473.83"/>
+<polygon fill="blue" stroke="blue" points="111.06,-473.82 114,-484 118.05,-474.21 111.06,-473.82"/>
+<text text-anchor="middle" x="347.63" y="-369.67" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
</g>
-<!-- Store13&#45;&gt;Store10 -->
-<g id="edge9" class="edge">
-<title>Store13&#45;&gt;Store10</title>
-<path fill="none" stroke="black" d="M140.67,-267.95C138.22,-275.74 135.26,-285.18 132.51,-293.92"/>
-<polygon fill="black" stroke="black" points="129.09,-293.14 129.43,-303.72 135.77,-295.23 129.09,-293.14"/>
-<text text-anchor="middle" x="137.67" y="-270.55" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
+<!-- Store13&#45;&gt;new8 -->
+<g id="edge7" class="edge">
+<title>Store13&#45;&gt;new8</title>
+<path fill="none" stroke="black" d="M317.99,-362.25C297.67,-372.63 267.01,-388.3 242.46,-400.84"/>
+<polygon fill="black" stroke="black" points="240.69,-397.81 233.38,-405.48 243.88,-404.04 240.69,-397.81"/>
+<text text-anchor="middle" x="314.99" y="-364.85" font-family="Helvetica,sans-Serif" font-size="8.00">2</text>
</g>
<!-- Store13&#45;&gt;Con_12 -->
-<g id="edge11" class="edge">
+<g id="edge8" class="edge">
<title>Store13&#45;&gt;Con_12</title>
-<path fill="none" stroke="black" d="M125.16,-265.17C109.24,-275.98 87.18,-290.98 69.92,-302.7"/>
-<polygon fill="black" stroke="black" points="67.7,-299.98 61.4,-308.5 71.63,-305.77 67.7,-299.98"/>
-<text text-anchor="middle" x="122.16" y="-267.77" font-family="Helvetica,sans-Serif" font-size="8.00">3</text>
+<path fill="none" stroke="black" d="M335.88,-367.95C333.99,-375.74 331.7,-385.18 329.58,-393.92"/>
+<polygon fill="black" stroke="black" points="326.15,-393.18 327.2,-403.72 332.96,-394.83 326.15,-393.18"/>
+<text text-anchor="middle" x="332.88" y="-370.55" font-family="Helvetica,sans-Serif" font-size="8.00">3</text>
</g>
<!-- If14 -->
-<g id="node9" class="node">
+<g id="node8" class="node">
<title>If14</title>
-<polygon fill="yellow" stroke="transparent" points="392,-411 392,-436 486,-436 486,-411 392,-411"/>
-<polygon fill="none" stroke="black" points="392,-411 392,-436 486,-436 486,-411 392,-411"/>
-<text text-anchor="start" x="433.5" y="-419.8" font-family="Times,serif" font-size="14.00">If</text>
-<polygon fill="none" stroke="black" points="392,-380 392,-411 486,-411 486,-380 392,-380"/>
-<polygon fill="yellow" stroke="transparent" points="397,-385 397,-406 437,-406 437,-385 397,-385"/>
-<polygon fill="none" stroke="black" points="397,-385 397,-406 437,-406 437,-385 397,-385"/>
-<text text-anchor="start" x="400" y="-391.8" font-family="Times,serif" font-size="14.00">True</text>
-<polygon fill="yellow" stroke="transparent" points="437,-385 437,-406 481,-406 481,-385 437,-385"/>
-<polygon fill="none" stroke="black" points="437,-385 437,-406 481,-406 481,-385 437,-385"/>
-<text text-anchor="start" x="440" y="-391.8" font-family="Times,serif" font-size="14.00">False</text>
+<polygon fill="yellow" stroke="transparent" points="24,-267 24,-292 118,-292 118,-267 24,-267"/>
+<polygon fill="none" stroke="black" points="24,-267 24,-292 118,-292 118,-267 24,-267"/>
+<text text-anchor="start" x="65.5" y="-275.8" font-family="Times,serif" font-size="14.00">If</text>
+<polygon fill="none" stroke="black" points="24,-236 24,-267 118,-267 118,-236 24,-236"/>
+<polygon fill="yellow" stroke="transparent" points="29,-241 29,-262 69,-262 69,-241 29,-241"/>
+<polygon fill="none" stroke="black" points="29,-241 29,-262 69,-262 69,-241 29,-241"/>
+<text text-anchor="start" x="32" y="-247.8" font-family="Times,serif" font-size="14.00">True</text>
+<polygon fill="yellow" stroke="transparent" points="69,-241 69,-262 113,-262 113,-241 69,-241"/>
+<polygon fill="none" stroke="black" points="69,-241 69,-262 113,-262 113,-241 69,-241"/>
+<text text-anchor="start" x="72" y="-247.8" font-family="Times,serif" font-size="14.00">False</text>
</g>
<!-- If14&#45;&gt;Start2 -->
-<g id="edge12" class="edge">
+<g id="edge9" class="edge">
<title>If14&#45;&gt;Start2:p0</title>
-<path fill="none" stroke="red" d="M383.85,-434.38C379.19,-436.34 374.53,-438.24 370,-440 315.48,-461.2 246.02,-426.45 237.8,-473.79"/>
-<polygon fill="red" stroke="red" points="234.3,-473.76 237,-484 241.27,-474.31 234.3,-473.76"/>
-<text text-anchor="middle" x="380.85" y="-427.98" font-family="Helvetica,sans-Serif" font-size="8.00">0</text>
-</g>
-<!-- If14&#45;&gt;Start2 -->
-<g id="edge13" class="edge">
-<title>If14&#45;&gt;Start2:p1</title>
-<path fill="none" stroke="black" d="M383.86,-433.77C346.61,-450.49 300.83,-471.05 281.42,-479.77"/>
-<polygon fill="black" stroke="black" points="279.69,-476.71 272,-484 282.56,-483.1 279.69,-476.71"/>
-<text text-anchor="middle" x="380.86" y="-436.37" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
+<path fill="none" stroke="red" d="M58.13,-296.08C47.38,-323.83 32.89,-365.85 27,-404 24.56,-419.81 23.18,-424.46 27,-440 31.32,-457.58 44.03,-461.08 48.46,-473.95"/>
+<polygon fill="red" stroke="red" points="45.02,-474.65 50,-484 51.94,-473.58 45.02,-474.65"/>
+<text text-anchor="middle" x="55.13" y="-298.68" font-family="Helvetica,sans-Serif" font-size="8.00">0</text>
</g>
<!-- Con_18 -->
-<g id="node10" class="node">
+<g id="node9" class="node">
<title>Con_18</title>
-<ellipse fill="none" stroke="black" cx="225" cy="-322" rx="27" ry="18"/>
-<text text-anchor="middle" x="225" y="-318.3" font-family="Times,serif" font-size="14.00">#2</text>
+<ellipse fill="none" stroke="black" cx="95" cy="-350" rx="27" ry="18"/>
+<text text-anchor="middle" x="95" y="-346.3" font-family="Times,serif" font-size="14.00">#2</text>
</g>
<!-- Store19 -->
-<g id="node11" class="node">
+<g id="node10" class="node">
<title>Store19</title>
-<ellipse fill="none" stroke="black" cx="281" cy="-250" rx="36.29" ry="18"/>
-<text text-anchor="middle" x="281" y="-246.3" font-family="Times,serif" font-size="14.00">Store</text>
+<ellipse fill="none" stroke="black" cx="174" cy="-264" rx="29.8" ry="18"/>
+<text text-anchor="middle" x="174" y="-260.3" font-family="Times,serif" font-size="14.00">.y =</text>
</g>
-<!-- Store19&#45;&gt;New8 -->
-<g id="edge15" class="edge">
-<title>Store19&#45;&gt;New8</title>
-<path fill="none" stroke="black" d="M277.3,-267.99C271.45,-294.81 260.03,-347.21 253,-379.46"/>
-<polygon fill="black" stroke="black" points="249.51,-379.04 250.8,-389.55 256.35,-380.53 249.51,-379.04"/>
-<text text-anchor="middle" x="274.3" y="-270.59" font-family="Helvetica,sans-Serif" font-size="8.00">2</text>
+<!-- Store19&#45;&gt;new8 -->
+<g id="edge12" class="edge">
+<title>Store19&#45;&gt;new8</title>
+<path fill="none" stroke="black" d="M188.91,-279.62C203.35,-295.52 222.56,-322.27 219,-349"/>
+<path fill="none" stroke="black" d="M219,-351C217.08,-365.43 213.58,-381.26 210.34,-394.21"/>
+<polygon fill="black" stroke="black" points="206.95,-393.34 207.84,-403.9 213.73,-395.09 206.95,-393.34"/>
+<text text-anchor="middle" x="185.91" y="-282.22" font-family="Helvetica,sans-Serif" font-size="8.00">2</text>
</g>
<!-- Store19&#45;&gt;Store11 -->
-<g id="edge14" class="edge">
+<g id="edge11" class="edge">
<title>Store19&#45;&gt;Store11</title>
-<path fill="none" stroke="black" d="M291.66,-267.59C297.1,-276.05 303.83,-286.51 309.88,-295.92"/>
-<polygon fill="black" stroke="black" points="307.06,-298.01 315.41,-304.53 312.95,-294.23 307.06,-298.01"/>
-<text text-anchor="middle" x="288.66" y="-270.19" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
+<path fill="none" stroke="blue" d="M173.19,-282C172.65,-293.31 171.93,-308.42 171.31,-321.43"/>
+<polygon fill="blue" stroke="blue" points="167.8,-321.58 170.82,-331.74 174.79,-321.92 167.8,-321.58"/>
+<text text-anchor="middle" x="170.19" y="-284.6" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
</g>
<!-- Store19&#45;&gt;Con_18 -->
-<g id="edge16" class="edge">
+<g id="edge13" class="edge">
<title>Store19&#45;&gt;Con_18</title>
-<path fill="none" stroke="black" d="M268.29,-266.88C261.03,-275.96 251.79,-287.51 243.71,-297.61"/>
-<polygon fill="black" stroke="black" points="240.79,-295.66 237.27,-305.66 246.25,-300.04 240.79,-295.66"/>
-<text text-anchor="middle" x="265.29" y="-269.48" font-family="Helvetica,sans-Serif" font-size="8.00">3</text>
+<path fill="none" stroke="black" d="M159.88,-280.02C147.56,-293.12 129.52,-312.29 115.59,-327.1"/>
+<polygon fill="black" stroke="black" points="113.04,-324.71 108.74,-334.39 118.14,-329.51 113.04,-324.71"/>
+<text text-anchor="middle" x="156.88" y="-282.62" font-family="Helvetica,sans-Serif" font-size="8.00">3</text>
+</g>
+<!-- Con_22 -->
+<g id="node11" class="node">
+<title>Con_22</title>
+<ellipse fill="none" stroke="black" cx="265" cy="-350" rx="27" ry="18"/>
+<text text-anchor="middle" x="265" y="-346.3" font-family="Times,serif" font-size="14.00">#3</text>
</g>
-<!-- Con_20 -->
+<!-- Store23 -->
<g id="node12" class="node">
-<title>Con_20</title>
-<ellipse fill="none" stroke="black" cx="427" cy="-322" rx="27" ry="18"/>
-<text text-anchor="middle" x="427" y="-318.3" font-family="Times,serif" font-size="14.00">#3</text>
+<title>Store23</title>
+<ellipse fill="none" stroke="black" cx="272" cy="-264" rx="29.8" ry="18"/>
+<text text-anchor="middle" x="272" y="-260.3" font-family="Times,serif" font-size="14.00">.y =</text>
</g>
-<!-- Store21 -->
-<g id="node13" class="node">
-<title>Store21</title>
-<ellipse fill="none" stroke="black" cx="381" cy="-250" rx="36.29" ry="18"/>
-<text text-anchor="middle" x="381" y="-246.3" font-family="Times,serif" font-size="14.00">Store</text>
+<!-- Store23&#45;&gt;new8 -->
+<g id="edge15" class="edge">
+<title>Store23&#45;&gt;new8</title>
+<path fill="none" stroke="black" d="M257.04,-279.75C242.69,-295.35 222.67,-321.48 219,-349"/>
+<text text-anchor="middle" x="254.04" y="-282.35" font-family="Helvetica,sans-Serif" font-size="8.00">2</text>
</g>
-<!-- Store21&#45;&gt;New8 -->
-<g id="edge18" class="edge">
-<title>Store21&#45;&gt;New8</title>
-<path fill="none" stroke="black" d="M383.48,-267.99C385.36,-287.16 385.53,-318.48 371,-340 355.77,-362.56 330.37,-378.17 306.51,-388.6"/>
-<polygon fill="black" stroke="black" points="305.01,-385.43 297.11,-392.49 307.69,-391.9 305.01,-385.43"/>
-<text text-anchor="middle" x="380.48" y="-270.59" font-family="Helvetica,sans-Serif" font-size="8.00">2</text>
+<!-- Store23&#45;&gt;Store11 -->
+<g id="edge14" class="edge">
+<title>Store23&#45;&gt;Store11</title>
+<path fill="none" stroke="blue" d="M254.7,-279.25C238.26,-292.79 213.37,-313.28 194.82,-328.56"/>
+<polygon fill="blue" stroke="blue" points="192.54,-325.9 187.05,-334.96 196.99,-331.31 192.54,-325.9"/>
+<text text-anchor="middle" x="251.7" y="-272.85" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
+</g>
+<!-- Store23&#45;&gt;Con_22 -->
+<g id="edge16" class="edge">
+<title>Store23&#45;&gt;Con_22</title>
+<path fill="none" stroke="black" d="M270.58,-282C269.64,-293.31 268.38,-308.42 267.3,-321.43"/>
+<polygon fill="black" stroke="black" points="263.78,-321.48 266.44,-331.74 270.76,-322.06 263.78,-321.48"/>
+<text text-anchor="middle" x="267.58" y="-284.6" font-family="Helvetica,sans-Serif" font-size="8.00">3</text>
+</g>
+<!-- Region24 -->
+<g id="node13" class="node">
+<title>Region24</title>
+<polygon fill="yellow" stroke="black" points="123,-196 57,-196 57,-160 123,-160 123,-196"/>
+<text text-anchor="middle" x="90" y="-174.3" font-family="Times,serif" font-size="14.00">Region</text>
</g>
-<!-- Store21&#45;&gt;Store11 -->
+<!-- Region24&#45;&gt;If14 -->
<g id="edge17" class="edge">
-<title>Store21&#45;&gt;Store11</title>
-<path fill="none" stroke="black" d="M368.24,-267.24C361.3,-276.07 352.58,-287.17 344.87,-296.99"/>
-<polygon fill="black" stroke="black" points="342.11,-294.83 338.69,-304.85 347.62,-299.15 342.11,-294.83"/>
-<text text-anchor="middle" x="365.24" y="-269.84" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
+<title>Region24&#45;&gt;If14:p0</title>
+<path fill="none" stroke="red" d="M70.46,-196.22C62.05,-205.18 53.41,-216.97 50.26,-229.91"/>
+<polygon fill="red" stroke="red" points="46.76,-229.64 49,-240 53.71,-230.51 46.76,-229.64"/>
+<text text-anchor="middle" x="67.46" y="-198.82" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
</g>
-<!-- Store21&#45;&gt;Con_20 -->
-<g id="edge19" class="edge">
-<title>Store21&#45;&gt;Con_20</title>
-<path fill="none" stroke="black" d="M391.67,-267.24C397.44,-276.02 404.68,-287.04 411.1,-296.81"/>
-<polygon fill="black" stroke="black" points="408.29,-298.9 416.71,-305.33 414.14,-295.06 408.29,-298.9"/>
-<text text-anchor="middle" x="388.67" y="-269.84" font-family="Helvetica,sans-Serif" font-size="8.00">3</text>
+<!-- Region24&#45;&gt;If14 -->
+<g id="edge18" class="edge">
+<title>Region24&#45;&gt;If14:p1</title>
+<path fill="none" stroke="red" d="M90.43,-196.09C90.64,-205.55 90.87,-217.77 90.96,-229.69"/>
+<polygon fill="red" stroke="red" points="87.46,-230.01 91,-240 94.46,-229.99 87.46,-230.01"/>
+<text text-anchor="middle" x="87.43" y="-198.69" font-family="Helvetica,sans-Serif" font-size="8.00">2</text>
</g>
-<!-- Region22 -->
+<!-- Phi_326 -->
<g id="node14" class="node">
-<title>Region22</title>
-<polygon fill="yellow" stroke="black" points="494,-196 428,-196 428,-160 494,-160 494,-196"/>
-<text text-anchor="middle" x="461" y="-174.3" font-family="Times,serif" font-size="14.00">Region</text>
+<title>Phi_326</title>
+<ellipse fill="lightyellow" stroke="black" cx="174" cy="-178" rx="33.29" ry="18"/>
+<text text-anchor="middle" x="174" y="-174.3" font-family="Times,serif" font-size="14.00">φ_$3</text>
</g>
-<!-- Region22&#45;&gt;If14 -->
+<!-- Phi_326&#45;&gt;Store19 -->
<g id="edge20" class="edge">
-<title>Region22&#45;&gt;If14:p0</title>
-<path fill="none" stroke="red" d="M468.66,-196.11C481.18,-226.8 502.33,-292.46 478,-340 464.62,-366.15 427.64,-354.5 418.88,-373.99"/>
-<polygon fill="red" stroke="red" points="415.4,-373.53 417,-384 422.28,-374.82 415.4,-373.53"/>
-<text text-anchor="middle" x="465.66" y="-198.71" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
-</g>
-<!-- Phi_Vector2D_y23 -->
-<g id="node15" class="node">
-<title>Phi_Vector2D_y23</title>
-<ellipse fill="lightyellow" stroke="black" cx="310" cy="-178" rx="79.89" ry="18"/>
-<text text-anchor="middle" x="310" y="-174.3" font-family="Times,serif" font-size="14.00">φ_$Vector2D_y</text>
+<title>Phi_326&#45;&gt;Store19</title>
+<path fill="none" stroke="blue" d="M174,-196.4C174,-207.74 174,-222.77 174,-235.68"/>
+<polygon fill="blue" stroke="blue" points="170.5,-235.9 174,-245.9 177.5,-235.9 170.5,-235.9"/>
+<text text-anchor="middle" x="171" y="-199" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
+</g>
+<!-- Phi_326&#45;&gt;Store23 -->
+<g id="edge21" class="edge">
+<title>Phi_326&#45;&gt;Store23</title>
+<path fill="none" stroke="blue" d="M191.07,-193.63C206.76,-207.08 230.2,-227.17 247.81,-242.27"/>
+<polygon fill="blue" stroke="blue" points="245.58,-244.97 255.45,-248.82 250.14,-239.65 245.58,-244.97"/>
+<text text-anchor="middle" x="188.07" y="-196.23" font-family="Helvetica,sans-Serif" font-size="8.00">2</text>
+</g>
+<!-- Phi_326&#45;&gt;Region24 -->
+<g id="edge19" class="edge">
+<title>Phi_326&#45;&gt;Region24</title>
+<path fill="none" stroke="black" stroke-dasharray="1,5" d="M140.62,-178C138.17,-178 135.71,-178 133.25,-178"/>
+<polygon fill="black" stroke="black" points="133.14,-174.5 123.14,-178 133.14,-181.5 133.14,-174.5"/>
+<text text-anchor="middle" x="137.62" y="-171.6" font-family="Helvetica,sans-Serif" font-size="8.00">0</text>
</g>
-<!-- Phi_Vector2D_y23&#45;&gt;Store19 -->
+<!-- Return27&#45;&gt;new8 -->
<g id="edge23" class="edge">
-<title>Phi_Vector2D_y23&#45;&gt;Store19</title>
-<path fill="none" stroke="black" d="M302.98,-195.95C299.63,-204.03 295.55,-213.88 291.82,-222.89"/>
-<polygon fill="black" stroke="black" points="288.55,-221.63 287.96,-232.21 295.02,-224.31 288.55,-221.63"/>
-<text text-anchor="middle" x="299.98" y="-198.55" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
+<title>Return27&#45;&gt;new8</title>
+<path fill="none" stroke="black" d="M207.48,-120.36C230.67,-131.64 259.67,-150.25 273,-177"/>
+<path fill="none" stroke="black" d="M273,-179C286.16,-205.41 244.02,-204.62 233,-232 213.44,-280.58 225.92,-297.09 219,-349"/>
+<text text-anchor="middle" x="210.48" y="-113.96" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
</g>
-<!-- Phi_Vector2D_y23&#45;&gt;Store21 -->
+<!-- Return27&#45;&gt;Store13 -->
<g id="edge24" class="edge">
-<title>Phi_Vector2D_y23&#45;&gt;Store21</title>
-<path fill="none" stroke="black" d="M327.19,-195.95C336.48,-205.1 348.07,-216.53 358.11,-226.43"/>
-<polygon fill="black" stroke="black" points="355.85,-229.12 365.42,-233.64 360.76,-224.13 355.85,-229.12"/>
-<text text-anchor="middle" x="324.19" y="-198.55" font-family="Helvetica,sans-Serif" font-size="8.00">2</text>
+<title>Return27&#45;&gt;Store13</title>
+<path fill="none" stroke="blue" d="M273,-179C286,-204.9 298.85,-205.68 311,-232 324.45,-261.13 332.19,-297.33 336.24,-321.69"/>
+<polygon fill="blue" stroke="blue" points="332.79,-322.32 337.8,-331.66 339.71,-321.24 332.79,-322.32"/>
+<text text-anchor="middle" x="270" y="-172.6" font-family="Helvetica,sans-Serif" font-size="8.00">2</text>
</g>
-<!-- Phi_Vector2D_y23&#45;&gt;Region22 -->
+<!-- Return27&#45;&gt;Region24 -->
<g id="edge22" class="edge">
-<title>Phi_Vector2D_y23&#45;&gt;Region22</title>
-<path fill="none" stroke="black" stroke-dasharray="1,5" d="M390.22,-178C399.33,-178 408.43,-178 417.54,-178"/>
-<polygon fill="black" stroke="black" points="417.82,-181.5 427.82,-178 417.82,-174.5 417.82,-181.5"/>
-<text text-anchor="middle" x="393.22" y="-171.6" font-family="Helvetica,sans-Serif" font-size="8.00">0</text>
-</g>
-<!-- Return24&#45;&gt;New8 -->
-<g id="edge26" class="edge">
-<title>Return24&#45;&gt;New8</title>
-<path fill="none" stroke="black" d="M373.77,-124.44C381.82,-134.45 391.63,-147.49 399,-160 416.77,-190.17 455.73,-269.74 463,-304 466.32,-319.65 472.49,-327.12 463,-340 453.78,-352.52 373.24,-375.2 313.19,-390.68"/>
-<polygon fill="black" stroke="black" points="312.19,-387.32 303.37,-393.19 313.93,-394.1 312.19,-387.32"/>
-<text text-anchor="middle" x="370.77" y="-127.04" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
-</g>
-<!-- Return24&#45;&gt;Store13 -->
-<g id="edge27" class="edge">
-<title>Return24&#45;&gt;Store13</title>
-<path fill="none" stroke="black" d="M325.78,-114.7C296.32,-122.65 253.09,-137.15 221,-160 196.73,-177.27 175.54,-204.17 161.93,-223.87"/>
-<polygon fill="black" stroke="black" points="158.9,-222.11 156.23,-232.36 164.71,-226.01 158.9,-222.11"/>
-<text text-anchor="middle" x="322.78" y="-108.3" font-family="Helvetica,sans-Serif" font-size="8.00">2</text>
-</g>
-<!-- Return24&#45;&gt;Region22 -->
+<title>Return27&#45;&gt;Region24</title>
+<path fill="none" stroke="red" d="M153.24,-124.3C142.76,-133.03 129.89,-143.76 118.5,-153.25"/>
+<polygon fill="red" stroke="red" points="115.97,-150.81 110.53,-159.9 120.45,-156.18 115.97,-150.81"/>
+<text text-anchor="middle" x="150.24" y="-126.9" font-family="Helvetica,sans-Serif" font-size="8.00">0</text>
+</g>
+<!-- Return27&#45;&gt;Phi_326 -->
<g id="edge25" class="edge">
-<title>Return24&#45;&gt;Region22</title>
-<path fill="none" stroke="red" d="M383.95,-124.12C397.04,-133.11 413.26,-144.24 427.44,-153.97"/>
-<polygon fill="red" stroke="red" points="425.73,-157.04 435.95,-159.81 429.69,-151.27 425.73,-157.04"/>
-<text text-anchor="middle" x="380.95" y="-126.72" font-family="Helvetica,sans-Serif" font-size="8.00">0</text>
-</g>
-<!-- Return24&#45;&gt;Phi_Vector2D_y23 -->
-<g id="edge28" class="edge">
-<title>Return24&#45;&gt;Phi_Vector2D_y23</title>
-<path fill="none" stroke="black" d="M346.89,-124.3C341.13,-132.53 334.14,-142.52 327.79,-151.58"/>
-<polygon fill="black" stroke="black" points="324.84,-149.7 321.97,-159.9 330.58,-153.71 324.84,-149.7"/>
-<text text-anchor="middle" x="343.89" y="-126.9" font-family="Helvetica,sans-Serif" font-size="8.00">3</text>
+<title>Return27&#45;&gt;Phi_326</title>
+<path fill="none" stroke="blue" d="M174,-124.3C174,-132.02 174,-141.29 174,-149.89"/>
+<polygon fill="blue" stroke="blue" points="170.5,-149.9 174,-159.9 177.5,-149.9 170.5,-149.9"/>
+<text text-anchor="middle" x="171" y="-126.9" font-family="Helvetica,sans-Serif" font-size="8.00">3</text>
</g>
</g>
</svg>
diff --git a/chapter10/docs/example2a.gv b/chapter10/docs/example2a.gv
new file mode 100644
index 00000000..23f31bf8
--- /dev/null
+++ b/chapter10/docs/example2a.gv
@@ -0,0 +1,65 @@
+digraph chapter10 {
+/*
+struct Bar {
+ int a;
+ int b;
+}
+struct Foo {
+ int x;
+}
+Foo? foo = null;
+Bar bar = new Bar;
+bar.a = 1;
+bar.a = 2;
+return bar.a;
+
+*/
+ 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="p2">$2</TD><TD PORT="p3">$3</TD><TD PORT="p4">$4</TD></TR>
+ </TABLE>
+ </TD></TR>
+ </TABLE>>
+ ];
+ Stop3 [ shape=box style=filled fillcolor=yellow label="Stop" ];
+ new10 [ label="new Bar" ];
+ Con_11 [ label="#0" ];
+ Store12 [ label=".a =" ];
+ Store13 [ label=".b =" ];
+ Con_14 [ label="#1" ];
+ Store15 [ label=".a =" ];
+ Con_16 [ label="#2" ];
+ Store17 [ label=".a =" ];
+ Load18 [ label=".a" ];
+ Return19 [ shape=box style=filled fillcolor=yellow label="Return" ];
+ }
+ edge [ fontname=Helvetica, fontsize=8 ];
+ Stop3 -> Return19[taillabel=0 color=red];
+ new10 -> Start2:p0[taillabel=0 color=green];
+ Store12 -> Start2:p2[taillabel=1 color=blue];
+ Store12 -> new10[taillabel=2];
+ Store12 -> Con_11[taillabel=3];
+ Store13 -> Start2:p3[taillabel=1 color=blue];
+ Store13 -> new10[taillabel=2];
+ Store13 -> Con_11[taillabel=3];
+ Store15 -> Store12[taillabel=1 color=blue];
+ Store15 -> new10[taillabel=2];
+ Store15 -> Con_14[taillabel=3];
+ Store17 -> Store15[taillabel=1 color=blue];
+ Store17 -> new10[taillabel=2];
+ Store17 -> Con_16[taillabel=3];
+ Load18 -> Store17[taillabel=1 color=blue];
+ Load18 -> new10[taillabel=2];
+ Return19 -> Start2:p0[taillabel=0 color=red];
+ Return19 -> Load18[taillabel=1];
+ Return19 -> Store17[taillabel=2 color=blue];
+ Return19 -> Store13[taillabel=3 color=blue];
+ Return19 -> Start2:p4[taillabel=4 color=blue];
+}
diff --git a/chapter10/docs/example2a.svg b/chapter10/docs/example2a.svg
new file mode 100644
index 00000000..9f069ad4
--- /dev/null
+++ b/chapter10/docs/example2a.svg
@@ -0,0 +1,249 @@
+<?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 2.43.0 (0)
+ -->
+<!-- Title: chapter10 Pages: 1 -->
+<svg width="331pt" height="608pt"
+ viewBox="0.00 0.00 331.00 608.00" 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 604)">
+<title>chapter10</title>
+<polygon fill="white" stroke="transparent" points="-4,4 -4,-604 327,-604 327,4 -4,4"/>
+<g id="clust1" class="cluster">
+<title>cluster_Nodes</title>
+<polygon fill="none" stroke="black" points="8,-8 8,-592 315,-592 315,-8 8,-8"/>
+</g>
+<!-- Start2 -->
+<g id="node1" class="node">
+<title>Start2</title>
+<polygon fill="yellow" stroke="transparent" points="129,-555 129,-580 254,-580 254,-555 129,-555"/>
+<polygon fill="none" stroke="black" points="129,-555 129,-580 254,-580 254,-555 129,-555"/>
+<text text-anchor="start" x="173" y="-563.8" font-family="Times,serif" font-size="14.00">Start</text>
+<polygon fill="none" stroke="black" points="129,-524 129,-555 254,-555 254,-524 129,-524"/>
+<polygon fill="yellow" stroke="transparent" points="134,-529 134,-550 174,-550 174,-529 134,-529"/>
+<polygon fill="none" stroke="black" points="134,-529 134,-550 174,-550 174,-529 134,-529"/>
+<text text-anchor="start" x="137" y="-535.8" font-family="Times,serif" font-size="14.00">$ctrl</text>
+<polygon fill="none" stroke="black" points="174,-529 174,-550 199,-550 199,-529 174,-529"/>
+<text text-anchor="start" x="177" y="-535.8" font-family="Times,serif" font-size="14.00">$2</text>
+<polygon fill="none" stroke="black" points="199,-529 199,-550 224,-550 224,-529 199,-529"/>
+<text text-anchor="start" x="202" y="-535.8" font-family="Times,serif" font-size="14.00">$3</text>
+<polygon fill="none" stroke="black" points="224,-529 224,-550 249,-550 249,-529 224,-529"/>
+<text text-anchor="start" x="227" y="-535.8" font-family="Times,serif" font-size="14.00">$4</text>
+</g>
+<!-- Stop3 -->
+<g id="node2" class="node">
+<title>Stop3</title>
+<polygon fill="yellow" stroke="black" points="101,-52 47,-52 47,-16 101,-16 101,-52"/>
+<text text-anchor="middle" x="74" y="-30.3" font-family="Times,serif" font-size="14.00">Stop</text>
+</g>
+<!-- Return19 -->
+<g id="node12" class="node">
+<title>Return19</title>
+<polygon fill="yellow" stroke="black" points="107,-124 41,-124 41,-88 107,-88 107,-124"/>
+<text text-anchor="middle" x="74" y="-102.3" font-family="Times,serif" font-size="14.00">Return</text>
+</g>
+<!-- Stop3&#45;&gt;Return19 -->
+<g id="edge1" class="edge">
+<title>Stop3&#45;&gt;Return19</title>
+<path fill="none" stroke="red" d="M74,-52.3C74,-60.02 74,-69.29 74,-77.89"/>
+<polygon fill="red" stroke="red" points="70.5,-77.9 74,-87.9 77.5,-77.9 70.5,-77.9"/>
+<text text-anchor="middle" x="71" y="-54.9" font-family="Helvetica,sans-Serif" font-size="8.00">0</text>
+</g>
+<!-- new10 -->
+<g id="node3" class="node">
+<title>new10</title>
+<ellipse fill="none" stroke="black" cx="118" cy="-466" rx="49.29" ry="18"/>
+<text text-anchor="middle" x="118" y="-462.3" font-family="Times,serif" font-size="14.00">new Bar</text>
+</g>
+<!-- new10&#45;&gt;Start2 -->
+<g id="edge2" class="edge">
+<title>new10&#45;&gt;Start2:p0</title>
+<path fill="none" stroke="green" d="M133.89,-483.12C141.58,-492.29 149.78,-504.57 152.8,-517.77"/>
+<polygon fill="green" stroke="green" points="149.36,-518.48 154,-528 156.31,-517.66 149.36,-518.48"/>
+<text text-anchor="middle" x="130.89" y="-485.72" font-family="Helvetica,sans-Serif" font-size="8.00">0</text>
+</g>
+<!-- Con_11 -->
+<g id="node4" class="node">
+<title>Con_11</title>
+<ellipse fill="none" stroke="black" cx="232" cy="-466" rx="27" ry="18"/>
+<text text-anchor="middle" x="232" y="-462.3" font-family="Times,serif" font-size="14.00">#0</text>
+</g>
+<!-- Store12 -->
+<g id="node5" class="node">
+<title>Store12</title>
+<ellipse fill="none" stroke="black" cx="178" cy="-394" rx="29.8" ry="18"/>
+<text text-anchor="middle" x="178" y="-390.3" font-family="Times,serif" font-size="14.00">.a =</text>
+</g>
+<!-- Store12&#45;&gt;Start2 -->
+<g id="edge3" class="edge">
+<title>Store12&#45;&gt;Start2:p2</title>
+<path fill="none" stroke="blue" d="M179.7,-412.2C181.85,-435.45 185.36,-478.51 185.92,-517.62"/>
+<polygon fill="blue" stroke="blue" points="182.43,-518.03 186,-528 189.43,-517.97 182.43,-518.03"/>
+<text text-anchor="middle" x="176.7" y="-414.8" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
+</g>
+<!-- Store12&#45;&gt;new10 -->
+<g id="edge4" class="edge">
+<title>Store12&#45;&gt;new10</title>
+<path fill="none" stroke="black" d="M164.68,-410.54C157.06,-419.43 147.32,-430.79 138.71,-440.84"/>
+<polygon fill="black" stroke="black" points="135.97,-438.66 132.11,-448.53 141.28,-443.22 135.97,-438.66"/>
+<text text-anchor="middle" x="161.68" y="-413.14" font-family="Helvetica,sans-Serif" font-size="8.00">2</text>
+</g>
+<!-- Store12&#45;&gt;Con_11 -->
+<g id="edge5" class="edge">
+<title>Store12&#45;&gt;Con_11</title>
+<path fill="none" stroke="black" d="M189.98,-410.54C196.98,-419.6 205.94,-431.21 213.79,-441.39"/>
+<polygon fill="black" stroke="black" points="211.17,-443.73 220.05,-449.51 216.71,-439.45 211.17,-443.73"/>
+<text text-anchor="middle" x="186.98" y="-413.14" font-family="Helvetica,sans-Serif" font-size="8.00">3</text>
+</g>
+<!-- Store13 -->
+<g id="node6" class="node">
+<title>Store13</title>
+<ellipse fill="none" stroke="black" cx="256" cy="-394" rx="30.59" ry="18"/>
+<text text-anchor="middle" x="256" y="-390.3" font-family="Times,serif" font-size="14.00">.b =</text>
+</g>
+<!-- Store13&#45;&gt;Start2 -->
+<g id="edge6" class="edge">
+<title>Store13&#45;&gt;Start2:p3</title>
+<path fill="none" stroke="blue" d="M263.6,-411.63C270.91,-430.21 279.31,-460.72 268,-484 256,-508.69 222.7,-499.84 214.07,-517.7"/>
+<polygon fill="blue" stroke="blue" points="210.54,-517.51 212,-528 217.4,-518.88 210.54,-517.51"/>
+<text text-anchor="middle" x="260.6" y="-414.23" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
+</g>
+<!-- Store13&#45;&gt;new10 -->
+<g id="edge7" class="edge">
+<title>Store13&#45;&gt;new10</title>
+<path fill="none" stroke="black" d="M233.52,-406.4C212.26,-417.19 179.96,-433.57 154.91,-446.28"/>
+<polygon fill="black" stroke="black" points="153.04,-443.3 145.71,-450.95 156.21,-449.54 153.04,-443.3"/>
+<text text-anchor="middle" x="230.52" y="-409" font-family="Helvetica,sans-Serif" font-size="8.00">2</text>
+</g>
+<!-- Store13&#45;&gt;Con_11 -->
+<g id="edge8" class="edge">
+<title>Store13&#45;&gt;Con_11</title>
+<path fill="none" stroke="black" d="M250.19,-411.95C247.45,-419.94 244.11,-429.67 241.05,-438.6"/>
+<polygon fill="black" stroke="black" points="237.69,-437.62 237.76,-448.21 244.31,-439.89 237.69,-437.62"/>
+<text text-anchor="middle" x="247.19" y="-414.55" font-family="Helvetica,sans-Serif" font-size="8.00">3</text>
+</g>
+<!-- Con_14 -->
+<g id="node7" class="node">
+<title>Con_14</title>
+<ellipse fill="none" stroke="black" cx="83" cy="-394" rx="27" ry="18"/>
+<text text-anchor="middle" x="83" y="-390.3" font-family="Times,serif" font-size="14.00">#1</text>
+</g>
+<!-- Store15 -->
+<g id="node8" class="node">
+<title>Store15</title>
+<ellipse fill="none" stroke="black" cx="86" cy="-322" rx="29.8" ry="18"/>
+<text text-anchor="middle" x="86" y="-318.3" font-family="Times,serif" font-size="14.00">.a =</text>
+</g>
+<!-- Store15&#45;&gt;new10 -->
+<g id="edge10" class="edge">
+<title>Store15&#45;&gt;new10</title>
+<path fill="none" stroke="black" d="M98.96,-338.58C106.42,-348.58 115.07,-362.24 119,-376 124.76,-396.15 124.14,-419.93 122.28,-437.84"/>
+<polygon fill="black" stroke="black" points="118.79,-437.53 121.04,-447.89 125.74,-438.39 118.79,-437.53"/>
+<text text-anchor="middle" x="95.96" y="-341.18" font-family="Helvetica,sans-Serif" font-size="8.00">2</text>
+</g>
+<!-- Store15&#45;&gt;Store12 -->
+<g id="edge9" class="edge">
+<title>Store15&#45;&gt;Store12</title>
+<path fill="none" stroke="blue" d="M103.74,-336.5C117.4,-346.89 136.48,-361.41 151.88,-373.13"/>
+<polygon fill="blue" stroke="blue" points="149.92,-376.04 160,-379.31 154.16,-370.47 149.92,-376.04"/>
+<text text-anchor="middle" x="106.74" y="-339.1" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
+</g>
+<!-- Store15&#45;&gt;Con_14 -->
+<g id="edge11" class="edge">
+<title>Store15&#45;&gt;Con_14</title>
+<path fill="none" stroke="black" d="M85.26,-340.3C84.93,-348.02 84.53,-357.29 84.16,-365.89"/>
+<polygon fill="black" stroke="black" points="80.66,-365.75 83.73,-375.9 87.66,-366.05 80.66,-365.75"/>
+<text text-anchor="middle" x="82.26" y="-342.9" font-family="Helvetica,sans-Serif" font-size="8.00">3</text>
+</g>
+<!-- Con_16 -->
+<g id="node9" class="node">
+<title>Con_16</title>
+<ellipse fill="none" stroke="black" cx="161" cy="-322" rx="27" ry="18"/>
+<text text-anchor="middle" x="161" y="-318.3" font-family="Times,serif" font-size="14.00">#2</text>
+</g>
+<!-- Store17 -->
+<g id="node10" class="node">
+<title>Store17</title>
+<ellipse fill="none" stroke="black" cx="86" cy="-250" rx="29.8" ry="18"/>
+<text text-anchor="middle" x="86" y="-246.3" font-family="Times,serif" font-size="14.00">.a =</text>
+</g>
+<!-- Store17&#45;&gt;new10 -->
+<g id="edge13" class="edge">
+<title>Store17&#45;&gt;new10</title>
+<path fill="none" stroke="black" d="M70.13,-265.26C57.27,-278.25 40.68,-298.75 37,-321"/>
+<text text-anchor="middle" x="67.13" y="-267.86" font-family="Helvetica,sans-Serif" font-size="8.00">2</text>
+</g>
+<!-- Store17&#45;&gt;Store15 -->
+<g id="edge12" class="edge">
+<title>Store17&#45;&gt;Store15</title>
+<path fill="none" stroke="blue" d="M86,-268.3C86,-276.02 86,-285.29 86,-293.89"/>
+<polygon fill="blue" stroke="blue" points="82.5,-293.9 86,-303.9 89.5,-293.9 82.5,-293.9"/>
+<text text-anchor="middle" x="83" y="-270.9" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
+</g>
+<!-- Store17&#45;&gt;Con_16 -->
+<g id="edge14" class="edge">
+<title>Store17&#45;&gt;Con_16</title>
+<path fill="none" stroke="black" d="M101.54,-265.5C112.24,-275.49 126.62,-288.91 138.56,-300.06"/>
+<polygon fill="black" stroke="black" points="136.29,-302.73 145.99,-306.99 141.07,-297.61 136.29,-302.73"/>
+<text text-anchor="middle" x="98.54" y="-268.1" font-family="Helvetica,sans-Serif" font-size="8.00">3</text>
+</g>
+<!-- Load18 -->
+<g id="node11" class="node">
+<title>Load18</title>
+<ellipse fill="none" stroke="black" cx="74" cy="-178" rx="27" ry="18"/>
+<text text-anchor="middle" x="74" y="-174.3" font-family="Times,serif" font-size="14.00">.a</text>
+</g>
+<!-- Load18&#45;&gt;new10 -->
+<g id="edge16" class="edge">
+<title>Load18&#45;&gt;new10</title>
+<path fill="none" stroke="black" d="M63.89,-195.07C57.97,-205.26 50.92,-218.94 47,-232 35.56,-270.12 43.5,-281.73 37,-321"/>
+<path fill="none" stroke="black" d="M37,-323C29.78,-362.14 27.2,-377.47 47,-412 54.9,-425.77 67.96,-437.05 80.75,-445.61"/>
+<polygon fill="black" stroke="black" points="79.16,-448.74 89.49,-451.1 82.88,-442.82 79.16,-448.74"/>
+<text text-anchor="middle" x="60.89" y="-197.67" font-family="Helvetica,sans-Serif" font-size="8.00">2</text>
+</g>
+<!-- Load18&#45;&gt;Store17 -->
+<g id="edge15" class="edge">
+<title>Load18&#45;&gt;Store17</title>
+<path fill="none" stroke="blue" d="M76.9,-195.95C78.23,-203.65 79.82,-212.97 81.31,-221.64"/>
+<polygon fill="blue" stroke="blue" points="77.9,-222.46 83.04,-231.72 84.8,-221.28 77.9,-222.46"/>
+<text text-anchor="middle" x="73.9" y="-198.55" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
+</g>
+<!-- Return19&#45;&gt;Start2 -->
+<g id="edge17" class="edge">
+<title>Return19&#45;&gt;Start2:p0</title>
+<path fill="none" stroke="red" d="M59.94,-124.2C52.45,-134.13 43.64,-147.17 38,-160 21.64,-197.21 17,-208.36 17,-249 17,-249 17,-249 17,-395 17,-473.65 47.97,-533.65 122.67,-538.66"/>
+<polygon fill="red" stroke="red" points="122.89,-542.17 133,-539 123.12,-535.17 122.89,-542.17"/>
+<text text-anchor="middle" x="56.94" y="-126.8" font-family="Helvetica,sans-Serif" font-size="8.00">0</text>
+</g>
+<!-- Return19&#45;&gt;Start2 -->
+<g id="edge21" class="edge">
+<title>Return19&#45;&gt;Start2:p4</title>
+<path fill="none" stroke="blue" d="M306,-323C287.16,-411.95 339.16,-519.36 271.5,-536.61"/>
+<polygon fill="blue" stroke="blue" points="270.87,-533.17 261.65,-538.38 272.11,-540.06 270.87,-533.17"/>
+<text text-anchor="middle" x="303" y="-316.6" font-family="Helvetica,sans-Serif" font-size="8.00">4</text>
+</g>
+<!-- Return19&#45;&gt;Store13 -->
+<g id="edge20" class="edge">
+<title>Return19&#45;&gt;Store13</title>
+<path fill="none" stroke="blue" d="M306,-179C314.76,-241.5 316.5,-258.77 306,-321"/>
+<path fill="none" stroke="blue" d="M306,-323C302.13,-341.27 290.11,-358.39 278.83,-371.13"/>
+<polygon fill="blue" stroke="blue" points="276.24,-368.77 271.98,-378.47 281.36,-373.55 276.24,-368.77"/>
+<text text-anchor="middle" x="303" y="-172.6" font-family="Helvetica,sans-Serif" font-size="8.00">3</text>
+</g>
+<!-- Return19&#45;&gt;Store17 -->
+<g id="edge19" class="edge">
+<title>Return19&#45;&gt;Store17</title>
+<path fill="none" stroke="blue" d="M107.24,-110.22C170.02,-117.23 300.33,-136.59 306,-177"/>
+<path fill="none" stroke="blue" d="M306,-179C311.23,-216.32 190.09,-236.58 125.4,-244.71"/>
+<polygon fill="blue" stroke="blue" points="124.65,-241.27 115.15,-245.95 125.5,-248.22 124.65,-241.27"/>
+<text text-anchor="middle" x="110.24" y="-103.82" font-family="Helvetica,sans-Serif" font-size="8.00">2</text>
+</g>
+<!-- Return19&#45;&gt;Load18 -->
+<g id="edge18" class="edge">
+<title>Return19&#45;&gt;Load18</title>
+<path fill="none" stroke="black" d="M74,-124.3C74,-132.02 74,-141.29 74,-149.89"/>
+<polygon fill="black" stroke="black" points="70.5,-149.9 74,-159.9 77.5,-149.9 70.5,-149.9"/>
+<text text-anchor="middle" x="71" y="-126.9" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
+</g>
+</g>
+</svg>
diff --git a/chapter10/docs/example2b.gv b/chapter10/docs/example2b.gv
new file mode 100644
index 00000000..a7d4ac62
--- /dev/null
+++ b/chapter10/docs/example2b.gv
@@ -0,0 +1,56 @@
+digraph chapter10 {
+/*
+struct Bar {
+ int a;
+ int b;
+}
+struct Foo {
+ int x;
+}
+Foo? foo = null;
+Bar bar = new Bar;
+bar.a = 1;
+bar.a = 2;
+return bar.a;
+
+*/
+ 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="p2">$2</TD><TD PORT="p3">$3</TD><TD PORT="p4">$4</TD></TR>
+ </TABLE>
+ </TD></TR>
+ </TABLE>>
+ ];
+ Stop3 [ shape=box style=filled fillcolor=yellow label="Stop" ];
+ new10 [ label="new Bar" ];
+ Con_11 [ label="#0" ];
+ Store13 [ label=".b =" ];
+ Con_16 [ label="#2" ];
+ Store17 [ label=".a =" ];
+ Load18 [ label=".a" ];
+ Return19 [ shape=box style=filled fillcolor=yellow label="Return" ];
+ }
+ edge [ fontname=Helvetica, fontsize=8 ];
+ Stop3 -> Return19[taillabel=0 color=red];
+ new10 -> Start2:p0[taillabel=0 color=green];
+ Store13 -> Start2:p3[taillabel=1 color=blue];
+ Store13 -> new10[taillabel=2];
+ Store13 -> Con_11[taillabel=3];
+ Store17 -> Start2:p2[taillabel=1 color=blue];
+ Store17 -> new10[taillabel=2];
+ Store17 -> Con_16[taillabel=3];
+ Load18 -> Store17[taillabel=1 color=blue];
+ Load18 -> new10[taillabel=2];
+ Return19 -> Start2:p0[taillabel=0 color=red];
+ Return19 -> Load18[taillabel=1];
+ Return19 -> Store17[taillabel=2 color=blue];
+ Return19 -> Store13[taillabel=3 color=blue];
+ Return19 -> Start2:p4[taillabel=4 color=blue];
+} \ No newline at end of file
diff --git a/chapter10/docs/example2b.svg b/chapter10/docs/example2b.svg
new file mode 100644
index 00000000..1ecf4de7
--- /dev/null
+++ b/chapter10/docs/example2b.svg
@@ -0,0 +1,189 @@
+<?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 2.43.0 (0)
+ -->
+<!-- Title: chapter10 Pages: 1 -->
+<svg width="369pt" height="464pt"
+ viewBox="0.00 0.00 368.60 464.00" 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 460)">
+<title>chapter10</title>
+<polygon fill="white" stroke="transparent" points="-4,4 -4,-460 364.6,-460 364.6,4 -4,4"/>
+<g id="clust1" class="cluster">
+<title>cluster_Nodes</title>
+<polygon fill="none" stroke="black" points="8,-8 8,-448 346,-448 346,-8 8,-8"/>
+</g>
+<!-- Start2 -->
+<g id="node1" class="node">
+<title>Start2</title>
+<polygon fill="yellow" stroke="transparent" points="152,-411 152,-436 277,-436 277,-411 152,-411"/>
+<polygon fill="none" stroke="black" points="152,-411 152,-436 277,-436 277,-411 152,-411"/>
+<text text-anchor="start" x="196" y="-419.8" font-family="Times,serif" font-size="14.00">Start</text>
+<polygon fill="none" stroke="black" points="152,-380 152,-411 277,-411 277,-380 152,-380"/>
+<polygon fill="yellow" stroke="transparent" points="157,-385 157,-406 197,-406 197,-385 157,-385"/>
+<polygon fill="none" stroke="black" points="157,-385 157,-406 197,-406 197,-385 157,-385"/>
+<text text-anchor="start" x="160" y="-391.8" font-family="Times,serif" font-size="14.00">$ctrl</text>
+<polygon fill="none" stroke="black" points="197,-385 197,-406 222,-406 222,-385 197,-385"/>
+<text text-anchor="start" x="200" y="-391.8" font-family="Times,serif" font-size="14.00">$2</text>
+<polygon fill="none" stroke="black" points="222,-385 222,-406 247,-406 247,-385 222,-385"/>
+<text text-anchor="start" x="225" y="-391.8" font-family="Times,serif" font-size="14.00">$3</text>
+<polygon fill="none" stroke="black" points="247,-385 247,-406 272,-406 272,-385 247,-385"/>
+<text text-anchor="start" x="250" y="-391.8" font-family="Times,serif" font-size="14.00">$4</text>
+</g>
+<!-- Stop3 -->
+<g id="node2" class="node">
+<title>Stop3</title>
+<polygon fill="yellow" stroke="black" points="139,-52 85,-52 85,-16 139,-16 139,-52"/>
+<text text-anchor="middle" x="112" y="-30.3" font-family="Times,serif" font-size="14.00">Stop</text>
+</g>
+<!-- Return19 -->
+<g id="node9" class="node">
+<title>Return19</title>
+<polygon fill="yellow" stroke="black" points="145,-124 79,-124 79,-88 145,-88 145,-124"/>
+<text text-anchor="middle" x="112" y="-102.3" font-family="Times,serif" font-size="14.00">Return</text>
+</g>
+<!-- Stop3&#45;&gt;Return19 -->
+<g id="edge1" class="edge">
+<title>Stop3&#45;&gt;Return19</title>
+<path fill="none" stroke="red" d="M112,-52.3C112,-60.02 112,-69.29 112,-77.89"/>
+<polygon fill="red" stroke="red" points="108.5,-77.9 112,-87.9 115.5,-77.9 108.5,-77.9"/>
+<text text-anchor="middle" x="109" y="-54.9" font-family="Helvetica,sans-Serif" font-size="8.00">0</text>
+</g>
+<!-- new10 -->
+<g id="node3" class="node">
+<title>new10</title>
+<ellipse fill="none" stroke="black" cx="177" cy="-322" rx="49.29" ry="18"/>
+<text text-anchor="middle" x="177" y="-318.3" font-family="Times,serif" font-size="14.00">new Bar</text>
+</g>
+<!-- new10&#45;&gt;Start2 -->
+<g id="edge2" class="edge">
+<title>new10&#45;&gt;Start2:p0</title>
+<path fill="none" stroke="green" d="M177,-340.09C177,-349.55 177,-361.77 177,-373.69"/>
+<polygon fill="green" stroke="green" points="173.5,-374 177,-384 180.5,-374 173.5,-374"/>
+<text text-anchor="middle" x="174" y="-342.69" font-family="Helvetica,sans-Serif" font-size="8.00">0</text>
+</g>
+<!-- Con_11 -->
+<g id="node4" class="node">
+<title>Con_11</title>
+<ellipse fill="none" stroke="black" cx="291" cy="-322" rx="27" ry="18"/>
+<text text-anchor="middle" x="291" y="-318.3" font-family="Times,serif" font-size="14.00">#0</text>
+</g>
+<!-- Store13 -->
+<g id="node5" class="node">
+<title>Store13</title>
+<ellipse fill="none" stroke="black" cx="266" cy="-250" rx="30.59" ry="18"/>
+<text text-anchor="middle" x="266" y="-246.3" font-family="Times,serif" font-size="14.00">.b =</text>
+</g>
+<!-- Store13&#45;&gt;Start2 -->
+<g id="edge3" class="edge">
+<title>Store13&#45;&gt;Start2:p3</title>
+<path fill="none" stroke="blue" d="M259.43,-267.92C251.04,-290.96 237.36,-333.9 235.27,-373.91"/>
+<polygon fill="blue" stroke="blue" points="231.77,-373.91 235,-384 238.77,-374.1 231.77,-373.91"/>
+<text text-anchor="middle" x="256.43" y="-270.52" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
+</g>
+<!-- Store13&#45;&gt;new10 -->
+<g id="edge4" class="edge">
+<title>Store13&#45;&gt;new10</title>
+<path fill="none" stroke="black" d="M248.42,-264.83C235.97,-274.62 219.01,-287.96 204.75,-299.17"/>
+<polygon fill="black" stroke="black" points="202.41,-296.56 196.72,-305.49 206.74,-302.06 202.41,-296.56"/>
+<text text-anchor="middle" x="245.42" y="-267.43" font-family="Helvetica,sans-Serif" font-size="8.00">2</text>
+</g>
+<!-- Store13&#45;&gt;Con_11 -->
+<g id="edge5" class="edge">
+<title>Store13&#45;&gt;Con_11</title>
+<path fill="none" stroke="black" d="M272.05,-267.95C274.91,-275.94 278.38,-285.67 281.57,-294.6"/>
+<polygon fill="black" stroke="black" points="278.34,-295.97 285,-304.21 284.94,-293.62 278.34,-295.97"/>
+<text text-anchor="middle" x="269.05" y="-270.55" font-family="Helvetica,sans-Serif" font-size="8.00">3</text>
+</g>
+<!-- Con_16 -->
+<g id="node6" class="node">
+<title>Con_16</title>
+<ellipse fill="none" stroke="black" cx="83" cy="-322" rx="27" ry="18"/>
+<text text-anchor="middle" x="83" y="-318.3" font-family="Times,serif" font-size="14.00">#2</text>
+</g>
+<!-- Store17 -->
+<g id="node7" class="node">
+<title>Store17</title>
+<ellipse fill="none" stroke="black" cx="74" cy="-250" rx="29.8" ry="18"/>
+<text text-anchor="middle" x="74" y="-246.3" font-family="Times,serif" font-size="14.00">.a =</text>
+</g>
+<!-- Store17&#45;&gt;Start2 -->
+<g id="edge6" class="edge">
+<title>Store17&#45;&gt;Start2:p2</title>
+<path fill="none" stroke="blue" d="M61.5,-266.67C47.91,-285.72 30.23,-318.07 47,-340 90.02,-396.26 197.33,-318.14 208.12,-373.87"/>
+<polygon fill="blue" stroke="blue" points="204.65,-374.34 209,-384 211.62,-373.74 204.65,-374.34"/>
+<text text-anchor="middle" x="58.5" y="-269.27" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
+</g>
+<!-- Store17&#45;&gt;new10 -->
+<g id="edge7" class="edge">
+<title>Store17&#45;&gt;new10</title>
+<path fill="none" stroke="black" d="M93.37,-264.17C108.16,-274.22 128.83,-288.27 145.92,-299.88"/>
+<polygon fill="black" stroke="black" points="144.25,-302.97 154.49,-305.7 148.18,-297.18 144.25,-302.97"/>
+<text text-anchor="middle" x="90.37" y="-266.77" font-family="Helvetica,sans-Serif" font-size="8.00">2</text>
+</g>
+<!-- Store17&#45;&gt;Con_16 -->
+<g id="edge8" class="edge">
+<title>Store17&#45;&gt;Con_16</title>
+<path fill="none" stroke="black" d="M76.22,-268.3C77.22,-276.02 78.41,-285.29 79.51,-293.89"/>
+<polygon fill="black" stroke="black" points="76.05,-294.42 80.8,-303.9 83,-293.53 76.05,-294.42"/>
+<text text-anchor="middle" x="73.22" y="-270.9" font-family="Helvetica,sans-Serif" font-size="8.00">3</text>
+</g>
+<!-- Load18 -->
+<g id="node8" class="node">
+<title>Load18</title>
+<ellipse fill="none" stroke="black" cx="112" cy="-178" rx="27" ry="18"/>
+<text text-anchor="middle" x="112" y="-174.3" font-family="Times,serif" font-size="14.00">.a</text>
+</g>
+<!-- Load18&#45;&gt;new10 -->
+<g id="edge10" class="edge">
+<title>Load18&#45;&gt;new10</title>
+<path fill="none" stroke="black" d="M119.58,-195.57C130.78,-220.02 151.82,-266 165.09,-294.98"/>
+<polygon fill="black" stroke="black" points="161.92,-296.46 169.26,-304.1 168.28,-293.55 161.92,-296.46"/>
+<text text-anchor="middle" x="116.58" y="-198.17" font-family="Helvetica,sans-Serif" font-size="8.00">2</text>
+</g>
+<!-- Load18&#45;&gt;Store17 -->
+<g id="edge9" class="edge">
+<title>Load18&#45;&gt;Store17</title>
+<path fill="none" stroke="blue" d="M103.19,-195.24C98.65,-203.6 93.01,-213.98 87.9,-223.39"/>
+<polygon fill="blue" stroke="blue" points="84.72,-221.91 83.03,-232.37 90.88,-225.25 84.72,-221.91"/>
+<text text-anchor="middle" x="100.19" y="-197.84" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
+</g>
+<!-- Return19&#45;&gt;Start2 -->
+<g id="edge11" class="edge">
+<title>Return19&#45;&gt;Start2:p0</title>
+<path fill="none" stroke="red" d="M78.92,-118.71C54.82,-129.48 25.06,-148.19 17,-177"/>
+<path fill="none" stroke="red" d="M17,-179C-2.42,-248.44 -5.52,-281.77 37,-340 66.51,-380.41 90.13,-391.98 133.12,-394.44"/>
+<polygon fill="red" stroke="red" points="133.09,-397.94 143.22,-394.85 133.37,-390.94 133.09,-397.94"/>
+<text text-anchor="middle" x="75.92" y="-112.31" font-family="Helvetica,sans-Serif" font-size="8.00">0</text>
+</g>
+<!-- Return19&#45;&gt;Start2 -->
+<g id="edge15" class="edge">
+<title>Return19&#45;&gt;Start2:p4</title>
+<path fill="none" stroke="blue" d="M337,-179C373.1,-264.02 373.34,-375.99 294.56,-392.84"/>
+<polygon fill="blue" stroke="blue" points="293.9,-389.4 284.56,-394.41 294.99,-396.32 293.9,-389.4"/>
+<text text-anchor="middle" x="334" y="-172.6" font-family="Helvetica,sans-Serif" font-size="8.00">4</text>
+</g>
+<!-- Return19&#45;&gt;Store13 -->
+<g id="edge14" class="edge">
+<title>Return19&#45;&gt;Store13</title>
+<path fill="none" stroke="blue" d="M145.2,-111.29C204,-119.77 321.73,-141.04 337,-177"/>
+<path fill="none" stroke="blue" d="M337,-179C346.91,-202.35 322.21,-221.91 299.27,-234.36"/>
+<polygon fill="blue" stroke="blue" points="297.63,-231.27 290.32,-238.94 300.82,-237.5 297.63,-231.27"/>
+<text text-anchor="middle" x="148.2" y="-104.89" font-family="Helvetica,sans-Serif" font-size="8.00">3</text>
+</g>
+<!-- Return19&#45;&gt;Store17 -->
+<g id="edge13" class="edge">
+<title>Return19&#45;&gt;Store17</title>
+<path fill="none" stroke="blue" d="M17,-179C11.2,-199.75 28.07,-218.41 44.94,-231.23"/>
+<polygon fill="blue" stroke="blue" points="42.94,-234.1 53.12,-237.04 46.99,-228.4 42.94,-234.1"/>
+<text text-anchor="middle" x="14" y="-172.6" font-family="Helvetica,sans-Serif" font-size="8.00">2</text>
+</g>
+<!-- Return19&#45;&gt;Load18 -->
+<g id="edge12" class="edge">
+<title>Return19&#45;&gt;Load18</title>
+<path fill="none" stroke="black" d="M112,-124.3C112,-132.02 112,-141.29 112,-149.89"/>
+<polygon fill="black" stroke="black" points="108.5,-149.9 112,-159.9 115.5,-149.9 108.5,-149.9"/>
+<text text-anchor="middle" x="109" y="-126.9" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
+</g>
+</g>
+</svg>
diff --git a/chapter10/docs/example2c.gv b/chapter10/docs/example2c.gv
new file mode 100644
index 00000000..7bd21542
--- /dev/null
+++ b/chapter10/docs/example2c.gv
@@ -0,0 +1,53 @@
+digraph chapter10 {
+/*
+struct Bar {
+ int a;
+ int b;
+}
+struct Foo {
+ int x;
+}
+Foo? foo = null;
+Bar bar = new Bar;
+bar.a = 1;
+bar.a = 2;
+return bar.a;
+
+*/
+ rankdir=BT;
+ concentrate="true";
+ compound="true";
+ subgraph cluster_Nodes {
+ Con_16 [ label="#2" ];
+ Store17 [ label=".a =" ];
+ 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="p2">$2</TD><TD PORT="p3">$3</TD><TD PORT="p4">$4</TD></TR>
+ </TABLE>
+ </TD></TR>
+ </TABLE>>
+ ];
+ Return19 [ shape=box style=filled fillcolor=yellow label="Return" ];
+ Stop3 [ shape=box style=filled fillcolor=yellow label="Stop" ];
+ new10 [ label="new Bar" ];
+ Con_11 [ label="#0" ];
+ Store13 [ label=".b =" ];
+ }
+ edge [ fontname=Helvetica, fontsize=8 ];
+ Store17 -> Start2:p2[taillabel=1 color=blue];
+ Store17 -> new10[taillabel=2];
+ Store17 -> Con_16[taillabel=3];
+ Return19 -> Start2:p0[taillabel=0 color=red];
+ Return19 -> Con_16[taillabel=1];
+ Return19 -> Store17[taillabel=2 color=blue];
+ Return19 -> Store13[taillabel=3 color=blue];
+ Return19 -> Start2:p4[taillabel=4 color=blue];
+ Stop3 -> Return19[taillabel=0 color=red];
+ new10 -> Start2:p0[taillabel=0 color=green];
+ Store13 -> Start2:p3[taillabel=1 color=blue];
+ Store13 -> new10[taillabel=2];
+ Store13 -> Con_11[taillabel=3];
+} \ No newline at end of file
diff --git a/chapter10/docs/example2c.svg b/chapter10/docs/example2c.svg
new file mode 100644
index 00000000..d70660a2
--- /dev/null
+++ b/chapter10/docs/example2c.svg
@@ -0,0 +1,168 @@
+<?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 2.43.0 (0)
+ -->
+<!-- Title: chapter10 Pages: 1 -->
+<svg width="362pt" height="392pt"
+ viewBox="0.00 0.00 362.00 392.00" 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 388)">
+<title>chapter10</title>
+<polygon fill="white" stroke="transparent" points="-4,4 -4,-388 358,-388 358,4 -4,4"/>
+<g id="clust1" class="cluster">
+<title>cluster_Nodes</title>
+<polygon fill="none" stroke="black" points="8,-8 8,-376 346,-376 346,-8 8,-8"/>
+</g>
+<!-- Con_16 -->
+<g id="node1" class="node">
+<title>Con_16</title>
+<ellipse fill="none" stroke="black" cx="63" cy="-250" rx="27" ry="18"/>
+<text text-anchor="middle" x="63" y="-246.3" font-family="Times,serif" font-size="14.00">#2</text>
+</g>
+<!-- Store17 -->
+<g id="node2" class="node">
+<title>Store17</title>
+<ellipse fill="none" stroke="black" cx="130" cy="-178" rx="29.8" ry="18"/>
+<text text-anchor="middle" x="130" y="-174.3" font-family="Times,serif" font-size="14.00">.a =</text>
+</g>
+<!-- Store17&#45;&gt;Con_16 -->
+<g id="edge3" class="edge">
+<title>Store17&#45;&gt;Con_16</title>
+<path fill="none" stroke="black" d="M115.79,-193.85C106.64,-203.4 94.58,-216.01 84.3,-226.75"/>
+<polygon fill="black" stroke="black" points="81.57,-224.53 77.19,-234.18 86.63,-229.37 81.57,-224.53"/>
+<text text-anchor="middle" x="112.79" y="-196.45" font-family="Helvetica,sans-Serif" font-size="8.00">3</text>
+</g>
+<!-- Start2 -->
+<g id="node3" class="node">
+<title>Start2</title>
+<polygon fill="yellow" stroke="transparent" points="152,-339 152,-364 277,-364 277,-339 152,-339"/>
+<polygon fill="none" stroke="black" points="152,-339 152,-364 277,-364 277,-339 152,-339"/>
+<text text-anchor="start" x="196" y="-347.8" font-family="Times,serif" font-size="14.00">Start</text>
+<polygon fill="none" stroke="black" points="152,-308 152,-339 277,-339 277,-308 152,-308"/>
+<polygon fill="yellow" stroke="transparent" points="157,-313 157,-334 197,-334 197,-313 157,-313"/>
+<polygon fill="none" stroke="black" points="157,-313 157,-334 197,-334 197,-313 157,-313"/>
+<text text-anchor="start" x="160" y="-319.8" font-family="Times,serif" font-size="14.00">$ctrl</text>
+<polygon fill="none" stroke="black" points="197,-313 197,-334 222,-334 222,-313 197,-313"/>
+<text text-anchor="start" x="200" y="-319.8" font-family="Times,serif" font-size="14.00">$2</text>
+<polygon fill="none" stroke="black" points="222,-313 222,-334 247,-334 247,-313 222,-313"/>
+<text text-anchor="start" x="225" y="-319.8" font-family="Times,serif" font-size="14.00">$3</text>
+<polygon fill="none" stroke="black" points="247,-313 247,-334 272,-334 272,-313 247,-313"/>
+<text text-anchor="start" x="250" y="-319.8" font-family="Times,serif" font-size="14.00">$4</text>
+</g>
+<!-- Store17&#45;&gt;Start2 -->
+<g id="edge1" class="edge">
+<title>Store17&#45;&gt;Start2:p2</title>
+<path fill="none" stroke="blue" d="M122.08,-195.45C114.22,-214.42 105.15,-245.81 119,-268 140.46,-302.38 197.41,-273.74 207.47,-301.89"/>
+<polygon fill="blue" stroke="blue" points="204.04,-302.64 209,-312 210.97,-301.59 204.04,-302.64"/>
+<text text-anchor="middle" x="119.08" y="-198.05" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
+</g>
+<!-- new10 -->
+<g id="node6" class="node">
+<title>new10</title>
+<ellipse fill="none" stroke="black" cx="177" cy="-250" rx="49.29" ry="18"/>
+<text text-anchor="middle" x="177" y="-246.3" font-family="Times,serif" font-size="14.00">new Bar</text>
+</g>
+<!-- Store17&#45;&gt;new10 -->
+<g id="edge2" class="edge">
+<title>Store17&#45;&gt;new10</title>
+<path fill="none" stroke="black" d="M140.67,-194.88C146.39,-203.41 153.58,-214.11 160.05,-223.75"/>
+<polygon fill="black" stroke="black" points="157.24,-225.85 165.72,-232.2 163.05,-221.95 157.24,-225.85"/>
+<text text-anchor="middle" x="137.67" y="-197.48" font-family="Helvetica,sans-Serif" font-size="8.00">2</text>
+</g>
+<!-- Return19 -->
+<g id="node4" class="node">
+<title>Return19</title>
+<polygon fill="yellow" stroke="black" points="223,-124 157,-124 157,-88 223,-88 223,-124"/>
+<text text-anchor="middle" x="190" y="-102.3" font-family="Times,serif" font-size="14.00">Return</text>
+</g>
+<!-- Return19&#45;&gt;Con_16 -->
+<g id="edge5" class="edge">
+<title>Return19&#45;&gt;Con_16</title>
+<path fill="none" stroke="black" d="M17,-179C8.57,-197.2 22.58,-216.12 37.3,-229.69"/>
+<polygon fill="black" stroke="black" points="35.08,-232.39 44.95,-236.26 39.65,-227.09 35.08,-232.39"/>
+<text text-anchor="middle" x="14" y="-172.6" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
+</g>
+<!-- Return19&#45;&gt;Store17 -->
+<g id="edge6" class="edge">
+<title>Return19&#45;&gt;Store17</title>
+<path fill="none" stroke="blue" d="M175.17,-124.3C167.47,-133.29 157.96,-144.38 149.66,-154.07"/>
+<polygon fill="blue" stroke="blue" points="146.88,-151.93 143.03,-161.8 152.2,-156.48 146.88,-151.93"/>
+<text text-anchor="middle" x="172.17" y="-126.9" font-family="Helvetica,sans-Serif" font-size="8.00">2</text>
+</g>
+<!-- Return19&#45;&gt;Start2 -->
+<g id="edge4" class="edge">
+<title>Return19&#45;&gt;Start2:p0</title>
+<path fill="none" stroke="red" d="M156.89,-108.08C113.74,-111.57 40.96,-125.25 17,-177"/>
+<path fill="none" stroke="red" d="M17,-179C-17.13,-252.71 52.8,-311.87 132.92,-321.6"/>
+<polygon fill="red" stroke="red" points="132.97,-325.12 143.25,-322.57 133.63,-318.15 132.97,-325.12"/>
+<text text-anchor="middle" x="153.89" y="-101.68" font-family="Helvetica,sans-Serif" font-size="8.00">0</text>
+</g>
+<!-- Return19&#45;&gt;Start2 -->
+<g id="edge8" class="edge">
+<title>Return19&#45;&gt;Start2:p4</title>
+<path fill="none" stroke="blue" d="M223.46,-117.39C245.19,-125.72 272.61,-139.46 290,-160 334.77,-212.87 344.89,-312.63 283.09,-322.25"/>
+<polygon fill="blue" stroke="blue" points="282.71,-318.77 273,-323 283.23,-325.75 282.71,-318.77"/>
+<text text-anchor="middle" x="226.46" y="-110.99" font-family="Helvetica,sans-Serif" font-size="8.00">4</text>
+</g>
+<!-- Store13 -->
+<g id="node8" class="node">
+<title>Store13</title>
+<ellipse fill="none" stroke="black" cx="250" cy="-178" rx="30.59" ry="18"/>
+<text text-anchor="middle" x="250" y="-174.3" font-family="Times,serif" font-size="14.00">.b =</text>
+</g>
+<!-- Return19&#45;&gt;Store13 -->
+<g id="edge7" class="edge">
+<title>Return19&#45;&gt;Store13</title>
+<path fill="none" stroke="blue" d="M204.83,-124.3C212.42,-133.16 221.77,-144.07 229.99,-153.66"/>
+<polygon fill="blue" stroke="blue" points="227.4,-156.01 236.57,-161.33 232.72,-151.46 227.4,-156.01"/>
+<text text-anchor="middle" x="201.83" y="-126.9" font-family="Helvetica,sans-Serif" font-size="8.00">3</text>
+</g>
+<!-- Stop3 -->
+<g id="node5" class="node">
+<title>Stop3</title>
+<polygon fill="yellow" stroke="black" points="217,-52 163,-52 163,-16 217,-16 217,-52"/>
+<text text-anchor="middle" x="190" y="-30.3" font-family="Times,serif" font-size="14.00">Stop</text>
+</g>
+<!-- Stop3&#45;&gt;Return19 -->
+<g id="edge9" class="edge">
+<title>Stop3&#45;&gt;Return19</title>
+<path fill="none" stroke="red" d="M190,-52.3C190,-60.02 190,-69.29 190,-77.89"/>
+<polygon fill="red" stroke="red" points="186.5,-77.9 190,-87.9 193.5,-77.9 186.5,-77.9"/>
+<text text-anchor="middle" x="187" y="-54.9" font-family="Helvetica,sans-Serif" font-size="8.00">0</text>
+</g>
+<!-- new10&#45;&gt;Start2 -->
+<g id="edge10" class="edge">
+<title>new10&#45;&gt;Start2:p0</title>
+<path fill="none" stroke="green" d="M177,-268.09C177,-277.55 177,-289.77 177,-301.69"/>
+<polygon fill="green" stroke="green" points="173.5,-302 177,-312 180.5,-302 173.5,-302"/>
+<text text-anchor="middle" x="174" y="-270.69" font-family="Helvetica,sans-Serif" font-size="8.00">0</text>
+</g>
+<!-- Con_11 -->
+<g id="node7" class="node">
+<title>Con_11</title>
+<ellipse fill="none" stroke="black" cx="271" cy="-250" rx="27" ry="18"/>
+<text text-anchor="middle" x="271" y="-246.3" font-family="Times,serif" font-size="14.00">#0</text>
+</g>
+<!-- Store13&#45;&gt;Start2 -->
+<g id="edge11" class="edge">
+<title>Store13&#45;&gt;Start2:p3</title>
+<path fill="none" stroke="blue" d="M270.42,-191.5C283.57,-200.84 299.55,-214.9 307,-232 313.39,-246.67 314.83,-254.04 307,-268 290.59,-297.26 245.93,-279.37 236.69,-302.12"/>
+<polygon fill="blue" stroke="blue" points="233.23,-301.55 235,-312 240.13,-302.73 233.23,-301.55"/>
+<text text-anchor="middle" x="267.42" y="-194.1" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
+</g>
+<!-- Store13&#45;&gt;new10 -->
+<g id="edge12" class="edge">
+<title>Store13&#45;&gt;new10</title>
+<path fill="none" stroke="black" d="M234.52,-193.85C224.79,-203.17 212.05,-215.39 201.03,-225.96"/>
+<polygon fill="black" stroke="black" points="198.53,-223.51 193.73,-232.96 203.37,-228.56 198.53,-223.51"/>
+<text text-anchor="middle" x="231.52" y="-196.45" font-family="Helvetica,sans-Serif" font-size="8.00">2</text>
+</g>
+<!-- Store13&#45;&gt;Con_11 -->
+<g id="edge13" class="edge">
+<title>Store13&#45;&gt;Con_11</title>
+<path fill="none" stroke="black" d="M255.08,-195.95C257.48,-203.94 260.4,-213.67 263.08,-222.6"/>
+<polygon fill="black" stroke="black" points="259.74,-223.64 265.96,-232.21 266.44,-221.63 259.74,-223.64"/>
+<text text-anchor="middle" x="252.08" y="-198.55" font-family="Helvetica,sans-Serif" font-size="8.00">3</text>
+</g>
+</g>
+</svg>
diff --git a/chapter10/src/main/java/com/seaofnodes/simple/node/LoadNode.java b/chapter10/src/main/java/com/seaofnodes/simple/node/LoadNode.java
index 26e57727..d37c6296 100644
--- a/chapter10/src/main/java/com/seaofnodes/simple/node/LoadNode.java
+++ b/chapter10/src/main/java/com/seaofnodes/simple/node/LoadNode.java
@@ -1,5 +1,6 @@
package com.seaofnodes.simple.node;
+import com.seaofnodes.simple.Utils;
import com.seaofnodes.simple.type.Type;
import com.seaofnodes.simple.type.Field;
@@ -38,6 +39,27 @@ public class LoadNode extends MemOpNode {
@Override
public Node idealize() {
+
+ // Simple Load-after-Store on same address.
+ if( mem() instanceof StoreNode st &&
+ ptr() == st.ptr() ) { // Must check same object
+ assert _field==st._field; // Equiv class aliasing is perfect
+ return st.val();
+ }
+
+ // Push a Load up through a Phi, as long as it collapses on at least one arm.
+ // BEFORE (2 Sts, 1 Ld): AFTER (1 St):
+ // if( pred ) ptr.x = e0; val = pred ? e0
+ // else ptr.x = e1; : e1;
+ // val = ptr.x; ptr.x = val;
+ if( mem() instanceof PhiNode phi && phi.nIns()== 3 &&
+ ((phi.in(1) instanceof StoreNode st1 && ptr()==st1.ptr()) ||
+ (phi.in(2) instanceof StoreNode st2 && ptr()==st2.ptr()) ) ) {
+ Node ld1 = new LoadNode(_field,phi.in(1),ptr()).peephole();
+ Node ld2 = new LoadNode(_field,phi.in(2),ptr()).peephole();
+ return new PhiNode(_field._fname,_type,phi.region(),ld1,ld2);
+ }
+
return null;
}
}
diff --git a/chapter10/src/main/java/com/seaofnodes/simple/node/MemOpNode.java b/chapter10/src/main/java/com/seaofnodes/simple/node/MemOpNode.java
index 4376bb0f..dd68120c 100644
--- a/chapter10/src/main/java/com/seaofnodes/simple/node/MemOpNode.java
+++ b/chapter10/src/main/java/com/seaofnodes/simple/node/MemOpNode.java
@@ -18,7 +18,6 @@ abstract class MemOpNode extends Node {
public Node mem() { return in(1); }
public Node ptr() { return in(2); }
- public Node val() { return nIns() > 3 ? in(3) : null; }
@Override
boolean eq(Node n) {
diff --git a/chapter10/src/main/java/com/seaofnodes/simple/node/Node.java b/chapter10/src/main/java/com/seaofnodes/simple/node/Node.java
index f96b88bd..6a32c092 100644
--- a/chapter10/src/main/java/com/seaofnodes/simple/node/Node.java
+++ b/chapter10/src/main/java/com/seaofnodes/simple/node/Node.java
@@ -178,6 +178,7 @@ public abstract class Node {
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;
}
@@ -264,7 +265,11 @@ public abstract class Node {
// Add bogus null use to keep node alive
public <N extends Node> N keep() { return addUse(null); }
// Remove bogus null.
- public <N extends Node> N unkeep() { delUse(null); return (N)this; }
+ public <N extends Node> N unkeep() {
+ assert Utils.find(_outputs, null) != -1;
+ delUse(null);
+ return (N)this;
+ }
// Replace self with nnn in the graph, making 'this' go dead
@@ -459,9 +464,9 @@ public abstract class Node {
ArrayList<Node> _deps;
/**
- * Add a node to the list o dependencies. Only add it if its not
- * an input or output of this node, that is, it is at least one step
- * away. The node being added must benefit from this node being peepholed.
+ * Add a node to the list of dependencies. Only add it if its not an input
+ * or output of this node, that is, it is at least one step away. The node
+ * being added must benefit from this node being peepholed.
*/
Node addDep( Node dep ) {
// Running peepholes during the big assert cannot have side effects
diff --git a/chapter10/src/main/java/com/seaofnodes/simple/node/PhiNode.java b/chapter10/src/main/java/com/seaofnodes/simple/node/PhiNode.java
index 6261c446..08fe047c 100644
--- a/chapter10/src/main/java/com/seaofnodes/simple/node/PhiNode.java
+++ b/chapter10/src/main/java/com/seaofnodes/simple/node/PhiNode.java
@@ -1,6 +1,7 @@
package com.seaofnodes.simple.node;
import com.seaofnodes.simple.type.Type;
+import com.seaofnodes.simple.type.TypeMem;
import com.seaofnodes.simple.Utils;
import java.util.BitSet;
@@ -36,6 +37,8 @@ public class PhiNode extends Node {
Node region() { return in(0); }
@Override public boolean isMultiTail() { return true; }
+ @Override
+ public boolean isMem() { return _declaredType instanceof TypeMem; }
@Override
public Type compute() {
diff --git a/chapter10/src/main/java/com/seaofnodes/simple/node/ScopeNode.java b/chapter10/src/main/java/com/seaofnodes/simple/node/ScopeNode.java
index 44c1bab7..8a50eb56 100644
--- a/chapter10/src/main/java/com/seaofnodes/simple/node/ScopeNode.java
+++ b/chapter10/src/main/java/com/seaofnodes/simple/node/ScopeNode.java
@@ -255,7 +255,7 @@ public class ScopeNode extends Node {
if( ctrl._type==Type.XCONTROL ) return null;
// Invert the If conditional
if( invert )
- pred = pred instanceof NotNode not ? not.in(1) : new NotNode(pred).peephole();
+ pred = pred instanceof NotNode not ? not.in(1) : IterPeeps.add(new NotNode(pred).peephole());
// Direct use of a value as predicate. This is a zero/null test.
if( Utils.find(_inputs, pred) != -1 ) {
diff --git a/chapter10/src/main/java/com/seaofnodes/simple/node/StoreNode.java b/chapter10/src/main/java/com/seaofnodes/simple/node/StoreNode.java
index 07e4e3f7..8faf6d4b 100644
--- a/chapter10/src/main/java/com/seaofnodes/simple/node/StoreNode.java
+++ b/chapter10/src/main/java/com/seaofnodes/simple/node/StoreNode.java
@@ -28,6 +28,7 @@ public class StoreNode extends MemOpNode {
public String glabel() { return "."+_field._fname+" ="; }
@Override
public boolean isMem() { return true; }
+ public Node val() { return in(3); }
@Override
StringBuilder _print1(StringBuilder sb, BitSet visited) {
@@ -41,6 +42,31 @@ public class StoreNode extends MemOpNode {
@Override
public Node idealize() {
+
+ // Simple store-after-store on same address. Should pick up the
+ // required init-store being stomped by a first user store.
+ if( mem() instanceof StoreNode st &&
+ ptr()==st.ptr() && // Must check same object
+ // Must have exactly one use of "this" or you get weird
+ // non-serializable memory effects in the worse case.
+ st.checkNoUseBeyond(this) ) {
+ assert _field==st._field; // Equiv class aliasing is perfect
+ setDef(1,st.mem());
+ return this;
+ }
+
return null;
}
+
+ // Check that `this` has no uses beyond `that`
+ private boolean checkNoUseBeyond(Node that) {
+ if( nOuts()==1 ) return true;
+ // Add deps on the other uses (can be e.g. ScopeNode mid-parse) so that
+ // when the other uses go away we can retry.
+ for( Node use : _outputs )
+ if( use != that )
+ use.addDep(that);
+ return false;
+ }
+
}
diff --git a/chapter10/src/test/java/com/seaofnodes/simple/Chapter10Test.java b/chapter10/src/test/java/com/seaofnodes/simple/Chapter10Test.java
index 6bafe72a..36ad19ae 100644
--- a/chapter10/src/test/java/com/seaofnodes/simple/Chapter10Test.java
+++ b/chapter10/src/test/java/com/seaofnodes/simple/Chapter10Test.java
@@ -30,9 +30,9 @@ bar.a = 1;
bar.a = 2;
return bar.a;
""");
- StopNode stop = parser.parse(true).iterate(true);
+ StopNode stop = parser.parse(false).iterate(true);
System.out.println(IRPrinter.prettyPrint(stop, 99, true));
- assertEquals("return .a;", stop.toString());
+ assertEquals("return 2;", stop.toString());
}
@Test
@@ -86,8 +86,8 @@ while (arg) {
}
return bar.a;
""");
- StopNode stop = parser.parse(true).iterate(true);
- assertEquals("return .a;", stop.toString());
+ StopNode stop = parser.parse(false).iterate(true);
+ assertEquals("return Phi(Loop10,0,(Phi_a+2));", stop.toString());
}
@Test
@@ -190,6 +190,31 @@ v1=new s0;
}
@Test
+ public void testIter() {
+ // Build and use an iterator
+ Parser parser = new Parser(
+"""
+struct Iter {
+ int x;
+ int len;
+}
+Iter i = new Iter;
+i.len = arg;
+int sum=0;
+while( i.x < i.len ) {
+ sum = sum + i.x;
+ i.x = i.x + 1;
+}
+return sum;
+""");
+ StopNode stop = parser.parse().iterate(true);
+ assertEquals("return Phi(Loop14,0,(Phi(Loop,0,(Phi_x+1))+Phi_sum));", stop.toString());
+ }
+
+
+
+
+ @Test
public void test1() {
Parser parser = new Parser("""
struct s0 {int v0;}