src/share/vm/ci/ciObject.hpp

Print this page


   1 /*
   2  * Copyright (c) 1999, 2006, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 








  25 // ciObject
  26 //
  27 // This class represents an oop in the HotSpot virtual machine.
  28 // Its subclasses are structured in a hierarchy which mirrors
  29 // an aggregate of the VM's oop and klass hierarchies (see
  30 // oopHierarchy.hpp).  Each instance of ciObject holds a handle
  31 // to a corresponding oop on the VM side and provides routines
  32 // for accessing the information in its oop.  By using the ciObject
  33 // hierarchy for accessing oops in the VM, the compiler ensures
  34 // that it is safe with respect to garbage collection; that is,
  35 // GC and compilation can proceed independently without
  36 // interference.
  37 //
  38 // Within the VM, the oop and klass hierarchies are separate.
  39 // The compiler interface does not preserve this separation --
  40 // the distinction between `klassOop' and `Klass' are not
  41 // reflected in the interface and instead the Klass hierarchy
  42 // is directly modeled as the subclasses of ciKlass.
  43 class ciObject : public ResourceObj {
  44   CI_PACKAGE_ACCESS


 274   }
 275   ciArrayKlassKlass*       as_array_klass_klass() {
 276     assert(is_array_klass_klass(), "bad cast");
 277     return (ciArrayKlassKlass*)this;
 278   }
 279   ciObjArrayKlassKlass*    as_obj_array_klass_klass() {
 280     assert(is_obj_array_klass_klass(), "bad cast");
 281     return (ciObjArrayKlassKlass*)this;
 282   }
 283   ciTypeArrayKlassKlass*   as_type_array_klass_klass() {
 284     assert(is_type_array_klass_klass(), "bad cast");
 285     return (ciTypeArrayKlassKlass*)this;
 286   }
 287 
 288   // Print debugging output about this ciObject.
 289   void print(outputStream* st = tty);
 290 
 291   // Print debugging output about the oop this ciObject represents.
 292   void print_oop(outputStream* st = tty);
 293 };


   1 /*
   2  * Copyright (c) 1999, 2010, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_CI_CIOBJECT_HPP
  26 #define SHARE_VM_CI_CIOBJECT_HPP
  27 
  28 #include "ci/ciClassList.hpp"
  29 #include "memory/allocation.hpp"
  30 #include "runtime/handles.hpp"
  31 #include "runtime/jniHandles.hpp"
  32 
  33 // ciObject
  34 //
  35 // This class represents an oop in the HotSpot virtual machine.
  36 // Its subclasses are structured in a hierarchy which mirrors
  37 // an aggregate of the VM's oop and klass hierarchies (see
  38 // oopHierarchy.hpp).  Each instance of ciObject holds a handle
  39 // to a corresponding oop on the VM side and provides routines
  40 // for accessing the information in its oop.  By using the ciObject
  41 // hierarchy for accessing oops in the VM, the compiler ensures
  42 // that it is safe with respect to garbage collection; that is,
  43 // GC and compilation can proceed independently without
  44 // interference.
  45 //
  46 // Within the VM, the oop and klass hierarchies are separate.
  47 // The compiler interface does not preserve this separation --
  48 // the distinction between `klassOop' and `Klass' are not
  49 // reflected in the interface and instead the Klass hierarchy
  50 // is directly modeled as the subclasses of ciKlass.
  51 class ciObject : public ResourceObj {
  52   CI_PACKAGE_ACCESS


 282   }
 283   ciArrayKlassKlass*       as_array_klass_klass() {
 284     assert(is_array_klass_klass(), "bad cast");
 285     return (ciArrayKlassKlass*)this;
 286   }
 287   ciObjArrayKlassKlass*    as_obj_array_klass_klass() {
 288     assert(is_obj_array_klass_klass(), "bad cast");
 289     return (ciObjArrayKlassKlass*)this;
 290   }
 291   ciTypeArrayKlassKlass*   as_type_array_klass_klass() {
 292     assert(is_type_array_klass_klass(), "bad cast");
 293     return (ciTypeArrayKlassKlass*)this;
 294   }
 295 
 296   // Print debugging output about this ciObject.
 297   void print(outputStream* st = tty);
 298 
 299   // Print debugging output about the oop this ciObject represents.
 300   void print_oop(outputStream* st = tty);
 301 };
 302 
 303 #endif // SHARE_VM_CI_CIOBJECT_HPP