Path: blob/master/src/hotspot/share/jfr/leakprofiler/sampling/objectSample.cpp
41155 views
/*1* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/23#include "precompiled.hpp"24#include "jfr/leakprofiler/sampling/objectSample.hpp"25#include "jfr/leakprofiler/sampling/objectSampler.hpp"26#include "oops/weakHandle.inline.hpp"27#include "runtime/handles.inline.hpp"2829void ObjectSample::reset() {30release();31set_stack_trace_id(0);32set_stack_trace_hash(0);33release_references();34}3536const oop ObjectSample::object() const {37return _object.resolve();38}3940bool ObjectSample::is_dead() const {41return _object.peek() == NULL;42}4344const oop* ObjectSample::object_addr() const {45return _object.ptr_raw();46}4748void ObjectSample::set_object(oop object) {49assert(_object.is_empty(), "should be empty");50Handle h(Thread::current(), object);51_object = WeakHandle(ObjectSampler::oop_storage(), h);52}5354void ObjectSample::release() {55_object.release(ObjectSampler::oop_storage());56_object = WeakHandle();57}585960