1.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Fri Jun 06 11:47:26 2008 -0700 1.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Mon Jun 09 11:51:19 2008 -0400 1.3 @@ -190,7 +190,8 @@ 1.4 // depends on this property. 1.5 debug_only( 1.6 FreeChunk* junk = NULL; 1.7 - assert(junk->prev_addr() == (void*)(oop(junk)->klass_addr()), 1.8 + assert(UseCompressedOops || 1.9 + junk->prev_addr() == (void*)(oop(junk)->klass_addr()), 1.10 "Offset of FreeChunk::_prev within FreeChunk must match" 1.11 " that of OopDesc::_klass within OopDesc"); 1.12 ) 1.13 @@ -1039,7 +1040,7 @@ 1.14 // mark end of object 1.15 } 1.16 // check that oop looks uninitialized 1.17 - assert(oop(start)->klass() == NULL, "_klass should be NULL"); 1.18 + assert(oop(start)->klass_or_null() == NULL, "_klass should be NULL"); 1.19 } 1.20 1.21 void CMSCollector::promoted(bool par, HeapWord* start, 1.22 @@ -1309,17 +1310,25 @@ 1.23 } 1.24 } 1.25 oop obj = oop(obj_ptr); 1.26 - assert(obj->klass() == NULL, "Object should be uninitialized here."); 1.27 + assert(obj->klass_or_null() == NULL, "Object should be uninitialized here."); 1.28 // Otherwise, copy the object. Here we must be careful to insert the 1.29 // klass pointer last, since this marks the block as an allocated object. 1.30 + // Except with compressed oops it's the mark word. 1.31 HeapWord* old_ptr = (HeapWord*)old; 1.32 if (word_sz > (size_t)oopDesc::header_size()) { 1.33 Copy::aligned_disjoint_words(old_ptr + oopDesc::header_size(), 1.34 obj_ptr + oopDesc::header_size(), 1.35 word_sz - oopDesc::header_size()); 1.36 } 1.37 + 1.38 + if (UseCompressedOops) { 1.39 + // Copy gap missed by (aligned) header size calculation above 1.40 + obj->set_klass_gap(old->klass_gap()); 1.41 + } 1.42 + 1.43 // Restore the mark word copied above. 1.44 obj->set_mark(m); 1.45 + 1.46 // Now we can track the promoted object, if necessary. We take care 1.47 // To delay the transition from uninitialized to full object 1.48 // (i.e., insertion of klass pointer) until after, so that it 1.49 @@ -1327,7 +1336,8 @@ 1.50 if (promoInfo->tracking()) { 1.51 promoInfo->track((PromotedObject*)obj, old->klass()); 1.52 } 1.53 - // Finally, install the klass pointer. 1.54 + 1.55 + // Finally, install the klass pointer (this should be volatile). 1.56 obj->set_klass(old->klass()); 1.57 1.58 assert(old->is_oop(), "Will dereference klass ptr below"); 1.59 @@ -6165,7 +6175,7 @@ 1.60 HeapWord* CMSCollector::next_card_start_after_block(HeapWord* addr) const { 1.61 size_t sz = 0; 1.62 oop p = (oop)addr; 1.63 - if (p->klass() != NULL && p->is_parsable()) { 1.64 + if (p->klass_or_null() != NULL && p->is_parsable()) { 1.65 sz = CompactibleFreeListSpace::adjustObjectSize(p->size()); 1.66 } else { 1.67 sz = block_size_using_printezis_bits(addr); 1.68 @@ -6602,7 +6612,7 @@ 1.69 } 1.70 if (_bitMap->isMarked(addr)) { 1.71 // it's marked; is it potentially uninitialized? 1.72 - if (p->klass() != NULL) { 1.73 + if (p->klass_or_null() != NULL) { 1.74 if (CMSPermGenPrecleaningEnabled && !p->is_parsable()) { 1.75 // Signal precleaning to redirty the card since 1.76 // the klass pointer is already installed. 1.77 @@ -6615,11 +6625,8 @@ 1.78 if (p->is_objArray()) { 1.79 // objArrays are precisely marked; restrict scanning 1.80 // to dirty cards only. 1.81 - size = p->oop_iterate(_scanningClosure, mr); 1.82 - assert(size == CompactibleFreeListSpace::adjustObjectSize(size), 1.83 - "adjustObjectSize should be the identity for array sizes, " 1.84 - "which are necessarily larger than minimum object size of " 1.85 - "two heap words"); 1.86 + size = CompactibleFreeListSpace::adjustObjectSize( 1.87 + p->oop_iterate(_scanningClosure, mr)); 1.88 } else { 1.89 // A non-array may have been imprecisely marked; we need 1.90 // to scan object in its entirety. 1.91 @@ -6653,7 +6660,7 @@ 1.92 } 1.93 } else { 1.94 // Either a not yet marked object or an uninitialized object 1.95 - if (p->klass() == NULL || !p->is_parsable()) { 1.96 + if (p->klass_or_null() == NULL || !p->is_parsable()) { 1.97 // An uninitialized object, skip to the next card, since 1.98 // we may not be able to read its P-bits yet. 1.99 assert(size == 0, "Initial value"); 1.100 @@ -6710,7 +6717,7 @@ 1.101 HeapWord* addr = (HeapWord*)p; 1.102 DEBUG_ONLY(_collector->verify_work_stacks_empty();) 1.103 assert(!_span.contains(addr), "we are scanning the survivor spaces"); 1.104 - assert(p->klass() != NULL, "object should be initializd"); 1.105 + assert(p->klass_or_null() != NULL, "object should be initializd"); 1.106 assert(p->is_parsable(), "must be parsable."); 1.107 // an initialized object; ignore mark word in verification below 1.108 // since we are running concurrent with mutators 1.109 @@ -6868,7 +6875,7 @@ 1.110 assert(_skipBits == 0, "tautology"); 1.111 _skipBits = 2; // skip next two marked bits ("Printezis-marks") 1.112 oop p = oop(addr); 1.113 - if (p->klass() == NULL || !p->is_parsable()) { 1.114 + if (p->klass_or_null() == NULL || !p->is_parsable()) { 1.115 DEBUG_ONLY(if (!_verifying) {) 1.116 // We re-dirty the cards on which this object lies and increase 1.117 // the _threshold so that we'll come back to scan this object 1.118 @@ -6890,7 +6897,7 @@ 1.119 if (_threshold < end_card_addr) { 1.120 _threshold = end_card_addr; 1.121 } 1.122 - if (p->klass() != NULL) { 1.123 + if (p->klass_or_null() != NULL) { 1.124 // Redirty the range of cards... 1.125 _mut->mark_range(redirty_range); 1.126 } // ...else the setting of klass will dirty the card anyway. 1.127 @@ -7048,7 +7055,7 @@ 1.128 assert(_skip_bits == 0, "tautology"); 1.129 _skip_bits = 2; // skip next two marked bits ("Printezis-marks") 1.130 oop p = oop(addr); 1.131 - if (p->klass() == NULL || !p->is_parsable()) { 1.132 + if (p->klass_or_null() == NULL || !p->is_parsable()) { 1.133 // in the case of Clean-on-Enter optimization, redirty card 1.134 // and avoid clearing card by increasing the threshold. 1.135 return; 1.136 @@ -8023,7 +8030,7 @@ 1.137 "alignment problem"); 1.138 1.139 #ifdef DEBUG 1.140 - if (oop(addr)->klass() != NULL && 1.141 + if (oop(addr)->klass_or_null() != NULL && 1.142 ( !_collector->should_unload_classes() 1.143 || oop(addr)->is_parsable())) { 1.144 // Ignore mark word because we are running concurrent with mutators 1.145 @@ -8036,7 +8043,7 @@ 1.146 1.147 } else { 1.148 // This should be an initialized object that's alive. 1.149 - assert(oop(addr)->klass() != NULL && 1.150 + assert(oop(addr)->klass_or_null() != NULL && 1.151 (!_collector->should_unload_classes() 1.152 || oop(addr)->is_parsable()), 1.153 "Should be an initialized object");