< prev index next >

src/share/vm/services/heapDumper.cpp

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 813,822 **** --- 813,844 ---- // pass 1 - count the static fields u2 field_count = 0; for (FieldStream fldc(ikh, true, true); !fldc.eos(); fldc.next()) { if (fldc.access_flags().is_static()) field_count++; } + // Add in resolved_references which is referenced by the cpCache + // The resolved_references is an array per InstanceKlass holding the + // strings and other oops resolved from the constant pool. + oop resolved_references = ikh->constants()->resolved_references_or_null(); + if (resolved_references != NULL) { + field_count++; + + // Add in the resolved_references of the used previous versions of the class + // in the case of RedefineClasses + InstanceKlass* prev = ikh->previous_versions(); + while (prev != NULL && prev->constants()->resolved_references_or_null() != NULL) { + field_count++; + prev = prev->previous_versions(); + } + } + + // Also provide a pointer to the init_lock if present, so there aren't unreferenced int[0] + // arrays. + oop init_lock = ikh->init_lock(); + if (init_lock != NULL) { + field_count++; + } writer->write_u2(field_count); // pass 2 - dump the field descriptors and raw values for (FieldStream fld(ikh, true, true); !fld.eos(); fld.next()) {
*** 831,840 **** --- 853,885 ---- address addr = (address)ikh->java_mirror() + offset; dump_field_value(writer, sig->byte_at(0), addr); } } + + // Add resolved_references for each class that has them + if (resolved_references != NULL) { + writer->write_symbolID(vmSymbols::resolved_references_name()); // name + writer->write_u1(sig2tag(vmSymbols::object_array_signature())); // type + writer->write_objectID(resolved_references); + + // Also write any previous versions + InstanceKlass* prev = ikh->previous_versions(); + while (prev != NULL && prev->constants()->resolved_references_or_null() != NULL) { + writer->write_symbolID(vmSymbols::resolved_references_name()); // name + writer->write_u1(sig2tag(vmSymbols::object_array_signature())); // type + writer->write_objectID(prev->constants()->resolved_references()); + prev = prev->previous_versions(); + } + } + + // Add init lock to the end if the class is not yet initialized + if (init_lock != NULL) { + writer->write_symbolID(vmSymbols::init_lock_name()); // name + writer->write_u1(sig2tag(vmSymbols::int_array_signature())); // type + writer->write_objectID(init_lock); + } } // dump the raw values of the instance fields of the given object void DumperSupport::dump_instance_fields(DumpWriter* writer, oop o) { HandleMark hm;
*** 1756,1765 **** --- 1801,1812 ---- check_segment_length(); // HPROF_GC_ROOT_JNI_GLOBAL JNIGlobalsDumper jni_dumper(writer()); JNIHandles::oops_do(&jni_dumper); + Universe::oops_do(&jni_dumper); // technically not jni roots, but global roots + // for things like preallocated throwable backtraces check_segment_length(); // HPROF_GC_ROOT_STICKY_CLASS StickyClassDumper class_dumper(writer()); SystemDictionary::always_strong_classes_do(&class_dumper);
< prev index next >