src/share/vm/gc_implementation/g1/heapRegion.cpp
Print this page
rev 4801 : imported patch code-movement
rev 4802 : imported patch optimize-nmethod-scanning
rev 4803 : imported patch thomas-comments
@@ -231,11 +231,17 @@
}
zero_marked_bytes();
_offsets.resize(HeapRegion::GrainWords);
init_top_at_mark_start();
- _strong_code_root_list->clear();
+
+ if (_strong_code_root_list != NULL) {
+ delete _strong_code_root_list;
+ }
+ _strong_code_root_list = new (ResourceObj::C_HEAP, mtGC)
+ GrowableArray<nmethod*>(10, 0, NULL, true);
+
if (clear_space) clear(SpaceDecorator::Mangle);
}
void HeapRegion::par_clear() {
assert(used() == 0, "the region should have been already cleared");
@@ -364,12 +370,10 @@
_rem_set(NULL), _recorded_rs_length(0), _predicted_elapsed_time_ms(0),
_predicted_bytes_to_copy(0),
_strong_code_root_list(NULL)
{
_orig_end = mr.end();
- _strong_code_root_list = new (ResourceObj::C_HEAP, mtGC)
- GrowableArray<nmethod*>(10, 0, NULL, true);
// Note that initialize() will set the start of the unmarked area of the
// region.
hr_clear(false /*par*/, false /*clear_space*/);
set_top(bottom());
set_saved_mark();
@@ -595,11 +599,11 @@
return NULL;
}
// Code roots support
-void HeapRegion::push_strong_code_root(nmethod* nm) {
+void HeapRegion::add_strong_code_root(nmethod* nm) {
assert(nm != NULL, "sanity");
// Search for the code blob from the RHS to avoid
// duplicate entries as much as possible
if (_strong_code_root_list->find_from_end(nm) < 0) {
// Code blob isn't already in the list
@@ -653,11 +657,11 @@
// during the regular evacuation failure handling code.
_num_self_forwarded++;
} else {
// The reference points into a promotion or to-space region
HeapRegion* to = _g1h->heap_region_containing(obj);
- to->push_strong_code_root(_nm);
+ to->add_strong_code_root(_nm);
}
}
}
public:
@@ -692,11 +696,11 @@
// Now push any code roots we need to retain
// FIXME: assert that region got an evacuation failure if non-empty
while (to_be_retained.is_nonempty()) {
nmethod* nm = to_be_retained.pop();
assert(nm != NULL, "sanity");
- push_strong_code_root(nm);
+ add_strong_code_root(nm);
}
}
class VerifyStrongCodeRootOopClosure: public OopClosure {
const HeapRegion* _hr;
@@ -1216,7 +1220,5 @@
// false ==> we'll do the clearing if there's clearing to be done.
ContiguousSpace::initialize(mr, false, SpaceDecorator::Mangle);
_offsets.zero_bottom_entry();
_offsets.initialize_threshold();
}
-
-template class GrowableArray<nmethod*>;