src/share/vm/ci/ciKlass.hpp

Tue, 05 Jan 2010 15:21:25 +0100

author
twisti
date
Tue, 05 Jan 2010 15:21:25 +0100
changeset 1573
dd57230ba8fe
parent 435
a61af66fc99e
child 1907
c18cbe5936b8
permissions
-rw-r--r--

6893268: additional dynamic language related optimizations in C2
Summary: C2 needs some additional optimizations to be able to handle MethodHandle invokes and invokedynamic instructions at the best performance.
Reviewed-by: kvn, never

     1 /*
     2  * Copyright 1999-2009 Sun Microsystems, Inc.  All Rights Reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     8  *
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    12  * version 2 for more details (a copy is included in the LICENSE file that
    13  * accompanied this code).
    14  *
    15  * You should have received a copy of the GNU General Public License version
    16  * 2 along with this work; if not, write to the Free Software Foundation,
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    18  *
    19  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    20  * CA 95054 USA or visit www.sun.com if you need additional information or
    21  * have any questions.
    22  *
    23  */
    25 // ciKlass
    26 //
    27 // This class and its subclasses represent klassOops in the
    28 // HotSpot virtual machine.  In the vm, each klassOop contains an
    29 // embedded Klass object.  ciKlass is subclassed to explicitly
    30 // represent the kind of Klass embedded in the klassOop.  For
    31 // example, a klassOop with an embedded objArrayKlass object is
    32 // represented in the ciObject hierarchy by the class
    33 // ciObjArrayKlass.
    34 class ciKlass : public ciType {
    35   CI_PACKAGE_ACCESS
    36   friend class ciEnv;
    37   friend class ciField;
    38   friend class ciMethod;
    39   friend class ciObjArrayKlass;
    41 private:
    42   ciSymbol* _name;
    43   jint _layout_helper;
    45 protected:
    46   ciKlass(KlassHandle k_h, ciSymbol* name);
    47   ciKlass(ciSymbol* name, ciKlass* klass);
    49   klassOop get_klassOop() const {
    50     klassOop k = (klassOop)get_oop();
    51     assert(k != NULL, "illegal use of unloaded klass");
    52     return k;
    53   }
    55   Klass*   get_Klass() const { return get_klassOop()->klass_part(); }
    57   // Certain subklasses have an associated class loader.
    58   virtual oop loader()             { return NULL; }
    59   virtual jobject loader_handle()  { return NULL; }
    61   virtual oop protection_domain()             { return NULL; }
    62   virtual jobject protection_domain_handle()  { return NULL; }
    64   const char* type_string() { return "ciKlass"; }
    66   void print_impl(outputStream* st);
    68 public:
    69   ciKlass(KlassHandle k_h);
    71   // What is the name of this klass?
    72   ciSymbol* name() const { return _name; }
    74   // What is its layout helper value?
    75   jint layout_helper() { return _layout_helper; }
    77   bool is_subtype_of(ciKlass* klass);
    78   bool is_subclass_of(ciKlass* klass);
    79   juint super_depth();
    80   juint super_check_offset();
    81   ciKlass* super_of_depth(juint i);
    82   bool can_be_primary_super();
    83   static juint primary_super_limit() { return Klass::primary_super_limit(); }
    85   // Get the shared parent of two klasses.
    86   ciKlass* least_common_ancestor(ciKlass* k);
    88   virtual bool is_interface() {
    89     return false;
    90   }
    92   virtual bool is_abstract() {
    93     return false;
    94   }
    96   // Does this type (array, class, interface) have no subtypes?
    97   virtual bool is_leaf_type() {
    98     return false;
    99   }
   101   // Attempt to get a klass using this ciKlass's loader.
   102   ciKlass* find_klass(ciSymbol* klass_name);
   103   // Note:  To find a class from its name string, use ciSymbol::make,
   104   // but consider adding to vmSymbols.hpp instead.
   106   // Get the instance of java.lang.Class corresponding to this klass.
   107   ciInstance*            java_mirror();
   109   // Fetch Klass::modifier_flags.
   110   jint                   modifier_flags();
   112   // Fetch Klass::access_flags.
   113   jint                   access_flags();
   115   // What kind of ciObject is this?
   116   bool is_klass() { return true; }
   118   void print_name_on(outputStream* st);
   119 };

mercurial