< prev index next >
src/hotspot/share/gc/parallel/mutableNUMASpace.cpp
Print this page
*** 23,32 ****
--- 23,33 ----
*/
#include "precompiled.hpp"
#include "gc/parallel/mutableNUMASpace.hpp"
#include "gc/shared/collectedHeap.hpp"
+ #include "gc/shared/fill.hpp"
#include "gc/shared/spaceDecorator.hpp"
#include "memory/allocation.inline.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/atomic.hpp"
#include "runtime/thread.inline.hpp"
*** 93,107 ****
if (s->top() < top()) { // For all spaces preceding the one containing top()
if (s->free_in_words() > 0) {
HeapWord* cur_top = s->top();
size_t words_left_to_fill = pointer_delta(s->end(), s->top());;
while (words_left_to_fill > 0) {
! size_t words_to_fill = MIN2(words_left_to_fill, CollectedHeap::filler_array_max_size());
! assert(words_to_fill >= CollectedHeap::min_fill_size(),
"Remaining size (" SIZE_FORMAT ") is too small to fill (based on " SIZE_FORMAT " and " SIZE_FORMAT ")",
! words_to_fill, words_left_to_fill, CollectedHeap::filler_array_max_size());
! CollectedHeap::fill_with_object(cur_top, words_to_fill);
if (!os::numa_has_static_binding()) {
size_t touched_words = words_to_fill;
#ifndef ASSERT
if (!ZapUnusedHeapArea) {
touched_words = MIN2((size_t)align_object_size(typeArrayOopDesc::header_size(T_INT)),
--- 94,108 ----
if (s->top() < top()) { // For all spaces preceding the one containing top()
if (s->free_in_words() > 0) {
HeapWord* cur_top = s->top();
size_t words_left_to_fill = pointer_delta(s->end(), s->top());;
while (words_left_to_fill > 0) {
! size_t words_to_fill = MIN2(words_left_to_fill, Fill::max_size());
! assert(words_to_fill >= Fill::min_size(),
"Remaining size (" SIZE_FORMAT ") is too small to fill (based on " SIZE_FORMAT " and " SIZE_FORMAT ")",
! words_to_fill, words_left_to_fill, Fill::max_size());
! Fill::range(cur_top, words_to_fill);
if (!os::numa_has_static_binding()) {
size_t touched_words = words_to_fill;
#ifndef ASSERT
if (!ZapUnusedHeapArea) {
touched_words = MIN2((size_t)align_object_size(typeArrayOopDesc::header_size(T_INT)),
*** 733,746 ****
if (s->contains(value)) {
// Check if setting the chunk's top to a given value would create a hole less than
// a minimal object; assuming that's not the last chunk in which case we don't care.
if (i < lgrp_spaces()->length() - 1) {
size_t remainder = pointer_delta(s->end(), value);
! const size_t min_fill_size = CollectedHeap::min_fill_size();
if (remainder < min_fill_size && remainder > 0) {
// Add a minimum size filler object; it will cross the chunk boundary.
! CollectedHeap::fill_with_object(value, min_fill_size);
value += min_fill_size;
assert(!s->contains(value), "Should be in the next chunk");
// Restart the loop from the same chunk, since the value has moved
// to the next one.
continue;
--- 734,747 ----
if (s->contains(value)) {
// Check if setting the chunk's top to a given value would create a hole less than
// a minimal object; assuming that's not the last chunk in which case we don't care.
if (i < lgrp_spaces()->length() - 1) {
size_t remainder = pointer_delta(s->end(), value);
! const size_t min_fill_size = Fill::min_size();
if (remainder < min_fill_size && remainder > 0) {
// Add a minimum size filler object; it will cross the chunk boundary.
! Fill::range(value, min_fill_size);
value += min_fill_size;
assert(!s->contains(value), "Should be in the next chunk");
// Restart the loop from the same chunk, since the value has moved
// to the next one.
continue;
*** 807,817 ****
MutableSpace *s = ls->space();
HeapWord *p = s->allocate(size);
if (p != NULL) {
size_t remainder = s->free_in_words();
! if (remainder < CollectedHeap::min_fill_size() && remainder > 0) {
s->set_top(s->top() - size);
p = NULL;
}
}
if (p != NULL) {
--- 808,818 ----
MutableSpace *s = ls->space();
HeapWord *p = s->allocate(size);
if (p != NULL) {
size_t remainder = s->free_in_words();
! if (remainder < Fill::min_size() && remainder > 0) {
s->set_top(s->top() - size);
p = NULL;
}
}
if (p != NULL) {
*** 849,859 ****
LGRPSpace *ls = lgrp_spaces()->at(i);
MutableSpace *s = ls->space();
HeapWord *p = s->cas_allocate(size);
if (p != NULL) {
size_t remainder = pointer_delta(s->end(), p + size);
! if (remainder < CollectedHeap::min_fill_size() && remainder > 0) {
if (s->cas_deallocate(p, size)) {
// We were the last to allocate and created a fragment less than
// a minimal object.
p = NULL;
} else {
--- 850,860 ----
LGRPSpace *ls = lgrp_spaces()->at(i);
MutableSpace *s = ls->space();
HeapWord *p = s->cas_allocate(size);
if (p != NULL) {
size_t remainder = pointer_delta(s->end(), p + size);
! if (remainder < Fill::min_size() && remainder > 0) {
if (s->cas_deallocate(p, size)) {
// We were the last to allocate and created a fragment less than
// a minimal object.
p = NULL;
} else {
< prev index next >