diff options
| author | dibyendumajumdar <mobile@majumdar.org.uk> | 2023-10-28 14:24:30 +0100 |
|---|---|---|
| committer | Dibyendu Majumdar <dibyendumajumdar@users.noreply.github.com> | 2023-11-01 18:56:50 +0000 |
| commit | 65cc1fa45d695266ad51252f7427ad8e9ab5ba04 (patch) | |
| tree | f9c895416babd900708da838e57964e9f76bc324 /chapter05/src/main/java/com | |
| parent | 5ebbfe4813289ec520160c112f3b30d10b0eeb5f (diff) | |
| download | Simple-65cc1fa45d695266ad51252f7427ad8e9ab5ba04.tar.gz Simple-65cc1fa45d695266ad51252f7427ad8e9ab5ba04.zip | |
Small cleanup
Diffstat (limited to 'chapter05/src/main/java/com')
| -rw-r--r-- | chapter05/src/main/java/com/seaofnodes/simple/Parser.java | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/chapter05/src/main/java/com/seaofnodes/simple/Parser.java b/chapter05/src/main/java/com/seaofnodes/simple/Parser.java index b141d7ac..fc105523 100644 --- a/chapter05/src/main/java/com/seaofnodes/simple/Parser.java +++ b/chapter05/src/main/java/com/seaofnodes/simple/Parser.java @@ -69,7 +69,7 @@ public class Parser { return _scope.lookup(CTRL_TOKEN); } - private void updateCtrlToken(Node n) { + private void setCtrlToken(Node n) { _scope.update(CTRL_TOKEN, n); } @@ -136,19 +136,17 @@ public class Parser { ScopeNode ifScope = _scope.dup(); // Duplicate current scope _allScopes.add(ifScope); // For graph visualization we need all scopes _scope = ifScope; // ifScope is now the current scope - updateCtrlToken(ifT); // set ctrl token to ifTrue projection + setCtrlToken(ifT); // set ctrl token to ifTrue projection parseStatement(); - // restore scope _scope = savedScope; // Restore scope to original, we use this for else block if any - // Setup ifF as the ctrl - updateCtrlToken(ifF); // Ctrl token is now set to ifFalse projection + setCtrlToken(ifF); // Ctrl token is now set to ifFalse projection if (match("else")) parseStatement(); // Create region node and merge scopes // If a var is in both scopes and has different binding then we need to create PhiNode for it // After merge _scope remains, and ifScope is discarded - System.out.println(new GraphVisualizer().generateDotOutput(this)); + //System.out.println(new GraphVisualizer().generateDotOutput(this)); RegionNode region = mergeScopes(ifT, ifScope, ifF, _scope); - updateCtrlToken(region); // Now region becomes the ctrl token + setCtrlToken(region); // Now region becomes the ctrl token ifScope.clear(); // Clean up ifScope _allScopes.remove(ifScope); // Discard ifScope return region; |
