Path: blob/master/src/hotspot/share/oops/compiledICHolder.hpp
40951 views
/*1* Copyright (c) 1998, 2021, 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#ifndef SHARE_OOPS_COMPILEDICHOLDER_HPP25#define SHARE_OOPS_COMPILEDICHOLDER_HPP2627#include "oops/oop.hpp"28#include "utilities/macros.hpp"29#include "oops/klass.hpp"30#include "oops/method.hpp"3132// A CompiledICHolder* is a helper object for the inline cache implementation.33// It holds:34// (1) (method+klass pair) when converting from compiled to an interpreted call35// (2) (klass+klass pair) when calling itable stub from megamorphic compiled call36//37// These are always allocated in the C heap and are freed during a38// safepoint by the ICBuffer logic. It's unsafe to free them earlier39// since they might be in use.40//414243class CompiledICHolder : public CHeapObj<mtCompiler> {44friend class VMStructs;45private:46static volatile int _live_count; // allocated47static volatile int _live_not_claimed_count; // allocated but not yet in use so not48// reachable by iterating over nmethods4950Metadata* _holder_metadata;51Klass* _holder_klass; // to avoid name conflict with oopDesc::_klass52CompiledICHolder* _next;53bool _is_metadata_method;5455public:56// Constructor57CompiledICHolder(Metadata* metadata, Klass* klass, bool is_method = true);58~CompiledICHolder() NOT_DEBUG_RETURN;5960static int live_count() { return _live_count; }61static int live_not_claimed_count() { return _live_not_claimed_count; }6263// accessors64Klass* holder_klass() const { return _holder_klass; }65Metadata* holder_metadata() const { return _holder_metadata; }6667static int holder_metadata_offset() { return offset_of(CompiledICHolder, _holder_metadata); }68static int holder_klass_offset() { return offset_of(CompiledICHolder, _holder_klass); }6970CompiledICHolder* next() { return _next; }71void set_next(CompiledICHolder* n) { _next = n; }7273inline bool is_loader_alive();7475// Verify76void verify_on(outputStream* st);7778// Printing79void print_on(outputStream* st) const;80void print_value_on(outputStream* st) const;8182const char* internal_name() const { return "{compiledICHolder}"; }8384void claim() NOT_DEBUG_RETURN;85};8687#endif // SHARE_OOPS_COMPILEDICHOLDER_HPP888990