Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/oops/metadata.hpp
32285 views
/*1* Copyright (c) 2011, 2014, 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_VM_OOPS_METADATA_HPP25#define SHARE_VM_OOPS_METADATA_HPP2627#include "utilities/exceptions.hpp"28#include "utilities/globalDefinitions.hpp"29#include "utilities/ostream.hpp"3031// This is the base class for an internal Class related metadata32class Metadata : public MetaspaceObj {33// Debugging hook to check that the metadata has not been deleted.34NOT_PRODUCT(int _valid;)35public:36NOT_PRODUCT(Metadata() { _valid = 0; })37NOT_PRODUCT(bool is_valid() const volatile { return _valid == 0; })3839int identity_hash() { return (int)(uintptr_t)this; }4041// Rehashing support for tables containing pointers to this42unsigned int new_hash(juint seed) { ShouldNotReachHere(); return 0; }4344virtual bool is_metadata() const volatile { return true; }45virtual bool is_klass() const volatile { return false; }46virtual bool is_method() const volatile { return false; }47virtual bool is_methodData() const volatile { return false; }48virtual bool is_constantPool() const volatile { return false; }4950virtual const char* internal_name() const = 0;5152void print() const { print_on(tty); }53void print_value() const { print_value_on(tty); }5455void print_maybe_null() const { print_on_maybe_null(tty); }56void print_on_maybe_null(outputStream* st) const {57if (this == NULL)58st->print("NULL");59else60print_on(tty);61}62void print_value_on_maybe_null(outputStream* st) const {63if (this == NULL)64st->print("NULL");65else66print_value_on(tty);67}6869virtual void print_on(outputStream* st) const; // First level print70virtual void print_value_on(outputStream* st) const = 0; // Second level print7172char* print_value_string() const;7374// Used to keep metadata alive during class redefinition75// Can't assert because is called for delete functions (as an assert)76virtual bool on_stack() const { return false; }77virtual void set_on_stack(const bool value);7879// Set on_stack bit, so that the metadata is not cleared80// during class redefinition. This is a virtual call because only methods81// and constant pools need to be set, but someday instanceKlasses might also.82static void mark_on_stack(Metadata* m) { m->set_on_stack(true); }83};8485#endif // SHARE_VM_OOPS_METADATA_HPP868788