hotspot/src/share/vm/oops/constantPoolKlass.cpp
changeset 1894 5c343868d071
parent 1550 be2fc37a817f
child 2105 347008ce7984
equal deleted inserted replaced
1893:c82e388e17c5 1894:5c343868d071
    23  */
    23  */
    24 
    24 
    25 # include "incls/_precompiled.incl"
    25 # include "incls/_precompiled.incl"
    26 # include "incls/_constantPoolKlass.cpp.incl"
    26 # include "incls/_constantPoolKlass.cpp.incl"
    27 
    27 
    28 constantPoolOop constantPoolKlass::allocate(int length, TRAPS) {
    28 constantPoolOop constantPoolKlass::allocate(int length, bool is_conc_safe, TRAPS) {
    29   int size = constantPoolOopDesc::object_size(length);
    29   int size = constantPoolOopDesc::object_size(length);
    30   KlassHandle klass (THREAD, as_klassOop());
    30   KlassHandle klass (THREAD, as_klassOop());
    31   constantPoolOop c =
    31   constantPoolOop c =
    32     (constantPoolOop)CollectedHeap::permanent_obj_allocate(klass, size, CHECK_NULL);
    32     (constantPoolOop)CollectedHeap::permanent_obj_allocate(klass, size, CHECK_NULL);
    33 
    33 
    36   c->set_cache(NULL);
    36   c->set_cache(NULL);
    37   c->set_pool_holder(NULL);
    37   c->set_pool_holder(NULL);
    38   c->set_flags(0);
    38   c->set_flags(0);
    39   // only set to non-zero if constant pool is merged by RedefineClasses
    39   // only set to non-zero if constant pool is merged by RedefineClasses
    40   c->set_orig_length(0);
    40   c->set_orig_length(0);
       
    41   // if constant pool may change during RedefineClasses, it is created
       
    42   // unsafe for GC concurrent processing.
       
    43   c->set_is_conc_safe(is_conc_safe);
    41   // all fields are initialized; needed for GC
    44   // all fields are initialized; needed for GC
    42 
    45 
    43   // initialize tag array
    46   // initialize tag array
    44   // Note: cannot introduce constant pool handle before since it is not
    47   // Note: cannot introduce constant pool handle before since it is not
    45   //       completely initialized (no class) -> would cause assertion failure
    48   //       completely initialized (no class) -> would cause assertion failure
   203   addr = cp->cache_addr();
   206   addr = cp->cache_addr();
   204   blk->do_oop(addr);
   207   blk->do_oop(addr);
   205   addr = cp->pool_holder_addr();
   208   addr = cp->pool_holder_addr();
   206   blk->do_oop(addr);
   209   blk->do_oop(addr);
   207   return size;
   210   return size;
       
   211 }
       
   212 
       
   213 bool constantPoolKlass::oop_is_conc_safe(oop obj) const {
       
   214   assert(obj->is_constantPool(), "must be constantPool");
       
   215   return constantPoolOop(obj)->is_conc_safe();
   208 }
   216 }
   209 
   217 
   210 #ifndef SERIALGC
   218 #ifndef SERIALGC
   211 int constantPoolKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) {
   219 int constantPoolKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) {
   212   assert (obj->is_constantPool(), "obj must be constant pool");
   220   assert (obj->is_constantPool(), "obj must be constant pool");