duke@435: /* coleenp@4037: * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. duke@435: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@435: * duke@435: * This code is free software; you can redistribute it and/or modify it duke@435: * under the terms of the GNU General Public License version 2 only, as duke@435: * published by the Free Software Foundation. duke@435: * duke@435: * This code is distributed in the hope that it will be useful, but WITHOUT duke@435: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@435: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@435: * version 2 for more details (a copy is included in the LICENSE file that duke@435: * accompanied this code). duke@435: * duke@435: * You should have received a copy of the GNU General Public License version duke@435: * 2 along with this work; if not, write to the Free Software Foundation, duke@435: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@435: * trims@1907: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA trims@1907: * or visit www.oracle.com if you need additional information or have any trims@1907: * questions. duke@435: * duke@435: */ duke@435: stefank@2314: #ifndef SHARE_VM_CI_CIKLASS_HPP stefank@2314: #define SHARE_VM_CI_CIKLASS_HPP stefank@2314: stefank@2314: #include "ci/ciType.hpp" stefank@2314: duke@435: // ciKlass duke@435: // coleenp@4037: // This class and its subclasses represent Klass*s in the coleenp@4037: // HotSpot virtual machine. In the vm, each Klass* contains an duke@435: // embedded Klass object. ciKlass is subclassed to explicitly coleenp@4037: // represent the kind of Klass embedded in the Klass*. For coleenp@4142: // example, a Klass* with an embedded ObjArrayKlass object is duke@435: // represented in the ciObject hierarchy by the class duke@435: // ciObjArrayKlass. duke@435: class ciKlass : public ciType { duke@435: CI_PACKAGE_ACCESS duke@435: friend class ciEnv; duke@435: friend class ciField; duke@435: friend class ciMethod; duke@435: friend class ciObjArrayKlass; duke@435: duke@435: private: duke@435: ciSymbol* _name; duke@435: jint _layout_helper; duke@435: duke@435: protected: duke@435: ciKlass(KlassHandle k_h, ciSymbol* name); coleenp@4037: ciKlass(ciSymbol* name, BasicType bt); duke@435: coleenp@4037: Klass* get_Klass() const { coleenp@4037: Klass* k = (Klass*)_metadata; duke@435: assert(k != NULL, "illegal use of unloaded klass"); duke@435: return k; duke@435: } duke@435: duke@435: // Certain subklasses have an associated class loader. duke@435: virtual oop loader() { return NULL; } duke@435: virtual jobject loader_handle() { return NULL; } duke@435: duke@435: virtual oop protection_domain() { return NULL; } duke@435: virtual jobject protection_domain_handle() { return NULL; } duke@435: duke@435: const char* type_string() { return "ciKlass"; } duke@435: duke@435: void print_impl(outputStream* st); duke@435: duke@435: public: duke@435: ciKlass(KlassHandle k_h); duke@435: duke@435: // What is the name of this klass? twisti@1573: ciSymbol* name() const { return _name; } duke@435: duke@435: // What is its layout helper value? duke@435: jint layout_helper() { return _layout_helper; } duke@435: duke@435: bool is_subtype_of(ciKlass* klass); duke@435: bool is_subclass_of(ciKlass* klass); duke@435: juint super_depth(); duke@435: juint super_check_offset(); duke@435: ciKlass* super_of_depth(juint i); duke@435: bool can_be_primary_super(); duke@435: static juint primary_super_limit() { return Klass::primary_super_limit(); } duke@435: coleenp@4037: // Is this ciObject the ciInstanceKlass representing java.lang.Object()? coleenp@4037: virtual bool is_java_lang_Object() const { return false; } coleenp@4037: duke@435: // Get the shared parent of two klasses. duke@435: ciKlass* least_common_ancestor(ciKlass* k); duke@435: duke@435: virtual bool is_interface() { duke@435: return false; duke@435: } duke@435: duke@435: virtual bool is_abstract() { duke@435: return false; duke@435: } duke@435: duke@435: // Does this type (array, class, interface) have no subtypes? duke@435: virtual bool is_leaf_type() { duke@435: return false; duke@435: } duke@435: duke@435: // Attempt to get a klass using this ciKlass's loader. duke@435: ciKlass* find_klass(ciSymbol* klass_name); duke@435: // Note: To find a class from its name string, use ciSymbol::make, duke@435: // but consider adding to vmSymbols.hpp instead. duke@435: duke@435: // Get the instance of java.lang.Class corresponding to this klass. duke@435: ciInstance* java_mirror(); duke@435: duke@435: // Fetch Klass::modifier_flags. duke@435: jint modifier_flags(); duke@435: duke@435: // Fetch Klass::access_flags. duke@435: jint access_flags(); duke@435: duke@435: // What kind of ciObject is this? coleenp@4037: bool is_klass() const { return true; } duke@435: duke@435: void print_name_on(outputStream* st); duke@435: }; stefank@2314: stefank@2314: #endif // SHARE_VM_CI_CIKLASS_HPP