hotspot/src/share/vm/oops/constantPoolOop.hpp
changeset 360 21d113ecbf6a
parent 1 489c9b5090e2
child 670 ddf3e9583f2f
equal deleted inserted replaced
357:f4edb0d9f109 360:21d113ecbf6a
    32 // the entry in the constant pool is a klass or String object and
    32 // the entry in the constant pool is a klass or String object and
    33 // not a symbolOop.
    33 // not a symbolOop.
    34 
    34 
    35 class SymbolHashMap;
    35 class SymbolHashMap;
    36 
    36 
    37 class constantPoolOopDesc : public arrayOopDesc {
    37 class constantPoolOopDesc : public oopDesc {
    38   friend class VMStructs;
    38   friend class VMStructs;
    39   friend class BytecodeInterpreter;  // Directly extracts an oop in the pool for fast instanceof/checkcast
    39   friend class BytecodeInterpreter;  // Directly extracts an oop in the pool for fast instanceof/checkcast
    40  private:
    40  private:
    41   typeArrayOop         _tags; // the tag array describing the constant pool's contents
    41   typeArrayOop         _tags; // the tag array describing the constant pool's contents
    42   constantPoolCacheOop _cache;         // the cache holding interpreter runtime information
    42   constantPoolCacheOop _cache;         // the cache holding interpreter runtime information
    43   klassOop             _pool_holder;   // the corresponding class
    43   klassOop             _pool_holder;   // the corresponding class
       
    44   int                  _length; // number of elements in the array
    44   // only set to non-zero if constant pool is merged by RedefineClasses
    45   // only set to non-zero if constant pool is merged by RedefineClasses
    45   int                  _orig_length;
    46   int                  _orig_length;
    46 
    47 
    47   void set_tags(typeArrayOop tags)             { oop_store_without_check((oop*)&_tags, tags); }
    48   void set_tags(typeArrayOop tags)             { oop_store_without_check((oop*)&_tags, tags); }
    48   void tag_at_put(int which, jbyte t)          { tags()->byte_at_put(which, t); }
    49   void tag_at_put(int which, jbyte t)          { tags()->byte_at_put(which, t); }
   328 
   329 
   329   // Klass name matches name at offset
   330   // Klass name matches name at offset
   330   bool klass_name_at_matches(instanceKlassHandle k, int which);
   331   bool klass_name_at_matches(instanceKlassHandle k, int which);
   331 
   332 
   332   // Sizing
   333   // Sizing
       
   334   int length() const                   { return _length; }
       
   335   void set_length(int length)          { _length = length; }
       
   336 
       
   337   // Tells whether index is within bounds.
       
   338   bool is_within_bounds(int index) const {
       
   339     return 0 <= index && index < length();
       
   340   }
       
   341 
   333   static int header_size()             { return sizeof(constantPoolOopDesc)/HeapWordSize; }
   342   static int header_size()             { return sizeof(constantPoolOopDesc)/HeapWordSize; }
   334   static int object_size(int length)   { return align_object_size(header_size() + length); }
   343   static int object_size(int length)   { return align_object_size(header_size() + length); }
   335   int object_size()                    { return object_size(length()); }
   344   int object_size()                    { return object_size(length()); }
   336 
   345 
   337   friend class constantPoolKlass;
   346   friend class constantPoolKlass;