hotspot/src/share/vm/ci/ciObject.hpp
author trims
Tue, 05 Apr 2011 14:12:31 -0700
changeset 8921 14bfe81f2a9d
parent 8076 96d498ec7ae1
child 9959 a6730101c2d0
permissions -rw-r--r--
7010070: Update all 2010 Oracle-changed OpenJDK files to have the proper copyright dates - second pass Summary: Update the copyright to be 2010 on all changed files in OpenJDK Reviewed-by: ohair
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
8921
14bfe81f2a9d 7010070: Update all 2010 Oracle-changed OpenJDK files to have the proper copyright dates - second pass
trims
parents: 8076
diff changeset
     2
 * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4567
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4567
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4567
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    25
#ifndef SHARE_VM_CI_CIOBJECT_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#define SHARE_VM_CI_CIOBJECT_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "ci/ciClassList.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "memory/allocation.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
#include "runtime/handles.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    31
#include "runtime/jniHandles.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    32
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
// ciObject
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
// This class represents an oop in the HotSpot virtual machine.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
// Its subclasses are structured in a hierarchy which mirrors
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
// an aggregate of the VM's oop and klass hierarchies (see
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
// oopHierarchy.hpp).  Each instance of ciObject holds a handle
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
// to a corresponding oop on the VM side and provides routines
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
// for accessing the information in its oop.  By using the ciObject
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
// hierarchy for accessing oops in the VM, the compiler ensures
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
// that it is safe with respect to garbage collection; that is,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
// GC and compilation can proceed independently without
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
// interference.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
// Within the VM, the oop and klass hierarchies are separate.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
// The compiler interface does not preserve this separation --
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
// the distinction between `klassOop' and `Klass' are not
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
// reflected in the interface and instead the Klass hierarchy
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
// is directly modeled as the subclasses of ciKlass.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
class ciObject : public ResourceObj {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  CI_PACKAGE_ACCESS
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  friend class ciEnv;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  // A JNI handle referring to an oop in the VM.  This
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  // handle may, in a small set of cases, correctly be NULL.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  jobject  _handle;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  ciKlass* _klass;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  uint     _ident;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
3908
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1
diff changeset
    62
  enum { FLAG_BITS   = 2 };
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  enum {
3908
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1
diff changeset
    64
         PERM_FLAG        = 1,
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1
diff changeset
    65
         SCAVENGABLE_FLAG = 2
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
       };
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
protected:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  ciObject();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  ciObject(oop o);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  ciObject(Handle h);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  ciObject(ciKlass* klass);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  jobject      handle()  const { return _handle; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  // Get the VM oop that this object holds.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  oop get_oop() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
    assert(_handle != NULL, "null oop");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
    return JNIHandles::resolve_non_null(_handle);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
3908
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1
diff changeset
    80
  void init_flags_from(oop x) {
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1
diff changeset
    81
    int flags = 0;
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1
diff changeset
    82
    if (x != NULL) {
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1
diff changeset
    83
      if (x->is_perm())
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1
diff changeset
    84
        flags |= PERM_FLAG;
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1
diff changeset
    85
      if (x->is_scavengable())
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1
diff changeset
    86
        flags |= SCAVENGABLE_FLAG;
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1
diff changeset
    87
    }
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1
diff changeset
    88
    _ident |= flags;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  // Virtual behavior of the print() method.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  virtual void print_impl(outputStream* st) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  virtual const char* type_string() { return "ciObject"; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  void set_ident(uint id);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  // The klass of this ciObject.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  ciKlass* klass();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  // A number unique to this object.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  uint ident();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
  // Are two ciObjects equal?
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
  bool equals(ciObject* obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  // A hash value for the convenience of compilers.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  int hash();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
3908
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1
diff changeset
   110
  // Tells if this oop has an encoding as a constant.
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1
diff changeset
   111
  // True if is_scavengable is false.
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1
diff changeset
   112
  // Also true if ScavengeRootsInCode is non-zero.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  // If it does not have an encoding, the compiler is responsible for
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  // making other arrangements for dealing with the oop.
3908
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1
diff changeset
   115
  // See ciEnv::make_array
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1
diff changeset
   116
  bool can_be_constant();
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1
diff changeset
   117
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1
diff changeset
   118
  // Tells if this oop should be made a constant.
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1
diff changeset
   119
  // True if is_scavengable is false or ScavengeRootsInCode > 1.
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1
diff changeset
   120
  bool should_be_constant();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  // Is this object guaranteed to be in the permanent part of the heap?
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  // If so, CollectedHeap::can_elide_permanent_oop_store_barriers is relevant.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
  // If the answer is false, no guarantees are made.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
  bool is_perm() { return (_ident & PERM_FLAG) != 0; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
3908
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1
diff changeset
   127
  // Might this object possibly move during a scavenge operation?
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1
diff changeset
   128
  // If the answer is true and ScavengeRootsInCode==0, the oop cannot be embedded in code.
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1
diff changeset
   129
  bool is_scavengable() { return (_ident & SCAVENGABLE_FLAG) != 0; }
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1
diff changeset
   130
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
  // The address which the compiler should embed into the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  // generated code to represent this oop.  This address
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
  // is not the true address of the oop -- it will get patched
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
  // during nmethod creation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
  //
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
  // Usage note: no address arithmetic allowed.  Oop must
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
  // be registered with the oopRecorder.
3908
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1
diff changeset
   138
  jobject constant_encoding();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  // What kind of ciObject is this?
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
  virtual bool is_null_object() const       { return false; }
4567
7fc02fbe5c7a 6893268: additional dynamic language related optimizations in C2
twisti
parents: 4566
diff changeset
   142
  virtual bool is_call_site() const         { return false; }
4566
b363f6ef4068 6829187: compiler optimizations required for JSR 292
twisti
parents: 3908
diff changeset
   143
  virtual bool is_cpcache() const           { return false; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
  virtual bool is_instance()                { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
  virtual bool is_method()                  { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
  virtual bool is_method_data()             { return false; }
4567
7fc02fbe5c7a 6893268: additional dynamic language related optimizations in C2
twisti
parents: 4566
diff changeset
   147
  virtual bool is_method_handle() const     { return false; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
  virtual bool is_array()                   { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
  virtual bool is_obj_array()               { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
  virtual bool is_type_array()              { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
  virtual bool is_symbol()                  { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
  virtual bool is_type()                    { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
  virtual bool is_return_address()          { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
  virtual bool is_klass()                   { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
  virtual bool is_instance_klass()          { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
  virtual bool is_method_klass()            { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
  virtual bool is_array_klass()             { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
  virtual bool is_obj_array_klass()         { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
  virtual bool is_type_array_klass()        { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
  virtual bool is_symbol_klass()            { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
  virtual bool is_klass_klass()             { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
  virtual bool is_instance_klass_klass()    { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
  virtual bool is_array_klass_klass()       { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
  virtual bool is_obj_array_klass_klass()   { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
  virtual bool is_type_array_klass_klass()  { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
  // Is this a type or value which has no associated class?
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
  // It is true of primitive types and null objects.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
  virtual bool is_classless() const         { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
  // Is this ciObject a Java Language Object?  That is,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
  // is the ciObject an instance or an array
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
  virtual bool is_java_object()             { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
  // Does this ciObject represent a Java Language class?
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
  // That is, is the ciObject an instanceKlass or arrayKlass?
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
  virtual bool is_java_klass()              { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
  // Is this ciObject the ciInstanceKlass representing
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
  // java.lang.Object()?
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
  virtual bool is_java_lang_Object()        { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
  // Does this ciObject refer to a real oop in the VM?
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
  //
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
  // Note: some ciObjects refer to oops which have yet to be
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
  // created.  We refer to these as "unloaded".  Specifically,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
  // there are unloaded ciMethods, ciObjArrayKlasses, and
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
  // ciInstanceKlasses.  By convention the ciNullObject is
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
  // considered loaded, and primitive types are considered loaded.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
  bool is_loaded() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
    return handle() != NULL || is_classless();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
  // Subclass casting with assertions.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
  ciNullObject*            as_null_object() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
    assert(is_null_object(), "bad cast");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
    return (ciNullObject*)this;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
  }
4567
7fc02fbe5c7a 6893268: additional dynamic language related optimizations in C2
twisti
parents: 4566
diff changeset
   199
  ciCallSite*              as_call_site() {
7fc02fbe5c7a 6893268: additional dynamic language related optimizations in C2
twisti
parents: 4566
diff changeset
   200
    assert(is_call_site(), "bad cast");
7fc02fbe5c7a 6893268: additional dynamic language related optimizations in C2
twisti
parents: 4566
diff changeset
   201
    return (ciCallSite*) this;
7fc02fbe5c7a 6893268: additional dynamic language related optimizations in C2
twisti
parents: 4566
diff changeset
   202
  }
4566
b363f6ef4068 6829187: compiler optimizations required for JSR 292
twisti
parents: 3908
diff changeset
   203
  ciCPCache*               as_cpcache() {
b363f6ef4068 6829187: compiler optimizations required for JSR 292
twisti
parents: 3908
diff changeset
   204
    assert(is_cpcache(), "bad cast");
b363f6ef4068 6829187: compiler optimizations required for JSR 292
twisti
parents: 3908
diff changeset
   205
    return (ciCPCache*) this;
b363f6ef4068 6829187: compiler optimizations required for JSR 292
twisti
parents: 3908
diff changeset
   206
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
  ciInstance*              as_instance() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
    assert(is_instance(), "bad cast");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
    return (ciInstance*)this;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
  ciMethod*                as_method() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
    assert(is_method(), "bad cast");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
    return (ciMethod*)this;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
  ciMethodData*            as_method_data() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
    assert(is_method_data(), "bad cast");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
    return (ciMethodData*)this;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
  }
4567
7fc02fbe5c7a 6893268: additional dynamic language related optimizations in C2
twisti
parents: 4566
diff changeset
   219
  ciMethodHandle*          as_method_handle() {
7fc02fbe5c7a 6893268: additional dynamic language related optimizations in C2
twisti
parents: 4566
diff changeset
   220
    assert(is_method_handle(), "bad cast");
7fc02fbe5c7a 6893268: additional dynamic language related optimizations in C2
twisti
parents: 4566
diff changeset
   221
    return (ciMethodHandle*) this;
7fc02fbe5c7a 6893268: additional dynamic language related optimizations in C2
twisti
parents: 4566
diff changeset
   222
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
  ciArray*                 as_array() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
    assert(is_array(), "bad cast");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
    return (ciArray*)this;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
  ciObjArray*              as_obj_array() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
    assert(is_obj_array(), "bad cast");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
    return (ciObjArray*)this;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
  ciTypeArray*             as_type_array() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
    assert(is_type_array(), "bad cast");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
    return (ciTypeArray*)this;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
  ciSymbol*                as_symbol() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
    assert(is_symbol(), "bad cast");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
    return (ciSymbol*)this;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
  ciType*                  as_type() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
    assert(is_type(), "bad cast");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
    return (ciType*)this;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
  ciReturnAddress*         as_return_address() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
    assert(is_return_address(), "bad cast");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
    return (ciReturnAddress*)this;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
  ciKlass*                 as_klass() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
    assert(is_klass(), "bad cast");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
    return (ciKlass*)this;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
  ciInstanceKlass*         as_instance_klass() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
    assert(is_instance_klass(), "bad cast");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
    return (ciInstanceKlass*)this;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
  ciMethodKlass*           as_method_klass() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
    assert(is_method_klass(), "bad cast");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
    return (ciMethodKlass*)this;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
  ciArrayKlass*            as_array_klass() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
    assert(is_array_klass(), "bad cast");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
    return (ciArrayKlass*)this;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
  ciObjArrayKlass*         as_obj_array_klass() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
    assert(is_obj_array_klass(), "bad cast");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
    return (ciObjArrayKlass*)this;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
  ciTypeArrayKlass*        as_type_array_klass() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
    assert(is_type_array_klass(), "bad cast");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
    return (ciTypeArrayKlass*)this;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
  ciKlassKlass*            as_klass_klass() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
    assert(is_klass_klass(), "bad cast");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
    return (ciKlassKlass*)this;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
  ciInstanceKlassKlass*    as_instance_klass_klass() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
    assert(is_instance_klass_klass(), "bad cast");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
    return (ciInstanceKlassKlass*)this;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
  ciArrayKlassKlass*       as_array_klass_klass() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
    assert(is_array_klass_klass(), "bad cast");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
    return (ciArrayKlassKlass*)this;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
  ciObjArrayKlassKlass*    as_obj_array_klass_klass() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
    assert(is_obj_array_klass_klass(), "bad cast");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
    return (ciObjArrayKlassKlass*)this;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
  ciTypeArrayKlassKlass*   as_type_array_klass_klass() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
    assert(is_type_array_klass_klass(), "bad cast");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
    return (ciTypeArrayKlassKlass*)this;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
  // Print debugging output about this ciObject.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
  void print(outputStream* st = tty);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
  // Print debugging output about the oop this ciObject represents.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
  void print_oop(outputStream* st = tty);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   298
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   299
#endif // SHARE_VM_CI_CIOBJECT_HPP