1 #ifdef USE_PRAGMA_IDENT_HDR
   2 #pragma ident "@(#)constantPoolKlass.hpp        1.51 07/05/29 09:44:18 JVM"
   3 #endif
   4 /*
   5  * Copyright 1997-2006 Sun Microsystems, Inc.  All Rights Reserved.
   6  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   7  *
   8  * This code is free software; you can redistribute it and/or modify it
   9  * under the terms of the GNU General Public License version 2 only, as
  10  * published by the Free Software Foundation.
  11  *
  12  * This code is distributed in the hope that it will be useful, but WITHOUT
  13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15  * version 2 for more details (a copy is included in the LICENSE file that
  16  * accompanied this code).
  17  *
  18  * You should have received a copy of the GNU General Public License version
  19  * 2 along with this work; if not, write to the Free Software Foundation,
  20  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  21  *
  22  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  23  * CA 95054 USA or visit www.sun.com if you need additional information or
  24  * have any questions.
  25  *  
  26  */
  27 
  28 // A constantPoolKlass is the klass of a constantPoolOop
  29 
  30 class constantPoolKlass : public arrayKlass {
  31  public:
  32   // Dispatched klass operations
  33   bool oop_is_constantPool() const  { return true; }
  34   int oop_size(oop obj) const;
  35   int klass_oop_size() const        { return object_size(); }
  36 
  37   // Allocation
  38   DEFINE_ALLOCATE_PERMANENT(constantPoolKlass);
  39   constantPoolOop allocate(int length, TRAPS); 
  40   static klassOop create_klass(TRAPS);
  41 
  42   // Casting from klassOop
  43   static constantPoolKlass* cast(klassOop k) {
  44     assert(k->klass_part()->oop_is_constantPool(), "cast to constantPoolKlass");
  45     return (constantPoolKlass*) k->klass_part(); 
  46   }
  47 
  48   // Sizing
  49   static int header_size()        { return oopDesc::header_size() + sizeof(constantPoolKlass)/HeapWordSize; }
  50   int object_size() const         { return arrayKlass::object_size(header_size()); }
  51 
  52   // Garbage collection
  53   void oop_follow_contents(oop obj);
  54   int oop_adjust_pointers(oop obj);
  55 
  56   // Parallel Scavenge and Parallel Old
  57   PARALLEL_GC_DECLS
  58 
  59   // Iterators
  60   int oop_oop_iterate(oop obj, OopClosure* blk);
  61   int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr);
  62 
  63 #ifndef PRODUCT
  64  public:
  65   // Printing
  66   void oop_print_on(oop obj, outputStream* st);
  67 #endif
  68 
  69  public:
  70   // Verification
  71   const char* internal_name() const;
  72   void oop_verify_on(oop obj, outputStream* st);
  73   // tells whether obj is partially constructed (gc during class loading)
  74   bool oop_partially_loaded(oop obj) const;
  75   void oop_set_partially_loaded(oop obj);
  76 #ifndef PRODUCT
  77   // Compile the world support
  78   static void preload_and_initialize_all_classes(oop constant_pool, TRAPS);
  79 #endif
  80 };
  81