src/share/vm/ci/ciType.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/ciType.hpp	Wed Apr 27 01:25:04 2016 +0800
     1.3 @@ -0,0 +1,115 @@
     1.4 +/*
     1.5 + * Copyright (c) 2000, 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_CITYPE_HPP
    1.29 +#define SHARE_VM_CI_CITYPE_HPP
    1.30 +
    1.31 +#include "ci/ciMetadata.hpp"
    1.32 +
    1.33 +// ciType
    1.34 +//
    1.35 +// This class represents either a class (T_OBJECT), array (T_ARRAY),
    1.36 +// or one of the primitive types such as T_INT.
    1.37 +class ciType : public ciMetadata {
    1.38 +  CI_PACKAGE_ACCESS
    1.39 +  friend class ciKlass;
    1.40 +  friend class ciReturnAddress;
    1.41 +
    1.42 +private:
    1.43 +  BasicType _basic_type;
    1.44 +
    1.45 +  ciType(BasicType t);     // for primitive and unloaded types
    1.46 +  ciType(KlassHandle k);   // for subclasses (reference types)
    1.47 +
    1.48 +  const char* type_string() { return "ciType"; }
    1.49 +
    1.50 +  void print_impl(outputStream* st);
    1.51 +
    1.52 +  // Distinguished instances of primitive ciTypes..
    1.53 +  static ciType* _basic_types[T_CONFLICT+1];
    1.54 +
    1.55 +public:
    1.56 +  BasicType basic_type() const              { return _basic_type; }
    1.57 +
    1.58 +  // Returns true iff the types are identical, or if both are klasses
    1.59 +  // and the is_subtype_of relation holds between the klasses.
    1.60 +  bool is_subtype_of(ciType* type);
    1.61 +
    1.62 +  // Get the instance of java.lang.Class corresponding to this type.
    1.63 +  // There are mirrors for instance, array, and primitive types (incl. void).
    1.64 +  virtual ciInstance*    java_mirror();
    1.65 +
    1.66 +  // Get the class which "boxes" (or "wraps") values of this type.
    1.67 +  // Example:  short is boxed by java.lang.Short, etc.
    1.68 +  // Returns self if it is a reference type.
    1.69 +  // Returns NULL for void, since null is used in such cases.
    1.70 +  ciKlass*  box_klass();
    1.71 +
    1.72 +  // Returns true if this is not a klass or array (i.e., not a reference type).
    1.73 +  bool is_primitive_type() const            { return basic_type() != T_OBJECT && basic_type() != T_ARRAY; }
    1.74 +  int size() const                          { return type2size[basic_type()]; }
    1.75 +  bool is_void() const                      { return basic_type() == T_VOID; }
    1.76 +  bool is_one_word() const                  { return size() == 1; }
    1.77 +  bool is_two_word() const                  { return size() == 2; }
    1.78 +
    1.79 +  // What kind of ciObject is this?
    1.80 +  bool is_type() const                      { return true; }
    1.81 +  bool is_classless() const                 { return is_primitive_type(); }
    1.82 +
    1.83 +  const char* name();
    1.84 +  virtual void print_name_on(outputStream* st);
    1.85 +  void print_name() {
    1.86 +    print_name_on(tty);
    1.87 +  }
    1.88 +
    1.89 +  static ciType* make(BasicType t);
    1.90 +};
    1.91 +
    1.92 +
    1.93 +// ciReturnAddress
    1.94 +//
    1.95 +// This class represents the type of a specific return address in the
    1.96 +// bytecodes.
    1.97 +class ciReturnAddress : public ciType {
    1.98 +  CI_PACKAGE_ACCESS
    1.99 +
   1.100 +private:
   1.101 +  // The bci of this return address.
   1.102 +  int _bci;
   1.103 +
   1.104 +  ciReturnAddress(int bci);
   1.105 +
   1.106 +  const char* type_string() { return "ciReturnAddress"; }
   1.107 +
   1.108 +  void print_impl(outputStream* st);
   1.109 +
   1.110 +public:
   1.111 +  bool is_return_address() const { return true; }
   1.112 +
   1.113 +  int  bci() { return _bci; }
   1.114 +
   1.115 +  static ciReturnAddress* make(int bci);
   1.116 +};
   1.117 +
   1.118 +#endif // SHARE_VM_CI_CITYPE_HPP

mercurial