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

Dump::dump_oop() starts off with an overly strong assert

XMLWordPrintable

    • b79
    • sparc
    • solaris_9

      In jvmpi.cpp, the method Dump::dump_oop() starts off with an overly strong assert:

        assert(obj == NULL || (obj->is_oop() && !obj->is_klass()), "not an opp or a
      klass");

      As it turns out, there are some objects ("unsafe" static field accessors)
      which can actually have a direct reference to a hotspot klass structure,
      instead of to the java mirror. This showed up when running OptimizeIt.

      We solved the problem by weakening the assert to this:

        assert(obj == NULL || obj->is_oop(), "not an oop");
      ###@###.### 2005-05-20 06:37:09 GMT
      % ~/tests/sun-unsafe % /usr/local/j2sdk1.4.2_10/bin/java_g -Xrunhprof Reflecter
      HPROF ERROR: unable to resolve a method id
      HPROF ERROR: got NULL trace in obj_alloc
      HPROF ERROR: duplicate obj_id in object_alloc
      HPROF ERROR: unable to resolve a method id
      HPROF ERROR: got NULL trace in obj_alloc
      HPROF ERROR: unable to resolve a method id
      HPROF ERROR: got NULL trace in obj_alloc
      HPROF ERROR: unable to resolve a method id
      HPROF ERROR: got NULL trace in obj_alloc
      HPROF ERROR: unable to resolve a method id
      HPROF ERROR: got NULL trace in obj_alloc
      HPROF ERROR: class ID already in use
      Value is: 2
      Dumping Java heap ...# To suppress the following error report, specify this argument
      # after -XX: or in .hotspotrc: SuppressErrorAt=/jvmpi.cpp:1367]
      #
      # An unexpected error has been detected by HotSpot Virtual Machine:
      #
      # Internal Error (/export/jdk142-update/ws/fcs/hotspot/src/share/vm/prims/jvmpi.cpp, 1367), pid=4131, tid=2864642992
      #
      # Java VM: Java HotSpot(TM) Client VM (1.4.2_10-b03-debug mixed mode)
      #
      # Error: assert(obj == __null || (obj->is_oop() && !obj->is_klass()),"not an opp or a klass")
      # An error report file with more information is saved as hs_err_pid4131.log
      #
      # If you would like to submit a bug report, please visit:
      # http://java.sun.com/webapps/bugreport/crash.jsp
      #
      Current thread is 2864642992
      Dumping core ...
      Abort



      dalexand@swx2013: ~/tests/sun-unsafe % cat Reflecter.java
      import java.lang.reflect.*;

      public class Reflecter {

       public static void main(String[] args) {
         System.exit(main2(args));
       }

       public static int main2(String[] args) {
         Class character_klass = null;
         Field min_radix_field = null;

         try {
           character_klass = Class.forName("java.lang.Character");
         } catch (Exception e) {
           return 1;
         }

         try {
           min_radix_field = character_klass.getField("MIN_RADIX");
         } catch (Exception e) {
           return 2;
         }
           try {
           System.out.println("Value is: " + min_radix_field.getInt(null));
         } catch (Exception e) {
           return 3;
         }

         return 0;
       }
      }

            dcubed Daniel Daugherty
            mmma Marvin Ma (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: