src/share/vm/ci/ciKlass.hpp

Wed, 12 Oct 2011 21:00:13 -0700

author
twisti
date
Wed, 12 Oct 2011 21:00:13 -0700
changeset 3197
5eb9169b1a14
parent 2314
f95d63e2154a
child 4037
da91efe96a93
permissions
-rw-r--r--

7092712: JSR 292: unloaded invokedynamic call sites can lead to a crash with signature types not on BCP
Reviewed-by: jrose, never

duke@435 1 /*
stefank@2314 2 * Copyright (c) 1999, 2010, 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 #include "oops/klassOop.hpp"
stefank@2314 30
duke@435 31 // ciKlass
duke@435 32 //
duke@435 33 // This class and its subclasses represent klassOops in the
duke@435 34 // HotSpot virtual machine. In the vm, each klassOop contains an
duke@435 35 // embedded Klass object. ciKlass is subclassed to explicitly
duke@435 36 // represent the kind of Klass embedded in the klassOop. For
duke@435 37 // example, a klassOop with an embedded objArrayKlass object is
duke@435 38 // represented in the ciObject hierarchy by the class
duke@435 39 // ciObjArrayKlass.
duke@435 40 class ciKlass : public ciType {
duke@435 41 CI_PACKAGE_ACCESS
duke@435 42 friend class ciEnv;
duke@435 43 friend class ciField;
duke@435 44 friend class ciMethod;
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);
duke@435 53 ciKlass(ciSymbol* name, ciKlass* klass);
duke@435 54
duke@435 55 klassOop get_klassOop() const {
duke@435 56 klassOop k = (klassOop)get_oop();
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 Klass* get_Klass() const { return get_klassOop()->klass_part(); }
duke@435 62
duke@435 63 // Certain subklasses have an associated class loader.
duke@435 64 virtual oop loader() { return NULL; }
duke@435 65 virtual jobject loader_handle() { return NULL; }
duke@435 66
duke@435 67 virtual oop protection_domain() { return NULL; }
duke@435 68 virtual jobject protection_domain_handle() { return NULL; }
duke@435 69
duke@435 70 const char* type_string() { return "ciKlass"; }
duke@435 71
duke@435 72 void print_impl(outputStream* st);
duke@435 73
duke@435 74 public:
duke@435 75 ciKlass(KlassHandle k_h);
duke@435 76
duke@435 77 // What is the name of this klass?
twisti@1573 78 ciSymbol* name() const { return _name; }
duke@435 79
duke@435 80 // What is its layout helper value?
duke@435 81 jint layout_helper() { return _layout_helper; }
duke@435 82
duke@435 83 bool is_subtype_of(ciKlass* klass);
duke@435 84 bool is_subclass_of(ciKlass* klass);
duke@435 85 juint super_depth();
duke@435 86 juint super_check_offset();
duke@435 87 ciKlass* super_of_depth(juint i);
duke@435 88 bool can_be_primary_super();
duke@435 89 static juint primary_super_limit() { return Klass::primary_super_limit(); }
duke@435 90
duke@435 91 // Get the shared parent of two klasses.
duke@435 92 ciKlass* least_common_ancestor(ciKlass* k);
duke@435 93
duke@435 94 virtual bool is_interface() {
duke@435 95 return false;
duke@435 96 }
duke@435 97
duke@435 98 virtual bool is_abstract() {
duke@435 99 return false;
duke@435 100 }
duke@435 101
duke@435 102 // Does this type (array, class, interface) have no subtypes?
duke@435 103 virtual bool is_leaf_type() {
duke@435 104 return false;
duke@435 105 }
duke@435 106
duke@435 107 // Attempt to get a klass using this ciKlass's loader.
duke@435 108 ciKlass* find_klass(ciSymbol* klass_name);
duke@435 109 // Note: To find a class from its name string, use ciSymbol::make,
duke@435 110 // but consider adding to vmSymbols.hpp instead.
duke@435 111
duke@435 112 // Get the instance of java.lang.Class corresponding to this klass.
duke@435 113 ciInstance* java_mirror();
duke@435 114
duke@435 115 // Fetch Klass::modifier_flags.
duke@435 116 jint modifier_flags();
duke@435 117
duke@435 118 // Fetch Klass::access_flags.
duke@435 119 jint access_flags();
duke@435 120
duke@435 121 // What kind of ciObject is this?
duke@435 122 bool is_klass() { return true; }
duke@435 123
duke@435 124 void print_name_on(outputStream* st);
duke@435 125 };
stefank@2314 126
stefank@2314 127 #endif // SHARE_VM_CI_CIKLASS_HPP

mercurial