本文整理汇总了C++中Generation::prev_used_region方法的典型用法代码示例。如果您正苦于以下问题:C++ Generation::prev_used_region方法的具体用法?C++ Generation::prev_used_region怎么用?C++ Generation::prev_used_region使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Generation
的用法示例。
在下文中一共展示了Generation::prev_used_region方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: invalidate_or_clear
void CardTableRS::invalidate_or_clear(Generation* gen, bool younger,
bool perm) {
GenCollectedHeap* gch = GenCollectedHeap::heap();
// For each generation gen (and younger and/or perm)
// invalidate the cards for the currently occupied part
// of that generation and clear the cards for the
// unoccupied part of the generation (if any, making use
// of that generation's prev_used_region to determine that
// region). No need to do anything for the youngest
// generation. Also see note#20040107.ysr above.
Generation* g = gen;
for(Generation* prev_gen = gch->prev_gen(g); prev_gen != NULL;
g = prev_gen, prev_gen = gch->prev_gen(g)) {
MemRegion used_mr = g->used_region();
MemRegion to_be_cleared_mr = g->prev_used_region().minus(used_mr);
if (!to_be_cleared_mr.is_empty()) {
clear(to_be_cleared_mr);
}
invalidate(used_mr);
if (!younger) break;
}
// Clear perm gen cards if asked to do so.
if (perm) {
g = gch->perm_gen();
MemRegion used_mr = g->used_region();
MemRegion to_be_cleared_mr = g->prev_used_region().minus(used_mr);
if (!to_be_cleared_mr.is_empty()) {
clear(to_be_cleared_mr);
}
invalidate(used_mr);
}
}
示例2: clear_into_younger
void CardTableRS::clear_into_younger(Generation* gen, bool clear_perm) {
GenCollectedHeap* gch = GenCollectedHeap::heap();
// Generations younger than gen have been evacuated. We can clear
// card table entries for gen (we know that it has no pointers
// to younger gens) and for those below. The card tables for
// the youngest gen need never be cleared, and those for perm gen
// will be cleared based on the parameter clear_perm.
// There's a bit of subtlety in the clear() and invalidate()
// methods that we exploit here and in invalidate_or_clear()
// below to avoid missing cards at the fringes. If clear() or
// invalidate() are changed in the future, this code should
// be revisited. 20040107.ysr
Generation* g = gen;
for(Generation* prev_gen = gch->prev_gen(g);
prev_gen != NULL;
g = prev_gen, prev_gen = gch->prev_gen(g)) {
MemRegion to_be_cleared_mr = g->prev_used_region();
clear(to_be_cleared_mr);
}
// Clear perm gen cards if asked to do so.
if (clear_perm) {
MemRegion to_be_cleared_mr = gch->perm_gen()->prev_used_region();
clear(to_be_cleared_mr);
}
}