src/hotspot/share/services/heapDumper.cpp
changeset 48787 7638bf98a312
parent 48105 8d15b1369c7a
child 49036 bc92debe57e4
equal deleted inserted replaced
48786:cc231bd80c8b 48787:7638bf98a312
     1 /*
     1 /*
     2  * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
  1315   void do_oop(narrowOop* obj_p) { ShouldNotReachHere(); }
  1315   void do_oop(narrowOop* obj_p) { ShouldNotReachHere(); }
  1316 };
  1316 };
  1317 
  1317 
  1318 
  1318 
  1319 void JNILocalsDumper::do_oop(oop* obj_p) {
  1319 void JNILocalsDumper::do_oop(oop* obj_p) {
  1320   // ignore null or deleted handles
  1320   // ignore null handles
  1321   oop o = *obj_p;
  1321   oop o = *obj_p;
  1322   if (o != NULL && o != JNIHandles::deleted_handle()) {
  1322   if (o != NULL) {
  1323     writer()->write_u1(HPROF_GC_ROOT_JNI_LOCAL);
  1323     writer()->write_u1(HPROF_GC_ROOT_JNI_LOCAL);
  1324     writer()->write_objectID(o);
  1324     writer()->write_objectID(o);
  1325     writer()->write_u4(_thread_serial_num);
  1325     writer()->write_u4(_thread_serial_num);
  1326     writer()->write_u4((u4)_frame_num);
  1326     writer()->write_u4((u4)_frame_num);
  1327   }
  1327   }
  1345 
  1345 
  1346 void JNIGlobalsDumper::do_oop(oop* obj_p) {
  1346 void JNIGlobalsDumper::do_oop(oop* obj_p) {
  1347   oop o = *obj_p;
  1347   oop o = *obj_p;
  1348 
  1348 
  1349   // ignore these
  1349   // ignore these
  1350   if (o == NULL || o == JNIHandles::deleted_handle()) return;
  1350   if (o == NULL) return;
  1351 
  1351 
  1352   // we ignore global ref to symbols and other internal objects
  1352   // we ignore global ref to symbols and other internal objects
  1353   if (o->is_instance() || o->is_objArray() || o->is_typeArray()) {
  1353   if (o->is_instance() || o->is_objArray() || o->is_typeArray()) {
  1354     writer()->write_u1(HPROF_GC_ROOT_JNI_GLOBAL);
  1354     writer()->write_u1(HPROF_GC_ROOT_JNI_GLOBAL);
  1355     writer()->write_objectID(o);
  1355     writer()->write_objectID(o);
  1420   // called for each object in the heap
  1420   // called for each object in the heap
  1421   void do_object(oop o);
  1421   void do_object(oop o);
  1422 };
  1422 };
  1423 
  1423 
  1424 void HeapObjectDumper::do_object(oop o) {
  1424 void HeapObjectDumper::do_object(oop o) {
  1425   // hide the sentinel for deleted handles
       
  1426   if (o == JNIHandles::deleted_handle()) return;
       
  1427 
       
  1428   // skip classes as these emitted as HPROF_GC_CLASS_DUMP records
  1425   // skip classes as these emitted as HPROF_GC_CLASS_DUMP records
  1429   if (o->klass() == SystemDictionary::Class_klass()) {
  1426   if (o->klass() == SystemDictionary::Class_klass()) {
  1430     if (!java_lang_Class::is_primitive(o)) {
  1427     if (!java_lang_Class::is_primitive(o)) {
  1431       return;
  1428       return;
  1432     }
  1429     }