34 template <> 35 void AdaptiveFreeList<FreeChunk>::print_on(outputStream* st, const char* c) const { 36 if (c != NULL) { 37 st->print("%16s", c); 38 } else { 39 st->print(SIZE_FORMAT_W(16), size()); 40 } 41 st->print("\t" 42 SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\t" 43 SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\n", 44 bfr_surp(), surplus(), desired(), prev_sweep(), before_sweep(), 45 count(), coal_births(), coal_deaths(), split_births(), split_deaths()); 46 } 47 48 template <class Chunk> 49 AdaptiveFreeList<Chunk>::AdaptiveFreeList() : FreeList<Chunk>(), _hint(0) { 50 init_statistics(); 51 } 52 53 template <class Chunk> 54 AdaptiveFreeList<Chunk>::AdaptiveFreeList(Chunk* fc) : FreeList<Chunk>(fc), _hint(0) { 55 init_statistics(); 56 #ifndef PRODUCT 57 _allocation_stats.set_returned_bytes(size() * HeapWordSize); 58 #endif 59 } 60 61 template <class Chunk> 62 void AdaptiveFreeList<Chunk>::initialize() { 63 FreeList<Chunk>::initialize(); 64 set_hint(0); 65 init_statistics(true /* split_birth */); 66 } 67 68 template <class Chunk> 69 void AdaptiveFreeList<Chunk>::reset(size_t hint) { 70 FreeList<Chunk>::reset(); 71 set_hint(hint); 72 } 73 74 #ifndef PRODUCT 75 template <class Chunk> 76 void AdaptiveFreeList<Chunk>::assert_proper_lock_protection_work() const { 77 assert(protecting_lock() != NULL, "Don't call this directly"); 78 assert(ParallelGCThreads > 0, "Don't call this directly"); 79 Thread* thr = Thread::current(); 80 if (thr->is_VM_thread() || thr->is_ConcurrentGC_thread()) { 81 // assert that we are holding the freelist lock | 34 template <> 35 void AdaptiveFreeList<FreeChunk>::print_on(outputStream* st, const char* c) const { 36 if (c != NULL) { 37 st->print("%16s", c); 38 } else { 39 st->print(SIZE_FORMAT_W(16), size()); 40 } 41 st->print("\t" 42 SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\t" 43 SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\n", 44 bfr_surp(), surplus(), desired(), prev_sweep(), before_sweep(), 45 count(), coal_births(), coal_deaths(), split_births(), split_deaths()); 46 } 47 48 template <class Chunk> 49 AdaptiveFreeList<Chunk>::AdaptiveFreeList() : FreeList<Chunk>(), _hint(0) { 50 init_statistics(); 51 } 52 53 template <class Chunk> 54 void AdaptiveFreeList<Chunk>::initialize() { 55 FreeList<Chunk>::initialize(); 56 set_hint(0); 57 init_statistics(true /* split_birth */); 58 } 59 60 template <class Chunk> 61 void AdaptiveFreeList<Chunk>::reset(size_t hint) { 62 FreeList<Chunk>::reset(); 63 set_hint(hint); 64 } 65 66 #ifndef PRODUCT 67 template <class Chunk> 68 void AdaptiveFreeList<Chunk>::assert_proper_lock_protection_work() const { 69 assert(protecting_lock() != NULL, "Don't call this directly"); 70 assert(ParallelGCThreads > 0, "Don't call this directly"); 71 Thread* thr = Thread::current(); 72 if (thr->is_VM_thread() || thr->is_ConcurrentGC_thread()) { 73 // assert that we are holding the freelist lock |