|
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
|
@@ -686,6 +686,16 @@ class DumperSupport : AllStatic {
|
686 | 686 |
|
687 | 687 | // fixes up the current dump record and writes HPROF_HEAP_DUMP_END record
|
688 | 688 | static void end_of_dump(DumpWriter* writer);
|
| 689 | + |
| 690 | + static oop mask_dormant_archived_object(oop o) { |
| 691 | + if (o != NULL && o->klass()->java_mirror() == NULL) { |
| 692 | + // Ignore this object since the corresponding java mirror is not loaded. |
| 693 | + // Might be a dormant archive object. |
| 694 | + return NULL; |
| 695 | + } else { |
| 696 | + return o; |
| 697 | + } |
| 698 | + } |
689 | 699 | };
|
690 | 700 |
|
691 | 701 | // write a header of the given type
|
@@ -761,6 +771,13 @@ void DumperSupport::dump_field_value(DumpWriter* writer, char type, oop obj, int
|
761 | 771 | case JVM_SIGNATURE_CLASS :
|
762 | 772 | case JVM_SIGNATURE_ARRAY : {
|
763 | 773 | oop o = obj->obj_field_access<ON_UNKNOWN_OOP_REF | AS_NO_KEEPALIVE>(offset);
|
| 774 | + if (o != NULL && log_is_enabled(Debug, cds, heap) && mask_dormant_archived_object(o) == NULL) { |
| 775 | + ResourceMark rm; |
| 776 | + log_debug(cds, heap)("skipped dormant archived object " INTPTR_FORMAT " (%s) referenced by " INTPTR_FORMAT " (%s)", |
| 777 | + p2i(o), o->klass()->external_name(), |
| 778 | + p2i(obj), obj->klass()->external_name()); |
| 779 | + } |
| 780 | + o = mask_dormant_archived_object(o); |
764 | 781 | assert(oopDesc::is_oop_or_null(o), "Expected an oop or NULL at " PTR_FORMAT, p2i(o));
|
765 | 782 | writer->write_objectID(o);
|
766 | 783 | break;
|
@@ -958,11 +975,6 @@ void DumperSupport::dump_instance_field_descriptors(DumpWriter* writer, Klass* k
|
958 | 975 | // creates HPROF_GC_INSTANCE_DUMP record for the given object
|
959 | 976 | void DumperSupport::dump_instance(DumpWriter* writer, oop o) {
|
960 | 977 | Klass* k = o->klass();
|
961 |
| - if (k->java_mirror() == NULL) { |
962 |
| - // Ignoring this object since the corresponding java mirror is not loaded. |
963 |
| - // Might be a dormant archive object. |
964 |
| - return; |
965 |
| - } |
966 | 978 |
|
967 | 979 | writer->write_u1(HPROF_GC_INSTANCE_DUMP);
|
968 | 980 | writer->write_objectID(o);
|
@@ -1148,6 +1160,13 @@ void DumperSupport::dump_object_array(DumpWriter* writer, objArrayOop array) {
|
1148 | 1160 | // [id]* elements
|
1149 | 1161 | for (int index = 0; index < length; index++) {
|
1150 | 1162 | oop o = array->obj_at(index);
|
| 1163 | + if (o != NULL && log_is_enabled(Debug, cds, heap) && mask_dormant_archived_object(o) == NULL) { |
| 1164 | + ResourceMark rm; |
| 1165 | + log_debug(cds, heap)("skipped dormant archived object " INTPTR_FORMAT " (%s) referenced by " INTPTR_FORMAT " (%s)", |
| 1166 | + p2i(o), o->klass()->external_name(), |
| 1167 | + p2i(array), array->klass()->external_name()); |
| 1168 | + } |
| 1169 | + o = mask_dormant_archived_object(o); |
1151 | 1170 | writer->write_objectID(o);
|
1152 | 1171 | }
|
1153 | 1172 | }
|
@@ -1427,6 +1446,11 @@ void HeapObjectDumper::do_object(oop o) {
|
1427 | 1446 | }
|
1428 | 1447 | }
|
1429 | 1448 |
|
| 1449 | + if (DumperSupport::mask_dormant_archived_object(o) == NULL) { |
| 1450 | + log_debug(cds, heap)("skipped dormant archived object " INTPTR_FORMAT " (%s)", p2i(o), o->klass()->external_name()); |
| 1451 | + return; |
| 1452 | + } |
| 1453 | + |
1430 | 1454 | if (o->is_instance()) {
|
1431 | 1455 | // create a HPROF_GC_INSTANCE record for each object
|
1432 | 1456 | DumperSupport::dump_instance(writer(), o);
|
|
0 commit comments