From e4dc3273f201ae741637b626998637cce973546b Mon Sep 17 00:00:00 2001 From: Cliff Click Date: Fri, 2 Oct 2026 13:04:34 -0700 Subject: First pass README updates --- chapter04/README.md | 69 +++--- chapter04/docs/04-arg1.json | 16 ++ chapter04/docs/04-arg1.svg | 165 +++++++-------- chapter04/docs/04-arg2.json | 16 ++ chapter04/docs/04-arg2.svg | 162 +++++++------- chapter04/docs/04-post-peephole.json | 18 ++ chapter04/docs/04-post-peephole.svg | 198 ++++++++---------- chapter04/docs/04-pre-peephole.json | 20 ++ chapter04/docs/04-pre-peephole.svg | 232 +++++++++------------ chapter04/docs/Makefile | 13 +- chapter04/docs/projnode.json | 14 ++ chapter04/docs/projnode.svg | 74 +++++++ .../main/java/com/seaofnodes/simple/type/Type.java | 9 +- 13 files changed, 551 insertions(+), 455 deletions(-) create mode 100644 chapter04/docs/04-arg1.json create mode 100644 chapter04/docs/04-arg2.json create mode 100644 chapter04/docs/04-post-peephole.json create mode 100644 chapter04/docs/04-pre-peephole.json create mode 100644 chapter04/docs/projnode.json create mode 100644 chapter04/docs/projnode.svg (limited to 'chapter04') diff --git a/chapter04/README.md b/chapter04/README.md index fd77392c..e7ae71d2 100644 --- a/chapter04/README.md +++ b/chapter04/README.md @@ -1,26 +1,29 @@ # Chapter 4: External Argument and Comparisons +[Previous: Chapter 3](../chapter03/README.md) | +[Next: Chapter 5](../chapter05/README.md) + # Table of Contents 1. [Extensions to Intermediate Representation](#extensions-to-intermediate-representation) 2. [Projection Nodes](#projection-nodes) 3. [Visualisation](#visualisation) -5. [Initial values](#initial-values) -6. [When Is Control Not-Null?](#when-is-control-not-null) -5. [Note Regarding Visualizations](#note-regarding-visualizations) -6. [Changes to Type System](#changes-to-type-system) -7. [Tuple Types](#tuple-types) -8. [$ctrl name binding](#ctrl-name-binding) -9. [More Peephole Optimizations](#more-peephole-optimizations) -10. [Peephole Walkthrough](#peephole-walkthrough) -11. [Dead Code Elimination(DCE)](#dead-code-eliminationdce) +4. [Initial values](#initial-values) +5. [When Is Control Not-Null?](#when-is-control-not-null) +6. [Note Regarding Visualizations](#note-regarding-visualizations) +7. [Changes to Type System](#changes-to-type-system) +8. [Tuple Types](#tuple-types) +9. [$ctrl name binding](#ctrl-name-binding) +10. [More Peephole Optimizations](#more-peephole-optimizations) +11. [Peephole Walkthrough](#peephole-walkthrough) +12. [Dead Code Elimination(DCE)](#dead-code-eliminationdce) You can also read [this chapter](https://github.com/SeaOfNodes/Simple/tree/linear-chapter04) in a linear Git revision history on the [linear](https://github.com/SeaOfNodes/Simple/tree/linear) branch and [compare](https://github.com/SeaOfNodes/Simple/compare/linear-chapter03...linear-chapter04) it to the previous chapter. -In this chapter we extend the language grammar with following features: +In this chapter we extend the language grammar with the following features: -* The program receives a single argument named `arg` of integer type from external environment. +* The program receives a single argument named `arg` of integer type from the external environment. * Expressions support comparison operators. * We introduce a scope sensitive name binding `$ctrl` for the current incoming control node. Thus, our Return is no longer hard-wired to Start, instead it @@ -69,15 +72,15 @@ In the visuals, projection nodes are shown as rectangular boxes inside the node ### Visualisation -![ProjNode](./docs/projnode.png) +![Start and its control and argument projections](./docs/projnode.svg) In the visual above, the projection nodes have been tagged by the names -associated with the outputs of the Start node. Both MultiNode that contain -Control and Control nodes are yellow. `$ctrl` and `arg` are outputs(users) of +associated with the outputs of the Start node. Both MultiNodes that contain +Control and Control nodes are yellow. `$ctrl` and `arg` are outputs (users) of StartNode(`START`) and have their MultiNode as their only input in slot 0. The `label` has no semantics and is used during debug printing. -```java +```java public ProjNode(MultiNode ctrl, int idx, String label) { super(ctrl); ``` @@ -130,37 +133,37 @@ The graph: constant. The `arg` was originally defined by a ProjNode; but when peephole is called the computed type is a constant, and the ProjNode gets replaced with a ConstantNode: - + ```java public final Node peephole( ) { - Type type = _type = compute(); + Type type = _type = compute(); /* type = {TypeInteger@1527} "2" */ // ProjNode is not a constant unlike its type. if (!(this instanceof ConstantNode) && type.isConstant()) /* Create Constant(2) */ return deadCodeElim(new ConstantNode(type).peephole()); - + /* won't get called */ ... ``` If you don't pass an argument you get `TypeInteger.BOT` -```java +```java Parser parser = new Parser("return arg; "); ... - + public Parser(String source) { this(source, TypeInteger.BOT); } - + ``` We clearly see this is not a constant: ```java -public final static TypeInteger BOT = new TypeInteger(false, 1); +public final static TypeInteger BOT = new TypeInteger(false, 1); /* _is_con = false */ ``` @@ -177,7 +180,7 @@ In later chapters, `$ctrl` will point to other control nodes, such as #### Note Regarding Visualizations From this chapter onwards we omit the edges from Constants to Start node, mainly to reduce -clutter and help draw reader's attention to the more important aspects of the graph. +clutter and help draw the reader's attention to the more important aspects of the graph. @@ -195,7 +198,7 @@ associated with a Type at a specific Node can be conveniently represented as a [lattice](https://en.wikipedia.org/wiki/Lattice_(order)). The type itself is identified by the Java class `Type` and subtypes. The type -implementation uses Java classes as convenient to deal with a Types' internal +implementation uses Java classes as a convenient way to deal with a Type's internal structure - but the Java classes have no relation to a Type's place in the lattice. @@ -239,20 +242,20 @@ In the table above `Con1` and `Con2` represent two distinct integer values, and * The `meet` of any integer with itself is that integer. * The `meet` of two unrelated integer constants is `IntBot`. -Currently, all our integer valued nodes are either a constant or a `IntBot` integer type. +Currently, all our integer valued nodes are either a constant or an `IntBot` integer type. When we start optimizing loops, we will start seeing `IntTop` values. ### Tuple Types -Tuple types need a little more explaination: they are a fixed-size grouping of +Tuple types need a little more explanation: they are a fixed-size grouping of types; literally a `Type[]`. Tuples represent a collection of otherwise unrelated types, and come from `MultiNode`s. `ProjNode`s will take the appropriate `Type` array element out of a Tuple. The `StartNode` now produces a 2-element `TypeTuple` with control and the type of `arg`: `[ctrl, TypeInteger.INTBOT]` The lattice `meet` operator on Tuples is done element by element; each array -element recursively calls `meet`. Tuples of mixed sizes are a internal +element recursively calls `meet`. Tuples of mixed sizes are an internal compiler error, and the `meet` uses Bottom for them. @@ -284,7 +287,7 @@ We would expect the compiler to output `arg+3` here, but as it stands what we ge ![Graph1](./docs/04-pre-peephole.svg) -We need to perform some algebraic simplifications to enable better outcome. For +We need to perform some algebraic simplifications to enable a better outcome. For example, we need to rearrange the expression as follows: ``` @@ -303,7 +306,7 @@ Here is a list of peepholes introduced in this Chapter, more will be introduced |-----------------------|-----------------------|------------------------------------------------| | (arg + 0 ) | arg | Add of zero identity | | (arg - 0 ) | arg | Sub of zero identity | -| (arg * 1 ) | arg | Multiple of one identity | +| (arg * 1 ) | arg | Multiply by one identity | | (con + arg) | (arg + con) | Move constants to right, to encourage folding | | (con * arg) | (arg * con) | Move constants to right, to encourage folding | | (con1 + (arg + con2)) | (arg + (con1 + con2)) | Move constants to right, to encourage folding | @@ -374,18 +377,18 @@ public final Node peephole( ) { } ``` -The peephole method does following: +The peephole method does the following: - Compute a Type for the node. - If the Type is a Constant and the node is not a ConstantNode, replace with a ConstantNode, recursively invoking peephole on the new constant. - Otherwise, ask the Node for a better replacement via a call to `idealize()`. - The "better replacement" is things like `(1+2)` becomes `3` and `1+(x+2))` + The "better replacement" is things like `(1+2)` becomes `3` and `1+(x+2)` becomes `(x+(1+2))`. -- - Each Node subtype is responsible for deciding what the `idealize()` step +- Each Node subtype is responsible for deciding what the `idealize()` step should do. If there is a better replacement then the node returns a non `null` value. -- - If we see a non `null` value, something changed, so we invoke `peephole()` +- If we see a non `null` value, something changed, so we invoke `peephole()` again and then also run dead code elimination on the (now dead and replaced) `this` node. diff --git a/chapter04/docs/04-arg1.json b/chapter04/docs/04-arg1.json new file mode 100644 index 00000000..b16dc51b --- /dev/null +++ b/chapter04/docs/04-arg1.json @@ -0,0 +1,16 @@ +{ + "ver": 1, + "comp": "chapter04/docs/04-arg1.svg", + "step": 1, + "roots": [], + "scope": 0, + "nodes": [ + {"id": 1, "label": "Scope", "type": null, "kind": "SCOPE", "edges": [{"idx": 0, "def": 0, "role": "ASSOC", "label": "0: $ctrl"}, {"idx": 1, "def": 5, "role": "ASSOC", "label": "0: arg"}], "proj": null}, + {"id": 2, "label": "Start", "type": null, "kind": "CTRL", "edges": [], "proj": null}, + {"id": 4, "label": "$ctrl", "type": null, "kind": "CTRL", "edges": [{"idx": 0, "def": 2, "role": "CTRL", "label": null}], "proj": {"par": 2, "idx": 0}}, + {"id": 5, "label": "2", "type": null, "kind": "DATA", "edges": [], "proj": null}, + {"id": 6, "label": "Return", "type": null, "kind": "CTRL", "edges": [{"idx": 0, "def": 4, "role": "CTRL", "label": null}, {"idx": 1, "def": 5, "role": "DATA", "label": null}], "proj": null} + ], + "groups": [ + ] +} diff --git a/chapter04/docs/04-arg1.svg b/chapter04/docs/04-arg1.svg index cf4599c5..b948e7cd 100644 --- a/chapter04/docs/04-arg1.svg +++ b/chapter04/docs/04-arg1.svg @@ -1,84 +1,81 @@ - - - - - - -chapter04 - - -cluster_Nodes - - - -cluster_Scope1_0 - - - -cluster_Scope1_1 - - - - -Start2 - - -Start - - - -$ctrl - - - -Con_5 - -2 - - - -Return6 - -Return - - - -Return6->Start2:p0 - - -0 - - - -Return6->Con_5 - - -1 - - - -Scope1_0 - - -0 - -$ctrl - -arg - - - -Scope1_0:Scope1_0_arg->Con_5 - - - - - -Scope1_1 - - -1 - - - \ No newline at end of file +#1[1] → #5 · ASSOC · 0: arg#6[0] → #4 · CTRL#6[1] → #5 · DATAScope  #1#1 Scope +Type not computed + +[0] → — ASSOC 0: $ctrl +[1] → #5 ASSOC 0: arg0: $ctrl0: arg01Start  #2#2 Start +Type not computed + +$ctrl  #4/0#4 $ctrl +Projection 0 of #2 +Type not computed + +[0] → #2 CTRL2  #5#5 2 +Type not computed + +Return  #6#6 Return +Type not computed + +[0] → #4 CTRL +[1] → #5 DATA01 diff --git a/chapter04/docs/04-arg2.json b/chapter04/docs/04-arg2.json new file mode 100644 index 00000000..5d2d7fde --- /dev/null +++ b/chapter04/docs/04-arg2.json @@ -0,0 +1,16 @@ +{ + "ver": 1, + "comp": "chapter04/docs/04-arg2.svg", + "step": 1, + "roots": [], + "scope": 0, + "nodes": [ + {"id": 1, "label": "Scope", "type": null, "kind": "SCOPE", "edges": [{"idx": 0, "def": 0, "role": "ASSOC", "label": "0: $ctrl"}, {"idx": 1, "def": 6, "role": "ASSOC", "label": "0: arg"}], "proj": null}, + {"id": 2, "label": "Start", "type": null, "kind": "CTRL", "edges": [], "proj": null}, + {"id": 4, "label": "$ctrl", "type": null, "kind": "CTRL", "edges": [{"idx": 0, "def": 2, "role": "CTRL", "label": null}], "proj": {"par": 2, "idx": 0}}, + {"id": 5, "label": "Return", "type": null, "kind": "CTRL", "edges": [{"idx": 0, "def": 4, "role": "CTRL", "label": null}, {"idx": 1, "def": 6, "role": "DATA", "label": null}], "proj": null}, + {"id": 6, "label": "arg", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 2, "role": "DATA", "label": null}], "proj": {"par": 2, "idx": 1}} + ], + "groups": [ + ] +} diff --git a/chapter04/docs/04-arg2.svg b/chapter04/docs/04-arg2.svg index 2b3b47a3..aebd8b0d 100644 --- a/chapter04/docs/04-arg2.svg +++ b/chapter04/docs/04-arg2.svg @@ -1,80 +1,82 @@ - - - - - - -chapter04 - - -cluster_Nodes - - - -cluster_Scope1_0 - - - -cluster_Scope1_1 - - - - -Start2 - - -Start - - - -$ctrl - -arg - - - -Return5 - -Return - - - -Return5->Start2:p0 - - -0 - - - -Return5->Start2:p1 - - -1 - - - -Scope1_0 - - -0 - -$ctrl - -arg - - - -Scope1_0:Scope1_0_arg->Start2:p1 - - - - - -Scope1_1 - - -1 - - - \ No newline at end of file +#1[1] → #6 · ASSOC · 0: arg#5[0] → #4 · CTRL#5[1] → #6 · DATAScope  #1#1 Scope +Type not computed + +[0] → — ASSOC 0: $ctrl +[1] → #6 ASSOC 0: arg0: $ctrl0: arg01Start  #2#2 Start +Type not computed + +$ctrl  #4/0#4 $ctrl +Projection 0 of #2 +Type not computed + +[0] → #2 CTRLReturn  #5#5 Return +Type not computed + +[0] → #4 CTRL +[1] → #6 DATA01arg  #6/1#6 arg +Projection 1 of #2 +Type not computed + +[0] → #2 DATA diff --git a/chapter04/docs/04-post-peephole.json b/chapter04/docs/04-post-peephole.json new file mode 100644 index 00000000..4890ca67 --- /dev/null +++ b/chapter04/docs/04-post-peephole.json @@ -0,0 +1,18 @@ +{ + "ver": 1, + "comp": "chapter04/docs/04-post-peephole.svg", + "step": 1, + "roots": [], + "scope": 0, + "nodes": [ + {"id": 1, "label": "Scope", "type": null, "kind": "SCOPE", "edges": [{"idx": 0, "def": 0, "role": "ASSOC", "label": "0: $ctrl"}, {"idx": 1, "def": 5, "role": "ASSOC", "label": "0: arg"}], "proj": null}, + {"id": 2, "label": "Start", "type": null, "kind": "CTRL", "edges": [], "proj": null}, + {"id": 4, "label": "$ctrl", "type": null, "kind": "CTRL", "edges": [{"idx": 0, "def": 2, "role": "CTRL", "label": null}], "proj": {"par": 2, "idx": 0}}, + {"id": 5, "label": "arg", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 2, "role": "DATA", "label": null}], "proj": {"par": 2, "idx": 1}}, + {"id": 10, "label": "#3", "type": null, "kind": "DATA", "edges": [], "proj": null}, + {"id": 11, "label": "+", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 0, "role": "DATA", "label": null}, {"idx": 1, "def": 5, "role": "DATA", "label": null}, {"idx": 2, "def": 10, "role": "DATA", "label": null}], "proj": null}, + {"id": 12, "label": "Return", "type": null, "kind": "CTRL", "edges": [{"idx": 0, "def": 4, "role": "CTRL", "label": null}, {"idx": 1, "def": 11, "role": "DATA", "label": null}], "proj": null} + ], + "groups": [ + ] +} diff --git a/chapter04/docs/04-post-peephole.svg b/chapter04/docs/04-post-peephole.svg index 550c16ef..530155dd 100644 --- a/chapter04/docs/04-post-peephole.svg +++ b/chapter04/docs/04-post-peephole.svg @@ -1,108 +1,90 @@ - - - - - - -chapter04 - - -cluster_Nodes - - - -cluster_Scope1_0 - - - -cluster_Scope1_1 - - - - -Start2 - - -Start - - - -$ctrl - -arg - - - -Con_10 - -#3 - - - -Add11 - -+ - - - -Add11->Start2:p1 - - -1 - - - -Add11->Con_10 - - -2 - - - -Return12 - -Return - - - -Return12->Start2:p0 - - -0 - - - -Return12->Add11 - - -1 - - - -Scope1_0 - - -0 - -$ctrl - -arg - - - -Scope1_0:Scope1_0_arg->Start2:p1 - - - - - -Scope1_1 - - -1 - - - +#1[1] → #5 · ASSOC · 0: arg#11[1] → #5 · DATA#11[2] → #10 · DATA#12[0] → #4 · CTRL#12[1] → #11 · DATAScope  #1#1 Scope +Type not computed + +[0] → — ASSOC 0: $ctrl +[1] → #5 ASSOC 0: arg0: $ctrl0: arg01Start  #2#2 Start +Type not computed + +$ctrl  #4/0#4 $ctrl +Projection 0 of #2 +Type not computed + +[0] → #2 CTRLarg  #5/1#5 arg +Projection 1 of #2 +Type not computed + +[0] → #2 DATA#3  #10#10 #3 +Type not computed + ++  #11#11 + +Type not computed + +[0] → — DATA +[1] → #5 DATA +[2] → #10 DATA012Return  #12#12 Return +Type not computed + +[0] → #4 CTRL +[1] → #11 DATA01 diff --git a/chapter04/docs/04-pre-peephole.json b/chapter04/docs/04-pre-peephole.json new file mode 100644 index 00000000..839c16e7 --- /dev/null +++ b/chapter04/docs/04-pre-peephole.json @@ -0,0 +1,20 @@ +{ + "ver": 1, + "comp": "chapter04/docs/04-pre-peephole.svg", + "step": 1, + "roots": [], + "scope": 0, + "nodes": [ + {"id": 1, "label": "Scope", "type": null, "kind": "SCOPE", "edges": [{"idx": 0, "def": 0, "role": "ASSOC", "label": "0: $ctrl"}, {"idx": 1, "def": 10, "role": "ASSOC", "label": "0: arg"}], "proj": null}, + {"id": 2, "label": "Start", "type": null, "kind": "CTRL", "edges": [], "proj": null}, + {"id": 4, "label": "$ctrl", "type": null, "kind": "CTRL", "edges": [{"idx": 0, "def": 2, "role": "CTRL", "label": null}], "proj": {"par": 2, "idx": 0}}, + {"id": 5, "label": "#1", "type": null, "kind": "DATA", "edges": [], "proj": null}, + {"id": 6, "label": "#2", "type": null, "kind": "DATA", "edges": [], "proj": null}, + {"id": 7, "label": "+", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 0, "role": "DATA", "label": null}, {"idx": 1, "def": 10, "role": "DATA", "label": null}, {"idx": 2, "def": 6, "role": "DATA", "label": null}], "proj": null}, + {"id": 8, "label": "+", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 0, "role": "DATA", "label": null}, {"idx": 1, "def": 5, "role": "DATA", "label": null}, {"idx": 2, "def": 7, "role": "DATA", "label": null}], "proj": null}, + {"id": 9, "label": "Return", "type": null, "kind": "CTRL", "edges": [{"idx": 0, "def": 4, "role": "CTRL", "label": null}, {"idx": 1, "def": 8, "role": "DATA", "label": null}], "proj": null}, + {"id": 10, "label": "arg", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 2, "role": "DATA", "label": null}], "proj": {"par": 2, "idx": 1}} + ], + "groups": [ + ] +} diff --git a/chapter04/docs/04-pre-peephole.svg b/chapter04/docs/04-pre-peephole.svg index 9ec38d27..5ad17b13 100644 --- a/chapter04/docs/04-pre-peephole.svg +++ b/chapter04/docs/04-pre-peephole.svg @@ -1,134 +1,98 @@ - - - - - - -chapter04 - - -cluster_Nodes - - - -cluster_Scope1_0 - - - -cluster_Scope1_1 - - - - -Start2 - - -Start - - - -$ctrl - -arg - - - -Con_5 - -#1 - - - -Con_6 - -#2 - - - -Add7 - -+ - - - -Add7->Start2:p1 - - -1 - - - -Add7->Con_6 - - -2 - - - -Add8 - -+ - - - -Add8->Con_5 - - -1 - - - -Add8->Add7 - - -2 - - - -Return9 - -Return - - - -Return9->Start2:p0 - - -0 - - - -Return9->Add8 - - -1 - - - -Scope1_0 - - -0 - -$ctrl - -arg - - - -Scope1_0:Scope1_0_arg->Start2:p1 - - - - - -Scope1_1 - - -1 - - - +#1[1] → #10 · ASSOC · 0: arg#7[1] → #10 · DATA#7[2] → #6 · DATA#8[1] → #5 · DATA#8[2] → #7 · DATA#9[0] → #4 · CTRL#9[1] → #8 · DATAScope  #1#1 Scope +Type not computed + +[0] → — ASSOC 0: $ctrl +[1] → #10 ASSOC 0: arg0: $ctrl0: arg01Start  #2#2 Start +Type not computed + +$ctrl  #4/0#4 $ctrl +Projection 0 of #2 +Type not computed + +[0] → #2 CTRL#1  #5#5 #1 +Type not computed + +#2  #6#6 #2 +Type not computed + ++  #7#7 + +Type not computed + +[0] → — DATA +[1] → #10 DATA +[2] → #6 DATA012+  #8#8 + +Type not computed + +[0] → — DATA +[1] → #5 DATA +[2] → #7 DATA012Return  #9#9 Return +Type not computed + +[0] → #4 CTRL +[1] → #8 DATA01arg  #10/1#10 arg +Projection 1 of #2 +Type not computed + +[0] → #2 DATA diff --git a/chapter04/docs/Makefile b/chapter04/docs/Makefile index 12659b8f..6fa0f057 100644 --- a/chapter04/docs/Makefile +++ b/chapter04/docs/Makefile @@ -1,12 +1 @@ -GV := $(wildcard *.gv) -SVG := $(patsubst %.gv,%.svg,$(GV)) - -.PHONY: all -all: $(SVG) - -%.svg: %.gv - dot -Tsvg $< > $@ - -.PHONY: clean -clean: - @rm -f $(SVG) +include ../../graph/docs.mk diff --git a/chapter04/docs/projnode.json b/chapter04/docs/projnode.json new file mode 100644 index 00000000..3d4d20cf --- /dev/null +++ b/chapter04/docs/projnode.json @@ -0,0 +1,14 @@ +{ + "ver": 1, + "comp": "chapter04/docs/projnode.svg", + "step": 1, + "roots": [], + "scope": 0, + "nodes": [ + {"id": 2, "label": "Start", "type": null, "kind": "CTRL", "edges": [], "proj": null}, + {"id": 4, "label": "$ctrl", "type": null, "kind": "CTRL", "edges": [{"idx": 0, "def": 2, "role": "CTRL", "label": null}], "proj": {"par": 2, "idx": 0}}, + {"id": 6, "label": "arg", "type": null, "kind": "DATA", "edges": [{"idx": 0, "def": 2, "role": "DATA", "label": null}], "proj": {"par": 2, "idx": 1}} + ], + "groups": [ + ] +} diff --git a/chapter04/docs/projnode.svg b/chapter04/docs/projnode.svg new file mode 100644 index 00000000..b1291cdb --- /dev/null +++ b/chapter04/docs/projnode.svg @@ -0,0 +1,74 @@ +Start  #2#2 Start +Type not computed + +$ctrl  #4/0#4 $ctrl +Projection 0 of #2 +Type not computed + +[0] → #2 CTRLarg  #6/1#6 arg +Projection 1 of #2 +Type not computed + +[0] → #2 DATA diff --git a/chapter04/src/main/java/com/seaofnodes/simple/type/Type.java b/chapter04/src/main/java/com/seaofnodes/simple/type/Type.java index 1e50bdda..466fb739 100644 --- a/chapter04/src/main/java/com/seaofnodes/simple/type/Type.java +++ b/chapter04/src/main/java/com/seaofnodes/simple/type/Type.java @@ -41,12 +41,13 @@ public class Type { public boolean isConstant() { return _type == TTOP; } - public StringBuilder print(StringBuilder sb) {return is_simple() ? sb.append(STRS[_type]) : sb;} - - public Type meet(Type other) { return Type.BOTTOM; } - @Override public final String toString() { return print(new StringBuilder()).toString(); } + + public StringBuilder print(StringBuilder sb) {return is_simple() ? sb.append(STRS[_type]) : sb;} + + public Type meet(Type other) { return Type.BOTTOM; } + } -- cgit v1.2.3