summaryrefslogtreecommitdiff
path: root/vaporize
diff options
context:
space:
mode:
authorbd-912 <bdunahu@colostate.edu>2024-04-19 19:21:16 -0600
committerbd-912 <bdunahu@colostate.edu>2024-04-19 19:21:16 -0600
commit7b93ef1ec7cb51f3494d7f18cc39dd9d26a24be8 (patch)
treeb65e3470bd0f620e1f29ae5851c0a092618fb669 /vaporize
parent66ffeaf968bd332f1e18cb27aad11b50e4dd0eab (diff)
Use one global logger
Diffstat (limited to 'vaporize')
-rw-r--r--vaporize/library/CFGSimp.java18
-rw-r--r--vaporize/library/Kettle.java14
-rw-r--r--vaporize/library/SpillEverywhere.java79
3 files changed, 41 insertions, 70 deletions
diff --git a/vaporize/library/CFGSimp.java b/vaporize/library/CFGSimp.java
index 79eb4c2..b7ca7bd 100644
--- a/vaporize/library/CFGSimp.java
+++ b/vaporize/library/CFGSimp.java
@@ -1,8 +1,5 @@
package vaporize.library;
-import java.util.logging.Logger;
-import java.util.logging.ConsoleHandler;
-
import cs132.vapor.ast.*;
import st.*;
import misc.*;
@@ -10,13 +7,6 @@ import java.util.*;
public class CFGSimp extends VInstr.VisitorPR<String, String, RuntimeException> {
- private static Logger log = Logger.getLogger(CFGSimp.class.getName());
- private static ConsoleHandler consoleHandler = new ConsoleHandler();
- static {
- consoleHandler.setFormatter(new MinimalSimpleFormatter());
- log.addHandler(consoleHandler);
- }
-
private VaporProgram vp;
private Kettle kettle;
private ArrayList<ControlFlowGraph> cfgs;
@@ -33,15 +23,15 @@ public class CFGSimp extends VInstr.VisitorPR<String, String, RuntimeException>
cfg.setStart(start);
// nodes
- this.log.info(String.format("CFGSimp is collecting nodes for %s",
- this.kettle.parseFuncName(f)));
+ MinimalLogger.info(String.format("CFGSimp is collecting nodes for %s",
+ this.kettle.parseFuncName(f)));
for (VInstr s : f.body)
cfg.addNode(new CFGNode(s));
// edges
- this.log.info(String.format("CFGSimp is collecting edges for %s",
- this.kettle.parseFuncName(f)));
+ MinimalLogger.info(String.format("CFGSimp is collecting edges for %s",
+ this.kettle.parseFuncName(f)));
for (VInstr s : f.body)
s.accept("", this);
diff --git a/vaporize/library/Kettle.java b/vaporize/library/Kettle.java
index fb9ddc4..561ae32 100644
--- a/vaporize/library/Kettle.java
+++ b/vaporize/library/Kettle.java
@@ -1,8 +1,5 @@
package vaporize.library;
-import java.util.logging.Logger;
-import java.util.logging.ConsoleHandler;
-
import cs132.vapor.ast.*;
import misc.*;
@@ -17,17 +14,10 @@ import java.util.ArrayList;
*/
class Kettle {
- private static Logger log = Logger.getLogger(Kettle.class.getName());
- private static ConsoleHandler consoleHandler = new ConsoleHandler();
- static {
- consoleHandler.setFormatter(new MinimalSimpleFormatter());
- log.addHandler(consoleHandler);
- }
-
ArrayList<String> vapor;
protected Kettle(ArrayList<String> vapor) {
- log.info("Pouring program into kettle...");
+ MinimalLogger.info("Pouring program into kettle...");
this.vapor = vapor;
}
@@ -50,7 +40,7 @@ class Kettle {
out,
local);
- log.info(String.format("Replacing function declaraction\n%s\nwith\n%s",
+ MinimalLogger.info(String.format("Replacing function declaraction %s with %s",
this.get(prev),
next));
diff --git a/vaporize/library/SpillEverywhere.java b/vaporize/library/SpillEverywhere.java
index d9e9f3f..d6671bf 100644
--- a/vaporize/library/SpillEverywhere.java
+++ b/vaporize/library/SpillEverywhere.java
@@ -1,8 +1,5 @@
package vaporize.library;
-import java.util.logging.Logger;
-import java.util.logging.ConsoleHandler;
-
import cs132.vapor.ast.*;
import st.*;
import misc.*;
@@ -10,13 +7,6 @@ import java.util.*;
public class SpillEverywhere extends VInstr.VisitorPR<String, String, RuntimeException> {
- private static Logger log = Logger.getLogger(SpillEverywhere.class.getName());
- private static ConsoleHandler consoleHandler = new ConsoleHandler();
- static {
- consoleHandler.setFormatter(new MinimalSimpleFormatter());
- log.addHandler(consoleHandler);
- }
-
private VaporProgram vp;
private Kettle kettle;
private String vaporm;
@@ -41,74 +31,75 @@ public class SpillEverywhere extends VInstr.VisitorPR<String, String, RuntimeExc
for (VFunction f : vp.functions) {
for (VInstr s : f.body) {
- // s.accept("", this);
+ s.accept("", this);
}
this.kettle.replaceFunctionDeclare(f, 0, 0, 0);
}
- this.log.info(kettle.dump());
+ MinimalLogger.info(kettle.dump());
}
public String visit(String p, VMemRead n) throws RuntimeException {
- log.info(String.format("%s (%s:%s)",
- n.getClass().getSimpleName(),
- this.kettle.get(n),
- n.sourcePos.toString()));
+ MinimalLogger.info(String.format("%s (%s:%s)",
+ n.getClass().getSimpleName(),
+ this.kettle.get(n),
+ n.sourcePos.toString()));
return null;
}
public String visit(String p, VMemWrite n) throws RuntimeException {
- log.info(String.format("%s (%s:%s)",
- n.getClass().getSimpleName(),
- this.kettle.get(n),
- n.sourcePos.toString()));
+ System.out.println("HEY!");
+ MinimalLogger.info(String.format("%s (%s:%s)",
+ n.getClass().getSimpleName(),
+ this.kettle.get(n),
+ n.sourcePos.toString()));
return null;
}
public String visit(String p, VAssign n) throws RuntimeException {
- log.info(String.format("%s (%s:%s)",
- n.getClass().getSimpleName(),
- this.kettle.get(n),
- n.sourcePos.toString()));
+ MinimalLogger.info(String.format("%s (%s:%s)",
+ n.getClass().getSimpleName(),
+ this.kettle.get(n),
+ n.sourcePos.toString()));
return null;
}
public String visit(String p, VBranch n) throws RuntimeException {
- log.info(String.format("%s (%s:%s)",
- n.getClass().getSimpleName(),
- this.kettle.get(n),
- n.sourcePos.toString()));
+ MinimalLogger.info(String.format("%s (%s:%s)",
+ n.getClass().getSimpleName(),
+ this.kettle.get(n),
+ n.sourcePos.toString()));
return null;
}
public String visit(String p, VGoto n) throws RuntimeException {
- log.info(String.format("%s (%s:%s)",
- n.getClass().getSimpleName(),
- this.kettle.get(n),
- n.sourcePos.toString()));
+ MinimalLogger.info(String.format("%s (%s:%s)",
+ n.getClass().getSimpleName(),
+ this.kettle.get(n),
+ n.sourcePos.toString()));
return null;
}
public String visit(String p, VCall n) throws RuntimeException {
- log.info(String.format("%s (%s:%s)",
- n.getClass().getSimpleName(),
- this.kettle.get(n),
- n.sourcePos.toString()));
+ MinimalLogger.info(String.format("%s (%s:%s)",
+ n.getClass().getSimpleName(),
+ this.kettle.get(n),
+ n.sourcePos.toString()));
return null;
}
public String visit(String p, VBuiltIn n) throws RuntimeException {
- log.info(String.format("%s (%s:%s)",
- n.op.name,
- this.kettle.get(n),
- n.sourcePos.toString()));
+ MinimalLogger.info(String.format("%s (%s:%s)",
+ n.op.name,
+ this.kettle.get(n),
+ n.sourcePos.toString()));
return null;
}
public String visit(String p, VReturn n) throws RuntimeException {
- log.info(String.format("%s (%s:%s)",
- n.getClass().getSimpleName(),
- this.kettle.get(n),
- n.sourcePos.toString()));
+ MinimalLogger.info(String.format("%s (%s:%s)",
+ n.getClass().getSimpleName(),
+ this.kettle.get(n),
+ n.sourcePos.toString()));
return null;
}