Merge
This commit is contained in:
commit
865adecf33
@ -103,14 +103,14 @@ public class G1HeapRegionTable extends VMObject {
|
||||
@Override
|
||||
public void remove() { /* not supported */ }
|
||||
|
||||
HeapRegionIterator(Address addr) {
|
||||
HeapRegionIterator(long committedLength) {
|
||||
index = 0;
|
||||
length = length();
|
||||
length = committedLength;
|
||||
}
|
||||
}
|
||||
|
||||
public Iterator<HeapRegion> heapRegionIterator() {
|
||||
return new HeapRegionIterator(addr);
|
||||
public Iterator<HeapRegion> heapRegionIterator(long committedLength) {
|
||||
return new HeapRegionIterator(committedLength);
|
||||
}
|
||||
|
||||
public G1HeapRegionTable(Address addr) {
|
||||
|
@ -42,6 +42,8 @@ import sun.jvm.hotspot.types.TypeDataBase;
|
||||
public class HeapRegionSeq extends VMObject {
|
||||
// G1HeapRegionTable _regions
|
||||
static private long regionsFieldOffset;
|
||||
// uint _committed_length
|
||||
static private CIntegerField committedLengthField;
|
||||
|
||||
static {
|
||||
VM.registerVMInitializedObserver(new Observer() {
|
||||
@ -55,6 +57,7 @@ public class HeapRegionSeq extends VMObject {
|
||||
Type type = db.lookupType("HeapRegionSeq");
|
||||
|
||||
regionsFieldOffset = type.getField("_regions").getOffset();
|
||||
committedLengthField = type.getCIntegerField("_committed_length");
|
||||
}
|
||||
|
||||
private G1HeapRegionTable regions() {
|
||||
@ -67,8 +70,12 @@ public class HeapRegionSeq extends VMObject {
|
||||
return regions().length();
|
||||
}
|
||||
|
||||
public long committedLength() {
|
||||
return committedLengthField.getValue(addr);
|
||||
}
|
||||
|
||||
public Iterator<HeapRegion> heapRegionIterator() {
|
||||
return regions().heapRegionIterator();
|
||||
return regions().heapRegionIterator(committedLength());
|
||||
}
|
||||
|
||||
public HeapRegionSeq(Address addr) {
|
||||
|
@ -66,29 +66,10 @@ void MarkSweep::AdjustKlassClosure::do_klass(Klass* klass) {
|
||||
klass->oops_do(&MarkSweep::adjust_pointer_closure);
|
||||
}
|
||||
|
||||
void MarkSweep::follow_klass(Klass* klass) {
|
||||
ClassLoaderData* cld = klass->class_loader_data();
|
||||
// The actual processing of the klass is done when we
|
||||
// traverse the list of Klasses in the class loader data.
|
||||
MarkSweep::follow_class_loader(cld);
|
||||
}
|
||||
|
||||
void MarkSweep::adjust_klass(Klass* klass) {
|
||||
ClassLoaderData* cld = klass->class_loader_data();
|
||||
// The actual processing of the klass is done when we
|
||||
// traverse the list of Klasses in the class loader data.
|
||||
MarkSweep::adjust_class_loader(cld);
|
||||
}
|
||||
|
||||
void MarkSweep::follow_class_loader(ClassLoaderData* cld) {
|
||||
cld->oops_do(&MarkSweep::mark_and_push_closure, &MarkSweep::follow_klass_closure, true);
|
||||
}
|
||||
|
||||
void MarkSweep::adjust_class_loader(ClassLoaderData* cld) {
|
||||
cld->oops_do(&MarkSweep::adjust_pointer_closure, &MarkSweep::adjust_klass_closure, true);
|
||||
}
|
||||
|
||||
|
||||
void MarkSweep::follow_stack() {
|
||||
do {
|
||||
while (!_marking_stack.is_empty()) {
|
||||
|
@ -172,10 +172,8 @@ class MarkSweep : AllStatic {
|
||||
static void follow_stack(); // Empty marking stack.
|
||||
|
||||
static void follow_klass(Klass* klass);
|
||||
static void adjust_klass(Klass* klass);
|
||||
|
||||
static void follow_class_loader(ClassLoaderData* cld);
|
||||
static void adjust_class_loader(ClassLoaderData* cld);
|
||||
|
||||
static void preserve_mark(oop p, markOop mark);
|
||||
// Save the mark word so it can be restored later
|
||||
|
@ -44,6 +44,11 @@ inline void MarkSweep::mark_object(oop obj) {
|
||||
}
|
||||
}
|
||||
|
||||
inline void MarkSweep::follow_klass(Klass* klass) {
|
||||
oop op = klass->klass_holder();
|
||||
MarkSweep::mark_and_push(&op);
|
||||
}
|
||||
|
||||
template <class T> inline void MarkSweep::follow_root(T* p) {
|
||||
assert(!Universe::heap()->is_in_reserved(p),
|
||||
"roots shouldn't be things within the heap");
|
||||
|
@ -2180,7 +2180,6 @@ int InstanceKlass::oop_adjust_pointers(oop obj) {
|
||||
obj, \
|
||||
MarkSweep::adjust_pointer(p), \
|
||||
assert_is_in)
|
||||
MarkSweep::adjust_klass(obj->klass());
|
||||
return size;
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,13 @@ void InstanceMirrorKlass::oop_follow_contents(oop obj) {
|
||||
// Follow the klass field in the mirror.
|
||||
Klass* klass = java_lang_Class::as_Klass(obj);
|
||||
if (klass != NULL) {
|
||||
MarkSweep::follow_klass(klass);
|
||||
// For anonymous classes we need to handle the class loader data,
|
||||
// otherwise it won't be claimed and can be unloaded.
|
||||
if (klass->oop_is_instance() && InstanceKlass::cast(klass)->is_anonymous()) {
|
||||
MarkSweep::follow_class_loader(klass->class_loader_data());
|
||||
} else {
|
||||
MarkSweep::follow_klass(klass);
|
||||
}
|
||||
} else {
|
||||
// If klass is NULL then this a mirror for a primitive type.
|
||||
// We don't have to follow them, since they are handled as strong
|
||||
@ -196,17 +202,6 @@ int InstanceMirrorKlass::oop_adjust_pointers(oop obj) {
|
||||
int size = oop_size(obj);
|
||||
InstanceKlass::oop_adjust_pointers(obj);
|
||||
|
||||
// Follow the klass field in the mirror.
|
||||
Klass* klass = java_lang_Class::as_Klass(obj);
|
||||
if (klass != NULL) {
|
||||
MarkSweep::adjust_klass(klass);
|
||||
} else {
|
||||
// If klass is NULL then this a mirror for a primitive type.
|
||||
// We don't have to follow them, since they are handled as strong
|
||||
// roots in Universe::oops_do.
|
||||
assert(java_lang_Class::is_primitive(obj), "Sanity check");
|
||||
}
|
||||
|
||||
InstanceMirrorKlass_OOP_ITERATE( \
|
||||
start_of_static_fields(obj), java_lang_Class::static_oop_field_count(obj), \
|
||||
MarkSweep::adjust_pointer(p), \
|
||||
|
@ -569,7 +569,6 @@ int ObjArrayKlass::oop_adjust_pointers(oop obj) {
|
||||
// Get size before changing pointers.
|
||||
// Don't call size() or oop_size() since that is a virtual call.
|
||||
int size = a->object_size();
|
||||
MarkSweep::adjust_klass(a->klass());
|
||||
ObjArrayKlass_OOP_ITERATE(a, p, MarkSweep::adjust_pointer(p))
|
||||
return size;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user