From: <jik...@li...> - 2011-07-12 22:22:15
|
details: http://jikesrvm.hg.sourceforge.net/hgweb/jikesrvm/soc2011/rev/06f04944e43f changeset: 10424:06f04944e43f user: gary46 date: Tue Jul 12 23:27:27 2011 +0100 description: Updated the storeObjectReference to be concurrent and modified Barriers for compatibility (the call to storeObjectReference in objectArrayStoreNoGCBarrier seemed incorrect diffstat: MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Barriers.java | 3 +- MMTk/src/org/mmtk/plan/generational_steps/GenSteps.java | 83 ++------ MMTk/src/org/mmtk/plan/generational_steps/GenStepsCollector.java | 14 +- MMTk/src/org/mmtk/plan/generational_steps/GenStepsMatureTraceLocal.java | 8 +- MMTk/src/org/mmtk/plan/generational_steps/GenStepsMutator.java | 6 +- MMTk/src/org/mmtk/plan/generational_steps/GenStepsNurseryTraceLocal.java | 53 +---- MMTk/src/org/mmtk/plan/generational_steps/marksweep/GenStepsMSCollector.java | 2 +- 7 files changed, 58 insertions(+), 111 deletions(-) diffs (truncated from 471 to 300 lines): diff -r 7cf639f7956f -r 06f04944e43f MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Barriers.java --- a/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Barriers.java Tue Jul 05 21:48:00 2011 +0100 +++ b/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Barriers.java Tue Jul 12 23:27:27 2011 +0100 @@ -621,7 +621,8 @@ if (org.jikesrvm.VM.runningVM) { Address base = ObjectReference.fromObject(dst).toAddress(); Address slot = base.plus(Offset.fromIntZeroExtend(index << LOG_BYTES_IN_ADDRESS)); - VM.activePlan.global().storeObjectReference(slot, ObjectReference.fromObject(value)); + slot.store(ObjectReference.fromObject(value)); +// VM.activePlan.global().storeObjectReference(slot, ObjectReference.fromObject(value)); } else { dst[index] = value; } diff -r 7cf639f7956f -r 06f04944e43f MMTk/src/org/mmtk/plan/generational_steps/GenSteps.java --- a/MMTk/src/org/mmtk/plan/generational_steps/GenSteps.java Tue Jul 05 21:48:00 2011 +0100 +++ b/MMTk/src/org/mmtk/plan/generational_steps/GenSteps.java Tue Jul 12 23:27:27 2011 +0100 @@ -99,8 +99,8 @@ private static final VMRequest vmRequest = USE_DISCONTIGUOUS_NURSERY ? VMRequest.create() : VMRequest.create(NURSERY_VM_FRACTION, true); public static final CopySpace edenSpace = new CopySpace("eden", false, vmRequest); - public static final int NURSERY = edenSpace.getDescriptor(); - private static final Address NURSERY_START = edenSpace.getStart(); + public static final int EDEN = edenSpace.getDescriptor(); + private static final Address EDEN_START = edenSpace.getStart(); /** The steps space is where all objects that survive the nursery will start going through before reaching the Mature Space */ public static final int NUMBER_OF_STEPS = 2; @@ -111,11 +111,11 @@ /* TODO: Use an array instead to allow N number of space */ /* Step one */ public static final CopySpace step1Space0 = new CopySpace("step10", false, VMRequest.create()); - public static final CopySpace step1Space1 = new CopySpace("step11", true, VMRequest.create()); + public static final CopySpace step1Space1 = new CopySpace("step11", false, VMRequest.create()); /* Step two */ public static final CopySpace step2Space0 = new CopySpace("step20", false, VMRequest.create()); - public static final CopySpace step2Space1 = new CopySpace("step21", true, VMRequest.create()); + public static final CopySpace step2Space1 = new CopySpace("step21", false, VMRequest.create()); public static final int SPACE10 = step1Space0.getDescriptor(); public static final int SPACE11 = step1Space1.getDescriptor(); @@ -146,11 +146,7 @@ public SharedDeque modbufPool2 = new SharedDeque("modBufs2",metaDataSpace, 1); public SharedDeque remsetPool2 = new SharedDeque("remSets2",metaDataSpace, 1); public SharedDeque arrayRemsetPool2 = new SharedDeque("arrayRemSets2",metaDataSpace, 2); - - protected final WriteBuffer remset1 = new WriteBuffer(remsetPool); /* remember modified array fields */ - protected final WriteBuffer remset2 = new WriteBuffer(remsetPool2); /* remember modified array fields */ - protected WriteBuffer remset = remset1; /* remember modified array fields */ - + /* * Class initializer */ @@ -183,7 +179,7 @@ nextGCFullHeap = true; } - /** + /** * Perform a (global) collection phase. * * @param phaseId Collection phase to execute. @@ -205,11 +201,10 @@ step1Space1.prepare(!hi); step2Space0.prepare(hi); step2Space1.prepare(!hi); - +/* remset.flushLocal(); remset = remset2; - - +*/ if (traceFullHeap()){ if (gcFullHeap) { if (Stats.gatheringStats()) fullHeap.set(); @@ -223,7 +218,6 @@ } return; } - if (phaseId == CLOSURE) { if (!traceFullHeap()) { nurseryTrace.prepare(); @@ -233,9 +227,6 @@ if (phaseId == RELEASE) { edenSpace.release(); - - remset.flushLocal(); - remset = remset1; // TODO: use a function fromSpace that returns an array of from spaces to release. if (hi) @@ -248,7 +239,7 @@ step1Space1.release(); step2Space1.release(); } - + modbufPool.clearDeque(1); remsetPool.clearDeque(1); arrayRemsetPool.clearDeque(2); @@ -262,10 +253,8 @@ // Log.writeln(nextGCFullHeap); /* ADDED */ +// remset.flushLocal(); /* Reseting empty pools before swapping */ - modbufPool.reset(); - remsetPool.reset(); - arrayRemsetPool.reset(); /* Swap the remset pools */ swapRemsetPools(); return; @@ -346,7 +335,7 @@ /** * Return the number of pages in use given the pending - * allocation. Simply add the nursery's ans steps' contribution to that of + * allocation. Simply add the eden's and steps' contribution to that of * the superclass. * * @return The number of pages reserved given the pending @@ -406,30 +395,9 @@ static boolean inEden(Address addr) { if (USE_DISCONTIGUOUS_NURSERY) - return Map.getDescriptorForAddress(addr) == NURSERY; + return Map.getDescriptorForAddress(addr) == EDEN; else - return addr.GE(NURSERY_START); - -/* - int descriptor; - - if (!USE_DISCONTIGUOUS_NURSERY && addr.GE(NURSERY_START)) - return (true); - - descriptor = Map.getDescriptorForAddress(addr); - if (USE_DISCONTIGUOUS_NURSERY && descriptor == NURSERY) - return (true); -*/ - - // It seems that the nursery is only the Eden space from what the comments say. - // So following that idea, if an object is in a step, it is not in the nursery. - // TODO: Use a while statement on an array -/* if (descriptor == SPACE10 || - descriptor == SPACE20 || - descriptor == SPACE11 || - descriptor == SPACE21) - return (true);*/ -// return (false); + return addr.GE(EDEN_START); } /** @@ -477,7 +445,7 @@ * @return Is current GC only collecting objects allocated since last GC. */ public final boolean isCurrentGCNursery() { - // FIXME: this might be wrong. But false since steps objects stay in nursery longer than one GC. Maybe test if some objects are in the steps to return true if not. + // FIXME: this might be wrong. return false; // return !gcFullHeap; } @@ -513,14 +481,14 @@ public int sanityExpectedRC(ObjectReference object, int sanityRootRC) { Space space = Space.getSpaceForObject(object); - // Nursery + // Eden if (space == GenSteps.edenSpace) { return SanityChecker.DEAD; } // Steps - // TODO: use a while statement and an array. + // TODO: use a while statement and an array. if (hi) { if (space == GenSteps.step1Space0 || space == GenSteps.step2Space0) @@ -533,7 +501,7 @@ if (space == GenSteps.step1Space0 || space == GenSteps.step2Space0) return (SanityChecker.ALIVE); if (space == GenSteps.step1Space1 || space == GenSteps.step2Space1) - return (SanityChecker.DEAD); + return (SanityChecker.DEAD); } // Immortal spaces @@ -542,7 +510,7 @@ } // Mature space (nursery collection) - if (VM.activePlan.global().isCurrentGCNursery()) { + if (!this.gcFullHeap) {//VM.activePlan.global().isCurrentGCNursery()) { return SanityChecker.UNSURE; } @@ -627,7 +595,7 @@ switch (step) { case 0: - return (NURSERY); + return (EDEN); case 1: return (hi ? SPACE11 : SPACE10); case 2: @@ -650,7 +618,7 @@ switch (step) { case 0: - return (NURSERY); + return (EDEN); case 1: return (hi ? SPACE10 : SPACE11); case 2: @@ -840,7 +808,7 @@ if (inEden(addr)) return (true); return (isInSteps(addr)); - } + } /** * Return true if the object resides within the nursery spaces. @@ -887,12 +855,9 @@ */ @Inline public void storeObjectReference(Address slot, ObjectReference value) { - if (GenSteps.GATHER_WRITE_BARRIER_STATS) GenSteps.wbFast.inc(); - if (!GenSteps.isInNursery(slot) && GenSteps.isInNursery(value)) { - if (GenSteps.GATHER_WRITE_BARRIER_STATS) GenSteps.wbSlow.inc(); - remset.insert(slot); - } - + if (!gcInProgress()) + VM.assertions.fail("gc write barrier action requested though gc is not in progress"); + ((GenStepsCollector) VM.activePlan.collector()).performWriteBarrierAction(slot, value); super.storeObjectReference(slot, value); } diff -r 7cf639f7956f -r 06f04944e43f MMTk/src/org/mmtk/plan/generational_steps/GenStepsCollector.java --- a/MMTk/src/org/mmtk/plan/generational_steps/GenStepsCollector.java Tue Jul 05 21:48:00 2011 +0100 +++ b/MMTk/src/org/mmtk/plan/generational_steps/GenStepsCollector.java Tue Jul 12 23:27:27 2011 +0100 @@ -57,6 +57,8 @@ protected AddressDeque remset; protected AddressPairDeque arrayRemset; + protected final WriteBuffer remset2; /* remember modified array fields */ + /** * The allocators for the steps. */ @@ -82,7 +84,7 @@ arrayRemset = new AddressPairDeque(global().arrayRemsetPool); remset = new AddressDeque("remset", global().remsetPool); modbuf = new ObjectReferenceDeque("modbuf", global().modbufPool); - + remset2 = new WriteBuffer(global().remsetPool2); nurseryTrace = new GenStepsNurseryTraceLocal(global().nurseryTrace, this); step1 = new CopyLocal(GenSteps.getToSpaceAtStep(1)); step2 = new CopyLocal(GenSteps.getToSpaceAtStep(2)); @@ -198,6 +200,7 @@ if (!global().traceFullHeap()) { nurseryTrace.release(); + remset2.flushLocal(); /* Why is this done here ? */ /* It should be done in GenSteps at the release phase */ /* Possible answer, the Collector removes one consumer */ @@ -232,4 +235,13 @@ /** @return The trace to use when collecting the mature space */ public abstract TraceLocal getFullHeapTrace(); + public void performWriteBarrierAction(Address slot, ObjectReference value) + { + if (GenSteps.GATHER_WRITE_BARRIER_STATS) GenSteps.wbFast.inc(); + if (!GenSteps.isInNursery(slot) && GenSteps.isInNursery(value)) { + if (GenSteps.GATHER_WRITE_BARRIER_STATS) GenSteps.wbSlow.inc(); + remset2.insert(slot); + } + } + } diff -r 7cf639f7956f -r 06f04944e43f MMTk/src/org/mmtk/plan/generational_steps/GenStepsMatureTraceLocal.java --- a/MMTk/src/org/mmtk/plan/generational_steps/GenStepsMatureTraceLocal.java Tue Jul 05 21:48:00 2011 +0100 +++ b/MMTk/src/org/mmtk/plan/generational_steps/GenStepsMatureTraceLocal.java Tue Jul 12 23:27:27 2011 +0100 @@ -38,7 +38,7 @@ private final ObjectReferenceDeque modbuf; private final AddressDeque remset; private final AddressPairDeque arrayRemset; - + /**************************************************************************** * * Initialization |