@@ -111,6 +111,10 @@ void OopStorage::AllocationList::unlink(const Block& block) {
111
111
}
112
112
}
113
113
114
+ bool OopStorage::AllocationList::contains (const Block& block) const {
115
+ return (next (block) != NULL ) || (ctail () == &block);
116
+ }
117
+
114
118
OopStorage::ActiveArray::ActiveArray (size_t size) :
115
119
_size(size),
116
120
_block_count(0 ),
@@ -245,8 +249,8 @@ size_t OopStorage::Block::allocation_alignment_shift() {
245
249
return exact_log2 (block_alignment);
246
250
}
247
251
248
- inline bool is_full_bitmask (uintx bitmask) { return ~bitmask == 0 ; }
249
- inline bool is_empty_bitmask (uintx bitmask) { return bitmask == 0 ; }
252
+ static inline bool is_full_bitmask (uintx bitmask) { return ~bitmask == 0 ; }
253
+ static inline bool is_empty_bitmask (uintx bitmask) { return bitmask == 0 ; }
250
254
251
255
bool OopStorage::Block::is_full () const {
252
256
return is_full_bitmask (allocated_bitmask ());
@@ -667,32 +671,31 @@ bool OopStorage::reduce_deferred_updates() {
667
671
// bitmask state here while blocking a release() operation from recording
668
672
// the deferred update needed for its bitmask change.
669
673
OrderAccess::fence ();
670
- // Process popped block .
674
+ // Make list state consistent with bitmask state .
671
675
uintx allocated = block->allocated_bitmask ();
672
-
673
- // Make membership in list consistent with bitmask state.
674
- if ((_allocation_list.ctail () != NULL ) &&
675
- ((_allocation_list.ctail () == block) ||
676
- (_allocation_list.next (*block) != NULL ))) {
677
- // Block is in the _allocation_list.
678
- assert (!is_full_bitmask (allocated), " invariant" );
679
- } else if (!is_full_bitmask (allocated)) {
680
- // Block is not in the _allocation_list, but now should be.
681
- _allocation_list.push_front (*block);
682
- } // Else block is full and not in list, which is correct.
683
-
684
- // Move empty block to end of list, for possible deletion.
685
- if (is_empty_bitmask (allocated)) {
686
- _allocation_list.unlink (*block);
676
+ if (is_full_bitmask (allocated)) {
677
+ // If full then it shouldn't be in the list, and should stay that way.
678
+ assert (!_allocation_list.contains (*block), " invariant" );
679
+ } else if (_allocation_list.contains (*block)) {
680
+ // Block is in list. If empty, move to the end for possible deletion.
681
+ if (is_empty_bitmask (allocated)) {
682
+ _allocation_list.unlink (*block);
683
+ _allocation_list.push_back (*block);
684
+ }
685
+ } else if (is_empty_bitmask (allocated)) {
686
+ // Block is empty and not in list. Add to back for possible deletion.
687
687
_allocation_list.push_back (*block);
688
+ } else {
689
+ // Block is neither full nor empty, and not in list. Add to front.
690
+ _allocation_list.push_front (*block);
688
691
}
689
692
690
693
log_trace (oopstorage, blocks)(" %s: processed deferred update " PTR_FORMAT,
691
694
name (), p2i (block));
692
695
return true ; // Processed one pending update.
693
696
}
694
697
695
- inline void check_release_entry (const oop* entry) {
698
+ static inline void check_release_entry (const oop* entry) {
696
699
assert (entry != NULL , " Releasing NULL" );
697
700
assert (*entry == NULL , " Releasing uncleared entry: " PTR_FORMAT, p2i (entry));
698
701
}
0 commit comments