Wed, 27 Apr 2016 01:25:04 +0800
Initial load
http://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/
changeset: 6782:28b50d07f6f8
tag: jdk8u25-b17
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; |
aoqi@0 | 46 | |
aoqi@0 | 47 | private: |
aoqi@0 | 48 | ciSymbol* _name; |
aoqi@0 | 49 | jint _layout_helper; |
aoqi@0 | 50 | |
aoqi@0 | 51 | protected: |
aoqi@0 | 52 | ciKlass(KlassHandle k_h, ciSymbol* name); |
aoqi@0 | 53 | ciKlass(ciSymbol* name, BasicType bt); |
aoqi@0 | 54 | |
aoqi@0 | 55 | Klass* get_Klass() const { |
aoqi@0 | 56 | Klass* k = (Klass*)_metadata; |
aoqi@0 | 57 | assert(k != NULL, "illegal use of unloaded klass"); |
aoqi@0 | 58 | return k; |
aoqi@0 | 59 | } |
aoqi@0 | 60 | |
aoqi@0 | 61 | // Certain subklasses have an associated class loader. |
aoqi@0 | 62 | virtual oop loader() { return NULL; } |
aoqi@0 | 63 | virtual jobject loader_handle() { return NULL; } |
aoqi@0 | 64 | |
aoqi@0 | 65 | virtual oop protection_domain() { return NULL; } |
aoqi@0 | 66 | virtual jobject protection_domain_handle() { return NULL; } |
aoqi@0 | 67 | |
aoqi@0 | 68 | const char* type_string() { return "ciKlass"; } |
aoqi@0 | 69 | |
aoqi@0 | 70 | void print_impl(outputStream* st); |
aoqi@0 | 71 | |
aoqi@0 | 72 | public: |
aoqi@0 | 73 | ciKlass(KlassHandle k_h); |
aoqi@0 | 74 | |
aoqi@0 | 75 | // What is the name of this klass? |
aoqi@0 | 76 | ciSymbol* name() const { return _name; } |
aoqi@0 | 77 | |
aoqi@0 | 78 | // What is its layout helper value? |
aoqi@0 | 79 | jint layout_helper() { return _layout_helper; } |
aoqi@0 | 80 | |
aoqi@0 | 81 | bool is_subtype_of(ciKlass* klass); |
aoqi@0 | 82 | bool is_subclass_of(ciKlass* klass); |
aoqi@0 | 83 | juint super_depth(); |
aoqi@0 | 84 | juint super_check_offset(); |
aoqi@0 | 85 | ciKlass* super_of_depth(juint i); |
aoqi@0 | 86 | bool can_be_primary_super(); |
aoqi@0 | 87 | static juint primary_super_limit() { return Klass::primary_super_limit(); } |
aoqi@0 | 88 | |
aoqi@0 | 89 | // Is this ciObject the ciInstanceKlass representing java.lang.Object()? |
aoqi@0 | 90 | virtual bool is_java_lang_Object() const { return false; } |
aoqi@0 | 91 | |
aoqi@0 | 92 | // Get the shared parent of two klasses. |
aoqi@0 | 93 | ciKlass* least_common_ancestor(ciKlass* k); |
aoqi@0 | 94 | |
aoqi@0 | 95 | virtual bool is_interface() { |
aoqi@0 | 96 | return false; |
aoqi@0 | 97 | } |
aoqi@0 | 98 | |
aoqi@0 | 99 | virtual bool is_abstract() { |
aoqi@0 | 100 | return false; |
aoqi@0 | 101 | } |
aoqi@0 | 102 | |
aoqi@0 | 103 | // Does this type (array, class, interface) have no subtypes? |
aoqi@0 | 104 | virtual bool is_leaf_type() { |
aoqi@0 | 105 | return false; |
aoqi@0 | 106 | } |
aoqi@0 | 107 | |
aoqi@0 | 108 | // Attempt to get a klass using this ciKlass's loader. |
aoqi@0 | 109 | ciKlass* find_klass(ciSymbol* klass_name); |
aoqi@0 | 110 | // Note: To find a class from its name string, use ciSymbol::make, |
aoqi@0 | 111 | // but consider adding to vmSymbols.hpp instead. |
aoqi@0 | 112 | |
aoqi@0 | 113 | // Get the instance of java.lang.Class corresponding to this klass. |
aoqi@0 | 114 | ciInstance* java_mirror(); |
aoqi@0 | 115 | |
aoqi@0 | 116 | // Fetch Klass::modifier_flags. |
aoqi@0 | 117 | jint modifier_flags(); |
aoqi@0 | 118 | |
aoqi@0 | 119 | // Fetch Klass::access_flags. |
aoqi@0 | 120 | jint access_flags(); |
aoqi@0 | 121 | |
aoqi@0 | 122 | // What kind of ciObject is this? |
aoqi@0 | 123 | bool is_klass() const { return true; } |
aoqi@0 | 124 | |
aoqi@0 | 125 | virtual ciKlass* exact_klass() = 0; |
aoqi@0 | 126 | |
aoqi@0 | 127 | void print_name_on(outputStream* st); |
aoqi@0 | 128 | }; |
aoqi@0 | 129 | |
aoqi@0 | 130 | #endif // SHARE_VM_CI_CIKLASS_HPP |