1.1 --- a/src/share/vm/services/heapDumper.cpp Wed Jun 27 03:04:33 2018 -0700 1.2 +++ b/src/share/vm/services/heapDumper.cpp Wed Jul 04 03:02:43 2018 -0400 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -815,6 +815,28 @@ 1.11 for (FieldStream fldc(ikh, true, true); !fldc.eos(); fldc.next()) { 1.12 if (fldc.access_flags().is_static()) field_count++; 1.13 } 1.14 + // Add in resolved_references which is referenced by the cpCache 1.15 + // The resolved_references is an array per InstanceKlass holding the 1.16 + // strings and other oops resolved from the constant pool. 1.17 + oop resolved_references = ikh->constants()->resolved_references_or_null(); 1.18 + if (resolved_references != NULL) { 1.19 + field_count++; 1.20 + 1.21 + // Add in the resolved_references of the used previous versions of the class 1.22 + // in the case of RedefineClasses 1.23 + InstanceKlass* prev = ikh->previous_versions(); 1.24 + while (prev != NULL && prev->constants()->resolved_references_or_null() != NULL) { 1.25 + field_count++; 1.26 + prev = prev->previous_versions(); 1.27 + } 1.28 + } 1.29 + 1.30 + // Also provide a pointer to the init_lock if present, so there aren't unreferenced int[0] 1.31 + // arrays. 1.32 + oop init_lock = ikh->init_lock(); 1.33 + if (init_lock != NULL) { 1.34 + field_count++; 1.35 + } 1.36 1.37 writer->write_u2(field_count); 1.38 1.39 @@ -833,6 +855,29 @@ 1.40 dump_field_value(writer, sig->byte_at(0), addr); 1.41 } 1.42 } 1.43 + 1.44 + // Add resolved_references for each class that has them 1.45 + if (resolved_references != NULL) { 1.46 + writer->write_symbolID(vmSymbols::resolved_references_name()); // name 1.47 + writer->write_u1(sig2tag(vmSymbols::object_array_signature())); // type 1.48 + writer->write_objectID(resolved_references); 1.49 + 1.50 + // Also write any previous versions 1.51 + InstanceKlass* prev = ikh->previous_versions(); 1.52 + while (prev != NULL && prev->constants()->resolved_references_or_null() != NULL) { 1.53 + writer->write_symbolID(vmSymbols::resolved_references_name()); // name 1.54 + writer->write_u1(sig2tag(vmSymbols::object_array_signature())); // type 1.55 + writer->write_objectID(prev->constants()->resolved_references()); 1.56 + prev = prev->previous_versions(); 1.57 + } 1.58 + } 1.59 + 1.60 + // Add init lock to the end if the class is not yet initialized 1.61 + if (init_lock != NULL) { 1.62 + writer->write_symbolID(vmSymbols::init_lock_name()); // name 1.63 + writer->write_u1(sig2tag(vmSymbols::int_array_signature())); // type 1.64 + writer->write_objectID(init_lock); 1.65 + } 1.66 } 1.67 1.68 // dump the raw values of the instance fields of the given object 1.69 @@ -868,7 +913,7 @@ 1.70 if (!fld.access_flags().is_static()) { 1.71 Symbol* sig = fld.signature(); 1.72 1.73 - writer->write_symbolID(fld.name()); // name 1.74 + writer->write_symbolID(fld.name()); // name 1.75 writer->write_u1(sig2tag(sig)); // type 1.76 } 1.77 } 1.78 @@ -1758,6 +1803,8 @@ 1.79 // HPROF_GC_ROOT_JNI_GLOBAL 1.80 JNIGlobalsDumper jni_dumper(writer()); 1.81 JNIHandles::oops_do(&jni_dumper); 1.82 + Universe::oops_do(&jni_dumper); // technically not jni roots, but global roots 1.83 + // for things like preallocated throwable backtraces 1.84 check_segment_length(); 1.85 1.86 // HPROF_GC_ROOT_STICKY_CLASS