• Home
    • View
    • Login
    This page
    • Normal
    • Export PDF
    • Page Information

    Loading...
  1. Dashboard
  2. Undefined Space
  3. HotSpot
  4. PrintAssembly

PrintAssembly

  • Created by John Rose, last modified on Feb 22, 2009

Puzzled by a performance glitch? You might have to look at the generated code.

Examining generated code

The following HotSpot options (with an -XX: prefix on the command line) require OpenJDK 7 and an externally loadable disassembler plugin:

  • +PrintAssembly print assembly code for bytecoded and native methods
  • +PrintNMethods print nmethods as they are generated
  • +PrintNativeNMethods print native method wrappers as they are generated
  • +PrintSignatureHandlers print native method signature handlers
  • +PrintAdapterHandlers print adapters (i2c, c2i) as they are generated
  • +PrintStubCode print stubs: deopt, uncommon trap, exception, safepoint, runtime support
  • +PrintInterpreter print interpreter code

These flags are "diagnostic", meaning that they must be preceded by -XX:+UnlockDiagnosticVMOptions. On the command line, they must all be preceded by -XX:. They may also be placed in a flags file, .hotspotrc by default, or configurable as -XX:Flags=myhotspotrc.txt.

Plugin Implementations

The plugin is defined in the OpenJDK sources here:
http://hg.openjdk.java.net/jdk7/hotspot/hotspot/file/tip/src/share/tools/hsdis/

This version of the plugin requires the Gnu disassembler, which is available separately as part of the binutils project.

Look at the README for instructions on building. Pre-built binaries do not seem to be available (help... anyone?).

Independently of the OpenJDK sources, there is an implementation of the plugin in the base-hsdis project at Kenai. This is a from-scratch implementation which uses code from the Bastard project at SourceForge. The copyrights on this code are non-restrictive.

The Kenai project offers binary downloads.

Filtering Output

Individual methods may be printed:

  • CompileCommand=print,*MyClass.myMethod prints assembly for just one method
  • CompileCommand=option,*MyClass.myMethod,PrintOptoAssembly (debug build only) produces the old print command output
  • CompileCommand=option,*MyClass.myMethod,PrintNMethods produces method dumps

Reading the compiler's mind

The -XX:+LogCompilation flag produces a low-level XML file about compiler and runtime decisions, which may be interesting to some. The -XX:+UnlockDiagnosticVMOptions must come first. The dump is to hotspot.log in the current directory; use -XX:LogFile=foo.log to change this.

Overview
Content Tools
ThemeBuilder
  • No labels

Terms of Use
• License: GPLv2
• Privacy • Trademarks • Contact Us

Powered by a free Atlassian Confluence Open Source Project License granted to https://www.atlassian.com/software/views/opensource-community-additional-license-offer. Evaluate Confluence today.

  • Kolekti ThemeBuilder Powered by Atlassian Confluence 8.5.23
  • Kolekti ThemeBuilder printed.by.atlassian.confluence
  • Report a bug
  • Atlassian News
Atlassian
Kolekti ThemeBuilder EngineAtlassian Confluence
{"serverDuration": 199, "requestCorrelationId": "0037251fc865af21"}