src/share/vm/ci/ciKlass.hpp

Mon, 07 Jul 2014 10:12:40 +0200

author
stefank
date
Mon, 07 Jul 2014 10:12:40 +0200
changeset 6992
2c6ef90f030a
parent 6198
55fb97c4c58d
child 7535
7ae4e26cb1e0
permissions
-rw-r--r--

8049421: G1 Class Unloading after completing a concurrent mark cycle
Reviewed-by: tschatzl, ehelin, brutisso, coleenp, roland, iveresov
Contributed-by: stefan.karlsson@oracle.com, mikael.gerdin@oracle.com

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

mercurial