|
1 | 1 | /* |
2 | | - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 | 4 | * |
5 | 5 | * This code is free software; you can redistribute it and/or modify it |
@@ -683,6 +683,16 @@ class DumperSupport : AllStatic { |
683 | 683 |
|
684 | 684 | // fixes up the current dump record and writes HPROF_HEAP_DUMP_END record |
685 | 685 | static void end_of_dump(DumpWriter* writer); |
| 686 | + |
| 687 | + static oop mask_dormant_archived_object(oop o) { |
| 688 | + if (o != NULL && o->klass()->java_mirror() == NULL) { |
| 689 | + // Ignore this object since the corresponding java mirror is not loaded. |
| 690 | + // Might be a dormant archive object. |
| 691 | + return NULL; |
| 692 | + } else { |
| 693 | + return o; |
| 694 | + } |
| 695 | + } |
686 | 696 | }; |
687 | 697 |
|
688 | 698 | // write a header of the given type |
@@ -758,6 +768,13 @@ void DumperSupport::dump_field_value(DumpWriter* writer, char type, oop obj, int |
758 | 768 | case JVM_SIGNATURE_CLASS : |
759 | 769 | case JVM_SIGNATURE_ARRAY : { |
760 | 770 | oop o = obj->obj_field_access<ON_UNKNOWN_OOP_REF | AS_NO_KEEPALIVE>(offset); |
| 771 | + if (o != NULL && log_is_enabled(Debug, cds, heap) && mask_dormant_archived_object(o) == NULL) { |
| 772 | + ResourceMark rm; |
| 773 | + log_debug(cds, heap)("skipped dormant archived object " INTPTR_FORMAT " (%s) referenced by " INTPTR_FORMAT " (%s)", |
| 774 | + p2i(o), o->klass()->external_name(), |
| 775 | + p2i(obj), obj->klass()->external_name()); |
| 776 | + } |
| 777 | + o = mask_dormant_archived_object(o); |
761 | 778 | assert(oopDesc::is_oop_or_null(o), "Expected an oop or NULL at " PTR_FORMAT, p2i(o)); |
762 | 779 | writer->write_objectID(o); |
763 | 780 | break; |
@@ -955,11 +972,6 @@ void DumperSupport::dump_instance_field_descriptors(DumpWriter* writer, Klass* k |
955 | 972 | // creates HPROF_GC_INSTANCE_DUMP record for the given object |
956 | 973 | void DumperSupport::dump_instance(DumpWriter* writer, oop o) { |
957 | 974 | Klass* k = o->klass(); |
958 | | - if (k->java_mirror() == NULL) { |
959 | | - // Ignoring this object since the corresponding java mirror is not loaded. |
960 | | - // Might be a dormant archive object. |
961 | | - return; |
962 | | - } |
963 | 975 |
|
964 | 976 | writer->write_u1(HPROF_GC_INSTANCE_DUMP); |
965 | 977 | writer->write_objectID(o); |
@@ -1145,6 +1157,13 @@ void DumperSupport::dump_object_array(DumpWriter* writer, objArrayOop array) { |
1145 | 1157 | // [id]* elements |
1146 | 1158 | for (int index = 0; index < length; index++) { |
1147 | 1159 | oop o = array->obj_at(index); |
| 1160 | + if (o != NULL && log_is_enabled(Debug, cds, heap) && mask_dormant_archived_object(o) == NULL) { |
| 1161 | + ResourceMark rm; |
| 1162 | + log_debug(cds, heap)("skipped dormant archived object " INTPTR_FORMAT " (%s) referenced by " INTPTR_FORMAT " (%s)", |
| 1163 | + p2i(o), o->klass()->external_name(), |
| 1164 | + p2i(array), array->klass()->external_name()); |
| 1165 | + } |
| 1166 | + o = mask_dormant_archived_object(o); |
1148 | 1167 | writer->write_objectID(o); |
1149 | 1168 | } |
1150 | 1169 | } |
@@ -1424,6 +1443,11 @@ void HeapObjectDumper::do_object(oop o) { |
1424 | 1443 | } |
1425 | 1444 | } |
1426 | 1445 |
|
| 1446 | + if (DumperSupport::mask_dormant_archived_object(o) == NULL) { |
| 1447 | + log_debug(cds, heap)("skipped dormant archived object " INTPTR_FORMAT " (%s)", p2i(o), o->klass()->external_name()); |
| 1448 | + return; |
| 1449 | + } |
| 1450 | + |
1427 | 1451 | if (o->is_instance()) { |
1428 | 1452 | // create a HPROF_GC_INSTANCE record for each object |
1429 | 1453 | DumperSupport::dump_instance(writer(), o); |
|
0 commit comments