< prev index next >
src/hotspot/share/gc/shared/collectedHeap.cpp
Print this page
rev 47223 : [mq]: heapz8
rev 47224 : [mq]: heap9a
*** 302,337 ****
// - We either really did fill the tlab.
// - We pretended to everyone we did and we want to sample.
// - Both of the above reasons are true at the same time.
if (HeapMonitoring::enabled()) {
if (thread->tlab().should_sample()) {
// If we don't have an object yet, try to allocate it.
if (obj == NULL) {
// The tlab could still have space after this sample.
- thread->tlab().set_back_actual_end();
obj = thread->tlab().allocate(size);
}
// Is the object allocated now?
// If not, this means we have to wait till a new TLAB, let the subsequent
// call to handle_heap_sampling pick the next sample.
if (obj != NULL) {
// Object is allocated, sample it now.
HeapMonitoring::object_alloc_do_sample(thread,
reinterpret_cast<oopDesc*>(obj),
! size);
// Pick a next sample in this case, we allocated right.
! thread->tlab().pick_next_sample();
}
}
}
return obj;
}
HeapWord* CollectedHeap::allocate_from_tlab_slow(Klass* klass, Thread* thread, size_t size) {
HeapWord* obj = handle_heap_sampling(thread, NULL, size);
if (obj != NULL) {
return obj;
}
--- 302,340 ----
// - We either really did fill the tlab.
// - We pretended to everyone we did and we want to sample.
// - Both of the above reasons are true at the same time.
if (HeapMonitoring::enabled()) {
if (thread->tlab().should_sample()) {
+ HeapWord *end = thread->tlab().end();
+ thread->tlab().set_back_actual_end();
+
// If we don't have an object yet, try to allocate it.
if (obj == NULL) {
// The tlab could still have space after this sample.
obj = thread->tlab().allocate(size);
}
// Is the object allocated now?
// If not, this means we have to wait till a new TLAB, let the subsequent
// call to handle_heap_sampling pick the next sample.
if (obj != NULL) {
// Object is allocated, sample it now.
HeapMonitoring::object_alloc_do_sample(thread,
reinterpret_cast<oopDesc*>(obj),
! size * HeapWordSize);
// Pick a next sample in this case, we allocated right.
! thread->tlab().pick_next_sample(thread->tlab().top() - end);
}
}
}
return obj;
}
HeapWord* CollectedHeap::allocate_from_tlab_slow(Klass* klass, Thread* thread, size_t size) {
HeapWord* obj = handle_heap_sampling(thread, NULL, size);
+ bool should_sample = thread->tlab().should_sample();
if (obj != NULL) {
return obj;
}
*** 372,383 ****
size_t hdr_size = oopDesc::header_size();
Copy::fill_to_words(obj + hdr_size, new_tlab_size - hdr_size, badHeapWordVal);
#endif // ASSERT
}
thread->tlab().fill(obj, obj + size, new_tlab_size);
! handle_heap_sampling(thread, obj, size);
return obj;
}
void CollectedHeap::flush_deferred_store_barrier(JavaThread* thread) {
MemRegion deferred = thread->deferred_card_mark();
if (!deferred.is_empty()) {
--- 375,390 ----
size_t hdr_size = oopDesc::header_size();
Copy::fill_to_words(obj + hdr_size, new_tlab_size - hdr_size, badHeapWordVal);
#endif // ASSERT
}
thread->tlab().fill(obj, obj + size, new_tlab_size);
!
! if (should_sample) {
! return handle_heap_sampling(thread, obj, size);
! } else {
return obj;
+ }
}
void CollectedHeap::flush_deferred_store_barrier(JavaThread* thread) {
MemRegion deferred = thread->deferred_card_mark();
if (!deferred.is_empty()) {
< prev index next >