Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7143353

-Xrunhprof fails in Java 7 due to bad switch

    Details

    • Subcomponent:
    • Resolved In Build:
      b13
    • CPU:
      x86
    • OS:
      linux, solaris_10
    • Verification:
      Verified

      Description

      FULL PRODUCT VERSION :
      java version "1.7.0_02"
      Java(TM) SE Runtime Environment (build 1.7.0_02-b13)
      Java HotSpot(TM) 64-Bit Server VM (build 22.0-b10, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Linux headius-Server 3.0.0-12-generic #20-Ubuntu SMP Fri Oct 7 14:56:25 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

      Darwin Charles-Oliver-Nutters-MacBook-Pro.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:32:41 PDT 2011; root:xnu-1504.15.3~1/RELEASE_X86_64 x86_64

      A DESCRIPTION OF THE PROBLEM :
      In all builds of OpenJDK 7 I have tried, the -Xrunhprof switch (for the "demo" JVMTI profiler) fails to work with the following error when run against code that uses invokedynamic or methodhandle/methodtype references:

      HPROF ERROR: Unknown constant
      [../../../src/share/demo/jvmti/java_crw_demo/java_crw_demo.c:693]
      [hprof_init.c:210]
      HPROF TERMINATED PROCESS

      The problem lies in the file listed here. A switch statement (at
      java_crw_demo.c:662 in my copy) is not handling the two new constant types JVM_CONSTANT_MethodHandle and JVM_CONSTANT_MethodType.

      I'm not sure the right way to handle them, but because they are missing the switch falls off the end and produces this error.

      I understand that "hprof" is demonstration code, but there are folks like
      myself that actually use its output.

      Note that the switch in question is missing *at least* the constants I
      reported. There may be others.

      I also did a quick audit of other places where these constants are used and found the following files that might be worth examining...

      hotspot/src/share/vm/oops/constantPoolOop.cpp in
      constantPoolOopDesc::shared_symbols_iterate,
      constantPoolOopDesc::shared_strings_iterate, print_cpool_bytes (some of these may be filtered out elsewhere)

      hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp in
      VM_RedefineClasses::append_entry

      This is not a complete list, but they were at least suspicious.

      REGRESSION. Last worked in version 6u29

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run any program that uses invokedynamic, methodhandle, or methodtype constant pool entries with the -Xrunhprof flag passed to the JVM.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The "hprof" JVMTI profiler should profile the program.
      ACTUAL -
      The error mentioned in the description is produced.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      HPROF ERROR: Unknown constant
      [../../../src/share/demo/jvmti/java_crw_demo/java_crw_demo.c:693]
      [hprof_init.c:210]
      HPROF TERMINATED PROCESS

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      It is not possible to produce Java source code that compiles to a .class file with invokedynamic, methodhandle, or methodtype constant pool entries. The invokedynamic-related test code in OpenJDK should work as an example case.
      ---------- END SOURCE ----------

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                nloodin Nils Loodin (Inactive)
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: