97 } else {
98 assert(_number_of_refills == 0 && _fast_refill_waste == 0 &&
99 _slow_refill_waste == 0 && _gc_waste == 0,
100 "tlab stats == 0");
101 }
102 global_stats()->update_slow_allocations(_slow_allocations);
103 }
104
105 // Fills the current tlab with a dummy filler array to create
106 // an illusion of a contiguous Eden and optionally retires the tlab.
107 // Waste accounting should be done in caller as appropriate; see,
108 // for example, clear_before_allocation().
109 void ThreadLocalAllocBuffer::make_parsable(bool retire, bool zap) {
110 if (end() != NULL) {
111 invariants();
112
113 if (retire) {
114 myThread()->incr_allocated_bytes(used_bytes());
115 }
116
117 HeapWord* obj = Universe::heap()->tlab_post_allocation_setup(top());
118 CollectedHeap::fill_with_object(obj, hard_end(), retire && zap);
119
120 if (retire || ZeroTLAB) { // "Reset" the TLAB
121 set_start(NULL);
122 set_top(NULL);
123 set_pf_top(NULL);
124 set_end(NULL);
125 }
126 }
127 assert(!(retire || ZeroTLAB) ||
128 (start() == NULL && end() == NULL && top() == NULL),
129 "TLAB must be reset");
130 }
131
132 void ThreadLocalAllocBuffer::resize_all_tlabs() {
133 if (ResizeTLAB) {
134 for (JavaThreadIteratorWithHandle jtiwh; JavaThread *thread = jtiwh.next(); ) {
135 thread->tlab().resize();
136 }
137 }
138 }
|
97 } else {
98 assert(_number_of_refills == 0 && _fast_refill_waste == 0 &&
99 _slow_refill_waste == 0 && _gc_waste == 0,
100 "tlab stats == 0");
101 }
102 global_stats()->update_slow_allocations(_slow_allocations);
103 }
104
105 // Fills the current tlab with a dummy filler array to create
106 // an illusion of a contiguous Eden and optionally retires the tlab.
107 // Waste accounting should be done in caller as appropriate; see,
108 // for example, clear_before_allocation().
109 void ThreadLocalAllocBuffer::make_parsable(bool retire, bool zap) {
110 if (end() != NULL) {
111 invariants();
112
113 if (retire) {
114 myThread()->incr_allocated_bytes(used_bytes());
115 }
116
117 CollectedHeap::fill_with_object(top(), hard_end(), retire && zap);
118
119 if (retire || ZeroTLAB) { // "Reset" the TLAB
120 set_start(NULL);
121 set_top(NULL);
122 set_pf_top(NULL);
123 set_end(NULL);
124 }
125 }
126 assert(!(retire || ZeroTLAB) ||
127 (start() == NULL && end() == NULL && top() == NULL),
128 "TLAB must be reset");
129 }
130
131 void ThreadLocalAllocBuffer::resize_all_tlabs() {
132 if (ResizeTLAB) {
133 for (JavaThreadIteratorWithHandle jtiwh; JavaThread *thread = jtiwh.next(); ) {
134 thread->tlab().resize();
135 }
136 }
137 }
|