src/share/vm/ci/ciKlass.hpp

changeset 0
f90c822e73f8
child 6876
710a3c8b516e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/share/vm/ci/ciKlass.hpp	Wed Apr 27 01:25:04 2016 +0800
     1.3 @@ -0,0 +1,130 @@
     1.4 +/*
     1.5 + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.23 + * or visit www.oracle.com if you need additional information or have any
    1.24 + * questions.
    1.25 + *
    1.26 + */
    1.27 +
    1.28 +#ifndef SHARE_VM_CI_CIKLASS_HPP
    1.29 +#define SHARE_VM_CI_CIKLASS_HPP
    1.30 +
    1.31 +#include "ci/ciType.hpp"
    1.32 +
    1.33 +// ciKlass
    1.34 +//
    1.35 +// This class and its subclasses represent Klass*s in the
    1.36 +// HotSpot virtual machine.  In the vm, each Klass* contains an
    1.37 +// embedded Klass object.  ciKlass is subclassed to explicitly
    1.38 +// represent the kind of Klass embedded in the Klass*.  For
    1.39 +// example, a Klass* with an embedded ObjArrayKlass object is
    1.40 +// represented in the ciObject hierarchy by the class
    1.41 +// ciObjArrayKlass.
    1.42 +class ciKlass : public ciType {
    1.43 +  CI_PACKAGE_ACCESS
    1.44 +  friend class ciEnv;
    1.45 +  friend class ciField;
    1.46 +  friend class ciMethod;
    1.47 +  friend class ciMethodData;
    1.48 +  friend class ciObjArrayKlass;
    1.49 +
    1.50 +private:
    1.51 +  ciSymbol* _name;
    1.52 +  jint _layout_helper;
    1.53 +
    1.54 +protected:
    1.55 +  ciKlass(KlassHandle k_h, ciSymbol* name);
    1.56 +  ciKlass(ciSymbol* name, BasicType bt);
    1.57 +
    1.58 +  Klass* get_Klass() const {
    1.59 +    Klass* k = (Klass*)_metadata;
    1.60 +    assert(k != NULL, "illegal use of unloaded klass");
    1.61 +    return k;
    1.62 +  }
    1.63 +
    1.64 +  // Certain subklasses have an associated class loader.
    1.65 +  virtual oop loader()             { return NULL; }
    1.66 +  virtual jobject loader_handle()  { return NULL; }
    1.67 +
    1.68 +  virtual oop protection_domain()             { return NULL; }
    1.69 +  virtual jobject protection_domain_handle()  { return NULL; }
    1.70 +
    1.71 +  const char* type_string() { return "ciKlass"; }
    1.72 +
    1.73 +  void print_impl(outputStream* st);
    1.74 +
    1.75 +public:
    1.76 +  ciKlass(KlassHandle k_h);
    1.77 +
    1.78 +  // What is the name of this klass?
    1.79 +  ciSymbol* name() const { return _name; }
    1.80 +
    1.81 +  // What is its layout helper value?
    1.82 +  jint layout_helper() { return _layout_helper; }
    1.83 +
    1.84 +  bool is_subtype_of(ciKlass* klass);
    1.85 +  bool is_subclass_of(ciKlass* klass);
    1.86 +  juint super_depth();
    1.87 +  juint super_check_offset();
    1.88 +  ciKlass* super_of_depth(juint i);
    1.89 +  bool can_be_primary_super();
    1.90 +  static juint primary_super_limit() { return Klass::primary_super_limit(); }
    1.91 +
    1.92 +  // Is this ciObject the ciInstanceKlass representing java.lang.Object()?
    1.93 +  virtual bool is_java_lang_Object() const  { return false; }
    1.94 +
    1.95 +  // Get the shared parent of two klasses.
    1.96 +  ciKlass* least_common_ancestor(ciKlass* k);
    1.97 +
    1.98 +  virtual bool is_interface() {
    1.99 +    return false;
   1.100 +  }
   1.101 +
   1.102 +  virtual bool is_abstract() {
   1.103 +    return false;
   1.104 +  }
   1.105 +
   1.106 +  // Does this type (array, class, interface) have no subtypes?
   1.107 +  virtual bool is_leaf_type() {
   1.108 +    return false;
   1.109 +  }
   1.110 +
   1.111 +  // Attempt to get a klass using this ciKlass's loader.
   1.112 +  ciKlass* find_klass(ciSymbol* klass_name);
   1.113 +  // Note:  To find a class from its name string, use ciSymbol::make,
   1.114 +  // but consider adding to vmSymbols.hpp instead.
   1.115 +
   1.116 +  // Get the instance of java.lang.Class corresponding to this klass.
   1.117 +  ciInstance*            java_mirror();
   1.118 +
   1.119 +  // Fetch Klass::modifier_flags.
   1.120 +  jint                   modifier_flags();
   1.121 +
   1.122 +  // Fetch Klass::access_flags.
   1.123 +  jint                   access_flags();
   1.124 +
   1.125 +  // What kind of ciObject is this?
   1.126 +  bool is_klass() const { return true; }
   1.127 +
   1.128 +  virtual ciKlass* exact_klass() = 0;
   1.129 +
   1.130 +  void print_name_on(outputStream* st);
   1.131 +};
   1.132 +
   1.133 +#endif // SHARE_VM_CI_CIKLASS_HPP

mercurial