RFR: 8264838: IGV: enhance graph export functionality

Christian Hagedorn chagedorn at openjdk.java.net
Tue Jun 8 08:25:18 UTC 2021


On Mon, 7 Jun 2021 15:05:15 GMT, Nils Eliasson <neliasso at openjdk.org> wrote:

> This PR that is contributed by @robcasloz adds SVG export functionality to IGV.
> 
> Please review,
> Best regards,
> Nils Eliasson

Changes requested by chagedorn (Reviewer).

src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/EditorTopComponent.java line 56:

> 54: import org.apache.batik.dom.GenericDOMImplementation;
> 55: import org.apache.batik.svggen.SVGGeneratorContext;
> 56: import org.apache.batik.svggen.SVGGraphics2D;

When trying to build IGV with this patch I get

Compilation failure
[ERROR] /home/christian/jdk/open/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/EditorTopComponent.java:[648,18] cannot find symbol
[ERROR]   symbol:   class SVGGraphics2DIOException
[ERROR]   location: class com.sun.hotspot.igv.view.EditorTopComponent

I think there is a missing `import org.apache.batik.svggen.SVGGraphics2DIOException;` here.

src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/EditorTopComponent.java line 123:

> 121:                     }
> 122:                 }
> 123:             }

Can be simplified to

try (FileOutputStream os = new FileOutputStream(f)) {
    Writer out = new OutputStreamWriter(os, StandardCharsets.UTF_8);
    printToStream(svgGenerator, out, true);
} catch (IOException e) {
    e.printStackTrace();
}

You could also use `StandardCharsets.UTF_8` instead of `"UTF-8"`.

-------------

PR: https://git.openjdk.java.net/jdk/pull/4394


More information about the hotspot-compiler-dev mailing list