提交 86b977d9 编写于 作者: J jcoomes

Merge

......@@ -2547,7 +2547,14 @@ void os::realign_memory(char *addr, size_t bytes, size_t alignment_hint) {
}
void os::free_memory(char *addr, size_t bytes, size_t alignment_hint) {
commit_memory(addr, bytes, alignment_hint, false);
// This method works by doing an mmap over an existing mmaping and effectively discarding
// the existing pages. However it won't work for SHM-based large pages that cannot be
// uncommitted at all. We don't do anything in this case to avoid creating a segment with
// small pages on top of the SHM segment. This method always works for small pages, so we
// allow that in any case.
if (alignment_hint <= (size_t)os::vm_page_size() || !UseSHM) {
commit_memory(addr, bytes, alignment_hint, false);
}
}
void os::numa_make_global(char *addr, size_t bytes) {
......
/*
* Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -38,33 +38,36 @@ SurvRateGroup::SurvRateGroup(G1CollectorPolicy* g1p,
_summary_surv_rates(NULL),
_surv_rate(NULL),
_accum_surv_rate_pred(NULL),
_surv_rate_pred(NULL)
{
_surv_rate_pred(NULL),
_stats_arrays_length(0) {
reset();
if (summary_surv_rates_len > 0) {
size_t length = summary_surv_rates_len;
_summary_surv_rates = NEW_C_HEAP_ARRAY(NumberSeq*, length);
if (_summary_surv_rates == NULL) {
vm_exit_out_of_memory(sizeof(NumberSeq*) * length,
"Not enough space for surv rate summary");
}
for (size_t i = 0; i < length; ++i)
_summary_surv_rates = NEW_C_HEAP_ARRAY(NumberSeq*, length);
for (size_t i = 0; i < length; ++i) {
_summary_surv_rates[i] = new NumberSeq();
}
}
start_adding_regions();
}
void SurvRateGroup::reset()
{
void SurvRateGroup::reset() {
_all_regions_allocated = 0;
_setup_seq_num = 0;
_stats_arrays_length = 0;
_accum_surv_rate = 0.0;
_last_pred = 0.0;
// the following will set up the arrays with length 1
_region_num = 1;
// The call to stop_adding_regions() will use "new" to refill
// the _surv_rate_pred array, so we need to make sure to call
// "delete".
for (size_t i = 0; i < _stats_arrays_length; ++i) {
delete _surv_rate_pred[i];
}
_stats_arrays_length = 0;
stop_adding_regions();
guarantee( _stats_arrays_length == 1, "invariant" );
guarantee( _surv_rate_pred[0] != NULL, "invariant" );
......@@ -73,72 +76,47 @@ void SurvRateGroup::reset()
_region_num = 0;
}
void
SurvRateGroup::start_adding_regions() {
_setup_seq_num = _stats_arrays_length;
_region_num = 0;
_accum_surv_rate = 0.0;
#if 0
gclog_or_tty->print_cr("[%s] start adding regions, seq num %d, length %d",
_name, _setup_seq_num, _region_num);
#endif // 0
}
void
SurvRateGroup::stop_adding_regions() {
#if 0
gclog_or_tty->print_cr("[%s] stop adding regions, length %d", _name, _region_num);
#endif // 0
if (_region_num > _stats_arrays_length) {
double* old_surv_rate = _surv_rate;
double* old_accum_surv_rate_pred = _accum_surv_rate_pred;
TruncatedSeq** old_surv_rate_pred = _surv_rate_pred;
_surv_rate = NEW_C_HEAP_ARRAY(double, _region_num);
if (_surv_rate == NULL) {
vm_exit_out_of_memory(sizeof(double) * _region_num,
"Not enough space for surv rate array.");
}
_accum_surv_rate_pred = NEW_C_HEAP_ARRAY(double, _region_num);
if (_accum_surv_rate_pred == NULL) {
vm_exit_out_of_memory(sizeof(double) * _region_num,
"Not enough space for accum surv rate pred array.");
}
_surv_rate_pred = NEW_C_HEAP_ARRAY(TruncatedSeq*, _region_num);
if (_surv_rate == NULL) {
vm_exit_out_of_memory(sizeof(TruncatedSeq*) * _region_num,
"Not enough space for surv rate pred array.");
}
for (size_t i = 0; i < _stats_arrays_length; ++i)
for (size_t i = 0; i < _stats_arrays_length; ++i) {
_surv_rate_pred[i] = old_surv_rate_pred[i];
#if 0
gclog_or_tty->print_cr("[%s] stop adding regions, new seqs %d to %d",
_name, _array_length, _region_num - 1);
#endif // 0
}
for (size_t i = _stats_arrays_length; i < _region_num; ++i) {
_surv_rate_pred[i] = new TruncatedSeq(10);
// _surv_rate_pred[i]->add(last_pred);
}
_stats_arrays_length = _region_num;
if (old_surv_rate != NULL)
if (old_surv_rate != NULL) {
FREE_C_HEAP_ARRAY(double, old_surv_rate);
if (old_accum_surv_rate_pred != NULL)
}
if (old_accum_surv_rate_pred != NULL) {
FREE_C_HEAP_ARRAY(double, old_accum_surv_rate_pred);
if (old_surv_rate_pred != NULL)
FREE_C_HEAP_ARRAY(NumberSeq*, old_surv_rate_pred);
}
if (old_surv_rate_pred != NULL) {
FREE_C_HEAP_ARRAY(TruncatedSeq*, old_surv_rate_pred);
}
}
for (size_t i = 0; i < _stats_arrays_length; ++i)
for (size_t i = 0; i < _stats_arrays_length; ++i) {
_surv_rate[i] = 0.0;
}
}
double
......@@ -187,12 +165,6 @@ void
SurvRateGroup::all_surviving_words_recorded(bool propagate) {
if (propagate && _region_num > 0) { // conservative
double surv_rate = _surv_rate_pred[_region_num-1]->last();
#if 0
gclog_or_tty->print_cr("propagating %1.2lf from %d to %d",
surv_rate, _curr_length, _array_length - 1);
#endif // 0
for (size_t i = _region_num; i < _stats_arrays_length; ++i) {
guarantee( _surv_rate[i] <= 0.00001,
"the slot should not have been updated" );
......
/*
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -72,6 +72,9 @@ class CardTableModRefBS: public ModRefBarrierSet {
CT_MR_BS_last_reserved = 16
};
// a word's worth (row) of clean card values
static const intptr_t clean_card_row = (intptr_t)(-1);
// dirty and precleaned are equivalent wrt younger_refs_iter.
static bool card_is_dirty_wrt_gen_iter(jbyte cv) {
return cv == dirty_card || cv == precleaned_card;
......
/*
* Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -173,6 +173,10 @@ ClearNoncleanCardWrapper::ClearNoncleanCardWrapper(
SharedHeap::heap()->workers()->active_workers()), "Mismatch");
}
bool ClearNoncleanCardWrapper::is_word_aligned(jbyte* entry) {
return (((intptr_t)entry) & (BytesPerWord-1)) == 0;
}
void ClearNoncleanCardWrapper::do_MemRegion(MemRegion mr) {
assert(mr.word_size() > 0, "Error");
assert(_ct->is_aligned(mr.start()), "mr.start() should be card aligned");
......@@ -194,6 +198,17 @@ void ClearNoncleanCardWrapper::do_MemRegion(MemRegion mr) {
const MemRegion mrd(start_of_non_clean, end_of_non_clean);
_dirty_card_closure->do_MemRegion(mrd);
}
// fast forward through potential continuous whole-word range of clean cards beginning at a word-boundary
if (is_word_aligned(cur_entry)) {
jbyte* cur_row = cur_entry - BytesPerWord;
while (cur_row >= limit && *((intptr_t*)cur_row) == CardTableRS::clean_card_row()) {
cur_row -= BytesPerWord;
}
cur_entry = cur_row + BytesPerWord;
cur_hw = _ct->addr_for(cur_entry);
}
// Reset the dirty window, while continuing to look
// for the next dirty card that will start a
// new dirty window.
......
/*
* Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -45,6 +45,10 @@ class CardTableRS: public GenRemSet {
return CardTableModRefBS::clean_card;
}
static intptr_t clean_card_row() {
return CardTableModRefBS::clean_card_row;
}
static bool
card_is_dirty_wrt_gen_iter(jbyte cv) {
return CardTableModRefBS::card_is_dirty_wrt_gen_iter(cv);
......@@ -176,6 +180,8 @@ private:
// Work methods called by the clear_card()
inline bool clear_card_serial(jbyte* entry);
inline bool clear_card_parallel(jbyte* entry);
// check alignment of pointer
bool is_word_aligned(jbyte* entry);
public:
ClearNoncleanCardWrapper(DirtyCardToOopClosure* dirty_card_closure, CardTableRS* ct);
......
/*
* Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -156,6 +156,10 @@ TruncatedSeq::TruncatedSeq(int length, double alpha):
_sequence[i] = 0.0;
}
TruncatedSeq::~TruncatedSeq() {
FREE_C_HEAP_ARRAY(double, _sequence);
}
void TruncatedSeq::add(double val) {
AbsSeq::add(val);
......
/*
* Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -118,6 +118,7 @@ public:
// accepts a value for L
TruncatedSeq(int length = DefaultSeqLength,
double alpha = DEFAULT_ALPHA_VALUE);
~TruncatedSeq();
virtual void add(double val);
virtual double maximum() const;
virtual double last() const; // the last value added to the sequence
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册