Path: blob/master/src/hotspot/share/ci/ciMetadata.hpp
40930 views
/*1* Copyright (c) 1999, 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_CI_CIMETADATA_HPP25#define SHARE_CI_CIMETADATA_HPP2627#include "ci/ciBaseObject.hpp"28#include "ci/ciClassList.hpp"29#include "runtime/handles.hpp"3031// ciMetadata32//33// Compiler interface to metadata object in the VM, not Java object.3435class ciMetadata: public ciBaseObject {36CI_PACKAGE_ACCESS37friend class ciEnv;3839protected:40Metadata* _metadata;4142ciMetadata(): _metadata(NULL) {}43ciMetadata(Metadata* o): _metadata(o) {}4445virtual bool is_classless() const;46public:47bool is_loaded() const { return _metadata != NULL || is_classless(); }4849virtual bool is_metadata() const { return true; }5051virtual bool is_type() const { return false; }52virtual bool is_return_address() const { return false; }53virtual bool is_method() const { return false; }54virtual bool is_method_data() const { return false; }55virtual bool is_klass() const { return false; }56virtual bool is_instance_klass() const { return false; }57virtual bool is_array_klass() const { return false; }58virtual bool is_obj_array_klass() const { return false; }59virtual bool is_type_array_klass() const { return false; }60virtual void dump_replay_data(outputStream* st) { /* do nothing */ }6162ciMethod* as_method() {63assert(is_method(), "bad cast");64return (ciMethod*)this;65}66ciMethodData* as_method_data() {67assert(is_method_data(), "bad cast");68return (ciMethodData*)this;69}70ciSymbol* as_symbol() {71assert(is_symbol(), "bad cast");72return (ciSymbol*)this;73}74ciType* as_type() {75assert(is_type(), "bad cast");76return (ciType*)this;77}78ciReturnAddress* as_return_address() {79assert(is_return_address(), "bad cast");80return (ciReturnAddress*)this;81}82ciKlass* as_klass() {83assert(is_klass(), "bad cast");84return (ciKlass*)this;85}86ciInstanceKlass* as_instance_klass() {87assert(is_instance_klass(), "bad cast");88return (ciInstanceKlass*)this;89}90ciArrayKlass* as_array_klass() {91assert(is_array_klass(), "bad cast");92return (ciArrayKlass*)this;93}94ciObjArrayKlass* as_obj_array_klass() {95assert(is_obj_array_klass(), "bad cast");96return (ciObjArrayKlass*)this;97}98ciTypeArrayKlass* as_type_array_klass() {99assert(is_type_array_klass(), "bad cast");100return (ciTypeArrayKlass*)this;101}102103Metadata* constant_encoding() { return _metadata; }104105bool equals(ciMetadata* obj) const { return (this == obj); }106107int hash() { return ident() * 31; } // ???108109void print(outputStream* st);110virtual void print_impl(outputStream* st) {}111virtual const char* type_string() { return "ciMetadata"; }112113void print() { print(tty); }114void print_metadata(outputStream* st = tty);115116};117#endif // SHARE_CI_CIMETADATA_HPP118119120