diff src/share/vm/oops/cpCacheKlass.cpp @ 2226:c5a923563727

6912621: iCMS: Error: assert(_markBitMap.isMarked(addr + 1),"Missing Printezis bit?") Summary: Fix block_size_if_printezis_bits() so it does not expect the bits, only uses them when available. Fix block_size_no_stall() so it does not stall when the bits are missing such cases, letting the caller deal with zero size returns. Constant pool cache oops do not need to be unparsable or conc_unsafe after their klass pointer is installed. Some cosmetic clean-ups and some assertion checking for conc-usafety which, in the presence of class file redefinition, has no a-priori time boundedness, so all GCs must be able to safely deal with putatively conc-unsafe objects in a stop-world pause. Reviewed-by: jmasa, johnc
author ysr
date Mon, 07 Feb 2011 22:19:57 -0800
parents f95d63e2154a
children e5383553fd4e
line wrap: on
line diff
--- a/src/share/vm/oops/cpCacheKlass.cpp	Thu Feb 03 20:49:09 2011 -0800
+++ b/src/share/vm/oops/cpCacheKlass.cpp	Mon Feb 07 22:19:57 2011 -0800
@@ -49,43 +49,31 @@
 
 
 constantPoolCacheOop constantPoolCacheKlass::allocate(int length,
-                                                      bool is_conc_safe,
                                                       TRAPS) {
   // allocate memory
   int size = constantPoolCacheOopDesc::object_size(length);
 
   KlassHandle klass (THREAD, as_klassOop());
 
-  // This is the original code.  The code from permanent_obj_allocate()
-  // was in-lined to allow the setting of is_conc_safe before the klass
-  // is installed.
+  // Commented out below is the original code.  The code from
+  // permanent_obj_allocate() was in-lined so that we could
+  // set the _length field, necessary to correctly compute its
+  // size(), before setting its klass word further below.
   // constantPoolCacheOop cache = (constantPoolCacheOop)
   //   CollectedHeap::permanent_obj_allocate(klass, size, CHECK_NULL);
 
   oop obj = CollectedHeap::permanent_obj_allocate_no_klass_install(klass, size, CHECK_NULL);
-  constantPoolCacheOop cache = (constantPoolCacheOop) obj;
-  cache->set_is_conc_safe(is_conc_safe);
-  // The store to is_conc_safe must be visible before the klass
-  // is set.  This should be done safely because _is_conc_safe has
-  // been declared volatile.  If there are any problems, consider adding
-  // OrderAccess::storestore();
-  CollectedHeap::post_allocation_install_obj_klass(klass, obj, size);
   NOT_PRODUCT(Universe::heap()->check_for_bad_heap_word_value((HeapWord*) obj,
                                                               size));
-
-  // The length field affects the size of the object.  The allocation
-  // above allocates the correct size (see calculation of "size") but
-  // the size() method of the constant pool cache oop will not reflect
-  // that size until the correct length is set.
-  cache->set_length(length);
+  constantPoolCacheOop cache = (constantPoolCacheOop) obj;
+  assert(!UseConcMarkSweepGC || obj->klass_or_null() == NULL,
+         "klass should be NULL here when using CMS");
+  cache->set_length(length);  // should become visible before klass is set below.
+  cache->set_constant_pool(NULL);
 
-  // The store of the length must be visible before is_conc_safe is
-  // set to a safe state.
-  // This should be done safely because _is_conc_safe has
-  // been declared volatile.  If there are any problems, consider adding
-  // OrderAccess::storestore();
-  cache->set_is_conc_safe(methodOopDesc::IsSafeConc);
-  cache->set_constant_pool(NULL);
+  OrderAccess::storestore();
+  obj->set_klass(klass());
+  assert(cache->size() == size, "Incorrect cache->size()");
   return cache;
 }
 
@@ -176,11 +164,6 @@
   return size;
 }
 
-bool constantPoolCacheKlass::oop_is_conc_safe(oop obj) const {
-  assert(obj->is_constantPoolCache(), "should be constant pool");
-  return constantPoolCacheOop(obj)->is_conc_safe();
-}
-
 #ifndef SERIALGC
 void constantPoolCacheKlass::oop_push_contents(PSPromotionManager* pm,
                                                oop obj) {