Java HotSpot Client Compiler Visualizer User Guide

Similar documents
JustClust User Manual

RuleBender Tutorial

Hypercosm. Studio.

MyOra 3.0. User Guide. SQL Tool for Oracle. Jayam Systems, LLC

DataPA OpenAnalytics End User Training

Microsoft FrontPage 2003

MAS 500 Intelligence Tips and Tricks Booklet Vol. 1

POOSL IDE User Manual

Windows 8.1 Update 1 Supplement

1.5 MONITOR. Schools Accountancy Team INTRODUCTION

Online Sharing User Manual

Excel 2007 Basic knowledge

HOW TO LINK AND PRESENT A 4D MODEL USING NAVISWORKS. Timo Hartmann t.hartmann@ctw.utwente.nl

3D Viewer. user's manual _2

Manual. Sealer Monitor Software. Version

Introduction to Eclipse

WHAT S NEW IN OBIEE

Information Server Documentation SIMATIC. Information Server V8.0 Update 1 Information Server Documentation. Introduction 1. Web application basics 2

Eclipse installation, configuration and operation


Utilities ComCash

Logi Ad Hoc Reporting System Administration Guide

Practice Fusion API Client Installation Guide for Windows

Avaya Network Configuration Manager User Guide

Tips and Tricks SAGE ACCPAC INTELLIGENCE

MyOra 3.5. User Guide. SQL Tool for Oracle. Kris Murthy

MicroStrategy Tips and Tricks

PTC Integrity Eclipse and IBM Rational Development Platform Guide

NetBeans Profiler is an

Abstract. For notes detailing the changes in each release, see the MySQL for Excel Release Notes. For legal information, see the Legal Notices.

SAP Business Intelligence (BI) Reporting Training for MM. General Navigation. Rick Heckman PASSHE 1/31/2012

Desktop, Web and Mobile Testing Tutorials

Table of Contents. Overview...2. System Requirements...3. Hardware...3. Software...3. Loading and Unloading MIB's...3. Settings...

Bitrix Site Manager 4.1. User Guide

Microsoft PowerPoint 2011

Scheduling Document Creation

Microsoft Access 2010 handout

Intellect Platform - The Workflow Engine Basic HelpDesk Troubleticket System - A102

Table Of Contents. iii

TUTORIAL 4 Building a Navigation Bar with Fireworks

BLUECIELO MERIDIAN ASSET MANAGEMENT MODULE 2014

Microsoft PowerPoint 2010

OpenIMS 4.2. Document Management Server. User manual

Teradata SQL Assistant Version 13.0 (.Net) Enhancements and Differences. Mike Dempsey

Content Author's Reference and Cookbook

Getting Started with the ArcGIS Predictive Analysis Add-In

ArchestrA Log Viewer User s Guide Invensys Systems, Inc.

Spotfire v6 New Features. TIBCO Spotfire Delta Training Jumpstart

SAP BusinessObjects Business Intelligence (BI) platform Document Version: 4.1, Support Package Report Conversion Tool Guide

For Introduction to Java Programming, 5E By Y. Daniel Liang

Appointment Scheduler

UML Class Diagrams (1.8.7) 9/2/2009

SAS BI Dashboard 4.3. User's Guide. SAS Documentation

PowerPoint 2013: Basic Skills

Network Probe User Guide

ithenticate User Manual

QUICK REFERENCE: ADOBE ILLUSTRATOR CS2 AND CS3 SECTION 1: CS3 TOOL BOX: PAGE 2 SECTION 2: CS2 TOOL BOX: PAGE 11

Nintex Workflow 2010 Help Last updated: Friday, 26 November 2010

Table Of Contents. iii

Aras Corporation Aras Corporation. All rights reserved. Notice of Rights. Notice of Liability

3 IDE (Integrated Development Environment)

Lab Activity File Management with Windows Explorer Windows XP, Vista, Windows 7 and Windows 8 Brought to you by RMRoberts.com

Introduction to OpenOffice Writer 2.0 Jessica Kubik Information Technology Lab School of Information University of Texas at Austin Fall 2005

Contents. Launching FrontPage Working with the FrontPage Interface... 3 View Options... 4 The Folders List... 5 The Page View Frame...

Alfresco Online Collaboration Tool

EET 310 Programming Tools

Microsoft Outlook 2013 Part 1: Introduction to Outlook

Topography of an Origin Project and Workspace

Simply Accounting Intelligence Tips and Tricks Booklet Vol. 1

The Reporting Console

Microsoft. Outlook 2007 Calendar Management Tools For. Jerry Maletsky Dash Designs Consulting Technology Training And Consulting

BIGPOND ONLINE STORAGE USER GUIDE Issue August 2005

Microsoft Word 2010 Prepared by Computing Services at the Eastman School of Music July 2010

Operating Systems. and Windows

Adobe Conversion Settings in Word. Section 508: Why comply?

ORACLE BUSINESS INTELLIGENCE WORKSHOP

NetIQ Operations Center 5: The Best IT Management Tool in the World Lab

Auditing manual. Archive Manager. Publication Date: November, 2015

Basic Microsoft Excel 2007

Net Inspector 2015 GETTING STARTED GUIDE. MG-SOFT Corporation. Document published on October 16, (Document Version: 10.6)

RGK60 RGK50 RGAM10 RGAM20 RGAM4 Generator set control units

LEGENDplex Data Analysis Software

Excel 2007: Basics Learning Guide

Creating Personal Web Sites Using SharePoint Designer 2007

Infoview XIR3. User Guide. 1 of 20

Using Process Monitor

Microsoft Word Quick Reference Guide. Union Institute & University

AB-Clock. Manual. Copyright by GRAHL software design

SAP BusinessObjects Financial Consolidation Web User Guide

Database Studio is the new tool to administrate SAP MaxDB database instances as of version 7.5.

Introduction to the Visual Studio.NET IDE

Installing the Android SDK

How To Write A Cq5 Authoring Manual On An Ubuntu Cq (Windows) (Windows 5) (Mac) (Apple) (Amd) (Powerbook) (Html) (Web) (Font

Building and Using Web Services With JDeveloper 11g

WebFOCUS BI Portal: S.I.M.P.L.E. as can be

Solutions from SAP. SAP Business One 2005 SP01. User Interface. Standards and Guidelines. January 2006

ELOQUA INSIGHT Reporter User Guide

SIMATIC. WinCC V7.0. Getting started. Getting started. Welcome 2. Icons 3. Creating a project 4. Configure communication 5

Handout: Word 2010 Tips and Shortcuts

Directions for Frequency Tables, Histograms, and Frequency Bar Charts

Transcription:

User Guide Project Information Summary: Visualization tool for the Java HotSpot client compiler Project homepage: https://c1visualizer.dev.java.net Project owner: Christian Wimmer License: Common Development and Distribution License Quick Start Download and install the visualizer application. Download and install a DEBUG build of the JDK 6, JDK 7, or OpenJDK. Generate input data using the Java command line option -XX:+PrintCFGToFile. Load the generated output.cfg file into the visualizer application. Expand a method in the Compiled Methods view. Open an editor for the Intermediate Representation, Bytecodes, Control Flow Graph, Data Flow Graph, or Intervals of a compilation phase. Use the detail views to see additional information for the element that is currently selected in the active editor. Installation A Java SE 6 Runtime Environment (JRE) or Development Kit (JDK) or higher must be installed on your system. Any JRE for Java 6 or higher can be used to run the visualizer application, the application itself does not depend on the Java HotSpot VM. The Java HotSpot Client Compiler Visualizer application is based on the NetBeans Platform 6.0. It is distributed as a single zip file with the appropriate launchers for all supported platforms. Extract the zip file and start the executable in the subdirectory /bin for your platform, e.g. c1visualizer.exe on Microsoft Windows. 1

Generating Input Data The application visualizes the internal data structures of the Java HotSpot client compiler, a just in time compiler inside the Java HotSpot VM. The compiler can be configured to dump debug information into a file while the VM is running. This feature is not included in the product version of the VM, therefore a DEBUG build must be used. You can download the DEBUG build for your platform (or download the source code and build a DEBUG version yourself) from the following locations: JDK 6: http://download.java.net/jdk6/binaries/ JDK 7: http://download.java.net/jdk7/binaries/ OpenJDK: http://openjdk.java.net/ The DEBUG builds contain the java executable in the directory /fastdebug/bin. In contrast to the product builds, you can specify additional command line options that are useful for debugging and testing the VM. The command line option -XX:+PrintCFGToFile activates the dump of the debug information. A file named output.cfg is created in the directory of your Java application that can be loaded into the visualizer application. The following table contains other useful command line options: Option -XX:+PrintCFGToFile -XX:+PrintCompilation -XX:+PrintInlining -XX:-Inline -Xcomp -XX:CompileOnly= <class>[.<method>] Description Enables the dumping of debug information. Prints the name of all methods that are compiled to the console. Prints the name of all methods that are inlined into a method to the console. Deactivates method inlining. All methods that are executed are compiled. Normally, only few important methods are compiled, therefore this increases the number of compiled methods greatly. Limits the compilation to classes that match the pattern. It is possible to append a list of such patterns. Packages are separated by /, not by. The examples in this user guide show the methods that are compiled when running the SciMark 2.0 benchmark (available from http://math.nist.gov/scimark2/). The input file was created using the following command line: java -XX:+PrintCFGToFile jnt.scimark2.commandline You can also download this sample file from the project homepage. 2

Loading Input Data Use File / Open Compiled Methods to load an output.cfg file. The new methods are added to the Compiled Methods view (usually on the left side of the window). The first level of the three contains the methods that were compiled. The second level shows a snapshot of the compiler data structures in different compilation phases. Usually, the following states are produced (compiler developers can easily add their own states when working on the compiler): Bytecode parsing: The first state contains the bytecodes and the control flow graph of a method when the bytecodes are parsed by the compiler. The name of the method and the type of the parameters are shown in the list. Inlined methods: If the compiler inlined methods, the bytecodes and the control flow graph of the inlined methods are shown equally to the first method. After Generation of HIR: During compilation, two intermediate representations are used before the final machine code is generated. The first one is called high level intermediate representation (HIR). Normally one HIR instruction is generated for one Java bytecode This state shows the complete HIR after all bytecodes have been parsed. Before Register Allocation: This state is generated after global optimizations on the HIR have been performed. Also the low level intermediate representation (LIR), which is close to machine code, is already available in this state. Before Register Allocation (Lifetime intervals): A special view on the data structures used during linear scan register allocation. 3

After Register Allocation (Lifetime intervals): Displays the register allocation data after physical registers are assigned to the virtual ones. It also shows which values are spilled, i.e. temporarily stored in memory. Before Code Generation: This last step shows the LIR just before machine code is generated. Depending on the selected element, different editors can be opened using the context menu or the toolbar of the Compiled Methods view. The editors are explained in detail in the following sections. Intermediate Representation: Textual view of the currently available intermediate representations. Bytecodes: Textual view of the bytecodes. Control Flow Graph: Graphical view of the control flow. The control flow in all compilation states, i.e. for the bytecodes, the HIR and the LIR. Data Flow Graph: Graphical view of the data flow. It is only available for the HIR. Intervals: Graphical view of the lifetime intervals, which are the main data structure of the linear scan register allocator. The remaining icons in the toolbar of the Compiled Methods view format the list of compiled methods: Sort the list of methods (the first level of the tree) alphabetically. Hide inlined methods that are short and consist only of a single block because such methods are usually not of interest. Show the fully qualified package name for all classes. 4

Intermediate Representation This editor displays the HIR and the LIR in textual form. It can be viewed as a textual console output enhanced with syntax coloring and navigation. The following figure shows the intermediate representation of the method String.hashCode() in the state Before Register Allocation. At this state both, HIR and LIR are available, so this is usually the state with the most valuable information. Block header State of local variables HIR instruction Reference highlighting with hyperlink Block folding LIR operation Reference tooltip The intermediate representation is grouped in basic blocks, i.e. longest possible sequences of instructions without jumps or jump targets in the middle. The first line of each block contains information about the connections to other blocks as well as a set of flags for this block. This line is followed by up to three subsections that show the state of the local variables at the beginning of the block, the HIR of the block and the LIR of the block. Depending on the compilation state, only the HIR, only the LIR or both the HIR and LIR are available. Block folding, syntax coloring, tooltips, highlighting of name references and hyperlink navigation improve the readability and navigation in the editor. The views State, HIR, and LIR show the same textual information for the currently selected blocks. This information is useful when working with other editors. When blocks are e.g. selected in the control flow graph editor, the textual intermediate representation is available via these views. 5

Bytecodes This editor displays the bytecodes in textual form. The bytecodes are only available in the early states of the compilation, i.e. during bytecode parsing. After method inlining, the control flow graph and the intermediate representation contain information from all inlined methods, therefore a mapping back to the bytecodes is neither possible nor useful. Similarly to the intermediate representation editor, block folding, syntax coloring, tooltips, highlighting of name references and hyperlink navigation are available. The bytecodes are not part of the dumped debug information in the output.cfg file. The file contains only the method name, so the class files must be available for the visualizer application. Use the preferences dialog available via the menu Tools / Options to configure the classpath for your application. For example, the following figure shows the correctly configured classpath for the SciMark benchmarks. The base folder of the benchmark, which contains the subfolders with the Java packages, is added to the default list that represents the Java boot classpath. 6

Control Flow Graph The graphical visualization of the control flow graph is the best way to get a structural overview of a method. The nodes of the graph are the basic blocks, the edges are possible control flow paths. Blocks have different colors depending on which flags are set for the blocks. For examples, loop headers and exception handlers are marked with special colors. This automatic coloring can be overridden manually using the color button of the toolbar. To make loops easier to detect, the loop depth of a block affects the drawing of a block too. The border of the blocks B3 and B4 is a double line, meaning loop depth one. All other blocks in this example have loop depth zero and therefore the border is just a single line. Backward edges are edges going from a loop end to the loop header. They have a special color. In the example there is only one backward edge going from block B4 to B3 and it is painted red. For drawing the edges, there are two possible modes available: The first mode (Button ) draws straight edges whenever possible, otherwise it tries to evade any obstacles and paints the edges as Bezier curves. The other one (Button ) is called Manhattan Router and makes all connections orthogonal. Three different automatic block positioning algorithms (Buttons,, and ) optimize different criteria like the overall size of the graph or the highlighting of loops. The visualization can be modified manually in several ways to get a better overview. First of all, the blocks can be dragged using the left mouse button. There exist several other operations on blocks which can be applied either using the toolbar buttons or the context menu: Combine: An important functionality when analyzing large graphs is combining several blocks to a single node. This way unimportant parts can be removed from the graph. Split: This is the opposite operation to combining nodes. Instead of the combined node, all original nodes are restored. 7

Show/hide edges: Some blocks, especially exception handler blocks, have many incoming or outgoing edges, which can make the graph look bad. By hiding those edges, the overview can be improved. Color: The automatic coloring of the nodes depending on flags can be manually overwritten to mark certain parts of the graph. 8

Data Flow Graph In the graphical visualization of the data flow, HIR instructions are shown as nodes. The edges represent data dependencies, i.e. an edge goes from the usage of a value to its definition. Data flow graphs for large methods are big and difficult to understand. Therefore, the editor is accompanied by a view that lists all instructions, and it is possible to reduce the amount of data shown in the editor. Instructions can be hidden and shown using the toolbar, the context menu, or the checkboxes in the view. Normally, only the instruction numbers are shown in the graph. Only when a node is expanded, the details like the instruction string and the Block are visible. Use the context menu to expand and collapse nodes. Clustering of nodes brings control flow information into the data flow graph. When clustering is enabled, instructions of the same block are located as close as possible. The toolbar offers several possibilities to customize the view of the editor: The first five buttons are used to hide groups of nodes. It is possible to hide constants, parameters, phi functions and operations. Additionally, one may hide all nodes at once. The second five buttons can make groups of nodes visible. Each button has its counterpart within the previous five ones. Expansion of block data and instruction string data can be handled using the next two buttons. These can be toggled. The expansion is applied to the whole graph. To select the layout algorithm, one of the following buttons has to be pressed. The first two ones activate hierarchical layouts. The third, fourth and fifth apply force directed layouts. The dashed blue rectangles shown in the icons two and four indicate that these layout algorithms support clustering. 9

The gearwheel represents the layout calculation process. Pressing the first of the two buttons forces an immediate layout cycle. The second one is a toggle button that enables auto layout cycles after each user interaction. This option may be deactivated if a big graph has to be processed. The bent arrow symbolizes the re usage of node positions. Some layout algorithms use an optimizing approach starting with a random node arrangement. If this option is activated, the layout is calculated based on the current node positions instead. To configure the current layout algorithm, the wrench button can be used. This brings up a dialog with all exposed layout options. The next toggle button decides if invisible nodes are included during the layout calculation. This option is helpful to keep the overview if a graph is built from nothing, because new nodes do not influence the positions of previously visible ones. The last option within this group decides if node animation is used. This means that the movement of a node is animated using linear interpolation. The next three options are only available if clustering is supported by the current layout algorithm. The first of them activates highlight clustering, i.e. the clustering of the currently expanded nodes. The next option decides if links between different clusters are grayed. The third is a toggle button that enables or disables visible cluster borders. The last button can be used to export the currently visible graph to various file formats, including vector graphics and graph representations. Functions that operate on the currently selected nodes are available in the context menu of the editor or the view. They can be used to show and hide the selected nodes, to expand and collapse the nodes, and to navigate through the graph. 10

Intervals This editor displays the data structures used during register allocation. The client compiler uses the linear scan algorithm. The control flow graph is flattened to a list. All LIR operations are numbered using the block order and shown on the x axis, so every column corresponds to one LIR operation. The numbers of the virtual registers, which are also the numbers of the intervals, are shown on the y axis. A row with a graphical view of the lifetime interval is painted for every virtual register. During register allocation, intervals can be split into several shorter ones. A new virtual register is assigned to each newly created interval, but shown in the same line to improve the readability. Additionally, a physical register is assigned to every interval. If there is no register available, the value needs to be stored temporarily in memory, and a stack slot number is assigned to the interval. Two snapshots of the interval are available for each method: Before Register Allocation shows the initial state of the intervals after they have been created. No interval has been split yet, so every line contains one interval. The color of a bar indicates the type of its associated value, e.g. magenta for objects and blue for integer values. After Register Allocation shows the intervals after the register allocator has assigned a physical register to each interval. It is also possible that long intervals are split into several shorter ones. In the example below, the interval for the virtual register 41 was split into the three parts 41, 57 and 56. Physical registers like eax or ebx are assigned to the intervals. Orange color is used to indicate that a value needs to be stored in memory for a while, which is also called spilling. The register allocator avoids spilling whenever possible and also optimizhes the position where the intervals are split and spilled. In this example, the value 41 is not accessed within the loop (which consists of the blocks B3 and B4), therefore it is a good decision to spill this value, as it needs to be loaded from memory only once after the end of the loop and not at every loop iteration. 11