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