diff options
| author | Cliff Click <cliffc@acm.org> | 2026-09-29 12:41:55 -0700 |
|---|---|---|
| committer | Cliff Click <cliffc@acm.org> | 2026-09-29 12:41:55 -0700 |
| commit | a8558640bd9e3391134577db3c53737273135bf9 (patch) | |
| tree | a99030ae8f4957ccc41a610e947050e6da8e27ea /chapter10a | |
| parent | 6347fa6dc2ee8d3060f2f0db21f03f11d374b0bc (diff) | |
| download | Simple-a8558640bd9e3391134577db3c53737273135bf9.tar.gz Simple-a8558640bd9e3391134577db3c53737273135bf9.zip | |
README updates
Diffstat (limited to 'chapter10a')
| -rw-r--r-- | chapter10a/README.md | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/chapter10a/README.md b/chapter10a/README.md index 2f25f681..70a09f8d 100644 --- a/chapter10a/README.md +++ b/chapter10a/README.md @@ -52,6 +52,13 @@ same `ScopeNode` lookup and update operations as a local variable. For an `if`, the two branches can finish with different memory values. An ordinary Phi selects the memory from the branch that executed: +```java +struct Point { int x; int y; } +Point p = new Point; +if( arg ) p.x = 3; else p.x = 4; +return p.x; +``` +  Loops reuse Chapter 8's lazy Phi construction. Reading or updating `$mem` in a @@ -59,6 +66,16 @@ loop creates an initially incomplete memory Phi. Closing the loop supplies its backedge. `break`, `continue`, nested loops, and early returns use the same scope mechanics as scalar variables. +```java +struct Point { int x; int y; } +Point p = new Point; +while( arg ) { + p.x = arg; + arg = arg-1; +}; +return p.x; +``` +  Every Return consumes the current whole-memory value. This keeps stores alive @@ -97,10 +114,11 @@ The implementation's `$TOP` and `$BOT` names need not appear in the diagram: | `⊤:struct` | struct top | `TypeStruct.TOP` | `$TOP` | | `⊥:struct` | struct bottom | `TypeStruct.BOT` | `$BOT` | -Edges in this diagram show lattice order, with top above bottom. They are not -the use-to-definition edges of the program graphs elsewhere in the chapter. -Boxes containing an ellipsis abbreviate further parallel alternatives; they -are not extra union types. Field and tuple-element type lattices are elided. +Edges in this diagram show lattice order, with top above bottom. Boxes +containing an ellipsis abbreviate further parallel alternatives; they are not +extra union types. Field and tuple-element type lattices are elided in the +diagram. Field types can be any scalar type (Integer or Pointer), Tuple types +can be *any* lattice type, including Control and Memory. Within the type lattice, we now have the following domains: @@ -169,7 +187,7 @@ We use the following operations on the lattice: * The join of `1` and `2` is integer top. As we construct the Sea of Nodes graph, we ensure that values stay inside the -domain they are created in - that is ptr fields will never contain ints +domain they are created in - that is pointer fields will never contain integers (obviously)... nor even the generic `TOP` and `BOT`. There are a couple of nuances worth highlighting. |
