Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/ci/ciMetadata.hpp
32285 views
/*1* Copyright (c) 1999, 2012, 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_CI_CIMETADATA_HPP25#define SHARE_VM_CI_CIMETADATA_HPP2627#include "ci/ciBaseObject.hpp"28#include "ci/ciClassList.hpp"29#include "memory/allocation.hpp"30#include "runtime/handles.hpp"31#include "runtime/jniHandles.hpp"3233// ciMetadata34//35// Compiler interface to metadata object in the VM, not Java object.3637class ciMetadata: public ciBaseObject {38CI_PACKAGE_ACCESS39friend class ciEnv;4041protected:42Metadata* _metadata;4344ciMetadata(): _metadata(NULL) {}45ciMetadata(Metadata* o): _metadata(o) {}4647virtual bool is_classless() const { return false; }48public:49bool is_loaded() const { return _metadata != NULL || is_classless(); }5051virtual bool is_metadata() const { return true; }5253virtual bool is_type() const { return false; }54virtual bool is_cpcache() const { return false; }55virtual bool is_return_address() const { return false; }56virtual bool is_method() const { return false; }57virtual bool is_method_data() const { return false; }58virtual bool is_klass() const { return false; }59virtual bool is_instance_klass() const { return false; }60virtual bool is_array_klass() const { return false; }61virtual bool is_obj_array_klass() const { return false; }62virtual bool is_type_array_klass() const { return false; }63virtual void dump_replay_data(outputStream* st) { /* do nothing */ }6465ciMethod* as_method() {66assert(is_method(), "bad cast");67return (ciMethod*)this;68}69ciMethodData* as_method_data() {70assert(is_method_data(), "bad cast");71return (ciMethodData*)this;72}73ciSymbol* as_symbol() {74assert(is_symbol(), "bad cast");75return (ciSymbol*)this;76}77ciType* as_type() {78assert(is_type(), "bad cast");79return (ciType*)this;80}81ciReturnAddress* as_return_address() {82assert(is_return_address(), "bad cast");83return (ciReturnAddress*)this;84}85ciKlass* as_klass() {86assert(is_klass(), "bad cast");87return (ciKlass*)this;88}89ciInstanceKlass* as_instance_klass() {90assert(is_instance_klass(), "bad cast");91return (ciInstanceKlass*)this;92}93ciArrayKlass* as_array_klass() {94assert(is_array_klass(), "bad cast");95return (ciArrayKlass*)this;96}97ciObjArrayKlass* as_obj_array_klass() {98assert(is_obj_array_klass(), "bad cast");99return (ciObjArrayKlass*)this;100}101ciTypeArrayKlass* as_type_array_klass() {102assert(is_type_array_klass(), "bad cast");103return (ciTypeArrayKlass*)this;104}105106Metadata* constant_encoding() { return _metadata; }107108bool equals(ciMetadata* obj) const { return (this == obj); }109110int hash() { return ident() * 31; } // ???111112void print(outputStream* st);113virtual void print_impl(outputStream* st) {}114virtual const char* type_string() { return "ciMetadata"; }115116void print() { print(tty); }117void print_metadata(outputStream* st = tty);118119};120#endif // SHARE_VM_CI_CIMETADATA_HPP121122123