1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/vm/ci/ciKlass.hpp Sat Dec 01 00:00:00 2007 +0000 1.3 @@ -0,0 +1,119 @@ 1.4 +/* 1.5 + * Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. 1.11 + * 1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 + * version 2 for more details (a copy is included in the LICENSE file that 1.16 + * accompanied this code). 1.17 + * 1.18 + * You should have received a copy of the GNU General Public License version 1.19 + * 2 along with this work; if not, write to the Free Software Foundation, 1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 + * 1.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 1.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 1.24 + * have any questions. 1.25 + * 1.26 + */ 1.27 + 1.28 +// ciKlass 1.29 +// 1.30 +// This class and its subclasses represent klassOops in the 1.31 +// HotSpot virtual machine. In the vm, each klassOop contains an 1.32 +// embedded Klass object. ciKlass is subclassed to explicitly 1.33 +// represent the kind of Klass embedded in the klassOop. For 1.34 +// example, a klassOop with an embedded objArrayKlass object is 1.35 +// represented in the ciObject hierarchy by the class 1.36 +// ciObjArrayKlass. 1.37 +class ciKlass : public ciType { 1.38 + CI_PACKAGE_ACCESS 1.39 + friend class ciEnv; 1.40 + friend class ciField; 1.41 + friend class ciMethod; 1.42 + friend class ciObjArrayKlass; 1.43 + 1.44 +private: 1.45 + ciSymbol* _name; 1.46 + jint _layout_helper; 1.47 + 1.48 +protected: 1.49 + ciKlass(KlassHandle k_h, ciSymbol* name); 1.50 + ciKlass(ciSymbol* name, ciKlass* klass); 1.51 + 1.52 + klassOop get_klassOop() const { 1.53 + klassOop k = (klassOop)get_oop(); 1.54 + assert(k != NULL, "illegal use of unloaded klass"); 1.55 + return k; 1.56 + } 1.57 + 1.58 + Klass* get_Klass() const { return get_klassOop()->klass_part(); } 1.59 + 1.60 + // Certain subklasses have an associated class loader. 1.61 + virtual oop loader() { return NULL; } 1.62 + virtual jobject loader_handle() { return NULL; } 1.63 + 1.64 + virtual oop protection_domain() { return NULL; } 1.65 + virtual jobject protection_domain_handle() { return NULL; } 1.66 + 1.67 + const char* type_string() { return "ciKlass"; } 1.68 + 1.69 + void print_impl(outputStream* st); 1.70 + 1.71 +public: 1.72 + ciKlass(KlassHandle k_h); 1.73 + 1.74 + // What is the name of this klass? 1.75 + ciSymbol* name() { return _name; } 1.76 + 1.77 + // What is its layout helper value? 1.78 + jint layout_helper() { return _layout_helper; } 1.79 + 1.80 + bool is_subtype_of(ciKlass* klass); 1.81 + bool is_subclass_of(ciKlass* klass); 1.82 + juint super_depth(); 1.83 + juint super_check_offset(); 1.84 + ciKlass* super_of_depth(juint i); 1.85 + bool can_be_primary_super(); 1.86 + static juint primary_super_limit() { return Klass::primary_super_limit(); } 1.87 + 1.88 + // Get the shared parent of two klasses. 1.89 + ciKlass* least_common_ancestor(ciKlass* k); 1.90 + 1.91 + virtual bool is_interface() { 1.92 + return false; 1.93 + } 1.94 + 1.95 + virtual bool is_abstract() { 1.96 + return false; 1.97 + } 1.98 + 1.99 + // Does this type (array, class, interface) have no subtypes? 1.100 + virtual bool is_leaf_type() { 1.101 + return false; 1.102 + } 1.103 + 1.104 + // Attempt to get a klass using this ciKlass's loader. 1.105 + ciKlass* find_klass(ciSymbol* klass_name); 1.106 + // Note: To find a class from its name string, use ciSymbol::make, 1.107 + // but consider adding to vmSymbols.hpp instead. 1.108 + 1.109 + // Get the instance of java.lang.Class corresponding to this klass. 1.110 + ciInstance* java_mirror(); 1.111 + 1.112 + // Fetch Klass::modifier_flags. 1.113 + jint modifier_flags(); 1.114 + 1.115 + // Fetch Klass::access_flags. 1.116 + jint access_flags(); 1.117 + 1.118 + // What kind of ciObject is this? 1.119 + bool is_klass() { return true; } 1.120 + 1.121 + void print_name_on(outputStream* st); 1.122 +};