diff graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java @ 5557:2e2a77f091f2

re-enabled disassembler output to C1Visualizer after code installation moved some useful functionality from TypeCheckTest up in GraphTest added NewInstanceTest to test snippets for lowering NewInstanceNode
author Doug Simon <doug.simon@oracle.com>
date Mon, 11 Jun 2012 14:25:42 +0200
parents e42c0df7212a
children a3d71693e0ce
line wrap: on
line diff
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java	Mon Jun 11 14:22:03 2012 +0200
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java	Mon Jun 11 14:25:42 2012 +0200
@@ -25,7 +25,6 @@
 import java.io.*;
 import java.util.*;
 
-import com.oracle.max.criutils.*;
 import com.oracle.graal.alloc.util.*;
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
@@ -38,6 +37,7 @@
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.cfg.*;
 import com.oracle.graal.nodes.*;
+import com.oracle.max.criutils.*;
 
 /**
  * Observes compilation events and uses {@link CFGPrinter} to produce a control flow graph for the <a
@@ -152,8 +152,9 @@
                 }
             };
             cfgPrinter.printMachineCode(runtime.disassemble(info, tm), message);
-        } else if (object instanceof CodeInfo) {
-            cfgPrinter.printMachineCode(runtime.disassemble((CodeInfo) object, null), message);
+        } else if (isCompilationResultAndCodeInfo(object)) {
+            Object[] tuple = (Object[]) object;
+            cfgPrinter.printMachineCode(runtime.disassemble((CodeInfo) tuple[1], (CompilationResult) tuple[0]), message);
         } else if (object instanceof Interval[]) {
             cfgPrinter.printIntervals(message, (Interval[]) object);
 
@@ -167,4 +168,14 @@
         cfgPrinter.cfg = null;
         cfgPrinter.flush();
     }
+
+    private static boolean isCompilationResultAndCodeInfo(Object object) {
+        if (object instanceof Object[]) {
+            Object[] tuple = (Object[]) object;
+            if (tuple.length == 2 && tuple[0] instanceof CompilationResult && tuple[1] instanceof CodeInfo) {
+                return true;
+            }
+        }
+        return false;
+    }
 }