Path: blob/master/src/hotspot/share/ci/ciKlass.hpp
40930 views
/*1* Copyright (c) 1999, 2020, 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_CIKLASS_HPP25#define SHARE_CI_CIKLASS_HPP2627#include "ci/ciType.hpp"28#include "oops/klass.hpp"2930// ciKlass31//32// This class and its subclasses represent Klass*s in the33// HotSpot virtual machine. In the vm, each Klass* contains an34// embedded Klass object. ciKlass is subclassed to explicitly35// represent the kind of Klass embedded in the Klass*. For36// example, a Klass* with an embedded ObjArrayKlass object is37// represented in the ciObject hierarchy by the class38// ciObjArrayKlass.39class ciKlass : public ciType {40CI_PACKAGE_ACCESS41friend class ciEnv;42friend class ciField;43friend class ciMethod;44friend class ciMethodData;45friend class ciObjArrayKlass;46friend class ciSignature;47friend class ciReceiverTypeData;4849private:50ciSymbol* _name;51jint _layout_helper;5253protected:54ciKlass(Klass* k, ciSymbol* name);55ciKlass(ciSymbol* name, BasicType bt);5657Klass* get_Klass() const {58Klass* k = (Klass*)_metadata;59assert(k != NULL, "illegal use of unloaded klass");60return k;61}6263// Certain subklasses have an associated class loader.64virtual oop loader() { return NULL; }65virtual jobject loader_handle() { return NULL; }6667virtual oop protection_domain() { return NULL; }68virtual jobject protection_domain_handle() { return NULL; }6970const char* type_string() { return "ciKlass"; }7172void print_impl(outputStream* st);7374public:75ciKlass(Klass* k);7677// What is the name of this klass?78ciSymbol* name() const { return _name; }7980// What is its layout helper value?81jint layout_helper() { return _layout_helper; }8283bool is_subtype_of(ciKlass* klass);84bool is_subclass_of(ciKlass* klass);85juint super_depth();86juint super_check_offset();87ciKlass* super_of_depth(juint i);88static juint primary_super_limit() { return Klass::primary_super_limit(); }8990// Is this ciObject the ciInstanceKlass representing java.lang.Object()?91virtual bool is_java_lang_Object() const { return false; }9293// Get the shared parent of two klasses.94ciKlass* least_common_ancestor(ciKlass* k);9596virtual bool is_interface() {97return false;98}99100virtual bool is_abstract() {101return false;102}103104// Does this type (array, class, interface) have no subtypes?105virtual bool is_leaf_type() {106return false;107}108109// Attempt to get a klass using this ciKlass's loader.110ciKlass* find_klass(ciSymbol* klass_name);111// Note: To find a class from its name string, use ciSymbol::make,112// but consider adding to vmSymbols.hpp instead.113114// Get the instance of java.lang.Class corresponding to this klass.115ciInstance* java_mirror();116117// Fetch Klass::modifier_flags.118jint modifier_flags();119120// Fetch Klass::access_flags.121jint access_flags();122123// What kind of ciObject is this?124bool is_klass() const { return true; }125126virtual ciKlass* exact_klass() = 0;127128void print_name_on(outputStream* st);129130const char* external_name() const;131};132133#endif // SHARE_CI_CIKLASS_HPP134135136