[rvm-research] [GC]About MarkCompact and ComplexPhase
ChenHao <[email protected]>
| Newsgroups | gmane.comp.java.jikes.rvm.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello All,
After reading MarkCompact GCPlan, I have several questions:
1.MarkCompactCollector.ToCursor
void copy(ObjectReference from, ObjectReference to) {
cursor = VM.objectModel.copyTo(from, to, cursor);
MarkCompactSpace.setForwardingPointer(to, ObjectReference.nullReference());
}
the "cursor" is:
@param region The start of the region that was reserved for this object
@param region The start (or an address less than) the region that was reserved for this object.
but "cursor" may change during a collection, not always the start of the region.
2.MarkCompactCollector
public void calculateForwardingPointers() {
/* Loop through the objects in the current 'from' region */
while (fromCursor.hasMoreObjects()) {
......
if (MarkCompactSpace.toBeCompacted(current)) {
.......
toCursor.incTo(Allocator.alignAllocationNoFill(toCursor.get(), align, offset));//【1】
.......
if (!toCursor.sameRegion(fromCursor) && !toCursor.isAvailable(size)) {
toCursor.advanceToNextRegion();
toCursor.incTo(Allocator.alignAllocationNoFill(toCursor.get(), align, offset));//【2】
}
ObjectReference target = VM.objectModel.getReferenceWhenCopiedTo(current, toCursor.get());
if (toCursor.sameRegion(fromCursor) && target.toAddress().GE(current.toAddress())) {
// Don't move the object.//【3】
MarkCompactSpace.setForwardingPointer(current, current);
toCursor.incTo(VM.objectModel.getObjectEndAddress(current));
} else {
MarkCompactSpace.setForwardingPointer(current, target);
toCursor.inc(size);
}
}
}
}
Why do "toCursor.incTo(Allocator.alignAllocationNoFill(toCursor.get(), align, offset));" twice? See【1】【2】
What does "if (toCursor.sameRegion(fromCursor) && target.toAddress().GE(current.toAddress())) "mean? See【3】
In which condition the collector will not move the object?
3.MarkCompactSpace
Some comments are confusing,just Crtl C+Crtl V?
traceObject()/traceMarkObject()/traceForwardObject()
testAndMark()/testAndClearMark()/clearMark()
traceObject() is just a stub(Maybe I can reuse to perform Copying)
In traceMarkObject() method, why return "object" not "getForwardingPointer(object)"? See 【4】
public ObjectReference traceMarkObject(TraceLocal trace, ObjectReference object) {
if (testAndMark(object)) {
trace.processNode(object);
} else if (!getForwardingPointer(object).isNull()) {
return getForwardingPointer(object);
}
}
return object;【4】
}
4.MC & ComplexPhase
In org.mmtk.plan.markcompact.MC.java, ComplexPhase"mcColletion" is created and it replaces "colletion" in Simple.
When a GC is triggered, perform Phase.beginNewPhaseStack(Phase.scheduleComplex(global().collection))
=> pushScheduledPhase() & processPhaseStack()
There is no switch casestatementfor "SCHEDULE_COMPLEX" in processPhaseStack(), how to process ComplexPhase in Phase?
Simple defines lots of Phases, which is necessary for a Plan? And when should I define my own phase?
I'm still not so clear about how to write collctionPhase().
Thanks for any help.
Best Wishes. Chen Hao
------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Jikesrvm-researchers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers