diff -bBr -I '$Id:' -I '\@version' -I '\@date' --exclude=CVS --exclude=Plan.java original.src/vm/memoryManagers/JMTk/plan/BasePlan.java rvm/src/vm/memoryManagers/JMTk/plan/BasePlan.java
6a7,11
> //-#if RVM_WITH_MARKING_COLLECT
> import org.mmtk.utility.AlignedFreeListVMResource;
> import org.mmtk.policy.MarkingLocal;
> import org.mmtk.policy.MarkingSpace;
> //-#endif
30a36
> import com.ibm.JikesRVM.VM_Word;
82a89
>   public static final int GC_REPEAT = 3;
92a100
>   private static int forcedCollectCount = 0;
94a103,105
>   //-#if RVM_WITH_MARKING_COLLECT
>   private static AlignedFreeListVMResource metaDataVM;
>   //-#else
95a107
>   //-#endif
99a112,114
>   //-#if RVM_WITH_MARKING_COLLECT
>   public static AlignedFreeListVMResource immortalVM;
>   //-#else
100a116
>   //-#endif
116a133,135
>   //-#if RVM_WITH_ALLOC_COUNT
>   public static SizeCounter allocs;
>   //-#endif
132a152,166
>   //-#if RVM_WITH_MARKING_COLLECT
>   public static final VM_Address META_DATA_START = BOOT_START.add(BOOT_SIZE);
>   protected static final VM_Extent  META_DATA_SIZE  = VM_Extent.fromIntZeroExtend(32 * 1024 * 1024);
>   public static final VM_Address   META_DATA_END = META_DATA_START.add(META_DATA_SIZE);
>   //-#if RVM_WITH_EXP_MERGE
>   protected  static final long          AVAILABLE = VM_Interface.MAXIMUM_MAPPABLE.diff(META_DATA_START.add(64*1024*1024)).toLong();
>   protected  static final VM_Extent       MS_SIZE = Conversions.roundDownMB(VM_Extent.fromIntZeroExtend((int)(AVAILABLE / 2.3)));
>   protected static final VM_Extent      LOS_SIZE = Conversions.roundDownMB(VM_Extent.fromIntZeroExtend((int)(AVAILABLE / 2.3 * 0.3)));
>   protected static  final VM_Extent   IMMORTAL_SIZE = VM_Extent.fromIntZeroExtend((32* 1024 * 1024) + MS_SIZE.toInt());
>   //-#else
>   protected static final VM_Extent    IMMORTAL_SIZE = VM_Extent.fromIntZeroExtend(32 * 1024 * 1024);
>   //-#endif
>   public static final VM_Address  IMMORTAL_START = META_DATA_END.add(LOS_SIZE);
>   public static final VM_Address    IMMORTAL_END = IMMORTAL_START.add(IMMORTAL_SIZE);
>   //-#else
138a173
>   //-#endif
145a181,184
>   //-#if RVM_WITH_MARKING_COLLECT
>   public static MarkingLocal immortal;
>   public static MarkingSpace immortalSpace;
>   //-#else
146a186
>   //-#endif
161a202,206
>     //-#if RVM_WITH_MARKING_COLLECT
>     metaDataVM = new AlignedFreeListVMResource(META_SPACE, "Meta data",
>                                                META_DATA_START, META_DATA_SIZE,
>                                                VMResource.META_DATA);
>     //-#else
162a208
>     //-#endif
168a215,221
>     //-#if RVM_WITH_MARKING_COLLECT
>     immortalVM = new AlignedFreeListVMResource(IMMORTAL_SPACE, "Immortal",
>                                                IMMORTAL_START, IMMORTAL_SIZE,
>                                                (byte)(VMResource.IN_VM |
>                                                       VMResource.IMMORTAL));
>     immortalSpace = new MarkingSpace(immortalVM, immortalMR);
>     //-#else
170c223
< 
---
>     //-#endif
181c234,236
<     
---
>     //-#if RVM_WITH_ALLOC_COUNT
>     allocs = new SizeCounter("alloc", true, true);
>     //-#endif
189a245,247
>     //-#if RVM_WITH_MARKING_COLLECT
>     immortal = new MarkingLocal(immortalSpace);
>     //-#else
190a249
>     //-#endif
214c273,274
<     if (Options.verbose > 0) Stats.startAll();
---
>     if (!Options.timeSecondRun && Options.verbose > 0) Stats.startAll();
>     if (!Options.timeSecondRun) insideHarness = true;
271a332,343
>   //-#if RVM_WITH_MARKING_COLLECT
>   /**
>    * Add a gray object
>    *
>    * @param obj The object to be enqueued
>    */
>   public static final void inCoreEnqueue(VM_Address obj)
>     throws VM_PragmaInline {
>     VM_Interface.getPlan().partials.push(obj);
>   }
>   //-#endif
> 
282a355,427
>   //-#if RVM_WITH_MARKING_COLLECT
>   /**
>    * Trace a reference during GC.  This involves determining which
>    * collection policy applies and calling the appropriate
>    * <code>trace</code> method.
>    *
>    * @param objLoc The location containing the object reference to be
>    * traced.  The object reference is <i>NOT</i> an interior pointer.
>    * @param root True if <code>objLoc</code> is within a root.
>    */
>   public static final void traceObjectLocation(boolean repeat, 
> 					       VM_Address objLoc)
>     throws VM_PragmaInline {
>     VM_Address obj = VM_Magic.getMemoryAddress(objLoc);
>     VM_Address newObj = Plan.traceObject(repeat, obj);
>     VM_Magic.setMemoryAddress(objLoc, newObj);
>   }
> 
>   public static final void traceObjectLocationPaging(boolean repeat, 
>                                                      VM_Address objLoc)
>     throws VM_PragmaInline {
>     VM_Address obj = VM_Magic.getMemoryAddress(objLoc);
>     VM_Address newObj = Plan.traceObjectPaging(repeat, obj);
>     VM_Magic.setMemoryAddress(objLoc, newObj);
>   }
> 
>   /**
>    * Trace a reference during GC.  This involves determining which
>    * collection policy applies and calling the appropriate
>    * <code>trace</code> method.
>    *
>    * @param obj The object reference to be traced.  This is <i>NOT</i> an
>    * interior pointer.
>    * @param interiorRef The interior reference inside obj that must be traced.
>    * @param root True if the reference to <code>obj</code> was held in a root.
>    * @return The possibly moved interior reference.
>    */
>   public static final 
>     VM_Address traceInteriorReference(boolean repeat, VM_Address obj,
> 				      VM_Address interiorRef)
>     throws VM_PragmaInline {
>     VM_Offset offset = interiorRef.diff(obj);
>     VM_Address newObj = Plan.traceObject(repeat, obj);
>     if (VM_Interface.VerifyAssertions) {
>       if (offset.sLT(VM_Offset.zero()) || offset.sGT(VM_Offset.fromIntSignExtend(1<<24))) {  // There is probably no object this large
>         Log.writeln("ERROR: Suspiciously large delta of interior pointer from object base");
>         Log.write("       object base = "); Log.writeln(obj);
>         Log.write("       interior reference = "); Log.writeln(interiorRef);
>         Log.write("       delta = "); Log.writeln(offset);
>         VM_Interface._assert(false);
>       }
>     }
>     return newObj.add(offset);
>   }
> 
>   public static final 
>     VM_Address traceInteriorReferencePaging(boolean repeat, VM_Address obj,
>                                             VM_Address interiorRef)
>     throws VM_PragmaInline {
>     VM_Offset offset = interiorRef.diff(obj);
>     VM_Address newObj = Plan.traceObjectPaging(repeat, obj);
>     if (VM_Interface.VerifyAssertions) {
>       if (offset.sLT(VM_Offset.zero()) || offset.sGT(VM_Offset.fromIntSignExtend(1<<24))) {  // There is probably no object this large
>         Log.writeln("ERROR: Suspiciously large delta of interior pointer from object base");
>         Log.write("       object base = "); Log.writeln(obj);
>         Log.write("       interior reference = "); Log.writeln(interiorRef);
>         Log.write("       delta = "); Log.writeln(offset);
>         VM_Interface._assert(false);
>       }
>     }
>     return newObj.add(offset);
>   }
>   //-#else
339a485
>   //-#endif
354a501,596
>   //-#if RVM_WITH_MARKING_COLLECT
>   /**
>    * Forward the object referred to by a given address and update the
>    * address if necessary.  This <i>does not</i> enqueue the referent
>    * for processing; the referent must be explicitly enqueued if it is
>    * to be processed.<p>
>    *
>    * <i>Non-copying collectors do nothing, copying collectors must
>    * override this method.</i>
>    *
>    * @param location The location whose referent is to be forwarded if
>    * necessary.  The location will be updated if the referent is
>    * forwarded.
>    */
>   public static void forwardObjectLocation(boolean repeat,
>                                            VM_Address location) {
>     if (VM_Interface.VerifyAssertions)
>       VM_Interface._assert(!Plan.MOVES_OBJECTS);
>   }
>   
>   /**
>    * If the object in question has been forwarded, return its
>    * forwarded value.<p>
>    *
>    * <i>Non-copying collectors do nothing, copying collectors must
>    * override this method.</i>
>    *
>    * @param object The object which may have been forwarded.
>    * @return The forwarded value for <code>object</code>.  <i>In this
>    * case return <code>object</code>, copying collectors must override
>    * this method.
>    */
>   public static VM_Address getForwardedReference(boolean repeat,
>                                                  VM_Address object) {
>     if (VM_Interface.VerifyAssertions)
>       VM_Interface._assert(!Plan.MOVES_OBJECTS);
>     return object;
>   }
> 
>   /**
>    * Make alive an object that was not otherwise known to be alive.
>    * This is used by the ReferenceProcessor, for example.
>    *
>    * @param object The object which is to be made alive.
>    */
>   public static void makeAlive(boolean repeat, VM_Address object)
>     throws VM_PragmaInline {
>     Plan.traceObject(repeat, object);
>   }
>   public static void makeAlivePaging(boolean repeat, VM_Address object)
>     throws VM_PragmaInline {
>     Plan.traceObjectPaging(repeat, object);
>   }
>  
>   /**
>    * An object is unreachable and is about to be added to the
>    * finalizable queue.  The collector must ensure the object is not
>    * collected (despite being otherwise unreachable), and should
>    * return its forwarded address if keeping the object alive involves
>    * forwarding.<p>
>    *
>    * <i>For many collectors these semantics relfect those of
>    * <code>traceObject</code>, which is implemented here.  Other
>    * collectors must override this method.</i>
>    *
>    * @param object The object which may have been forwarded.
>    * @return The forwarded value for <code>object</code>.  <i>In this
>    * case return <code>object</code>, copying collectors must override
>    * this method.
>    */
>   public static VM_Address retainFinalizable(boolean repeat,
>                                              VM_Address object)
>     throws VM_PragmaInline {
>     return Plan.traceObject(repeat, object);
>   }
> 
>   public static VM_Address retainFinalizablePaging(boolean repeat,
>                                                    VM_Address object)
>     throws VM_PragmaInline {
>     return Plan.traceObjectPaging(repeat, object);
>   }
> 
>   /**
>    * Return true if an object is ready to move to the finalizable
>    * queue, i.e. it has no regular references to it.  This method may
>    * (and in some cases is) be overridden by subclasses.
>    *
>    * @param object The object being queried.
>    * @return <code>true</code> if the object has no regular references
>    * to it.
>    */
>   public static boolean isFinalizable(VM_Address object, boolean paging)
>     throws VM_PragmaInline {
>     return !Plan.isLive(object, paging);
>   }
>   //-#else
432a675
>   //-#endif
667c910
<     return gcStatus == GC_PROPER;
---
>     return ((gcStatus == GC_PROPER) || (gcStatus == GC_REPEAT));
692a936,940
>   public static void timingRunPrepare() {
>     Options.fullHeapSystemGC = true;
>     Options.ignoreSystemGC = false;
>   }
> 
700c948,949
<   public static void harnessBegin() throws VM_PragmaInterruptible {
---
>   public static void harnessBegin() {
>     if (++forcedCollectCount == Options.timingStartCollect) {
702,703d950
<     System.gc();
<     Options.fullHeapSystemGC = false;
704a952,956
>       // Set that the heap is NOT variable sized
>       Options.variableSizeHeap = false;
>       Options.ignoreSystemGC = true;
>       // Reset the heap size to the initial heap size
>       HeapGrowthManager.overrideGrowHeapSize(HeapGrowthManager.getInitialHeapSize() - HeapGrowthManager.getCurrentHeapSize());
705a958,972
>     }
>   }
> 
>   public static void timingRunStart() {
>     // Set that the heap is NOT variable sized
>     Options.variableSizeHeap = false;
>     Options.ignoreSystemGC = true;
> 
>     // Reset the heap size to the initial heap size
>     HeapGrowthManager.overrideGrowHeapSize(HeapGrowthManager.getInitialHeapSize() - HeapGrowthManager.getCurrentHeapSize());
>     insideHarness = true;
> 
>     // Start the harness within Jikes
>     VM_Interface.pagingStart();
>     // Start the statistics
708a976,986
>   public static void postGCHarnessBegin() {
>     if (forcedCollectCount == Options.timingStartCollect) {
>       Options.fullHeapSystemGC = false;
>       VM_Interface.pagingStart();
>       Stats.startAll();
>       //-#if RVM_WITH_ALLOC_COUNT
>       allocs.start();
>       //-#endif
>     }
>   }
> 
759c1037,1043
<     if (Options.verbose == 1) {
---
>     if (Options.timeSecondRun) {
>       Stats.stopAll();
>       VM_Interface.pagingEnd();
>       printDetailedTiming(true);
>     } else if (Options.verboseTiming) {
>       printDetailedTiming(true);
>     } else if (Options.verbose == 1) {
768c1052,1055
<     if (Options.verboseTiming) printDetailedTiming(true);
---
>     //-#if RVM_WITH_ALLOC_COUNT
>     else
>       printDetailedTiming(true);
>     //-#endif
774c1061,1074
<   protected void printDetailedTiming(boolean totals) {}
---
>   protected void printDetailedTiming(boolean totals) {
>     Log.write("[End ");
>     totalTime.printTotalSecs();
>     Log.write(" s or ");
>     totalTime.printTotalMillis();
>     Log.writeln(" ms]");
>     //-#if RVM_WITH_ALLOC_COUNT
>     Log.write(" BytesAlloc: ");
>     allocs.printVolume();
>     Log.write(" ObjsAlloc: ");
>     allocs.printUnits();
>     Log.writeln();
>     //-#endif
>   }
diff -bBr -I '$Id:' -I '\@version' -I '\@date' --exclude=CVS --exclude=Plan.java original.src/vm/memoryManagers/JMTk/plan/StopTheWorldGC.java rvm/src/vm/memoryManagers/JMTk/plan/StopTheWorldGC.java
13a14,16
> //-#if RVM_WITH_MARKING_COLLECT
> import org.mmtk.utility.PageMgr;
> //-#endif
61a65,67
>   //-#if RVM_WITH_MARKING_COLLECT
>   protected static SharedDeque partialPool = new SharedDeque(metaDataRPA, 1);
>   //-#endif
81a88,92
>   //-#if RVM_WITH_MARKING_COLLECT
>   protected static boolean repeatScan;
>   protected static boolean pagingGC;
>   //-#endif
> 
86a98,100
>   //-#if RVM_WITH_MARKING_COLLECT
>   protected AddressDeque partials;          // gray objects
>   //-#endif
110a125,128
>     //-#if RVM_WITH_MARKING_COLLECT
>     partials = new AddressDeque("paritals", partialPool);
>     partialPool.newClient();
>     //-#endif
118a137,139
>     //-#if RVM_WITH_MARKING_COLLECT
>     repeatScan = false;
>     //-#endif
136a158,162
>   //-#if RVM_WITH_MARKING_COLLECT
>   abstract protected void globalPrepareForRepeat();
>   abstract protected void threadLocalPrepareForRepeat(boolean paging);
>   abstract protected void preparePagesPaging(boolean repeat);
>   //-#endif
153a180,439
>   //-#if RVM_WITH_MARKING_COLLECT
>   /**
>    * Perform a collection.
>    *
>    * Important notes:
>    *   . Global actions are executed by only one thread
>    *   . Thread-local actions are executed by all threads
>    *   . The following order is guaranteed by BasePlan, with each
>    *     separated by a synchronization barrier.:
>    *      1. globalPrepare()
>    *      2. threadLocalPrepare()
>    *      3. threadLocalRelease()
>    *      4. globalRelease()
>    */
>   public void collect() {
>     if (VM_Interface.VerifyAssertions) 
>       VM_Interface._assert(collectionsInitiated > 0);
>     if (!PageMgr.pagesEvicted()) {
>       boolean designated = (VM_Interface.rendezvous(4210) == 1);
>       boolean timekeeper = Stats.gatheringStats() && designated;
>       // Save if this scan will be a compacting garbage collection
>       if (designated) repeatScan = Plan.isCompactingGC();
>       if (designated) pagingGC = false;
>       if (timekeeper) Stats.startGC();
>       if (timekeeper) initTime.start();
>       prepare(false);
>       if (VM_Interface.GCSPY)
>         gcspyPrepare();
>       if (timekeeper) initTime.stop();
>       
>       if (timekeeper) rootTime.start();
>       VM_Interface.computeAllRoots(rootLocations, interiorRootLocations);
>       if (VM_Interface.GCSPY)
>         gcspyRoots(rootLocations, interiorRootLocations);
>       if (timekeeper) rootTime.stop();
>       
>       // This should actually occur right before preCopyGC but
>       // a spurious complaint about setObsolete would occur.
>       // The upshot is that objects coped by preCopyGC are not
>       // subject to the sanity checking.
>       int order = VM_Interface.rendezvous(4900);
>       if (order == 1) {
>         VM_Interface.resetThreadCounter();
>         setGcStatus(GC_PROPER);    
>       }
>       VM_Interface.rendezvous(4901);
>       
>       if (timekeeper) scanTime.start();
>       VM_Interface.getPlan().processCards(false);
>       processAllWork(false);
>       if (timekeeper) scanTime.stop();
>       
>       if (!Options.noReferenceTypes) {
>         if (timekeeper) refTypeTime.start();
>         if (designated) ReferenceProcessor.moveSoftReferencesToReadyList(false);
>         if (designated) ReferenceProcessor.moveWeakReferencesToReadyList(false);
>         if (timekeeper) refTypeTime.stop();
>       }
>       
>       if (Options.noFinalizer) {
>         if (designated) Finalizer.kill();
>       } else {
>         if (timekeeper) finalizeTime.start();
>         if (designated) Finalizer.moveToFinalizable(false);
>         VM_Interface.rendezvous(4220);
>         if (timekeeper) finalizeTime.stop();
>       }
>       
>       if (!Options.noReferenceTypes) {
>         if (timekeeper) refTypeTime.start();
>         if (designated) 
>           ReferenceProcessor.movePhantomReferencesToReadyList(false);
>         if (timekeeper) refTypeTime.stop();
>       }
>       
>       if (!Options.noReferenceTypes || !Options.noFinalizer) {
>         if (timekeeper) scanTime.start();
>         processAllWork(false);
>         if (timekeeper) scanTime.stop();
>       }
>       // If we need to repeat the scanning
>       if (repeatScan) {
>         prepareForRepeat(false);
>         if (timekeeper) rootTime.start();
>         VM_Interface.computeAllRoots(rootLocations, interiorRootLocations);
>         if (timekeeper) rootTime.stop();
>         
>         // This should actually occur right before preCopyGC but
>         // a spurious complaint about setObsolete would occur.
>         // The upshot is that objects coped by preCopyGC are not
>         // subject to the sanity checking.
>         order = VM_Interface.rendezvous(4900);
>         if (order == 1) {
>           VM_Interface.resetThreadCounter();
>           setGcStatus(GC_REPEAT);
>         }
>         VM_Interface.rendezvous(4901);
> 
>         if (!Options.noReferenceTypes) {
>           if (timekeeper) refTypeTime.start();
>           if (designated) ReferenceProcessor.updateSoftReferences(false);
>           if (designated) ReferenceProcessor.updateWeakReferences(false);
>           if (designated) ReferenceProcessor.updatePhantomReferences(false);
>           if (timekeeper) refTypeTime.stop();
>         }
>         
>         if (!Options.noFinalizer) {
>           if (timekeeper) finalizeTime.start();
>           if (designated) Finalizer.updateFinalizable(false);
>           if (timekeeper) finalizeTime.stop();
>         }
>         
>         if (timekeeper) scanTime.start();
>         processAllWork(true);
>         if (timekeeper) scanTime.stop();   
>       }
>       
>       if (timekeeper) finishTime.start();
>       if (VM_Interface.GCSPY)
>         gcspyPreRelease();
>       release();
>       if (VM_Interface.GCSPY)
>         gcspyPostRelease();
>       if (timekeeper) finishTime.stop();
>       if (timekeeper) Stats.endGC();
>       if (timekeeper) printStats();
>       if (designated && PageMgr.isPaging()) {
>         Plan.updatePageAvail();
>       }
>       if (designated && PageMgr.pageEvictionGC()) {
>         int discardPgs = PageMgr.computeDiscardable(Plan.getNewHeapSize());
>         VM_Interface.returnPages(discardPgs);
>       }
>     } else
>       collectWhilePaging();
>   }
> 
>   private final void collectWhilePaging() throws VM_PragmaNoInline {
>     boolean designated = (VM_Interface.rendezvous(4210) == 1);
>     boolean timekeeper = Stats.gatheringStats() && designated;
>     // Save if this scan will be a compacting garbage collection
>     if (designated) repeatScan = Plan.isCompactingGC();
>     if (designated) pagingGC = true;
>     if (timekeeper) Stats.startGC();
>     if (timekeeper) initTime.start();
>     prepare(true);
>     if (VM_Interface.GCSPY)
>       gcspyPrepare();
>     if (timekeeper) initTime.stop();
>     
>     if (timekeeper) rootTime.start();
>     VM_Interface.computeAllRoots(rootLocations, interiorRootLocations);
>     if (VM_Interface.GCSPY)
>       gcspyRoots(rootLocations, interiorRootLocations);
>     if (timekeeper) rootTime.stop();
>     
>     // This should actually occur right before preCopyGC but
>     // a spurious complaint about setObsolete would occur.
>     // The upshot is that objects coped by preCopyGC are not
>     // subject to the sanity checking.
>     int order = VM_Interface.rendezvous(4900);
>     if (order == 1) {
>       VM_Interface.resetThreadCounter();
>       setGcStatus(GC_PROPER);
>     }
>     VM_Interface.rendezvous(4901);
>     
>     if (timekeeper) scanTime.start();
>     VM_Interface.getPlan().processCards(true);
>     
>     preparePagesPaging(false);
>     processAllWorkPaging(false);
>     if (timekeeper) scanTime.stop();
>     
>     if (!Options.noReferenceTypes) {
>       if (timekeeper) refTypeTime.start();
>       if (designated) ReferenceProcessor.moveSoftReferencesToReadyList(true);
>       if (designated) ReferenceProcessor.moveWeakReferencesToReadyList(true);
>       if (timekeeper) refTypeTime.stop();
>     }
>     
>     if (Options.noFinalizer) {
>       if (designated) Finalizer.kill();
>     } else {
>       if (timekeeper) finalizeTime.start();
>       if (designated) Finalizer.moveToFinalizable(true);
>       VM_Interface.rendezvous(4220);
>       if (timekeeper) finalizeTime.stop();
>     }
>     
>     if (!Options.noReferenceTypes) {
>       if (timekeeper) refTypeTime.start();
>       if (designated)
>         ReferenceProcessor.movePhantomReferencesToReadyList(true);
>       if (timekeeper) refTypeTime.stop();
>     }
>     
>     if (timekeeper) scanTime.start();
>     processAllWorkPaging(false);
>     if (timekeeper) scanTime.stop();
> 
>     // If we need to repeat the scanning
>     if (repeatScan) {
>       prepareForRepeat(true);
>       if (timekeeper) rootTime.start();
>       VM_Interface.computeAllRoots(rootLocations, interiorRootLocations);
>       if (timekeeper) rootTime.stop();
>       
>       // This should actually occur right before preCopyGC but
>       // a spurious complaint about setObsolete would occur.
>       // The upshot is that objects coped by preCopyGC are not
>       // subject to the sanity checking.
>       order = VM_Interface.rendezvous(4900);
>       if (order == 1) {
>         VM_Interface.resetThreadCounter();
>         setGcStatus(GC_PROPER);
>       }
>       VM_Interface.rendezvous(4901);
>       
>       if (timekeeper) scanTime.start();
>       preparePagesPaging(true);
>       if (timekeeper) scanTime.stop();
>       
>       if (!Options.noReferenceTypes) {
>         if (timekeeper) refTypeTime.start();
>         if (designated) ReferenceProcessor.updateSoftReferences(true);
>         if (designated) ReferenceProcessor.updateWeakReferences(true);
>         if (designated) ReferenceProcessor.updatePhantomReferences(true);
>         if (timekeeper) refTypeTime.stop();
>       }
> 
>       if (!Options.noFinalizer) {
>         if (timekeeper) finalizeTime.start();
>         if (designated) Finalizer.updateFinalizable(true);
>         if (timekeeper) finalizeTime.stop();
>       }
> 
>       if (timekeeper) scanTime.start();
>       processAllWorkPaging(true);
>       if (timekeeper) scanTime.stop();
>     }
>     
>     if (timekeeper) finishTime.start();
>     if (VM_Interface.GCSPY)
>       gcspyPreRelease();
>     release();
>     if (VM_Interface.GCSPY)
>       gcspyPostRelease();
>     
>     if (timekeeper) finishTime.stop();
>     if (timekeeper) Stats.endGC();
>     if (timekeeper) printStats();
>     if (designated)
>       Plan.updatePageAvail();
>     if (designated && PageMgr.pageEvictionGC()) {
>       int discardPgs = PageMgr.computeDiscardable(Plan.getNewHeapSize());
>       VM_Interface.returnPages(discardPgs);
>     }
>   }
>   //-#else
238a525
>   //-#endif
239a527,554
>   //-#if RVM_WITH_MARKING_COLLECT
>   /**
>    * Prepare for a collection.
>    */
>   protected final void prepare(boolean paging) {
>     long start = VM_Interface.cycles();
>     int order = VM_Interface.rendezvous(4230);
>     if (order == 1) {
>       setGcStatus(GC_PREPARE);
>       baseGlobalPrepare(start);
>     }
>     VM_Interface.rendezvous(4240);
>     if (order == 1)
>       for (int i=0; i<planCount; i++) {
>         Plan p = plans[i];
>         if (VM_Interface.isNonParticipating(p)) 
>           p.baseThreadLocalPrepare(NON_PARTICIPANT);
>       }
>     baseThreadLocalPrepare(order);
>     VM_Interface.rendezvous(4250);
>     if (Plan.MOVES_OBJECTS) {
>       VM_Interface.preCopyGCInstances(false);
>       VM_Interface.rendezvous(4260);
>       if (order == 1) VM_Interface.resetThreadCounter();
>       VM_Interface.rendezvous(4270);
>     }
>   }
>   //-#else
265a581,651
>   //-#endif
> 
>   //-#if RVM_WITH_MARKING_COLLECT
>   /**
>    * Prepare to repeat a collection.
>    */
>   protected final void prepareForRepeat(boolean paging) {
>     int order = VM_Interface.rendezvous(4212);
>     baseThreadReleaseForRepeat();
>     baseThreadLocalPrepareForRepeat(order, paging);
>     VM_Interface.rendezvous(4240);
>     if (order == 1) {
>       setGcStatus(GC_REPEAT);
>       baseGlobalPrepareForRepeat();
>     }
>     
>     VM_Interface.rendezvous(4250);    
>     if (Plan.MOVES_OBJECTS) {
>       VM_Interface.preCopyGCInstances(true);
>       VM_Interface.rendezvous(4260);
>       if (order == 1) VM_Interface.resetThreadCounter();
>       VM_Interface.rendezvous(4270);
>     }
>   }
> 
>   private final void baseThreadReleaseForRepeat() {
>     values.reset();
>     remset.resetLocal();
>     forwardedObjects.reset();
>     rootLocations.reset();
>     interiorRootLocations.reset();
>   }
>   
>   /**
>    * Perform operations with <i>global</i> scope in preparation for a
>    * collection.  This is called by <code>prepare()</code>, which will
>    * ensure that <i>only one thread</i> executes this.<p>
>    *
>    * In this case, it means performing generic operations and calling
>    * <code>globalPrepare()</code>, which performs plan-specific
>    * operations.
>    *
>    * @param start The time that this GC started
>    */
>   private final void baseGlobalPrepareForRepeat() {
>     valuePool.reset();
>     remsetPool.reset();
>     forwardPool.reset();
>     rootLocationPool.reset();
>     interiorRootPool.reset();
>     globalPrepareForRepeat();
>   }
> 
>   /**
>    * Perform operations with <i>thread-local</i> scope in preparation
>    * for a collection.  This is called by <code>prepare()</code> which
>    * will ensure that <i>all threads</i> execute this.<p>
>    *
>    * After performing generic operations,
>    * <code>threadLocalPrepare()</code> is called to perform
>    * subclass-specific operations.
>    *
>    * @param order A unique ordering placed on the threads by the
>    * caller's use of <code>rendezvous</code>.
>    */
>   public final void baseThreadLocalPrepareForRepeat(int order,
>                                                     boolean paging) {
>     if (Options.verbose >= 4) Log.writeln("  Preparing all collector threads for restart");
>     threadLocalPrepareForRepeat(paging);
>   }
>   //-#endif
279c665,666
<     if ((Options.verbose == 1) || (Options.verbose == 2)) {
---
>     if (((Options.verbose == 1) || (Options.verbose == 2)) &&
>         insideHarness) {
389c776
<     remset.reset();
---
>     remset.resetLocal();
395a783
>   //-#if RVM_WITH_MARKING_COLLECT
400c788,833
<   private final void processAllWork() throws VM_PragmaNoInline {
---
>   private final void processAllWorkPaging(boolean repeat)
>     throws VM_PragmaNoInline {
>     if (Options.verbose >= 4) { Log.prependThreadId(); Log.writeln("  Working on GC in parallel"); }
>     do {
>       if (Options.verbose >= 5) { Log.prependThreadId(); Log.writeln("    processing forwarded (pre-copied) objects"); }
>       while (!forwardedObjects.isEmpty()) {
>         VM_Address object = forwardedObjects.pop();
>         scanForwardedObjectPaging(repeat, object);
>       }
>       if (Options.verbose >= 5) { Log.prependThreadId(); Log.writeln("    processing root locations"); }
>       while (!rootLocations.isEmpty()) {
>         VM_Address loc = rootLocations.pop();
>         traceObjectLocationPaging(repeat, loc);
>       }
>       if (Options.verbose >= 5) { Log.prependThreadId(); Log.writeln("    processing interior root locations"); }
>       while (!interiorRootLocations.isEmpty()) {
>         VM_Address obj = interiorRootLocations.pop1();
>         VM_Address interiorLoc = interiorRootLocations.pop2();
>         VM_Address interior = VM_Magic.getMemoryAddress(interiorLoc);
>         VM_Address newInterior =
>           traceInteriorReferencePaging(repeat, obj, interior);
>         VM_Magic.setMemoryAddress(interiorLoc, newInterior);
>       }
>       if (Options.verbose >= 5) { Log.prependThreadId(); Log.writeln("    processing gray objects"); }
>       while (!values.isEmpty()) {
>         VM_Address v = values.pop();
>         Scan.scanObjectPaging(repeat, v);  // NOT traceObject
>       }
>       if (Options.verbose >= 5) { Log.prependThreadId(); Log.writeln("    processing gray partials"); }
>       while (!partials.isEmpty()) {
>         VM_Address v = partials.pop();
>         Scan.scanObjectPartial(repeat, v);  // NOT traceObject
>       }
>       if (Options.verbose >= 5) { Log.prependThreadId(); Log.writeln("    processing remset"); }
>       while (!remset.isEmpty()) {
>         VM_Address loc = remset.pop();
>         traceObjectLocationPaging(repeat, loc);
>       }
>       flushRememberedSets();
>     }
>     while (!(rootLocations.isEmpty() && interiorRootLocations.isEmpty() &&
>              values.isEmpty() && remset.isEmpty() && partials.isEmpty()));
> 
>     if (Options.verbose >= 4) { Log.prependThreadId(); Log.writeln("    waiting at barrier"); }
>     VM_Interface.rendezvous(4300);
>   }
401a835,878
>   /**
>    * Process all GC work.  This method iterates until all work queues
>    * are empty.
>    */
>   private final void processAllWork(boolean repeat) throws VM_PragmaNoInline {
>     if (Options.verbose >= 4) { Log.prependThreadId(); Log.writeln("  Working on GC in parallel"); }
>     do {
>       if (Options.verbose >= 5) { Log.prependThreadId(); Log.writeln("    processing forwarded (pre-copied) objects"); }
>       while (!forwardedObjects.isEmpty()) {
>         VM_Address object = forwardedObjects.pop();
>         scanForwardedObject(repeat, object);
>       }
>       if (Options.verbose >= 5) { Log.prependThreadId(); Log.writeln("    processing root locations"); }
>       while (!rootLocations.isEmpty()) {
>         VM_Address loc = rootLocations.pop();
>         traceObjectLocation(repeat, loc);
>       }
>       if (Options.verbose >= 5) { Log.prependThreadId(); Log.writeln("    processing interior root locations"); }
>       while (!interiorRootLocations.isEmpty()) {
>         VM_Address obj = interiorRootLocations.pop1();
>         VM_Address interiorLoc = interiorRootLocations.pop2();
>         VM_Address interior = VM_Magic.getMemoryAddress(interiorLoc);
>         VM_Address newInterior = traceInteriorReference(repeat, obj, interior);
>         VM_Magic.setMemoryAddress(interiorLoc, newInterior);
>       }
>       if (Options.verbose >= 5) { Log.prependThreadId(); Log.writeln("    processing gray objects"); }
>       while (!values.isEmpty()) {
>         VM_Address v = values.pop();
>         Scan.scanObject(repeat, v);  // NOT traceObject
>       }
>       if (Options.verbose >= 5) { Log.prependThreadId(); Log.writeln("    processing remset"); }
>       while (!remset.isEmpty()) {
>         VM_Address loc = remset.pop();
>         traceObjectLocation(repeat, loc);
>       }
>       flushRememberedSets();
>     }
>     while (!(rootLocations.isEmpty() && interiorRootLocations.isEmpty() &&
>              values.isEmpty() && remset.isEmpty()));
>     if (Options.verbose >= 4) { Log.prependThreadId(); Log.writeln("    waiting at barrier"); }
>     VM_Interface.rendezvous(4300);
>   }
>   //-#else
>   private final void processAllWork() throws VM_PragmaNoInline {
433,434c910,912
<     } while (!(rootLocations.isEmpty() && interiorRootLocations.isEmpty()
<                && values.isEmpty() && remset.isEmpty()));
---
>     }
>     while (!(rootLocations.isEmpty() && interiorRootLocations.isEmpty() &&
>              values.isEmpty() && remset.isEmpty()));
438a917
>   //-#endif
445a925,946
>   //-#if RVM_WITH_MARKING_COLLECT
>   /**
>    * Collectors that move objects <b>must</b> override this method.
>    * It performs the deferred scanning of objects which are forwarded
>    * during bootstrap of each copying collection.  Because of the
>    * complexities of the collection bootstrap (such objects are
>    * generally themselves gc-critical), the forwarding and scanning of
>    * the objects must be dislocated.  It is an error for a non-moving
>    * collector to call this method.
>    *
>    * @param object The forwarded object to be scanned
>    */
>   protected void scanForwardedObject(boolean repeat, VM_Address object) {
>     if (VM_Interface.VerifyAssertions) 
>       VM_Interface._assert(!Plan.MOVES_OBJECTS);
>   }
> 
>   protected void scanForwardedObjectPaging(boolean repeat, VM_Address object) {
>     if (VM_Interface.VerifyAssertions) 
>       VM_Interface._assert(!Plan.MOVES_OBJECTS);
>   }
>   //-#else
460a962
>   //-#endif
471c973,974
<     if ((Options.verbose == 1) || (Options.verbose == 2)) {
---
>     if (((Options.verbose == 1) || (Options.verbose == 2)) &&
>         insideHarness) {
diff -bBr -I '$Id:' -I '\@version' -I '\@date' --exclude=CVS --exclude=Plan.java original.src/vm/memoryManagers/JMTk/utility/Allocator.java rvm/src/vm/memoryManagers/JMTk/utility/Allocator.java
56a57,93
>   //-#if RVM_WITH_EXP_MERGE
>   protected VM_Address allocSlowOnce(boolean isScalar, int bytes,
>                                      boolean inGC, byte space_) {
>     // Default--- do nothing
>     return VM_Address.zero();
>   }
>   
>   public VM_Address allocSlow(boolean isScalar, int bytes, boolean inGC, 
>                               byte space_) 
>     throws VM_PragmaNoInline { 
>     return allocSlowBody(isScalar, bytes, inGC, space_);
>   }
>   
>   private VM_Address allocSlowBody(boolean isScalar, int bytes, boolean inGC,
>                                    byte space_) 
>     throws VM_PragmaInline {
>     int gcCountStart = Stats.gcCount();    
>     Allocator current = this;
>     for (int i=0; i<MAX_RETRY; i++) {
>       VM_Address result = current.allocSlowOnce(isScalar, bytes, inGC, space_);
>       if (!result.isZero())
>         return result;
>       current = BasePlan.getOwnAllocator(current);
>     }
>     Log.write("GC Warning: Possible VM range imbalance - Allocator.allocSlowBody failed on request of ");
>     Log.write(bytes);
>     Log.write(" on space "); Log.writeln(Plan.getSpaceFromAllocatorAnyPlan(this));
>     Log.write("gcCountStart = "); Log.writeln(gcCountStart);
>     Log.write("gcCount (now) = "); Log.writeln(Stats.gcCount());
>     MemoryResource.showUsage(BasePlan.MB);
>     VM_Interface.dumpStack(); 
>     VM_Interface.failWithOutOfMemoryError();
>     /* NOTREACHED */
>     return VM_Address.zero();
>   }
>   //-#endif
> 
diff -bBr -I '$Id:' -I '\@version' -I '\@date' --exclude=CVS --exclude=Plan.java original.src/vm/memoryManagers/JMTk/utility/BooleanOptions.dat rvm/src/vm/memoryManagers/JMTk/utility/BooleanOptions.dat
42a43,45
> 
> timeSecondRun false
> Should we only time the second run of the benchmark?
diff -bBr -I '$Id:' -I '\@version' -I '\@date' --exclude=CVS --exclude=Plan.java original.src/vm/memoryManagers/JMTk/utility/Enumerate.java rvm/src/vm/memoryManagers/JMTk/utility/Enumerate.java
22a23,26
>   //-#if RVM_WITH_MARKING_COLLECT
>   abstract public void enumeratePointerLocation(boolean repeat,
>                                                 VM_Address location);
>   //-#else
23a28
>   //-#endif
Only in rvm/src/vm/memoryManagers/JMTk/utility: FilterBuffer.java
Only in rvm/src/vm/memoryManagers/JMTk/utility: FilteringSSB.java
diff -bBr -I '$Id:' -I '\@version' -I '\@date' --exclude=CVS --exclude=Plan.java original.src/vm/memoryManagers/JMTk/utility/Finalizer.java rvm/src/vm/memoryManagers/JMTk/utility/Finalizer.java
109c109,110
<   private static void addLive(Object obj) throws VM_PragmaLogicallyUninterruptible {
---
>   private static void addLive(Object obj)
>     throws VM_PragmaLogicallyUninterruptible {
165a167
>   //-#if RVM_WITH_MARKING_COLLECT
170c172,173
<   public final static int moveToFinalizable () {
---
>   public final static void updateFinalizable(boolean paging)
>     throws VM_PragmaLogicallyUninterruptible {
173a177,178
>     if (!paging) {
>       // Process through all of the finalizable candidates
175a181,228
>         candidate.set(cursor, Plan.retainFinalizable(true, cand));
>         cursor++;
>       }
>       
>       // Now process through all of the live objects
>       cursor = 0;
>       while (cursor < liveEnd) {
>         VM_Address obj = VM_Magic.objectAsAddress(live[cursor]);
>         live[cursor++] =
>           VM_Magic.addressAsObject(Plan.retainFinalizable(true, obj));
>       }
>     } else {
>        // Process through all of the finalizable candidates
>       while (cursor < candidateEnd) {
>         VM_Address cand = candidate.get(cursor);
>         candidate.set(cursor, Plan.retainFinalizablePaging(true, cand));
>         cursor++;
>       }
> 
>       // Now process through all of the live objects
>       cursor = 0;
>       while (cursor < liveEnd) {
>         VM_Address obj = VM_Magic.objectAsAddress(live[cursor]);
>         live[cursor++] =
>           VM_Magic.addressAsObject(Plan.retainFinalizablePaging(true, obj));
>       }
>     }
>   }
>   //-#endif
>   
>   /**
>    * Scan the array for objects which have become finalizable and move
>    * them to the Finalizable class
>    */
>   //-#if RVM_WITH_MARKING_COLLECT
>   public final static int moveToFinalizable(boolean paging)
>     throws VM_PragmaInline {
>   //-#else
>   public final static int moveToFinalizable() {
>   //-#endif
>     int cursor = 0;
>     int newFinalizeCount = 0;
> 
>     while (cursor < candidateEnd) {
>       VM_Address cand = candidate.get(cursor);
>       //-#if RVM_WITH_MARKING_COLLECT
>       boolean isFinalizable = Plan.isFinalizable(cand, paging);
>       //-#else
176a230
>       //-#endif
178a233,240
>         //-#if RVM_WITH_MARKING_COLLECT
>         if (!paging)
>           addLive(VM_Magic.addressAsObject(Plan.retainFinalizable(false,
>                                                                   cand)));
>         else
>           addLive(VM_Magic.addressAsObject(Plan.retainFinalizablePaging(false,
>                                                                         cand)));
>         //-#else
179a242
>         //-#endif
181a245,247
>         //-#if RVM_WITH_MARKING_COLLECT
>         candidate.set(cursor, Plan.getForwardedReference(false, cand));
>         //-#else
182a249
>         //-#endif
diff -bBr -I '$Id:' -I '\@version' -I '\@date' --exclude=CVS --exclude=Plan.java original.src/vm/memoryManagers/JMTk/utility/PreCopyEnumerator.java rvm/src/vm/memoryManagers/JMTk/utility/PreCopyEnumerator.java
34a35,37
>   //-#if RVM_WITH_MARKING_COLLECT
>   public void enumeratePointerLocation(boolean repeat, VM_Address location)
>   //-#else
35a39
>   //-#endif
36a41,43
>     //-#if RVM_WITH_MARKING_COLLECT
>     Plan.forwardObjectLocation(repeat, location);
>     //-#else
37a45
>     //-#endif
diff -bBr -I '$Id:' -I '\@version' -I '\@date' --exclude=CVS --exclude=Plan.java original.src/vm/memoryManagers/JMTk/utility/RawPageAllocator.java rvm/src/vm/memoryManagers/JMTk/utility/RawPageAllocator.java
42a43,45
>   //-#if RVM_WITH_MARKING_COLLECT
>   public RawPageAllocator(AlignedFreeListVMResource vmr, MemoryResource mr) {
>   //-#else
43a47
>   //-#endif
45a50,51
>     //-#if RVM_WITH_MARKING_COLLECT
>     //-#else
47a54
>     //-#endif
57a65,69
>     //-#if RVM_WITH_MARKING_COLLECT
>     VM_Address result = vmResource.acquire(pages, memoryResource);
>     PageMgr.usePages(result, result.add(Conversions.pagesToBytes(pages)));
>     return result;
>     //-#else
78a91
>     //-#endif
88a102,106
>     //-#if RVM_WITH_MARKING_COLLECT
>     int freed = vmResource.getSize(start);
>     vmResource.release(freed, start, memoryResource);
>     return freed;
>     //-#else
93a112
>     //-#endif
103a123,125
>     //-#if RVM_WITH_MARKING_COLLECT
>     return vmResource.getSize(start);
>     //-#else
104a127
>     //-#endif
110a134,137
>   //-#if RVM_WITH_MARKING_COLLECT
>   private MemoryResource memoryResource;
>   private AlignedFreeListVMResource vmResource;
>   //-#else
117a145
>   //-#endif
diff -bBr -I '$Id:' -I '\@version' -I '\@date' --exclude=CVS --exclude=Plan.java original.src/vm/memoryManagers/JMTk/utility/ReferenceProcessor.java rvm/src/vm/memoryManagers/JMTk/utility/ReferenceProcessor.java
94c94,95
<   private void addCandidate(Reference ref) throws VM_PragmaNoInline, VM_PragmaInterruptible {
---
>   private void addCandidate(Reference ref)
>     throws VM_PragmaNoInline, VM_PragmaInterruptible {
109a111,198
>   //-#if RVM_WITH_MARKING_COLLECT
>   /** In case of a repeat scan of the heap, update the locations of the
>    *  references.  All data should be maintained, as the objects must be
>    *  reachable
>    */
>   private final void update(int semantics, boolean paging)
>     throws VM_PragmaLogicallyUninterruptible {
>     if (TRACE) {
>       switch (semantics) {
>       case SOFT_SEMANTICS:
>         Log.writeln("Starting ReferenceProcessor.traverse(SOFT)");
>         break;
>       case WEAK_SEMANTICS:
>         Log.writeln("Starting ReferenceProcessor.traverse(WEAK)");
>         break;
>       case PHANTOM_SEMANTICS:
>         Log.writeln("Starting ReferenceProcessor.traverse(PHANTOM)");
>         break;
>       }
>     }
>     
>     int enqueued = 0;
>     VM_Address newHead = VM_Address.zero();
>     VM_Address prevReference = VM_Address.zero();
>     VM_Address reference = waitingListHead;
>     
>     while (!reference.isZero()) {
>       if (TRACE) {
>         Log.write("+++ old reference: "); Log.writeln(reference);
>       }
> 
>       // Dead references would already have been cleared, so we know
>       // reference should be reachable.
> 
>       // In case it isn't (for some odd reason)
>       makeAlive(true, reference, paging);
>         
>       VM_Address newReference = getForwardingAddress(true, reference, paging);
>       VM_Address oldReferent = VM_Interface.getReferent(reference);
> 
>       if (TRACE_DETAIL) {
>         Log.write("    new reference: "); Log.writeln(newReference);
>         Log.write(" old referENT: "); Log.writeln(oldReferent);
>       }
> 
>       // If the referent has been cleared, it should already have
>       // fallen out of the queue.  We will assert this as a means of checking
>       if (VM_Interface.VerifyAssertions)
>         VM_Interface._assert(!oldReferent.isZero());
>       
>       // Since the entry is still on the list, it must have been reachable.
>       // We need to keep it reachable
>       if (!Plan.isLive(oldReferent, paging))
>         makeAlive(true, oldReferent, paging);
> 
>       VM_Address newReferent = getForwardingAddress(true, oldReferent, paging);
> 
>       if (TRACE) {
>         Log.write(" new referENT: "); Log.writeln(newReferent);
>       }
>             
>       // Update the referent
>       VM_Interface.setReferent(newReference, newReferent);
> 
>       // Update 'next' pointer of the previous reference in the
>       // linked list of waiting references.
>       if (!prevReference.isZero()) {
>         VM_Interface.setNextReferenceAsAddress(prevReference,
>                                                newReference);
>       }
>             
>       prevReference = newReference;
>       if (newHead.isZero())
>         newHead = newReference;
>       
>       reference = VM_Interface.getNextReferenceAsAddress(reference);
>     }
> 
>     waitingListHead = newHead;
>     
>     if (!prevReference.isZero())
>       VM_Interface.setNextReferenceAsAddress(prevReference, VM_Address.zero());
> 
>     if (TRACE) {
>       Log.writeln("Ending ReferenceProcessor.traverse()");
>     }
>   }
>   //-#endif
118c207,213
<   private int traverse(int semantics) throws VM_PragmaLogicallyUninterruptible {
---
>   //-#if RVM_WITH_MARKING_COLLECT
>   private int traverse(int semantics, boolean paging)
>   //-#else
>   private int traverse(int semantics)
>   //-#endif
>     throws VM_PragmaLogicallyUninterruptible {
>     
149a245,247
>       //-#if RVM_WITH_MARKING_COLLECT
>       if (Plan.isLive(reference, paging)) {
>       //-#else
150a249
>       //-#endif
152c251,253
<         
---
>         //-#if RVM_WITH_MARKING_COLLECT
>         VM_Address newReference = getForwardingAddress(false, reference, paging);
>         //-#else
153a255
>         //-#endif
168a271,273
>           //-#if RVM_WITH_MARKING_COLLECT
>           if (semantics == PHANTOM_SEMANTICS && !Plan.isLive(oldReferent, paging))
>           //-#else
169a275
>           //-#endif
175a282,284
>               //-#if RVM_WITH_MARKING_COLLECT
>               makeAlive(false, oldReferent, paging);
>               //-#else
176a286,287
>               //-#endif
>               
188a300,302
>             //-#if RVM_WITH_MARKING_COLLECT
>             makeAlive(false, oldReferent, paging);
>             //-#else
189a304
>             //-#endif
191a307,315
>           //-#if RVM_WITH_MARKING_COLLECT
>           if (Plan.isLive(oldReferent, paging)) {
>             // Referent is still reachable in a way that is as strong
>             // as or stronger than the current reference level.
>             
>             
>             VM_Address newReferent = getForwardingAddress(false, oldReferent,
>                                                           paging);
>             //-#else
195a320
>               
196a322
>               //-#endif
278c404,412
< 
---
>   //-#if RVM_WITH_MARKING_COLLECT
>   private static void makeAlive(boolean repeat, VM_Address addr,
>                                 boolean paging) throws VM_PragmaInline {
>     if (!paging)
>       Plan.makeAlive(repeat, addr);
>     else
>       Plan.makeAlivePaging(repeat, addr);
>   }
>   //-#else
281a416
>   //-#endif
287a423,430
>   //-#if RVM_WITH_MARKING_COLLECT
>   private static VM_Address getForwardingAddress(boolean repeat,
>                                                  VM_Address addr,
>                                                  boolean paging)
>     throws VM_PragmaInline {
>     return Plan.getForwardedReference(repeat, addr);
>   }
>   //-#else
290a434
>   //-#endif
305,306c449,459
<   public static void addSoftCandidate(SoftReference ref) throws VM_PragmaInterruptible {
<     softReferenceProcessor.addCandidate(ref);
---
>   //-#if RVM_WITH_MARKING_COLLECT
>   public static void  updateSoftReferences(boolean paging) {
>     softReferenceProcessor.update(SOFT_SEMANTICS, paging);
>   }
> 
>   public static void  updateWeakReferences(boolean paging) {
>     weakReferenceProcessor.update(WEAK_SEMANTICS, paging);
>   }
> 
>   public static void  updatePhantomReferences(boolean paging) {
>     phantomReferenceProcessor.update(PHANTOM_SEMANTICS, paging);
308a462,474
>   public static void  moveSoftReferencesToReadyList(boolean paging) {
>     softReferenceProcessor.traverse(SOFT_SEMANTICS, paging);
>     clearSoftReferences = false;
>   }
> 
>   public static void  moveWeakReferencesToReadyList(boolean paging) {
>     weakReferenceProcessor.traverse(WEAK_SEMANTICS, paging);
>   }
> 
>   public static void  movePhantomReferencesToReadyList(boolean paging) {
>     phantomReferenceProcessor.traverse(PHANTOM_SEMANTICS, paging);
>   }
>   //-#else
313a480,494
>   public static void  moveWeakReferencesToReadyList() {
>     weakReferenceProcessor.traverse(WEAK_SEMANTICS);
>   }
> 
>   public static void  movePhantomReferencesToReadyList() {
>     phantomReferenceProcessor.traverse(PHANTOM_SEMANTICS);
>   }
>   //-#endif
> 
> 
>   public static void addSoftCandidate(SoftReference ref) throws VM_PragmaInterruptible {
>     softReferenceProcessor.addCandidate(ref);
>   }
> 
> 
318,320d498
<   public static void  moveWeakReferencesToReadyList() {
<     weakReferenceProcessor.traverse(WEAK_SEMANTICS);
<   }
326,329d503
<   public static void  movePhantomReferencesToReadyList() {
<     phantomReferenceProcessor.traverse(PHANTOM_SEMANTICS);
<   }
< 
diff -bBr -I '$Id:' -I '\@version' -I '\@date' --exclude=CVS --exclude=Plan.java original.src/vm/memoryManagers/JMTk/utility/Scan.java rvm/src/vm/memoryManagers/JMTk/utility/Scan.java
8a9
> import org.mmtk.vm.Constants;
16a18
> import com.ibm.JikesRVM.VM_Word;
27a30,113
>   //-#if RVM_WITH_MARKING_COLLECT
>   /**
>    * Scan a object, processing each pointer field encountered. 
>    *
>    * @param object The object to be scanned.
>    */
>   public static final void scanObject(boolean repeat, VM_Address object) 
>     throws VM_PragmaInline {
>     MMType type = VM_Interface.getObjectType(object);
>     if (!type.isDelegated()) {
>       int references = type.getReferences(object);
>       for (int i = 0; i < references; i++) {
>         VM_Address slot = type.getSlot(object, i);
>         Plan.traceObjectLocation(repeat, slot);
>       }
>     } else
>       VM_Interface.scanObject(object);
>   }
>   
>   public static final void scanObjectPaging(boolean repeat, VM_Address object) 
>     throws VM_PragmaInline {
>     MMType type = VM_Interface.getObjectType(object);
>     if (!type.isDelegated()) {
>       int references = type.getReferences(object);
>       for (int i = 0; i < references; i++) {
>         VM_Address slot = type.getSlot(object, i);
>         Plan.traceObjectLocationPaging(repeat, slot);
>       }
>     } else
>       VM_Interface.scanObject(object);
>   }
> 
>   public static final void scanObjectPartial(boolean repeat, VM_Address object) 
>     throws VM_PragmaInline {
>     MMType type = VM_Interface.getObjectType(object);
>     if (!type.isDelegated()) {
>       int references = type.getReferences(object);
>       int i = 0;
>       while (i < references) {
>         VM_Address slot = type.getSlot(object, i);
>         VM_Address page = slot.toWord().and(VM_Word.fromIntZeroExtend(Constants.BYTES_IN_PAGE - 1).not()).toAddress();
>         if (!PageMgr.isDiscarded(page)) {
>           do {
>             Plan.traceObjectLocationPaging(repeat, slot);
>             i++;
>             if (i == references)
>               break;
>             slot = type.getSlot(object, i);
>           } while (slot.GE(page));
>         } else {
>           do {
>             i++;
>             if (i == references)
>               break;
>             slot = type.getSlot(object, i);
>           } while (slot.GE(page));
>         }
>       }
>     } else
>       VM_Interface.scanObject(object);
>   }
>   
>   /**
>    * Enumerate the pointers in an object, calling back to a given plan
>    * for each pointer encountered. <i>NOTE</i> that only the "real"
>    * pointer fields are enumerated, not the TIB.
>    *
>    * @param object The object to be scanned.
>    * @param enum the Enumerate object through which the callback
>    * is made
>    */
>   public static final void enumeratePointers(VM_Address object, Enumerate enum,
>                                        boolean repeat) 
>     throws VM_PragmaInline {
>     MMType type = VM_Interface.getObjectType(object);
>     if (!type.isDelegated()) {
>       int references = type.getReferences(object);
>       for (int i = 0; i < references; i++) {
>         VM_Address slot = type.getSlot(object, i);
>         enum.enumeratePointerLocation(repeat, slot);
>       }
>     }
>   }
>   //-#else
65a152
>   //-#endif
diff -bBr -I '$Id:' -I '\@version' -I '\@date' --exclude=CVS --exclude=Plan.java original.src/vm/memoryManagers/JMTk/utility/TraceGenerator.java rvm/src/vm/memoryManagers/JMTk/utility/TraceGenerator.java
192c191,192
<     VM_Offset traceOffset = TraceInterface.adjustSlotOffset(isScalar, src, slot);
---
>     VM_Offset traceOffset = TraceInterface.adjustSlotOffset(isScalar, src,
>                                                             slot);
375a376,377
>    	//-#if RVM_WITH_MARKING_COLLECT
>    	//-#else
376a379
>   	//-#endif
diff -bBr -I '$Id:' -I '\@version' -I '\@date' --exclude=CVS --exclude=Plan.java original.src/vm/memoryManagers/JMTk/utility/ValueOptions.dat rvm/src/vm/memoryManagers/JMTk/utility/ValueOptions.dat
90a91,95
> V timingStartCollect int 99
> Number of forced collections before starting the timing numbers
> if (val < 0) VM_Interface.sysFail("Unreasonable verbosity level " + val);
> 
> 
diff -bBr -I '$Id:' -I '\@version' -I '\@date' --exclude=CVS --exclude=Plan.java original.src/vm/memoryManagers/JMTk/utility/VMResource.java rvm/src/vm/memoryManagers/JMTk/utility/VMResource.java
209a210,228
>   //-#if RVM_WITH_EXP_MERGE
>   protected void acquireHelp (VM_Address start, int pageRequest, byte space_) {
>     if (!VM_Interface.runningVM()) VM_Interface.sysFail("VMResource.acquireHelp called before VM is running");
>     if (spaceTable == null) 
>         VM_Interface.sysFail("VMResource.acquireHelp called when spaceTable is still empty");
>     int pageStart = Conversions.addressToPages(start);
>     // Log.write("Acquiring pages "); Log.write(pageStart);
>     // Log.write(" to "); Log.write(pageStart + pageRequest - 1);
>     // Log.write(" for space "); Log.writeln(space);
>     for (int i=0; i<pageRequest; i++) {
> //       if (VM_Interface.VerifyAssertions) 
> //           VM_Interface._assert(spaceTable[pageStart+i] == Plan.UNUSED_SPACE 
> //                                // Suspect - FreeListVM
> //                                || spaceTable[pageStart+i] == space); 
>       spaceTable[pageStart+i] = space_;
>     }
>   }
>   //-#endif
> 
252c271
<   final private byte space;
---
>   final protected byte space;
diff -bBr -I '$Id:' -I '\@version' -I '\@date' --exclude=CVS --exclude=Plan.java original.src/vm/memoryManagers/JMTk/vmInterface/DebugUtil.java rvm/src/vm/memoryManagers/JMTk/vmInterface/DebugUtil.java
92a93,95
>   //-#if RVM_WITH_MARKING_COLLECT
>   public static boolean validObject(boolean repeat, Object ref)
>   //-#else
93a97
>   //-#endif
94a99,101
>     //-#if RVM_WITH_MARKING_COLLECT
>     return validRef(repeat, VM_Magic.objectAsAddress(ref));
>     //-#else
95a103
>     //-#endif
97a106,108
>   //-#if RVM_WITH_MARKING_COLLECT
>   public static boolean validRef(boolean repeat, VM_Address ref)
>   //-#else
98a110
>   //-#endif
108a121,124
>       //-#if RVM_WITH_MARKING_COLLECT
>       if (VM_AllocatorHeader.isForwarded(repeat, ref, true) ||
>           VM_AllocatorHeader.isBeingForwarded(repeat, ref, true)) {
>       //-#else
110a127
>       //-#endif
diff -bBr -I '$Id:' -I '\@version' -I '\@date' --exclude=CVS --exclude=Plan.java original.src/vm/memoryManagers/JMTk/vmInterface/MM_Interface.java rvm/src/vm/memoryManagers/JMTk/vmInterface/MM_Interface.java
374a375,377
>     //-#if RVM_WITH_MARKING_COLLECT
>     return DebugUtil.validRef(false, ref);
>     //-#else
375a379
>     //-#endif
535c539
<     if (BYTES_IN_PARTICLE > BYTES_IN_INT)
---
>     if (BYTES_IN_PARTICLE > BYTES_IN_INT) {
536a541
>     }
685a691,695
>     if (VM.VerifyAssertions)
>       VM._assert(fullSize >= 8192);
>     //-#if RVM_WITH_MARKING_COLLECT
>     VM_Address fullRegion = VM_Interface.getPlan().alloc(fullSize, false, logAlignment, Plan.IMMORTAL_SPACE, advice);
>     //-#else
686a697
>     //-#endif
802a814,825
>   //-#if RVM_WITH_MARKING_COLLECT
>   /**
>    * Processes an object during the tracing phase of a collection.
>    *
>    * @param object the address of the object to be processed
>    * @return The address of the object after processing (it may have
>    * been moved in the course of processing).
>    */
>   public static VM_Address processPtrValue(boolean repeat, VM_Address object)
>     throws VM_PragmaUninterruptible, VM_PragmaInline {
>     return Plan.traceObject(repeat, object);
>   }
806a830,840
>    * @param location the address of a reference to the object to be
>    * processed
>    */
>   public static void processPtrLocation(boolean repeat, VM_Address location)
>     throws VM_PragmaUninterruptible, VM_PragmaInline {
>     Plan.traceObjectLocation(repeat, location);
>   }
>   //-#else
>   /**
>    * Processes an object during the tracing phase of a collection.
>    *
826c860
< 
---
>   //-#endif
diff -bBr -I '$Id:' -I '\@version' -I '\@date' --exclude=CVS --exclude=Plan.java original.src/vm/memoryManagers/JMTk/vmInterface/Monitor.java rvm/src/vm/memoryManagers/JMTk/vmInterface/Monitor.java
40a41,43
>     //-#if RVM_WITH_MARKING_COLLECT
>     VM_Interface.quitPageMgr();
>     //-#endif
diff -bBr -I '$Id:' -I '\@version' -I '\@date' --exclude=CVS --exclude=Plan.java original.src/vm/memoryManagers/JMTk/vmInterface/VM_Interface.java rvm/src/vm/memoryManagers/JMTk/vmInterface/VM_Interface.java
58a59
> import com.ibm.JikesRVM.VM_SysCall;
466a468,469
>       if (Options.timeSecondRun)
>         Plan.harnessBegin();
482a486,488
>     if (Options.timeSecondRun && (why == EXTERNAL_GC_TRIGGER))
>       Plan.postGCHarnessBegin();
>     
704c709
<       if (tib == null || VM_ObjectModel.getObjectType(tib) != VM_Type.JavaLangObjectArrayType) {
---
>       if (tib == null || VM_Magic.objectAsAddress(tib).GE(VM_Address.fromInt(0x80000000)) || VM_Magic.objectAsAddress(tib).LT(bootImageAddress) || (VM_ObjectModel.getArrayLength(tib) < 0)) {
772a778,817
>   //-#if RVM_WITH_MARKING_COLLECT
>   public static void preCopyGCInstances(boolean repeat) throws VM_PragmaInline {
>     /* pre-copy all thread objects in parallel */
>     if (rendezvous(4201) == 1) /* one thread forwards the threads object */
>       enumeratePointers(VM_Scheduler.threads, preCopyEnum, repeat);
>     rendezvous(4202);
>     while (true) {
>       int threadIndex = threadCounter.increment();
>       if (threadIndex >= VM_Scheduler.threads.length) break;
>       VM_Thread thread = VM_Scheduler.threads[threadIndex];
>       if (thread != null) {
>         enumeratePointers(thread, preCopyEnum, repeat);
>         enumeratePointers(thread.contextRegisters, preCopyEnum, repeat);
>         enumeratePointers(thread.hardwareExceptionRegisters, preCopyEnum, repeat);
>         if (thread.jniEnv != null) {
>           // Right now, jniEnv are Java-visible objects (not C-visible)
>           // if (VM.VerifyAssertions)
>           //   VM._assert(Plan.willNotMove(VM_Magic.objectAsAddress(thread.jniEnv)));
>           enumeratePointers(thread.jniEnv, preCopyEnum, repeat);
>         }
>       }
>     }    
>     rendezvous(4203);
>   }
>   
>   /**
>    * Enumerate the pointers in an object, calling back to a given plan
>    * for each pointer encountered. <i>NOTE</i> that only the "real"
>    * pointer fields are enumerated, not the TIB.
>    *
>    * @param object The object to be scanned.
>    * @param enum the Enumerate object through which the callback
>    * is made
>    */
>   private static void enumeratePointers(Object object, Enumerate enum,
>                                         boolean repeat) 
>     throws VM_PragmaUninterruptible, VM_PragmaInline {
>     Scan.enumeratePointers(VM_Magic.objectAsAddress(object), enum, repeat);
>   }
>   //-#else
809a855
>   //-#endif
984a1031,1059
>   //-#if RVM_WITH_MARKING_COLLECT
>   public static final VM_Address getObjectHeadPointer(VM_Address ref,
>                                                       boolean isScalar)
>     throws VM_PragmaInline {
>     return VM_ObjectModel.getObjectHeadPointer(ref, isScalar);
>   }
> 
>   public static final VM_Address getObjectEnd(VM_Address obj,
>                                               boolean isScalar) 
>     throws VM_PragmaInline {
>     return VM_ObjectModel.getObjectEnd(obj, isScalar);
>   }
> 
>   public static final void returnPages(int discardPgs) {
>     VM_SysCall.sysReturnPages(discardPgs);
>   }
>   
>   public static final void quitPageMgr() {
>     VM_SysCall.sysQuitPageMgr();
>   }
> 
>   public static final void pagingStart() {
>     VM_SysCall.sysPagingStart();
>   }
> 
>   public static final void pagingEnd() {
>     VM_SysCall.sysPagingEnd();
>   }
> 
