diff options
author | bd-912 <bdunahu@colostate.edu> | 2024-04-19 23:37:54 -0600 |
---|---|---|
committer | bd-912 <bdunahu@colostate.edu> | 2024-04-19 23:37:54 -0600 |
commit | 18da70342efb2114042c8ad5fae089cef6e69862 (patch) | |
tree | a0bf7d5a2e616517982442fe8e446df4df52d9a1 | |
parent | 8625d3a2708e6332083a1b780b4f016beacf67d3 (diff) |
CFG captures VGoto path
-rw-r--r-- | vaporize/library/CFGSimp.java | 7 | ||||
-rw-r--r-- | vaporize/library/Kettle.java | 9 |
2 files changed, 10 insertions, 6 deletions
diff --git a/vaporize/library/CFGSimp.java b/vaporize/library/CFGSimp.java index a759afc..9f2556d 100644 --- a/vaporize/library/CFGSimp.java +++ b/vaporize/library/CFGSimp.java @@ -113,7 +113,8 @@ public class CFGSimp extends VInstr.VisitorPR<ControlFlowGraph, String, RuntimeE /////////////////////////////////////////////////////////////// CFGNode curr = cfg.getNode(n); cfg.addEdge(this.curr, cfg.getNode(n)); - cfg.addEdge(this.curr, cfg.getNode(new Integer(this.kettle.findLabelIndex(n)))); + cfg.addEdge(this.curr, cfg.getNode(new Integer(this.kettle + .findLabelIndex(n.target.toString())))); this.curr = curr; /////////////////////////////////////////////////////////////// @@ -131,7 +132,9 @@ public class CFGSimp extends VInstr.VisitorPR<ControlFlowGraph, String, RuntimeE n.sourcePos.toString())); /////////////////////////////////////////////////////////////// CFGNode curr = cfg.getNode(n); - cfg.addEdge(this.curr, cfg.getNode(n)); + cfg.addEdge(this.curr, cfg.getNode(new Integer(this.kettle + .findLabelIndex(n.target.toString())))); + this.curr = curr; /////////////////////////////////////////////////////////////// MinimalLogger.info(String.format("<-%s (\"%s\":%s)", diff --git a/vaporize/library/Kettle.java b/vaporize/library/Kettle.java index e413907..d76c938 100644 --- a/vaporize/library/Kettle.java +++ b/vaporize/library/Kettle.java @@ -75,10 +75,10 @@ class Kettle { * Needed because VBranch doesn't seem to * keep track of this... */ - protected int findLabelIndex(VBranch n) { + protected int findLabelIndex(String str) { int index = -1; // is this guarenteed? - String search = n.target.toString().substring(1); + String search = str.substring(1); String comp; for (int i = 0; i < this.vapor.size(); ++i) { if (!this.vapor.get(i).isEmpty()) { @@ -93,9 +93,10 @@ class Kettle { if (index == -1) { MinimalLogger.severe(String.format("findLabelIndex could not compute label for %s!", - this.get(n).trim())); + str.trim())); } - return index; + // go to the section AFTER the label + return index+1; } protected int indexOf(Node n) { |