< prev index next >

src/share/vm/jfr/leakprofiler/checkpoint/objectSampleWriter.cpp

Print this page
rev 9055 : 8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
Reviewed-by: egahlin, rwestberg

*** 1,7 **** /* ! * Copyright (c) 2014, 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. --- 1,7 ---- /* ! * Copyright (c) 2014, 2019, 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.
*** 348,358 **** writer->write<u8>(osdi->_data._system); writer->write<u8>(osdi->_data._type); return 1; } ! static traceid get_root_description_info_id(const Edge& edge, traceid id) { assert(edge.is_root(), "invariant"); if (EdgeUtils::is_leak_edge(edge)) { return 0; } --- 348,358 ---- writer->write<u8>(osdi->_data._system); writer->write<u8>(osdi->_data._type); return 1; } ! static traceid get_gc_root_description_info_id(const Edge& edge, traceid id) { assert(edge.is_root(), "invariant"); if (EdgeUtils::is_leak_edge(edge)) { return 0; }
*** 516,540 **** RootDescriptionWriter rw(&writer, NULL, false); root_infos->iterate(rw); } } ! static void add_old_object_sample_info(const Edge* current, traceid id) { assert(current != NULL, "invariant"); if (sample_infos == NULL) { sample_infos = new SampleInfo(); } assert(sample_infos != NULL, "invariant"); OldObjectSampleInfo* const oosi = new OldObjectSampleInfo(); assert(oosi != NULL, "invariant"); oosi->_id = id; oosi->_data._object = current->pointee(); ! oosi->_data._reference_id = current->is_root() ? (traceid)0 : id; sample_infos->store(oosi); } ! static void add_reference_info(const RoutableEdge* current, traceid id, traceid parent_id) { assert(current != NULL, "invariant"); if (ref_infos == NULL) { ref_infos = new RefInfo(); } --- 516,540 ---- RootDescriptionWriter rw(&writer, NULL, false); root_infos->iterate(rw); } } ! static void add_old_object_sample_info(const StoredEdge* current, traceid id) { assert(current != NULL, "invariant"); if (sample_infos == NULL) { sample_infos = new SampleInfo(); } assert(sample_infos != NULL, "invariant"); OldObjectSampleInfo* const oosi = new OldObjectSampleInfo(); assert(oosi != NULL, "invariant"); oosi->_id = id; oosi->_data._object = current->pointee(); ! oosi->_data._reference_id = current->parent() == NULL ? (traceid)0 : id; sample_infos->store(oosi); } ! static void add_reference_info(const StoredEdge* current, traceid id, traceid parent_id) { assert(current != NULL, "invariant"); if (ref_infos == NULL) { ref_infos = new RefInfo(); }
*** 542,582 **** ReferenceInfo* const ri = new ReferenceInfo(); assert(ri != NULL, "invariant"); ri->_id = id; ri->_data._array_info_id = !current->is_skip_edge() ? get_array_info_id(*current, id) : 0; ! ri->_data._field_info_id = ri->_data._array_info_id == 0 && !current->is_skip_edge() ? ! get_field_info_id(*current) : (traceid)0; ri->_data._old_object_sample_id = parent_id; ri->_data._skip = current->skip_length(); ref_infos->store(ri); } ! static traceid add_root_info(const Edge* root, traceid id) { assert(root != NULL, "invariant"); ! assert(root->is_root(), "invariant"); ! return get_root_description_info_id(*root, id); } ! void ObjectSampleWriter::write(const RoutableEdge* edge) { assert(edge != NULL, "invariant"); const traceid id = _store->get_id(edge); add_old_object_sample_info(edge, id); ! const RoutableEdge* parent = edge->logical_parent(); if (parent != NULL) { add_reference_info(edge, id, _store->get_id(parent)); } else { ! assert(edge->is_root(), "invariant"); ! add_root_info(edge, id); } } ! ObjectSampleWriter::ObjectSampleWriter(JfrCheckpointWriter& writer, const EdgeStore* store) : _writer(writer), _store(store) { assert(store != NULL, "invariant"); ! assert(store->number_of_entries() > 0, "invariant"); sample_infos = NULL; ref_infos = NULL; array_infos = NULL; field_infos = NULL; root_infos = NULL; --- 542,588 ---- ReferenceInfo* const ri = new ReferenceInfo(); assert(ri != NULL, "invariant"); ri->_id = id; ri->_data._array_info_id = !current->is_skip_edge() ? get_array_info_id(*current, id) : 0; ! ri->_data._field_info_id = ri->_data._array_info_id == 0 && !current->is_skip_edge() ? get_field_info_id(*current) : (traceid)0; ri->_data._old_object_sample_id = parent_id; ri->_data._skip = current->skip_length(); ref_infos->store(ri); } ! static bool is_gc_root(const StoredEdge* current) { ! assert(current != NULL, "invariant"); ! return current->parent() == NULL && current->gc_root_id() != 0; ! } ! ! static traceid add_gc_root_info(const StoredEdge* root, traceid id) { assert(root != NULL, "invariant"); ! assert(is_gc_root(root), "invariant"); ! return get_gc_root_description_info_id(*root, id); } ! void ObjectSampleWriter::write(const StoredEdge* edge) { assert(edge != NULL, "invariant"); const traceid id = _store->get_id(edge); add_old_object_sample_info(edge, id); ! const StoredEdge* const parent = edge->parent(); if (parent != NULL) { add_reference_info(edge, id, _store->get_id(parent)); } else { ! if (is_gc_root(edge)) { ! assert(edge->gc_root_id() == id, "invariant"); ! add_gc_root_info(edge, id); ! } } } ! ObjectSampleWriter::ObjectSampleWriter(JfrCheckpointWriter& writer, EdgeStore* store) : _writer(writer), _store(store) { assert(store != NULL, "invariant"); ! assert(!store->is_empty(), "invariant"); sample_infos = NULL; ref_infos = NULL; array_infos = NULL; field_infos = NULL; root_infos = NULL;
*** 588,615 **** write_array_infos(_writer); write_field_infos(_writer); write_root_descriptors(_writer); } ! void ObjectSampleWriter::write_chain(const RoutableEdge& edge) { ! assert(EdgeUtils::is_leak_edge(edge), "invariant"); ! if (edge.processed()) { ! return; ! } ! EdgeUtils::collapse_chain(edge); ! const RoutableEdge* current = &edge; ! while (current != NULL) { ! if (current->processed()) { ! return; ! } ! write(current); ! current->set_processed(); ! current = current->logical_parent(); ! } ! } ! ! bool ObjectSampleWriter::operator()(const RoutableEdge& edge) { ! if (EdgeUtils::is_leak_edge(edge)) { ! write_chain(edge); ! } return true; } --- 594,602 ---- write_array_infos(_writer); write_field_infos(_writer); write_root_descriptors(_writer); } ! bool ObjectSampleWriter::operator()(StoredEdge& e) { ! write(&e); return true; }
< prev index next >