diff src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Figure.java @ 21146:33ff6b03fad1

add support for control flow window and basic block view on graphs Contributed-by: Michael Haupt <michael.haupt@oracle.com> Contributed-by: Peter Hofer <peter.hofer@jku.at> Contributed-by: Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
author Michael Haupt <michael.haupt@oracle.com>
date Wed, 29 Apr 2015 08:31:28 +0200
parents 3c78119de0cd
children
line wrap: on
line diff
--- a/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Figure.java	Tue Apr 28 12:58:40 2015 -0700
+++ b/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Figure.java	Wed Apr 29 08:31:28 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,10 +23,12 @@
  */
 package com.sun.hotspot.igv.graph;
 
+import com.sun.hotspot.igv.data.InputBlock;
 import com.sun.hotspot.igv.data.InputGraph;
 import com.sun.hotspot.igv.data.InputNode;
 import com.sun.hotspot.igv.data.Properties;
 import com.sun.hotspot.igv.data.Source;
+import com.sun.hotspot.igv.layout.Cluster;
 import com.sun.hotspot.igv.layout.Vertex;
 import java.awt.*;
 import java.awt.image.BufferedImage;
@@ -338,6 +340,19 @@
     public String toString() {
         return idString;
     }
+    
+    public Cluster getCluster() {
+        if (getSource().getSourceNodes().size() == 0) {
+            assert false : "Should never reach here, every figure must have at least one source node!";
+            return null;
+        } else {
+            final InputBlock inputBlock = diagram.getGraph().getBlock(getSource().getSourceNodes().get(0));
+            assert inputBlock != null;
+            Cluster result = diagram.getBlock(inputBlock);
+            assert result != null;
+            return result;
+        }
+    }
 
     @Override
     public boolean isRoot() {