23 */ 24 25 #include "precompiled.hpp" 26 #include "gc/shared/genCollectedHeap.hpp" 27 #include "gc/shared/threadLocalAllocBuffer.inline.hpp" 28 #include "memory/resourceArea.hpp" 29 #include "memory/universe.inline.hpp" 30 #include "oops/oop.inline.hpp" 31 #include "runtime/thread.inline.hpp" 32 #include "utilities/copy.hpp" 33 34 // Thread-Local Edens support 35 36 // static member initialization 37 size_t ThreadLocalAllocBuffer::_max_size = 0; 38 unsigned ThreadLocalAllocBuffer::_target_refills = 0; 39 GlobalTLABStats* ThreadLocalAllocBuffer::_global_stats = NULL; 40 41 void ThreadLocalAllocBuffer::clear_before_allocation() { 42 _slow_refill_waste += (unsigned)remaining(); 43 make_parsable(true); // also retire the TLAB 44 } 45 46 void ThreadLocalAllocBuffer::accumulate_statistics_before_gc() { 47 global_stats()->initialize(); 48 49 for (JavaThread *thread = Threads::first(); thread != NULL; thread = thread->next()) { 50 thread->tlab().accumulate_statistics(); 51 thread->tlab().initialize_statistics(); 52 } 53 54 // Publish new stats if some allocation occurred. 55 if (global_stats()->allocation() != 0) { 56 global_stats()->publish(); 57 if (PrintTLAB) { 58 global_stats()->print(); 59 } 60 } 61 } 62 | 23 */ 24 25 #include "precompiled.hpp" 26 #include "gc/shared/genCollectedHeap.hpp" 27 #include "gc/shared/threadLocalAllocBuffer.inline.hpp" 28 #include "memory/resourceArea.hpp" 29 #include "memory/universe.inline.hpp" 30 #include "oops/oop.inline.hpp" 31 #include "runtime/thread.inline.hpp" 32 #include "utilities/copy.hpp" 33 34 // Thread-Local Edens support 35 36 // static member initialization 37 size_t ThreadLocalAllocBuffer::_max_size = 0; 38 unsigned ThreadLocalAllocBuffer::_target_refills = 0; 39 GlobalTLABStats* ThreadLocalAllocBuffer::_global_stats = NULL; 40 41 void ThreadLocalAllocBuffer::clear_before_allocation() { 42 _slow_refill_waste += (unsigned)remaining(); 43 // In debug mode we expect the storage above top to be uninitialized 44 // or filled with a padding object. 45 assert(!ZapUnusedHeapArea || VM_Version::reserve_for_allocation_prefetch() > 0 || top() == NULL || *(intptr_t*)top() != 0, "overzeroing detected"); 46 make_parsable(true); // also retire the TLAB 47 } 48 49 void ThreadLocalAllocBuffer::accumulate_statistics_before_gc() { 50 global_stats()->initialize(); 51 52 for (JavaThread *thread = Threads::first(); thread != NULL; thread = thread->next()) { 53 thread->tlab().accumulate_statistics(); 54 thread->tlab().initialize_statistics(); 55 } 56 57 // Publish new stats if some allocation occurred. 58 if (global_stats()->allocation() != 0) { 59 global_stats()->publish(); 60 if (PrintTLAB) { 61 global_stats()->print(); 62 } 63 } 64 } 65 |