src/share/vm/ci/ciKlass.hpp

Wed, 23 Oct 2013 12:40:23 +0200

author
roland
date
Wed, 23 Oct 2013 12:40:23 +0200
changeset 5991
b2ee5dc63353
parent 5914
d13d7aba8c12
child 6198
55fb97c4c58d
permissions
-rw-r--r--

8024070: C2 needs some form of type speculation
Summary: record unused type profile information with type system, propagate and use it.
Reviewed-by: kvn, twisti

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

mercurial