src/share/vm/ci/ciKlass.hpp

Wed, 03 Jul 2019 20:42:37 +0800

author
aoqi
date
Wed, 03 Jul 2019 20:42:37 +0800
changeset 9637
eef07cd490d4
parent 7535
7ae4e26cb1e0
permissions
-rw-r--r--

Merge

aoqi@0 1 /*
aoqi@0 2 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 *
aoqi@0 5 * This code is free software; you can redistribute it and/or modify it
aoqi@0 6 * under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 * published by the Free Software Foundation.
aoqi@0 8 *
aoqi@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 12 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 13 * accompanied this code).
aoqi@0 14 *
aoqi@0 15 * You should have received a copy of the GNU General Public License version
aoqi@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 18 *
aoqi@0 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 20 * or visit www.oracle.com if you need additional information or have any
aoqi@0 21 * questions.
aoqi@0 22 *
aoqi@0 23 */
aoqi@0 24
aoqi@0 25 #ifndef SHARE_VM_CI_CIKLASS_HPP
aoqi@0 26 #define SHARE_VM_CI_CIKLASS_HPP
aoqi@0 27
aoqi@0 28 #include "ci/ciType.hpp"
aoqi@0 29
aoqi@0 30 // ciKlass
aoqi@0 31 //
aoqi@0 32 // This class and its subclasses represent Klass*s in the
aoqi@0 33 // HotSpot virtual machine. In the vm, each Klass* contains an
aoqi@0 34 // embedded Klass object. ciKlass is subclassed to explicitly
aoqi@0 35 // represent the kind of Klass embedded in the Klass*. For
aoqi@0 36 // example, a Klass* with an embedded ObjArrayKlass object is
aoqi@0 37 // represented in the ciObject hierarchy by the class
aoqi@0 38 // ciObjArrayKlass.
aoqi@0 39 class ciKlass : public ciType {
aoqi@0 40 CI_PACKAGE_ACCESS
aoqi@0 41 friend class ciEnv;
aoqi@0 42 friend class ciField;
aoqi@0 43 friend class ciMethod;
aoqi@0 44 friend class ciMethodData;
aoqi@0 45 friend class ciObjArrayKlass;
stefank@6992 46 friend class ciReceiverTypeData;
aoqi@0 47
aoqi@0 48 private:
aoqi@0 49 ciSymbol* _name;
aoqi@0 50 jint _layout_helper;
aoqi@0 51
aoqi@0 52 protected:
aoqi@0 53 ciKlass(KlassHandle k_h, ciSymbol* name);
aoqi@0 54 ciKlass(ciSymbol* name, BasicType bt);
aoqi@0 55
aoqi@0 56 Klass* get_Klass() const {
aoqi@0 57 Klass* k = (Klass*)_metadata;
aoqi@0 58 assert(k != NULL, "illegal use of unloaded klass");
aoqi@0 59 return k;
aoqi@0 60 }
aoqi@0 61
aoqi@0 62 // Certain subklasses have an associated class loader.
aoqi@0 63 virtual oop loader() { return NULL; }
aoqi@0 64 virtual jobject loader_handle() { return NULL; }
aoqi@0 65
aoqi@0 66 virtual oop protection_domain() { return NULL; }
aoqi@0 67 virtual jobject protection_domain_handle() { return NULL; }
aoqi@0 68
aoqi@0 69 const char* type_string() { return "ciKlass"; }
aoqi@0 70
aoqi@0 71 void print_impl(outputStream* st);
aoqi@0 72
aoqi@0 73 public:
aoqi@0 74 ciKlass(KlassHandle k_h);
aoqi@0 75
aoqi@0 76 // What is the name of this klass?
aoqi@0 77 ciSymbol* name() const { return _name; }
aoqi@0 78
aoqi@0 79 // What is its layout helper value?
aoqi@0 80 jint layout_helper() { return _layout_helper; }
aoqi@0 81
aoqi@0 82 bool is_subtype_of(ciKlass* klass);
aoqi@0 83 bool is_subclass_of(ciKlass* klass);
aoqi@0 84 juint super_depth();
aoqi@0 85 juint super_check_offset();
aoqi@0 86 ciKlass* super_of_depth(juint i);
aoqi@0 87 bool can_be_primary_super();
aoqi@0 88 static juint primary_super_limit() { return Klass::primary_super_limit(); }
aoqi@0 89
aoqi@0 90 // Is this ciObject the ciInstanceKlass representing java.lang.Object()?
aoqi@0 91 virtual bool is_java_lang_Object() const { return false; }
aoqi@0 92
aoqi@0 93 // Get the shared parent of two klasses.
aoqi@0 94 ciKlass* least_common_ancestor(ciKlass* k);
aoqi@0 95
aoqi@0 96 virtual bool is_interface() {
aoqi@0 97 return false;
aoqi@0 98 }
aoqi@0 99
aoqi@0 100 virtual bool is_abstract() {
aoqi@0 101 return false;
aoqi@0 102 }
aoqi@0 103
aoqi@0 104 // Does this type (array, class, interface) have no subtypes?
aoqi@0 105 virtual bool is_leaf_type() {
aoqi@0 106 return false;
aoqi@0 107 }
aoqi@0 108
aoqi@0 109 // Attempt to get a klass using this ciKlass's loader.
aoqi@0 110 ciKlass* find_klass(ciSymbol* klass_name);
aoqi@0 111 // Note: To find a class from its name string, use ciSymbol::make,
aoqi@0 112 // but consider adding to vmSymbols.hpp instead.
aoqi@0 113
aoqi@0 114 // Get the instance of java.lang.Class corresponding to this klass.
aoqi@0 115 ciInstance* java_mirror();
aoqi@0 116
aoqi@0 117 // Fetch Klass::modifier_flags.
aoqi@0 118 jint modifier_flags();
aoqi@0 119
aoqi@0 120 // Fetch Klass::access_flags.
aoqi@0 121 jint access_flags();
aoqi@0 122
aoqi@0 123 // What kind of ciObject is this?
aoqi@0 124 bool is_klass() const { return true; }
aoqi@0 125
aoqi@0 126 virtual ciKlass* exact_klass() = 0;
aoqi@0 127
aoqi@0 128 void print_name_on(outputStream* st);
aoqi@0 129 };
aoqi@0 130
aoqi@0 131 #endif // SHARE_VM_CI_CIKLASS_HPP

mercurial