src/hotspot/share/services/heapDumper.cpp
changeset 47532 d8e417df3468
parent 47216 71c04702a3d5
child 47765 b7c7428eaab9
equal deleted inserted replaced
47530:468f0664cb39 47532:d8e417df3468
   854   u2 field_count = 0;
   854   u2 field_count = 0;
   855   for (FieldStream fldc(ik, true, true); !fldc.eos(); fldc.next()) {
   855   for (FieldStream fldc(ik, true, true); !fldc.eos(); fldc.next()) {
   856     if (fldc.access_flags().is_static()) field_count++;
   856     if (fldc.access_flags().is_static()) field_count++;
   857   }
   857   }
   858 
   858 
       
   859   // Add in resolved_references which is referenced by the cpCache
       
   860   // The resolved_references is an array per InstanceKlass holding the
       
   861   // strings and other oops resolved from the constant pool.
       
   862   oop resolved_references = ik->constants()->resolved_references_or_null();
       
   863   if (resolved_references != NULL) {
       
   864     field_count++;
       
   865 
       
   866     // Add in the resolved_references of the used previous versions of the class
       
   867     // in the case of RedefineClasses
       
   868     InstanceKlass* prev = ik->previous_versions();
       
   869     while (prev != NULL && prev->constants()->resolved_references_or_null() != NULL) {
       
   870       field_count++;
       
   871       prev = prev->previous_versions();
       
   872     }
       
   873   }
       
   874 
       
   875   // Also provide a pointer to the init_lock if present, so there aren't unreferenced int[0]
       
   876   // arrays.
       
   877   oop init_lock = ik->init_lock();
       
   878   if (init_lock != NULL) {
       
   879     field_count++;
       
   880   }
       
   881 
   859   writer->write_u2(field_count);
   882   writer->write_u2(field_count);
   860 
   883 
   861   // pass 2 - dump the field descriptors and raw values
   884   // pass 2 - dump the field descriptors and raw values
   862   for (FieldStream fld(ik, true, true); !fld.eos(); fld.next()) {
   885   for (FieldStream fld(ik, true, true); !fld.eos(); fld.next()) {
   863     if (fld.access_flags().is_static()) {
   886     if (fld.access_flags().is_static()) {
   871       address addr = (address)ik->java_mirror() + offset;
   894       address addr = (address)ik->java_mirror() + offset;
   872 
   895 
   873       dump_field_value(writer, sig->byte_at(0), addr);
   896       dump_field_value(writer, sig->byte_at(0), addr);
   874     }
   897     }
   875   }
   898   }
       
   899 
       
   900   // Add resolved_references for each class that has them
       
   901   if (resolved_references != NULL) {
       
   902     writer->write_symbolID(vmSymbols::resolved_references_name());  // name
       
   903     writer->write_u1(sig2tag(vmSymbols::object_array_signature())); // type
       
   904     writer->write_objectID(resolved_references);
       
   905 
       
   906     // Also write any previous versions
       
   907     InstanceKlass* prev = ik->previous_versions();
       
   908     while (prev != NULL && prev->constants()->resolved_references_or_null() != NULL) {
       
   909       writer->write_symbolID(vmSymbols::resolved_references_name());  // name
       
   910       writer->write_u1(sig2tag(vmSymbols::object_array_signature())); // type
       
   911       writer->write_objectID(prev->constants()->resolved_references());
       
   912       prev = prev->previous_versions();
       
   913     }
       
   914   }
       
   915 
       
   916   // Add init lock to the end if the class is not yet initialized
       
   917   if (init_lock != NULL) {
       
   918     writer->write_symbolID(vmSymbols::init_lock_name());         // name
       
   919     writer->write_u1(sig2tag(vmSymbols::int_array_signature())); // type
       
   920     writer->write_objectID(init_lock);
       
   921   }
   876 }
   922 }
   877 
   923 
   878 // dump the raw values of the instance fields of the given object
   924 // dump the raw values of the instance fields of the given object
   879 void DumperSupport::dump_instance_fields(DumpWriter* writer, oop o) {
   925 void DumperSupport::dump_instance_fields(DumpWriter* writer, oop o) {
   880   HandleMark hm;
   926   HandleMark hm;
   906   // pass 2 - dump the field descriptors
   952   // pass 2 - dump the field descriptors
   907   for (FieldStream fld(ik, true, true); !fld.eos(); fld.next()) {
   953   for (FieldStream fld(ik, true, true); !fld.eos(); fld.next()) {
   908     if (!fld.access_flags().is_static()) {
   954     if (!fld.access_flags().is_static()) {
   909       Symbol* sig = fld.signature();
   955       Symbol* sig = fld.signature();
   910 
   956 
   911       writer->write_symbolID(fld.name());                   // name
   957       writer->write_symbolID(fld.name());   // name
   912       writer->write_u1(sig2tag(sig));       // type
   958       writer->write_u1(sig2tag(sig));       // type
   913     }
   959     }
   914   }
   960   }
   915 }
   961 }
   916 
   962 
  1820   check_segment_length();
  1866   check_segment_length();
  1821 
  1867 
  1822   // HPROF_GC_ROOT_JNI_GLOBAL
  1868   // HPROF_GC_ROOT_JNI_GLOBAL
  1823   JNIGlobalsDumper jni_dumper(writer());
  1869   JNIGlobalsDumper jni_dumper(writer());
  1824   JNIHandles::oops_do(&jni_dumper);
  1870   JNIHandles::oops_do(&jni_dumper);
       
  1871   Universe::oops_do(&jni_dumper);  // technically not jni roots, but global roots
       
  1872                                    // for things like preallocated throwable backtraces
  1825   check_segment_length();
  1873   check_segment_length();
  1826 
  1874 
  1827   // HPROF_GC_ROOT_STICKY_CLASS
  1875   // HPROF_GC_ROOT_STICKY_CLASS
  1828   // These should be classes in the NULL class loader data, and not all classes
  1876   // These should be classes in the NULL class loader data, and not all classes
  1829   // if !ClassUnloading
  1877   // if !ClassUnloading