Path: blob/master/src/hotspot/share/oops/compiledICHolder.cpp
40951 views
/*1* Copyright (c) 1998, 2018, 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*/2324#include "precompiled.hpp"25#include "oops/compiledICHolder.hpp"26#include "runtime/atomic.hpp"2728volatile int CompiledICHolder::_live_count;29volatile int CompiledICHolder::_live_not_claimed_count;303132CompiledICHolder::CompiledICHolder(Metadata* metadata, Klass* klass, bool is_method)33: _holder_metadata(metadata), _holder_klass(klass), _is_metadata_method(is_method) {34#ifdef ASSERT35Atomic::inc(&_live_count);36Atomic::inc(&_live_not_claimed_count);37#endif // ASSERT38}3940#ifdef ASSERT41CompiledICHolder::~CompiledICHolder() {42assert(_live_count > 0, "underflow");43Atomic::dec(&_live_count);44}45#endif // ASSERT4647// Printing4849void CompiledICHolder::print_on(outputStream* st) const {50st->print("%s", internal_name());51st->print(" - metadata: "); holder_metadata()->print_value_on(st); st->cr();52st->print(" - klass: "); holder_klass()->print_value_on(st); st->cr();53}5455void CompiledICHolder::print_value_on(outputStream* st) const {56st->print("%s", internal_name());57}585960// Verification6162void CompiledICHolder::verify_on(outputStream* st) {63guarantee(holder_metadata()->is_method() || holder_metadata()->is_klass(), "should be method or klass");64guarantee(holder_klass()->is_klass(), "should be klass");65}6667#ifdef ASSERT6869void CompiledICHolder::claim() {70Atomic::dec(&_live_not_claimed_count);71}7273#endif // ASSERT747576