From: <rg...@us...> - 2008-07-23 04:49:20
|
Revision: 14767 http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=14767&view=rev Author: rgarner Date: 2008-07-23 04:49:17 +0000 (Wed, 23 Jul 2008) Log Message: ----------- MMTk harness: add trace option for 'available byte', and improve memory trace capability. Modified Paths: -------------- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ObjectModel.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Trace.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/Trace.java rvmroot/trunk/MMTk/harness/vmmagic/org/vmmagic/unboxed/SimulatedMemory.java Modified: rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ObjectModel.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ObjectModel.java 2008-07-22 21:42:29 UTC (rev 14766) +++ rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ObjectModel.java 2008-07-23 04:49:17 UTC (rev 14767) @@ -537,6 +537,10 @@ * @param val the new value of the byte */ public void writeAvailableByte(ObjectReference object, byte val) { + if (Trace.isEnabled(Item.AVBYTE)) { + byte old = object.toAddress().loadByte(STATUS_OFFSET); + Trace.trace(Item.AVBYTE,"%s.gcbyte:%d->%d", object,old,val); + } object.toAddress().store(val, STATUS_OFFSET); } @@ -557,6 +561,10 @@ * @param val the new value of the bits */ public void writeAvailableBitsWord(ObjectReference object, Word val) { + if (Trace.isEnabled(Item.AVBYTE)) { + byte old = object.toAddress().loadByte(STATUS_OFFSET); + Trace.trace(Item.AVBYTE,"%s.gcbyte:%d->%d", object,old,val.and(Word.fromIntZeroExtend(0xFF)).toInt()); + } object.toAddress().store(val, STATUS_OFFSET); } Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Trace.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Trace.java 2008-07-22 21:42:29 UTC (rev 14766) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Trace.java 2008-07-23 04:49:17 UTC (rev 14767) @@ -15,7 +15,7 @@ import java.util.EnumSet; public class Trace { - public enum Item { ALLOC, CALL, OBJECT, INTRINSIC, LOAD, STORE, HASH, ENV, ROOTS, COLLECT } + public enum Item { ALLOC, CALL, OBJECT, INTRINSIC, LOAD, STORE, HASH, ENV, ROOTS, COLLECT, AVBYTE } private static EnumSet<Item> enabled = EnumSet.noneOf(Item.class); @@ -23,6 +23,15 @@ //enable(Item.ALLOC); } + public static String[] itemNames() { + String[] result = new String[Item.values().length+1]; + result[0] = "NONE"; + for (int i=0; i < Item.values().length; i++) { + result[i+1] = Item.values()[i].toString(); + } + return result; + } + public static void enable(String item) { enable(Item.valueOf(item)); } @@ -37,7 +46,15 @@ public static void trace(Item item, String pattern, Object...args) { if (isEnabled(item)) { - System.out.printf("["+item+"] "+pattern+"%n",args); + printf(prefix(item) + pattern + "%n",args); } } + + public static String prefix(Item item) { + return "["+item+"] "; + } + + public static void printf(String pattern, Object...args) { + System.err.printf(pattern,args); + } } Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/Trace.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/Trace.java 2008-07-22 21:42:29 UTC (rev 14766) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/Trace.java 2008-07-23 04:49:17 UTC (rev 14767) @@ -24,19 +24,8 @@ public Trace() { super(Harness.options, "Trace", "Harness debugging trace options", - new String[] { - "NONE", - "CALL", - "ALLOC", - "OBJECT", - "INTRINSIC", - "LOAD", - "STORE", - "HASH", - "ENV", - "ROOTS", - "COLLECT"}, - "NONE"); + org.mmtk.harness.lang.Trace.itemNames(), + "NONE"); } public void apply() { Modified: rvmroot/trunk/MMTk/harness/vmmagic/org/vmmagic/unboxed/SimulatedMemory.java =================================================================== --- rvmroot/trunk/MMTk/harness/vmmagic/org/vmmagic/unboxed/SimulatedMemory.java 2008-07-22 21:42:29 UTC (rev 14766) +++ rvmroot/trunk/MMTk/harness/vmmagic/org/vmmagic/unboxed/SimulatedMemory.java 2008-07-23 04:49:17 UTC (rev 14767) @@ -48,10 +48,33 @@ private static final Offset ZERO = Offset.zero(); private static final ArrayList<Address> watches = new ArrayList<Address>(); + /** + * Watch mutations to an address (watches 4 byte values) + * @param watchAddress + */ public static void addWatch(Address watchAddress) { watches.add(watchAddress); } + /** + * Watch an address range ('bytes' bytes starting from watchAddress). + * @param watchAddress + * @param bytes + */ + public static void addWatch(Address watchAddress, int bytes) { + while (bytes > 0) { + watches.add(watchAddress); + bytes -= BYTES_IN_WORD; + watchAddress = watchAddress.plus(BYTES_IN_WORD); + } + } + + /** + * Return the page corresponding to a specific (address+offset) value + * @param address + * @param offset + * @return + */ public static MemoryPage getPage(Address address, Offset offset) { int page = (address.value + offset.value) >>> LOG_BYTES_IN_PAGE; return getPage(page); @@ -300,12 +323,14 @@ ArrayList<Integer> watches = new ArrayList<Integer>(); for(Address addr: SimulatedMemory.watches) { if ((addr.value >>> LOG_BYTES_IN_PAGE) == page) { - watches.add(new Integer(getIndex(addr, ZERO))); + int index = getIndex(addr, ZERO); + watches.add(index); + System.err.println("Watching address "+addr+" (index "+index+" in page "+page+")"); } } watch = new int[watches.size()]; for(int i=0; i < watches.size(); i++) { - watch[i] = (int)watches.get(i); + watch[i] = watches.get(i); } } @@ -421,6 +446,12 @@ */ private int read(int index) { int value = data[index]; + for(int i=0; i < watch.length; i++) { + if (watch[i] == index) { + System.err.println(Address.formatInt((page << LOG_BYTES_IN_PAGE) + (index<<LOG_BYTES_IN_WORD)) + "= " + + Address.formatInt(data[index])); + } + } return value; } @@ -430,7 +461,7 @@ private void write(int index, int value) { for(int i=0; i < watch.length; i++) { if (watch[i] == index) { - System.err.println(Address.formatInt((page << LOG_BYTES_IN_PAGE) + index) + ": " + + System.err.println(Address.formatInt((page << LOG_BYTES_IN_PAGE) + (index<<LOG_BYTES_IN_WORD)) + ": " + Address.formatInt(data[index]) + " -> " + Address.formatInt(value)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cap...@us...> - 2008-07-23 20:12:41
|
Revision: 14780 http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=14780&view=rev Author: captain5050 Date: 2008-07-23 20:12:39 +0000 (Wed, 23 Jul 2008) Log Message: ----------- Fix javadoc warnings. Modified Paths: -------------- rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/ScanThread.java rvmroot/trunk/MMTk/src/org/mmtk/policy/MarkSweepLocal.java Modified: rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/ScanThread.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/ScanThread.java 2008-07-23 19:55:08 UTC (rev 14779) +++ rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/ScanThread.java 2008-07-23 20:12:39 UTC (rev 14780) @@ -645,8 +645,6 @@ * the reference is invalid, dump stack and die. * * @param refaddr The address of the reference in question. - * @param verbosity The level of verbosity to be used when - * performing the scan. */ static void checkReference(Address refaddr) { ObjectReference ref = refaddr.loadObjectReference(); Modified: rvmroot/trunk/MMTk/src/org/mmtk/policy/MarkSweepLocal.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/policy/MarkSweepLocal.java 2008-07-23 19:55:08 UTC (rev 14779) +++ rvmroot/trunk/MMTk/src/org/mmtk/policy/MarkSweepLocal.java 2008-07-23 20:12:39 UTC (rev 14780) @@ -36,7 +36,7 @@ * case when marking, while also allowing for fast sweeping, with * minimal space overhead (2 bits per object). * - * @see SegregatedFreeList + * @see org.mmtk.utility.alloc.SegregatedFreeList * @see MarkSweepSpace */ @Uninterruptible This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dfr...@us...> - 2008-07-28 05:50:13
|
Revision: 14809 http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=14809&view=rev Author: dframpton-oss Date: 2008-07-28 05:50:08 +0000 (Mon, 28 Jul 2008) Log Message: ----------- Improvements to the sanity checker. Make finding the root set explicitly parallel, and the sanity trace and check explicitly single-threaded. Increase the sanity table size to cope with all dacapo benchmarks. Make it more lightweight to code for individual collectors by making sanityExpectedRC a virtual method of Plan. Modified Paths: -------------- rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Scanning.java rvmroot/trunk/MMTk/src/org/mmtk/plan/CollectorContext.java rvmroot/trunk/MMTk/src/org/mmtk/plan/Plan.java rvmroot/trunk/MMTk/src/org/mmtk/plan/Simple.java rvmroot/trunk/MMTk/src/org/mmtk/plan/SimpleCollector.java rvmroot/trunk/MMTk/src/org/mmtk/plan/SimpleMutator.java rvmroot/trunk/MMTk/src/org/mmtk/plan/StopTheWorld.java rvmroot/trunk/MMTk/src/org/mmtk/plan/copyms/CopyMS.java rvmroot/trunk/MMTk/src/org/mmtk/plan/copyms/CopyMSCollector.java rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/Gen.java rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/GenCollector.java rvmroot/trunk/MMTk/src/org/mmtk/plan/markcompact/MC.java rvmroot/trunk/MMTk/src/org/mmtk/plan/markcompact/MCCollector.java rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/RCBase.java rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/RCBaseCollector.java rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyimmix/StickyImmixCollector.java rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyms/StickyMS.java rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyms/StickyMSCollector.java rvmroot/trunk/MMTk/src/org/mmtk/utility/sanitychecker/SanityChecker.java rvmroot/trunk/MMTk/src/org/mmtk/utility/sanitychecker/SanityCheckerLocal.java rvmroot/trunk/MMTk/src/org/mmtk/utility/sanitychecker/SanityDataTable.java rvmroot/trunk/MMTk/src/org/mmtk/utility/sanitychecker/SanityTraceLocal.java Added Paths: ----------- rvmroot/trunk/MMTk/src/org/mmtk/utility/sanitychecker/SanityRootTraceLocal.java Removed Paths: ------------- rvmroot/trunk/MMTk/src/org/mmtk/plan/copyms/CopyMSSanityCheckerLocal.java rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/GenSanityCheckerLocal.java rvmroot/trunk/MMTk/src/org/mmtk/plan/markcompact/MCSanityCheckerLocal.java rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/RCSanityCheckerLocal.java rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyimmix/StickyImmixSanityCheckerLocal.java rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyms/StickyMSSanityCheckerLocal.java Modified: rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Scanning.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Scanning.java 2008-07-27 23:23:32 UTC (rev 14808) +++ rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Scanning.java 2008-07-28 05:50:08 UTC (rev 14809) @@ -324,9 +324,9 @@ /* identify this thread as a root */ trace.processRootEdge(Magic.objectAsAddress(Scheduler.threads).plus(threadIndex<<LOG_BYTES_IN_ADDRESS), false); } + /* flush out any remset entries generated during the above activities */ ActivePlan.flushRememberedSets(); - CollectorThread.gcBarrier.rendezvous(4200); } /** Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/CollectorContext.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/CollectorContext.java 2008-07-27 23:23:32 UTC (rev 14808) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/CollectorContext.java 2008-07-28 05:50:08 UTC (rev 14809) @@ -71,14 +71,17 @@ * Instance fields */ /** Unique collector identifier */ - protected int id = VM.activePlan.registerCollector(this); + protected final int id = VM.activePlan.registerCollector(this); /** Per-collector allocator into the immortal space */ - protected BumpPointer immortal = new ImmortalLocal(Plan.immortalSpace); + protected final BumpPointer immortal = new ImmortalLocal(Plan.immortalSpace); /** Used for aborting concurrent phases pre-empted by stop the world collection */ protected boolean resetConcurrentWork; + /** Used for sanity checking */ + protected final SanityCheckerLocal sanityLocal = new SanityCheckerLocal(); + /**************************************************************************** * * Initialization Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/Plan.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/Plan.java 2008-07-27 23:23:32 UTC (rev 14808) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/Plan.java 2008-07-28 05:50:08 UTC (rev 14809) @@ -375,6 +375,19 @@ } /** + * Return the expected reference count. For non-reference counting + * collectors this becomes a true/false relationship. + * + * @param object The object to check. + * @param sanityRootRC The number of root references to the object. + * @return The expected (root excluded) reference count. + */ + public int sanityExpectedRC(ObjectReference object, int sanityRootRC) { + Space space = Space.getSpaceForObject(object); + return space.isReachable(object) ? SanityChecker.ALIVE : SanityChecker.DEAD; + } + + /** * @return True is a stress test GC is required */ @Inline Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/Simple.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/Simple.java 2008-07-27 23:23:32 UTC (rev 14808) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/Simple.java 2008-07-28 05:50:08 UTC (rev 14809) @@ -74,6 +74,7 @@ public static final short SANITY_SET_POSTGC = Phase.createSimple("sanity-setpost", null); public static final short SANITY_PREPARE = Phase.createSimple("sanity-prepare", null); public static final short SANITY_ROOTS = Phase.createSimple("sanity-roots", null); + public static final short SANITY_COPY_ROOTS = Phase.createSimple("sanity-copy-roots", null); public static final short SANITY_BUILD_TABLE = Phase.createSimple("sanity-build-table", null); public static final short SANITY_CHECK_TABLE = Phase.createSimple("sanity-check-table", null); public static final short SANITY_RELEASE = Phase.createSimple("sanity-release", null); @@ -93,11 +94,12 @@ Phase.scheduleComplex (prepareStacks), Phase.scheduleCollector (SANITY_ROOTS), Phase.scheduleGlobal (SANITY_ROOTS), - Phase.scheduleCollector (SANITY_BUILD_TABLE)); + Phase.scheduleCollector (SANITY_COPY_ROOTS), + Phase.scheduleGlobal (SANITY_BUILD_TABLE)); /** Validate a sanity table */ protected static final short sanityCheckPhase = Phase.createComplex("sanity-check", null, - Phase.scheduleCollector (SANITY_CHECK_TABLE), + Phase.scheduleGlobal (SANITY_CHECK_TABLE), Phase.scheduleCollector (SANITY_RELEASE), Phase.scheduleGlobal (SANITY_RELEASE)); @@ -175,8 +177,7 @@ // CHECKSTYLE:ON - /* Basic GC sanity checker */ - private SanityChecker sanityChecker = new SanityChecker(); + private final SanityChecker sanityChecker = new SanityChecker(); /** * The current collection attempt. @@ -190,7 +191,7 @@ /** * @return Return the current sanity checker. */ - public SanityChecker getSanityChecker() { + public final SanityChecker getSanityChecker() { return sanityChecker; } @@ -264,8 +265,7 @@ return; } - if (Options.sanityCheck.getValue() && - getSanityChecker().collectionPhase(phaseId)) { + if (Options.sanityCheck.getValue() && getSanityChecker().collectionPhase(phaseId)) { return; } Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/SimpleCollector.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/SimpleCollector.java 2008-07-27 23:23:32 UTC (rev 14808) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/SimpleCollector.java 2008-07-28 05:50:08 UTC (rev 14809) @@ -15,7 +15,6 @@ import org.mmtk.utility.Finalizer; import org.mmtk.utility.Log; import org.mmtk.utility.options.Options; -import org.mmtk.utility.sanitychecker.SanityCheckerLocal; import org.mmtk.vm.VM; @@ -39,9 +38,6 @@ * Instance fields */ - /** Basic sanity checker */ - private SanityCheckerLocal sanityChecker = new SanityCheckerLocal(); - /**************************************************************************** * * Collection @@ -157,8 +153,7 @@ return; } - if (Options.sanityCheck.getValue() && - getSanityChecker().collectionPhase(phaseId, primary)) { + if (Options.sanityCheck.getValue() && sanityLocal.collectionPhase(phaseId, primary)) { return; } @@ -177,9 +172,4 @@ private static Simple global() { return (Simple) VM.activePlan.global(); } - - /** @return The current sanity checker. */ - public SanityCheckerLocal getSanityChecker() { - return sanityChecker; - } } Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/SimpleMutator.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/SimpleMutator.java 2008-07-27 23:23:32 UTC (rev 14808) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/SimpleMutator.java 2008-07-28 05:50:08 UTC (rev 14809) @@ -50,6 +50,7 @@ if (!Plan.stacksPrepared()) { VM.collection.prepareMutator(this); } + flushRememberedSets(); return; } Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/StopTheWorld.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/StopTheWorld.java 2008-07-27 23:23:32 UTC (rev 14808) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/StopTheWorld.java 2008-07-28 05:50:08 UTC (rev 14809) @@ -36,14 +36,14 @@ /** Build and validate a sanity table */ protected static final short preSanityPhase = Phase.createComplex("pre-sanity", null, + Phase.scheduleGlobal (SANITY_SET_PREGC), Phase.scheduleComplex (sanityBuildPhase), - Phase.scheduleGlobal (SANITY_SET_PREGC), Phase.scheduleComplex (sanityCheckPhase)); /** Build and validate a sanity table */ protected static final short postSanityPhase = Phase.createComplex("post-sanity", null, + Phase.scheduleGlobal (SANITY_SET_POSTGC), Phase.scheduleComplex (sanityBuildPhase), - Phase.scheduleGlobal (SANITY_SET_POSTGC), Phase.scheduleComplex (sanityCheckPhase)); // CHECKSTYLE:ON Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/copyms/CopyMS.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/copyms/CopyMS.java 2008-07-27 23:23:32 UTC (rev 14808) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/copyms/CopyMS.java 2008-07-28 05:50:08 UTC (rev 14809) @@ -15,10 +15,13 @@ import org.mmtk.plan.*; import org.mmtk.policy.CopySpace; import org.mmtk.policy.MarkSweepSpace; +import org.mmtk.policy.Space; import org.mmtk.utility.heap.VMRequest; import org.mmtk.utility.options.Options; +import org.mmtk.utility.sanitychecker.SanityChecker; import org.vmmagic.pragma.*; +import org.vmmagic.unboxed.ObjectReference; /** * This class implements the global state of a full-heap collector @@ -173,6 +176,25 @@ } /** + * Return the expected reference count. For non-reference counting + * collectors this becomes a true/false relationship. + * + * @param object The object to check. + * @param sanityRootRC The number of root references to the object. + * @return The expected (root excluded) reference count. + */ + public int sanityExpectedRC(ObjectReference object, int sanityRootRC) { + Space space = Space.getSpaceForObject(object); + + // Nursery + if (space == CopyMS.nurserySpace) { + return SanityChecker.DEAD; + } + + return space.isReachable(object) ? SanityChecker.ALIVE : SanityChecker.DEAD; + } + + /** * Register specialized methods. */ @Interruptible Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/copyms/CopyMSCollector.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/copyms/CopyMSCollector.java 2008-07-27 23:23:32 UTC (rev 14808) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/copyms/CopyMSCollector.java 2008-07-28 05:50:08 UTC (rev 14809) @@ -14,7 +14,6 @@ import org.mmtk.plan.*; import org.mmtk.policy.MarkSweepLocal; -import org.mmtk.utility.sanitychecker.SanityCheckerLocal; import org.mmtk.vm.VM; import org.vmmagic.pragma.*; @@ -44,9 +43,6 @@ private MarkSweepLocal mature; private CopyMSTraceLocal trace; - // Sanity checking - private CopyMSSanityCheckerLocal sanityChecker; - /**************************************************************************** * * Initialization @@ -58,7 +54,6 @@ public CopyMSCollector() { mature = new MarkSweepLocal(CopyMS.msSpace); trace = new CopyMSTraceLocal(global().trace); - sanityChecker = new CopyMSSanityCheckerLocal(); } /**************************************************************************** @@ -145,11 +140,6 @@ return (CopyMS) VM.activePlan.global(); } - /** @return Return the current sanity checker. */ - public SanityCheckerLocal getSanityChecker() { - return sanityChecker; - } - /** @return The current trace instance. */ public final TraceLocal getCurrentTrace() { return trace; } Deleted: rvmroot/trunk/MMTk/src/org/mmtk/plan/copyms/CopyMSSanityCheckerLocal.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/copyms/CopyMSSanityCheckerLocal.java 2008-07-27 23:23:32 UTC (rev 14808) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/copyms/CopyMSSanityCheckerLocal.java 2008-07-28 05:50:08 UTC (rev 14809) @@ -1,47 +0,0 @@ -/* - * This file is part of the Jikes RVM project (http://jikesrvm.org). - * - * This file is licensed to You under the Common Public License (CPL); - * You may not use this file except in compliance with the License. You - * may obtain a copy of the License at - * - * http://www.opensource.org/licenses/cpl1.0.php - * - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. - */ -package org.mmtk.plan.copyms; - -import org.mmtk.policy.Space; - -import org.mmtk.utility.sanitychecker.SanityChecker; -import org.mmtk.utility.sanitychecker.SanityCheckerLocal; - -import org.vmmagic.pragma.*; -import org.vmmagic.unboxed.*; - -/** - * This class performs sanity checks for CopyMS collectors. - */ -@Uninterruptible public class CopyMSSanityCheckerLocal extends SanityCheckerLocal { - - /** - * Return the expected reference count. For non-reference counting - * collectors this becomes a true/false relationship. - * - * @param object The object to check. - * @param sanityRootRC The number of root references to the object. - * @return The expected (root excluded) reference count. - */ - protected int sanityExpectedRC(ObjectReference object, int sanityRootRC) { - Space space = Space.getSpaceForObject(object); - - // Nursery - if (space == CopyMS.nurserySpace) { - return global().preGCSanity() ? SanityChecker.UNSURE : SanityChecker.DEAD; - } - - return space.isReachable(object) ? SanityChecker.ALIVE : SanityChecker.DEAD; - } - -} Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/Gen.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/Gen.java 2008-07-27 23:23:32 UTC (rev 14808) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/Gen.java 2008-07-28 05:50:08 UTC (rev 14809) @@ -20,9 +20,11 @@ import org.mmtk.utility.heap.VMRequest; import org.mmtk.utility.Log; import org.mmtk.utility.options.Options; +import org.mmtk.utility.sanitychecker.SanityChecker; import org.mmtk.utility.statistics.*; import org.mmtk.vm.Collection; +import org.mmtk.vm.VM; import org.vmmagic.pragma.*; import org.vmmagic.unboxed.*; @@ -387,6 +389,36 @@ } /** + * Return the expected reference count. For non-reference counting + * collectors this becomes a true/false relationship. + * + * @param object The object to check. + * @param sanityRootRC The number of root references to the object. + * @return The expected (root excluded) reference count. + */ + public int sanityExpectedRC(ObjectReference object, int sanityRootRC) { + Space space = Space.getSpaceForObject(object); + + // Nursery + if (space == Gen.nurserySpace) { + return SanityChecker.DEAD; + } + + // Immortal spaces + if (space == Gen.immortalSpace || space == Gen.vmSpace) { + return space.isReachable(object) ? SanityChecker.ALIVE : SanityChecker.DEAD; + } + + // Mature space (nursery collection) + if (VM.activePlan.global().isCurrentGCNursery()) { + return SanityChecker.UNSURE; + } + + // Mature space (full heap collection) + return space.isReachable(object) ? SanityChecker.ALIVE : SanityChecker.DEAD; + } + + /** * Register specialized methods. */ @Interruptible Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/GenCollector.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/GenCollector.java 2008-07-27 23:23:32 UTC (rev 14808) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/GenCollector.java 2008-07-28 05:50:08 UTC (rev 14809) @@ -14,7 +14,6 @@ import org.mmtk.plan.*; import org.mmtk.utility.deque.*; -import org.mmtk.utility.sanitychecker.SanityCheckerLocal; import org.mmtk.vm.VM; @@ -46,9 +45,6 @@ protected final AddressDeque remset; protected final AddressPairDeque arrayRemset; - // Sanity checking - private GenSanityCheckerLocal sanityChecker; - /**************************************************************************** * * Initialization @@ -66,7 +62,6 @@ arrayRemset = new AddressPairDeque(global().arrayRemsetPool); remset = new AddressDeque("remset", global().remsetPool); nurseryTrace = new GenNurseryTraceLocal(global().nurseryTrace, this); - sanityChecker = new GenSanityCheckerLocal(); } /**************************************************************************** @@ -136,11 +131,6 @@ return nurseryTrace; } - /** @return Return the current sanity checker. */ - public SanityCheckerLocal getSanityChecker() { - return sanityChecker; - } - /** @return The trace to use when collecting the mature space */ public abstract TraceLocal getFullHeapTrace(); Deleted: rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/GenSanityCheckerLocal.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/GenSanityCheckerLocal.java 2008-07-27 23:23:32 UTC (rev 14808) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/GenSanityCheckerLocal.java 2008-07-28 05:50:08 UTC (rev 14809) @@ -1,60 +0,0 @@ -/* - * This file is part of the Jikes RVM project (http://jikesrvm.org). - * - * This file is licensed to You under the Common Public License (CPL); - * You may not use this file except in compliance with the License. You - * may obtain a copy of the License at - * - * http://www.opensource.org/licenses/cpl1.0.php - * - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. - */ -package org.mmtk.plan.generational; - -import org.mmtk.policy.Space; - -import org.mmtk.utility.sanitychecker.SanityChecker; -import org.mmtk.utility.sanitychecker.SanityCheckerLocal; -import org.mmtk.vm.VM; - -import org.vmmagic.pragma.*; -import org.vmmagic.unboxed.*; - -/** - * This class performs sanity checks for RefCount collectors. - */ -@Uninterruptible public class GenSanityCheckerLocal extends SanityCheckerLocal { - - /** - * Return the expected reference count. For non-reference counting - * collectors this becomes a true/false relationship. - * - * @param object The object to check. - * @param sanityRootRC The number of root references to the object. - * @return The expected (root excluded) reference count. - */ - protected int sanityExpectedRC(ObjectReference object, - int sanityRootRC) { - Space space = Space.getSpaceForObject(object); - - // Nursery - if (space == Gen.nurserySpace) { - return global().preGCSanity() ? SanityChecker.UNSURE : SanityChecker.DEAD; - } - - // Immortal spaces - if (space == Gen.immortalSpace || space == Gen.vmSpace) { - return space.isReachable(object) ? SanityChecker.ALIVE : SanityChecker.DEAD; - } - - // Mature space (nursery collection) - if (VM.activePlan.global().isCurrentGCNursery()) { - return SanityChecker.UNSURE; - } - - // Mature space (full heap collection) - return space.isReachable(object) ? SanityChecker.ALIVE : SanityChecker.DEAD; - } - -} Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/markcompact/MC.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/markcompact/MC.java 2008-07-27 23:23:32 UTC (rev 14808) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/markcompact/MC.java 2008-07-28 05:50:08 UTC (rev 14809) @@ -16,6 +16,7 @@ import org.mmtk.policy.MarkCompactSpace; import org.mmtk.policy.Space; import org.mmtk.utility.heap.VMRequest; +import org.mmtk.utility.sanitychecker.SanityChecker; import org.vmmagic.pragma.*; import org.vmmagic.unboxed.ObjectReference; @@ -195,6 +196,28 @@ } /** + * Return the expected reference count. For non-reference counting + * collectors this becomes a true/false relationship. + * @param object The object to check. + * @param sanityRootRC The number of root references to the object. + * + * @return The expected (root excluded) reference count. + */ + public int sanityExpectedRC(ObjectReference object, int sanityRootRC) { + Space space = Space.getSpaceForObject(object); + + // Nursery + if (space == MC.mcSpace) { + // We are never sure about objects in MC. + // This is not very satisfying but allows us to use the sanity checker to + // detect dangling pointers. + return SanityChecker.UNSURE; + } else { + return super.sanityExpectedRC(object, sanityRootRC); + } + } + + /** * Register specialized methods. */ @Interruptible Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/markcompact/MCCollector.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/markcompact/MCCollector.java 2008-07-27 23:23:32 UTC (rev 14808) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/markcompact/MCCollector.java 2008-07-28 05:50:08 UTC (rev 14809) @@ -14,7 +14,6 @@ import org.mmtk.plan.*; -import org.mmtk.utility.sanitychecker.SanityCheckerLocal; import org.mmtk.vm.VM; import org.vmmagic.pragma.*; @@ -53,10 +52,6 @@ private final MCForwardTraceLocal forwardTrace; private boolean currentTrace; - // Sanity checking - private final MCSanityCheckerLocal sanityChecker; - - /**************************************************************************** * * Initialization @@ -68,7 +63,6 @@ public MCCollector() { markTrace = new MCMarkTraceLocal(global().markTrace); forwardTrace = new MCForwardTraceLocal(global().forwardTrace); - sanityChecker = new MCSanityCheckerLocal(); } @@ -174,11 +168,6 @@ } } - /** @return Return the current sanity checker. */ - public SanityCheckerLocal getSanityChecker() { - return sanityChecker; - } - /** @return The active global plan as an <code>MC</code> instance. */ @Inline private static MC global() { Deleted: rvmroot/trunk/MMTk/src/org/mmtk/plan/markcompact/MCSanityCheckerLocal.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/markcompact/MCSanityCheckerLocal.java 2008-07-27 23:23:32 UTC (rev 14808) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/markcompact/MCSanityCheckerLocal.java 2008-07-28 05:50:08 UTC (rev 14809) @@ -1,51 +0,0 @@ -/* - * This file is part of the Jikes RVM project (http://jikesrvm.org). - * - * This file is licensed to You under the Common Public License (CPL); - * You may not use this file except in compliance with the License. You - * may obtain a copy of the License at - * - * http://www.opensource.org/licenses/cpl1.0.php - * - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. - */ -package org.mmtk.plan.markcompact; - -import org.mmtk.policy.Space; - -import org.mmtk.utility.sanitychecker.SanityChecker; -import org.mmtk.utility.sanitychecker.SanityCheckerLocal; - -import org.vmmagic.pragma.*; -import org.vmmagic.unboxed.*; - -/** - * This class performs sanity checks for MarkCompact collectors. - */ -@Uninterruptible public class MCSanityCheckerLocal extends SanityCheckerLocal { - - /** - * Return the expected reference count. For non-reference counting - * collectors this becomes a true/false relationship. - * - * @param object The object to check. - * @param sanityRootRC The number of root references to the object. - * @return The expected (root excluded) reference count. - */ - protected int sanityExpectedRC(ObjectReference object, - int sanityRootRC) { - Space space = Space.getSpaceForObject(object); - - // Nursery - if (space == MC.mcSpace) { - // We are never sure about objects in MC. - // This is not very satisfying but allows us to use the sanity checker to - // detect dangling pointers. - return SanityChecker.UNSURE; - } else { - return super.sanityExpectedRC(object, sanityRootRC); - } - } - -} Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/RCBase.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/RCBase.java 2008-07-27 23:23:32 UTC (rev 14808) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/RCBase.java 2008-07-28 05:50:08 UTC (rev 14809) @@ -23,6 +23,7 @@ import org.mmtk.utility.deque.SharedDeque; import org.mmtk.utility.heap.VMRequest; import org.mmtk.utility.options.Options; +import org.mmtk.utility.sanitychecker.SanityChecker; import org.mmtk.utility.statistics.EventCounter; import org.mmtk.vm.VM; @@ -296,4 +297,23 @@ return true; return super.willNeverMove(object); } + + /** + * Return the expected reference count. For non-reference counting + * collectors this becomes a true/false relationship. + * + * @param object The object to check. + * @param sanityRootRC The number of root references to the object. + * @return The expected (root excluded) reference count. + */ + public int sanityExpectedRC(ObjectReference object, int sanityRootRC) { + if (RCBase.isRCObject(object)) { + if (!RCHeader.isLiveRC(object)) { + return SanityChecker.DEAD; + } + return RCHeader.getRC(object) - sanityRootRC; + } else { + return SanityChecker.UNSURE; + } + } } Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/RCBaseCollector.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/RCBaseCollector.java 2008-07-27 23:23:32 UTC (rev 14808) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/RCBaseCollector.java 2008-07-28 05:50:08 UTC (rev 14809) @@ -17,7 +17,6 @@ import org.mmtk.plan.refcount.cd.NullCDCollector; import org.mmtk.plan.refcount.cd.TrialDeletionCollector; import org.mmtk.utility.deque.ObjectReferenceDeque; -import org.mmtk.utility.sanitychecker.SanityCheckerLocal; import org.mmtk.vm.VM; import org.vmmagic.pragma.*; @@ -57,7 +56,6 @@ private NullCDCollector nullCD; private TrialDeletionCollector trialDeletionCD; - private RCSanityCheckerLocal sanityChecker; /**************************************************************************** * Initialization @@ -71,7 +69,6 @@ oldRootSet = new ObjectReferenceDeque("old root", global().oldRootPool); modBuffer = new ObjectReferenceDeque("mod buf", global().modPool); decBuffer = new DecBuffer(global().decPool); - sanityChecker = new RCSanityCheckerLocal(); switch (RCBase.CYCLE_DETECTOR) { case RCBase.NO_CYCLE_DETECTOR: nullCD = new NullCDCollector(); @@ -205,11 +202,6 @@ return (RCBase) VM.activePlan.global(); } - /** @return The current sanity checker. */ - public SanityCheckerLocal getSanityChecker() { - return sanityChecker; - } - /** @return The TraceStep to use when processing modified objects. */ protected abstract TransitiveClosure getModifiedProcessor(); Deleted: rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/RCSanityCheckerLocal.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/RCSanityCheckerLocal.java 2008-07-27 23:23:32 UTC (rev 14808) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/RCSanityCheckerLocal.java 2008-07-28 05:50:08 UTC (rev 14809) @@ -1,52 +0,0 @@ -/* - * This file is part of the Jikes RVM project (http://jikesrvm.org). - * - * This file is licensed to You under the Common Public License (CPL); - * You may not use this file except in compliance with the License. You - * may obtain a copy of the License at - * - * http://www.opensource.org/licenses/cpl1.0.php - * - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. - */ -package org.mmtk.plan.refcount; - -import org.mmtk.utility.sanitychecker.SanityChecker; -import org.mmtk.utility.sanitychecker.SanityCheckerLocal; - -import org.mmtk.vm.VM; - -import org.vmmagic.pragma.*; -import org.vmmagic.unboxed.*; - -/** - * This class performs sanity checks for reference counting collectors. - */ -@Uninterruptible public class RCSanityCheckerLocal extends SanityCheckerLocal { - - /** - * Return the expected reference count. For non-reference counting - * collectors this becomes a true/false relationship. - * - * @param object The object to check. - * @param sanityRootRC The number of root references to the object. - * @return The expected (root excluded) reference count. - */ - protected int sanityExpectedRC(ObjectReference object, - int sanityRootRC) { - if (VM.activePlan.global().getSanityChecker().preGCSanity()) { - return SanityChecker.UNSURE; - } - - if (RCBase.isRCObject(object)) { - if (!RCHeader.isLiveRC(object)) { - return SanityChecker.DEAD; - } - return RCHeader.getRC(object) - sanityRootRC; - } else { - return SanityChecker.UNSURE; - } - } - -} Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyimmix/StickyImmixCollector.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyimmix/StickyImmixCollector.java 2008-07-27 23:23:32 UTC (rev 14808) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyimmix/StickyImmixCollector.java 2008-07-28 05:50:08 UTC (rev 14809) @@ -20,7 +20,6 @@ import org.mmtk.policy.immix.CollectorLocal; import org.mmtk.utility.alloc.ImmixAllocator; import org.mmtk.utility.deque.ObjectReferenceDeque; -import org.mmtk.utility.sanitychecker.SanityCheckerLocal; import org.mmtk.vm.VM; import org.vmmagic.pragma.*; @@ -49,9 +48,6 @@ private StickyImmixNurseryTraceLocal nurseryTrace; private final ImmixAllocator nurseryCopy; - /* Sanity checking */ - private StickyImmixSanityCheckerLocal sanityChecker; - /**************************************************************************** * Initialization */ @@ -66,7 +62,6 @@ nurseryTrace = new StickyImmixNurseryTraceLocal(global().immixTrace, modBuffer); immix = new CollectorLocal(StickyImmix.immixSpace); nurseryCopy = new ImmixAllocator(Immix.immixSpace, true, true); - sanityChecker = new StickyImmixSanityCheckerLocal(); } /**************************************************************************** @@ -129,9 +124,4 @@ private static StickyImmix global() { return (StickyImmix) VM.activePlan.global(); } - - /** @return Return the current sanity checker. */ - public SanityCheckerLocal getSanityChecker() { - return sanityChecker; - } } Deleted: rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyimmix/StickyImmixSanityCheckerLocal.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyimmix/StickyImmixSanityCheckerLocal.java 2008-07-27 23:23:32 UTC (rev 14808) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyimmix/StickyImmixSanityCheckerLocal.java 2008-07-28 05:50:08 UTC (rev 14809) @@ -1,55 +0,0 @@ -/* - * This file is part of the Jikes RVM project (http://jikesrvm.org). - * - * This file is licensed to You under the Common Public License (CPL); - * You may not use this file except in compliance with the License. You - * may obtain a copy of the License at - * - * http://www.opensource.org/licenses/cpl1.0.php - * - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. - */ -package org.mmtk.plan.stickyimmix; - -import org.mmtk.policy.Space; - -import org.mmtk.utility.sanitychecker.SanityChecker; -import org.mmtk.utility.sanitychecker.SanityCheckerLocal; -import org.mmtk.vm.VM; - -import org.vmmagic.pragma.*; -import org.vmmagic.unboxed.*; - -/** - * This class performs sanity checks for sticky-immix collectors. - */ -@Uninterruptible -public class StickyImmixSanityCheckerLocal extends SanityCheckerLocal { - - /** - * Return the expected reference count. For non-reference counting - * collectors this becomes a true/false relationship. - * - * @param object The object to check. - * @param sanityRootRC The number of root references to the object. - * @return The expected (root excluded) reference count. - */ - @Override - protected int sanityExpectedRC(ObjectReference object, int sanityRootRC) { - Space space = Space.getSpaceForObject(object); - - // Immortal spaces - if (space == StickyImmix.immortalSpace || space == StickyImmix.vmSpace) { - return space.isReachable(object) ? SanityChecker.ALIVE : SanityChecker.DEAD; - } - - // Mature space (nursery collection) - if (VM.activePlan.global().isCurrentGCNursery() && space != StickyImmix.immixSpace) { - return SanityChecker.UNSURE; - } - - return super.sanityExpectedRC(object, sanityRootRC); - } - -} Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyms/StickyMS.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyms/StickyMS.java 2008-07-27 23:23:32 UTC (rev 14808) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyms/StickyMS.java 2008-07-28 05:50:08 UTC (rev 14809) @@ -14,11 +14,15 @@ import org.mmtk.plan.TransitiveClosure; import org.mmtk.plan.marksweep.MS; +import org.mmtk.policy.Space; import org.mmtk.utility.Log; import org.mmtk.utility.deque.SharedDeque; import org.mmtk.utility.options.Options; +import org.mmtk.utility.sanitychecker.SanityChecker; +import org.mmtk.vm.VM; import org.vmmagic.pragma.*; +import org.vmmagic.unboxed.ObjectReference; /** * This class implements the global state of a simple sticky mark bits collector, @@ -172,6 +176,30 @@ } /** + * Return the expected reference count. For non-reference counting + * collectors this becomes a true/false relationship. + * @param object The object to check. + * @param sanityRootRC The number of root references to the object. + * + * @return The expected (root excluded) reference count. + */ + public int sanityExpectedRC(ObjectReference object, int sanityRootRC) { + Space space = Space.getSpaceForObject(object); + + // Immortal spaces + if (space == StickyMS.immortalSpace || space == StickyMS.vmSpace) { + return space.isReachable(object) ? SanityChecker.ALIVE : SanityChecker.DEAD; + } + + // Mature space (nursery collection) + if (VM.activePlan.global().isCurrentGCNursery() && space != StickyMS.msSpace) { + return SanityChecker.UNSURE; + } + + return super.sanityExpectedRC(object, sanityRootRC); + } + + /** * Register specialized methods. */ @Interruptible Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyms/StickyMSCollector.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyms/StickyMSCollector.java 2008-07-27 23:23:32 UTC (rev 14808) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyms/StickyMSCollector.java 2008-07-28 05:50:08 UTC (rev 14809) @@ -17,7 +17,6 @@ import org.mmtk.plan.marksweep.MSTraceLocal; import org.mmtk.policy.MarkSweepLocal; import org.mmtk.utility.deque.ObjectReferenceDeque; -import org.mmtk.utility.sanitychecker.SanityCheckerLocal; import org.mmtk.vm.VM; import org.vmmagic.pragma.*; @@ -45,9 +44,6 @@ */ private StickyMSNurseryTraceLocal nurseryTrace; - /* Sanity checking */ - private StickyMSSanityCheckerLocal sanityChecker; - /**************************************************************************** * Initialization */ @@ -60,7 +56,6 @@ fullTrace = new MSTraceLocal(global().msTrace, modBuffer); nurseryTrace = new StickyMSNurseryTraceLocal(global().msTrace, modBuffer); ms = new MarkSweepLocal(StickyMS.msSpace); - sanityChecker = new StickyMSSanityCheckerLocal(); } /**************************************************************************** @@ -121,9 +116,4 @@ private static StickyMS global() { return (StickyMS) VM.activePlan.global(); } - - /** @return Return the current sanity checker. */ - public SanityCheckerLocal getSanityChecker() { - return sanityChecker; - } } Deleted: rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyms/StickyMSSanityCheckerLocal.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyms/StickyMSSanityCheckerLocal.java 2008-07-27 23:23:32 UTC (rev 14808) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyms/StickyMSSanityCheckerLocal.java 2008-07-28 05:50:08 UTC (rev 14809) @@ -1,55 +0,0 @@ -/* - * This file is part of the Jikes RVM project (http://jikesrvm.org). - * - * This file is licensed to You under the Common Public License (CPL); - * You may not use this file except in compliance with the License. You - * may obtain a copy of the License at - * - * http://www.opensource.org/licenses/cpl1.0.php - * - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. - */ -package org.mmtk.plan.stickyms; - -import org.mmtk.policy.Space; - -import org.mmtk.utility.sanitychecker.SanityChecker; -import org.mmtk.utility.sanitychecker.SanityCheckerLocal; -import org.mmtk.vm.VM; - -import org.vmmagic.pragma.*; -import org.vmmagic.unboxed.*; - -/** - * This class performs sanity checks for RefCount collectors. - */ -@Uninterruptible -public class StickyMSSanityCheckerLocal extends SanityCheckerLocal { - - /** - * Return the expected reference count. For non-reference counting - * collectors this becomes a true/false relationship. - * - * @param object The object to check. - * @param sanityRootRC The number of root references to the object. - * @return The expected (root excluded) reference count. - */ - @Override - protected int sanityExpectedRC(ObjectReference object, int sanityRootRC) { - Space space = Space.getSpaceForObject(object); - - // Immortal spaces - if (space == StickyMS.immortalSpace || space == StickyMS.vmSpace) { - return space.isReachable(object) ? SanityChecker.ALIVE : SanityChecker.DEAD; - } - - // Mature space (nursery collection) - if (VM.activePlan.global().isCurrentGCNursery() && space != StickyMS.msSpace) { - return SanityChecker.UNSURE; - } - - return super.sanityExpectedRC(object, sanityRootRC); - } - -} Modified: rvmroot/trunk/MMTk/src/org/mmtk/utility/sanitychecker/SanityChecker.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/utility/sanitychecker/SanityChecker.java 2008-07-27 23:23:32 UTC (rev 14808) +++ rvmroot/trunk/MMTk/src/org/mmtk/utility/sanitychecker/SanityChecker.java 2008-07-28 05:50:08 UTC (rev 14809) @@ -15,6 +15,7 @@ import org.mmtk.plan.Plan; import org.mmtk.plan.Trace; import org.mmtk.plan.Simple; +import org.mmtk.plan.TraceLocal; import org.mmtk.policy.Space; import org.mmtk.utility.Constants; import org.mmtk.utility.Log; @@ -27,7 +28,8 @@ /** * This class performs sanity checks for Simple collectors. */ -@Uninterruptible public final class SanityChecker implements Constants { +@Uninterruptible +public final class SanityChecker implements Constants { /* Counters */ public static long referenceCount; @@ -40,35 +42,28 @@ public static final int ALIVE = -1; public static final int UNSURE = 0; - public static final int LOG_SANITY_DATA_SIZE = 21; - /* Trace */ - public Trace trace; + public static final int LOG_SANITY_DATA_SIZE = 24; + + /* Tracing */ + public Trace rootTrace; + public Trace checkTrace; private final SanityDataTable sanityTable; private boolean preGCSanity; + /* Local, but we only run the check trace single-threaded. */ + final SanityTraceLocal checkTraceLocal; + /**************************************************************************** * Constants */ public SanityChecker() { sanityTable = new SanityDataTable(Plan.sanitySpace, LOG_SANITY_DATA_SIZE); - trace = new Trace(Plan.sanitySpace); + checkTrace = new Trace(Plan.sanitySpace); + rootTrace = new Trace(Plan.sanitySpace); + checkTraceLocal = new SanityTraceLocal(checkTrace, this); } /** - * @return The current sanity data table. - */ - public SanityDataTable getSanityTable() { - return sanityTable; - } - - /** - * @return True if this is pre-gc sanity, false if post-gc - */ - public boolean preGCSanity() { - return preGCSanity; - } - - /** * Perform any sanity checking collection phases. * * @param phaseId The id to proces @@ -90,7 +85,7 @@ Log.writeln(""); Log.write("============================== GC Sanity Checking "); Log.writeln("=============================="); - Log.writeln("Performing Sanity Checks..."); + Log.writeln(preGCSanity ? "Performing Pre-GC Sanity Checks..." : "Performing Post-GC Sanity Checks..."); // Reset counters referenceCount = 0; @@ -102,7 +97,12 @@ // Clear data space sanityTable.acquireTable(); - trace.prepareNonBlocking(); + // Root trace + rootTrace.prepareNonBlocking(); + + // Checking trace + checkTrace.prepareNonBlocking(); + checkTraceLocal.prepare(); return true; } @@ -111,9 +111,55 @@ return true; } + if (phaseId == Simple.SANITY_BUILD_TABLE) { + // Trace, checking for dangling pointers + checkTraceLocal.completeTrace(); + return true; + } + + if (phaseId == Simple.SANITY_CHECK_TABLE) { + // Iterate over the reachable objects. + Address curr = sanityTable.getFirst(); + while (!curr.isZero()) { + ObjectReference ref = SanityDataTable.getObjectReference(curr); + int normalRC = SanityDataTable.getNormalRC(curr); + int rootRC = SanityDataTable.getRootRC(curr); + if (!preGCSanity) { + int expectedRC = VM.activePlan.global().sanityExpectedRC(ref, rootRC); + switch (expectedRC) { + case SanityChecker.ALIVE: + case SanityChecker.UNSURE: + // Always ok. + break; + case SanityChecker.DEAD: + // Never ok. + Log.write("ERROR: SanityRC = "); + Log.write(normalRC); + Log.write(", SpaceRC = 0 "); + SanityChecker.dumpObjectInformation(ref); + break; + default: + // A mismatch in an RC space + if (normalRC != expectedRC) { + Log.write("WARNING: SanityRC = "); + Log.write(normalRC); + Log.write(", SpaceRC = "); + Log.write(expectedRC); + Log.write(" "); + SanityChecker.dumpObjectInformation(ref); + break; + } + } + } + curr = sanityTable.getNext(curr); + } + return true; + } + if (phaseId == Simple.SANITY_RELEASE) { - trace.release(); + checkTrace.release(); sanityTable.releaseTable(); + checkTraceLocal.release(); Log.writeln("roots\tobjects\trefs\tnull"); Log.write(rootReferenceCount);Log.write("\t"); @@ -131,6 +177,36 @@ } /** + * Process an object during sanity checking, validating data, + * incrementing counters and enqueuing if this is the first + * visit to the object. + * + * @param object The object to mark. + * @param root True If the object is a root. + */ + public void processObject(TraceLocal trace, ObjectReference object, boolean root) { + SanityChecker.referenceCount++; + if (root) SanityChecker.rootReferenceCount++; + + if (object.isNull()) { + SanityChecker.nullReferenceCount++; + return; + } + + if (Plan.SCAN_BOOT_IMAGE && Space.isInSpace(Plan.VM_SPACE, object)) { + return; + } + + // Get the table entry. + Address tableEntry = sanityTable.getEntry(object, true); + + if (SanityDataTable.incRC(tableEntry, root)) { + SanityChecker.liveObjectCount++; + trace.processNode(object); + } + } + + /** * Print out object information (used for warning and error messages) * * @param object The object to dump info for. Modified: rvmroot/trunk/MMTk/src/org/mmtk/utility/sanitychecker/SanityCheckerLocal.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/utility/sanitychecker/SanityCheckerLocal.java 2008-07-27 23:23:32 UTC (rev 14808) +++ rvmroot/trunk/MMTk/src/org/mmtk/utility/sanitychecker/SanityCheckerLocal.java 2008-07-28 05:50:08 UTC (rev 14809) @@ -14,30 +14,28 @@ import org.mmtk.plan.Plan; import org.mmtk.plan.Simple; -import org.mmtk.plan.TraceLocal; -import org.mmtk.policy.Space; import org.mmtk.utility.Constants; -import org.mmtk.utility.Log; import org.mmtk.vm.VM; import org.vmmagic.pragma.*; -import org.vmmagic.unboxed.*; /** * This class performs sanity checks for Simple collectors. */ -@Uninterruptible public class SanityCheckerLocal implements Constants { +@Uninterruptible +public final class SanityCheckerLocal implements Constants { /* Trace */ - private final SanityTraceLocal sanityTrace; + final SanityRootTraceLocal rootTraceLocal; + final SanityChecker global; - /**************************************************************************** * Constants */ public SanityCheckerLocal() { - sanityTrace = new SanityTraceLocal(global().trace, this); + global = VM.activePlan.global().getSanityChecker(); + rootTraceLocal = new SanityRootTraceLocal(global.rootTrace); } /** @@ -48,133 +46,35 @@ * @return True if the phase was handled. */ @NoInline - public final boolean collectionPhase(int phaseId, boolean primary) { + public boolean collectionPhase(int phaseId, boolean primary) { if (phaseId == Simple.SANITY_PREPARE) { - if (primary) { - sanityTrace.prepare(); - } + rootTraceLocal.prepare(); return true; } if (phaseId == Simple.SANITY_ROOTS) { - VM.scanning.computeGlobalRoots(sanityTrace); - VM.scanning.computeThreadRoots(sanityTrace); - VM.scanning.computeStaticRoots(sanityTrace); + VM.scanning.computeGlobalRoots(rootTraceLocal); + VM.scanning.computeThreadRoots(rootTraceLocal); + VM.scanning.computeStaticRoots(rootTraceLocal); if (Plan.SCAN_BOOT_IMAGE) { - VM.scanning.computeBootImageRoots(sanityTrace); + VM.scanning.computeBootImageRoots(rootTraceLocal); } - sanityTrace.flush(); + rootTraceLocal.flush(); return true; } - if (phaseId == Simple.SANITY_BUILD_TABLE) { + if (phaseId == Simple.SANITY_COPY_ROOTS) { if (primary) { - // Trace, checking for dangling pointers - sanityTrace.completeTrace(); + rootTraceLocal.copyRootValuesTo(global.checkTraceLocal); } return true; } - if (phaseId == Simple.SANITY_CHECK_TABLE) { - if (primary) { - // Iterate over the reachable objects. - Address curr = global().getSanityTable().getFirst(); - while (!curr.isZero()) { - ObjectReference ref = SanityDataTable.getObjectReference(curr); - int normalRC = SanityDataTable.getNormalRC(curr); - int rootRC = SanityDataTable.getRootRC(curr); - int expectedRC = sanityExpectedRC(ref, rootRC); - switch (expectedRC) { - case SanityChecker.ALIVE: - case SanityChecker.UNSURE: - // Always ok. - break; - case SanityChecker.DEAD: - // Never ok. - Log.write("ERROR: SanityRC = "); - Log.write(normalRC); - Log.write(", SpaceRC = 0 "); - SanityChecker.dumpObjectInformation(ref); - break; - default: - // A mismatch in an RC space - if (normalRC != expectedRC) { - Log.write("WARNING: SanityRC = "); - Log.write(normalRC); - Log.write(", SpaceRC = "); - Log.write(expectedRC); - Log.write(" "); - SanityChecker.dumpObjectInformation(ref); - break; - } - } - curr = global().getSanityTable().getNext(curr); - } - } - return true; - } - if (phaseId == Simple.SANITY_RELEASE) { - if (primary) { - sanityTrace.release(); - } + rootTraceLocal.release(); return true; } return false; } - - /** - * Process an object during sanity checking, validating data, - * incrementing counters and enqueuing if this is the first - * visit to the object. - * - * @param object The object to mark. - * @param root True If the object is a root. - */ - public final void processObject(TraceLocal trace, ObjectReference object, - boolean root) { - SanityChecker.referenceCount++; - if (root) SanityChecker.rootReferenceCount++; - - if (object.isNull()) { - SanityChecker.nullReferenceCount++; - return; - } - - if (Plan.SCAN_BOOT_IMAGE && Space.isInSpace(Plan.VM_SPACE, object)) { - return; - } - - // Get the table entry. - Address tableEntry = global().getSanityTable().getEntry(object, true); - - if (SanityDataTable.incRC(tableEntry, root)) { - SanityChecker.liveObjectCount++; - trace.processNode(object); - } - } - - /** - * Return the expected reference count. For non-reference counting - * collectors this becomes a true/false relationship. - * - * @param object The object to check. - * @param sanityRootRC The number of root references to the object. - * @return The expected (root excluded) reference count. - */ - protected int sanityExpectedRC(ObjectReference object, - int sanityRootRC) { - if (global().preGCSanity()) - return SanityChecker.UNSURE; - - Space space = Space.getSpaceForObject(object); - return space.isReachable(object) ? SanityChecker.ALIVE : SanityChecker.DEAD; - } - - /** @return The global trace as a SanityChecker instance. */ - protected static SanityChecker global() { - return VM.activePlan.global().getSanityChecker(); - } - } Modified: rvmroot/trunk/MMTk/src/org/mmtk/utility/sanitychecker/SanityDataTable.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/utility/sanitychecker/SanityDataTable.java 2008-07-27 23:23:32 UTC (rev 14808) +++ rvmroot/trunk/MMTk/src/org/mmtk/utility/sanitychecker/SanityDataTable.java 2008-07-28 05:50:08 UTC (rev 14809) @@ -27,8 +27,8 @@ * * This class is not thread safe. */ -@Uninterruptible public final class SanityDataTable extends SimpleHashtable - implements Constants { +@Uninterruptible +public final class SanityDataTable extends SimpleHashtable implements Constants { /** The number of bits for the normal reference count */ private static final int NORMAL_RC_BITS = 25; Added: rvmroot/trunk/MMTk/src/org/mmtk/utility/sanitychecker/SanityRootTraceLocal.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/utility/sanitychecker/SanityRootTraceLocal.java (rev 0) +++ rvmroot/trunk/MMTk/src/org/mmtk/utility/sanitychecker/SanityRootTraceLocal.java 2008-07-28 05:50:08 UTC (rev 14809) @@ -0,0 +1,95 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Common Public License (CPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/cpl1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ +package org.mmtk.utility.sanitychecker; + +import org.mmtk.plan.TraceLocal; +import org.mmtk.plan.Trace; +import org.mmtk.vm.VM; + +import org.vmmagic.pragma.*; +import org.vmmagic.unboxed.*; + +/** + * This class implements the parallel root-gathering part of a sanity check. + */ +@Uninterruptible +public final class SanityRootTraceLocal extends TraceLocal { + + /** + * Constructor + */ + public SanityRootTraceLocal(Trace trace) { + super(trace); + } + + /**************************************************************************** + * + * Object processing and tracing + */ + + /** + * Copy root values across to the 'real' single-threaded trace that will do + * the sanity checking. + */ + @Inline + public void copyRootValuesTo(TraceLocal trace) { + while (!values.isEmpty()) { + trace.traceObject(values.pop(), true); + } + } + + /** + * Process delayed roots. This does not make sense for SanityRootTraceLocal. + * are empty. + */ + @Inline + public void processRoots() { + VM.assertions.fail("SanityRootTraceLocal.processRoots called."); + } + + /** + * Finishing processing all GC work. This does not make sense for SanityRootTraceLocal. + */ + @Inline + public void completeTrace() { + VM.assertions.fail("SanityRootTraceLocal.completeTrace called."); + } + + /** + * This method is the core method during the trace of the object graph. + * The role of this method is to: + * + * @param object The object to be traced. + * @param root Is this object a root? + * @return The new reference to the same object instance. + */ + @Inline + public ObjectReference traceObject(ObjectReference object, boolean root) { + if (!root) VM.assertions.fail("SanityRootTraceLocal.traceObject called for non-root object."); + if (!object.isNull()) { + values.push(object); + } + return object; + } + + /** + * Will this object move from this point on, during the current trace ? + * + * @param object The object to query. + * @return True if the object will not move. + */ + public boolean willNotMoveInCurrentCollection(ObjectReference object) { + // We never move objects! + return true; + } +} Property changes on: rvmroot/trunk/MMTk/src/org/mmtk/utility/sanitychecker/SanityRootTraceLocal.java ___________________________________________________________________ Added: svn:eol-style + native Modified: rvmroot/trunk/MMTk/src/org/mmtk/utility/sanitychecker/SanityTraceLocal.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/utility/sanitychecker/SanityTraceLocal.java 2008-07-27 23:23:32 UTC (rev 14808) +++ rvmroot/trunk/MMTk/src/org/mmtk/utility/sanitychecker/SanityTraceLocal.java 2008-07-28 05:50:08 UTC (rev 14809) @@ -24,14 +24,14 @@ @Uninterruptible public final class SanityTraceLocal extends TraceLocal { - private final SanityCheckerLocal sanityChecker; + private final SanityChecker sanityChecker; /** * Constructor */ - public SanityTraceLocal(Trace trace, SanityCheckerLocal scl) { + public SanityTraceLocal(Trace trace, SanityChecker sanityChecker) { super(trace); - sanityChecker = scl; + this.sanityChecker = sanityChecker; } /**************************************************************************** @@ -63,5 +63,4 @@ // We never move objects! return true; } - } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dfr...@us...> - 2008-08-08 06:51:02
|
Revision: 14854 http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=14854&view=rev Author: dframpton-oss Date: 2008-08-08 06:50:58 +0000 (Fri, 08 Aug 2008) Log Message: ----------- Move the collector read/write barriers into the global instance so they are safe from mutator and/or collector contexts. This allows 'gc' activity from concurrent collector threads or barriers to use them. Modified Paths: -------------- rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Barriers.java rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/ScanBootImage.java rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/ScanThread.java rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Scanning.java rvmroot/trunk/MMTk/src/org/mmtk/plan/CollectorContext.java rvmroot/trunk/MMTk/src/org/mmtk/plan/Plan.java rvmroot/trunk/MMTk/src/org/mmtk/plan/TraceLocal.java rvmroot/trunk/MMTk/src/org/mmtk/plan/poisoned/Poisoned.java rvmroot/trunk/MMTk/src/org/mmtk/plan/poisoned/PoisonedCollector.java rvmroot/trunk/MMTk/src/org/mmtk/plan/poisoned/PoisonedConstraints.java rvmroot/trunk/MMTk/src/org/mmtk/utility/deque/ObjectReferenceBuffer.java Modified: rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Barriers.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Barriers.java 2008-08-08 05:57:20 UTC (rev 14853) +++ rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Barriers.java 2008-08-08 06:50:58 UTC (rev 14854) @@ -218,7 +218,7 @@ if (org.jikesrvm.VM.runningVM) { Address base = ObjectReference.fromObject(dst).toAddress(); Address slot = base.plus(Offset.fromIntZeroExtend(index << LOG_BYTES_IN_ADDRESS)); - VM.activePlan.collector().storeObjectReference(slot, ObjectReference.fromObject(value)); + VM.activePlan.global().storeObjectReference(slot, ObjectReference.fromObject(value)); } else { dst[index] = value; } Modified: rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/ScanBootImage.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/ScanBootImage.java 2008-08-08 05:57:20 UTC (rev 14853) +++ rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/ScanBootImage.java 2008-08-08 06:50:58 UTC (rev 14854) @@ -156,7 +156,7 @@ */ @Uninterruptible private static void checkReference(Address refaddr) { - ObjectReference ref = org.mmtk.vm.VM.activePlan.collector().loadObjectReference(refaddr); + ObjectReference ref = org.mmtk.vm.VM.activePlan.global().loadObjectReference(refaddr); if (!MemoryManager.validRef(ref)) { Log.writeln(); Log.writeln("Invalid ref reported while scanning boot image"); Modified: rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/ScanThread.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/ScanThread.java 2008-08-08 05:57:20 UTC (rev 14853) +++ rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/ScanThread.java 2008-08-08 06:50:58 UTC (rev 14854) @@ -727,7 +727,7 @@ Log.write(loc); Log.write(" ("); Log.write(loc.diff(start)); Log.write("): "); - ObjectReference value = Selected.Collector.get().loadObjectReference(loc); + ObjectReference value = Selected.Plan.get().loadObjectReference(loc); Log.write(value); Log.write(" "); Log.flush(); Modified: rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Scanning.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Scanning.java 2008-08-08 05:57:20 UTC (rev 14853) +++ rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Scanning.java 2008-08-08 06:50:58 UTC (rev 14854) @@ -182,7 +182,7 @@ Address threadTableSlot = threadTable.toAddress().plus(threadIndex<<LOG_BYTES_IN_ADDRESS); if (VM.VerifyAssertions) { Address a = ObjectReference.fromObject(thread).toAddress(); - Address b = Selected.Collector.get().loadObjectReference(threadTableSlot).toAddress(); + Address b = Selected.Plan.get().loadObjectReference(threadTableSlot).toAddress(); VM._assert(a.EQ(b), "Thread table address arithmetic is wrong!"); } trace.processPrecopyEdge(threadTableSlot, false); Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/CollectorContext.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/CollectorContext.java 2008-08-08 05:57:20 UTC (rev 14853) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/CollectorContext.java 2008-08-08 06:50:58 UTC (rev 14854) @@ -190,30 +190,4 @@ /** @return the unique identifier for this collector context. */ @Inline public int getId() { return id; } - - /**************************************************************************** - * Collector read/write barriers. - */ - - /** - * Store an object reference - * - * @param slot The location of the reference - * @param value The value to store - */ - @Inline - public void storeObjectReference(Address slot, ObjectReference value) { - slot.store(value); - } - - /** - * Load an object reference - * - * @param slot The location of the reference - * @return the object reference loaded from slot - */ - @Inline - public ObjectReference loadObjectReference(Address slot) { - return slot.loadObjectReference(); - } } Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/Plan.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/Plan.java 2008-08-08 05:57:20 UTC (rev 14853) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/Plan.java 2008-08-08 06:50:58 UTC (rev 14854) @@ -852,6 +852,32 @@ } /**************************************************************************** + * Internal read/write barriers. + */ + + /** + * Store an object reference + * + * @param slot The location of the reference + * @param value The value to store + */ + @Inline + public void storeObjectReference(Address slot, ObjectReference value) { + slot.store(value); + } + + /** + * Load an object reference + * + * @param slot The location of the reference + * @return the object reference loaded from slot + */ + @Inline + public ObjectReference loadObjectReference(Address slot) { + return slot.loadObjectReference(); + } + + /**************************************************************************** * Collection. */ Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/TraceLocal.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/TraceLocal.java 2008-08-08 05:57:20 UTC (rev 14853) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/TraceLocal.java 2008-08-08 06:50:58 UTC (rev 14854) @@ -85,9 +85,9 @@ */ @Inline public final void processEdge(ObjectReference source, Address slot) { - ObjectReference object = VM.activePlan.collector().loadObjectReference(slot); + ObjectReference object = VM.activePlan.global().loadObjectReference(slot); ObjectReference newObject = traceObject(object, false); - VM.activePlan.collector().storeObjectReference(slot, newObject); + VM.activePlan.global().storeObjectReference(slot, newObject); } /** @@ -118,10 +118,10 @@ public final void processRootEdge(Address slot, boolean untraced) { ObjectReference object; if (untraced) object = slot.loadObjectReference(); - else object = VM.activePlan.collector().loadObjectReference(slot); + else object = VM.activePlan.global().loadObjectReference(slot); ObjectReference newObject = traceObject(object, true); if (untraced) slot.store(newObject); - else VM.activePlan.collector().storeObjectReference(slot, newObject); + else VM.activePlan.global().storeObjectReference(slot, newObject); } /** @@ -561,11 +561,11 @@ public final void processPrecopyEdge(Address slot, boolean untraced) { ObjectReference child; if (untraced) child = slot.loadObjectReference(); - else child = VM.activePlan.collector().loadObjectReference(slot); + else child = VM.activePlan.global().loadObjectReference(slot); if (!child.isNull()) { child = precopyObject(child); if (untraced) slot.store(child); - else VM.activePlan.collector().storeObjectReference(slot, child); + else VM.activePlan.global().storeObjectReference(slot, child); } } } Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/poisoned/Poisoned.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/poisoned/Poisoned.java 2008-08-08 05:57:20 UTC (rev 14853) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/poisoned/Poisoned.java 2008-08-08 06:50:58 UTC (rev 14854) @@ -15,6 +15,7 @@ import org.mmtk.plan.marksweep.MS; import org.vmmagic.pragma.*; +import org.vmmagic.unboxed.Address; import org.vmmagic.unboxed.ObjectReference; import org.vmmagic.unboxed.Word; @@ -50,4 +51,30 @@ public static ObjectReference depoison(Word value) { return value.and(Word.one().not()).toAddress().toObjectReference(); } + + /**************************************************************************** + * Internal read/write barriers. + */ + + /** + * Store an object reference + * + * @param slot The location of the reference + * @param value The value to store + */ + @Inline + public void storeObjectReference(Address slot, ObjectReference value) { + slot.store(poison(value)); + } + + /** + * Load an object reference + * + * @param slot The location of the reference + * @return the object reference loaded from slot + */ + @Inline + public ObjectReference loadObjectReference(Address slot) { + return depoison(slot.loadWord()); + } } Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/poisoned/PoisonedCollector.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/poisoned/PoisonedCollector.java 2008-08-08 05:57:20 UTC (rev 14853) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/poisoned/PoisonedCollector.java 2008-08-08 06:50:58 UTC (rev 14854) @@ -14,9 +14,7 @@ import org.mmtk.plan.marksweep.MSCollector; -import org.vmmagic.pragma.*; -import org.vmmagic.unboxed.Address; -import org.vmmagic.unboxed.ObjectReference; +import org.vmmagic.pragma.Uninterruptible; /** * This class implements a poisoned collector, that is essentially a test @@ -24,30 +22,4 @@ */ @Uninterruptible public class PoisonedCollector extends MSCollector { - /**************************************************************************** - * - * Collector read/write barriers. - */ - - /** - * Store an object reference - * - * @param slot The location of the reference - * @param value The value to store - */ - @Inline - public void storeObjectReference(Address slot, ObjectReference value) { - slot.store(Poisoned.poison(value)); - } - - /** - * Load an object reference - * - * @param slot The location of the reference - * @return the object reference loaded from slot - */ - @Inline - public ObjectReference loadObjectReference(Address slot) { - return Poisoned.depoison(slot.loadWord()); - } } Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/poisoned/PoisonedConstraints.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/poisoned/PoisonedConstraints.java 2008-08-08 05:57:20 UTC (rev 14853) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/poisoned/PoisonedConstraints.java 2008-08-08 06:50:58 UTC (rev 14854) @@ -25,6 +25,6 @@ public class PoisonedConstraints extends MSConstraints { public boolean needsWriteBarrier() { return true; } public boolean needsReadBarrier() { return true; } - public boolean needsStaticWriteBarrier() { return false;} + public boolean needsStaticWriteBarrier() { return false; } public boolean needsStaticReadBarrier() { return false; } } Modified: rvmroot/trunk/MMTk/src/org/mmtk/utility/deque/ObjectReferenceBuffer.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/utility/deque/ObjectReferenceBuffer.java 2008-08-08 05:57:20 UTC (rev 14853) +++ rvmroot/trunk/MMTk/src/org/mmtk/utility/deque/ObjectReferenceBuffer.java 2008-08-08 06:50:58 UTC (rev 14854) @@ -56,7 +56,7 @@ */ @Inline public final void processEdge(ObjectReference source, Address slot) { - ObjectReference object = VM.activePlan.collector().loadObjectReference(slot); + ObjectReference object = VM.activePlan.global().loadObjectReference(slot); process(object); } @@ -107,10 +107,22 @@ return values.pop(); } + @Inline + public final boolean isEmpty() { + return values.isEmpty(); + } + /** * Flushes all local state back to the shared queue. */ public final void flushLocal() { values.flushLocal(); } + + /** + * Return true if this buffer is locally empty + */ + public final boolean isFlushed() { + return values.isFlushed(); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2008-08-28 05:24:25
|
Revision: 14938 http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=14938&view=rev Author: rgarner Date: 2008-08-28 05:24:15 +0000 (Thu, 28 Aug 2008) Log Message: ----------- MMTk Harness: Reimplement the MMTk harness scripting language with a kind-of pcode interpreter, for a ~10x speedup. Some changes to the script language, just bringing it into line with intuition, including a type-checker. Other minor performance improvements. On the way, repackage the implementation more intuitively. Modified Paths: -------------- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ObjectModel.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Harness.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Main.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Mutator.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Declaration.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Env.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Trace.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/parser/MethodTable.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/parser/SymbolTable.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/GcEvery.java rvmroot/trunk/MMTk/harness/src-generated/org/mmtk/harness/lang/parser/Parser.jj rvmroot/trunk/MMTk/harness/test-scripts/Quicksort.script rvmroot/trunk/MMTk/harness/test-scripts/README rvmroot/trunk/MMTk/harness/test-scripts/lang/if-then-else.script rvmroot/trunk/MMTk/harness/test-scripts/lang/intrinsic.script rvmroot/trunk/MMTk/harness/vmmagic/org/vmmagic/unboxed/SimulatedMemory.java Added Paths: ----------- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Checker.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Compiler.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Intrinsics.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/PrettyPrinter.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/UnsyncStack.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Visitor.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/AST.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/AbstractAST.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Alloc.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Assert.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Assignment.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/BinaryExpression.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Call.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Constant.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Empty.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Expect.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Expression.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/IfStatement.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/IntrinsicMethod.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/LoadField.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Method.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/MethodProxy.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/NormalMethod.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Operator.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/PrintStatement.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Return.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Sequence.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Spawn.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Statement.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/StoreField.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Type.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/UnaryExpression.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Variable.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/WhileStatement.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/compiler/ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/compiler/CompiledMethod.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/compiler/CompiledMethodProxy.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/compiler/CompiledMethodTable.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/compiler/Register.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/compiler/Temporary.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/parser/Symbol.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/AllocOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/BinaryOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/BinaryOperation.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/Branch.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/CallIntrinsicOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/CallNormalOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/CallOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/EnnaryOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/ExitOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/ExpectOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/Goto.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/LoadFieldOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/NullaryOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/PrintOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/PseudoOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/ResolvableOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/ReturnOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/SpawnOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/StoreFieldOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/StoreLocal.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/TernaryOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/UnaryOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/UnaryOperation.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/runtime/ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/runtime/AllocationSite.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/runtime/BoolValue.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/runtime/ConstantPool.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/runtime/IntValue.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/runtime/ObjectValue.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/runtime/PcodeInterpreter.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/runtime/StackFrame.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/runtime/StringValue.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/runtime/Value.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/DumpPcode.java rvmroot/trunk/MMTk/harness/test-scripts/Spawn.options rvmroot/trunk/MMTk/harness/test-scripts/Spawn.script rvmroot/trunk/MMTk/harness/test-scripts/lang/alloc.script rvmroot/trunk/MMTk/harness/test-scripts/lang/assert.script rvmroot/trunk/MMTk/harness/test-scripts/lang/assign.script rvmroot/trunk/MMTk/harness/test-scripts/lang/call.script rvmroot/trunk/MMTk/harness/test-scripts/lang/const.script rvmroot/trunk/MMTk/harness/test-scripts/lang/expr.script rvmroot/trunk/MMTk/harness/test-scripts/lang/fields.script rvmroot/trunk/MMTk/harness/test-scripts/lang/getfield.script rvmroot/trunk/MMTk/harness/test-scripts/lang/if-then-else2.script rvmroot/trunk/MMTk/harness/test-scripts/lang/list.script rvmroot/trunk/MMTk/harness/test-scripts/lang/while.script Removed Paths: ------------- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Alloc.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/AllocationSite.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Assert.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Assignment.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/BinaryExpression.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/BoolValue.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Call.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Empty.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Expect.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Expression.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/GC.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Hash.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/IfStatement.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/IntValue.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/IntrinsicMethod.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/LoadField.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Method.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/NormalMethod.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ObjectValue.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Operator.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/PrintStatement.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Return.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ReturnException.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Sequence.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Spawn.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/StackFrame.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Statement.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/StoreField.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/StringValue.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ThreadId.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Type.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/UnaryExpression.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Value.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Variable.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/WhileStatement.java Modified: rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ObjectModel.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ObjectModel.java 2008-08-27 21:35:58 UTC (rev 14937) +++ rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ObjectModel.java 2008-08-28 05:24:15 UTC (rev 14938) @@ -25,7 +25,7 @@ import org.vmmagic.unboxed.*; @Uninterruptible -public class ObjectModel extends org.mmtk.vm.ObjectModel { +public final class ObjectModel extends org.mmtk.vm.ObjectModel { /* * The object model for the harness stores: Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Harness.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Harness.java 2008-08-27 21:35:58 UTC (rev 14937) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Harness.java 2008-08-28 05:24:15 UTC (rev 14938) @@ -14,13 +14,7 @@ import java.util.ArrayList; -import org.mmtk.harness.options.Collectors; -import org.mmtk.harness.options.GcEvery; -import org.mmtk.harness.options.HarnessOptionSet; -import org.mmtk.harness.options.InitHeap; -import org.mmtk.harness.options.MaxHeap; -import org.mmtk.harness.options.Plan; -import org.mmtk.harness.options.Trace; +import org.mmtk.harness.options.*; import org.mmtk.harness.vm.*; import org.mmtk.utility.heap.HeapGrowthManager; @@ -46,6 +40,9 @@ /** Option for the maximum heap size */ public static MaxHeap maxHeap = new MaxHeap(); + /** Option for the maximum heap size */ + public static DumpPcode dumpPcode = new DumpPcode(); + /** Trace options */ public static Trace trace = new Trace(); @@ -58,7 +55,7 @@ * * After calling this it is possible to begin creating mutator threads. */ - public static void init(String[] args) throws InterruptedException { + public static void init(String[] args) { /* Always use the harness factory */ System.setProperty("mmtk.hostjvm", Factory.class.getCanonicalName()); @@ -69,36 +66,44 @@ } trace.apply(); gcEvery.apply(); - MMTkThread thread = new MMTkThread((new Runnable() { - public void run() { + /* Get MMTk breathing */ + ActivePlan.init(plan.getValue()); + ActivePlan.plan.boot(); + HeapGrowthManager.boot(initHeap.getBytes(), maxHeap.getBytes()); + Collector.init(collectors.getValue()); - /* Get MMTk breathing */ - ActivePlan.init(plan.getValue()); - ActivePlan.plan.boot(); - HeapGrowthManager.boot(initHeap.getBytes(), maxHeap.getBytes()); - Collector.init(collectors.getValue()); + /* Override some defaults */ + Options.noFinalizer.setValue(true); + Options.noReferenceTypes.setValue(true); + Options.variableSizeHeap.setValue(false); - /* Override some defaults */ - Options.noFinalizer.setValue(true); - Options.noReferenceTypes.setValue(true); + /* Process command line options */ + for(String arg: newArgs) { + if (!options.process(arg)) { + throw new RuntimeException("Invalid option '" + arg + "'"); + } + } - /* Process command line options */ - for(String arg: newArgs) { - if (!options.process(arg)) { - throw new RuntimeException("Invalid option '" + arg + "'"); - } - } + /* Check options */ + assert Options.noFinalizer.getValue(): "noFinalizer must be true"; + assert Options.noReferenceTypes.getValue(): "noReferenceTypes must be true"; - /* Check options */ - assert Options.noFinalizer.getValue(): "noFinalizer must be true"; - assert Options.noReferenceTypes.getValue(): "noReferenceTypes must be true"; + /* Finish starting up MMTk */ + ActivePlan.plan.postBoot(); + ActivePlan.plan.fullyBooted(); + } - /* Finish starting up MMTk */ - ActivePlan.plan.postBoot(); - ActivePlan.plan.fullyBooted(); - } - })); - thread.start(); - thread.join(); + /** GC stress - GC on every allocation */ + private static boolean gcEveryAlloc = false; + + /** + * GC stress - GC after every allocation + */ + public static void setGcEveryAlloc() { + gcEveryAlloc = true; } + + public static boolean gcEveryAlloc() { + return gcEveryAlloc; + } } Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Main.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Main.java 2008-08-27 21:35:58 UTC (rev 14937) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Main.java 2008-08-28 05:24:15 UTC (rev 14938) @@ -13,12 +13,12 @@ package org.mmtk.harness; -import java.io.BufferedInputStream; -import java.io.FileInputStream; import java.io.FileNotFoundException; +import org.mmtk.harness.lang.Checker; +import org.mmtk.harness.lang.Compiler; import org.mmtk.harness.lang.Env; -import org.mmtk.harness.lang.Method; +import org.mmtk.harness.lang.parser.MethodTable; import org.mmtk.harness.lang.parser.Parser; import org.mmtk.harness.lang.parser.ParseException; @@ -39,13 +39,17 @@ if(!scriptFile.endsWith(".script")) { scriptFile += ".script"; } - final Method main = new Parser(new BufferedInputStream(new FileInputStream(scriptFile))).main(); + final MethodTable methods = new Parser(scriptFile).script(); + + /* Type-check the script */ + Checker.typeCheck(methods); + /* Initialise the harness */ Harness.init(harnessArgs); + Env m = new Env(Compiler.compile(methods)); /* Invoke the test */ - Env m = new Env(main); m.start(); m.join(); } Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Mutator.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Mutator.java 2008-08-27 21:35:58 UTC (rev 14937) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Mutator.java 2008-08-28 05:24:15 UTC (rev 14938) @@ -17,9 +17,9 @@ import java.util.Set; import java.util.Stack; -import org.mmtk.harness.lang.AllocationSite; import org.mmtk.harness.lang.Trace; import org.mmtk.harness.lang.Trace.Item; +import org.mmtk.harness.lang.runtime.AllocationSite; import org.mmtk.harness.vm.ActivePlan; import org.mmtk.harness.vm.ObjectModel; import org.mmtk.plan.MutatorContext; Deleted: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Alloc.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Alloc.java 2008-08-27 21:35:58 UTC (rev 14937) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Alloc.java 2008-08-28 05:24:15 UTC (rev 14938) @@ -1,64 +0,0 @@ -/* - * This file is part of the Jikes RVM project (http://jikesrvm.org). - * - * This file is licensed to You under the Common Public License (CPL); - * You may not use this file except in compliance with the License. You - * may obtain a copy of the License at - * - * http://www.opensource.org/licenses/cpl1.0.php - * - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. - */ -package org.mmtk.harness.lang; - -import org.vmmagic.unboxed.ObjectReference; - -public class Alloc implements Expression { - /** GC stress - GC on every allocation */ - private static boolean gcEveryAlloc = false; - - /** - * GC stress - GC after every allocation - */ - public static void setGcEveryAlloc() { - gcEveryAlloc = true; - } - - /** Call site ID */ - private final int site; - /** Number of reference fields */ - private final Expression refCount; - /** Number of data fields */ - private final Expression dataCount; - /** Double align the object? */ - private final Expression doubleAlign; - - /** - * Allocate an object. - */ - public Alloc(int site, Expression refCount, Expression dataCount, Expression doubleAlign) { - this.site = site; - this.refCount = refCount; - this.dataCount = dataCount; - this.doubleAlign = doubleAlign; - } - - /** - * Perform the allocation by calling MMTk. - */ - public Value eval(Env env) { - int refCountVal = env.evalInt(refCount, "Number of reference fields must be an integer"); - int dataCountVal = env.evalInt(dataCount, "Number of data fields must be an integer"); - boolean doubleAlignVal = env.evalBoolVal(doubleAlign, "DoubleAlign must be a boolean"); - - ObjectReference object = env.alloc(refCountVal, dataCountVal, doubleAlignVal,site); - ObjectValue oval = new ObjectValue(object); - if (gcEveryAlloc) { - env.pushTemporary(oval); - env.gc(); - env.popTemporary(oval); - } - return oval; - } -} Deleted: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/AllocationSite.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/AllocationSite.java 2008-08-27 21:35:58 UTC (rev 14937) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/AllocationSite.java 2008-08-28 05:24:15 UTC (rev 14938) @@ -1,85 +0,0 @@ -/* - * This file is part of the Jikes RVM project (http://jikesrvm.org). - * - * This file is licensed to You under the Common Public License (CPL); - * You may not use this file except in compliance with the License. You - * may obtain a copy of the License at - * - * http://www.opensource.org/licenses/cpl1.0.php - * - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. - */ -package org.mmtk.harness.lang; - -import java.util.ArrayList; - -import org.mmtk.harness.lang.parser.Token; - -/** - * Information about allocation sites in a script. Used when debugging to - * identify objects. - */ -public class AllocationSite { - - /** - * The global collection of allocation sites. - */ - private static final ArrayList<AllocationSite> sites = new ArrayList<AllocationSite>(); - - /** - * Retrieve an allocation site by ID. - * @param id - * @return - */ - public static AllocationSite getSite(int id) { - return sites.get(id); - } - - private final int id; - private final int column; - private final int line; - - /** - * Create an allocation site for a given source code line/column. - * @param line - * @param column - */ - public AllocationSite(int line, int column) { - this.id = sites.size(); - sites.add(this); - this.line = line; - this.column = column; - } - - /** - * An anonymous allocation site - */ - public AllocationSite() { - this(0,0); - } - - /** - * An allocation site for a given script token. - * @param token - */ - public AllocationSite(Token token) { - this(token.beginLine,token.beginColumn); - } - - public String toString() { - return String.format("%d:%d", line, column); - } - - public int getId() { - return id; - } - - public int getColumn() { - return column; - } - - public int getLine() { - return line; - } -} Deleted: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Assert.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Assert.java 2008-08-27 21:35:58 UTC (rev 14937) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Assert.java 2008-08-28 05:24:15 UTC (rev 14938) @@ -1,52 +0,0 @@ -/* - * This file is part of the Jikes RVM project (http://jikesrvm.org). - * - * This file is licensed to You under the Common Public License (CPL); - * You may not use this file except in compliance with the License. You - * may obtain a copy of the License at - * - * http://www.opensource.org/licenses/cpl1.0.php - * - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. - */ -package org.mmtk.harness.lang; - -import java.util.List; - -/** - * Asserts a condition and then prints output and exits if the assertion fails. - */ -public class Assert implements Statement { - /** The expression to check */ - private final Expression cond; - /** The expression to print */ - private final List<Expression> exprs; - - /** - * Constructor - * @param slot Stack frame slot of the variable - */ - public Assert(Expression cond, List<Expression> exprs) { - this.cond = cond; - this.exprs = exprs; - } - - /** - * Execute the statement - */ - public void exec(Env env) { - Value condVal = cond.eval(env); - env.gcSafePoint(); - - if (!condVal.getBoolValue()) { - StringBuilder output = new StringBuilder(); - for(Expression expr: exprs) { - output.append(expr.eval(env)); - env.gcSafePoint(); - } - System.err.println(output); - System.exit(1); - } - } -} Deleted: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Assignment.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Assignment.java 2008-08-27 21:35:58 UTC (rev 14937) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Assignment.java 2008-08-28 05:24:15 UTC (rev 14938) @@ -1,38 +0,0 @@ -/* - * This file is part of the Jikes RVM project (http://jikesrvm.org). - * - * This file is licensed to You under the Common Public License (CPL); - * You may not use this file except in compliance with the License. You - * may obtain a copy of the License at - * - * http://www.opensource.org/licenses/cpl1.0.php - * - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. - */ -package org.mmtk.harness.lang; - -/** - * An assignment of an expression to a stack variable. - */ -public class Assignment implements Statement { - /** The slot to assign to in the stack frame */ - private int slot; - /** The expression to assign */ - private Expression expr; - - /** - * Create a new assignment of the given expression to the specified variable. - */ - public Assignment(int slot, Expression expr) { - this.slot = slot; - this.expr = expr; - } - - /** - * Perform the assignment. - */ - public void exec(Env env) throws ReturnException { - env.top().set(slot, expr.eval(env)); - } -} Deleted: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/BinaryExpression.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/BinaryExpression.java 2008-08-27 21:35:58 UTC (rev 14937) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/BinaryExpression.java 2008-08-28 05:24:15 UTC (rev 14938) @@ -1,89 +0,0 @@ -/* - * This file is part of the Jikes RVM project (http://jikesrvm.org). - * - * This file is licensed to You under the Common Public License (CPL); - * You may not use this file except in compliance with the License. You - * may obtain a copy of the License at - * - * http://www.opensource.org/licenses/cpl1.0.php - * - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. - */ -package org.mmtk.harness.lang; - -/** - * A binary expression. - */ -public class BinaryExpression implements Expression { - /** The left hand side of the expression. */ - private final Expression lhs; - /** The right hand side of the expression */ - private final Expression rhs; - /** The operator */ - private Operator op; - - /** - * Create a binary expression. - */ - public BinaryExpression(Expression lhs, Operator op, Expression rhs) { - this.lhs = lhs; - this.op = op; - this.rhs = rhs; - } - - /** - * Evaluate the binary expression. - */ - public Value eval(Env env) { - Value lhsVal = lhs.eval(env); - env.pushTemporary(lhsVal); - env.gcSafePoint(); - - Value rhsVal = rhs.eval(env); - - try { - env.check(lhsVal.type() == rhsVal.type(), "Mismatched types in expression"); - - /* Valid for all */ - switch (op) { - case EQ: return new BoolValue(lhsVal.equals(rhsVal)); - case NE: return new BoolValue(!lhsVal.equals(rhsVal)); - default: - } - - /* Only valid for boolean */ - if (lhsVal.type() == Type.BOOLEAN && rhsVal.type() == Type.BOOLEAN) { - switch (op) { - case AND: return new BoolValue(lhsVal.getBoolValue() && rhsVal.getBoolValue()); - case OR: return new BoolValue(lhsVal.getBoolValue() || rhsVal.getBoolValue()); - default: - } - } - - /* Only valid for numeric */ - if (lhsVal.type() == Type.INT && rhsVal.type() == Type.INT) { - switch (op) { - case PLUS: return new IntValue(lhsVal.getIntValue() + rhsVal.getIntValue()); - case MINUS: return new IntValue(lhsVal.getIntValue() - rhsVal.getIntValue()); - case MULT: return new IntValue(lhsVal.getIntValue() * rhsVal.getIntValue()); - case DIV: return new IntValue(lhsVal.getIntValue() / rhsVal.getIntValue()); - case REM: return new IntValue(lhsVal.getIntValue() % rhsVal.getIntValue()); - case LS: return new IntValue(lhsVal.getIntValue() << rhsVal.getIntValue()); - case RS: return new IntValue(lhsVal.getIntValue() >> rhsVal.getIntValue()); - case RSL: return new IntValue(lhsVal.getIntValue() >>> rhsVal.getIntValue()); - case GT: return new BoolValue(lhsVal.getIntValue() > rhsVal.getIntValue()); - case LT: return new BoolValue(lhsVal.getIntValue() < rhsVal.getIntValue()); - case GE: return new BoolValue(lhsVal.getIntValue() >= rhsVal.getIntValue()); - case LE: return new BoolValue(lhsVal.getIntValue() <= rhsVal.getIntValue()); - default: - } - } - - env.fail("Invalid binary expression " + op.name()); - return null; - } finally { - env.popTemporary(lhsVal); - } - } -} Deleted: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/BoolValue.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/BoolValue.java 2008-08-27 21:35:58 UTC (rev 14937) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/BoolValue.java 2008-08-28 05:24:15 UTC (rev 14938) @@ -1,77 +0,0 @@ -/* - * This file is part of the Jikes RVM project (http://jikesrvm.org). - * - * This file is licensed to You under the Common Public License (CPL); - * You may not use this file except in compliance with the License. You - * may obtain a copy of the License at - * - * http://www.opensource.org/licenses/cpl1.0.php - * - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. - */ -package org.mmtk.harness.lang; - -/** - * Expression consisting of a simple boolean value - */ -public class BoolValue extends Value { - - /** The value */ - private boolean value; - - /** - * Constructor - * @param value - */ - public BoolValue(boolean value) { - this.value = value; - } - - /** - * Object equality. - */ - @Override - public boolean equals(Object other) { - return (other instanceof BoolValue && value == ((BoolValue)other).value); - } - - /** - * Copy the value from the given new value. - */ - public void copyFrom(Value newValue) { - this.value = newValue.getBoolValue(); - } - - /** - * Get this value as a boolean. - */ - @Override - public boolean getBoolValue() { - return value; - } - - /** - * String representation - */ - @Override - public String toString() { - return Boolean.toString(value); - } - - /** - * The type of this value - */ - @Override - public Type type() { - return Type.BOOLEAN; - } - - /** - * @see java.lang.Object#clone() - */ - @Override - public BoolValue clone() { - return new BoolValue(value); - } -} Deleted: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Call.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Call.java 2008-08-27 21:35:58 UTC (rev 14937) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Call.java 2008-08-28 05:24:15 UTC (rev 14938) @@ -1,99 +0,0 @@ -/* - * This file is part of the Jikes RVM project (http://jikesrvm.org). - * - * This file is licensed to You under the Common Public License (CPL); - * You may not use this file except in compliance with the License. You - * may obtain a copy of the License at - * - * http://www.opensource.org/licenses/cpl1.0.php - * - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. - */ -package org.mmtk.harness.lang; - -import java.util.List; - -import org.mmtk.harness.lang.Trace.Item; -import org.mmtk.harness.lang.parser.MethodTable; - -/** - * A call to a method. - */ -public class Call implements Statement, Expression { - /** Method table */ - private final MethodTable methods; - /** Method name */ - private final String methodName; - /** Parameter expressions */ - private final List<Expression> params; - - /** - * Call a method. - */ - public Call(MethodTable methods, String methodName, List<Expression> params) { - this.methods = methods; - this.methodName = methodName; - this.params = params; - } - - /** - * Run this statement. - */ - public void exec(Env env) throws ReturnException { - Method method = methods.get(methodName); - - Value[] values = evalParams(env); - popTemporaries(env, values); - method.exec(env, values); - } - - /** - * Call as an expression - */ - public Value eval(Env env) { - Method method = methods.get(methodName); - - Value[] values = evalParams(env); - - if (Trace.isEnabled(Item.CALL)) { - System.out.printf("Call %s(",methodName); - for (int i=0; i < values.length; i++) { - System.out.printf("%s%s",values[i].toString(),i == values.length-1 ? ")\n" : ", "); - } - } - popTemporaries(env, values); - // No GC safe points between here and when everything is saved in the callee's stack - return method.eval(env, values); - } - - /** - * Evaluate method parameters, ensuring that temporaries are gc-safe between - * each evaluation. - * @param env - * @return - */ - private Value[] evalParams(Env env) { - Value[] values = new Value[params.size()]; - for(int i=0; i < params.size(); i++) { - values[i] = params.get(i).eval(env); - // GC may occur between evaluating each parameter - env.pushTemporary(values[i]); - env.gcSafePoint(); - } - return values; - } - - /** - * Pop all temporaries off the stack - * @param env - * @param values - */ - private void popTemporaries(Env env, Value[] values) { - for(int i=params.size() - 1; i >= 0; i--) { - env.popTemporary(values[i]); - } - } - - -} Added: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Checker.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Checker.java (rev 0) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Checker.java 2008-08-28 05:24:15 UTC (rev 14938) @@ -0,0 +1,365 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Common Public License (CPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/cpl1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ +package org.mmtk.harness.lang; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.mmtk.harness.lang.Trace.Item; +import org.mmtk.harness.lang.ast.AST; +import org.mmtk.harness.lang.ast.Alloc; +import org.mmtk.harness.lang.ast.Assert; +import org.mmtk.harness.lang.ast.Assignment; +import org.mmtk.harness.lang.ast.BinaryExpression; +import org.mmtk.harness.lang.ast.Call; +import org.mmtk.harness.lang.ast.Constant; +import org.mmtk.harness.lang.ast.Empty; +import org.mmtk.harness.lang.ast.Expect; +import org.mmtk.harness.lang.ast.Expression; +import org.mmtk.harness.lang.ast.IfStatement; +import org.mmtk.harness.lang.ast.LoadField; +import org.mmtk.harness.lang.ast.Method; +import org.mmtk.harness.lang.ast.NormalMethod; +import org.mmtk.harness.lang.ast.Operator; +import org.mmtk.harness.lang.ast.PrintStatement; +import org.mmtk.harness.lang.ast.Return; +import org.mmtk.harness.lang.ast.Sequence; +import org.mmtk.harness.lang.ast.Spawn; +import org.mmtk.harness.lang.ast.Statement; +import org.mmtk.harness.lang.ast.StoreField; +import org.mmtk.harness.lang.ast.Type; +import org.mmtk.harness.lang.ast.UnaryExpression; +import org.mmtk.harness.lang.ast.Variable; +import org.mmtk.harness.lang.ast.WhileStatement; +import org.mmtk.harness.lang.parser.MethodTable; +import org.mmtk.harness.lang.runtime.Value; + +/** + * A type-checker visitor for MMTk scripts + */ +public class Checker extends Visitor { + + /** + * Type check a script, represented by its method table. + * @param methods + */ + public static void typeCheck(MethodTable methods) { + Checker checker = new Checker(); + for (Method m : methods.normalMethods()) { + m.accept(checker); + } + } + + /** + * The type of the most recently visited expression. + */ + private Type type; + + /** + * The type of the current method + */ + private Type returnType; + + /** + * Variable initialisation status + */ + private boolean[] isInitialized; + + /** + * @return The type of the most recently visited expression. + */ + public Type getType() { return type; } + + /** + * Visit an expression and return its type. + * @param expr + * @return + */ + private Type getTypeOf(Expression expr) { + expr.accept(this); + Trace.trace(Item.CHECKER,"Type of %s is %s%n",PrettyPrinter.format(expr),type.toString()); + return type; + } + + /** + * Visit an expression, and return true if the result type is in the given + * list of types. + * @param expr + * @param types + * @return + */ + private boolean checkType(Expression expr, Type...types) { + getTypeOf(expr); + for (Type t : types) { + if (type == t) { + return true; + } + } + return false; + } + + /** + * Report an error and exit + * @param ast + * @param message + */ + private static void fail(AST ast, String message) { + System.err.printf("Error at line %d: %s%n",ast.getLine(),message); + PrettyPrinter.print(System.err, ast); System.err.println(); + throw new RuntimeException(message); + } + + private void checkParams(AST marker, List<Type> actualTypes, List<Type> formalTypes) { + Iterator<Type> actualTypeIter = actualTypes.iterator(); + for (Type actualParamType : formalTypes) { + Type formalParamType = actualTypeIter.next(); + if (!formalParamType.isCompatibleWith(actualParamType)) { + fail(marker,"Actual parameter of type "+actualParamType+ + " is incompatible with formal param of type "+formalParamType); + } + } + } + + /****************************************************************************** + * + * Visitor methods + * + */ + + + @Override + public void visit(Alloc alloc) { + if (!checkType(alloc.getRefCount(),Type.INT)) { + fail(alloc,"Allocation reference count must be integer"); + } + if (!checkType(alloc.getDataCount(),Type.INT)) { + fail(alloc,"Allocation data count must be integer"); + } + if (!checkType(alloc.getDoubleAlign(),Type.BOOLEAN)) { + fail(alloc,"Allocation double align must be boolean"); + } + type = Type.OBJECT; + } + + @Override + public void visit(Assert ass) { + checkType(ass.getPredicate(),Type.BOOLEAN); + type = Type.VOID; + } + + @Override + public void visit(Assignment a) { + isInitialized[a.getSlot()] = true; + Type lhsType = a.getSymbol().getType(); + checkType(a.getRhs(),lhsType); + type = Type.VOID; + } + + @Override + public void visit(BinaryExpression exp) { + Type lhsType = getTypeOf(exp.getLhs()); + Type rhsType = getTypeOf(exp.getRhs()); + Operator op = exp.getOperator(); + boolean ok = true; + if (lhsType != rhsType) { + // Allow boolean/object comparisons + if (op == Operator.EQ || op == Operator.NE) { + if ((lhsType == Type.BOOLEAN && rhsType == Type.OBJECT) || + (lhsType == Type.OBJECT && rhsType == Type.BOOLEAN)) { + ok = true; + } else { + ok = false; + } + } else { + ok = false; + } + if (!ok) { + fail(exp,"Type mismatch"); + } + } + if (Operator.booleanOperators.contains(op)) { + type = Type.BOOLEAN; + } else { + type = lhsType; + } + } + + @Override + public void visit(Call call) { + Method m = call.getMethod(); + if (call.getParams().size() != m.getParamCount()) { + fail(call,"Wrong number of parameters"); + } + + List<Type> actualTypes = new ArrayList<Type>(); + /* Type-check the actual parameter expressions */ + for (Expression param : call.getParams()) { + param.accept(this); + actualTypes.add(type); + } + checkParams(call, actualTypes, m.getParamTypes()); + if (call.isExpression()) { + type = call.getMethod().getReturnType(); + } else { + type = Type.VOID; + } + } + + @Override + public void visit(Constant c) { + type = c.value.type(); + } + + @Override + public void visit(Empty e) { + type = Type.VOID; + } + + @Override + public void visit(Expect exc) { + type = Type.VOID; + } + + @Override + public void visit(IfStatement conditional) { + for (Expression e : conditional.getConds()) { + if (!checkType(e,Type.BOOLEAN)) { + fail(e,"Conditional must have type BOOLEAN"); + } + } + for (Statement s : conditional.getStmts()) { + s.accept(this); + } + type = Type.VOID; + } + + @Override + public void visit(LoadField load) { + if (load.getObjectSymbol().getType() != Type.OBJECT) { + fail(load,"Target of loadfield must be an Object"); + } + load.getIndex().accept(this); + if (type != Type.INT) { + fail(load,"Loadfield index must have type INTEGER"); + } + type = load.getFieldType(); + } + + @Override + public void visit(NormalMethod method) { + isInitialized = new boolean[method.getDecls().size()]; + for (Declaration decl : method.getParams()) { + isInitialized[decl.getSlot()] = true; + } + returnType = method.getReturnType(); + method.getBody().accept(this); + type = returnType; + } + + @Override + public void visit(PrintStatement print) { + for (Expression exp : print.getArgs()) { + exp.accept(this); + } + type = Type.VOID; + } + + /** + * Checks that + * - The expression returned is internally consistent + * - The type of the return value is compatible with the + * declared type of the method + */ + @Override + public void visit(Return ret) { + if (ret.hasReturnValue()) { + ret.getRhs().accept(this); + if (!returnType.isCompatibleWith(type)) { + fail(ret,"Returning a "+type+" in a method declared as "+returnType); + } + } else if (returnType != Type.VOID) { + fail(ret,"Returning from a non-void method requires a return value"); + } else { + type = Type.VOID; + } + } + + @Override + public void visit(Sequence ass) { + super.visit(ass); + } + + /** + * Check + * - Actual parameter expressions + * - Actual parameters against method formal parameters + */ + @Override + public void visit(Spawn sp) { + List<Type> actualTypes = new ArrayList<Type>(); + for (Expression expr : sp.getArgs()) { + expr.accept(this); + actualTypes.add(type); + } + checkParams(sp, actualTypes, sp.getMethod().getParamTypes()); + type = Type.VOID; + } + + @Override + public void visit(StoreField store) { + if (store.getObjectSymbol().getType() != Type.OBJECT) { + fail(store,"Target of storefield must be an Object"); + } + if (getTypeOf(store.getIndex()) != Type.INT) { + fail(store,"Storefield index must have type INTEGER"); + } + if (getTypeOf(store.getRhs()) != store.getFieldType()) { + fail(store,"Storefield to a "+store.getFieldType()+" must have type "+store.getFieldType()); + } + type = Type.VOID; + } + + @Override + public void visit(UnaryExpression exp) { + /* Unary operators preserve type */ + exp.getOperand().accept(this); + /* With this one exception ... */ + if (exp.getOperator() == Operator.NOT && type == Type.OBJECT) { + type = Type.BOOLEAN; + } + } + + @Override + public void visit(Value v) { + type = v.type(); + } + + @Override + public void visit(Variable var) { + if (!isInitialized[var.getSlot()]) { + fail(var,"Variable "+var.getSymbol().getName()+" is not initialized before use"); + } + type = var.getSymbol().getType(); + } + + @Override + public void visit(WhileStatement w) { + if (!checkType(w.getCond(),Type.BOOLEAN,Type.OBJECT)) { + fail(w,"While condition must have type BOOLEAN"); + } + w.getBody().accept(this); + type = Type.VOID; + } + +} Added: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Compiler.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Compiler.java (rev 0) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Compiler.java 2008-08-28 05:24:15 UTC (rev 14938) @@ -0,0 +1,359 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Common Public License (CPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/cpl1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ +package org.mmtk.harness.lang; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.mmtk.harness.Harness; +import org.mmtk.harness.lang.ast.Alloc; +import org.mmtk.harness.lang.ast.Assert; +import org.mmtk.harness.lang.ast.Assignment; +import org.mmtk.harness.lang.ast.BinaryExpression; +import org.mmtk.harness.lang.ast.Call; +import org.mmtk.harness.lang.ast.Constant; +import org.mmtk.harness.lang.ast.Empty; +import org.mmtk.harness.lang.ast.Expect; +import org.mmtk.harness.lang.ast.Expression; +import org.mmtk.harness.lang.ast.IfStatement; +import org.mmtk.harness.lang.ast.IntrinsicMethod; +import org.mmtk.harness.lang.ast.LoadField; +import org.mmtk.harness.lang.ast.Method; +import org.mmtk.harness.lang.ast.NormalMethod; +import org.mmtk.harness.lang.ast.PrintStatement; +import org.mmtk.harness.lang.ast.Return; +import org.mmtk.harness.lang.ast.Sequence; +import org.mmtk.harness.lang.ast.Statement; +import org.mmtk.harness.lang.ast.Spawn; +import org.mmtk.harness.lang.ast.StoreField; +import org.mmtk.harness.lang.ast.Type; +import org.mmtk.harness.lang.ast.UnaryExpression; +import org.mmtk.harness.lang.ast.Variable; +import org.mmtk.harness.lang.ast.WhileStatement; +import org.mmtk.harness.lang.compiler.CompiledMethod; +import org.mmtk.harness.lang.compiler.CompiledMethodProxy; +import org.mmtk.harness.lang.compiler.CompiledMethodTable; +import org.mmtk.harness.lang.compiler.Register; +import org.mmtk.harness.lang.compiler.Temporary; +import org.mmtk.harness.lang.parser.MethodTable; +import org.mmtk.harness.lang.pcode.AllocOp; +import org.mmtk.harness.lang.pcode.BinaryOperation; +import org.mmtk.harness.lang.pcode.Branch; +import org.mmtk.harness.lang.pcode.CallIntrinsicOp; +import org.mmtk.harness.lang.pcode.CallNormalOp; +import org.mmtk.harness.lang.pcode.ExitOp; +import org.mmtk.harness.lang.pcode.ExpectOp; +import org.mmtk.harness.lang.pcode.Goto; +import org.mmtk.harness.lang.pcode.PrintOp; +import org.mmtk.harness.lang.pcode.PseudoOp; +import org.mmtk.harness.lang.pcode.ReturnOp; +import org.mmtk.harness.lang.pcode.SpawnOp; +import org.mmtk.harness.lang.pcode.StoreFieldOp; +import org.mmtk.harness.lang.pcode.StoreLocal; +import org.mmtk.harness.lang.pcode.UnaryOperation; +import org.mmtk.harness.lang.runtime.ConstantPool; + +public final class Compiler extends Visitor { + + static { + //Trace.enable(Item.COMPILER); + //Trace.enable(Item.EVAL); + } + + private final CompiledMethod current; + private final CompiledMethodTable methodTable; + private final Temporary temps; + private final UnsyncStack<Register> operands = new UnsyncStack<Register>(); + + private Compiler(NormalMethod method, CompiledMethodTable table) { + this.current = new CompiledMethod(method); + this.methodTable = table; + this.temps = new Temporary(method.getDecls().size()); + } + + public static CompiledMethod compile(MethodTable methods) { + CompiledMethodTable table = new CompiledMethodTable(); + for (NormalMethod m : methods.normalMethods()) { + Compiler compiler = new Compiler(m,table); + m.accept(compiler); + table.put(compiler.yield()); + } + for (CompiledMethod cm : table) { + cm.resolveMethodReferences(); + if (Harness.dumpPcode.getValue()) { + System.out.println(cm.getName()+"\n"+cm.toString()); + } + } + return table.get("main"); + } + + /* + * Utility methods + */ + + public CompiledMethod yield() { + current.setTemps(temps.size()); + return current; + } + + private void emit(PseudoOp op) { + current.append(op); + } + + private int currentPc() { + return current.currentIndex(); + } + + private void freeTemps(List<Register> actuals) { + for (Register r : actuals) { + temps.release(r); + } + } + + private List<Register> compileArgList(List<Expression> args) { + ArrayList<Register> actuals = new ArrayList<Register>(args.size()); + for (Expression exp : args) { + exp.accept(this); + actuals.add(operands.pop()); + } + return actuals; + } + + private CompiledMethod compiledMethodFor(Method method) { + CompiledMethod compiledMethod = methodTable.get(method.getName()); + if (compiledMethod == null) { + compiledMethod = new CompiledMethodProxy((NormalMethod)method,methodTable); + } + return compiledMethod; + } + + + @Override + public void visit(Alloc alloc) { + alloc.getDataCount().accept(this); + Register dataCount = operands.pop(); + alloc.getRefCount().accept(this); + Register refCount = operands.pop(); + alloc.getDoubleAlign().accept(this); + Register doubleAlign = operands.pop(); + Register result = temps.acquire(); + emit(new AllocOp(result,dataCount,refCount,doubleAlign,alloc.getSite())); + operands.push(result); + temps.release(dataCount,refCount,doubleAlign); + } + + @Override + public void visit(Assert ass) { + ass.getPredicate().accept(this); // Compile the predicate + Register predicate = operands.pop(); + Branch branch = new Branch(predicate,true); + emit(branch); + temps.release(predicate); + ArrayList<Register> actuals = new ArrayList<Register>(ass.getOutputs().size()); + for (Expression expr : ass.getOutputs()) { + expr.accept(this); + actuals.add(operands.pop()); + } + emit(new PrintOp(actuals.toArray(new Register[0]))); + freeTemps(actuals); + emit(new ExitOp(ConstantPool.ONE)); + branch.setBranchTarget(currentPc()); + } + + @Override + public void visit(Assignment a) { + a.getRhs().accept(this); + Register rhs = operands.pop(); + emit(new StoreLocal(Register.createLocal(a.getSlot()),rhs)); + temps.release(rhs); + } + + @Override + public void visit(BinaryExpression exp) { + exp.getLhs().accept(this); + Register lhs = operands.pop(); + exp.getRhs().accept(this); + Register rhs = operands.pop(); + Register result = temps.acquire(); + emit(new BinaryOperation(result,lhs,rhs,exp.getOperator())); + temps.release(rhs,lhs); + operands.push(result); + } + + @Override + public void visit(Call call) { + Method method = call.getMethod(); + + + List<Register> actuals = compileArgList(call.getParams()); + Register returnVal = method.getReturnType() == Type.VOID ? + Register.NULL : temps.acquire(); + + if (method instanceof IntrinsicMethod) { + emit(new CallIntrinsicOp(returnVal,(IntrinsicMethod)method,actuals)); + } else if (method instanceof NormalMethod) { + CompiledMethod compiledMethod = compiledMethodFor(method); + emit(new CallNormalOp(returnVal,compiledMethod,actuals)); + } else { + throw new RuntimeException("Unknown method class "+method.getClass().getCanonicalName()); + } + freeTemps(actuals); + if (returnVal != Register.NULL) + operands.push(returnVal); + } + + /** + * Constant value. push an operand which fetches from the + * global constant pool + */ + @Override + public void visit(Constant c) { + operands.push(ConstantPool.acquire(c.value)); + } + + @Override + public void visit(Empty e) { + // Do nothing + } + + @Override + public void visit(Expect exp) { + emit(new ExpectOp(exp.getExpected())); + } + + @Override + public void visit(IfStatement conditional) { + Iterator<Statement> stmtIter = conditional.getStmts().iterator(); + Branch branch = new Branch(Register.NULL,false); + Goto gotoExit = new Goto(); + for (Expression cond : conditional.getConds()) { + branch.setBranchTarget(currentPc()); + cond.accept(this); + Register conditionReg = operands.pop(); + branch = new Branch(conditionReg,false); + temps.release(conditionReg); + emit(branch); + stmtIter.next().accept(this); + emit(gotoExit); + } + branch.setBranchTarget(currentPc()); + if (stmtIter.hasNext()) { + stmtIter.next().accept(this); + } + gotoExit.setBranchTarget(currentPc()); + } + + @Override + public void visit(IntrinsicMethod method) { + throw new RuntimeException("You can't compile an intrinsic method!!!"); + } + + @Override + public void visit(LoadField load) { + load.getIndex().accept(this); + Register index = operands.pop(); + Register object = Register.createLocal(load.getSlot()); + Register result = temps.acquire(); + emit(new org.mmtk.harness.lang.pcode.LoadFieldOp(result,object,index,load.getFieldType())); + temps.release(index); + operands.push(result); + } + + @Override + public void visit(NormalMethod method) { + method.getBody().accept(this); + emit(new ReturnOp()); + } + + @Override + public void visit(PrintStatement print) { + List<Expression> args = print.getArgs(); + List<Register> actuals = compileArgList(args); + emit(new PrintOp(actuals)); + freeTemps(actuals); + } + + @Override + public void visit(Return ret) { + if (ret.hasReturnValue()) { + ret.getRhs().accept(this); + emit(new ReturnOp(operands.pop())); + } else { + emit(new ReturnOp()); + } + } + + @Override + public void visit(Sequence ass) { + for (Statement stmt : ass) { + stmt.accept(this); + } + } + + @Override + public void visit(Spawn sp) { + List<Register> actuals = compileArgList(sp.getArgs()); + emit(new SpawnOp(compiledMethodFor(sp.getMethod()),actuals)); + freeTemps(actuals); + } + + @Override + public void visit(StoreField store) { + store.getIndex().accept(this); + Register index = operands.pop(); + store.getRhs().accept(this); + Register value = operands.pop(); + Register object = Register.createLocal(store.getSlot()); + emit(new StoreFieldOp(object,index,value,store.getFieldType())); + temps.release(index,value); + } + + @Override + public void visit(UnaryExpression exp) { + exp.getOperand().accept(this); + Register operand = operands.peek(); + emit(new UnaryOperation(operand,operand,exp.getOperator())); + } + + /** + * Variable reference: push an operand which will fetch + * the appropriate stack frame slot. + */ + @Override + public void visit(Variable var) { + operands.push(Register.createLocal(var.getSlot())); + } + + /** + * While statement. Compiled to: + * top: condition + * if false goto b + * body + * goto top: + * b: + */ + @Override + public void visit(WhileStatement w) { + int top = currentPc(); + w.getCond().accept(this); // Compile the loop condition + Register cond = operands.pop(); + Branch branchToExit = new Branch(cond,false); + temps.release(cond); + emit(branchToExit); + w.getBody().accept(this); + emit(new Goto(top)); + branchToExit.setBranchTarget(currentPc()); + } + +} Property changes on: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Compiler.java ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Declaration.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Declaration.java 2008-08-27 21:35:58 UTC (rev 14937) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Declaration.java 2008-08-28 05:24:15 UTC (rev 14938) @@ -12,18 +12,22 @@ */ package org.mmtk.harness.lang; +import org.mmtk.harness.lang.ast.Type; +import org.mmtk.harness.lang.parser.Symbol; +import org.mmtk.harness.lang.runtime.Value; + /** * A variable declaration */ public class Declaration { /** Name of the variable */ - public String name; + private final Symbol symbol; /** Initial value - actually holds the value for the lifetime of the variable */ - public Value initial; + private final Value initial; /** Stack frame slot */ - public int slot; + private final int slot; /** * Constructor @@ -32,9 +36,29 @@ * @param initial * @param slot */ - public Declaration(String name, Value initial, int slot) { - this.name = name; + public Declaration(Symbol symbol, Value initial) { + this.symbol = symbol; this.initial = initial; - this.slot = slot; + this.slot = symbol.getLocation(); } + + public void accept(Visitor v) { + v.visit(this); + } + + public String getName() { + return symbol.getName(); + } + + public Value getInitial() { + return initial; + } + + public int getSlot() { + return slot; + } + + public Type getType() { + return symbol.getType(); + } } Deleted: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Empty.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Empty.java 2008-08-27 21:35:58 UTC (rev 14937) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Empty.java 2008-08-28 05:24:15 UTC (rev 14938) @@ -1,29 +0,0 @@ -/* - * This file is part of the Jikes RVM project (http://jikesrvm.org). - * - * This file is licensed to You under the Common Public License (CPL); - * You may not use this file except in compliance with the License. You - * may obtain a copy of the License at - * - * http://www.opensource.org/licenses/cpl1.0.php - * - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. - */ -package org.mmtk.harness.lang; - -/** - * An empty statement. Useful in helping construct the parser. - */ -public class Empty implements Statement { - - /** Constructor */ - public Empty() { - } - - /** - * Execute the empty statement (do nothing) - */ - public void exec(Env env) throws ReturnException { - } -} Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Env.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Env.java 2008-08-27 21:35:58 UTC (rev 14937) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Env.java 2008-08-28 05:24:15 UTC (rev 14938) @@ -17,6 +17,11 @@ import org.mmtk.harness.Mutator; import org.mmtk.harness.lang.Trace.Item; +import org.mmtk.harness.lang.compiler.CompiledMethod; +import org.mmtk.harness.lang.runtime.ObjectValue; +import org.mmtk.harness.lang.runtime.PcodeInterpreter; +import org.mmtk.harness.lang.runtime.StackFrame; +import org.mmtk.harness.lang.runtime.Value; import org.mmtk.plan.TraceLocal; import org.vmmagic.unboxed.ObjectReference; @@ -30,7 +35,7 @@ /** * The stack */ - private Stack<StackFrame> stack = new Stack<StackFrame>(); + private UnsyncStack<StackFrame> stack = new UnsyncStack<StackFrame>(); /** * The temporary values saved during evaluation. @@ -38,9 +43,9 @@ private Stack<ObjectValue> temporaries = new Stack<ObjectValue>(); /** - * The main program + * The main program if we're using the compiler */ - private final Statement body; + private final CompiledMethod body; /** * A source of random numbers (we have one per thread so that we can write @@ -48,12 +53,7 @@ */ private Random rng = new Random(); - /** - * Create an environment with the given main program - * @param body - */ - public Env(Statement body) { - super(); + public Env(CompiledMethod body) { this.body = body; } @@ -67,23 +67,11 @@ @Override public void run() { begin(); - try { - body.exec(this); - } catc... [truncated message content] |
From: <rg...@us...> - 2008-09-15 08:26:20
|
Revision: 14984 http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=14984&view=rev Author: rgarner Date: 2008-09-15 08:26:08 +0000 (Mon, 15 Sep 2008) Log Message: ----------- MMTk Harness: Factor out scheduling/threading issues, and introduce a deterministic scheduler. Modified Paths: -------------- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ActivePlan.java rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Collection.java rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Factory.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Collector.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Harness.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Main.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Mutator.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Env.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Trace.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/compiler/CompiledMethod.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/SpawnOp.java rvmroot/trunk/MMTk/harness/vmmagic/org/vmmagic/unboxed/SimulatedMemory.java Added Paths: ----------- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/PolicyStats.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/RandomPolicyLength.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/RandomPolicyMax.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/RandomPolicyMin.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/RandomPolicySeed.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/Scheduler.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/SchedulerPolicy.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/YieldInterval.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/AbstractPolicy.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/Lock.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/Policy.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/Schedulable.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/Scheduler.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/ThreadModel.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/YieldAlways.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/YieldEvery.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/YieldNever.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/YieldRandomly.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/javathreads/ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/javathreads/JavaThreads.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/javathreads/Lock.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/javathreads/MMTkThread.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/javathreads/Rendezvous.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/rawthreads/ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/rawthreads/Lock.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/rawthreads/RawThread.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/rawthreads/RawThreads.java Removed Paths: ------------- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Lock.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/MMTkThread.java Modified: rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ActivePlan.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ActivePlan.java 2008-09-15 03:59:13 UTC (rev 14983) +++ rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ActivePlan.java 2008-09-15 08:26:08 UTC (rev 14984) @@ -13,8 +13,8 @@ package org.mmtk.harness.vm; import org.mmtk.harness.Collector; -import org.mmtk.harness.MMTkThread; import org.mmtk.harness.Mutator; +import org.mmtk.harness.scheduler.Scheduler; import org.mmtk.plan.Plan; import org.mmtk.plan.CollectorContext; import org.mmtk.plan.MutatorContext; @@ -65,7 +65,7 @@ public MutatorContext mutator() { return Mutator.current().getContext(); } /** @return The active <code>MutatorContext</code> instance. */ - public Log log() { return MMTkThread.current().getLog(); } + public Log log() { return Scheduler.currentLog(); } /** * Return the <code>CollectorContext</code> instance given its unique identifier. Modified: rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Collection.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Collection.java 2008-09-15 03:59:13 UTC (rev 14983) +++ rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Collection.java 2008-09-15 08:26:08 UTC (rev 14984) @@ -15,6 +15,7 @@ import org.mmtk.harness.Collector; import org.mmtk.harness.Harness; import org.mmtk.harness.Mutator; +import org.mmtk.harness.scheduler.Scheduler; import org.mmtk.plan.CollectorContext; import org.mmtk.plan.MutatorContext; import org.mmtk.plan.Plan; @@ -59,7 +60,7 @@ if (mutator.isOutOfMemory()) throw new Mutator.OutOfMemory(); Collector.triggerGC(why); - Mutator.current().waitForGC(); + Scheduler.waitForGC(); if (mutator.isOutOfMemory() && !mutator.isPhysicalAllocationFailure()) { throw new Mutator.OutOfMemory(); @@ -148,7 +149,7 @@ * @return True if GC is not in progress. */ public boolean noThreadsInGC() { - return Collector.noThreadsInGC(); + return Scheduler.noThreadsInGC(); } /** Modified: rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Factory.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Factory.java 2008-09-15 03:59:13 UTC (rev 14983) +++ rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Factory.java 2008-09-15 08:26:08 UTC (rev 14984) @@ -14,6 +14,8 @@ import org.vmutil.options.OptionSet; import org.mmtk.harness.Harness; +import org.mmtk.harness.scheduler.Lock; +import org.mmtk.harness.scheduler.Scheduler; import org.mmtk.utility.gcspy.Color; import org.mmtk.utility.gcspy.drivers.AbstractDriver; import org.mmtk.vm.gcspy.ByteStream; @@ -105,7 +107,7 @@ * @return A concrete VM-specific Lock instance. */ public Lock newLock(String name) { - return new Lock(name); + return Scheduler.newLock(name); } /** Deleted: rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Lock.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Lock.java 2008-09-15 03:59:13 UTC (rev 14983) +++ rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Lock.java 2008-09-15 08:26:08 UTC (rev 14984) @@ -1,75 +0,0 @@ -/* - * This file is part of the Jikes RVM project (http://jikesrvm.org). - * - * This file is licensed to You under the Common Public License (CPL); - * You may not use this file except in compliance with the License. You - * may obtain a copy of the License at - * - * http://www.opensource.org/licenses/cpl1.0.php - * - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. - */ -package org.mmtk.harness.vm; - -import org.vmmagic.pragma.Uninterruptible; - -/** - * Simple lock. - */ -@Uninterruptible -public class Lock extends org.mmtk.vm.Lock { - - /** The name of this lock */ - private String name; - - /** The current holder of the lock */ - private Thread holder; - - /** Create a new lock (with given name) */ - Lock(String name) { - setName(name); - } - - /** - * Set the name of this lock instance - * - * @param str The name of the lock (for error output). - */ - public void setName(String str) { - this.name = str; - } - - /** - * Try to acquire a lock and wait until acquired. - */ - public void acquire() { - synchronized(this) { - while(holder != null) { - try { - this.wait(); - } catch (InterruptedException ie) {} - } - holder = Thread.currentThread(); - } - } - - /** - * Perform sanity checks on the lock. For debugging. - * - * @param w Identifies the code location in the debugging output. - */ - public void check(int w) { - System.err.println("[" + name + "] AT " + w + " held by " + holder); - } - - /** - * Release the lock. - */ - public void release() { - synchronized(this) { - holder = null; - this.notifyAll(); - } - } -} Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Collector.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Collector.java 2008-09-15 03:59:13 UTC (rev 14983) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Collector.java 2008-09-15 08:26:08 UTC (rev 14984) @@ -14,6 +14,7 @@ import java.util.ArrayList; +import org.mmtk.harness.scheduler.Scheduler; import org.mmtk.harness.vm.ActivePlan; import org.mmtk.plan.CollectorContext; import org.mmtk.plan.Plan; @@ -24,14 +25,11 @@ /** * This class represents a collector thread. */ -public final class Collector extends MMTkThread { +public final class Collector implements Runnable { /** Registered collectors */ private static ArrayList<Collector> collectors = new ArrayList<Collector>(); - /** Thread access to current collector */ - private static ThreadLocal<Collector> collectorThreadLocal = new ThreadLocal<Collector>(); - /** * Get a collector by id. */ @@ -43,9 +41,8 @@ * Get the currently executing collector. */ public static Collector current() { - Collector c = collectorThreadLocal.get(); + Collector c = Scheduler.currentCollector(); assert c != null: "Collector.current() called from a thread without a collector context"; - assert c == Thread.currentThread() : "Collector.current() does not match Thread.currentThread()"; return c; } @@ -69,14 +66,8 @@ * Initialise numCollector collector threads. */ public static void init(int numCollectors) { - try { - Class<?> collectorClass = Class.forName(Harness.plan.getValue() + "Collector"); - for(int i = 0; i < numCollectors; i++) { - Collector c = new Collector((CollectorContext)collectorClass.newInstance()); - c.start(); - } - } catch (Exception ex) { - throw new RuntimeException("Could not create Collector", ex); + for(int i = 0; i < numCollectors; i++) { + Scheduler.scheduleCollector(); } } @@ -88,11 +79,15 @@ /** * Create a new Collector */ - private Collector(final CollectorContext context) { + public Collector() { + try { + Class<?> collectorClass = Class.forName(Harness.plan.getValue() + "Collector"); + this.context = (CollectorContext)collectorClass.newInstance(); + } catch (Exception ex) { + throw new RuntimeException("Could not create Collector", ex); + } collectors.set(context.getId(), this); - this.context = context; - setDaemon(true); - setUncaughtExceptionHandler(new UncaughtExceptionHandler() { + Thread.currentThread().setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { public void uncaughtException(Thread t, Throwable e) { System.err.print("Collector " + context.getId() + " caused unexpected exception: "); e.printStackTrace(); @@ -101,9 +96,6 @@ }); } - /** The number of collectors executing GC */ - private static int inGC; - /** The number of collections that have occurred */ public static int collectionCount; @@ -114,125 +106,49 @@ private static boolean heapDumpRequested; /** - * Are there no threads currently in GC? - */ - public static boolean noThreadsInGC() { - return inGC == 0; - } - - /** - * Has a GC been triggered? - */ - public static boolean gcTriggered() { - return inGC > 0; - } - - /** * Request a heap dump at the next GC. */ public static void requestHeapDump() { heapDumpRequested = true; } - /** Synchronisation object used for GC triggering */ - private static Object trigger = new Object(); - - /** The trigger for this GC */ - private static int triggerReason; - /** - * Wait for a GC to complete - */ - public static void waitForGC(boolean last) { - synchronized (trigger) { - if (last) { - trigger.notifyAll(); - } - while (inGC > 0) { - try { - trigger.wait(); - } catch (InterruptedException ie) {} - } - } - } - - /** * Trigger a collection for the given reason */ public static void triggerGC(int why) { - synchronized (trigger) { - triggerReason = why; - inGC = Harness.collectors.getValue(); - trigger.notifyAll(); - } + Scheduler.triggerGC(why); } /** - * A GC thread has completed its GC work. - */ - private static void exitGC() { - synchronized (trigger) { - inGC--; - if (inGC == 0) trigger.notifyAll(); - } - } - - /** * Return the MMTk CollectorContext for this collector. */ public CollectorContext getContext() { return context; } - /** Used during a GC to synchronise GC threads */ - private static Object rendezvousObject = new Object(); - - /** The rank that was given to the last thread to arrive at the rendezvous */ - private static int currentRank = 0; - /** * Rendezvous with all other processors, returning the rank * (that is, the order this processor arrived at the barrier). */ public static int rendezvous(int where) { - synchronized(rendezvousObject) { - int rank = ++currentRank; - if (currentRank == org.mmtk.vm.VM.activePlan.collectorCount()) { - currentRank = 0; - rendezvousObject.notifyAll(); - } else { - try { - rendezvousObject.wait(); - } catch (InterruptedException ie) { - assert false : "Interrupted in rendezvous"; - } - } - return rank; - } + return Scheduler.rendezvous(where); } /** * The main collector execution loop. Wait for a GC to be triggered, do the GC work and then wait again. */ public void run() { - collectorThreadLocal.set(this); boolean primary = context.getId() == 0; while(true) { - synchronized(trigger) { - while(inGC == 0 || !Mutator.allWaitingForGC()) { - try { - trigger.wait(); - } catch (InterruptedException ie) {} - } - } + Scheduler.waitForGCStart(); if (primary) { - Plan.setCollectionTrigger(triggerReason); + Plan.setCollectionTrigger(Scheduler.getTriggerReason()); } long startTime = System.nanoTime(); - boolean internalPhaseTriggered = (triggerReason == Collection.INTERNAL_PHASE_GC_TRIGGER); - boolean userTriggered = (triggerReason == Collection.EXTERNAL_GC_TRIGGER); + boolean internalPhaseTriggered = (Scheduler.getTriggerReason() == Collection.INTERNAL_PHASE_GC_TRIGGER); + boolean userTriggered = (Scheduler.getTriggerReason() == Collection.EXTERNAL_GC_TRIGGER); rendezvous(5000); do { @@ -301,7 +217,8 @@ if (primary) { Plan.collectionComplete(); } - exitGC(); + Scheduler.exitGC(); } } + } Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Harness.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Harness.java 2008-09-15 03:59:13 UTC (rev 14983) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Harness.java 2008-09-15 08:26:08 UTC (rev 14984) @@ -15,6 +15,7 @@ import java.util.ArrayList; import org.mmtk.harness.options.*; +import org.mmtk.harness.scheduler.AbstractPolicy; import org.mmtk.harness.vm.*; import org.mmtk.utility.heap.HeapGrowthManager; @@ -49,6 +50,24 @@ /** GC stress options */ public static GcEvery gcEvery = new GcEvery(); + /** Scheduler */ + public static Scheduler scheduler = new Scheduler(); + + /** Scheduler policy */ + public static SchedulerPolicy policy = new SchedulerPolicy(); + + /** Interval for the fixed scheduler policies */ + public static YieldInterval yieldInterval = new YieldInterval(); + + /** Parameters for the random scheduler policy */ + public static RandomPolicyLength randomPolicyLength = new RandomPolicyLength(); + public static RandomPolicySeed randomPolicySeed = new RandomPolicySeed(); + public static RandomPolicyMin randomPolicyMin = new RandomPolicyMin(); + public static RandomPolicyMax randomPolicyMax = new RandomPolicyMax(); + + /** Scheduler policy */ + public static PolicyStats policyStats = new PolicyStats(); + private static boolean isInitialized = false; /** @@ -98,6 +117,15 @@ /* Finish starting up MMTk */ ActivePlan.plan.postBoot(); ActivePlan.plan.fullyBooted(); + + /* Add exit handler to print yield stats */ + if (policyStats.getValue()) { + Runtime.getRuntime().addShutdownHook(new Thread() { + public void run() { + AbstractPolicy.printStats(); + } + }); + } } /** GC stress - GC on every allocation */ Deleted: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/MMTkThread.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/MMTkThread.java 2008-09-15 03:59:13 UTC (rev 14983) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/MMTkThread.java 2008-09-15 08:26:08 UTC (rev 14984) @@ -1,62 +0,0 @@ -/* - * This file is part of the Jikes RVM project (http://jikesrvm.org). - * - * This file is licensed to You under the Common Public License (CPL); - * You may not use this file except in compliance with the License. You - * may obtain a copy of the License at - * - * http://www.opensource.org/licenses/cpl1.0.php - * - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. - */ -package org.mmtk.harness; - - -import org.mmtk.utility.Log; - -/** - * This class represents an MMTk thread (mutator or collector). - */ -public class MMTkThread extends Thread { - /** The log associated with this thread */ - private final Log log = new Log(); - - /** - * Get the currently executing mutator. - */ - public static MMTkThread current() { - assert Thread.currentThread() instanceof MMTkThread : "Current thread does is not an MMTk thread"; - return (MMTkThread)Thread.currentThread(); - } - - /** - * Create an MMTk thread. - * - * @param entryPoint The entryPoint. - */ - protected MMTkThread(Runnable entryPoint) { - super(entryPoint); - setUncaughtExceptionHandler(new UncaughtExceptionHandler() { - public void uncaughtException(Thread t, Throwable e) { - System.err.print("Unexpected exception: "); - e.printStackTrace(); - System.exit(1); - } - }); - } - - /** - * Create an MMTk thread. - */ - protected MMTkThread() { - this(null); - } - - /** - * Get the log for this MMTk thread (mutator or collector). - */ - public final Log getLog() { - return log; - } -} Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Main.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Main.java 2008-09-15 03:59:13 UTC (rev 14983) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Main.java 2008-09-15 08:26:08 UTC (rev 14984) @@ -17,10 +17,10 @@ import org.mmtk.harness.lang.Checker; import org.mmtk.harness.lang.Compiler; -import org.mmtk.harness.lang.Env; import org.mmtk.harness.lang.parser.MethodTable; import org.mmtk.harness.lang.parser.Parser; import org.mmtk.harness.lang.parser.ParseException; +import org.mmtk.harness.scheduler.Scheduler; public class Main { public static void main(String[] args) throws InterruptedException, ParseException, FileNotFoundException { @@ -48,9 +48,8 @@ /* Initialise the harness */ Harness.init(harnessArgs); - Env m = new Env(Compiler.compile(methods)); - /* Invoke the test */ - m.start(); - m.join(); + Scheduler.scheduleMutator(Compiler.compile(methods)); + + Scheduler.schedule(); } } Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Mutator.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Mutator.java 2008-09-15 03:59:13 UTC (rev 14983) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Mutator.java 2008-09-15 08:26:08 UTC (rev 14984) @@ -20,6 +20,7 @@ import org.mmtk.harness.lang.Trace; import org.mmtk.harness.lang.Trace.Item; import org.mmtk.harness.lang.runtime.AllocationSite; +import org.mmtk.harness.scheduler.Scheduler; import org.mmtk.harness.vm.ActivePlan; import org.mmtk.harness.vm.ObjectModel; import org.mmtk.plan.MutatorContext; @@ -42,7 +43,7 @@ * Note that as soon as the mutator is created it is considered active. This means * that a GC can not occur unless you execute commands on the mutator (or muEnd it). */ -public class Mutator extends MMTkThread { +public class Mutator { private static boolean gcEveryWB = false; public static void setGcEveryWB() { @@ -63,8 +64,7 @@ * Get the currently executing mutator. */ public static Mutator current() { - assert Thread.currentThread() instanceof Mutator : "Current thread does is not a Mutator"; - return (Mutator)Thread.currentThread(); + return Scheduler.currentMutator(); } /** @@ -142,14 +142,7 @@ this.expectedThrowable = expectedThrowable; } - /** - * Create a mutator thread, specifying an (optional) entry point and initial local variable map. - * - * @param entryPoint The entryPoint. - * @param locals The local variable map. - */ - public Mutator(Runnable entryPoint) { - super(entryPoint); + public Mutator() { try { String prefix = Harness.plan.getValue(); this.context = (MutatorContext)Class.forName(prefix + "Mutator").newInstance(); @@ -157,27 +150,27 @@ } catch (Exception ex) { throw new RuntimeException("Could not create Mutator", ex); } + } + + public void begin() { mutators.set(context.getId(), this); - setUncaughtExceptionHandler(new UncaughtExceptionHandler() { - public void uncaughtException(Thread t, Throwable e) { - if (e.getClass() == expectedThrowable) { - System.err.println("Mutator " + context.getId() + " exiting due to expected exception of class " + expectedThrowable); - expectedThrowable = null; - end(); - } else { - System.err.print("Mutator " + context.getId() + " caused unexpected exception: "); - e.printStackTrace(); - System.exit(1); - } - } - }); } /** - * Create a new mutator thread. Intended to be used for subclasses implementing a run() method. + * Mutator-specific handling of uncaught exceptions. + * @param t + * @param e */ - protected Mutator() { - this(null); + public void uncaughtException(Thread t, Throwable e) { + if (e.getClass() == expectedThrowable) { + System.err.println("Mutator " + context.getId() + " exiting due to expected exception of class " + expectedThrowable); + expectedThrowable = null; + end(); + } else { + System.err.print("Mutator " + context.getId() + " caused unexpected exception: "); + e.printStackTrace(); + System.exit(1); + } } /** @@ -205,7 +198,6 @@ * Format the object for dumping. */ public static String formatObject(ObjectReference object) { -// return Address.fromIntZeroExtend(object.isNull() ? 0 : ObjectModel.getId(object)).toString(); return String.format("%s[%d@%s]", object, ObjectModel.getId(object), getSiteName(object)); } @@ -242,8 +234,8 @@ * A gc safe point for the mutator. */ public boolean gcSafePoint() { - if (Collector.gcTriggered()) { - waitForGC(); + if (Scheduler.gcTriggered()) { + Scheduler.waitForGC(); return true; } return false; @@ -259,98 +251,14 @@ } /** - * Object used for synchronizing the number of mutators waiting for a gc. - */ - private static Object count = new Object(); - - /** - * The number of mutators waiting for a collection to proceed. - */ - private static int mutatorsWaitingForGC; - - /** - * The number of mutators currently executing in the system. - */ - private static int activeMutators; - - /** - * Mark a mutator as currently active. If a GC is currently in process we must - * wait for it to finish. - */ - protected static void begin() { - synchronized (count) { - if (!allWaitingForGC()) { - activeMutators++; - return; - } - mutatorsWaitingForGC++; - } - Collector.waitForGC(false); - synchronized (count) { - mutatorsWaitingForGC--; - activeMutators++; - } - } - - /** - * A mutator is creating a new mutator and calling begin on its behalf. - * This simplfies the logic and is guaranteed not to block for GC. - */ - public void beginChild() { - synchronized (count) { - if (!allWaitingForGC()) { - activeMutators++; - return; - } - } - notReached(); - } - - /** * Mark a mutator as no longer active. If a GC has been triggered we must ensure * that it proceeds before we deactivate. */ - protected void end() { + public void end() { check(expectedThrowable == null, "Expected exception of class " + expectedThrowable + " not found"); - boolean lastToGC; - synchronized (count) { - lastToGC = (mutatorsWaitingForGC == (activeMutators - 1)); - if (!lastToGC) { - activeMutators--; - return; - } - mutatorsWaitingForGC++; - } - Collector.waitForGC(lastToGC); - synchronized (count) { - mutatorsWaitingForGC--; - activeMutators--; - } } /** - * Are all active mutators waiting for GC? - */ - public static boolean allWaitingForGC() { - return mutatorsWaitingForGC == activeMutators; - } - - /** - * Cause the current thread to wait for a triggered GC to proceed. - */ - public void waitForGC() { - boolean allWaiting; - synchronized (count) { - mutatorsWaitingForGC++; - allWaiting = allWaitingForGC(); - } - Collector.waitForGC(allWaiting); - synchronized (count) { - mutatorsWaitingForGC--; - } - } - - /** * Request a heap dump (also invokes a garbage collection) */ public void heapDump() { Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Env.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Env.java 2008-09-15 03:59:13 UTC (rev 14983) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Env.java 2008-09-15 08:26:08 UTC (rev 14984) @@ -17,8 +17,6 @@ import org.mmtk.harness.Mutator; import org.mmtk.harness.lang.Trace.Item; -import org.mmtk.harness.lang.compiler.CompiledMethod; -import org.mmtk.harness.lang.runtime.PcodeInterpreter; import org.mmtk.harness.lang.runtime.StackFrame; import org.mmtk.plan.TraceLocal; import org.vmmagic.unboxed.ObjectReference; @@ -36,35 +34,16 @@ private UnsyncStack<StackFrame> stack = new UnsyncStack<StackFrame>(); /** - * The main program if we're using the compiler - */ - private final CompiledMethod body; - - /** * A source of random numbers (we have one per thread so that we can write * deterministic scripts). */ private Random rng = new Random(); - public Env(CompiledMethod body) { - this.body = body; - } - public static void setGcEverySafepoint() { gcEverySafepoint = true; } /** - * Thread.run() - */ - @Override - public void run() { - begin(); - new PcodeInterpreter(this,body).exec(); - end(); - } - - /** * Enter a new procedure, pushing a new stack frame. * @param frame */ Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Trace.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Trace.java 2008-09-15 03:59:13 UTC (rev 14983) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Trace.java 2008-09-15 08:26:08 UTC (rev 14984) @@ -16,7 +16,7 @@ public final class Trace { public enum Item { ALLOC, CALL, OBJECT, INTRINSIC, LOAD, STORE, HASH, ENV, - ROOTS, COLLECT, AVBYTE, EVAL, COMPILER, CHECKER } + ROOTS, COLLECT, AVBYTE, EVAL, COMPILER, CHECKER, SCHEDULER } private static EnumSet<Item> enabled = EnumSet.noneOf(Item.class); @@ -45,7 +45,7 @@ return enabled.contains(item); } - public static void trace(Item item, String pattern, Object...args) { + public static synchronized void trace(Item item, String pattern, Object...args) { if (isEnabled(item)) { printf(prefix(item) + pattern + "%n",args); } Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/compiler/CompiledMethod.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/compiler/CompiledMethod.java 2008-09-15 03:59:13 UTC (rev 14983) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/compiler/CompiledMethod.java 2008-09-15 08:26:08 UTC (rev 14984) @@ -17,15 +17,18 @@ import java.util.List; import org.mmtk.harness.lang.Declaration; +import org.mmtk.harness.lang.Env; import org.mmtk.harness.lang.ast.NormalMethod; import org.mmtk.harness.lang.pcode.PseudoOp; import org.mmtk.harness.lang.pcode.ResolvableOp; +import org.mmtk.harness.lang.runtime.PcodeInterpreter; import org.mmtk.harness.lang.runtime.StackFrame; +import org.mmtk.harness.scheduler.Schedulable; /** * A method, compiled into pseudo-ops. */ -public class CompiledMethod { +public class CompiledMethod implements Schedulable { /** The name of the method */ private final String name; @@ -137,4 +140,8 @@ public StackFrame formatStackFrame() { return new StackFrame(decls,nTemps); } + + public void execute(Env env) { + new PcodeInterpreter(env,this).exec(); + } } Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/SpawnOp.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/SpawnOp.java 2008-09-15 03:59:13 UTC (rev 14983) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/SpawnOp.java 2008-09-15 08:26:08 UTC (rev 14984) @@ -21,6 +21,8 @@ import org.mmtk.harness.lang.compiler.Register; import org.mmtk.harness.lang.runtime.PcodeInterpreter; import org.mmtk.harness.lang.runtime.Value; +import org.mmtk.harness.scheduler.Schedulable; +import org.mmtk.harness.scheduler.Scheduler; public class SpawnOp extends EnnaryOp implements ResolvableOp { @@ -33,24 +35,23 @@ @Override public void exec(Env env) { - // Call for the child - env.beginChild(); - SpawnedEnv child = new SpawnedEnv(getOperandValues(env.top())); - child.start(); + Scheduler.scheduleMutator(new SpawnedMethod(getOperandValues(env.top()))); } - private class SpawnedEnv extends Env { + private final class SpawnedMethod implements Schedulable { + + /* The method parameters */ private final Value[] values; - public SpawnedEnv(Value...values) { - super(null); + public SpawnedMethod(Value...values) { this.values = values; } - public void run() { - new PcodeInterpreter(this,method).exec(values); - end(); + @Override + public void execute(Env env) { + new PcodeInterpreter(env,method).exec(values); } + } @Override Added: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/PolicyStats.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/PolicyStats.java (rev 0) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/PolicyStats.java 2008-09-15 08:26:08 UTC (rev 14984) @@ -0,0 +1,24 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Common Public License (CPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/cpl1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ +package org.mmtk.harness.options; + +import org.mmtk.harness.Harness; +import org.vmutil.options.BooleanOption; + +public class PolicyStats extends BooleanOption { + + public PolicyStats() { + super(Harness.options, "Policy Stats", "Print scheduler policy statistics", false); + } + +} Added: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/RandomPolicyLength.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/RandomPolicyLength.java (rev 0) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/RandomPolicyLength.java 2008-09-15 08:26:08 UTC (rev 14984) @@ -0,0 +1,32 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Common Public License (CPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/cpl1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ +package org.mmtk.harness.options; + +import org.mmtk.harness.Harness; + +/** + * The maximum heap size. + */ +public final class RandomPolicyLength extends org.vmutil.options.IntOption { + /** + * Create the option. + */ + public RandomPolicyLength() { + super(Harness.options, "Random Policy Length", + "Sequence length for the random scheduler policy", + 10); + } + + protected void validate() { + } +} Added: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/RandomPolicyMax.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/RandomPolicyMax.java (rev 0) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/RandomPolicyMax.java 2008-09-15 08:26:08 UTC (rev 14984) @@ -0,0 +1,32 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Common Public License (CPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/cpl1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ +package org.mmtk.harness.options; + +import org.mmtk.harness.Harness; + +/** + * The maximum heap size. + */ +public final class RandomPolicyMax extends org.vmutil.options.IntOption { + /** + * Create the option. + */ + public RandomPolicyMax() { + super(Harness.options, "Random Policy Max", + "Maximum yield interval for the random scheduler policy", + 20); + } + + protected void validate() { + } +} Added: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/RandomPolicyMin.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/RandomPolicyMin.java (rev 0) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/RandomPolicyMin.java 2008-09-15 08:26:08 UTC (rev 14984) @@ -0,0 +1,32 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Common Public License (CPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/cpl1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ +package org.mmtk.harness.options; + +import org.mmtk.harness.Harness; + +/** + * The maximum heap size. + */ +public final class RandomPolicyMin extends org.vmutil.options.IntOption { + /** + * Create the option. + */ + public RandomPolicyMin() { + super(Harness.options, "Random Policy Min", + "Minimum yield interval for the random scheduler policy", + 1); + } + + protected void validate() { + } +} Added: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/RandomPolicySeed.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/RandomPolicySeed.java (rev 0) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/RandomPolicySeed.java 2008-09-15 08:26:08 UTC (rev 14984) @@ -0,0 +1,32 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Common Public License (CPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/cpl1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ +package org.mmtk.harness.options; + +import org.mmtk.harness.Harness; + +/** + * The maximum heap size. + */ +public final class RandomPolicySeed extends org.vmutil.options.IntOption { + /** + * Create the option. + */ + public RandomPolicySeed() { + super(Harness.options, "Random Policy Seed", + "Seed for the random scheduler policy", + 0); + } + + protected void validate() { + } +} Added: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/Scheduler.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/Scheduler.java (rev 0) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/Scheduler.java 2008-09-15 08:26:08 UTC (rev 14984) @@ -0,0 +1,41 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Common Public License (CPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/cpl1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ +package org.mmtk.harness.options; + +import org.mmtk.harness.Harness; +import org.mmtk.harness.scheduler.Scheduler.Model; + +/** + * Number of collector threads. + */ +public final class Scheduler extends org.vmutil.options.EnumOption { + /** + * Create the option. + */ + public Scheduler() { + super(Harness.options, "Scheduler", + "MMTk Harness scheduler", + new String[] {"JAVA","DETERMINISTIC"}, + "JAVA"); + } + + /** + * Only accept non-negative values. + */ + protected void validate() { + } + + public Model model() { + return Model.valueOf(Model.class,values[getValue()]); + } +} Added: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/SchedulerPolicy.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/SchedulerPolicy.java (rev 0) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/SchedulerPolicy.java 2008-09-15 08:26:08 UTC (rev 14984) @@ -0,0 +1,41 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Common Public License (CPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/cpl1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ +package org.mmtk.harness.options; + +import org.mmtk.harness.Harness; +import org.mmtk.harness.scheduler.Scheduler.SchedPolicy; + +/** + * Number of collector threads. + */ +public final class SchedulerPolicy extends org.vmutil.options.EnumOption { + /** + * Create the option. + */ + public SchedulerPolicy() { + super(Harness.options, "Scheduler Policy", + "MMTk Harness scheduler policy", + SchedPolicy.valueNames(), + "RANDOM"); + } + + /** + * Only accept non-negative values. + */ + protected void validate() { + } + + public SchedPolicy policy() { + return SchedPolicy.valueOf(SchedPolicy.class,values[getValue()]); + } +} Added: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/YieldInterval.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/YieldInterval.java (rev 0) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/YieldInterval.java 2008-09-15 08:26:08 UTC (rev 14984) @@ -0,0 +1,32 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Common Public License (CPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/cpl1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ +package org.mmtk.harness.options; + +import org.mmtk.harness.Harness; + +/** + * The maximum heap size. + */ +public final class YieldInterval extends org.vmutil.options.IntOption { + /** + * Create the option. + */ + public YieldInterval() { + super(Harness.options, "Yield Interval", + "Yield interval for fixed scheduler policies", + 10); + } + + protected void validate() { + } +} Added: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/AbstractPolicy.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/AbstractPolicy.java (rev 0) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/AbstractPolicy.java 2008-09-15 08:26:08 UTC (rev 14984) @@ -0,0 +1,81 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Common Public License (CPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/cpl1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ +package org.mmtk.harness.scheduler; + +import java.util.ArrayList; +import java.util.List; + +/** + * Abstract superclass of scheduling policies. + */ +public abstract class AbstractPolicy implements Policy { + private static List<AbstractPolicy> policies = new ArrayList<AbstractPolicy>(); + + public static void printStats() { + for (AbstractPolicy p : policies) { + System.out.printf(p.formatStats()); + } + } + + AbstractPolicy(Thread thread) { + this.thread = thread; + policies.add(this); + } + + private int yieldCount = 0; + private final Thread thread; + + /** + * Accumulate statistics + */ + private void yieldTaken() { + yieldCount++; + } + + /** + * The policy specific method + * @return + */ + protected abstract boolean taken(); + + /** + * The public method of the Policy interface + * @return + */ + public final boolean yieldNow() { + if (taken()) { + yieldTaken(); + return true; + } else { + return false; + } + } + + /** + * Policy-specific formatting + */ + protected String formatPolicy() { + return ""; + } + + /** + * Format yield statistics as a string + */ + public String formatStats() { + String policy = formatPolicy(); + if (!policy.equals("")) { + policy = " ("+policy+")"; + } + return String.format("%s, %d yields%s%n",thread.getName(),yieldCount,policy); + } +} Added: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/Lock.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/Lock.java (rev 0) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/Lock.java 2008-09-15 08:26:08 UTC (rev 14984) @@ -0,0 +1,42 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Common Public License (CPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/cpl1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ +package org.mmtk.harness.scheduler; + +public abstract class Lock extends org.mmtk.vm.Lock { + + /** The name of this lock */ + protected String name; + + public abstract void release(); + + public abstract void check(int w); + + public abstract void acquire(); + + /** The current holder of the lock */ + protected Thread holder; + + public Lock(String name) { + this.name = name; + } + + /** + * Set the name of this lock instance + * + * @param str The name of the lock (for error output). + */ + public void setName(String str) { + this.name = str; + } + +} Added: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/Policy.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/Policy.java (rev 0) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/Policy.java 2008-09-15 08:26:08 UTC (rev 14984) @@ -0,0 +1,19 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Common Public License (CPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/cpl1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ +package org.mmtk.harness.scheduler; + +public interface Policy { + + boolean yieldNow(); + +} Property changes on: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/Policy.java ___________________________________________________________________ Added: svn:mergeinfo + Added: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/Schedulable.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/Schedulable.java (rev 0) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/Schedulable.java 2008-09-15 08:26:08 UTC (rev 14984) @@ -0,0 +1,24 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Common Public License (CPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/cpl1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ +package org.mmtk.harness.scheduler; + +import org.mmtk.harness.lang.Env; + +/** + * Interface to those classes which can be scheduled as mutators by the scheduler. + */ +public interface Schedulable { + + void execute(Env env); + +} Added: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/Scheduler.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/Scheduler.java (rev 0) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/Scheduler.java 2008-09-15 08:26:08 UTC (rev 14984) @@ -0,0 +1,203 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Common Public License (CPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/cpl1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ +package org.mmtk.harness.scheduler; + +import org.mmtk.harness.Collector; +import org.mmtk.harness.Harness; +import org.mmtk.harness.Mutator; +import org.mmtk.harness.scheduler.javathreads.JavaThreads; +import org.mmtk.harness.scheduler.rawthreads.RawThreads; +import org.mmtk.utility.Log; + +/** + * Facade class for the command-line selectable threading models available + * in the MMTk harness. + */ +public class Scheduler { + + /** + * Possible threading models + */ + public enum Model { + JAVA, + DETERMINISTIC; + + /** The values of this enum, converted to strings */ + public static String[] valueNames() { + String[] result = new String[Scheduler.Model.values().length]; + for (int i=0; i < Scheduler.Model.values().length; i++) { + result[i] = Scheduler.Model.values()[i].toString(); + } + return result; + } + } + + /** + * Possible thread-scheduling policies + */ + public enum SchedPolicy { + FIXED, + RANDOM, + NEVER; + + /** The values of this enum, converted to strings */ + public static String[] valueNames() { + String[] result = new String[Scheduler.SchedPolicy.values().length]; + for (int i=0; i < Scheduler.SchedPolicy.values().length; i++) { + result[i] = Scheduler.SchedPolicy.values()[i].toString(); + } + return result; + } + } + + /** + * Thread Model factory - returns the thread model selected by user options. + */ + private static ThreadModel selectedThreadModel() { + switch (Harness.scheduler.model()) { + case JAVA: + return new JavaThreads(); + case DETERMINISTIC: + return new RawThreads(); + default: + throw new RuntimeException("Unknown thread model"); + } + } + + private static final ThreadModel model = selectedThreadModel(); + + /** + * Yield policy factory - return an instance of the the command-line + * selected yield policy + */ + public static Policy yieldPolicy(Thread thread) { + switch (Harness.policy.policy()) { + case FIXED: + int yieldInterval = Harness.yieldInterval.getValue(); + if (yieldInterval == 1) { + return new YieldAlways(thread); + } else { + return new YieldEvery(thread,yieldInterval); + } + case RANDOM: + return new YieldRandomly(thread, + Harness.randomPolicySeed.getValue(), + Harness.randomPolicyLength.getValue(), + Harness.randomPolicyMin.getValue(), + Harness.randomPolicyMax.getValue()); + case NEVER: + return new YieldNever(thread); + default: + throw new RuntimeException("Unknown scheduler policy"); + } + } + + /** + * A yield-point. + */ + public static void yield() { + model.yield(); + } + + /** + * Create and start a new Mutator thread + * @param item The executable code to run in this thread + */ + public static void scheduleMutator(Schedulable item) { + model.scheduleMutator(item); + } + + /** + * Create and start a new collector thread + */ + public static void scheduleCollector() { + model.scheduleCollector(); + } + + /** + * The current Log object. + * @return + */ + public static Log currentLog() { + return model.currentLog(); + } + + /** + * The current mutator object (if the current thread is a Mutator) + * @return + */ + public static Mutator currentMutator() { + return model.currentMutator(); + } + + /* schedule GC */ + + public static void triggerGC(int why) { + model.triggerGC(why); + } + + public static void exitGC() { + model.exitGC(); + } + + public static void waitForGCStart() { + model.waitForGCStart(); + } + + public static int getTriggerReason() { + return model.getTriggerReason(); + } + + /** + * Are there no threads currently in GC? + */ + public static boolean noThreadsInGC() { + return model.noThreadsInGC(); + } + + /** + * Has a GC been triggered? + */ + public static boolean gcTriggered() { + return model.gcTriggered(); + } + + public static int rendezvous(int where) { + return model.rendezvous(where); + } + + public static Collector currentCollector() { + return model.currentCollector(); + } + + /** + * Cause the current thread to wait for a triggered GC to proceed. + */ + public static void waitForGC() { + model.waitForGC(); + } + + /** + * Schedule the threads + */ + public static void schedule() { + model.schedule(); + } + + /** + * An MMTk lock + */ + public static Lock newLock(String name) { + return model.newLock(name); + } +} Added: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/ThreadModel.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/ThreadModel.java (rev 0) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/ThreadModel.java 2008-09-15 08:26:08 UTC (rev 14984) @@ -0,0 +1,77 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Common Public License (CPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/cpl1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ +package org.mmtk.harness.scheduler; + +import org.mmtk.harness.Collector; +import org.mmtk.harness.Mutator; +import org.mmtk.utility.Log; + +public abstract class ThreadModel { + + /** The number of collectors executing GC */ + protected int inGC; + /** + * The number of mutators currently executing in the system. + */ + protected int activeMutators; + /** + * The number of mutators waiting for a collection to proceed. + */ + protected int mutatorsWaitingForGC; + /** The trigger for this GC */ + protected int triggerReason; + + protected abstract void yield(); + + protected abstract void scheduleMutator(Schedulable method); + + protected abstract void scheduleCollector(); + + protected abstract Log currentLog(); + + protected abstract Mutator currentMutator(); + + /* schedule GC */ + + protected abstract void triggerGC(int why); + + protected abstract void exitGC(); + + protected abstract void waitForGCStart(); + + public boolean noThreadsInGC() { + return inGC == 0; + } + + public boolean gcTriggered() { + return inGC > 0; + } + + public abstract int rendezvous(int where); + + public abstract Collector currentCollector(); + + public abstract void waitForGC(); + + public int getTriggerReason() { + return triggerReason; + } + + public abstract void schedule(); + + /** + * An MMTk lock + */ + public abstract Lock newLock(String name); + +} Added: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/YieldAlways.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/YieldAlways.java (rev 0) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/YieldAlways.java 2008-09-15 08:26:08 UTC (rev 14984) @@ -0,0 +1,26 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Common Public License (CPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/cpl1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ +package org.mmtk.harness.scheduler; + +public class YieldAlways extends AbstractPolicy implements Policy { + + public YieldAlways(Thread thread) { + super(thread); + } + + @Override + public boolean taken() { + return true; + } + +} Property changes on: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/YieldAlways.java ___________________________________________________________________ Added: svn:mergeinfo + Added: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/YieldEvery.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/YieldEvery.java (rev 0) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/YieldEvery.java 2008-09-15 08:26:08 UTC (rev 14984) @@ -0,0 +1,38 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Common Public License (CPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/cpl1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ +package org.mmtk.harness.scheduler; + +public class YieldEvery extends AbstractPolicy implements Policy { + + private final int frequency; + + private int counter; + + private void resetCounter() { + counter = frequency; + } + + public YieldEvery(Thread thread, int frequency) { + super(thread); + this.frequency = frequency; + } + + @Override + public boolean taken() { + if (counter == 0) { + resetCounter(); + } + return --counter == 0; + } + +} Property changes on: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/YieldEvery.java ___________________________________________________________________ Added: svn:mergeinfo + Added: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/YieldNever.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/YieldNever.java (rev 0) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/YieldNever.java 2008-09-15 08:26:08 UTC (rev 14984) @@ -0,0 +1,26 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Common Public License (CPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/cpl1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ +package org.mmtk.harness.scheduler; + +public class YieldNever extends AbstractPolicy implements Policy { + + public YieldNever(Thread thread) { + super(thread); + } + + @Override + public boolean taken() { + return false; + } + +} Added: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/YieldRandomly.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/YieldRandomly.java (rev 0) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/YieldRandomly.java 2008-09-15 08:26:08 UTC (rev 14984) @@ -0,0 +1,62 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Common Public License (CPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/cpl1.0.php + *... [truncated message content] |
From: <rg...@us...> - 2008-09-18 03:22:40
|
Revision: 15002 http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=15002&view=rev Author: rgarner Date: 2008-09-18 10:22:37 +0000 (Thu, 18 Sep 2008) Log Message: ----------- MMTk Harness: Bounds check #fields, and corresponding fix to the LargeObject test Modified Paths: -------------- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ObjectModel.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Mutator.java rvmroot/trunk/MMTk/harness/test-scripts/LargeObject.script Modified: rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ObjectModel.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ObjectModel.java 2008-09-18 08:20:41 UTC (rev 15001) +++ rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ObjectModel.java 2008-09-18 10:22:37 UTC (rev 15002) @@ -63,6 +63,9 @@ /** The offset of the first reference field. */ public static final Offset REFS_OFFSET = STATUS_OFFSET.plus(SimulatedMemory.BYTES_IN_WORD); + public static final short MAX_DATA_FIELDS = Short.MAX_VALUE; + public static final short MAX_REF_FIELDS = Short.MAX_VALUE; + /** Has this object been hashed? */ private static final int HASHED = 0x1 << (3 * SimulatedMemory.BITS_IN_BYTE); /** Has this object been moved since it was hashed? */ @@ -164,6 +167,7 @@ * Set the number of data words in the object. */ private static void setDataCount(ObjectReference object, int count) { + assert count < Short.MAX_VALUE && count > 0 : "Too many data fields, "+count; object.toAddress().store((short)count, DATACOUNT_OFFSET); } @@ -172,6 +176,7 @@ * Set the number of references in the object. */ private static void setRefCount(ObjectReference object, int count) { + assert count < Short.MAX_VALUE && count > 0 : "Too many reference fields, "+count; object.toAddress().store((short)count, REFCOUNT_OFFSET); } Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Mutator.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Mutator.java 2008-09-18 08:20:41 UTC (rev 15001) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Mutator.java 2008-09-18 10:22:37 UTC (rev 15002) @@ -401,7 +401,9 @@ */ public ObjectReference alloc(int refCount, int dataCount, boolean doubleAlign, int allocSite) { check(refCount >= 0, "Non-negative reference field count required"); + check(refCount <= ObjectModel.MAX_REF_FIELDS, "Maximum of "+ObjectModel.MAX_REF_FIELDS+" reference fields per object"); check(dataCount >= 0, "Non-negative data field count required"); + check(dataCount <= ObjectModel.MAX_DATA_FIELDS, "Maximum of "+ObjectModel.MAX_DATA_FIELDS+" data fields per object"); ObjectReference result = ObjectModel.allocateObject(context, refCount, dataCount, doubleAlign, allocSite); Trace.trace(Item.ALLOC,"alloc(" + refCount + ", " + dataCount + ", " + doubleAlign + ") returned [" + result + "]"); return result; Modified: rvmroot/trunk/MMTk/harness/test-scripts/LargeObject.script =================================================================== --- rvmroot/trunk/MMTk/harness/test-scripts/LargeObject.script 2008-09-18 08:20:41 UTC (rev 15001) +++ rvmroot/trunk/MMTk/harness/test-scripts/LargeObject.script 2008-09-18 10:22:37 UTC (rev 15002) @@ -15,15 +15,12 @@ * This is a simple test that allocates large objects. */ main() { - int limitPages = 128; + int limitPages = 32; // 128 int startPages = 2; int p = startPages; while (p <= limitPages) { - object temp = alloc(0, p * 1024); - heapDump(); + object temp = alloc(p*512, p * 512); gc(); - heapDump(); - p = p * 2; + p = p + 2; } - heapDump(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2008-10-01 12:13:50
|
Revision: 15035 http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=15035&view=rev Author: rgarner Date: 2008-10-01 12:13:28 +0000 (Wed, 01 Oct 2008) Log Message: ----------- MMTk Harness: Scaffolding to support GC-context unit tests Modified Paths: -------------- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Memory.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/Scheduler.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/ThreadModel.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/javathreads/JavaThreadModel.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/rawthreads/RawThread.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/rawthreads/RawThreadModel.java Modified: rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Memory.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Memory.java 2008-10-01 12:11:26 UTC (rev 15034) +++ rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Memory.java 2008-10-01 12:13:28 UTC (rev 15035) @@ -12,6 +12,7 @@ */ package org.mmtk.harness.vm; +import org.mmtk.harness.scheduler.Scheduler; import org.mmtk.policy.ImmortalSpace; import org.mmtk.utility.heap.VMRequest; @@ -165,6 +166,7 @@ */ @Inline public void sync() { + Scheduler.yield(); // Nothing required } @@ -175,6 +177,7 @@ */ @Inline public void isync() { + Scheduler.yield(); // Nothing required } Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/Scheduler.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/Scheduler.java 2008-10-01 12:11:26 UTC (rev 15034) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/Scheduler.java 2008-10-01 12:13:28 UTC (rev 15035) @@ -103,10 +103,16 @@ } } + /** + * Initialization + */ public static void init() { model = selectedThreadModel(); } + /** + * Advance collector threads to their initial 'wait for collection' barrier + */ public static void initCollectors() { model.initCollectors(); } @@ -134,11 +140,18 @@ } /** + * Create and start a new collector thread running a particular code + * sequence. Used to schedule unit tests in collector context. + */ + public static Thread scheduleCollector(Schedulable item) { + return model.scheduleCollector(item); + } + + /** * The current Log object. * @return */ public static Log currentLog() { -// return model.currentLog(); return ((MMTkThread)Thread.currentThread()).getLog(); } @@ -150,20 +163,43 @@ return model.currentMutator(); } + /** + * The current collector object (if the current thread is a Collector) + * @return + */ + public static Collector currentCollector() { + return model.currentCollector(); + } + /* schedule GC */ + /** + * Request a GC. Once requested, mutator threads block at + * 'waitForGC' until a collection is performed. + */ public static void triggerGC(int why) { model.triggerGC(why); } + /** + * A collector thread informs the scheduler that it has completed + * its GC work by calling this. + */ public static void exitGC() { model.exitGC(); } + /** + * Collector threads call this method to wait for a GC to be triggered. + */ public static void waitForGCStart() { model.waitForGCStart(); } + /** + * Why was the current GC triggered ? + * @return + */ public static int getTriggerReason() { return model.getTriggerReason(); } @@ -191,10 +227,6 @@ return model.rendezvous(where); } - public static Collector currentCollector() { - return model.currentCollector(); - } - /** * Cause the current thread to wait for a triggered GC to proceed. */ @@ -210,8 +242,16 @@ } /** - * An MMTk lock + * Schedule the GC threads as though a GC had been triggered + * Used to run unit tests that must run in collector context. */ + public static void scheduleGcThreads() { + model.scheduleGcThreads(); + } + + /** + * An MMTk lock - a factory method. + */ public static Lock newLock(String name) { return model.newLock(name); } Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/ThreadModel.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/ThreadModel.java 2008-10-01 12:11:26 UTC (rev 15034) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/ThreadModel.java 2008-10-01 12:13:28 UTC (rev 15035) @@ -14,20 +14,22 @@ import org.mmtk.harness.Collector; import org.mmtk.harness.Mutator; +import org.mmtk.harness.lang.Trace; +import org.mmtk.harness.lang.Trace.Item; import org.mmtk.utility.Log; public abstract class ThreadModel { - /** The number of collectors executing GC */ - protected int inGC; /** - * The number of mutators currently executing in the system. + * Distinguish between setup/initialization and proper running of the harness */ - protected int activeMutators; - /** - * The number of mutators waiting for a collection to proceed. - */ - protected int mutatorsWaitingForGC; + private boolean running = false; + + /** The global state of the scheduler */ + public enum State { MUTATOR, BEGIN_GC, GC, END_GC, RENDEZVOUS } + + private static volatile State state = State.MUTATOR; + /** The trigger for this GC */ protected int triggerReason; @@ -39,6 +41,8 @@ protected abstract void scheduleCollector(); + protected abstract Thread scheduleCollector(Schedulable item); + protected abstract Log currentLog(); protected abstract Mutator currentMutator(); @@ -51,13 +55,9 @@ protected abstract void waitForGCStart(); - public boolean noThreadsInGC() { - return inGC == 0; - } + public abstract boolean noThreadsInGC(); - public boolean gcTriggered() { - return inGC > 0; - } + public abstract boolean gcTriggered(); public abstract int rendezvous(int where); @@ -71,9 +71,39 @@ public abstract void schedule(); + public abstract void scheduleGcThreads(); + /** * An MMTk lock */ public abstract Lock newLock(String name); + protected void setState(State state) { + Trace.trace(Item.SCHEDULER,"State changing from %s to %s",ThreadModel.state,state); + ThreadModel.state = state; + } + + protected State getState() { + return state; + } + + protected boolean isState(State state) { + return ThreadModel.state == state; + } + + protected boolean isRunning() { + return running; + } + + private void setRunning(boolean state) { + running = state; + } + + protected void startRunning() { + setRunning(true); + } + + protected void stopRunning() { + setRunning(false); + } } Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/javathreads/JavaThreadModel.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/javathreads/JavaThreadModel.java 2008-10-01 12:11:26 UTC (rev 15034) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/javathreads/JavaThreadModel.java 2008-10-01 12:13:28 UTC (rev 15035) @@ -12,6 +12,10 @@ */ package org.mmtk.harness.scheduler.javathreads; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + import org.mmtk.harness.Collector; import org.mmtk.harness.Harness; import org.mmtk.harness.Mutator; @@ -20,6 +24,7 @@ import org.mmtk.harness.lang.Trace.Item; import org.mmtk.harness.scheduler.Schedulable; import org.mmtk.harness.scheduler.ThreadModel; +import static org.mmtk.harness.scheduler.ThreadModel.State.*; import org.mmtk.utility.Log; public final class JavaThreadModel extends ThreadModel { @@ -28,6 +33,12 @@ } /** + * Count of collector threads scheduled through scheduleCollector(Schedulable) + */ + Set<CollectorContextThread> collectorTestThreads = + Collections.synchronizedSet(new HashSet<CollectorContextThread>()); + + /** * Create a new mutator thread */ @Override @@ -47,14 +58,28 @@ t.start(); } + /** + * Create a new collector thread with a specific Schedulable + */ + @Override + public Thread scheduleCollector(Schedulable code) { + Trace.trace(Item.SCHEDULER, "Scheduling new collector"); + CollectorContextThread t = new CollectorContextThread(code); + collectorTestThreads.add(t); + t.start(); + return t; + } + private JavaThread currentMMTkThread() { return ((JavaThread)Thread.currentThread()); } @Override public void yield() { - if (currentMMTkThread().yieldPolicy()) { - Thread.yield(); + if (isRunning()) { + if (currentMMTkThread().yieldPolicy()) { + Thread.yield(); + } } } @@ -138,28 +163,46 @@ protected static int collectorId = 0; - private final class CollectorThread extends JavaThread { - final Collector collector; + private class CollectorThread extends JavaThread { + protected final Collector collector; - private CollectorThread(Collector collector) { - super(collector); - this.collector = collector; + protected CollectorThread(boolean daemon) { + this.collector = new Collector(); setName("Collector-"+(collectorId++)); - setDaemon(true); + setDaemon(daemon); } private CollectorThread() { - this(new Collector()); + this(true); } @Override public void run() { collectorThreadLocal.set(collector); - super.run(); + collector.run(); } } + private final class CollectorContextThread extends CollectorThread { + final Schedulable code; + + private CollectorContextThread(Schedulable code) { + super(false); + this.code = code; + } + + @Override + public void run() { + collectorThreadLocal.set(collector); + waitForGCStart(); + code.execute(new Env()); + collectorTestThreads.remove(this); + exitGC(); + } + + } + /***************************************************************************** * * Scheduling of GCs @@ -176,6 +219,7 @@ Trace.trace(Item.SCHEDULER, "%d waitForGC in", Thread.currentThread().getId()); synchronized (trigger) { if (last) { + setState(GC); trigger.notifyAll(); } while (inGC > 0) { @@ -201,7 +245,7 @@ } private boolean allWaitingForGC() { - return mutatorsWaitingForGC == activeMutators; + return (activeMutators > 0) && (mutatorsWaitingForGC == activeMutators); } /** @@ -212,6 +256,7 @@ synchronized (trigger) { triggerReason = why; inGC = Harness.collectors.getValue(); + setState(BEGIN_GC); trigger.notifyAll(); } } @@ -223,14 +268,17 @@ public void exitGC() { synchronized (trigger) { inGC--; - if (inGC == 0) trigger.notifyAll(); + if (inGC == 0) { + setState(MUTATOR); + trigger.notifyAll(); + } } } @Override public void waitForGCStart() { synchronized(trigger) { - while(inGC == 0 || !allWaitingForGC()) { + while(inGC == 0 || !isState(GC)) { try { trigger.wait(); } catch (InterruptedException ie) {} @@ -243,9 +291,23 @@ private final Rendezvous rendezvous = new Rendezvous(); /** + * The number of mutators waiting for a collection to proceed. + */ + protected int mutatorsWaitingForGC; + + /** The number of collectors executing GC */ + protected int inGC; + + /** + * The number of mutators currently executing in the system. + */ + protected int activeMutators; + + /** * Object used for synchronizing the number of mutators waiting for a gc. */ public static Object count = new Object(); + /** Thread access to current collector */ public static ThreadLocal<Collector> collectorThreadLocal = new ThreadLocal<Collector>(); @@ -266,6 +328,34 @@ @Override public void schedule() { + startRunning(); // Do nothing - java does it :) } + + @Override + public void scheduleGcThreads() { + synchronized (trigger) { + startRunning(); + inGC = collectorTestThreads.size(); + setState(GC); + trigger.notifyAll(); + while (!isState(MUTATOR)) { + try { + trigger.wait(); + } catch (InterruptedException e) { + } + } + stopRunning(); + } + } + + @Override + public boolean noThreadsInGC() { + return inGC == 0; + } + + @Override + public boolean gcTriggered() { + return inGC > 0; + } } Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/rawthreads/RawThread.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/rawthreads/RawThread.java 2008-10-01 12:11:26 UTC (rev 15034) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/rawthreads/RawThread.java 2008-10-01 12:13:28 UTC (rev 15035) @@ -43,11 +43,6 @@ this.model = model; } - public RawThread(RawThreadModel model, Runnable target) { - super(target); - this.model = model; - } - protected void end() { this.exiting = true; } @@ -81,6 +76,7 @@ } protected synchronized void waitTillCurrent() { + Trace.trace(Item.SCHEDULER, "%d: waiting for thread wakeup", getId()); while (!isCurrent) { try { this.wait(); Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/rawthreads/RawThreadModel.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/rawthreads/RawThreadModel.java 2008-10-01 12:11:26 UTC (rev 15034) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/rawthreads/RawThreadModel.java 2008-10-01 12:13:28 UTC (rev 15035) @@ -24,19 +24,21 @@ import org.mmtk.harness.lang.Trace.Item; import org.mmtk.harness.scheduler.Schedulable; import org.mmtk.harness.scheduler.ThreadModel; +import static org.mmtk.harness.scheduler.ThreadModel.State.*; import org.mmtk.utility.Log; public final class RawThreadModel extends ThreadModel { + private static boolean unitTest = false; + + public static void setUnitTest() { + unitTest = true; + } + static { //Trace.enable(Item.SCHEDULER); } - /** The global state of the scheduler */ - private enum State { MUTATOR, BEGIN_GC, GC, END_GC, RENDEZVOUS }; - - private static State state = State.MUTATOR; - /** The global scheduler thread */ private final Thread scheduler = Thread.currentThread(); @@ -48,7 +50,21 @@ */ private boolean schedulerIsAwake = true; + private RawThread current = null; + + private List<RawThread> collectors = new ArrayList<RawThread>(); + private List<RawThread> mutators = new ArrayList<RawThread>(); + /** + * Scheduling queues. A thread may be on exactly one of these queues, + * or on a lock wait queue, or current. + */ + private List<RawThread> runQueue = new LinkedList<RawThread>(); + private List<RawThread> rendezvousQueue = new LinkedList<RawThread>(); + private List<RawThread> gcWaitQueue = new LinkedList<RawThread>(); + private List<RawThread> collectorWaitQueue = new LinkedList<RawThread>(); + + /** * The superclass of mutator threads in the raw threads model */ private class MutatorThread extends RawThread { @@ -107,28 +123,77 @@ } } - private class CollectorThread extends RawThread { - Collector c; + /** + * The super-class of collector threads + */ + private static class CollectorThread extends RawThread { + protected final Collector c; - private CollectorThread(Collector c) { - super(RawThreadModel.this, c); + /** + * Create a collector thread, running the 'run'method of collector c + * + * @param model + * @param c + * @param daemon + */ + private CollectorThread(RawThreadModel model,Collector c, boolean daemon) { + super(model); this.c = c; - setDaemon(true); + setName("Collector-"+model.collectors.size()); + model.collectors.add(this); + setDaemon(daemon); + Trace.trace(Item.SCHEDULER, "%d: collector thread %d \"%s\" created (%d total)", + Thread.currentThread().getId(), getId(), getName(),model.collectors.size()); } - public CollectorThread() { - this(new Collector()); + /** Create a collector thread, with a new collector */ + protected CollectorThread(RawThreadModel model, boolean daemon) { + this(model,new Collector(), daemon); } + /** Create a collector thread, with a new collector */ + public CollectorThread(RawThreadModel model) { + this(model,true); + } + + @Override public void run() { // Initial 'yield' waitTillCurrent(); - super.run(); + c.run(); + assert false : "Collector threads should never exit"; } } - RawThread current = null; + /** + * The super-class of collector-context threads. These are unit tests + * that need to run in collector context. + */ + private class CollectorContextThread extends CollectorThread { + private final Schedulable code; + public CollectorContextThread(RawThreadModel model,Schedulable code) { + super(model,false); + this.code = code; + } + + @Override + public void run() { + // Initial 'yield' + waitTillCurrent(); + Trace.trace(Item.SCHEDULER, "%d: Collector context waiting for GC", current.getId()); + waitForGCStart(); + Trace.trace(Item.SCHEDULER, "%d: Starting collector context", current.getId()); + code.execute(new Env()); + synchronized(scheduler) { + collectors.remove(this); + wakeScheduler(); + } + Trace.trace(Item.SCHEDULER, "%d: Collector context complete", current.getId()); + } + } + + void setCurrent(RawThread current) { this.current = current; } @@ -137,18 +202,6 @@ return (MMTkThread)Thread.currentThread(); } - private List<RawThread> collectors = new ArrayList<RawThread>(); - private List<RawThread> mutators = new ArrayList<RawThread>(); - - /** - * Scheduling queues. A thread may be on exactly one of these queues, - * or on a lock wait queue, or current. - */ - private List<RawThread> runQueue = new LinkedList<RawThread>(); - private List<RawThread> rendezvousQueue = new LinkedList<RawThread>(); - private List<RawThread> gcWaitQueue = new LinkedList<RawThread>(); - private List<RawThread> collectorWaitQueue = new LinkedList<RawThread>(); - @Override public Log currentLog() { return current.getLog(); @@ -162,7 +215,7 @@ @Override public void exitGC() { Trace.trace(Item.SCHEDULER, "%d: exiting GC", current.getId()); - state = State.END_GC; + setState(END_GC); } @Override @@ -172,12 +225,22 @@ private int currentRendezvous = 0; + /** + * The number of mutators waiting for a collection to proceed. + */ + protected int mutatorsWaitingForGC; + + /** + * The number of mutators currently executing in the system. + */ + protected int activeMutators; + @Override public int rendezvous(int where) { Trace.trace(Item.SCHEDULER, "%d: rendezvous(%d)", current.getId(), where); - if (state != State.RENDEZVOUS) { + if (!isState(RENDEZVOUS)) { currentRendezvous = where; - state = State.RENDEZVOUS; + setState(RENDEZVOUS); } else { assert currentRendezvous == where; } @@ -192,15 +255,22 @@ */ @Override public void scheduleCollector() { - RawThread c = new CollectorThread(); - synchronized(scheduler) { - Trace.trace(Item.SCHEDULER, "%d: creating new collector, id=%d", Thread.currentThread().getId(), c.getId()); - c.setName("Collector-"+collectors.size()); - collectors.add(c); - c.start(); - } + RawThread c = new CollectorThread(this); + Trace.trace(Item.SCHEDULER, "%d: creating new collector, id=%d", + Thread.currentThread().getId(), c.getId()); + c.start(); + } - Trace.trace(Item.SCHEDULER, "%d: collector created and scheduled", Thread.currentThread().getId()); + /** + * Create a collector thread for specific code (eg unit test) + */ + @Override + public Thread scheduleCollector(Schedulable method) { + RawThread c = new CollectorContextThread(this,method); + Trace.trace(Item.SCHEDULER, "%d: creating new collector, id=%d", + Thread.currentThread().getId(), c.getId()); + c.start(); + return c; } /** @@ -213,7 +283,7 @@ Trace.trace(Item.SCHEDULER, "%d: creating new mutator, id=%d", Thread.currentThread().getId(), m.getId()); m.setName("Mutator-"+mutators.size()); mutators.add(m); - if (state != RawThreadModel.State.MUTATOR) { + if (!isState(MUTATOR)) { Trace.trace(Item.SCHEDULER, "%d: Adding to GC wait queue", Thread.currentThread().getId()); gcWaitQueue.add(m); } else { @@ -229,12 +299,12 @@ @Override protected void initCollectors() { Trace.trace(Item.SCHEDULER, "%d: Initializing collectors", Thread.currentThread().getId()); - state = State.GC; + setState(BEGIN_GC); assert Thread.currentThread() == scheduler; - runQueue.addAll(collectors); + makeRunnable(collectors,false); schedule(); assert collectorWaitQueue.size() == collectors.size(); - state = State.MUTATOR; + setState(MUTATOR); Trace.trace(Item.SCHEDULER, "%d: Collector threads initialized", Thread.currentThread().getId()); } @@ -243,13 +313,13 @@ Trace.trace(Item.SCHEDULER, "%d: Triggering GC", Thread.currentThread().getId()); synchronized(scheduler) { triggerReason = why; - inGC++; - state = State.BEGIN_GC; + setState(BEGIN_GC); } } @Override public void waitForGCStart() { + Trace.trace(Item.SCHEDULER, "%d: Yielding to collector wait queue", Thread.currentThread().getId()); yield(collectorWaitQueue); } @@ -258,14 +328,16 @@ */ @Override public void waitForGC() { - inGC++; + Trace.trace(Item.SCHEDULER, "%d: Yielding to GC wait queue", Thread.currentThread().getId()); yield(gcWaitQueue); } @Override public void yield() { - if (current.yieldPolicy()) { - yield(runQueue); + if (isRunning()) { + if (current.yieldPolicy()) { + yield(runQueue); + } } } @@ -276,7 +348,7 @@ void yield(List<RawThread> queue) { assert current != null; queue.add(current); - Trace.trace(Item.SCHEDULER,"Yielded onto queue with %d members",queue.size()); + Trace.trace(Item.SCHEDULER,"%d: Yielded onto queue with %d members",Thread.currentThread().getId(),queue.size()); assert queue.size() <= Math.max(mutators.size(),collectors.size()) : "yielded to queue size "+queue.size()+" where there are "+mutators.size()+" m and "+collectors.size()+"c"; current.yieldThread(); @@ -291,48 +363,77 @@ } /** + * Schedule gc-context unit tests + */ + @Override + public void scheduleGcThreads() { + /* Advance the GC threads to the collector wait queue */ + initCollectors(); + + /* Make them all runnable, as though we had entered a GC */ + makeRunnable(collectorWaitQueue); + + /* Transition to GC state */ + setState(GC); + + /* And run to completion */ + schedule(); + } + + /** * The actual scheduler */ @Override public void schedule() { + startRunning(); + assert Thread.currentThread() == scheduler; + Trace.trace(Item.SCHEDULER, "%d: scheduler begin", scheduler.getId()); + + /** + * The scheduler runs until there are no threads to schedule. + */ while (!runQueue.isEmpty()) { synchronized(scheduler) { assert runQueue.size() <= Math.max(mutators.size(),collectors.size()) : - "Run queue is unreasonably long, queue="+runQueue.size()+", m="+mutators.size()+", c="+collectors.size(); - runQueue.remove(0).resumeThread(); - Trace.trace(Item.SCHEDULER, "%d: scheduler sleeping, runqueue=%d", scheduler.getId(), runQueue.size()); - schedWait(); - Trace.trace(Item.SCHEDULER, "%d: scheduler resuming, state %s, runqueue=%d", scheduler.getId(),state, runQueue.size()); - switch (state) { + "Run queue is unreasonably long, queue="+runQueue.size()+ + ", m="+mutators.size()+", c="+collectors.size(); + if (runQueue.size() > 0) { + runQueue.remove(0).resumeThread(); + Trace.trace(Item.SCHEDULER, "%d: scheduler sleeping, runqueue=%d", scheduler.getId(), runQueue.size()); + schedWait(); + Trace.trace(Item.SCHEDULER, "%d: scheduler resuming, state %s, runqueue=%d", scheduler.getId(),getState(), runQueue.size()); + } + switch (getState()) { case MUTATOR: assert mutators.isEmpty() || !runQueue.isEmpty(); break; case BEGIN_GC: if (runQueue.isEmpty()) { assert gcWaitQueue.size() == mutators.size(); - state = State.GC; - Trace.trace(Item.SCHEDULER, "%d: Changing to state GC", scheduler.getId()); + setState(GC); + Trace.trace(Item.SCHEDULER, "%d: Changing to state GC - scheduling %d GC threads", + scheduler.getId(),collectorWaitQueue.size()); makeRunnable(collectorWaitQueue); } break; case END_GC: if (runQueue.isEmpty()) { assert collectorWaitQueue.size() == collectors.size(); - state = State.MUTATOR; - Trace.trace(Item.SCHEDULER, "%d: Changing to state MUTATOR", scheduler.getId()); + setState(MUTATOR); + Trace.trace(Item.SCHEDULER, "%d: Changing to state MUTATOR - scheduling %d mutator threads", + scheduler.getId(),gcWaitQueue.size()); makeRunnable(gcWaitQueue); - inGC = 0; } break; case GC: - assert mutators.size() == 0 || !runQueue.isEmpty() : + assert ! unitTest && (mutators.size() == 0 || !runQueue.isEmpty()) : "Runqueue cannot be empty while GC is in progress"; break; case RENDEZVOUS: if (runQueue.isEmpty()) { assert rendezvousQueue.size() == collectors.size(); Trace.trace(Item.SCHEDULER, "%d: Rendezvous complete - changing to state GC", scheduler.getId()); - state = State.GC; + setState(GC); makeRunnable(rendezvousQueue); currentRendezvous = 0; } @@ -340,6 +441,8 @@ } } } + Trace.trace(Item.SCHEDULER, "%d: scheduler end", scheduler.getId()); + stopRunning(); } void makeRunnable(List<RawThread> threads, boolean clear) { @@ -367,18 +470,28 @@ */ private void schedWait() { schedulerIsAwake = false; + assert Thread.currentThread() == scheduler; while (!schedulerIsAwake) { try { - Trace.trace(Item.SCHEDULER, "%d: waiting for scheduler wakeup", Thread - .currentThread().getId()); - assert Thread.currentThread() == scheduler; +// Trace.trace(Item.SCHEDULER, "%d: waiting for scheduler wakeup", +// Thread.currentThread().getId()); scheduler.wait(1); - Trace.trace(Item.SCHEDULER, "%d: scheduler wakeup complete", Thread - .currentThread().getId()); +// Trace.trace(Item.SCHEDULER, "%d: scheduler wakeup complete", +// Thread.currentThread().getId()); } catch (InterruptedException e) { } } } + @Override + public boolean noThreadsInGC() { + return isState(MUTATOR); + } + + @Override + public boolean gcTriggered() { + return isState(BEGIN_GC); + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2008-10-10 07:12:49
|
Revision: 15092 http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=15092&view=rev Author: rgarner Date: 2008-10-10 07:12:37 +0000 (Fri, 10 Oct 2008) Log Message: ----------- More FindBugs whining Modified Paths: -------------- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ActivePlan.java rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Collection.java rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Scanning.java rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Statistics.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Collector.java Modified: rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ActivePlan.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ActivePlan.java 2008-10-10 07:09:53 UTC (rev 15091) +++ rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ActivePlan.java 2008-10-10 07:12:37 UTC (rev 15092) @@ -27,7 +27,7 @@ * Stub to give access to plan local, constraint and global instances */ @Uninterruptible -public class ActivePlan extends org.mmtk.vm.ActivePlan { +public final class ActivePlan extends org.mmtk.vm.ActivePlan { /** Initialise static state */ public static void init(String prefix) { @@ -53,18 +53,23 @@ private static int mutatorIndex; /** @return The active Plan instance. */ + @Override public Plan global() { return plan; }; /** @return The active PlanConstraints instance. */ + @Override public PlanConstraints constraints() { return constraints; }; /** @return The active <code>CollectorContext</code> instance. */ + @Override public CollectorContext collector() { return Collector.current().getContext(); }; /** @return The active <code>MutatorContext</code> instance. */ + @Override public MutatorContext mutator() { return Mutator.current().getContext(); } /** @return The active <code>MutatorContext</code> instance. */ + @Override public Log log() { return Scheduler.currentLog(); } /** @@ -73,6 +78,7 @@ * @param id The identifier of the <code>CollectorContext</code> to return * @return The specified <code>CollectorContext</code> */ + @Override public CollectorContext collector(int id) { return Collector.get(id).getContext(); } /** @@ -81,15 +87,19 @@ * @param id The identifier of the <code>MutatorContext</code> to return * @return The specified <code>MutatorContext</code> */ + @Override public MutatorContext mutator(int id) { return Mutator.get(id).getContext(); } /** @return The number of registered <code>CollectorContext</code> instances. */ + @Override public int collectorCount() { return Collector.count(); } /** @return The number of registered <code>MutatorContext</code> instances. */ + @Override public int mutatorCount() { return Mutator.count(); } /** Reset the mutator iterator */ + @Override public void resetMutatorIterator() { mutatorIndex = 0; } /** @@ -100,6 +110,7 @@ * synchronized iteration of all mutators, or * <code>null</code> when all mutators have been done. */ + @Override public MutatorContext getNextMutator() { synchronized(ActivePlan.class) { if (mutatorIndex >= Mutator.count()) return null; @@ -114,6 +125,7 @@ * @return The <code>CollectorContext</code>'s unique identifier */ @Interruptible + @Override public int registerCollector(CollectorContext collector) { return Collector.register(collector); } @@ -125,6 +137,7 @@ * @return The <code>MutatorContext</code>'s unique identifier */ @Interruptible + @Override public int registerMutator(MutatorContext mutator) { return Mutator.register(mutator); } Modified: rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Collection.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Collection.java 2008-10-10 07:09:53 UTC (rev 15091) +++ rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Collection.java 2008-10-10 07:12:37 UTC (rev 15092) @@ -111,7 +111,7 @@ int current = mutator.getCollectionAttempts(); if (current > max) max = current; } - return max + Collector.collectionAttemptBase; + return max + Collector.getCollectionAttemptBase(); } /** Modified: rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Scanning.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Scanning.java 2008-10-10 07:09:53 UTC (rev 15091) +++ rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Scanning.java 2008-10-10 07:12:37 UTC (rev 15092) @@ -70,7 +70,7 @@ * parallel GC threads were not important, the thread counter could * simply be replaced by a for loop). */ - public void resetThreadCounter() { + public synchronized void resetThreadCounter() { threadCounter = 0; } Modified: rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Statistics.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Statistics.java 2008-10-10 07:09:53 UTC (rev 15091) +++ rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Statistics.java 2008-10-10 07:12:37 UTC (rev 15092) @@ -24,7 +24,7 @@ * @return The number of collections that have occurred. */ public int getCollectionCount() { - return Collector.collectionCount; + return Collector.getCollectionCount(); } /** Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Collector.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Collector.java 2008-10-10 07:09:53 UTC (rev 15091) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Collector.java 2008-10-10 07:12:37 UTC (rev 15092) @@ -97,11 +97,19 @@ } /** The number of collections that have occurred */ - public static int collectionCount; + private static int collectionCount; + public static int getCollectionCount() { + return collectionCount; + } + /** The current base count of collection attempts */ - public static int collectionAttemptBase; + private static int collectionAttemptBase; + public static int getCollectionAttemptBase() { + return collectionAttemptBase; + } + /** Has a heap dump been requested? */ private static boolean heapDumpRequested; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dgr...@us...> - 2008-10-16 19:10:26
|
Revision: 15114 http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=15114&view=rev Author: dgrove-oss Date: 2008-10-16 19:10:17 +0000 (Thu, 16 Oct 2008) Log Message: ----------- javadoc fixes. Modified Paths: -------------- rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/FinalizableProcessor.java rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Strings.java rvmroot/trunk/MMTk/src/org/mmtk/policy/ExplicitLargeObjectSpace.java rvmroot/trunk/MMTk/src/org/mmtk/policy/SegregatedFreeListSpace.java Modified: rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/FinalizableProcessor.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/FinalizableProcessor.java 2008-10-16 17:37:42 UTC (rev 15113) +++ rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/FinalizableProcessor.java 2008-10-16 19:10:17 UTC (rev 15114) @@ -123,8 +123,6 @@ * Allocate an entry in the table. This should be called from an unpreemptible * context so that the entry can be filled. This method is responsible for growing * the table if necessary. - * - * @return The allocated index. */ @NoInline @Unpreemptible("Non-preemptible but yield when table needs to be grown") Modified: rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Strings.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Strings.java 2008-10-16 17:37:42 UTC (rev 15113) +++ rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Strings.java 2008-10-16 19:10:17 UTC (rev 15114) @@ -93,7 +93,7 @@ * Copies characters from the string into the character array. * Thread switching is disabled during this method's execution. * - * @param src the source string + * @param str the source string * @param dst the destination array * @param dstBegin the start offset in the destination array * @param dstEnd the index after the last character in the Modified: rvmroot/trunk/MMTk/src/org/mmtk/policy/ExplicitLargeObjectSpace.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/policy/ExplicitLargeObjectSpace.java 2008-10-16 17:37:42 UTC (rev 15113) +++ rvmroot/trunk/MMTk/src/org/mmtk/policy/ExplicitLargeObjectSpace.java 2008-10-16 19:10:17 UTC (rev 15114) @@ -174,7 +174,6 @@ /** * Free an object * - * @param space The space the object is allocated in. * @param object The object to be freed. */ @Inline Modified: rvmroot/trunk/MMTk/src/org/mmtk/policy/SegregatedFreeListSpace.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/policy/SegregatedFreeListSpace.java 2008-10-16 17:37:42 UTC (rev 15113) +++ rvmroot/trunk/MMTk/src/org/mmtk/policy/SegregatedFreeListSpace.java 2008-10-16 19:10:17 UTC (rev 15114) @@ -674,8 +674,6 @@ /** * Sweep a block, freeing it and adding to the list given by availableHead * if it contains no free objects. - * - * @param clearMarks should we clear block mark bits as we process. */ private Address sweepCells(Sweeper sweeper, Address block, int sizeClass, Address availableHead) { boolean liveBlock = sweepCells(sweeper, block, sizeClass); @@ -747,12 +745,7 @@ } /** - * Does this block contain any live cells. - * - * @param block The block - * @param blockSize The size of the block - * @param clearMarks should we clear block mark bits as we process. - * @return True if any cells in the block are live + * Does this block contain any live cells? */ @Inline public boolean sweepCells(Sweeper sweeper, Address block, int sizeClass) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2008-11-24 04:30:40
|
Revision: 15195 http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=15195&view=rev Author: rgarner Date: 2008-11-24 04:30:32 +0000 (Mon, 24 Nov 2008) Log Message: ----------- MMTk Harness: refactor SimulatedMemory to narrow the interface Modified Paths: -------------- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ObjectModel.java rvmroot/trunk/MMTk/harness/vmmagic/org/vmmagic/unboxed/Address.java rvmroot/trunk/MMTk/harness/vmmagic/org/vmmagic/unboxed/SimulatedMemory.java Modified: rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ObjectModel.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ObjectModel.java 2008-11-24 03:49:05 UTC (rev 15194) +++ rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ObjectModel.java 2008-11-24 04:30:32 UTC (rev 15195) @@ -314,7 +314,7 @@ Address fromRegion = from.toAddress(); for(int i=0; i < oldBytes; i += SimulatedMemory.BYTES_IN_WORD) { - SimulatedMemory.setInt(toRegion.plus(i), SimulatedMemory.getInt(fromRegion.plus(i))); + toRegion.plus(i).store(fromRegion.plus(i).loadInt()); } int status = toRegion.loadInt(STATUS_OFFSET); @@ -349,7 +349,7 @@ int bytes = getSize(from); Address fromRegion = from.toAddress(); for(int i=0; i < bytes; i += SimulatedMemory.BYTES_IN_WORD) { - SimulatedMemory.setInt(toRegion.plus(i), SimulatedMemory.getInt(fromRegion.plus(i))); + toRegion.plus(i).store(fromRegion.plus(i).loadInt()); } int status = toRegion.loadInt(STATUS_OFFSET); Modified: rvmroot/trunk/MMTk/harness/vmmagic/org/vmmagic/unboxed/Address.java =================================================================== --- rvmroot/trunk/MMTk/harness/vmmagic/org/vmmagic/unboxed/Address.java 2008-11-24 03:49:05 UTC (rev 15194) +++ rvmroot/trunk/MMTk/harness/vmmagic/org/vmmagic/unboxed/Address.java 2008-11-24 04:30:32 UTC (rev 15195) @@ -402,7 +402,7 @@ * @return the read value */ public byte loadByte(Offset offset) { - return SimulatedMemory.getByte(this, offset); + return this.plus(offset).loadByte(); } /** @@ -423,7 +423,7 @@ * @return the read value */ public char loadChar(Offset offset) { - return SimulatedMemory.getChar(this, offset); + return this.plus(offset).loadChar(); } /** @@ -444,7 +444,7 @@ * @return the read value */ public short loadShort(Offset offset) { - return SimulatedMemory.getShort(this, offset); + return this.plus(offset).loadShort(); } /** @@ -465,7 +465,7 @@ * @return the read value */ public float loadFloat(Offset offset) { - return SimulatedMemory.getFloat(this, offset); + return this.plus(offset).loadFloat(); } /** @@ -486,7 +486,7 @@ * @return the read value */ public int loadInt(Offset offset) { - return SimulatedMemory.getInt(this, offset); + return this.plus(offset).loadInt(); } @@ -508,7 +508,7 @@ * @return the read value */ public long loadLong(Offset offset) { - return SimulatedMemory.getLong(this, offset); + return this.plus(offset).loadLong(); } /** @@ -529,7 +529,7 @@ * @return the read value */ public double loadDouble(Offset offset) { - return SimulatedMemory.getDouble(this, offset); + return this.plus(offset).loadDouble(); } /** @@ -592,7 +592,7 @@ * @param offset the offset to the value. */ public void store(ObjectReference value, Offset offset) { - SimulatedMemory.setInt(this, value.value, offset); + this.plus(offset).store(value); } /** @@ -613,7 +613,7 @@ * @param offset the offset to the value. */ public void store(Address value, Offset offset) { - SimulatedMemory.setInt(this, value.value, offset); + this.plus(offset).store(value); } /** @@ -634,7 +634,7 @@ * @param offset the offset to the value. */ public void store(float value, Offset offset) { - SimulatedMemory.setFloat(this, value, offset); + this.plus(offset).store(value); } /** @@ -655,7 +655,7 @@ * @param offset the offset to the value. */ public void store(Word value, Offset offset) { - SimulatedMemory.setInt(this, value.value, offset); + this.plus(offset).store(value); } /** @@ -676,7 +676,7 @@ * @param offset the offset to the value. */ public void store(byte value, Offset offset) { - SimulatedMemory.setByte(this, value, offset); + this.plus(offset).store(value); } @@ -698,7 +698,7 @@ * @param offset the offset to the value. */ public void store(int value, Offset offset) { - SimulatedMemory.setInt(this, value, offset); + this.plus(offset).store(value); } /** @@ -719,7 +719,7 @@ * @param offset the offset to the value. */ public void store(double value, Offset offset) { - SimulatedMemory.setDouble(this, value, offset); + this.plus(offset).store(value); } @@ -741,7 +741,7 @@ * @param offset the offset to the value. */ public void store(long value, Offset offset) { - SimulatedMemory.setLong(this, value, offset); + this.plus(offset).store(value); } /** @@ -762,7 +762,7 @@ * @param offset the offset to the value. */ public void store(char value, Offset offset) { - SimulatedMemory.setChar(this, value, offset); + this.plus(offset).store(value); } /** @@ -783,7 +783,7 @@ * @param offset the offset to the value. */ public void store(short value, Offset offset) { - SimulatedMemory.setShort(this, value, offset); + this.plus(offset).store(value); } /**************************************************************************** @@ -897,7 +897,7 @@ * @return true if the attempt was successful. */ public boolean attempt(int old, int value, Offset offset) { - return SimulatedMemory.exchangeInt(this, old, value, offset); + return this.plus(offset).attempt(old,value); } /** @@ -922,7 +922,7 @@ * @return true if the attempt was successful. */ public boolean attempt(Word old, Word value, Offset offset) { - return SimulatedMemory.exchangeInt(this, old.value, value.value, offset); + return this.plus(offset).attempt(old,value); } /** @@ -947,7 +947,7 @@ * @return true if the attempt was successful. */ public boolean attempt(ObjectReference old, ObjectReference value, Offset offset) { - return SimulatedMemory.exchangeInt(this, old.value, value.value, offset); + return this.plus(offset).attempt(old,value); } /** @@ -972,7 +972,7 @@ * @return true if the attempt was successful. */ public boolean attempt(Address old, Address value, Offset offset) { - return SimulatedMemory.exchangeInt(this, old.value, value.value, offset); + return this.plus(offset).attempt(old,value); } /** Modified: rvmroot/trunk/MMTk/harness/vmmagic/org/vmmagic/unboxed/SimulatedMemory.java =================================================================== --- rvmroot/trunk/MMTk/harness/vmmagic/org/vmmagic/unboxed/SimulatedMemory.java 2008-11-24 03:49:05 UTC (rev 15194) +++ rvmroot/trunk/MMTk/harness/vmmagic/org/vmmagic/unboxed/SimulatedMemory.java 2008-11-24 04:30:32 UTC (rev 15195) @@ -21,6 +21,8 @@ /** Set to true to print debug information */ private static final boolean VERBOSE = false; + private static final boolean ALIGN_CHECK_LONG = false; + /** * Print a debug message (provided verbose output is enabled) */ @@ -33,11 +35,13 @@ public static final int LOG_BYTES_IN_PAGE = 12; public static final int BYTES_IN_PAGE = 1 << LOG_BYTES_IN_PAGE; public static final int LOG_BYTES_IN_WORD = 2; + public static final int LOG_BYTES_IN_LONG = 3; public static final int LOG_BYTES_IN_SHORT = 1; public static final int LOG_BITS_IN_BYTE = 3; public static final int BITS_IN_BYTE = 1 << LOG_BITS_IN_BYTE; public static final int BYTES_IN_WORD = 1 << LOG_BYTES_IN_WORD; public static final int BYTES_IN_SHORT = 1 << LOG_BYTES_IN_SHORT; + public static final int BYTES_IN_LONG = 1 << LOG_BYTES_IN_LONG; public static final int PAGE_SIZE = 1 << LOG_BYTES_IN_PAGE; public static final int INDEX_MASK = (PAGE_SIZE - 1); public static final int WORD_MASK = ~(BYTES_IN_WORD - 1); @@ -52,58 +56,64 @@ static final class PageTable { private static final HashMap<Integer, MemoryPage> pages = new HashMap<Integer, MemoryPage>(); + private static int pageTableEntry(Address p) { + return p.toInt() >>> LOG_BYTES_IN_PAGE; + } + /** * Internal: get a page by page number, performing appropriate * checking and synchronization * @param page * @return */ - public static MemoryPage getPage(int page) { + static MemoryPage getPage(Address p) { synchronized(pages) { - MemoryPage p = pages.get(page); - if (p == null) { - throw new RuntimeException("Page not mapped: " + Address.formatInt(page << LOG_BYTES_IN_PAGE)); - } else if (!p.readable) { - throw new RuntimeException("Page not readable: " + Address.formatInt(page << LOG_BYTES_IN_PAGE)); + MemoryPage page = pages.get(pageTableEntry(p)); + if (page == null) { + throw new RuntimeException("Page not mapped: " + p); + } else if (!page.readable) { + throw new RuntimeException("Page not readable: " + p); } - return p; + return page; } } - static void setReadable(int p) { + static void setReadable(Address p) { synchronized(pages) { - MemoryPage page = pages.get(p); + MemoryPage page = pages.get(pageTableEntry(p)); if (page == null) { - throw new RuntimeException("Page not mapped: " + Address.formatInt(p << SimulatedMemory.LOG_BYTES_IN_PAGE)); + throw new RuntimeException("Page not mapped: " + p); } page.readable = true; } } - public static void setNonReadable(int p) { + static void setNonReadable(Address p) { synchronized(pages) { - MemoryPage page = pages.get(p); + MemoryPage page = pages.get(pageTableEntry(p)); if (page == null) { - throw new RuntimeException("Page not mapped: " + Address.formatInt(p << SimulatedMemory.LOG_BYTES_IN_PAGE)); + throw new RuntimeException("Page not mapped: " + p); } page.readable = false; } } - private static void mapPage(int p) { + private static void mapPage(Address p) { synchronized(pages) { - if (pages.get(p) != null) { - throw new RuntimeException("Page already mapped: " + Address.formatInt(p << SimulatedMemory.LOG_BYTES_IN_PAGE)); + int page = pageTableEntry(p); + if (VERBOSE) { System.err.printf("Mapping page %s%n", p); } + if (pages.get(page) != null) { + throw new RuntimeException("Page already mapped: " + p); } - pages.put(p, new MemoryPage(p)); + pages.put(page, new MemoryPage(p)); } } - private static void zeroPage(int p) { + private static void zeroPage(Address p) { synchronized(pages) { - MemoryPage page = pages.get(p); + MemoryPage page = pages.get(pageTableEntry(p)); if (page == null) { - throw new RuntimeException("Page not mapped: " + Address.formatInt(p << SimulatedMemory.LOG_BYTES_IN_PAGE)); + throw new RuntimeException("Page not mapped: " + p); } page.zero(); } @@ -141,15 +151,8 @@ return (addr2^addr1) < BYTES_IN_PAGE; } - /** - * Return the page corresponding to a specific (address+offset) value - * @param address - * @param offset - * @return - */ - public static MemoryPage getPage(Address address, Offset offset) { - Scheduler.yield(); - return getPage(address,offset.value); + private static boolean onSamePage(Address addr1, Address addr2) { + return addr2.toWord().xor(addr1.toWord()).LT(Word.fromIntSignExtend(BYTES_IN_PAGE)); } /** @@ -158,94 +161,68 @@ * @param offset * @return */ - public static MemoryPage getPage(Address address, int offset) { + private static MemoryPage getPage(Address address) { + Scheduler.yield(); if (address.isZero()) { throw new RuntimeException("Attempted to dereference a null address"); } - return PageTable.getPage((address.value + offset) >>> LOG_BYTES_IN_PAGE); + return PageTable.getPage(address); } - public static byte getByte(Address address) { return getByte(address, ZERO); } - public static char getChar(Address address) { return getChar(address, ZERO); } - public static short getShort(Address address) { return getShort(address, ZERO); } - public static int getInt(Address address) { return getInt(address, ZERO); } - public static float getFloat(Address address) { return getFloat(address, ZERO); } - public static long getLong(Address address) { return getLong(address, ZERO); } - public static double getDouble(Address address) { return getDouble(address, ZERO); } - - public static byte setByte(Address address, byte value) { return setByte(address, value, ZERO); } - public static char setChar(Address address, char value) { return setChar(address, value, ZERO); } - public static short setShort(Address address, short value) { return setShort(address, value, ZERO); } - public static int setInt(Address address, int value) { return setInt(address, value, ZERO); } - public static float setFloat(Address address, float value) { return setFloat(address, value, ZERO); } - public static long setLong(Address address, long value) { return setLong(address, value, ZERO); } - public static double setDouble(Address address, double value) { return setDouble(address, value, ZERO); } - - public static byte getByte(Address address, Offset offset) { - return getPage(address, offset).getByte(address, offset); + static byte getByte(Address address) { + return getPage(address).getByte(address); } - - public static char getChar(Address address, Offset offset) { - return getPage(address, offset).getChar(address, offset); + static char getChar(Address address) { + return getPage(address).getChar(address); } - - public static short getShort(Address address, Offset offset) { - return (short)getPage(address, offset).getChar(address, offset); + static short getShort(Address address) { + return (short)getPage(address).getChar(address); } - - public static int getInt(Address address, Offset offset) { - return getPage(address, offset).getInt(address, offset); + static int getInt(Address address) { + return getPage(address).getInt(address); } - - public static float getFloat(Address address, Offset offset) { - return Float.intBitsToFloat(getInt(address,offset)); + static float getFloat(Address address) { + return Float.intBitsToFloat(getInt(address)); } - - public static long getLong(Address address, Offset offset) { - return getPage(address, offset).getLong(address, offset); + static long getLong(Address address) { + return getPage(address).getLong(address); } - - public static double getDouble(Address address, Offset offset) { - return Double.longBitsToDouble(getLong(address,offset)); + static double getDouble(Address address) { + return Double.longBitsToDouble(getLong(address)); } - public static byte setByte(Address address, byte value, Offset offset) { - return getPage(address, offset).setByte(address, value, offset); + static byte setByte(Address address, byte value) { + return getPage(address).setByte(address, value); } - public static char setChar(Address address, char value, Offset offset) { - return getPage(address, offset).setChar(address, value, offset); + static char setChar(Address address, char value) { + return getPage(address).setChar(address, value); } - public static short setShort(Address address, short value, Offset offset) { - return (short)setChar(address, (char)value, offset); + static short setShort(Address address, short value) { + return (short)setChar(address, (char)value); } - public static int setInt(Address address, int value, Offset offset) { - return getPage(address, offset).setInt(address, value, offset); + static int setInt(Address address, int value) { + return getPage(address).setInt(address, value); } - public static float setFloat(Address address, float value, Offset offset) { - return Float.intBitsToFloat(setInt(address, Float.floatToIntBits(value), offset)); + static float setFloat(Address address, float value) { + return Float.intBitsToFloat(setInt(address, Float.floatToIntBits(value))); } - public static long setLong(Address address, long value, Offset offset) { - return getPage(address, offset).setLong(address, value, offset); + static long setLong(Address address, long value) { + return getPage(address).setLong(address, value); } - public static double setDouble(Address address, double value, Offset offset) { - return Double.longBitsToDouble(setLong(address, Double.doubleToLongBits(value), offset)); + static double setDouble(Address address, double value) { + return Double.longBitsToDouble(setLong(address, Double.doubleToLongBits(value))); } - - public static boolean exchangeInt(Address address, int oldValue, int value) { - return exchangeInt(address, oldValue, value, ZERO); + static boolean exchangeInt(Address address, int oldValue, int value) { + return getPage(address).exchangeInt(address, oldValue, value); } - public static boolean exchangeInt(Address address, int oldValue, int value, Offset offset) { - return getPage(address, offset).exchangeInt(address, oldValue, value, offset); - } - /** * Demand zero mmaps an area of virtual memory. * @@ -256,10 +233,9 @@ */ public static boolean map(Address start, int size) { log("map(%s,%d)\n", start.toString(), size); - int first = start.toInt() >>> LOG_BYTES_IN_PAGE; - int last = (size >>> LOG_BYTES_IN_PAGE) + first; + Address last = start.plus(size); - for(int p=first; p < last; p++) { + for(Address p=start; p.LT(last); p = p.plus(BYTES_IN_PAGE)) { PageTable.mapPage(p); } return true; @@ -275,9 +251,8 @@ */ public static boolean protect(Address start, int size) { log("protect(%s,%d)\n", start.toString(), size); - int first = start.toInt() >> LOG_BYTES_IN_PAGE; - int last = first + size >> LOG_BYTES_IN_PAGE; - for(int p=first; p < last; p++) { + Address last = start.plus(size); + for(Address p=start; p.LT(last); p = p.plus(BYTES_IN_PAGE)) { PageTable.setNonReadable(p); } return true; @@ -293,9 +268,8 @@ */ public static boolean unprotect(Address start, int size) { log("unprotect(%s,%d)\n", start.toString(), size); - int first = start.toInt() >> LOG_BYTES_IN_PAGE; - int last = first + size >> LOG_BYTES_IN_PAGE; - for(int p=first; p < last; p++) { + Address last = start.plus(size); + for(Address p=start; p.LT(last); p = p.plus(BYTES_IN_PAGE)) { PageTable.setReadable(p); } return true; @@ -321,15 +295,15 @@ public static void zero(Address start, int size) { log("zero(%s,%d)\n", start.toString(), size); assert (size % BYTES_IN_WORD == 0) : "Must zero word rounded bytes"; - MemoryPage page = getPage(start, 0); - int pageAddress = start.toInt(); + MemoryPage page = getPage(start); + Address pageAddress = start; for(int i=0; i < size; i += BYTES_IN_WORD) { - int curAddr = start.toInt()+i; + Address curAddr = start.plus(i); if (!onSamePage(pageAddress, curAddr)) { - page = getPage(start, i); + page = getPage(curAddr); pageAddress=curAddr; } - page.setInt(start, 0, i); + page.setInt(curAddr, 0); } } @@ -340,9 +314,8 @@ */ public static void zeroPages(Address start, int size) { log("zeroPages(%s,%d)\n", start.toString(), size); - int first = start.toInt() >>> LOG_BYTES_IN_PAGE; - int last = (first + size) >>> LOG_BYTES_IN_PAGE; - for(int p=first; p < last; p++) { + Address last = start.plus(size); + for(Address p=start; p.LT(last); p = p.plus(BYTES_IN_PAGE)) { PageTable.zeroPage(p); } } @@ -362,19 +335,18 @@ int bytes = (beforeBytes + afterBytes); for(int i=0; i < bytes; i += BYTES_IN_WORD) { Address cur = begin.plus(i); - System.err.println(cur + ": " + Address.formatInt(getInt(cur, ZERO))); + System.err.println(cur + ": " + getInt(cur)); } } /** * Represents a single page of memory. */ - static final class MemoryPage { + private static final class MemoryPage { /** Is this page currently readable */ private boolean readable; - /** The page number */ - private final int page; /** The raw data on this page */ + private final Address pageAddress; private final int[] data; /** Watched indexes */ private final boolean[] watch; @@ -382,133 +354,155 @@ /** * Create a new MemoryPage to hold the data in a given page. */ - private MemoryPage(int page) { - this.page = page; + private MemoryPage(Address pageAddress) { + this.pageAddress = pageAddress; this.readable = true; this.data = new int[PAGE_SIZE >>> LOG_BYTES_IN_WORD]; this.watch = getWatchPoints(); + if (VERBOSE) log("Mapping page %s%n",pageAddress); } /** + * The base address of a given cell + * @param index + * @return + */ + private Address cellAddress(int index) { + return pageAddress.plus(index<<LOG_BYTES_IN_WORD); + } + + /** * Zero the memory in this page. */ - public synchronized void zero() { + public void zero() { for(int i=0; i < data.length; i++) { write(i, 0); } } + /** + * Construct a long value from 2 ints (high and low order 32-bit words) + * @param high TODO + * @param low TODO + * @return + */ + private long longFrom2Ints(int high, int low) { + return (((long)high) << 32) |(((long)low & 0xFFFFFFFFL)); + } + + /** * Calculate the index to use in the page data based on the given address/offset combination. * @param address The address being used. * @param offset The offset from this address. * @return The index into the page data. */ - private int getIndex(Address address, Offset offset) { - return getIndex(address,offset.value); + private int getIndex(Address address) { + assert onSamePage(address,pageAddress) : + "Invalid access of " + address + " in page " + pageAddress; + return ((int)((address.toLong()) & INDEX_MASK)) >>> LOG_BYTES_IN_WORD; } - private int getIndex(Address address, int offset) { - assert ((((address.value + offset) >>> LOG_BYTES_IN_PAGE) ^ page) == 0) : - "Invalid access of " + Address.formatInt(address.toInt() + offset) + " in page " + Address.formatInt(page << LOG_BYTES_IN_PAGE); - return ((address.toInt() + offset) & INDEX_MASK) >>> LOG_BYTES_IN_WORD; - } /** * Load a byte value from this page. */ - public byte getByte(Address address, Offset offset) { - int bitShift = ((address.value + offset.value) & ~WORD_MASK) << LOG_BITS_IN_BYTE; - int index = getIndex(address, offset); + public byte getByte(Address address) { + int bitShift = ((address.toInt()) & ~WORD_MASK) << LOG_BITS_IN_BYTE; + int index = getIndex(address); return (byte)(read(index) >>> bitShift); } /** * Load a char value from this page. */ - public char getChar(Address address, Offset offset) { - int bitShift = ((address.value + offset.value) & ~WORD_MASK) << LOG_BITS_IN_BYTE; + public char getChar(Address address) { + int bitShift = ((address.toInt()) & ~WORD_MASK) << LOG_BITS_IN_BYTE; assert bitShift == 0 || bitShift == 16: "misaligned char access"; - int index = getIndex(address, offset); + int index = getIndex(address); return (char)(read(index) >>> bitShift); } /** * Load an integer value from this page. */ - public int getInt(Address address, Offset offset) { - assert ((address.value + offset.value) % 4) == 0: "misaligned 4b access"; - return read(getIndex(address, offset)); + public int getInt(Address address) { + assert ((address.toInt()) % BYTES_IN_WORD) == 0: "misaligned 4b access"; + return read(getIndex(address)); } /** * Load a long value from this page. */ - public synchronized long getLong(Address address, Offset offset) { - assert ((address.value + offset.value) % 8) == 0: "misaligned 8b access"; - return (((long)getInt(address, offset)) << 32) | - ((long)getInt(address, offset.plus(BYTES_IN_WORD))); + public long getLong(Address address) { + if (ALIGN_CHECK_LONG) { + assert ((address.toLong()) % BYTES_IN_LONG) == 0: "misaligned 8b access"; + } + return longFrom2Ints(getInt(address), getInt(address.plus(BYTES_IN_WORD))); } - public synchronized byte setByte(Address address, byte value, Offset offset) { - int shift = ((address.value + offset.value) & ~WORD_MASK) << LOG_BITS_IN_BYTE; + public byte setByte(Address address, byte value) { + int shift = ((address.toInt()) & ~WORD_MASK) << LOG_BITS_IN_BYTE; int mask = 0x000000FF << shift; int newValue = (((int)value) << shift) & mask; - int index = getIndex(address, offset); + int index = getIndex(address); int oldValue = read(index); newValue = (oldValue & ~mask) | newValue; write(index, newValue); return (byte)(oldValue >>> shift); } - public synchronized char setChar(Address address, char value, Offset offset) { - int shift = ((address.value + offset.value) & ~WORD_MASK) << LOG_BITS_IN_BYTE; + public char setChar(Address address, char value) { + int shift = ((address.toInt()) & ~WORD_MASK) << LOG_BITS_IN_BYTE; assert shift == 0 || shift == 16: "misaligned 2b access"; int mask = 0x0000FFFF << shift; int newValue = (((int)value) << shift) & mask; - int index = getIndex(address, offset); + int index = getIndex(address); int oldValue = read(index); newValue = (oldValue & ~mask) | newValue; write(index, newValue); return (char)(oldValue >>> shift); } - public int setInt(Address address, int value, Offset offset) { - return setInt(address,value,offset.value); - } - public synchronized int setInt(Address address, int value, int offset) { - assert ((address.value + offset) % 4) == 0: "misaligned 4b access"; - int index = getIndex(address, offset); + public int setInt(Address address, int value) { + assert ((address.toInt()) % BYTES_IN_WORD) == 0: "misaligned 4b access"; + int index = getIndex(address); int old = read(index); write(index, value); return old; } - public synchronized long setLong(Address address, long value, Offset offset) { - assert ((address.value + offset.value) % 8) == 0: "misaligned 8b access"; - int index = getIndex(address, offset); - long old = ((long)read(index)) << 32 | ((long)read(index+1)); + public long setLong(Address address, long value) { + if (ALIGN_CHECK_LONG) { + assert ((address.toInt()) % BYTES_IN_LONG) == 0: "misaligned 8b access"; + } + int index = getIndex(address); + long old = longFrom2Ints(read(index), read(index+1)); write(index, (int)(value >>> 32)); write(index+1, (int)(value & 0xFFFFFFFFL)); return old; } - public synchronized boolean exchangeInt(Address address, int oldValue, int value, Offset offset) { - assert ((address.value + offset.value) % 4) == 0: "misaligned 4b access"; - int index = getIndex(address, offset); - int old = read(index); + public synchronized boolean exchangeInt(Address address, int oldValue, int value) { + int old = getInt(address); if (old != oldValue) return false; - write(index, value); + setInt(address,value); return true; } + public synchronized boolean exchangeLong(Address address, long oldValue, long value) { + long old = getLong(address); + if (old != oldValue) return false; + setLong(address,value); + return true; + } + /** * Perform the actual read of memory. */ private int read(int index) { int value = data[index]; if (isWatched(index)) { - System.err.println(Address.formatInt((page << LOG_BYTES_IN_PAGE) + (index<<LOG_BYTES_IN_WORD)) + "= " + - Address.formatInt(data[index])); + System.err.printf("%s = %08x%n", cellAddress(index), data[index]); } return value; } @@ -518,9 +512,7 @@ */ private void write(int index, int value) { if (isWatched(index)) { - System.err.println(Address.formatInt((page << LOG_BYTES_IN_PAGE) + (index<<LOG_BYTES_IN_WORD)) + ": " + - Address.formatInt(data[index]) + " -> " + - Address.formatInt(value)); + System.err.printf("%s: %08x -> %08x%n", cellAddress(index), data[index], value); } data[index] = value; } @@ -535,10 +527,10 @@ private boolean[] getWatchPoints() { boolean[] result = new boolean[data.length]; for(Address addr: SimulatedMemory.watches) { - if ((addr.value >>> LOG_BYTES_IN_PAGE) == page) { - int index = getIndex(addr, ZERO); + if (onSamePage(addr,pageAddress)) { + int index = getIndex(addr); result[index] = true; - System.err.println("Watching address "+addr+" (index "+index+" in page "+page+")"); + System.err.println("Watching address "+addr); } } return result; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2009-03-09 01:51:09
|
Revision: 15562 http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=15562&view=rev Author: rgarner Date: 2009-03-09 01:31:00 +0000 (Mon, 09 Mar 2009) Log Message: ----------- Hooks for MMTk debugger as per RVM-802. MMTk harness component includes the parts of the sanity checker required to support a 'from-space invariant' at the start of the RELEASE phase. Modified Paths: -------------- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Factory.java rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ObjectModel.java rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Factory.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Mutator.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Env.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Trace.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/runtime/StackFrame.java rvmroot/trunk/MMTk/src/org/mmtk/plan/Phase.java rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/GenNurseryTraceLocal.java rvmroot/trunk/MMTk/src/org/mmtk/policy/CopySpace.java rvmroot/trunk/MMTk/src/org/mmtk/vm/Factory.java rvmroot/trunk/MMTk/src/org/mmtk/vm/VM.java Added Paths: ----------- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Debug.java rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Debug.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/sanity/ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/sanity/FromSpaceInvariant.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/sanity/HeapEntry.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/sanity/HeapSnapshot.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/sanity/HeapVisitor.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/sanity/Sanity.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/sanity/Traversal.java rvmroot/trunk/MMTk/src/org/mmtk/vm/Debug.java Added: rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Debug.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Debug.java (rev 0) +++ rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Debug.java 2009-03-09 01:31:00 UTC (rev 15562) @@ -0,0 +1,79 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Common Public License (CPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/cpl1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ +package org.mmtk.harness.vm; + +import org.mmtk.harness.lang.Trace; +import org.mmtk.harness.lang.Trace.Item; +import org.mmtk.harness.sanity.FromSpaceInvariant; +import org.mmtk.plan.Simple; +import org.vmmagic.unboxed.Address; +import org.vmmagic.unboxed.ObjectReference; + +/** + * Debugger support for the MMTk harness + */ +public final class Debug extends org.mmtk.vm.Debug { + + /** + * Enable MMTk debugger support + */ + @Override + public boolean isEnabled() { + return true; + } + + private String format(ObjectReference obj) { + if (obj.isNull()) { + return obj.toString(); + } + return ObjectModel.getString(obj); + } + + private String format(Address addr) { + return format(addr.toObjectReference()); + } + + /** + * @see org.mmtk.vm.Debug#arrayRemsetEntry(org.vmmagic.unboxed.Address, org.vmmagic.unboxed.Address) + */ + @Override + public void arrayRemsetEntry(Address start, Address guard) { + Trace.printf(Item.COLLECT, "arrayRemset: [%s,%s)", start, guard); + } + + /** + * @see org.mmtk.vm.Debug#modbufEntry(org.vmmagic.unboxed.ObjectReference) + */ + @Override + public void modbufEntry(ObjectReference object) { + Trace.printf(Item.COLLECT, "modbuf: %s", format(object)); + } + + /** + * @see org.mmtk.vm.Debug#remsetEntry(org.vmmagic.unboxed.Address) + */ + @Override + public void remsetEntry(Address slot) { + Trace.printf(Item.COLLECT, "remset: %s->%s", format(slot), format(slot.loadAddress())); + } + + /** + * @see org.mmtk.vm.Debug#globalPhase(short, boolean) + */ + @Override + public void globalPhase(short phaseId, boolean before) { + if (phaseId == Simple.RELEASE && before) { + new FromSpaceInvariant(); + } + } +} Modified: rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Factory.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Factory.java 2009-03-08 22:51:56 UTC (rev 15561) +++ rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Factory.java 2009-03-09 01:31:00 UTC (rev 15562) @@ -396,4 +396,9 @@ public org.mmtk.vm.MMTk_Events newEvents() { return new MMTkEvents(); } + + @Override + public Debug newDebug() { + return new Debug(); + } } Modified: rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ObjectModel.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ObjectModel.java 2009-03-08 22:51:56 UTC (rev 15561) +++ rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ObjectModel.java 2009-03-09 01:31:00 UTC (rev 15562) @@ -13,6 +13,8 @@ package org.mmtk.harness.vm; import java.io.PrintStream; +import java.util.HashSet; +import java.util.Set; import java.util.Stack; import org.mmtk.harness.Collector; @@ -22,6 +24,7 @@ import org.mmtk.plan.CollectorContext; import org.mmtk.plan.MutatorContext; import org.mmtk.plan.Plan; +import org.mmtk.policy.Space; import org.vmmagic.pragma.Uninterruptible; import org.vmmagic.unboxed.*; @@ -75,12 +78,9 @@ wr.flush(); } - static { - //printObjectLayout(System.out); - assert REFS_OFFSET.EQ(Offset.fromIntSignExtend(HEADER_SIZE)); - } - + /** Max data fields in an object */ public static final int MAX_DATA_FIELDS = Integer.MAX_VALUE; + /** Max pointer fields in an object */ public static final int MAX_REF_FIELDS = Integer.MAX_VALUE; /** Has this object been hashed? */ @@ -93,6 +93,10 @@ /** The value placed in alignment holes */ public static final int ALIGNMENT_VALUE = 1; + /* + * Object identifiers. Objects are allocated a sequential identifier. + */ + /** The next object id that will be allocated */ private static int nextObjectId = 1; @@ -106,7 +110,28 @@ return nextObjectId; } + /* + * Watchpoints by object identifier. + */ + + private static final Set<Integer> watchSet = new HashSet<Integer>(); + /** + * @param object The object + * @return True if this object is being watched + */ + public static boolean isWatched(ObjectReference object) { + return watchSet.contains(getId(object)); + } + + static { + //printObjectLayout(System.out); + assert REFS_OFFSET.EQ(Offset.fromIntSignExtend(HEADER_SIZE)); + //watchSet.add(4109); + //watchSet.add(8205); + } + + /** * Allocate an object and return the ObjectReference. * * @param context The MMTk MutatorContext to use. @@ -133,13 +158,19 @@ setRefCount(ref, refCount); setDataCount(ref, dataCount); + if (isWatched(ref)) { + System.err.printf("WATCH: Object %s created%n",objectIdString(ref)); + } + // Call MMTk postAlloc context.postAlloc(ref, null, bytes, allocator); return ref; } /** - * Get the number of references in the object. + * Get the number of references in an object. + * @param object The object + * @return number of reference fields in the object. */ public static int getRefs(ObjectReference object) { return object.toAddress().loadInt(REFCOUNT_OFFSET); @@ -147,19 +178,14 @@ /** * Get the object identifier. + * @param object The object + * @return The object identifier */ public static int getId(ObjectReference object) { return object.toAddress().loadInt(ID_OFFSET) >>> 2; } /** - * Get the object identifier as a string. - */ - public static String idString(ObjectReference object) { - return String.format("%08x", getId(object)); - } - - /** * Set the object identifier. */ private static void setId(ObjectReference object, int value) { @@ -255,38 +281,6 @@ /** - * Dump (logical) information for an object. - * - * @param object The object whose information is to be dumped - */ - public static void dumpLogicalObject(int width, ObjectReference object, Stack<ObjectReference> workStack) { - int refCount = getRefs(object); - int dataCount = getDataCount(object); - boolean hashed = (object.toAddress().loadInt(STATUS_OFFSET) & HASHED) == HASHED; - System.err.printf(" Object %s <%d %d %1s> [", Mutator.formatObject(width, object), refCount, dataCount, (hashed ? "H" : "")); - if (refCount > 0) { - for(int i=0; i < refCount; i++) { - ObjectReference ref = getRefSlot(object, i).loadObjectReference(); - System.err.print(" "); - System.err.print(Mutator.formatObject(width, ref)); - if (!ref.isNull()) { - workStack.push(ref); - } - } - } - System.err.println(" ]"); - } - - /** - * Print an object's header - */ - public static void dumpObjectHeader(ObjectReference object) { - int gcWord = object.toAddress().loadInt(GC_OFFSET); - int statusWord = object.toAddress().loadInt(STATUS_OFFSET); - System.err.printf("Object %s[%d@%s]<%x,%x>%n",object,getId(object),Mutator.getSiteName(object),gcWord,statusWord); - } - - /** * Return the next object id to be allocated. */ public static int nextObjectId() { @@ -327,14 +321,17 @@ * @param allocator The allocator to use. * @return the address of the new object */ + @Override public ObjectReference copy(ObjectReference from, int allocator) { - Trace.trace(Item.COLLECT,"Copying object %s[%d@%s]",from,getId(from),Mutator.getSiteName(from)); int oldBytes = getSize(from); int newBytes = getCopiedSize(from); int align = getAlignWhenCopied(from); CollectorContext c = Collector.current().getContext(); allocator = c.copyCheckAllocator(from, newBytes, align, allocator); Address toRegion = c.allocCopy(from, newBytes, align, getAlignOffsetWhenCopied(from), allocator); + ObjectReference to = toRegion.toObjectReference(); + Trace.trace(Item.COLLECT,"Copying object %s from %s to %s", objectIdString(from), + addressAndSpaceString(from),addressAndSpaceString(to)); Address fromRegion = from.toAddress(); for(int i=0; i < oldBytes; i += SimulatedMemory.BYTES_IN_INT) { @@ -347,9 +344,13 @@ toRegion.store(getHashCode(from), Offset.fromIntZeroExtend(oldBytes)); } - ObjectReference to = toRegion.toObjectReference(); + c.postCopy(to, null, newBytes, allocator); + if (isWatched(from)) { + System.err.printf("WATCH: Object %d copied from %s to %s%n",getId(from), + addressAndSpaceString(from),addressAndSpaceString(to)); + dumpObject(to); + } - c.postCopy(to, null, newBytes, allocator); return to; } @@ -362,11 +363,14 @@ * * @param from the address of the object to be copied * @param to The target location. - * @param region The start of the region that was reserved for this object + * @param toRegion The start of the region that was reserved for this object * @return Address The address past the end of the copied object */ + @Override public Address copyTo(ObjectReference from, ObjectReference to, Address toRegion) { - Trace.trace(Item.COLLECT,"Copying object %s[%d@%s] to %s",from,getId(from),Mutator.getSiteName(from),to); + Trace.trace(Item.COLLECT,"Copying object %s from %s/%s to %s/%s", objectIdString(from), + from,Space.getSpaceForObject(from).getName(), + to,Space.getSpaceForObject(to).getName()); if (Trace.isEnabled(Item.COLLECT)) { dumpObjectHeader(from); } @@ -386,6 +390,10 @@ if (Trace.isEnabled(Item.COLLECT)) { dumpObjectHeader(to); } + if (isWatched(from)) { + System.err.printf("WATCH: Object %d copied from %s to %s%n",objectIdString(from), + addressAndSpaceString(from),addressAndSpaceString(to)); + } return toRegion.plus(bytes); } @@ -447,6 +455,7 @@ /** * Return the next object in the heap under contiguous allocation */ + @Override public ObjectReference getNextObject(ObjectReference object) { Address nextAddress = object.toAddress().plus(getSize(object)); if (nextAddress.loadInt() == ALIGNMENT_VALUE) { @@ -461,6 +470,7 @@ /** * Return an object reference from knowledge of the low order word */ + @Override public ObjectReference getObjectFromStartAddress(Address start) { if ((start.loadInt() & ALIGNMENT_VALUE) != 0) { start = start.plus(SimulatedMemory.BYTES_IN_WORD); @@ -473,6 +483,7 @@ * * @param object The object. */ + @Override public Address getObjectEndAddress(ObjectReference object) { return object.toAddress().plus(getSize(object)); } @@ -483,28 +494,17 @@ * @param ref address of the object * @return byte array with the type descriptor */ + @Override public byte[] getTypeDescriptor(ObjectReference ref) { return getString(ref).getBytes(); } /** - * Get the type descriptor for an object. - * - * @param ref address of the object - * @return byte array with the type descriptor - */ - public String getString(ObjectReference ref) { - int refs = getRefs(ref); - int data = getDataCount(ref); - int size = getSize(ref); - return ("Object[" + size + "bytes " + refs + "R / " + data + "D]"); - } - - /** * Is the passed object an array? * * @param object address of the object */ + @Override public boolean isArray(ObjectReference object) { Assert.notImplemented(); return false; @@ -515,6 +515,7 @@ * * @param object address of the object */ + @Override public boolean isPrimitiveArray(ObjectReference object) { Assert.notImplemented(); return false; @@ -526,6 +527,7 @@ * @param object address of the object * @return The array length, in elements */ + @Override public int getArrayLength(ObjectReference object) { Assert.notImplemented(); return 0; @@ -544,7 +546,11 @@ * @return <code>true</code> if the bits were set, * <code>false</code> otherwise */ + @Override public boolean attemptAvailableBits(ObjectReference object, Word oldVal, Word newVal) { + if (Trace.isEnabled(Item.AVBYTE) || isWatched(object)) { + Trace.printf(Item.AVBYTE,"%s.status:%s->%s", object,oldVal,newVal); + } return object.toAddress().attempt(oldVal, newVal, STATUS_OFFSET); } @@ -555,6 +561,7 @@ * @param object the address of the object * @return the value of the bits */ + @Override public Word prepareAvailableBits(ObjectReference object) { return object.toAddress().prepareWord(STATUS_OFFSET); } @@ -565,10 +572,11 @@ * @param object the address of the object * @param val the new value of the byte */ + @Override public void writeAvailableByte(ObjectReference object, byte val) { - if (Trace.isEnabled(Item.AVBYTE)) { + if (Trace.isEnabled(Item.AVBYTE) || isWatched(object)) { byte old = object.toAddress().loadByte(STATUS_OFFSET); - Trace.trace(Item.AVBYTE,"%s.gcbyte:%d->%d", object,old,val); + Trace.printf(Item.AVBYTE,"%s.gcbyte:%d->%d", object,old,val); } object.toAddress().store(val, STATUS_OFFSET); } @@ -579,6 +587,7 @@ * @param object the address of the object * @return the value of the byte */ + @Override public byte readAvailableByte(ObjectReference object) { return object.toAddress().loadByte(STATUS_OFFSET); } @@ -589,10 +598,11 @@ * @param object the address of the object * @param val the new value of the bits */ + @Override public void writeAvailableBitsWord(ObjectReference object, Word val) { - if (Trace.isEnabled(Item.AVBYTE)) { + if (Trace.isEnabled(Item.AVBYTE) || isWatched(object)) { byte old = object.toAddress().loadByte(STATUS_OFFSET); - Trace.trace(Item.AVBYTE,"%s.gcbyte:%d->%d", object,old,val.and(Word.fromIntZeroExtend(0xFF)).toInt()); + Trace.printf(Item.AVBYTE,"%s.gcbyte:%d->%d", object,old,val.and(Word.fromIntZeroExtend(0xFF)).toInt()); } object.toAddress().store(val, STATUS_OFFSET); } @@ -603,6 +613,7 @@ * @param object the address of the object * @return the value of the bits */ + @Override public Word readAvailableBitsWord(ObjectReference object) { return object.toAddress().loadWord(STATUS_OFFSET); } @@ -615,6 +626,7 @@ * * @return the offset, relative the object reference address */ + @Override public Offset GC_HEADER_OFFSET() { return GC_OFFSET; } @@ -625,6 +637,7 @@ * @param object the reference address of the object * @return the lowest address of the object */ + @Override public Address objectStartRef(ObjectReference object) { return object.toAddress(); } @@ -636,6 +649,7 @@ * @param object the reference address of the object * @return an address inside the object */ + @Override public Address refToAddress(ObjectReference object) { return object.toAddress(); } @@ -647,25 +661,102 @@ * @return <code>true</code> if a reference of the type is * inherently acyclic */ + @Override public boolean isAcyclic(ObjectReference typeRef) { return false; } + /** @return The offset from array reference to element zero */ + @Override + protected Offset getArrayBaseOffset() { + return REFS_OFFSET; + } + + /* + * String representations of objects and logging/dump methods + */ + /** * Dump debugging information for an object. * * @param object The object whose information is to be dumped */ + @Override public void dumpObject(ObjectReference object) { System.err.println("==================================="); - System.err.println(getString(object) + " @" + object.toAddress()); + System.err.println(getString(object)); System.err.println("==================================="); SimulatedMemory.dumpMemory(object.toAddress(), 0, getSize(object)); System.err.println("==================================="); } - /** @return The offset from array reference to element zero */ - protected Offset getArrayBaseOffset() { - return REFS_OFFSET; + /** + * Format the object for dumping, and trim to a max width. + */ + public static String formatObject(int width, ObjectReference object) { + String base = getString(object); + return base.substring(base.length() - width); } + + /** + * Print an object's header + */ + public static void dumpObjectHeader(ObjectReference object) { + int gcWord = object.toAddress().loadInt(GC_OFFSET); + int statusWord = object.toAddress().loadInt(STATUS_OFFSET); + System.err.printf("Object %s[%d@%s]<%x,%x>%n",object,getId(object),Mutator.getSiteName(object),gcWord,statusWord); + } + + /** + * Dump (logical) information for an object. + * @param width Output width + * @param object The object whose information is to be dumped + */ + public static void dumpLogicalObject(int width, ObjectReference object, Stack<ObjectReference> workStack) { + int refCount = getRefs(object); + int dataCount = getDataCount(object); + boolean hashed = (object.toAddress().loadInt(STATUS_OFFSET) & HASHED) == HASHED; + System.err.printf(" Object %s <%d %d %1s> [", ObjectModel.formatObject(width, object), refCount, dataCount, (hashed ? "H" : "")); + if (refCount > 0) { + for(int i=0; i < refCount; i++) { + ObjectReference ref = getRefSlot(object, i).loadObjectReference(); + System.err.print(" "); + System.err.print(ObjectModel.formatObject(width, ref)); + if (!ref.isNull()) { + workStack.push(ref); + } + } + } + System.err.println(" ]"); + } + + /** + * String description of an object. + * + * @param ref address of the object + * @return "Object[size b nR/mD] + */ + public static String getString(ObjectReference ref) { + int refs = getRefs(ref); + int data = getDataCount(ref); + return addressAndSpaceString(ref)+objectIdString(ref)+refs + "R" + data + "D"; + } + + /** + * Brief string description of an object + * @param ref The object + * @return "[id@line:col]" + */ + private static String objectIdString(ObjectReference ref) { + return String.format("[%d@%s]", getId(ref),Mutator.getSiteName(ref)); + } + + /** + * Address and space name (eg 0x45678900/ms) + * @param ref The object + * @return "address/space" + */ + private static String addressAndSpaceString(ObjectReference ref) { + return String.format("%s/%s",ref, Space.getSpaceForObject(ref).getName()); + } } Added: rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Debug.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Debug.java (rev 0) +++ rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Debug.java 2009-03-09 01:31:00 UTC (rev 15562) @@ -0,0 +1,31 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Common Public License (CPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/cpl1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ +package org.jikesrvm.mm.mmtk; + +import org.vmmagic.pragma.Uninterruptible; + +/** + * Debugger support for the MMTk harness + */ +@Uninterruptible +public final class Debug extends org.mmtk.vm.Debug { + + /** + * Enable/disable MMTk debugger support + */ + @Override + public boolean isEnabled() { + return false; + } + +} Modified: rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Factory.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Factory.java 2009-03-08 22:51:56 UTC (rev 15561) +++ rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Factory.java 2009-03-09 01:31:00 UTC (rev 15562) @@ -298,6 +298,10 @@ } } + public org.mmtk.vm.Debug newDebug() { + return new Debug(); + } + /********************************************************************** * GCspy methods */ Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Mutator.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Mutator.java 2009-03-08 22:51:56 UTC (rev 15561) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Mutator.java 2009-03-09 01:31:00 UTC (rev 15562) @@ -13,6 +13,7 @@ package org.mmtk.harness; import java.util.ArrayList; +import java.util.Collections; import java.util.HashSet; import java.util.Set; import java.util.Stack; @@ -20,6 +21,7 @@ import org.mmtk.harness.lang.Trace; import org.mmtk.harness.lang.Trace.Item; import org.mmtk.harness.lang.runtime.AllocationSite; +import org.mmtk.harness.lang.runtime.ObjectValue; import org.mmtk.harness.scheduler.Scheduler; import org.mmtk.harness.vm.ActivePlan; import org.mmtk.harness.vm.ObjectModel; @@ -43,9 +45,12 @@ * Note that as soon as the mutator is created it is considered active. This means * that a GC can not occur unless you execute commands on the mutator (or muEnd it). */ -public class Mutator { +public abstract class Mutator { private static boolean gcEveryWB = false; + /** + * Force garbage collection on every write barrier invocation + */ public static void setGcEveryWB() { gcEveryWB = true; } @@ -54,6 +59,13 @@ protected static final ArrayList<Mutator> mutators = new ArrayList<Mutator>(); /** + * @return The active mutators + */ + public static java.util.Collection<Mutator> getMutators() { + return Collections.unmodifiableCollection(mutators); + } + + /** * Get a mutator by id. */ public static Mutator get(int id) { @@ -188,6 +200,11 @@ } /** + * Return the roots + */ + public abstract Iterable<ObjectValue> getRoots(); + + /** * Print the thread roots and add them to a stack for processing. */ public void dumpThreadRoots(int width, Stack<ObjectReference> roots) { @@ -195,21 +212,6 @@ } /** - * Format the object for dumping. - */ - public static String formatObject(ObjectReference object) { - return String.format("%s[%d@%s]", object, ObjectModel.getId(object), getSiteName(object)); - } - - /** - * Format the object for dumping, and trim to a max width. - */ - public static String formatObject(int width, ObjectReference object) { - String base = formatObject(object); - return base.substring(base.length() - width); - } - - /** * Print the thread roots and add them to a stack for processing. */ public static void dumpHeap() { @@ -306,7 +308,7 @@ int limit = ObjectModel.getDataCount(object); check(!object.isNull(), "Object can not be null"); check(index >= 0, "Index must be non-negative"); - check(index < limit, "Index out of bounds"); + check(index < limit, "Index "+index+" out of bounds "+limit); Address ref = ObjectModel.getDataSlot(object, index); ref.store(value); @@ -322,12 +324,12 @@ */ public void storeReferenceField(ObjectReference object, int index, ObjectReference value) { int limit = ObjectModel.getRefs(object); - if (Trace.isEnabled(Item.STORE)) { - System.err.printf("[%s].object[%d/%d] = %s%n",object.toString(),index,limit,value.toString()); + if (Trace.isEnabled(Item.STORE) || ObjectModel.isWatched(object)) { + Trace.printf(Item.STORE,"[%s].object[%d/%d] = %s",ObjectModel.getString(object),index,limit,value.toString()); } check(!object.isNull(), "Object can not be null"); check(index >= 0, "Index must be non-negative"); - check(index < limit, "Index out of bounds"); + check(index < limit, "Index "+index+" out of bounds "+limit); Address referenceSlot = ObjectModel.getRefSlot(object, index); if (ActivePlan.constraints.needsWriteBarrier()) { @@ -350,11 +352,11 @@ int limit = ObjectModel.getDataCount(object); check(!object.isNull(), "Object can not be null"); check(index >= 0, "Index must be non-negative"); - check(index < limit, "Index out of bounds"); + check(index < limit, "Index "+index+" out of bounds "+limit); Address dataSlot = ObjectModel.getDataSlot(object, index); int result = dataSlot.loadInt(); - Trace.trace(Item.LOAD,"[%s].int[%d] returned [%d]",object.toString(),index,result); + Trace.trace(Item.LOAD,"[%s].int[%d] returned [%d]",ObjectModel.getString(object),index,result); return result; } @@ -368,7 +370,7 @@ int limit = ObjectModel.getRefs(object); check(!object.isNull(), "Object can not be null"); check(index >= 0, "Index must be non-negative"); - check(index < limit, "Index out of bounds"); + check(index < limit, "Index "+index+" out of bounds "+limit); Address referenceSlot = ObjectModel.getRefSlot(object, index); ObjectReference result; @@ -377,7 +379,7 @@ } else { result = referenceSlot.loadObjectReference(); } - Trace.trace(Item.LOAD,"[%s].object[%d] returned [%s]",object.toString(),index,result.toString()); + Trace.trace(Item.LOAD,"[%s].object[%d] returned [%s]",ObjectModel.getString(object),index,result.toString()); return result; } @@ -387,7 +389,7 @@ public int hash(ObjectReference object) { check(!object.isNull(), "Object can not be null"); int result = ObjectModel.getHashCode(object); - Trace.trace(Item.HASH,"hash(%s) returned [%d]",object.toString(),result); + Trace.trace(Item.HASH,"hash(%s) returned [%d]",ObjectModel.getString(object),result); return result; } @@ -397,6 +399,7 @@ * @param refCount The number of reference fields. * @param dataCount The number of data fields. * @param doubleAlign Is this an 8 byte aligned object? + * @param allocSite Allocation site * @return The object reference. */ public ObjectReference alloc(int refCount, int dataCount, boolean doubleAlign, int allocSite) { @@ -406,6 +409,7 @@ check(dataCount <= ObjectModel.MAX_DATA_FIELDS, "Maximum of "+ObjectModel.MAX_DATA_FIELDS+" data fields per object"); ObjectReference result = ObjectModel.allocateObject(context, refCount, dataCount, doubleAlign, allocSite); Trace.trace(Item.ALLOC,"alloc(" + refCount + ", " + dataCount + ", " + doubleAlign + ") returned [" + result + "]"); + check(result != null, "Allocation returned null"); return result; } Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Env.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Env.java 2009-03-08 22:51:56 UTC (rev 15561) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Env.java 2009-03-09 01:31:00 UTC (rev 15562) @@ -12,11 +12,15 @@ */ package org.mmtk.harness.lang; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; import java.util.Random; import java.util.Stack; import org.mmtk.harness.Mutator; import org.mmtk.harness.lang.Trace.Item; +import org.mmtk.harness.lang.runtime.ObjectValue; import org.mmtk.harness.lang.runtime.StackFrame; import org.mmtk.plan.TraceLocal; import org.vmmagic.unboxed.ObjectReference; @@ -61,14 +65,14 @@ } /** - * The frame at the top of the stack. + * @return The frame at the top of the stack. */ public StackFrame top() { return stack.peek(); } /** - * + * @return The current stack */ public Iterable<StackFrame> stack() { return stack; @@ -86,6 +90,15 @@ Trace.trace(Item.ROOTS, "Locals: %d", localCount); } + @Override + public Collection<ObjectValue> getRoots() { + List<ObjectValue> roots = new ArrayList<ObjectValue>(); + for (StackFrame frame : stack) { + roots.addAll(frame.getRoots()); + } + return roots; + } + /** * Print the thread roots and add them to a stack for processing. */ Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Trace.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Trace.java 2009-03-08 22:51:56 UTC (rev 15561) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Trace.java 2009-03-09 01:31:00 UTC (rev 15562) @@ -14,16 +14,46 @@ import java.util.EnumSet; +/** + * Tracing of events in the harness, both for debugging MMTk + * and the harness itself. + * + * Tracing can be enabled using the command-line trace=<i>ITEM</i> parameter, + * or by setting Trace.enable(Item.xx) in the code. + */ public final class Trace { - public enum Item { ALLOC, CALL, OBJECT, INTRINSIC, LOAD, STORE, HASH, ENV, - ROOTS, COLLECT, AVBYTE, EVAL, COMPILER, CHECKER, SCHEDULER } + /** + * Items that can be traced. + */ + public enum Item { + /** Object allocation */ ALLOC, + /** Procedure calls in the harness language */ CALL, + /** Object reads and writes */ OBJECT, + /** Calls to intrinsic methods in the harness language */ INTRINSIC, + /** Load operations in the harness language */ LOAD, + /** Store operations in the harness language */ STORE, + /** Hashcode operations */ HASH, + /** Environment (stack frame) loads/stores */ ENV, + /** Tracing of roots */ ROOTS, + /** Garbage collection */ COLLECT, + /** Available byte operations */ AVBYTE, + /** P-code evaluation */ EVAL, + /** P-code compiler */ COMPILER, + /** Harness language semantic checker */ CHECKER, + /** Harness language thread scheduler */ SCHEDULER, + /** Harness language parser */ PARSER, + /** Harness language simplifier */ SIMPLIFIER + } private static EnumSet<Item> enabled = EnumSet.noneOf(Item.class); static { - //enable(Item.ALLOC); + //enable(Item.ENV); } + /** + * @return the names of the items in the Item enumeration + */ public static String[] itemNames() { String[] result = new String[Item.values().length+1]; result[0] = "NONE"; @@ -33,21 +63,34 @@ return result; } + /** + * Enable tracing of the given item + * @param item Item to trace + */ public static void enable(String item) { enable(Item.valueOf(item)); } + /** + * Enable tracing of the given item + * @param item Item to trace + */ public static void enable(Item item) { enabled.add(item); } + /** + * Is the given item enabled for tracing ? + * @param item The trace item + * @return Is the given item enabled for tracing ? + */ public static boolean isEnabled(Item item) { return enabled.contains(item); } public static synchronized void trace(Item item, String pattern, Object...args) { if (isEnabled(item)) { - printf(prefix(item) + pattern + "%n",args); + printf(item, pattern, args); } } @@ -55,6 +98,10 @@ return "["+item+"] "; } + public static void printf(Item item, String pattern, Object... args) { + printf(prefix(item) + pattern + "%n",args); + } + public static void printf(String pattern, Object...args) { System.err.printf(pattern,args); } Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/runtime/StackFrame.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/runtime/StackFrame.java 2009-03-08 22:51:56 UTC (rev 15561) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/runtime/StackFrame.java 2009-03-09 01:31:00 UTC (rev 15562) @@ -12,15 +12,17 @@ */ package org.mmtk.harness.lang.runtime; +import java.util.ArrayList; +import java.util.Collection; import java.util.List; import java.util.Stack; -import org.mmtk.harness.Mutator; import org.mmtk.harness.lang.Declaration; import org.mmtk.harness.lang.Trace; import org.mmtk.harness.lang.Trace.Item; +import org.mmtk.harness.lang.pcode.PseudoOp; import org.mmtk.harness.lang.ast.Type; -import org.mmtk.harness.lang.pcode.PseudoOp; +import org.mmtk.harness.vm.ObjectModel; import org.mmtk.plan.TraceLocal; import org.vmmagic.unboxed.ObjectReference; @@ -73,9 +75,8 @@ public Value get(int slot) { if (slot >= 0) { return values[slot]; - } else { - return ConstantPool.get(slot); } + return ConstantPool.get(slot); } /** @@ -90,27 +91,36 @@ */ public void set(int slot, Value value) { assert value != null : "Unexpected null value"; - if (Trace.isEnabled(Item.ENV)) { - Trace.trace(Item.ENV, "%s %s = %s",value.type().toString(),names[slot],value.toString()); + if (Trace.isEnabled(Item.EVAL)) { + Trace.printf(Item.EVAL, "%s %s = %s",value.type().toString(),getSlotName(slot),value.toString()); } values[slot] = value; } + private String getSlotName(int slot) { + if (names != null && names[slot] != null) { + return names[slot]; + } + return "t" + slot; + } + /** * GC support: trace this stack frame. + * @param trace The MMTk trace object to receive the roots + * @return The number of roots found */ public int computeRoots(TraceLocal trace) { int rootCount = 0; - for (int i=0; i < values.length; i++) { - Value value = values[i]; - if (value != null && value instanceof ObjectValue) { - ObjectValue object = (ObjectValue)value; + for (ObjectValue object : getRoots()) { + if (!object.getObjectValue().isNull()) { if (Trace.isEnabled(Item.ROOTS)) { - Trace.trace(Item.ROOTS, "Tracing root %s=%s", names[i], object.toString()); + Trace.trace(Item.ROOTS, "Tracing root %s", object.toString()); } object.traceObject(trace); + assert trace.willNotMoveInCurrentCollection(object.getObjectValue()) : + object.getObjectValue()+" has been traced but willNotMoveInCurrentCollection is still false"; if (Trace.isEnabled(Item.ROOTS)) { - Trace.trace(Item.ROOTS, "new value of %s=%s", names[i], object.toString()); + Trace.trace(Item.ROOTS, "new value of %s", object.toString()); } rootCount++; } @@ -119,20 +129,36 @@ } /** + * + * @return The root ObjectValues for this stack frame + */ + public Collection<ObjectValue> getRoots() { + List<ObjectValue> roots = new ArrayList<ObjectValue>(); + for (Value value : values) { + if (value != null && value instanceof ObjectValue) { + roots.add((ObjectValue)value); + } + } + return roots; + } + + /** * Debug printing support: dump this stack frame and return roots. + * @param width Output field width + * @param roots Root references */ public void dumpRoots(int width, Stack<ObjectReference> roots) { for (int i=0; i < values.length; i++) { Value value = values[i]; String name; if (Trace.isEnabled(Item.ROOTS)) { - name = i < names.length ? names[i] : "t"+i; + name = names != null && i < names.length ? getSlotName(i) : "t"+i; } else { name = "slot["+i+"]"; } if (value != null && value instanceof ObjectValue) { ObjectReference ref = ((ObjectValue)value).getObjectValue(); - System.err.printf(" %s=%s", name, Mutator.formatObject(width, ref)); + System.err.printf(" %s=%s", name, ObjectModel.formatObject(width, ref)); if (!ref.isNull()) roots.push(ref); } } Added: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/sanity/FromSpaceInvariant.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/sanity/FromSpaceInvariant.java (rev 0) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/sanity/FromSpaceInvariant.java 2009-03-09 01:31:00 UTC (rev 15562) @@ -0,0 +1,55 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Common Public License (CPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/cpl1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ +package org.mmtk.harness.sanity; + +import org.mmtk.harness.vm.ObjectModel; +import org.mmtk.policy.CopySpace; +import org.mmtk.policy.Space; +import org.vmmagic.unboxed.Address; +import org.vmmagic.unboxed.ObjectReference; + +/** + * Enforce the CopySpace invariant that all live objects are in to-space + * + * This should be true at the start of the RELEASE collection phase + */ +public class FromSpaceInvariant implements HeapVisitor { + + /** + * Creation of a FromSpaceInvariant object enforces the invariant. + */ + public FromSpaceInvariant() { + Traversal.traverse(this); + } + + /** + * Unused - the heap invariant is enforced on pointers (edges) + * @see org.mmtk.harness.sanity.HeapVisitor#visitObject(ObjectReference, boolean, boolean) + */ + @Override + public void visitObject(ObjectReference object, boolean root, boolean marked) { + } + + /** + * Enforce the invariant. We use this visitor method so we can + * @see org.mmtk.harness.sanity.HeapVisitor#visitPointer(ObjectReference, Address, ObjectReference) + */ + @Override + public void visitPointer(ObjectReference source, Address slot, ObjectReference target) { + Space space = Space.getSpaceForObject(target); + if (space instanceof CopySpace && ((CopySpace)space).isFromSpace()) { + assert false : String.format("### Object %s is in from-space, pointed to by %s slot %s%n", + ObjectModel.getString(target), ObjectModel.getString(source), slot); + } + } +} Added: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/sanity/HeapEntry.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/sanity/HeapEntry.java (rev 0) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/sanity/HeapEntry.java 2009-03-09 01:31:00 UTC (rev 15562) @@ -0,0 +1,137 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Common Public License (CPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/cpl1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ +package org.mmtk.harness.sanity; + +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +import org.mmtk.harness.vm.ObjectModel; +import org.vmmagic.unboxed.Address; +import org.vmmagic.unboxed.ObjectReference; + +/** + * An entry in the heap snapshot. + */ +public class HeapEntry implements Comparable<HeapEntry> { + /* Immutable fields */ + /** A reference to the object */ + private final ObjectReference object; + + /** */ + private final int id; + + /* Mutable fields */ + /** */ + private boolean rootReachable = false; + /** */ + private int refCount = 0; + + private Set<ObjectReference> referrers = new HashSet<ObjectReference>(); + + HeapEntry(ObjectReference object, int id) { + this.object = object; + this.id = id; + } + + /** + * Create an entry from an object reference - the constructor + * inspects the object for any fields it wants to record. + * @param object The object + */ + HeapEntry(ObjectReference object) { + this(object,ObjectModel.getId(object)); + } + + /** @return The ObjectReference */ + public ObjectReference getObject() { + return object; + } + + /** @return The object id */ + public int getId() { + return id; + } + + /** @return Is the object root reachable */ + public boolean isRootReachable() { + return rootReachable; + } + + /** @return the object reference count */ + public int getRefCount() { + return refCount; + } + + /** Increment the object reference count */ + public void incRefCount() { refCount++; } + + /** Set the object to be root reachable */ + public void setRootReachable() { this.rootReachable = true; } + + /** + * Register an incoming pointer + * @param referrer The object that points to this one + * + */ + public void addReferrer(ObjectReference referrer) { + referrers.add(referrer); + } + + /** @return the set of objects that point to this one */ + public Set<ObjectReference> getReferrers() { + return Collections.unmodifiableSet(referrers); + } + + /** Eclipse-generated hashcode based on object and id */ + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + id; + result = prime * result + ((object == null) ? 0 : object.hashCode()); + return result; + } + + /** Eclipse-generated equals */ + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + HeapEntry other = (HeapEntry) obj; + if (id != other.id) + return false; + if (!object.equals(other.object)) + return false; + return true; + } + + /** + * @see Comparable#compareTo(Object) + */ + @Override + public int compareTo(HeapEntry o) { + if (o == null) + return -1; + if (Integer.valueOf(id).compareTo(o.id) == 0) { + Address address = object.toAddress(); + Address oAddress = o.object.toAddress(); + return address.LT(oAddress) ? -1 : address.EQ(oAddress) ? 0 : 1; + } + return 1; + } +} Added: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/sanity/HeapSnapshot.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/sanity/HeapSnapshot.java (rev 0) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/sanity/HeapSnapshot.java 2009-03-09 01:31:00 UTC (rev 15562) @@ -0,0 +1,126 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Common Public License (CPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/cpl1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ +package org.mmtk.harness.sanity; + +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.TreeMap; +import java.util.TreeSet; + +import org.mmtk.policy.Space; +import org.vmmagic.unboxed.Address; +import org.vmmagic.unboxed.ObjectReference; + +/** + * A snapshot of the heap, taken by the harness without using core MMTk code. + */ +public class HeapSnapshot implements HeapVisitor { + + /** The objects in the heap, by address */ + private final Map<ObjectReference,HeapEntry> byAddress = new HashMap<ObjectReference,HeapEntry>(); + /** The objects in the heap, by ID */ + private final Map<Integer,Set<HeapEntry>> byId = new HashMap<Integer,Set<HeapEntry>>(); + /** Statistics: objects in each space */ + private final Map<String,Integer> spaceStats = new TreeMap<String,Integer>(); + /** Duplicate objects */ + private final Set<Set<HeapEntry>> duplicates = new HashSet<Set<HeapEntry>>(); + + /** @return the space statistics */ + public Map<String, Integer> getSpaceStats() { + return spaceStats; + } + + /** @return the number of objects in the heap */ + public int size() { + assert byAddress.size() == byId.size() : "Objects by address: "+byAddress.size()+", by id: "+byId.size(); + return byId.size(); + } + + /** @return the number of distinct object addresses in the heap */ + public int sizeByAddress() { + return byAddress.size(); + } + + /** @return the number of distinct objects in the heap */ + public int sizeById() { + return byId.size(); + } + + /** @return the set of live object IDs */ + public Set<Integer> getLive() { + return byId.keySet(); + } + + /** + * @return the set of duplicate objects (live objects that are pointed to + * at more than one address + */ + public Set<Set<HeapEntry>> getDuplicates() { + return Collections.unmodifiableSet(duplicates); + } + + /** + * Take a snapshot of the current heap + */ + public HeapSnapshot() { + Traversal.traverse(this); + } + + private void addEntryById(HeapEntry entry) { + Set<HeapEntry> entries = byId.get(entry.getId()); + if (entries == null) { + entries = new TreeSet<HeapEntry>(); + byId.put(entry.getId(), entries); + } else if (!entries.contains(entry)) { + duplicates.add(entries); + } + entries.add(entry); + } + + private void addSpaceStats(ObjectReference object) { + String name = Space.getSpaceForObject(object).getName(); + Integer count = spaceStats.get(name); + if (count == null) { + count = Integer.valueOf(0); + } + spaceStats.put(name, count+1); + } + + /** + * @see HeapVisitor#visitObject(ObjectReference, boolean, boolean) + */ + @Override + public void visitObject(ObjectReference object, boolean root, boolean marked) { + HeapEntry entry = byAddress.get(object); + if (!marked) { + assert entry == null; + entry = new HeapEntry(object); + byAddress.put(object, entry); + addEntryById(entry); + addSpaceStats(object); + } + if (root) entry.setRootReachable(); + entry.incRefCount(); + } + + /** + * @see HeapVisitor#visitPointer(ObjectReference, Address, ObjectReference) + */ + @Override + public void visitPointer(ObjectReference source, Address slot, ObjectReference target) { + // Do nothing + } +} Added: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/sanity/HeapVisitor.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/sanity/HeapVisitor.java (rev 0) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/sanity/HeapVisitor.java 2009-03-09 01:31:00 UTC (rev 15562) @@ -0,0 +1,37 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Common Public License (CPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/cpl1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ +package org.mmtk.harness.sanity; + +import org.vmmagic.unboxed.Address; +import org.vmmagic.unboxed.ObjectReference; + +/** + * Interface to visitor objects for the sanity traversal mechanism + */ +interface HeapVisitor { + /** + * Called once each time a heap object is reached + * @param object The live object + * @param root Was the referring pointer a root ? + * @param marked Was the object marked prior to this visit (ie is this a second or later visit) + */ + void visitObject(ObjectReference object, boolean root, boolean marked); + + /** + * Called once for every non-null pointer + * @param source Source object + * @param slot Slot in the source object + * @param target Target object + */ + void visitPointer(ObjectReference source, Address slot, ObjectReference target); +} Added: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/sanity/Sanity.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/sanity/Sanity.java (rev 0) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/sanity/Sanity.java 2009-03-09 01:31:00 UTC (rev 15562) @@ -0,0 +1,103 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Common Public License (CPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/cpl1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ +package org.mmtk.harness.sanity; + +import java.util.Map; +import java.util.Set; + +import org.mmtk.policy.Space; +import org.vmmagic.unboxed.ObjectReference; + + +/** + * Collection sanity checker for the MMTk Harness. + */ +public class Sanity { + + private static boolean VERBOSE = true; + + private HeapSnapshot before; + private HeapSnapshot after; + + /** Take a snapshot of the heap before collection */ + public void snapshotBefore() { + before = new HeapSnapshot(); + } + + /** Take a snapshot of the heap after collection */ + public void snapshotAfter() { + after = new HeapSnapshot(); + } + + /** + * Assert that the heap state is sane (immediately after a collection) + */ + public void assertSanity() { + if (VERBOSE) { + System.err.printf("Heap size by ID before: %d, after: %d%n", before.sizeById(), after.sizeById()); + System.err.printf("Heap size by Addr before: %d, after: %d%n", before.sizeByAddress(), after.sizeByAddress()); + } + + /* + * Assert that there are no duplicated objects, ie objects with the same + * object ID in more than one place. + */ + if (after.getDuplicates().size() > 0) { + for (Set<HeapEntry> aliasSet : after.getDuplicates()) { + HeapEntry first = aliasSet.iterator().next(); + boolean firstDup = true; + System.err.printf("### Object %s is duplicated in the heap: ",first.getId()); + for (HeapEntry entry : aliasSet) { + if (firstDup) { + firstDup = false; + } else { + System.err.printf(", "); + } + ObjectReference object = entry.getObject(); + System.err.printf("%s/%s",object,Space.getSpaceForObject(object).getName()); + } + System.err.printf("%n"); + } + } + + /* + * Assert that collection preserved the number of objects in the heap + */ + assert before.sizeById() == after.sizeById() : + "before : "+before.sizeById()+" objects, after: "+after.sizeById()+" objects"; + assert before.sizeByAddress() == after.sizeByAddress() : + "before : "+before.sizeByAddress()+" objects, after: "+after.sizeByAddress()+" objects"; + + /* + * Assert that the collection preserved the live set + */ + assert before.getLive().equals(after.getLive()); + if (VERBOSE) { + printSpaceStats("before", before); + printSpaceStats("after", after); + } + } + + + + private void printSpaceStats(String tag, HeapSnapshot snapshot) { + System.out.printf(tag+" "); + for (Map.Entry<String,Integer> statistic : snapshot.getSpaceStats().entrySet()) { + String name = statistic.getKey(); + int count = statistic.getValue(); + if (count > 0) + System.out.printf("%-8s:%6d ",name,count); + } + System.out.printf("%n"); + } +} Added: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/sanity/Traversal.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/sanity/Traversal.java (rev 0) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/sanity/Traversal.java 2009-03-09 01:31:00 UTC (rev 15562) @@ -0,0 +1,105 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Common Public License (CPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/cpl1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ +package org.mmtk.harness.sanity; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.mmtk.harness.Mutator; +import org.mmtk.harness.lang.runtime.ObjectValue; +import org.mmtk.harness.vm.ObjectModel; +import org.vmmagic.unboxed.Address; +import org.vmmagic.unboxed.ObjectReference; + +/** + * Perform a traversal of the heap, calling appropriate methods on + * the HeapVisitor object supplied. + */ +public final class Traversal { + + /** + * Traverse the heap. This is the only public method in the class + * @param visitor The heap visitor + */ + public static void traverse(HeapVisitor visitor) { + new Traversal(visitor); + } + + private final Set<ObjectReference> blackSet = new HashSet<ObjectReference>(); + private final List<ObjectReference> markStack = new ArrayList<ObjectReference>(); + private final HeapVisitor visitor; + + /** + * Perform the traversal. + * @param visitor + */ + private Traversal(HeapVisitor visitor) { + this.visitor = visitor; + traceRoots(); + doClosure(); + } + + /** + * Scan an object, calling the appropriate visitor method + * @param object + */ + private void scan(ObjectReference object) { + for (int i=0; i < ObjectModel.getRefs(object); i++) { + Address slot = ObjectModel.getRefSlot(object, i); + ObjectReference ref = slot.loadObjectReference(); + if (!ref.isNull()) { + visitor.visitPointer(object, slot, ref); + traceObject(ref,false); + } + } + } + + /** + * Trace an object, calling the appropriate visitor method + * @param object + * @param root + */ + private void traceObject(ObjectReference object, boolean root) { + if (object.isNull()) return; + boolean marked = blackSet.contains(object); + if (!marked) { + blackSet.add(object); + markStack.add(object); + } + visitor.visitObject(object, root, marked); + } + + /** + * Trace the harness root set + */ + private void traceRoots() { + for (Mutator m : Mutator.getMutators()) { + for (ObjectValue value : m.getRoots()) { + traceObject(value.getObjectValue(), true); + } + } + } + + /** + * Iterate over the heap depth-first, scanning objects until + * the mark stack is empty. + */ + private void doClosure() { + while (markStack.size() > 0) { + ObjectReference object = markStack.remove(markStack.size()-1); + scan(object); + } + } +} Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/Phase.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/Phase.java 2009-03-08 22:51:56 UTC (rev 15561) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/Phase.java 2009-03-09 01:31:00 UTC (rev 15562) @@ -414,14 +414,20 @@ /* Global phase */ case SCHEDULE_GLOBAL: { if (logDetails) Log.writeln(" as Global..."); - if (primary) plan.collectionPhase(phaseId); + if (primary) { + if (VM.DEBUG) VM.debugging.globalPhase(phaseId,true); + plan.collectionPhase(phaseId); + if (VM.DEBUG) VM.debugging.globalPhase(phaseId,false); + } break; } /* Collector phase */ case SCHEDULE_COLLECTOR: { if (logDetails) Log.writeln(" as Collector..."); + if (VM.DEBUG) VM.debugging.collectorPhase(phaseId,order,true); collector.collectionPhase(phaseId, primary); + if (VM.DEBUG) VM.debugging.collectorPhase(phaseId,order,false); break; } @@ -431,7 +437,9 @@ /* Iterate through all mutator contexts */ MutatorContext mutator; while ((mutator = VM.activePlan.getNextMutator()) != null) { + if (VM.DEBUG) VM.debugging.mutatorPhase(phaseId,mutator.getId(),true); mutator.collectionPhase(phaseId, primary); + if (VM.DEBUG) VM.debugging.mutatorPhase(phaseId,mutator.getId(),false); } break; } Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/GenNurseryTraceLocal.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/GenNurseryTraceLocal.java 2009-03-08 22:51:56 UTC (rev 15561) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/GenNurseryTraceLocal.java 2009-03-09 01:31:00 UTC (rev 15562) @@ -94,12 +94,14 @@ logMessage(5, "processing modbuf"); ObjectReference obj; while (!(obj = modbuf.pop()).isNull()) { + if (VM.DEBUG) VM.debugging.modbufEntry(obj); Plan.markAsUnlogged(obj); scanObject(obj); } logMessage(5, "processing remset"); while (!remset.isEmpty()) { Address loc = remset.pop(); + if (VM.DEBUG) VM.debugging.remsetEntry(loc); processRootEdge(loc, false); } logMessage(5, "processing array remset"); @@ -107,6 +109,7 @@ while (!arrayRemset.isEmpty()) { Address start = arrayRemset.pop1(); Address guard = arrayRemset.pop2(); + if (VM.DEBUG) VM.debugging.arrayRemsetEntry(start,guard); while (start.LT(guard)) { processRootEdge(start, false); start = start.plus(BYTES_IN_ADDRESS); Modified: rvmroot/trunk/MMTk/src/org/mmtk/policy/CopySpace.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/policy/CopySpace.java 2009-03-08 22:51:56 UTC (rev 15561) +++ rvmroot/trunk/MMTk/src/org/mmtk/policy/CopySpace.java 2009-03-09 01:31:00 UTC (rev 15562) @@ -15,7 +15,9 @@ import... [truncated message content] |
From: <rg...@us...> - 2009-03-09 06:29:06
|
Revision: 15567 http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=15567&view=rev Author: rgarner Date: 2009-03-09 06:28:55 +0000 (Mon, 09 Mar 2009) Log Message: ----------- Rudimentary type system for the MMTk harness scripting language. Some new scripts that exploit the new features, plus some follow-up changes for issues revealed by the new scripts. Modified Paths: -------------- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Debug.java rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ObjectModel.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Collector.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Harness.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Main.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Checker.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Compiler.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Declaration.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Intrinsics.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/PrettyPrinter.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Visitor.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/AST.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/AbstractAST.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Alloc.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Assert.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Assignment.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/BinaryExpression.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Call.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Constant.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Empty.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Expect.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/IfStatement.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/IntrinsicMethod.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/LoadField.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Method.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/MethodProxy.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/NormalMethod.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Operator.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/PrintStatement.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Return.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Sequence.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Spawn.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/StoreField.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/UnaryExpression.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Variable.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/WhileStatement.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/compiler/Register.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/compiler/Temporary.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/parser/MethodTable.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/parser/Source.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/parser/Symbol.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/parser/SymbolTable.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/BinaryOperation.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/LoadFieldOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/PseudoOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/StoreFieldOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/runtime/BoolValue.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/runtime/ConstantPool.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/runtime/IntValue.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/runtime/ObjectValue.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/runtime/StackFrame.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/runtime/StringValue.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/runtime/Value.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/Scheduler.java rvmroot/trunk/MMTk/harness/src-generated/org/mmtk/harness/lang/parser/Parser.jj rvmroot/trunk/MMTk/harness/test-scripts/Alignment.script rvmroot/trunk/MMTk/harness/test-scripts/CyclicGarbage.script rvmroot/trunk/MMTk/harness/test-scripts/HashCode.script rvmroot/trunk/MMTk/harness/test-scripts/LargeObject.script rvmroot/trunk/MMTk/harness/test-scripts/OutOfMemory.script rvmroot/trunk/MMTk/harness/test-scripts/Quicksort.script rvmroot/trunk/MMTk/harness/test-scripts/Spawn.script rvmroot/trunk/MMTk/harness/test-scripts/SpreadAlloc.script Added Paths: ----------- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/CheckerException.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/AllocUserType.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/LoadNamedField.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/StoreNamedField.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/parser/GlobalDefs.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/parser/TypeTable.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/AllocUserOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/LoadFixedFieldOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/StoreFixedFieldOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/runtime/NullValue.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/type/ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/type/AbstractType.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/type/BooleanType.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/type/Field.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/type/IntType.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/type/ObjectType.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/type/StringType.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/type/Type.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/type/TypeReference.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/type/UserType.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/type/UserTypeImpl.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/type/VoidType.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/Timeout.java rvmroot/trunk/MMTk/harness/test-scripts/FixedLive.options rvmroot/trunk/MMTk/harness/test-scripts/FixedLive.script rvmroot/trunk/MMTk/harness/test-scripts/Lists.options rvmroot/trunk/MMTk/harness/test-scripts/Lists.script rvmroot/trunk/MMTk/harness/test-scripts/lang/type1.script Removed Paths: ------------- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Type.java Modified: rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Debug.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Debug.java 2009-03-09 05:49:26 UTC (rev 15566) +++ rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Debug.java 2009-03-09 06:28:55 UTC (rev 15567) @@ -40,7 +40,7 @@ } private String format(Address addr) { - return format(addr.toObjectReference()); + return ObjectModel.addressAndSpaceString(addr); } /** @@ -48,7 +48,7 @@ */ @Override public void arrayRemsetEntry(Address start, Address guard) { - Trace.printf(Item.COLLECT, "arrayRemset: [%s,%s)", start, guard); + Trace.trace(Item.COLLECT, "arrayRemset: [%s,%s)", start, guard); } /** @@ -56,7 +56,7 @@ */ @Override public void modbufEntry(ObjectReference object) { - Trace.printf(Item.COLLECT, "modbuf: %s", format(object)); + Trace.trace(Item.COLLECT, "modbuf: %s", format(object)); } /** @@ -64,7 +64,7 @@ */ @Override public void remsetEntry(Address slot) { - Trace.printf(Item.COLLECT, "remset: %s->%s", format(slot), format(slot.loadAddress())); + Trace.trace(Item.COLLECT, "remset: %s->%s", format(slot), format(slot.loadObjectReference())); } /** Modified: rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ObjectModel.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ObjectModel.java 2009-03-09 05:49:26 UTC (rev 15566) +++ rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ObjectModel.java 2009-03-09 06:28:55 UTC (rev 15567) @@ -756,7 +756,16 @@ * @param ref The object * @return "address/space" */ - private static String addressAndSpaceString(ObjectReference ref) { + public static String addressAndSpaceString(ObjectReference ref) { return String.format("%s/%s",ref, Space.getSpaceForObject(ref).getName()); } + + /** + * Address and space name (eg 0x45678900/ms) + * @param ref The object + * @return "address/space" + */ + public static String addressAndSpaceString(Address addr) { + return addressAndSpaceString(addr.toObjectReference()); + } } Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Collector.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Collector.java 2009-03-09 05:49:26 UTC (rev 15566) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Collector.java 2009-03-09 06:28:55 UTC (rev 15567) @@ -33,13 +33,15 @@ /** * Get a collector by id. + * @param id The ID of the collector + * @return The collector */ public static Collector get(int id) { return collectors.get(id); } /** - * Get the currently executing collector. + * @return the currently executing collector. */ public static Collector current() { Collector c = Scheduler.currentCollector(); @@ -48,14 +50,15 @@ } /** - * The number of collector threads that have been created. + * @return The number of collector threads that have been created. */ public static int count() { return collectors.size(); } /** - * Register a collector thread, returning the allocated id. + * Register a collector thread + * @return the allocated id. */ public static synchronized int allocateCollectorId() { int id = collectors.size(); @@ -65,6 +68,7 @@ /** * Initialise numCollector collector threads. + * @param numCollectors # collectors */ public static void init(int numCollectors) { for(int i = 0; i < numCollectors; i++) { @@ -101,6 +105,9 @@ /** The number of collections that have occurred */ private static int collectionCount; + /** + * @return The number of GCs commenced so far + */ public static int getCollectionCount() { return collectionCount; } @@ -108,6 +115,9 @@ /** The current base count of collection attempts */ private static int collectionAttemptBase; + /** + * @return The current base count of collection attempts + */ public static int getCollectionAttemptBase() { return collectionAttemptBase; } @@ -124,13 +134,14 @@ /** * Trigger a collection for the given reason + * @param why Reason (as defined by MMTk VM interface) */ public static void triggerGC(int why) { Scheduler.triggerGC(why); } /** - * Return the MMTk CollectorContext for this collector. + * @return the MMTk CollectorContext for this collector. */ public CollectorContext getContext() { return context; @@ -139,6 +150,8 @@ /** * Rendezvous with all other processors, returning the rank * (that is, the order this processor arrived at the barrier). + * @param where An identifier for the rendezvous point + * @return The order of arrival */ public static int rendezvous(int where) { return Scheduler.rendezvous(where); @@ -167,14 +180,84 @@ } /** + * A timeout thread. Exit the harness if it isn't cancelled in time. + */ + private static final class TimeoutThread implements Runnable { + private static final boolean VERBOSE = false; + private static final int MILLIS_PER_SECOND = 1000; + private final long timeout; + private boolean cancelled = false; + private volatile boolean started = false; + + /** + * Create a timeout object and start it running in its own + * thread. + * @param seconds Timeout in seconds + */ + private TimeoutThread(int seconds) { + this.timeout = seconds * MILLIS_PER_SECOND; + new Thread(this).start(); + synchronized (this) { + while (!started) { + try { + wait(); + } catch (InterruptedException e) { + } + } + } + } + + /** + * @see java.lang.Thread#run() + */ + @Override + public void run() { + long startTime = System.currentTimeMillis(); + synchronized (this) { + while (!cancelled) { + try { + started = true; + notify(); + long now = System.currentTimeMillis(); + if (now - startTime >= timeout) { + System.err.printf("Collection exceeded timeout %dms%n",timeout); + System.exit(1); + } + long sleepTime = Math.max(1,timeout - (now - startTime)); + if (VERBOSE) { + System.err.printf("Collection timeout: sleeping for %dms%n",sleepTime); + } + wait(sleepTime); + } catch (InterruptedException e) { + // Ignore interruptions + } + } + } + } + + /** Cancel the timeout */ + public void cancel() { + synchronized (this) { + if (VERBOSE) { + System.err.printf("Collection timeout: cancelled%n"); + } + cancelled = true; + notify(); + } + } + } + + /** * Perform a GC */ private void collect() { boolean primary = context.getId() == 0; Sanity sanity = new Sanity(); + TimeoutThread timeout = null; if (primary) { Plan.setCollectionTrigger(Scheduler.getTriggerReason()); sanity.snapshotBefore(); + timeout = new TimeoutThread(Harness.timeout.getValue()); } long startTime = System.nanoTime(); @@ -249,6 +332,7 @@ rendezvous(5202); if (primary) { Plan.collectionComplete(); + timeout.cancel(); } } Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Harness.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Harness.java 2009-03-09 05:49:26 UTC (rev 15566) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Harness.java 2009-03-09 06:28:55 UTC (rev 15567) @@ -73,6 +73,9 @@ /** Print yield policy statistics on exit */ public static final PolicyStats policyStats = new PolicyStats(); + /** Timeout on unreasonably long GC */ + public static final Timeout timeout = new Timeout(); + private static boolean isInitialized = false; /** Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Main.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Main.java 2009-03-09 05:49:26 UTC (rev 15566) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Main.java 2009-03-09 06:28:55 UTC (rev 15567) @@ -16,12 +16,16 @@ import java.io.FileNotFoundException; import org.mmtk.harness.lang.Checker; +import org.mmtk.harness.lang.CheckerException; import org.mmtk.harness.lang.Compiler; import org.mmtk.harness.lang.parser.MethodTable; import org.mmtk.harness.lang.parser.Parser; import org.mmtk.harness.lang.parser.ParseException; import org.mmtk.harness.scheduler.Scheduler; +/** + * Main class for the MMTk debugging harness. + */ public class Main { public static void main(String[] args) throws InterruptedException, ParseException, FileNotFoundException { /* Usage */ @@ -43,14 +47,22 @@ scriptFile += ".script"; } + /* Compile the script */ final MethodTable methods = new Parser(scriptFile).script(); - /* Type-check the script */ - Checker.typeCheck(methods); + try { + /* Type-check the script */ + Checker.typeCheck(methods); + } catch (CheckerException e) { + System.err.println(e.getMessage()); + System.err.println("Exiting due to type-checker exceptions"); + return; + } - + /* Schedule a thread to run the script */ Scheduler.scheduleMutator(Compiler.compile(methods)); + /* Start the thread scheduler */ Scheduler.schedule(); } } Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Checker.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Checker.java 2009-03-09 05:49:26 UTC (rev 15566) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Checker.java 2009-03-09 06:28:55 UTC (rev 15567) @@ -19,6 +19,7 @@ import org.mmtk.harness.lang.Trace.Item; import org.mmtk.harness.lang.ast.AST; import org.mmtk.harness.lang.ast.Alloc; +import org.mmtk.harness.lang.ast.AllocUserType; import org.mmtk.harness.lang.ast.Assert; import org.mmtk.harness.lang.ast.Assignment; import org.mmtk.harness.lang.ast.BinaryExpression; @@ -29,6 +30,7 @@ import org.mmtk.harness.lang.ast.Expression; import org.mmtk.harness.lang.ast.IfStatement; import org.mmtk.harness.lang.ast.LoadField; +import org.mmtk.harness.lang.ast.LoadNamedField; import org.mmtk.harness.lang.ast.Method; import org.mmtk.harness.lang.ast.NormalMethod; import org.mmtk.harness.lang.ast.Operator; @@ -38,11 +40,14 @@ import org.mmtk.harness.lang.ast.Spawn; import org.mmtk.harness.lang.ast.Statement; import org.mmtk.harness.lang.ast.StoreField; -import org.mmtk.harness.lang.ast.Type; +import org.mmtk.harness.lang.ast.StoreNamedField; import org.mmtk.harness.lang.ast.UnaryExpression; import org.mmtk.harness.lang.ast.Variable; import org.mmtk.harness.lang.ast.WhileStatement; import org.mmtk.harness.lang.parser.MethodTable; +import org.mmtk.harness.lang.type.Field; +import org.mmtk.harness.lang.type.Type; +import org.mmtk.harness.lang.type.UserType; /** * A type-checker visitor for MMTk scripts @@ -61,11 +66,6 @@ } /** - * The type of the most recently visited expression. - */ - private Type type; - - /** * The type of the current method */ private Type returnType; @@ -76,17 +76,12 @@ private boolean[] isInitialized; /** - * @return The type of the most recently visited expression. - */ - public Type getType() { return type; } - - /** * Visit an expression and return its type. * @param expr * @return */ private Type getTypeOf(Expression expr) { - expr.accept(this); + Type type = (Type)expr.accept(this); Trace.trace(Item.CHECKER,"Type of %s is %s%n",PrettyPrinter.format(expr),type.toString()); return type; } @@ -99,7 +94,7 @@ * @return */ private boolean checkType(Expression expr, Type...types) { - getTypeOf(expr); + Type type = getTypeOf(expr); for (Type t : types) { if (type == t) { return true; @@ -113,10 +108,11 @@ * @param ast * @param message */ - private static void fail(AST ast, String message) { - System.err.printf("Error at line %d: %s%n",ast.getLine(),message); + private static void fail(AST ast, String message, Object...params) { + String fullMessage = String.format(message,params); + System.err.printf("Error at line %d: %s%n",ast.getLine(),fullMessage); PrettyPrinter.print(System.err, ast); System.err.println(); - throw new RuntimeException(message); + throw new CheckerException(fullMessage); } private void checkParams(AST marker, List<Type> actualTypes, List<Type> formalTypes) { @@ -138,7 +134,7 @@ @Override - public void visit(Alloc alloc) { + public Object visit(Alloc alloc) { if (!checkType(alloc.getRefCount(),Type.INT)) { fail(alloc,"Allocation reference count must be integer"); } @@ -148,25 +144,33 @@ if (!checkType(alloc.getDoubleAlign(),Type.BOOLEAN)) { fail(alloc,"Allocation double align must be boolean"); } - type = Type.OBJECT; + return Type.OBJECT; } @Override - public void visit(Assert ass) { + public Object visit(AllocUserType alloc) { + if (!alloc.getType().isObject() || alloc.getType() == Type.OBJECT) { + fail(alloc,"Can't allocate a %s using alloc(type)",alloc.getType().toString()); + } + return alloc.getType(); + } + + @Override + public Object visit(Assert ass) { checkType(ass.getPredicate(),Type.BOOLEAN); - type = Type.VOID; + return Type.VOID; } @Override - public void visit(Assignment a) { + public Object visit(Assignment a) { isInitialized[a.getSlot()] = true; Type lhsType = a.getSymbol().getType(); checkType(a.getRhs(),lhsType); - type = Type.VOID; + return Type.VOID; } @Override - public void visit(BinaryExpression exp) { + public Object visit(BinaryExpression exp) { Type lhsType = getTypeOf(exp.getLhs()); Type rhsType = getTypeOf(exp.getRhs()); Operator op = exp.getOperator(); @@ -174,9 +178,11 @@ if (lhsType != rhsType) { // Allow boolean/object comparisons if (op == Operator.EQ || op == Operator.NE) { - if ((lhsType == Type.BOOLEAN && rhsType == Type.OBJECT) || - (lhsType == Type.OBJECT && rhsType == Type.BOOLEAN)) { + if ((lhsType == Type.BOOLEAN && rhsType.isObject()) || + (lhsType.isObject() && rhsType == Type.BOOLEAN)) { ok = true; + } else if (lhsType.isObject() && rhsType.isObject()){ + ok = true; } else { ok = false; } @@ -184,18 +190,18 @@ ok = false; } if (!ok) { - fail(exp,"Type mismatch"); + fail(exp,"Type mismatch between "+lhsType+" and "+rhsType); } } if (Operator.booleanOperators.contains(op)) { - type = Type.BOOLEAN; + return Type.BOOLEAN; } else { - type = lhsType; + return lhsType; } } @Override - public void visit(Call call) { + public Object visit(Call call) { Method m = call.getMethod(); if (call.getParams().size() != m.getParamCount()) { fail(call,"Wrong number of parameters"); @@ -204,34 +210,32 @@ List<Type> actualTypes = new ArrayList<Type>(); /* Type-check the actual parameter expressions */ for (Expression param : call.getParams()) { - param.accept(this); - actualTypes.add(type); + actualTypes.add(getTypeOf(param)); } checkParams(call, actualTypes, m.getParamTypes()); if (call.isExpression()) { - type = call.getMethod().getReturnType(); - } else { - type = Type.VOID; + return call.getMethod().getReturnType(); } + return Type.VOID; } @Override - public void visit(Constant c) { - type = c.value.type(); + public Object visit(Constant c) { + return c.value.type(); } @Override - public void visit(Empty e) { - type = Type.VOID; + public Object visit(Empty e) { + return Type.VOID; } @Override - public void visit(Expect exc) { - type = Type.VOID; + public Object visit(Expect exc) { + return Type.VOID; } @Override - public void visit(IfStatement conditional) { + public Object visit(IfStatement conditional) { for (Expression e : conditional.getConds()) { if (!checkType(e,Type.BOOLEAN)) { fail(e,"Conditional must have type BOOLEAN"); @@ -240,38 +244,51 @@ for (Statement s : conditional.getStmts()) { s.accept(this); } - type = Type.VOID; + return Type.VOID; } @Override - public void visit(LoadField load) { + public Object visit(LoadField load) { if (load.getObjectSymbol().getType() != Type.OBJECT) { fail(load,"Target of loadfield must be an Object"); } - load.getIndex().accept(this); - if (type != Type.INT) { + if (getTypeOf(load.getIndex()) != Type.INT) { fail(load,"Loadfield index must have type INTEGER"); } - type = load.getFieldType(); + return load.getFieldType(); } @Override - public void visit(NormalMethod method) { + public Object visit(LoadNamedField load) { + Type t = load.getObjectSymbol().getType(); + if (!t.isObject()) { + fail(load,"Target of loadfield must be an Object type"); + } + UserType objectType = (UserType)t; + Field field = objectType.getField(load.getFieldName()); + if (field == null) { + fail(load,"Type %s does not have a field called %s",t,load.getFieldName()); + } + return field.getType(); + } + + @Override + public Object visit(NormalMethod method) { isInitialized = new boolean[method.getDecls().size()]; for (Declaration decl : method.getParams()) { isInitialized[decl.getSlot()] = true; } returnType = method.getReturnType(); method.getBody().accept(this); - type = returnType; + return returnType; } @Override - public void visit(PrintStatement print) { + public Object visit(PrintStatement print) { for (Expression exp : print.getArgs()) { exp.accept(this); } - type = Type.VOID; + return Type.VOID; } /** @@ -281,22 +298,22 @@ * declared type of the method */ @Override - public void visit(Return ret) { + public Object visit(Return ret) { if (ret.hasReturnValue()) { - ret.getRhs().accept(this); + Type type = getTypeOf(ret.getRhs()); if (!returnType.isCompatibleWith(type)) { fail(ret,"Returning a "+type+" in a method declared as "+returnType); } + return type; } else if (returnType != Type.VOID) { - fail(ret,"Returning from a non-void method requires a return value"); - } else { - type = Type.VOID; + fail(ret,"Returning from a non-Object method requires a return value"); } + return Type.VOID; } @Override - public void visit(Sequence ass) { - super.visit(ass); + public Object visit(Sequence seq) { + return super.visit(seq); } /** @@ -305,55 +322,78 @@ * - Actual parameters against method formal parameters */ @Override - public void visit(Spawn sp) { + public Object visit(Spawn sp) { List<Type> actualTypes = new ArrayList<Type>(); for (Expression expr : sp.getArgs()) { - expr.accept(this); - actualTypes.add(type); + actualTypes.add(getTypeOf(expr)); } checkParams(sp, actualTypes, sp.getMethod().getParamTypes()); - type = Type.VOID; + return Type.VOID; } @Override - public void visit(StoreField store) { + public Object visit(StoreField store) { if (store.getObjectSymbol().getType() != Type.OBJECT) { fail(store,"Target of storefield must be an Object"); } if (getTypeOf(store.getIndex()) != Type.INT) { fail(store,"Storefield index must have type INTEGER"); } - if (getTypeOf(store.getRhs()) != store.getFieldType()) { - fail(store,"Storefield to a "+store.getFieldType()+" must have type "+store.getFieldType()); + Type rhsType = getTypeOf(store.getRhs()); + Type fieldType = store.getFieldType(); + if (!fieldType.isCompatibleWith(rhsType)) { + fail(store,"Storefield to a "+fieldType+" must have type "+fieldType+", not "+rhsType); } - type = Type.VOID; + return Type.VOID; } @Override - public void visit(UnaryExpression exp) { + public Object visit(StoreNamedField store) { + assert store.getObjectSymbol() != null; + assert store.getObjectSymbol().getType() != null; + Type t = store.getObjectSymbol().getType(); + if (!t.isObject()) { + fail(store,"Target of storefield.name (%s) must be an object type, not %s", + store.getObjectSymbol().getName(),t.getName()); + } + UserType objectType = (UserType)t; + Field field = objectType.getField(store.getFieldName()); + if (field == null) { + fail(store,"The type "+objectType+" does not have a field called "+store.getFieldName()); + } + Type fieldType = field.getType(); + if (!fieldType.isCompatibleWith(getTypeOf(store.getRhs()))) { + fail(store,"Storefield to a "+fieldType+" must have type "+fieldType); + } + return Type.VOID; + } + + @Override + public Object visit(UnaryExpression exp) { /* Unary operators preserve type */ - exp.getOperand().accept(this); + Type type = getTypeOf(exp.getOperand()); /* With this one exception ... */ if (exp.getOperator() == Operator.NOT && type == Type.OBJECT) { - type = Type.BOOLEAN; + return Type.BOOLEAN; } + return type; } @Override - public void visit(Variable var) { + public Object visit(Variable var) { if (!isInitialized[var.getSlot()]) { fail(var,"Variable "+var.getSymbol().getName()+" is not initialized before use"); } - type = var.getSymbol().getType(); + return var.getSymbol().getType(); } @Override - public void visit(WhileStatement w) { + public Object visit(WhileStatement w) { if (!checkType(w.getCond(),Type.BOOLEAN,Type.OBJECT)) { fail(w,"While condition must have type BOOLEAN"); } w.getBody().accept(this); - type = Type.VOID; + return Type.VOID; } } Added: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/CheckerException.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/CheckerException.java (rev 0) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/CheckerException.java 2009-03-09 06:28:55 UTC (rev 15567) @@ -0,0 +1,39 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Common Public License (CPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/cpl1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ +package org.mmtk.harness.lang; + +public class CheckerException extends RuntimeException { + + public CheckerException() { + super(); + } + + public CheckerException(String message, Throwable cause) { + super(message, cause); + } + + public CheckerException(String message) { + super(message); + } + + public CheckerException(Throwable cause) { + super(cause); + } + + + /** + * + */ + private static final long serialVersionUID = 1L; + +} Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Compiler.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Compiler.java 2009-03-09 05:49:26 UTC (rev 15566) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Compiler.java 2009-03-09 06:28:55 UTC (rev 15567) @@ -17,7 +17,10 @@ import java.util.List; import org.mmtk.harness.Harness; +import org.mmtk.harness.lang.Trace.Item; +import org.mmtk.harness.lang.ast.AST; import org.mmtk.harness.lang.ast.Alloc; +import org.mmtk.harness.lang.ast.AllocUserType; import org.mmtk.harness.lang.ast.Assert; import org.mmtk.harness.lang.ast.Assignment; import org.mmtk.harness.lang.ast.BinaryExpression; @@ -29,6 +32,7 @@ import org.mmtk.harness.lang.ast.IfStatement; import org.mmtk.harness.lang.ast.IntrinsicMethod; import org.mmtk.harness.lang.ast.LoadField; +import org.mmtk.harness.lang.ast.LoadNamedField; import org.mmtk.harness.lang.ast.Method; import org.mmtk.harness.lang.ast.NormalMethod; import org.mmtk.harness.lang.ast.PrintStatement; @@ -37,7 +41,7 @@ import org.mmtk.harness.lang.ast.Statement; import org.mmtk.harness.lang.ast.Spawn; import org.mmtk.harness.lang.ast.StoreField; -import org.mmtk.harness.lang.ast.Type; +import org.mmtk.harness.lang.ast.StoreNamedField; import org.mmtk.harness.lang.ast.UnaryExpression; import org.mmtk.harness.lang.ast.Variable; import org.mmtk.harness.lang.ast.WhileStatement; @@ -48,6 +52,7 @@ import org.mmtk.harness.lang.compiler.Temporary; import org.mmtk.harness.lang.parser.MethodTable; import org.mmtk.harness.lang.pcode.AllocOp; +import org.mmtk.harness.lang.pcode.AllocUserOp; import org.mmtk.harness.lang.pcode.BinaryOperation; import org.mmtk.harness.lang.pcode.Branch; import org.mmtk.harness.lang.pcode.CallIntrinsicOp; @@ -56,14 +61,19 @@ import org.mmtk.harness.lang.pcode.ExpectOp; import org.mmtk.harness.lang.pcode.Goto; import org.mmtk.harness.lang.pcode.LoadFieldOp; +import org.mmtk.harness.lang.pcode.LoadFixedFieldOp; import org.mmtk.harness.lang.pcode.PrintOp; import org.mmtk.harness.lang.pcode.PseudoOp; import org.mmtk.harness.lang.pcode.ReturnOp; import org.mmtk.harness.lang.pcode.SpawnOp; import org.mmtk.harness.lang.pcode.StoreFieldOp; +import org.mmtk.harness.lang.pcode.StoreFixedFieldOp; import org.mmtk.harness.lang.pcode.StoreLocal; import org.mmtk.harness.lang.pcode.UnaryOperation; import org.mmtk.harness.lang.runtime.ConstantPool; +import org.mmtk.harness.lang.type.Field; +import org.mmtk.harness.lang.type.Type; +import org.mmtk.harness.lang.type.UserType; public final class Compiler extends Visitor { @@ -75,7 +85,6 @@ private final CompiledMethod current; private final CompiledMethodTable methodTable; private final Temporary temps; - private final UnsyncStack<Register> operands = new UnsyncStack<Register>(); private Compiler(NormalMethod method, CompiledMethodTable table) { this.current = new CompiledMethod(method); @@ -109,6 +118,7 @@ } private void emit(PseudoOp op) { + Trace.trace(Item.COMPILER, "emitting %s", op); current.append(op); } @@ -125,8 +135,7 @@ private List<Register> compileArgList(List<Expression> args) { ArrayList<Register> actuals = new ArrayList<Register>(args.size()); for (Expression exp : args) { - exp.accept(this); - actuals.add(operands.pop()); + actuals.add(compile(exp)); } return actuals; } @@ -139,64 +148,73 @@ return compiledMethod; } + /** + * Visit a node and return its result as a Register + * @param ast + * @return + */ + private Register compile(AST ast) { + return (Register)ast.accept(this); + } @Override - public void visit(Alloc alloc) { - alloc.getDataCount().accept(this); - Register dataCount = operands.pop(); - alloc.getRefCount().accept(this); - Register refCount = operands.pop(); - alloc.getDoubleAlign().accept(this); - Register doubleAlign = operands.pop(); + public Object visit(Alloc alloc) { + Register dataCount = compile(alloc.getDataCount()); + Register refCount = compile(alloc.getRefCount()); + Register doubleAlign = compile(alloc.getDoubleAlign()); Register result = temps.acquire(); emit(new AllocOp(alloc,result,dataCount,refCount,doubleAlign,alloc.getSite())); - operands.push(result); temps.release(dataCount,refCount,doubleAlign); + return result; } @Override - public void visit(Assert ass) { - ass.getPredicate().accept(this); // Compile the predicate - Register predicate = operands.pop(); + public Object visit(AllocUserType alloc) { + UserType type = (UserType)alloc.getType(); + Register result = temps.acquire(); + emit(new AllocUserOp(alloc,result,type,false,alloc.getSite())); + return result; + } + + @Override + public Object visit(Assert ass) { + Register predicate = compile(ass.getPredicate()); Branch branch = new Branch(ass,predicate,true); emit(branch); temps.release(predicate); ArrayList<Register> actuals = new ArrayList<Register>(ass.getOutputs().size()); for (Expression expr : ass.getOutputs()) { - expr.accept(this); - actuals.add(operands.pop()); + actuals.add(compile(expr)); } emit(new PrintOp(ass,actuals.toArray(new Register[0]))); freeTemps(actuals); emit(new ExitOp(ass,ConstantPool.ONE)); branch.setBranchTarget(currentPc()); + return null; } @Override - public void visit(Assignment a) { - a.getRhs().accept(this); - Register rhs = operands.pop(); + public Object visit(Assignment a) { + Trace.trace(Item.COMPILER, "Compiling %s", PrettyPrinter.format(a)); + Register rhs = compile(a.getRhs()); emit(new StoreLocal(a,Register.createLocal(a.getSlot()),rhs)); temps.release(rhs); + return null; } @Override - public void visit(BinaryExpression exp) { - exp.getLhs().accept(this); - Register lhs = operands.pop(); - exp.getRhs().accept(this); - Register rhs = operands.pop(); + public Object visit(BinaryExpression exp) { + Register lhs = compile(exp.getLhs()); + Register rhs = compile(exp.getRhs()); Register result = temps.acquire(); emit(new BinaryOperation(exp,result,lhs,rhs,exp.getOperator())); temps.release(rhs,lhs); - operands.push(result); + return result; } @Override - public void visit(Call call) { + public Object visit(Call call) { Method method = call.getMethod(); - - List<Register> actuals = compileArgList(call.getParams()); Register returnVal = method.getReturnType() == Type.VOID ? Register.NULL : temps.acquire(); @@ -210,8 +228,7 @@ throw new RuntimeException("Unknown method class "+method.getClass().getCanonicalName()); } freeTemps(actuals); - if (returnVal != Register.NULL) - operands.push(returnVal); + return returnVal; } /** @@ -219,29 +236,29 @@ * global constant pool */ @Override - public void visit(Constant c) { - operands.push(ConstantPool.acquire(c.value)); + public Object visit(Constant c) { + return ConstantPool.acquire(c.value); } @Override - public void visit(Empty e) { - // Do nothing + public Object visit(Empty e) { + return null; } @Override - public void visit(Expect exp) { + public Object visit(Expect exp) { emit(new ExpectOp(exp,exp.getExpected())); + return null; } @Override - public void visit(IfStatement conditional) { + public Object visit(IfStatement conditional) { Iterator<Statement> stmtIter = conditional.getStmts().iterator(); Branch branch = new Branch(conditional,Register.NULL,false); Goto gotoExit = new Goto(conditional); for (Expression cond : conditional.getConds()) { branch.setBranchTarget(currentPc()); - cond.accept(this); - Register conditionReg = operands.pop(); + Register conditionReg = compile(cond); branch = new Branch(conditional,conditionReg,false); temps.release(conditionReg); emit(branch); @@ -253,87 +270,115 @@ stmtIter.next().accept(this); } gotoExit.setBranchTarget(currentPc()); + return null; } @Override - public void visit(IntrinsicMethod method) { + public Object visit(IntrinsicMethod method) { throw new RuntimeException("You can't compile an intrinsic method!!!"); } @Override - public void visit(LoadField load) { - load.getIndex().accept(this); - Register index = operands.pop(); + public Object visit(LoadField load) { + Register index = compile(load.getIndex()); Register object = Register.createLocal(load.getSlot()); Register result = temps.acquire(); emit(new LoadFieldOp(load,result,object,index,load.getFieldType())); temps.release(index); - operands.push(result); + return result; } @Override - public void visit(NormalMethod method) { - method.getBody().accept(this); + public Object visit(LoadNamedField load) { + UserType type = (UserType)load.getObjectSymbol().getType(); + Field field = type.getField(load.getFieldName()); + Register object = Register.createLocal(load.getSlot()); + Register result = temps.acquire(); + emit(new LoadFixedFieldOp(load,result,object,field.getOffset(), + load.getFieldName(), + field.getType().isObject() ? Type.OBJECT : Type.INT)); + return result; + } + + @Override + public Object visit(NormalMethod method) { + compile(method.getBody()); emit(new ReturnOp(method)); + return null; } @Override - public void visit(PrintStatement print) { + public Object visit(PrintStatement print) { List<Expression> args = print.getArgs(); List<Register> actuals = compileArgList(args); emit(new PrintOp(print,actuals)); freeTemps(actuals); + return null; } @Override - public void visit(Return ret) { + public Object visit(Return ret) { if (ret.hasReturnValue()) { - ret.getRhs().accept(this); - emit(new ReturnOp(ret,operands.pop())); + emit(new ReturnOp(ret,compile(ret.getRhs()))); } else { emit(new ReturnOp(ret)); } + return null; } @Override - public void visit(Sequence ass) { + public Object visit(Sequence ass) { for (Statement stmt : ass) { - stmt.accept(this); + compile(stmt); } + return null; } @Override - public void visit(Spawn sp) { + public Object visit(Spawn sp) { List<Register> actuals = compileArgList(sp.getArgs()); emit(new SpawnOp(sp,compiledMethodFor(sp.getMethod()),actuals)); freeTemps(actuals); + return null; } @Override - public void visit(StoreField store) { - store.getIndex().accept(this); - Register index = operands.pop(); - store.getRhs().accept(this); - Register value = operands.pop(); + public Object visit(StoreField store) { + Register index = compile(store.getIndex()); + Register value = compile(store.getRhs()); Register object = Register.createLocal(store.getSlot()); emit(new StoreFieldOp(store,object,index,value,store.getFieldType())); temps.release(index,value); + return null; } @Override - public void visit(UnaryExpression exp) { - exp.getOperand().accept(this); - Register operand = operands.peek(); - emit(new UnaryOperation(exp,operand,operand,exp.getOperator())); + public Object visit(StoreNamedField store) { + Field field = store.getField(); + Register value = compile(store.getRhs()); + Register object = Register.createLocal(store.getSlot()); + emit(new StoreFixedFieldOp(store,object,field.getOffset(),store.getFieldName(),value, + field.getType().isObject() ? Type.OBJECT : Type.INT)); + temps.release(value); + return null; } + @Override + public Object visit(UnaryExpression exp) { + Register operand = compile(exp.getOperand()); + Register result = temps.acquire(); + emit(new UnaryOperation(exp,result,operand,exp.getOperator())); + temps.release(operand); + return result; + } + /** * Variable reference: push an operand which will fetch * the appropriate stack frame slot. */ @Override - public void visit(Variable var) { - operands.push(Register.createLocal(var.getSlot())); + public Object visit(Variable var) { + return Register.createLocal(var.getSlot()); } /** @@ -345,16 +390,16 @@ * b: */ @Override - public void visit(WhileStatement w) { + public Object visit(WhileStatement w) { int top = currentPc(); - w.getCond().accept(this); // Compile the loop condition - Register cond = operands.pop(); + Register cond = compile(w.getCond()); Branch branchToExit = new Branch(w,cond,false); temps.release(cond); emit(branchToExit); - w.getBody().accept(this); + compile(w.getBody()); emit(new Goto(w,top)); branchToExit.setBranchTarget(currentPc()); + return null; } } Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Declaration.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Declaration.java 2009-03-09 05:49:26 UTC (rev 15566) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Declaration.java 2009-03-09 06:28:55 UTC (rev 15567) @@ -12,9 +12,9 @@ */ package org.mmtk.harness.lang; -import org.mmtk.harness.lang.ast.Type; import org.mmtk.harness.lang.parser.Symbol; import org.mmtk.harness.lang.runtime.Value; +import org.mmtk.harness.lang.type.Type; /** * A variable declaration Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Intrinsics.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Intrinsics.java 2009-03-09 05:49:26 UTC (rev 15566) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Intrinsics.java 2009-03-09 06:28:55 UTC (rev 15567) @@ -68,7 +68,7 @@ * @return */ public static int random(Env env, int low, int high) { - return (int)(env.random().nextInt(high-low+1) + low); + return env.random().nextInt(high-low+1) + low; } /** Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/PrettyPrinter.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/PrettyPrinter.java 2009-03-09 05:49:26 UTC (rev 15566) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/PrettyPrinter.java 2009-03-09 06:28:55 UTC (rev 15567) @@ -20,6 +20,7 @@ import org.mmtk.harness.lang.ast.AST; import org.mmtk.harness.lang.ast.Alloc; +import org.mmtk.harness.lang.ast.AllocUserType; import org.mmtk.harness.lang.ast.Assert; import org.mmtk.harness.lang.ast.Assignment; import org.mmtk.harness.lang.ast.Call; @@ -27,6 +28,7 @@ import org.mmtk.harness.lang.ast.Expression; import org.mmtk.harness.lang.ast.IfStatement; import org.mmtk.harness.lang.ast.LoadField; +import org.mmtk.harness.lang.ast.LoadNamedField; import org.mmtk.harness.lang.ast.Method; import org.mmtk.harness.lang.ast.NormalMethod; import org.mmtk.harness.lang.ast.Operator; @@ -36,10 +38,12 @@ import org.mmtk.harness.lang.ast.Spawn; import org.mmtk.harness.lang.ast.Statement; import org.mmtk.harness.lang.ast.StoreField; +import org.mmtk.harness.lang.ast.StoreNamedField; import org.mmtk.harness.lang.ast.Variable; import org.mmtk.harness.lang.ast.WhileStatement; import org.mmtk.harness.lang.parser.MethodTable; import org.mmtk.harness.lang.parser.Parser; +import org.vmmagic.unboxed.ArchitecturalWord; public class PrettyPrinter extends Visitor { @@ -100,8 +104,8 @@ @Override - public void visit(NormalMethod method) { - fmt.out("%s(",method.getName()); + public Object visit(NormalMethod method) { + fmt.out("%s %s(",method.getReturnType(),method.getName()); boolean first = true; for (Declaration decl : method.getParams()) { if (first) { @@ -116,10 +120,11 @@ method.getBody().accept(this); fmt.decreaseIndent(); fmt.out("%s}",fmt.margin()); fmt.newline(); + return null; } @Override - public void visit(Call call) { + public Object visit(Call call) { fmt.out("%s(",call.getMethod().getName()); boolean first = true; for (Expression param : call.getParams()) { @@ -131,24 +136,27 @@ param.accept(this); } fmt.out(")"); + return null; } @Override - public void visit(Sequence ass) { + public Object visit(Sequence ass) { for (Statement stmt : ass) { stmt.accept(this); fmt.newline(); } + return null; } @Override - public void visit(Assignment a) { + public Object visit(Assignment a) { fmt.out("%s = ", a.getSymbol().getName()); a.getRhs().accept(this); fmt.out(";"); + return null; } @Override - public void visit(IfStatement conditional) { + public Object visit(IfStatement conditional) { String keyword = "if"; Iterator<Expression> condIter = conditional.getConds().iterator(); Iterator<Statement> bodyIter = conditional.getStmts().iterator(); @@ -172,11 +180,11 @@ fmt.decreaseIndent(); fmt.out("}"); } -// fmt.newline(); + return null; } @Override - public void visit(WhileStatement w) { + public Object visit(WhileStatement w) { fmt.out("while ("); w.getCond().accept(this); fmt.out(") {"); fmt.newline(); @@ -184,52 +192,72 @@ w.getBody().accept(this); fmt.decreaseIndent(); fmt.out("}"); -// fmt.newline(); + return null; } @Override - public void visit(Operator op) { + public Object visit(Operator op) { fmt.out(" %s ", op.toString()); + return null; } @Override - public void visit(LoadField load) { + public Object visit(LoadField load) { fmt.out("%s.%s[", load.getObjectSymbol().getName(), load.getFieldType().toString()); load.getIndex().accept(this); fmt.out("]"); + return null; } @Override - public void visit(Constant c) { + public Object visit(LoadNamedField load) { + fmt.out("%s.%s", load.getObjectSymbol().getName(), load.getFieldName()); + return null; + } + + @Override + public Object visit(Constant c) { fmt.out(c.value.toString()); + return null; } @Override - public void visit(Variable var) { + public Object visit(Variable var) { fmt.out("%s", var.getSymbol().getName()); + return null; } @Override - public void visit(StoreField store) { + public Object visit(StoreField store) { fmt.out("%s.%s[",store.getObjectSymbol().getName(), store.getFieldType().toString()); store.getIndex().accept(this); fmt.out("] := "); store.getRhs().accept(this); fmt.out(";"); + return null; } @Override - public void visit(Return ret) { + public Object visit(StoreNamedField store) { + fmt.out("%s.%s := ",store.getObjectSymbol().getName(), store.getFieldName()); + store.getRhs().accept(this); + fmt.out(";"); + return null; + } + + @Override + public Object visit(Return ret) { fmt.out("return"); if (ret.hasReturnValue()) { fmt.out(" "); ret.getRhs().accept(this); } fmt.out(";"); + return null; } @Override - public void visit(Assert ass) { + public Object visit(Assert ass) { fmt.out("assert("); ass.getPredicate().accept(this); for (Expression expr : ass.getOutputs()) { @@ -237,17 +265,19 @@ expr.accept(this); } fmt.out(");"); + return null; } @Override - public void visit(Declaration decl) { + public Object visit(Declaration decl) { fmt.out("%s %s", decl.getType(), decl.getName()); + return null; } @Override - public void visit(PrintStatement print) { + public Object visit(PrintStatement print) { fmt.out("print"); String separator = "("; for (Expression expr : print.getArgs()) { @@ -256,10 +286,11 @@ expr.accept(this); } fmt.out(");"); + return null; } @Override - public void visit(Alloc alloc) { + public Object visit(Alloc alloc) { fmt.out("alloc("); alloc.getDataCount().accept(this); fmt.out(","); @@ -269,10 +300,17 @@ alloc.getDoubleAlign().accept(this); } fmt.out(")"); + return null; } @Override - public void visit(Spawn spawn) { + public Object visit(AllocUserType alloc) { + fmt.out("alloc(%s)",alloc.getType()); + return null; + } + + @Override + public Object visit(Spawn spawn) { fmt.out("spawn"); String separator = "("; for (Expression expr : spawn.getArgs()) { @@ -280,6 +318,7 @@ expr.accept(this); } fmt.out(");"); + return null; } @@ -337,6 +376,7 @@ } public static void main(String[] args) { + ArchitecturalWord.init(); try { MethodTable methods = new Parser(new BufferedInputStream(new FileInputStream(args[0]))).script(); PrettyPrinter.printMethodTable(methods); Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Visitor.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Visitor.java 2009-03-09 05:49:26 UTC (rev 15566) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Visitor.java 2009-03-09 06:28:55 UTC (rev 15567) @@ -14,6 +14,7 @@ import org.mmtk.harness.lang.ast.AST; import org.mmtk.harness.lang.ast.Alloc; +import org.mmtk.harness.lang.ast.AllocUserType; import org.mmtk.harness.lang.ast.Assert; import org.mmtk.harness.lang.ast.Assignment; import org.mmtk.harness.lang.ast.BinaryExpression; @@ -25,6 +26,7 @@ import org.mmtk.harness.lang.ast.IfStatement; import org.mmtk.harness.lang.ast.IntrinsicMethod; import org.mmtk.harness.lang.ast.LoadField; +import org.mmtk.harness.lang.ast.LoadNamedField; import org.mmtk.harness.lang.ast.Method; import org.mmtk.harness.lang.ast.MethodProxy; import org.mmtk.harness.lang.ast.NormalMethod; @@ -35,6 +37,7 @@ import org.mmtk.harness.lang.ast.Spawn; import org.mmtk.harness.lang.ast.Statement; import org.mmtk.harness.lang.ast.StoreField; +import org.mmtk.harness.lang.ast.StoreNamedField; import org.mmtk.harness.lang.ast.UnaryExpression; import org.mmtk.harness.lang.ast.Variable; import org.mmtk.harness.lang.ast.WhileStatement; @@ -45,96 +48,127 @@ */ public abstract class Visitor { - public void visit(AST ast) { } - public void visit(Alloc alloc) { + public Object visit(AST ast) { return ast; } + public Object visit(Alloc alloc) { alloc.getDataCount().accept(this); alloc.getRefCount().accept(this); alloc.getDoubleAlign().accept(this); + return alloc; } - public void visit(Assert ass) { + public Object visit(AllocUserType alloc) { + return alloc; + } + public Object visit(Assert ass) { ass.getPredicate().accept(this); for (AST a : ass.getOutputs()) { a.accept(this); } + return ass; } - public void visit(Assignment a) { + public Object visit(Assignment a) { a.getRhs().accept(this); + return a; } - public void visit(BinaryExpression exp) { + public Object visit(BinaryExpression exp) { exp.getLhs().accept(this); exp.getOperator().accept(this); exp.getRhs().accept(this); + return exp; } - public void visit(Call call) { + public Object visit(Call call) { for (Expression param : call.getParams()) { param.accept(this); } call.getMethod().accept(this); + return call; } - public void visit(Constant c) { } - public void visit(Declaration decl) { } - public void visit(Empty e) { } - public void visit(Expect exc) { } - public void visit(IfStatement conditional) { + public Object visit(Constant c) { return c; } + public Object visit(Declaration decl) { return decl; } + public Object visit(Empty e) { return e; } + public Object visit(Expect exc) { return exc; } + public Object visit(IfStatement conditional) { for (Expression cond : conditional.getConds()) { cond.accept(this); } for (Statement stmt: conditional.getStmts()) { stmt.accept(this); } + return conditional; } - public void visit(IntrinsicMethod method) { + public Object visit(IntrinsicMethod method) { + return method; } - public void visit(LoadField load) { + public Object visit(LoadField load) { load.getIndex().accept(this); + return load; } - public void visit(Method method) { + public Object visit(LoadNamedField load) { + return load; + } + public Object visit(Method method) { System.err.println("Fall-through to Method visitor"); + return method; } - public void visit(MethodProxy proxy) { + public Object visit(MethodProxy proxy) { proxy.getMethod().accept(this); + return proxy; } - public void visit(NormalMethod method) { + public Object visit(NormalMethod method) { for (Declaration decl : method.getDecls()) { decl.accept(this); } method.getBody().accept(this); + return method; } - public void visit(Operator op) { + public Object visit(Operator op) { op.accept(this); + return op; } - public void visit(PrintStatement print) { + public Object visit(PrintStatement print) { for (Expression e : print.getArgs()) { e.accept(this); } + return print; } - public void visit(Return ret) { + public Object visit(Return ret) { if (ret.hasReturnValue()) { ret.getRhs().accept(this); } + return ret; } - public void visit(Sequence ass) { + public Object visit(Sequence ass) { for (Statement stmt : ass) { stmt.accept(this); } + return ass; } - public void visit(Spawn sp) { + public Object visit(Spawn sp) { for (AST arg : sp.getArgs()) { arg.accept(this); } sp.getMethod().accept(this); + return sp; } - public void visit(StoreField store) { + public Object visit(StoreField store) { store.getIndex().accept(this); store.getRhs().accept(this); + return store; } - public void visit(UnaryExpression exp) { + public Object visit(StoreNamedField store) { + store.getRhs().accept(this); + return store; + } + public Object visit(UnaryExpression exp) { exp.getOperator().accept(this); exp.getOperand().accept(this); + return exp; } - public void visit(Variable var) { } - public void visit(WhileStatement w) { + public Object visit(Variable var) { + return var; + } + public Object visit(WhileStatement w) { w.getCond().accept(this); w.getBody().accept(this); + return w; } } Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/AST.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/AST.java 2009-03-09 05:49:26 UTC (rev 15566) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/AST.java 2009-03-09 06:28:55 UTC (rev 15567) @@ -13,6 +13,7 @@ package org.mmtk.harness.lang.ast; import org.mmtk.harness.lang.Visitor; +import org.mmtk.harness.lang.parser.Token; /** * Abstract parent of all the components of an AST @@ -20,11 +21,13 @@ public interface AST { /** Accept visitors */ - void accept(Visitor v); + Object accept(Visitor v); int getLine(); int getColumn(); + Token getToken(); + String sourceLocation(String prefix); } Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/AbstractAST.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/AbstractAST.java 2009-03-09 05:49:26 UTC (rev 15566) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/AbstractAST.java 2009-03-09 06:28:55 UTC (rev 15567) @@ -12,13 +12,14 @@ */ package org.mmtk.harness.lang.ast; +import org.mmtk.harness.lang.Visitor; import org.mmtk.harness.lang.parser.Source; import org.mmtk.harness.lang.parser.Token; /** * Abstract parent of all the components of an AST */ -public abstract class AbstractAST implements AST { +public class AbstractAST implements AST { /* * Track the current source file - assumes only one source file @@ -43,45 +44,59 @@ /* The source file */ private Source source = currentSource; - /** Source code line corresponding to this syntax element */ - private final int line; - /** Source code column corresponding to this syntax element */ - private final int column; + /** Source code token corresponding to this syntax element */ + private final Token t; - protected AbstractAST(Token t) { - this(t.beginLine, t.beginColumn); + public AbstractAST(Token t) { + this.t = t; } + /** + * Constructor only for AST elements that don't have a direct correspondance + * to the source. + * @param line + * @param column + */ protected AbstractAST(int line, int column) { - this.line = line; - this.column = column; + Token tok = new Token(); + tok.beginLine = line; + tok.beginColumn = column; + this.t = tok; } + public Token getToken() { + return t; + } + @Override public int getLine() { - return line; + return t.beginLine; } @Override public int getColumn() { - return column; + return t.beginColumn; } @Override public String sourceLocation(String prefix) { if (source == null) { return prefix+"<no source available>"; - } else { - return prefix+source.getLine(line)+"\n"+... [truncated message content] |
From: <dgr...@us...> - 2009-04-24 15:00:54
|
Revision: 15662 http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=15662&view=rev Author: dgrove-oss Date: 2009-04-24 15:00:43 +0000 (Fri, 24 Apr 2009) Log Message: ----------- RVM-817 WIP: Change from CPL to EPL in individual file license information. Modified Paths: -------------- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ActivePlan.java rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Assert.java rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Barriers.java rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/BuildTimeConfig.java rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Collection.java rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Debug.java rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Factory.java rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/FinalizableProcessor.java rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/MMTkEvents.java rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Memory.java rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ObjectModel.java rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ReferenceProcessor.java rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Scanning.java rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Statistics.java rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Strings.java rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/SynchronizedCounter.java rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/ActivePlan.java rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Assert.java rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Barriers.java rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/BuildTimeConfig.java rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Collection.java rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Debug.java rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Factory.java rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/FinalizableProcessor.java rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Lock.java rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/MMTk_Events.java rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Memory.java rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/ObjectModel.java rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/ReferenceProcessor.java rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/ScanBootImage.java rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/ScanStatics.java rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/ScanThread.java rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Scanning.java rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Statistics.java rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Strings.java rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/SynchronizedCounter.java rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/TraceInterface.java rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/gcspy/ByteStream.java rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/gcspy/IntStream.java rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/gcspy/ServerInterpreter.java rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/gcspy/ServerSpace.java rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/gcspy/ShortStream.java rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/gcspy/Util.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Collector.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Harness.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/MMTkThread.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Main.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/Mutator.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Checker.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/CheckerException.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Compiler.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Declaration.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Env.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Intrinsics.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/PrettyPrinter.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Trace.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/UnsyncStack.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Visitor.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/AST.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/AbstractAST.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Alloc.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/AllocUserType.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Assert.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Assignment.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/BinaryExpression.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Call.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Constant.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Empty.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Expect.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Expression.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/IfStatement.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/IntrinsicMethod.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/LoadField.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/LoadNamedField.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Method.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/MethodProxy.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/NormalMethod.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Operator.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/PrintStatement.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Return.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Sequence.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Spawn.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Statement.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/StoreField.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/StoreNamedField.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/UnaryExpression.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Variable.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/WhileStatement.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/compiler/CompiledMethod.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/compiler/CompiledMethodProxy.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/compiler/CompiledMethodTable.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/compiler/Register.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/compiler/Temporary.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/parser/GlobalDefs.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/parser/MethodTable.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/parser/Source.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/parser/Symbol.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/parser/SymbolTable.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/parser/TypeTable.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/AllocOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/AllocUserOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/BinaryOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/BinaryOperation.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/Branch.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/CallIntrinsicOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/CallNormalOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/CallOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/EnnaryOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/ExitOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/ExpectOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/Goto.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/LoadFieldOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/LoadFixedFieldOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/NullaryOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/PrintOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/PseudoOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/ResolvableOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/ReturnOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/SpawnOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/StoreFieldOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/StoreFixedFieldOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/StoreLocal.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/TernaryOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/UnaryOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/UnaryOperation.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/runtime/AllocationSite.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/runtime/BoolValue.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/runtime/ConstantPool.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/runtime/IntValue.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/runtime/NullValue.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/runtime/ObjectValue.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/runtime/PcodeInterpreter.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/runtime/StackFrame.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/runtime/StringValue.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/runtime/Value.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/type/AbstractType.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/type/BooleanType.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/type/Field.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/type/IntType.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/type/ObjectType.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/type/StringType.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/type/Type.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/type/TypeReference.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/type/UserType.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/type/UserTypeImpl.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/type/VoidType.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/Bits.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/Collectors.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/DumpPcode.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/GcEvery.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/HarnessOptionSet.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/InitHeap.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/MaxHeap.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/Plan.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/PolicyStats.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/RandomPolicyLength.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/RandomPolicyMax.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/RandomPolicyMin.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/RandomPolicySeed.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/Scheduler.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/SchedulerPolicy.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/Timeout.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/Trace.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/YieldInterval.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/sanity/FromSpaceInvariant.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/sanity/HeapEntry.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/sanity/HeapSnapshot.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/sanity/HeapVisitor.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/sanity/Sanity.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/sanity/Traversal.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/AbstractPolicy.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/Lock.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/Policy.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/Schedulable.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/Scheduler.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/ThreadModel.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/YieldAlways.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/YieldEvery.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/YieldNever.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/YieldRandomly.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/javathreads/JavaLock.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/javathreads/JavaThread.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/javathreads/JavaThreadModel.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/javathreads/Rendezvous.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/rawthreads/RawLock.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/rawthreads/RawThread.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/scheduler/rawthreads/RawThreadModel.java rvmroot/trunk/MMTk/harness/src-generated/org/mmtk/harness/lang/parser/Parser.jj rvmroot/trunk/MMTk/harness/test-scripts/Alignment.script rvmroot/trunk/MMTk/harness/test-scripts/CyclicGarbage.script rvmroot/trunk/MMTk/harness/test-scripts/FixedLive.script rvmroot/trunk/MMTk/harness/test-scripts/HashCode.script rvmroot/trunk/MMTk/harness/test-scripts/LargeObject.script rvmroot/trunk/MMTk/harness/test-scripts/Lists.script rvmroot/trunk/MMTk/harness/test-scripts/OutOfMemory.script rvmroot/trunk/MMTk/harness/test-scripts/SpreadAlloc.script rvmroot/trunk/MMTk/harness/vmmagic/org/vmmagic/unboxed/Address.java rvmroot/trunk/MMTk/harness/vmmagic/org/vmmagic/unboxed/AddressArray.java rvmroot/trunk/MMTk/harness/vmmagic/org/vmmagic/unboxed/ArchitecturalWord.java rvmroot/trunk/MMTk/harness/vmmagic/org/vmmagic/unboxed/ArchitecturalWord32.java rvmroot/trunk/MMTk/harness/vmmagic/org/vmmagic/unboxed/ArchitecturalWord64.java rvmroot/trunk/MMTk/harness/vmmagic/org/vmmagic/unboxed/Architecture.java rvmroot/trunk/MMTk/harness/vmmagic/org/vmmagic/unboxed/Extent.java rvmroot/trunk/MMTk/harness/vmmagic/org/vmmagic/unboxed/ExtentArray.java rvmroot/trunk/MMTk/harness/vmmagic/org/vmmagic/unboxed/ObjectReference.java rvmroot/trunk/MMTk/harness/vmmagic/org/vmmagic/unboxed/ObjectReferenceArray.java rvmroot/trunk/MMTk/harness/vmmagic/org/vmmagic/unboxed/Offset.java rvmroot/trunk/MMTk/harness/vmmagic/org/vmmagic/unboxed/OffsetArray.java rvmroot/trunk/MMTk/harness/vmmagic/org/vmmagic/unboxed/SimulatedMemory.java rvmroot/trunk/MMTk/harness/vmmagic/org/vmmagic/unboxed/Word.java rvmroot/trunk/MMTk/harness/vmmagic/org/vmmagic/unboxed/WordArray.java rvmroot/trunk/MMTk/src/org/mmtk/plan/CollectorContext.java rvmroot/trunk/MMTk/src/org/mmtk/plan/ComplexPhase.java rvmroot/trunk/MMTk/src/org/mmtk/plan/GCspyPlan.java rvmroot/trunk/MMTk/src/org/mmtk/plan/MutatorContext.java rvmroot/trunk/MMTk/src/org/mmtk/plan/Phase.java rvmroot/trunk/MMTk/src/org/mmtk/plan/Plan.java rvmroot/trunk/MMTk/src/org/mmtk/plan/PlanConstraints.java rvmroot/trunk/MMTk/src/org/mmtk/plan/Simple.java rvmroot/trunk/MMTk/src/org/mmtk/plan/SimpleCollector.java rvmroot/trunk/MMTk/src/org/mmtk/plan/SimpleConstraints.java rvmroot/trunk/MMTk/src/org/mmtk/plan/SimpleMutator.java rvmroot/trunk/MMTk/src/org/mmtk/plan/SimplePhase.java rvmroot/trunk/MMTk/src/org/mmtk/plan/StopTheWorld.java rvmroot/trunk/MMTk/src/org/mmtk/plan/StopTheWorldCollector.java rvmroot/trunk/MMTk/src/org/mmtk/plan/StopTheWorldConstraints.java rvmroot/trunk/MMTk/src/org/mmtk/plan/StopTheWorldMutator.java rvmroot/trunk/MMTk/src/org/mmtk/plan/Trace.java rvmroot/trunk/MMTk/src/org/mmtk/plan/TraceLocal.java rvmroot/trunk/MMTk/src/org/mmtk/plan/TraceWriteBuffer.java rvmroot/trunk/MMTk/src/org/mmtk/plan/TransitiveClosure.java rvmroot/trunk/MMTk/src/org/mmtk/plan/copyms/CopyMS.java rvmroot/trunk/MMTk/src/org/mmtk/plan/copyms/CopyMSCollector.java rvmroot/trunk/MMTk/src/org/mmtk/plan/copyms/CopyMSConstraints.java rvmroot/trunk/MMTk/src/org/mmtk/plan/copyms/CopyMSMutator.java rvmroot/trunk/MMTk/src/org/mmtk/plan/copyms/CopyMSTraceLocal.java rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/Gen.java rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/GenCollector.java rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/GenConstraints.java rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/GenMatureTraceLocal.java rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/GenMutator.java rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/GenNurseryTraceLocal.java rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/copying/GenCopy.java rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/copying/GenCopyCollector.java rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/copying/GenCopyConstraints.java rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/copying/GenCopyMatureTraceLocal.java rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/copying/GenCopyMutator.java rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/immix/GenImmix.java rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/immix/GenImmixCollector.java rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/immix/GenImmixConstraints.java rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/immix/GenImmixMatureDefragTraceLocal.java rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/immix/GenImmixMatureTraceLocal.java rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/immix/GenImmixMutator.java rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/marksweep/GenMS.java rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/marksweep/GenMSCollector.java rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/marksweep/GenMSConstraints.java rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/marksweep/GenMSMatureTraceLocal.java rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/marksweep/GenMSMutator.java rvmroot/trunk/MMTk/src/org/mmtk/plan/immix/Immix.java rvmroot/trunk/MMTk/src/org/mmtk/plan/immix/ImmixCollector.java rvmroot/trunk/MMTk/src/org/mmtk/plan/immix/ImmixConstraints.java rvmroot/trunk/MMTk/src/org/mmtk/plan/immix/ImmixDefragTraceLocal.java rvmroot/trunk/MMTk/src/org/mmtk/plan/immix/ImmixMutator.java rvmroot/trunk/MMTk/src/org/mmtk/plan/immix/ImmixTraceLocal.java rvmroot/trunk/MMTk/src/org/mmtk/plan/markcompact/MC.java rvmroot/trunk/MMTk/src/org/mmtk/plan/markcompact/MCCollector.java rvmroot/trunk/MMTk/src/org/mmtk/plan/markcompact/MCConstraints.java rvmroot/trunk/MMTk/src/org/mmtk/plan/markcompact/MCForwardTraceLocal.java rvmroot/trunk/MMTk/src/org/mmtk/plan/markcompact/MCMarkTraceLocal.java rvmroot/trunk/MMTk/src/org/mmtk/plan/markcompact/MCMutator.java rvmroot/trunk/MMTk/src/org/mmtk/plan/marksweep/MS.java rvmroot/trunk/MMTk/src/org/mmtk/plan/marksweep/MSCollector.java rvmroot/trunk/MMTk/src/org/mmtk/plan/marksweep/MSConstraints.java rvmroot/trunk/MMTk/src/org/mmtk/plan/marksweep/MSMutator.java rvmroot/trunk/MMTk/src/org/mmtk/plan/marksweep/MSTraceLocal.java rvmroot/trunk/MMTk/src/org/mmtk/plan/nogc/NoGC.java rvmroot/trunk/MMTk/src/org/mmtk/plan/nogc/NoGCCollector.java rvmroot/trunk/MMTk/src/org/mmtk/plan/nogc/NoGCConstraints.java rvmroot/trunk/MMTk/src/org/mmtk/plan/nogc/NoGCMutator.java rvmroot/trunk/MMTk/src/org/mmtk/plan/nogc/NoGCTraceLocal.java rvmroot/trunk/MMTk/src/org/mmtk/plan/poisoned/Poisoned.java rvmroot/trunk/MMTk/src/org/mmtk/plan/poisoned/PoisonedCollector.java rvmroot/trunk/MMTk/src/org/mmtk/plan/poisoned/PoisonedConstraints.java rvmroot/trunk/MMTk/src/org/mmtk/plan/poisoned/PoisonedMutator.java rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/RCBase.java rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/RCBaseCollector.java rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/RCBaseConstraints.java rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/RCBaseMutator.java rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/RCDecBuffer.java rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/RCHeader.java rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/RCZero.java rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/backuptrace/BTDecMarked.java rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/backuptrace/BTDecMarkedAndZero.java rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/backuptrace/BTFreeLargeObjectSweeper.java rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/backuptrace/BTScanLargeObjectSweeper.java rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/backuptrace/BTSweepImmortalScanner.java rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/backuptrace/BTSweeper.java rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/backuptrace/BTTraceLocal.java rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/fullheap/RC.java rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/fullheap/RCCollector.java rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/fullheap/RCConstraints.java rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/fullheap/RCFindRootSetTraceLocal.java rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/fullheap/RCModifiedProcessor.java rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/fullheap/RCMutator.java rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/generational/GenRC.java rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/generational/GenRCCollector.java rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/generational/GenRCConstraints.java rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/generational/GenRCFindRootSetTraceLocal.java rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/generational/GenRCModifiedProcessor.java rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/generational/GenRCMutator.java rvmroot/trunk/MMTk/src/org/mmtk/plan/semispace/SS.java rvmroot/trunk/MMTk/src/org/mmtk/plan/semispace/SSCollector.java rvmroot/trunk/MMTk/src/org/mmtk/plan/semispace/SSConstraints.java rvmroot/trunk/MMTk/src/org/mmtk/plan/semispace/SSMutator.java rvmroot/trunk/MMTk/src/org/mmtk/plan/semispace/SSTraceLocal.java rvmroot/trunk/MMTk/src/org/mmtk/plan/semispace/gcspy/SSGCspy.java rvmroot/trunk/MMTk/src/org/mmtk/plan/semispace/gcspy/SSGCspyCollector.java rvmroot/trunk/MMTk/src/org/mmtk/plan/semispace/gcspy/SSGCspyConstraints.java rvmroot/trunk/MMTk/src/org/mmtk/plan/semispace/gcspy/SSGCspyMutator.java rvmroot/trunk/MMTk/src/org/mmtk/plan/semispace/gcspy/SSGCspyTraceLocal.java rvmroot/trunk/MMTk/src/org/mmtk/plan/semispace/gctrace/GCTrace.java rvmroot/trunk/MMTk/src/org/mmtk/plan/semispace/gctrace/GCTraceCollector.java rvmroot/trunk/MMTk/src/org/mmtk/plan/semispace/gctrace/GCTraceConstraints.java rvmroot/trunk/MMTk/src/org/mmtk/plan/semispace/gctrace/GCTraceMutator.java rvmroot/trunk/MMTk/src/org/mmtk/plan/semispace/gctrace/GCTraceTraceLocal.java rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyimmix/StickyImmix.java rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyimmix/StickyImmixCollector.java rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyimmix/StickyImmixConstraints.java rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyimmix/StickyImmixMutator.java rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyimmix/StickyImmixNurseryTraceLocal.java rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyms/StickyMS.java rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyms/StickyMSCollector.java rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyms/StickyMSConstraints.java rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyms/StickyMSMutator.java rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyms/StickyMSNurseryTraceLocal.java rvmroot/trunk/MMTk/src/org/mmtk/policy/BaseLargeObjectSpace.java rvmroot/trunk/MMTk/src/org/mmtk/policy/CopyLocal.java rvmroot/trunk/MMTk/src/org/mmtk/policy/CopySpace.java rvmroot/trunk/MMTk/src/org/mmtk/policy/ExplicitFreeListLocal.java rvmroot/trunk/MMTk/src/org/mmtk/policy/ExplicitFreeListSpace.java rvmroot/trunk/MMTk/src/org/mmtk/policy/ExplicitLargeObjectSpace.java rvmroot/trunk/MMTk/src/org/mmtk/policy/ImmortalLocal.java rvmroot/trunk/MMTk/src/org/mmtk/policy/ImmortalSpace.java rvmroot/trunk/MMTk/src/org/mmtk/policy/LargeObjectLocal.java rvmroot/trunk/MMTk/src/org/mmtk/policy/LargeObjectSpace.java rvmroot/trunk/MMTk/src/org/mmtk/policy/MarkCompactLocal.java rvmroot/trunk/MMTk/src/org/mmtk/policy/MarkCompactSpace.java rvmroot/trunk/MMTk/src/org/mmtk/policy/MarkSweepLocal.java rvmroot/trunk/MMTk/src/org/mmtk/policy/MarkSweepSpace.java rvmroot/trunk/MMTk/src/org/mmtk/policy/RawPageSpace.java rvmroot/trunk/MMTk/src/org/mmtk/policy/SegregatedFreeListSpace.java rvmroot/trunk/MMTk/src/org/mmtk/policy/Space.java rvmroot/trunk/MMTk/src/org/mmtk/policy/immix/Block.java rvmroot/trunk/MMTk/src/org/mmtk/policy/immix/Chunk.java rvmroot/trunk/MMTk/src/org/mmtk/policy/immix/ChunkList.java rvmroot/trunk/MMTk/src/org/mmtk/policy/immix/CollectorLocal.java rvmroot/trunk/MMTk/src/org/mmtk/policy/immix/Defrag.java rvmroot/trunk/MMTk/src/org/mmtk/policy/immix/ImmixConstants.java rvmroot/trunk/MMTk/src/org/mmtk/policy/immix/ImmixSpace.java rvmroot/trunk/MMTk/src/org/mmtk/policy/immix/Line.java rvmroot/trunk/MMTk/src/org/mmtk/policy/immix/MutatorLocal.java rvmroot/trunk/MMTk/src/org/mmtk/policy/immix/ObjectHeader.java rvmroot/trunk/MMTk/src/org/mmtk/utility/BaseGenericFreeList.java rvmroot/trunk/MMTk/src/org/mmtk/utility/CallSite.java rvmroot/trunk/MMTk/src/org/mmtk/utility/Constants.java rvmroot/trunk/MMTk/src/org/mmtk/utility/Conversions.java rvmroot/trunk/MMTk/src/org/mmtk/utility/CycleDetector.java rvmroot/trunk/MMTk/src/org/mmtk/utility/DoublyLinkedList.java rvmroot/trunk/MMTk/src/org/mmtk/utility/GenericFreeList.java rvmroot/trunk/MMTk/src/org/mmtk/utility/Log.java rvmroot/trunk/MMTk/src/org/mmtk/utility/Memory.java rvmroot/trunk/MMTk/src/org/mmtk/utility/SimpleHashtable.java rvmroot/trunk/MMTk/src/org/mmtk/utility/Synchronize.java rvmroot/trunk/MMTk/src/org/mmtk/utility/TraceGenerator.java rvmroot/trunk/MMTk/src/org/mmtk/utility/TracingConstants.java rvmroot/trunk/MMTk/src/org/mmtk/utility/Treadmill.java rvmroot/trunk/MMTk/src/org/mmtk/utility/alloc/Allocator.java rvmroot/trunk/MMTk/src/org/mmtk/utility/alloc/BlockAllocator.java rvmroot/trunk/MMTk/src/org/mmtk/utility/alloc/BumpPointer.java rvmroot/trunk/MMTk/src/org/mmtk/utility/alloc/DumpLinearScan.java rvmroot/trunk/MMTk/src/org/mmtk/utility/alloc/EmbeddedMetaData.java rvmroot/trunk/MMTk/src/org/mmtk/utility/alloc/ImmixAllocator.java rvmroot/trunk/MMTk/src/org/mmtk/utility/alloc/LargeObjectAllocator.java rvmroot/trunk/MMTk/src/org/mmtk/utility/alloc/LinearScan.java rvmroot/trunk/MMTk/src/org/mmtk/utility/alloc/SegregatedFreeList.java rvmroot/trunk/MMTk/src/org/mmtk/utility/alloc/SegregatedFreeListLocal.java rvmroot/trunk/MMTk/src/org/mmtk/utility/deque/AddressDeque.java rvmroot/trunk/MMTk/src/org/mmtk/utility/deque/AddressPairDeque.java rvmroot/trunk/MMTk/src/org/mmtk/utility/deque/AddressTripleDeque.java rvmroot/trunk/MMTk/src/org/mmtk/utility/deque/Deque.java rvmroot/trunk/MMTk/src/org/mmtk/utility/deque/LocalDeque.java rvmroot/trunk/MMTk/src/org/mmtk/utility/deque/LocalQueue.java rvmroot/trunk/MMTk/src/org/mmtk/utility/deque/LocalSSB.java rvmroot/trunk/MMTk/src/org/mmtk/utility/deque/ObjectReferenceBuffer.java rvmroot/trunk/MMTk/src/org/mmtk/utility/deque/ObjectReferenceDeque.java rvmroot/trunk/MMTk/src/org/mmtk/utility/deque/SharedDeque.java rvmroot/trunk/MMTk/src/org/mmtk/utility/deque/SortSharedDeque.java rvmroot/trunk/MMTk/src/org/mmtk/utility/deque/SortTODAddressStack.java rvmroot/trunk/MMTk/src/org/mmtk/utility/deque/SortTODObjectReferenceStack.java rvmroot/trunk/MMTk/src/org/mmtk/utility/deque/SortTODSharedDeque.java rvmroot/trunk/MMTk/src/org/mmtk/utility/deque/TraceBuffer.java rvmroot/trunk/MMTk/src/org/mmtk/utility/deque/WriteBuffer.java rvmroot/trunk/MMTk/src/org/mmtk/utility/gcspy/Color.java rvmroot/trunk/MMTk/src/org/mmtk/utility/gcspy/GCspy.java rvmroot/trunk/MMTk/src/org/mmtk/utility/gcspy/LinearScan.java rvmroot/trunk/MMTk/src/org/mmtk/utility/gcspy/StreamConstants.java rvmroot/trunk/MMTk/src/org/mmtk/utility/gcspy/Subspace.java rvmroot/trunk/MMTk/src/org/mmtk/utility/gcspy/drivers/AbstractDriver.java rvmroot/trunk/MMTk/src/org/mmtk/utility/gcspy/drivers/GenImmortalSpaceDriver.java rvmroot/trunk/MMTk/src/org/mmtk/utility/gcspy/drivers/GenLOSDriver.java rvmroot/trunk/MMTk/src/org/mmtk/utility/gcspy/drivers/ImmortalSpaceDriver.java rvmroot/trunk/MMTk/src/org/mmtk/utility/gcspy/drivers/LinearSpaceDriver.java rvmroot/trunk/MMTk/src/org/mmtk/utility/gcspy/drivers/TreadmillDriver.java rvmroot/trunk/MMTk/src/org/mmtk/utility/heap/FreeListPageResource.java rvmroot/trunk/MMTk/src/org/mmtk/utility/heap/HeapGrowthManager.java rvmroot/trunk/MMTk/src/org/mmtk/utility/heap/Map.java rvmroot/trunk/MMTk/src/org/mmtk/utility/heap/Mmapper.java rvmroot/trunk/MMTk/src/org/mmtk/utility/heap/MonotonePageResource.java rvmroot/trunk/MMTk/src/org/mmtk/utility/heap/PageResource.java rvmroot/trunk/MMTk/src/org/mmtk/utility/heap/SpaceDescriptor.java rvmroot/trunk/MMTk/src/org/mmtk/utility/heap/VMRequest.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/BoundedNursery.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/ConcurrentTrigger.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/CycleFilterThreshold.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/CycleMetaDataLimit.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/CycleTriggerThreshold.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/DebugAddress.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/DefragFreeHeadroom.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/DefragFreeHeadroomFraction.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/DefragHeadroom.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/DefragHeadroomFraction.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/DefragLineReuseRatio.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/DefragSimpleSpillThreshold.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/DefragStress.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/DummyEnum.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/EagerCompleteSweep.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/EagerMmapSpaces.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/EchoOptions.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/FixedNursery.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/FragmentationStats.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/FullHeapSystemGC.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/GCTimeCap.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/GCspyPort.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/GCspyTileSize.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/GCspyWait.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/GenCycleDetection.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/HarnessAll.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/IgnoreSystemGC.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/LineReuseRatio.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/MarkSweepMarkBits.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/MetaDataLimit.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/NoFinalizer.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/NoReferenceTypes.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/NurserySize.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/Options.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/PerfMetric.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/PrintPhaseStats.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/ProtectOnRelease.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/SanityCheck.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/StressFactor.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/TraceRate.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/VariableSizeHeap.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/Verbose.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/VerboseFragmentationStats.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/VerboseTiming.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/XmlStats.java rvmroot/trunk/MMTk/src/org/mmtk/utility/sanitychecker/SanityChecker.java rvmroot/trunk/MMTk/src/org/mmtk/utility/sanitychecker/SanityCheckerLocal.java rvmroot/trunk/MMTk/src/org/mmtk/utility/sanitychecker/SanityDataTable.java rvmroot/trunk/MMTk/src/org/mmtk/utility/sanitychecker/SanityLinearScan.java rvmroot/trunk/MMTk/src/org/mmtk/utility/sanitychecker/SanityRootTraceLocal.java rvmroot/trunk/MMTk/src/org/mmtk/utility/sanitychecker/SanityTraceLocal.java rvmroot/trunk/MMTk/src/org/mmtk/utility/statistics/BooleanCounter.java rvmroot/trunk/MMTk/src/org/mmtk/utility/statistics/Counter.java rvmroot/trunk/MMTk/src/org/mmtk/utility/statistics/EventCounter.java rvmroot/trunk/MMTk/src/org/mmtk/utility/statistics/LongCounter.java rvmroot/trunk/MMTk/src/org/mmtk/utility/statistics/PerfCounter.java rvmroot/trunk/MMTk/src/org/mmtk/utility/statistics/SizeCounter.java rvmroot/trunk/MMTk/src/org/mmtk/utility/statistics/Stats.java rvmroot/trunk/MMTk/src/org/mmtk/utility/statistics/Timer.java rvmroot/trunk/MMTk/src/org/mmtk/utility/statistics/Xml.java rvmroot/trunk/MMTk/src/org/mmtk/vm/ActivePlan.java rvmroot/trunk/MMTk/src/org/mmtk/vm/Assert.java rvmroot/trunk/MMTk/src/org/mmtk/vm/Barriers.java rvmroot/trunk/MMTk/src/org/mmtk/vm/BuildTimeConfig.java rvmroot/trunk/MMTk/src/org/mmtk/vm/Collection.java rvmroot/trunk/MMTk/src/org/mmtk/vm/Config.java rvmroot/trunk/MMTk/src/org/mmtk/vm/Debug.java rvmroot/trunk/MMTk/src/org/mmtk/vm/Factory.java rvmroot/trunk/MMTk/src/org/mmtk/vm/FinalizableProcessor.java rvmroot/trunk/MMTk/src/org/mmtk/vm/Lock.java rvmroot/trunk/MMTk/src/org/mmtk/vm/MMTk_Events.java rvmroot/trunk/MMTk/src/org/mmtk/vm/Memory.java rvmroot/trunk/MMTk/src/org/mmtk/vm/ObjectModel.java rvmroot/trunk/MMTk/src/org/mmtk/vm/ReferenceProcessor.java rvmroot/trunk/MMTk/src/org/mmtk/vm/Scanning.java rvmroot/trunk/MMTk/src/org/mmtk/vm/Statistics.java rvmroot/trunk/MMTk/src/org/mmtk/vm/Strings.java rvmroot/trunk/MMTk/src/org/mmtk/vm/SynchronizedCounter.java rvmroot/trunk/MMTk/src/org/mmtk/vm/TraceInterface.java rvmroot/trunk/MMTk/src/org/mmtk/vm/VM.java rvmroot/trunk/MMTk/src/org/mmtk/vm/gcspy/ByteStream.java rvmroot/trunk/MMTk/src/org/mmtk/vm/gcspy/IntStream.java rvmroot/trunk/MMTk/src/org/mmtk/vm/gcspy/ServerInterpreter.java rvmroot/trunk/MMTk/src/org/mmtk/vm/gcspy/ServerSpace.java rvmroot/trunk/MMTk/src/org/mmtk/vm/gcspy/ShortStream.java rvmroot/trunk/MMTk/src/org/mmtk/vm/gcspy/Stream.java rvmroot/trunk/MMTk/src/org/mmtk/vm/gcspy/Util.java Modified: rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ActivePlan.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ActivePlan.java 2009-04-24 14:02:49 UTC (rev 15661) +++ rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ActivePlan.java 2009-04-24 15:00:43 UTC (rev 15662) @@ -1,11 +1,11 @@ /* * This file is part of the Jikes RVM project (http://jikesrvm.org). * - * This file is licensed to You under the Common Public License (CPL); + * This file is licensed to You under the Eclipse Public License (EPL); * You may not use this file except in compliance with the License. You * may obtain a copy of the License at * - * http://www.opensource.org/licenses/cpl1.0.php + * http://www.opensource.org/licenses/eclipse-1.0.php * * See the COPYRIGHT.txt file distributed with this work for information * regarding copyright ownership. Modified: rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Assert.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Assert.java 2009-04-24 14:02:49 UTC (rev 15661) +++ rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Assert.java 2009-04-24 15:00:43 UTC (rev 15662) @@ -1,11 +1,11 @@ /* * This file is part of the Jikes RVM project (http://jikesrvm.org). * - * This file is licensed to You under the Common Public License (CPL); + * This file is licensed to You under the Eclipse Public License (EPL); * You may not use this file except in compliance with the License. You * may obtain a copy of the License at * - * http://www.opensource.org/licenses/cpl1.0.php + * http://www.opensource.org/licenses/eclipse-1.0.php * * See the COPYRIGHT.txt file distributed with this work for information * regarding copyright ownership. Modified: rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Barriers.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Barriers.java 2009-04-24 14:02:49 UTC (rev 15661) +++ rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Barriers.java 2009-04-24 15:00:43 UTC (rev 15662) @@ -1,11 +1,11 @@ /* * This file is part of the Jikes RVM project (http://jikesrvm.org). * - * This file is licensed to You under the Common Public License (CPL); + * This file is licensed to You under the Eclipse Public License (EPL); * You may not use this file except in compliance with the License. You * may obtain a copy of the License at * - * http://www.opensource.org/licenses/cpl1.0.php + * http://www.opensource.org/licenses/eclipse-1.0.php * * See the COPYRIGHT.txt file distributed with this work for information * regarding copyright ownership. Modified: rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/BuildTimeConfig.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/BuildTimeConfig.java 2009-04-24 14:02:49 UTC (rev 15661) +++ rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/BuildTimeConfig.java 2009-04-24 15:00:43 UTC (rev 15662) @@ -1,11 +1,11 @@ /* * This file is part of the Jikes RVM project (http://jikesrvm.org). * - * This file is licensed to You under the Common Public License (CPL); + * This file is licensed to You under the Eclipse Public License (EPL); * You may not use this file except in compliance with the License. You * may obtain a copy of the License at * - * http://www.opensource.org/licenses/cpl1.0.php + * http://www.opensource.org/licenses/eclipse-1.0.php * * See the COPYRIGHT.txt file distributed with this work for information * regarding copyright ownership. Modified: rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Collection.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Collection.java 2009-04-24 14:02:49 UTC (rev 15661) +++ rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Collection.java 2009-04-24 15:00:43 UTC (rev 15662) @@ -1,11 +1,11 @@ /* * This file is part of the Jikes RVM project (http://jikesrvm.org). * - * This file is licensed to You under the Common Public License (CPL); + * This file is licensed to You under the Eclipse Public License (EPL); * You may not use this file except in compliance with the License. You * may obtain a copy of the License at * - * http://www.opensource.org/licenses/cpl1.0.php + * http://www.opensource.org/licenses/eclipse-1.0.php * * See the COPYRIGHT.txt file distributed with this work for information * regarding copyright ownership. Modified: rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Debug.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Debug.java 2009-04-24 14:02:49 UTC (rev 15661) +++ rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Debug.java 2009-04-24 15:00:43 UTC (rev 15662) @@ -1,11 +1,11 @@ /* * This file is part of the Jikes RVM project (http://jikesrvm.org). * - * This file is licensed to You under the Common Public License (CPL); + * This file is licensed to You under the Eclipse Public License (EPL); * You may not use this file except in compliance with the License. You * may obtain a copy of the License at * - * http://www.opensource.org/licenses/cpl1.0.php + * http://www.opensource.org/licenses/eclipse-1.0.php * * See the COPYRIGHT.txt file distributed with this work for information * regarding copyright ownership. Modified: rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Factory.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Factory.java 2009-04-24 14:02:49 UTC (rev 15661) +++ rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Factory.java 2009-04-24 15:00:43 UTC (rev 15662) @@ -1,11 +1,11 @@ /* * This file is part of the Jikes RVM project (http://jikesrvm.org). * - * This file is licensed to You under the Common Public License (CPL); + * This file is licensed to You under the Eclipse Public License (EPL); * You may not use this file except in compliance with the License. You * may obtain a copy of the License at * - * http://www.opensource.org/licenses/cpl1.0.php + * http://www.opensource.org/licenses/eclipse-1.0.php * * See the COPYRIGHT.txt file distributed with this work for information * regarding copyright ownership. Modified: rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/FinalizableProcessor.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/FinalizableProcessor.java 2009-04-24 14:02:49 UTC (rev 15661) +++ rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/FinalizableProcessor.java 2009-04-24 15:00:43 UTC (rev 15662) @@ -1,11 +1,11 @@ /* * This file is part of the Jikes RVM project (http://jikesrvm.org). * - * This file is licensed to You under the Common Public License (CPL); + * This file is licensed to You under the Eclipse Public License (EPL); * You may not use this file except in compliance with the License. You * may obtain a copy of the License at * - * http://www.opensource.org/licenses/cpl1.0.php + * http://www.opensource.org/licenses/eclipse-1.0.php * * See the COPYRIGHT.txt file distributed with this work for information * regarding copyright ownership. Modified: rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/MMTkEvents.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/MMTkEvents.java 2009-04-24 14:02:49 UTC (rev 15661) +++ rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/MMTkEvents.java 2009-04-24 15:00:43 UTC (rev 15662) @@ -1,11 +1,11 @@ /* * This file is part of the Jikes RVM project (http://jikesrvm.org). * - * This file is licensed to You under the Common Public License (CPL); + * This file is licensed to You under the Eclipse Public License (EPL); * You may not use this file except in compliance with the License. You * may obtain a copy of the License at * - * http://www.opensource.org/licenses/cpl1.0.php + * http://www.opensource.org/licenses/eclipse-1.0.php * * See the COPYRIGHT.txt file distributed with this work for information * regarding copyright ownership. Modified: rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Memory.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Memory.java 2009-04-24 14:02:49 UTC (rev 15661) +++ rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Memory.java 2009-04-24 15:00:43 UTC (rev 15662) @@ -1,11 +1,11 @@ /* * This file is part of the Jikes RVM project (http://jikesrvm.org). * - * This file is licensed to You under the Common Public License (CPL); + * This file is licensed to You under the Eclipse Public License (EPL); * You may not use this file except in compliance with the License. You * may obtain a copy of the License at * - * http://www.opensource.org/licenses/cpl1.0.php + * http://www.opensource.org/licenses/eclipse-1.0.php * * See the COPYRIGHT.txt file distributed with this work for information * regarding copyright ownership. Modified: rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ObjectModel.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ObjectModel.java 2009-04-24 14:02:49 UTC (rev 15661) +++ rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ObjectModel.java 2009-04-24 15:00:43 UTC (rev 15662) @@ -1,11 +1,11 @@ /* * This file is part of the Jikes RVM project (http://jikesrvm.org). * - * This file is licensed to You under the Common Public License (CPL); + * This file is licensed to You under the Eclipse Public License (EPL); * You may not use this file except in compliance with the License. You * may obtain a copy of the License at * - * http://www.opensource.org/licenses/cpl1.0.php + * http://www.opensource.org/licenses/eclipse-1.0.php * * See the COPYRIGHT.txt file distributed with this work for information * regarding copyright ownership. Modified: rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ReferenceProcessor.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ReferenceProcessor.java 2009-04-24 14:02:49 UTC (rev 15661) +++ rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ReferenceProcessor.java 2009-04-24 15:00:43 UTC (rev 15662) @@ -1,11 +1,11 @@ /* * This file is part of the Jikes RVM project (http://jikesrvm.org). * - * This file is licensed to You under the Common Public License (CPL); + * This file is licensed to You under the Eclipse Public License (EPL); * You may not use this file except in compliance with the License. You * may obtain a copy of the License at * - * http://www.opensource.org/licenses/cpl1.0.php + * http://www.opensource.org/licenses/eclipse-1.0.php * * See the COPYRIGHT.txt file distributed with this work for information * regarding copyright ownership. Modified: rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Scanning.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Scanning.java 2009-04-24 14:02:49 UTC (rev 15661) +++ rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Scanning.java 2009-04-24 15:00:43 UTC (rev 15662) @@ -1,11 +1,11 @@ /* * This file is part of the Jikes RVM project (http://jikesrvm.org). * - * This file is licensed to You under the Common Public License (CPL); + * This file is licensed to You under the Eclipse Public License (EPL); * You may not use this file except in compliance with the License. You * may obtain a copy of the License at * - * http://www.opensource.org/licenses/cpl1.0.php + * http://www.opensource.org/licenses/eclipse-1.0.php * * See the COPYRIGHT.txt file distributed with this work for information * regarding copyright ownership. Modified: rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Statistics.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Statistics.java 2009-04-24 14:02:49 UTC (rev 15661) +++ rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Statistics.java 2009-04-24 15:00:43 UTC (rev 15662) @@ -1,11 +1,11 @@ /* * This file is part of the Jikes RVM project (http://jikesrvm.org). * - * This file is licensed to You under the Common Public License (CPL); + * This file is licensed to You under the Eclipse Public License (EPL); * You may not use this file except in compliance with the License. You * may obtain a copy of the License at * - * http://www.opensource.org/licenses/cpl1.0.php + * http://www.opensource.org/licenses/eclipse-1.0.php * * See the COPYRIGHT.txt file distributed with this work for information * regarding copyright ownership. Modified: rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Strings.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Strings.java 2009-04-24 14:02:49 UTC (rev 15661) +++ rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Strings.java 2009-04-24 15:00:43 UTC (rev 15662) @@ -1,11 +1,11 @@ /* * This file is part of the Jikes RVM project (http://jikesrvm.org). * - * This file is licensed to You under the Common Public License (CPL); + * This file is licensed to You under the Eclipse Public License (EPL); * You may not use this file except in compliance with the License. You * may obtain a copy of the License at * - * http://www.opensource.org/licenses/cpl1.0.php + * http://www.opensource.org/licenses/eclipse-1.0.php * * See the COPYRIGHT.txt file distributed with this work for information * regarding copyright ownership. Modified: rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/SynchronizedCounter.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/SynchronizedCounter.java 2009-04-24 14:02:49 UTC (rev 15661) +++ rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/SynchronizedCounter.java 2009-04-24 15:00:43 UTC (rev 15662) @@ -1,11 +1,11 @@ /* * This file is part of the Jikes RVM project (http://jikesrvm.org). * - * This file is licensed to You under the Common Public License (CPL); + * This file is licensed to You under the Eclipse Public License (EPL); * You may not use this file except in compliance with the License. You * may obtain a copy of the License at * - * http://www.opensource.org/licenses/cpl1.0.php + * http://www.opensource.org/licenses/eclipse-1.0.php * * See the COPYRIGHT.txt file distributed with this work for information * regarding copyright ownership. Modified: rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/ActivePlan.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/ActivePlan.java 2009-04-24 14:02:49 UTC (rev 15661) +++ rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/ActivePlan.java 2009-04-24 15:00:43 UTC (rev 15662) @@ -1,11 +1,11 @@ /* * This file is part of the Jikes RVM project (http://jikesrvm.org). * - * This file is licensed to You under the Common Public License (CPL); + * This file is licensed to You under the Eclipse Public License (EPL); * You may not use this file except in compliance with the License. You * may obtain a copy of the License at * - * http://www.opensource.org/licenses/cpl1.0.php + * http://www.opensource.org/licenses/eclipse-1.0.php * * See the COPYRIGHT.txt file distributed with this work for information * regarding copyright ownership. Modified: rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Assert.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Assert.java 2009-04-24 14:02:49 UTC (rev 15661) +++ rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Assert.java 2009-04-24 15:00:43 UTC (rev 15662) @@ -1,11 +1,11 @@ /* * This file is part of the Jikes RVM project (http://jikesrvm.org). * - * This file is licensed to You under the Common Public License (CPL); + * This file is licensed to You under the Eclipse Public License (EPL); * You may not use this file except in compliance with the License. You * may obtain a copy of the License at * - * http://www.opensource.org/licenses/cpl1.0.php + * http://www.opensource.org/licenses/eclipse-1.0.php * * See the COPYRIGHT.txt file distributed with this work for information * regarding copyright ownership. Modified: rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Barriers.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Barriers.java 2009-04-24 14:02:49 UTC (rev 15661) +++ rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Barriers.java 2009-04-24 15:00:43 UTC (rev 15662) @@ -1,11 +1,11 @@ /* * This file is part of the Jikes RVM project (http://jikesrvm.org). * - * This file is licensed to You under the Common Public License (CPL); + * This file is licensed to You under the Eclipse Public License (EPL); * You may not use this file except in compliance with the License. You * may obtain a copy of the License at * - * http://www.opensource.org/licenses/cpl1.0.php + * http://www.opensource.org/licenses/eclipse-1.0.php * * See the COPYRIGHT.txt file distributed with this work for information * regarding copyright ownership. Modified: rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/BuildTimeConfig.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/BuildTimeConfig.java 2009-04-24 14:02:49 UTC (rev 15661) +++ rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/BuildTimeConfig.java 2009-04-24 15:00:43 UTC (rev 15662) @@ -1,11 +1,11 @@ /* * This file is part of the Jikes RVM project (http://jikesrvm.org). * - * This file is licensed to You under the Common Public License (CPL); + * This file is licensed to You under the Eclipse Public License (EPL); * You may not use this file except in compliance with the License. You * may obtain a copy of the License at * - * http://www.opensource.org/licenses/cpl1.0.php + * http://www.opensource.org/licenses/eclipse-1.0.php * * See the COPYRIGHT.txt file distributed with this work for information * regarding copyright ownership. Modified: rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Collection.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Collection.java 2009-04-24 14:02:49 UTC (rev 15661) +++ rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Collection.java 2009-04-24 15:00:43 UTC (rev 15662) @@ -1,11 +1,11 @@ /* * This file is part of the Jikes RVM project (http://jikesrvm.org). * - * This file is licensed to You under the Common Public License (CPL); + * This file is licensed to You under the Eclipse Public License (EPL); * You may not use this file except in compliance with the License. You * may obtain a copy of the License at * - * http://www.opensource.org/licenses/cpl1.0.php + * http://www.opensource.org/licenses/eclipse-1.0.php * * See the COPYRIGHT.txt file distributed with this work for information * regarding copyright ownership. Modified: rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Debug.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Debug.java 2009-04-24 14:02:49 UTC (rev 15661) +++ rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Debug.java 2009-04-24 15:00:43 UTC (rev 15662) @@ -1,11 +1,11 @@ /* * This file is part of the Jikes RVM project (http://jikesrvm.org). * - * This file is licensed to You under the Common Public License (CPL); + * This file is licensed to You under the Eclipse Public License (EPL); * You may not use this file except in compliance with the License. You * may obtain a copy of the License at * - * http://www.opensource.org/licenses/cpl1.0.php + * http://www.opensource.org/licenses/eclipse-1.0.php * * See the COPYRIGHT.txt file distributed with this work for information * regarding copyright ownership. Modified: rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Factory.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Factory.java 2009-04-24 14:02:49 UTC (rev 15661) +++ rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Factory.java 2009-04-24 15:00:43 UTC (rev 15662) @@ -1,11 +1,11 @@ /* * This file is part of the Jikes RVM project (http://jikesrvm.org). * - * This file is licensed to You under the Common Public License (CPL); + * This file is licensed to You under the Eclipse Public License (EPL); * You may not use this file except in compliance with the License. You * may obtain a copy of the License at * - * http://www.opensource.org/licenses/cpl1.0.php + * http://www.opensource.org/licenses/eclipse-1.0.php * * See the COPYRIGHT.txt file distributed with this work for information * regarding copyright ownership. Modified: rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/FinalizableProcessor.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/FinalizableProcessor.java 2009-04-24 14:02:49 UTC (rev 15661) +++ rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/FinalizableProcessor.java 2009-04-24 15:00:43 UTC (rev 15662) @@ -1,11 +1,11 @@ /* * This file is part of the Jikes RVM project (http://jikesrvm.org). * - * This file is licensed to You under the Common Public License (CPL); + * This file is licensed to You under the Eclipse Public License (EPL); * You may not use this file except in compliance with the License. You * may obtain a copy of the License at * - * http://www.opensource.org/licenses/cpl1.0.php + * http://www.opensource.org/licenses/eclipse-1.0.php * * See the COPYRIGHT.txt file distributed with this work for information * regarding copyright ownership. Modified: rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Lock.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Lock.java 2009-04-24 14:02:49 UTC (rev 15661) +++ rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Lock.java 2009-04-24 15:00:43 UTC (rev... [truncated message content] |
From: <ste...@us...> - 2009-09-19 02:55:03
|
Revision: 15786 http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=15786&view=rev Author: steveb-oss Date: 2009-09-19 02:54:48 +0000 (Sat, 19 Sep 2009) Log Message: ----------- Rename for clarity--thanks to Laurence Hellyer Modified Paths: -------------- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Barriers.java rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Barriers.java rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/GenMutator.java rvmroot/trunk/MMTk/src/org/mmtk/vm/Barriers.java Modified: rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Barriers.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Barriers.java 2009-09-19 02:11:41 UTC (rev 15785) +++ rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Barriers.java 2009-09-19 02:54:48 UTC (rev 15786) @@ -59,7 +59,7 @@ * @param unusedB Opaque, VM-specific, meta-data identifying the slot */ @Override - public void objectReferenceWrite(Address slot, ObjectReference target, Word unusedA, Word unusedB) { + public void objectReferenceNonHeapWrite(Address slot, ObjectReference target, Word unusedA, Word unusedB) { slot.store(target); } Modified: rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Barriers.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Barriers.java 2009-09-19 02:11:41 UTC (rev 15785) +++ rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Barriers.java 2009-09-19 02:54:48 UTC (rev 15786) @@ -59,7 +59,7 @@ * @param ref The object that has the reference field */ @Inline - public final void objectReferenceWrite(Address slot, ObjectReference target, Word unusedA, Word unusedB) { + public final void objectReferenceNonHeapWrite(Address slot, ObjectReference target, Word unusedA, Word unusedB) { slot.store(target); } Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/GenMutator.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/GenMutator.java 2009-09-19 02:11:41 UTC (rev 15785) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/GenMutator.java 2009-09-19 02:54:48 UTC (rev 15786) @@ -219,7 +219,7 @@ public final void objectReferenceNonHeapWrite(Address slot, ObjectReference tgt, Word metaDataA, Word metaDataB) { fastPath(slot, tgt); - VM.barriers.objectReferenceWrite(slot, tgt, metaDataA, metaDataB); + VM.barriers.objectReferenceNonHeapWrite(slot, tgt, metaDataA, metaDataB); } /** Modified: rvmroot/trunk/MMTk/src/org/mmtk/vm/Barriers.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/vm/Barriers.java 2009-09-19 02:11:41 UTC (rev 15785) +++ rvmroot/trunk/MMTk/src/org/mmtk/vm/Barriers.java 2009-09-19 02:54:48 UTC (rev 15786) @@ -49,7 +49,7 @@ * @param metaDataA Opaque, VM-specific, meta-data identifying the slot * @param metaDataB Opaque, VM-specific, meta-data identifying the slot */ - public abstract void objectReferenceWrite(Address slot, ObjectReference target, Word metaDataA, Word metaDataB); + public abstract void objectReferenceNonHeapWrite(Address slot, ObjectReference target, Word metaDataA, Word metaDataB); /** * Atomically write a reference field of an object or array and return This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rg...@us...> - 2010-05-21 06:17:46
|
Revision: 15841 http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=15841&view=rev Author: rgarner Date: 2010-05-21 06:17:39 +0000 (Fri, 21 May 2010) Log Message: ----------- Better support for testing MarkCompact Modified Paths: -------------- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ObjectModel.java rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Scanning.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Checker.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Compiler.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/PrettyPrinter.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Visitor.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Alloc.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/AllocUserOp.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/type/AbstractType.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/type/Type.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/type/TypeReference.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/type/UserTypeImpl.java rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/HarnessOptionSet.java Added Paths: ----------- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/TypeLiteral.java rvmroot/trunk/MMTk/harness/test-scripts/AlignedLists.options rvmroot/trunk/MMTk/harness/test-scripts/AlignedLists.script rvmroot/trunk/MMTk/harness/test-scripts/OneObject.script rvmroot/trunk/MMTk/harness/test-scripts/TwoObjects.script Removed Paths: ------------- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/AllocUserType.java Modified: rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ObjectModel.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ObjectModel.java 2010-05-14 06:34:31 UTC (rev 15840) +++ rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/ObjectModel.java 2010-05-21 06:17:39 UTC (rev 15841) @@ -28,6 +28,7 @@ import org.mmtk.plan.MutatorContext; import org.mmtk.plan.Plan; import org.mmtk.policy.Space; +import org.mmtk.utility.alloc.Allocator; import org.vmmagic.pragma.Uninterruptible; import org.vmmagic.unboxed.*; import org.vmmagic.unboxed.harness.ArchitecturalWord; @@ -417,7 +418,8 @@ */ @Override public Address copyTo(ObjectReference from, ObjectReference to, Address toRegion) { - if (Trace.isEnabled(Item.COLLECT) || isWatched(from)) { + boolean traceThisObject = Trace.isEnabled(Item.COLLECT) || isWatched(from); + if (traceThisObject) { Trace.printf(Item.COLLECT,"Copying object %s explicitly from %s/%s to %s/%s, region %s%n", objectIdString(from), from,Space.getSpaceForObject(from).getName(), to,Space.getSpaceForObject(to).getName(), @@ -431,29 +433,36 @@ int bytes = getSize(from); if (doCopy) { - Address fromRegion = from.toAddress(); + Address srcRegion = from.toAddress(); + Address dstRegion = to.toAddress(); for(int i=0; i < bytes; i += MemoryConstants.BYTES_IN_INT) { - int before=fromRegion.plus(i).loadInt(); - toRegion.plus(i).store(fromRegion.plus(i).loadInt()); - int after=toRegion.plus(i).loadInt(); - if (Trace.isEnabled(Item.COLLECT)) { + int before = srcRegion.plus(i).loadInt(); + dstRegion.plus(i).store(before); + int after = dstRegion.plus(i).loadInt(); + if (traceThisObject) { System.err.printf("copy %s/%08x -> %s/%08x%n", - fromRegion.plus(i),before,toRegion.plus(i),after); + srcRegion.plus(i),before,dstRegion.plus(i),after); } } - int status = toRegion.loadInt(STATUS_OFFSET); + int status = dstRegion.loadInt(STATUS_OFFSET); if ((status & HASHED_AND_MOVED) == HASHED) { - toRegion.store(status | HASHED_AND_MOVED, STATUS_OFFSET); - toRegion.store(getHashCode(from), Offset.fromIntZeroExtend(bytes)); + dstRegion.store(status | HASHED_AND_MOVED, STATUS_OFFSET); + dstRegion.store(getHashCode(from), Offset.fromIntZeroExtend(bytes)); bytes += MemoryConstants.BYTES_IN_WORD; } + Allocator.fillAlignmentGap(toRegion, dstRegion); + } else { + if (traceThisObject) { + Trace.printf(Item.COLLECT,"%s: no copy required%n", getString(from)); + } } - if (Trace.isEnabled(Item.COLLECT)) { + Address objectEndAddress = getObjectEndAddress(to); + if (traceThisObject) { dumpObjectHeader("After copy: ", to); } Sanity.assertValid(to); - return toRegion.plus(bytes); + return objectEndAddress; } /** Modified: rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Scanning.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Scanning.java 2010-05-14 06:34:31 UTC (rev 15840) +++ rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Scanning.java 2010-05-21 06:17:39 UTC (rev 15841) @@ -50,7 +50,7 @@ * @param m Calling mutator */ public static void initThreadIteratorTable(Mutator m) { - if (threadIteratorTable == null) { + if (Harness.allocDuringCollection.getValue() && threadIteratorTable == null) { threadIteratorTable = new ObjectValue(m.allocThreadIteratorTable()); } } Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Checker.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Checker.java 2010-05-14 06:34:31 UTC (rev 15840) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Checker.java 2010-05-21 06:17:39 UTC (rev 15841) @@ -17,33 +17,7 @@ import java.util.List; import org.mmtk.harness.lang.Trace.Item; -import org.mmtk.harness.lang.ast.AST; -import org.mmtk.harness.lang.ast.Alloc; -import org.mmtk.harness.lang.ast.AllocUserType; -import org.mmtk.harness.lang.ast.Assert; -import org.mmtk.harness.lang.ast.Assignment; -import org.mmtk.harness.lang.ast.BinaryExpression; -import org.mmtk.harness.lang.ast.Call; -import org.mmtk.harness.lang.ast.Constant; -import org.mmtk.harness.lang.ast.Empty; -import org.mmtk.harness.lang.ast.Expect; -import org.mmtk.harness.lang.ast.Expression; -import org.mmtk.harness.lang.ast.IfStatement; -import org.mmtk.harness.lang.ast.LoadField; -import org.mmtk.harness.lang.ast.LoadNamedField; -import org.mmtk.harness.lang.ast.Method; -import org.mmtk.harness.lang.ast.NormalMethod; -import org.mmtk.harness.lang.ast.Operator; -import org.mmtk.harness.lang.ast.PrintStatement; -import org.mmtk.harness.lang.ast.Return; -import org.mmtk.harness.lang.ast.Sequence; -import org.mmtk.harness.lang.ast.Spawn; -import org.mmtk.harness.lang.ast.Statement; -import org.mmtk.harness.lang.ast.StoreField; -import org.mmtk.harness.lang.ast.StoreNamedField; -import org.mmtk.harness.lang.ast.UnaryExpression; -import org.mmtk.harness.lang.ast.Variable; -import org.mmtk.harness.lang.ast.WhileStatement; +import org.mmtk.harness.lang.ast.*; import org.mmtk.harness.lang.parser.MethodTable; import org.mmtk.harness.lang.type.Field; import org.mmtk.harness.lang.type.Type; @@ -135,24 +109,33 @@ @Override public Object visit(Alloc alloc) { - if (!checkType(alloc.getRefCount(),Type.INT)) { - fail(alloc,"Allocation reference count must be integer"); - } - if (!checkType(alloc.getDataCount(),Type.INT)) { - fail(alloc,"Allocation data count must be integer"); - } - if (!checkType(alloc.getDoubleAlign(),Type.BOOLEAN)) { - fail(alloc,"Allocation double align must be boolean"); - } - return Type.OBJECT; - } + Type p1Type = getTypeOf(alloc.getArg(0)); - @Override - public Object visit(AllocUserType alloc) { - if (!alloc.getType().isObject() || alloc.getType() == Type.OBJECT) { - fail(alloc,"Can't allocate a %s using alloc(type)",alloc.getType().toString()); + if (p1Type.equals(Type.INT)) { + alloc.setTyped(false); + // untyped 'object' allocation - int,int[,boolean] + if (!checkType(alloc.getArg(1),Type.INT)) { + fail(alloc,"Allocation data count must be integer"); + } + if (alloc.numArgs() >= 3) { + if (!checkType(alloc.getArg(2),Type.BOOLEAN)) { + fail(alloc,"Allocation double align must be boolean"); + } + } + return Type.OBJECT; + } else if (p1Type.isUserType()) { + alloc.setTyped(true); + alloc.setType((UserType)p1Type); + if (alloc.numArgs() >= 2) { + if (!checkType(alloc.getArg(1),Type.BOOLEAN)) { + fail(alloc,"Allocation double align must be boolean"); + } + } + return p1Type; + } else { + fail(alloc,"Can't allocate a %s using alloc(...)",alloc.getType().toString()); + throw new AssertionError("this line is unreachable"); } - return alloc.getType(); } @Override @@ -369,6 +352,11 @@ } @Override + public Object visit(TypeLiteral type) { + return type.getType(); + } + + @Override public Object visit(UnaryExpression exp) { /* Unary operators preserve type */ Type type = getTypeOf(exp.getOperand()); Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Compiler.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Compiler.java 2010-05-14 06:34:31 UTC (rev 15840) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Compiler.java 2010-05-21 06:17:39 UTC (rev 15841) @@ -18,58 +18,14 @@ import org.mmtk.harness.Harness; import org.mmtk.harness.lang.Trace.Item; -import org.mmtk.harness.lang.ast.AST; -import org.mmtk.harness.lang.ast.Alloc; -import org.mmtk.harness.lang.ast.AllocUserType; -import org.mmtk.harness.lang.ast.Assert; -import org.mmtk.harness.lang.ast.Assignment; -import org.mmtk.harness.lang.ast.BinaryExpression; -import org.mmtk.harness.lang.ast.Call; -import org.mmtk.harness.lang.ast.Constant; -import org.mmtk.harness.lang.ast.Empty; -import org.mmtk.harness.lang.ast.Expect; -import org.mmtk.harness.lang.ast.Expression; -import org.mmtk.harness.lang.ast.IfStatement; -import org.mmtk.harness.lang.ast.IntrinsicMethod; -import org.mmtk.harness.lang.ast.LoadField; -import org.mmtk.harness.lang.ast.LoadNamedField; -import org.mmtk.harness.lang.ast.Method; -import org.mmtk.harness.lang.ast.NormalMethod; -import org.mmtk.harness.lang.ast.PrintStatement; -import org.mmtk.harness.lang.ast.Return; -import org.mmtk.harness.lang.ast.Sequence; -import org.mmtk.harness.lang.ast.Statement; -import org.mmtk.harness.lang.ast.Spawn; -import org.mmtk.harness.lang.ast.StoreField; -import org.mmtk.harness.lang.ast.StoreNamedField; -import org.mmtk.harness.lang.ast.UnaryExpression; -import org.mmtk.harness.lang.ast.Variable; -import org.mmtk.harness.lang.ast.WhileStatement; +import org.mmtk.harness.lang.ast.*; import org.mmtk.harness.lang.compiler.CompiledMethod; import org.mmtk.harness.lang.compiler.CompiledMethodProxy; import org.mmtk.harness.lang.compiler.CompiledMethodTable; import org.mmtk.harness.lang.compiler.Register; import org.mmtk.harness.lang.compiler.Temporary; import org.mmtk.harness.lang.parser.MethodTable; -import org.mmtk.harness.lang.pcode.AllocOp; -import org.mmtk.harness.lang.pcode.AllocUserOp; -import org.mmtk.harness.lang.pcode.BinaryOperation; -import org.mmtk.harness.lang.pcode.Branch; -import org.mmtk.harness.lang.pcode.CallIntrinsicOp; -import org.mmtk.harness.lang.pcode.CallNormalOp; -import org.mmtk.harness.lang.pcode.ExitOp; -import org.mmtk.harness.lang.pcode.ExpectOp; -import org.mmtk.harness.lang.pcode.Goto; -import org.mmtk.harness.lang.pcode.LoadFieldOp; -import org.mmtk.harness.lang.pcode.LoadFixedFieldOp; -import org.mmtk.harness.lang.pcode.PrintOp; -import org.mmtk.harness.lang.pcode.PseudoOp; -import org.mmtk.harness.lang.pcode.ReturnOp; -import org.mmtk.harness.lang.pcode.SpawnOp; -import org.mmtk.harness.lang.pcode.StoreFieldOp; -import org.mmtk.harness.lang.pcode.StoreFixedFieldOp; -import org.mmtk.harness.lang.pcode.StoreLocal; -import org.mmtk.harness.lang.pcode.UnaryOperation; +import org.mmtk.harness.lang.pcode.*; import org.mmtk.harness.lang.runtime.ConstantPool; import org.mmtk.harness.lang.type.Field; import org.mmtk.harness.lang.type.Type; @@ -162,24 +118,28 @@ @Override public Object visit(Alloc alloc) { - Register dataCount = compile(alloc.getDataCount()); - Register refCount = compile(alloc.getRefCount()); - Register doubleAlign = compile(alloc.getDoubleAlign()); Register result = temps.acquire(); - emit(new AllocOp(alloc,result,dataCount,refCount,doubleAlign,alloc.getSite())); - temps.release(dataCount,refCount,doubleAlign); + Register doubleAlign = ConstantPool.FALSE; + if (alloc.isTyped()) { + UserType type = alloc.getType(); + if (alloc.numArgs() >= 2) { + doubleAlign = compile(alloc.getArg(1)); + } + emit(new AllocUserOp(alloc,result,type,doubleAlign,alloc.getSite())); + temps.release(doubleAlign); + } else { + Register refCount = compile(alloc.getArg(0)); + Register dataCount = compile(alloc.getArg(1)); + if (alloc.numArgs() >= 3) { + doubleAlign = compile(alloc.getArg(2)); + } + emit(new AllocOp(alloc,result,dataCount,refCount,doubleAlign,alloc.getSite())); + temps.release(dataCount,refCount,doubleAlign); + } return result; } @Override - public Object visit(AllocUserType alloc) { - UserType type = (UserType)alloc.getType(); - Register result = temps.acquire(); - emit(new AllocUserOp(alloc,result,type,false,alloc.getSite())); - return result; - } - - @Override public Object visit(Assert ass) { Register predicate = compile(ass.getPredicate()); Branch branch = new Branch(ass,predicate,true); @@ -367,6 +327,11 @@ } @Override + public Object visit(TypeLiteral type) { + throw new UnsupportedOperationException(); + } + + @Override public Object visit(UnaryExpression exp) { Register operand = compile(exp.getOperand()); Register result = temps.acquire(); Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/PrettyPrinter.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/PrettyPrinter.java 2010-05-14 06:34:31 UTC (rev 15840) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/PrettyPrinter.java 2010-05-21 06:17:39 UTC (rev 15841) @@ -21,7 +21,6 @@ import org.mmtk.harness.Harness; import org.mmtk.harness.lang.ast.AST; import org.mmtk.harness.lang.ast.Alloc; -import org.mmtk.harness.lang.ast.AllocUserType; import org.mmtk.harness.lang.ast.Assert; import org.mmtk.harness.lang.ast.Assignment; import org.mmtk.harness.lang.ast.Call; @@ -40,6 +39,7 @@ import org.mmtk.harness.lang.ast.Statement; import org.mmtk.harness.lang.ast.StoreField; import org.mmtk.harness.lang.ast.StoreNamedField; +import org.mmtk.harness.lang.ast.TypeLiteral; import org.mmtk.harness.lang.ast.Variable; import org.mmtk.harness.lang.ast.WhileStatement; import org.mmtk.harness.lang.parser.MethodTable; @@ -314,24 +314,20 @@ @Override public Object visit(Alloc alloc) { fmt.out("alloc("); - alloc.getDataCount().accept(this); - fmt.out(","); - alloc.getRefCount().accept(this); - if (alloc.getDoubleAlign() != null) { - fmt.out(","); - alloc.getDoubleAlign().accept(this); + final int nArgs = alloc.numArgs(); + for (int i=0; i < nArgs; i++) { + Expression arg = alloc.getArg(i); + arg.accept(this); + if (i < nArgs-1) { + fmt.out(","); + } else { + fmt.out(")"); + } } - fmt.out(")"); return null; } @Override - public Object visit(AllocUserType alloc) { - fmt.out("alloc(%s)",alloc.getType()); - return null; - } - - @Override public Object visit(Spawn spawn) { fmt.out("spawn"); String separator = "("; @@ -343,6 +339,11 @@ return null; } + @Override + public Object visit(TypeLiteral type) { + fmt.out(type.getType().toString()); + return null; + } /******************************************************************* * Utility methods Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Visitor.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Visitor.java 2010-05-14 06:34:31 UTC (rev 15840) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/Visitor.java 2010-05-21 06:17:39 UTC (rev 15841) @@ -14,7 +14,6 @@ import org.mmtk.harness.lang.ast.AST; import org.mmtk.harness.lang.ast.Alloc; -import org.mmtk.harness.lang.ast.AllocUserType; import org.mmtk.harness.lang.ast.Assert; import org.mmtk.harness.lang.ast.Assignment; import org.mmtk.harness.lang.ast.BinaryExpression; @@ -38,6 +37,7 @@ import org.mmtk.harness.lang.ast.Statement; import org.mmtk.harness.lang.ast.StoreField; import org.mmtk.harness.lang.ast.StoreNamedField; +import org.mmtk.harness.lang.ast.TypeLiteral; import org.mmtk.harness.lang.ast.UnaryExpression; import org.mmtk.harness.lang.ast.Variable; import org.mmtk.harness.lang.ast.WhileStatement; @@ -50,14 +50,11 @@ public Object visit(AST ast) { return ast; } public Object visit(Alloc alloc) { - alloc.getDataCount().accept(this); - alloc.getRefCount().accept(this); - alloc.getDoubleAlign().accept(this); + for (Expression arg : alloc.getArgs()) { + arg.accept(this); + } return alloc; } - public Object visit(AllocUserType alloc) { - return alloc; - } public Object visit(Assert ass) { ass.getPredicate().accept(this); for (AST a : ass.getOutputs()) { @@ -158,6 +155,9 @@ store.getRhs().accept(this); return store; } + public Object visit(TypeLiteral type) { + return type; + } public Object visit(UnaryExpression exp) { exp.getOperator().accept(this); exp.getOperand().accept(this); Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Alloc.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Alloc.java 2010-05-14 06:34:31 UTC (rev 15840) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/Alloc.java 2010-05-21 06:17:39 UTC (rev 15841) @@ -12,8 +12,11 @@ */ package org.mmtk.harness.lang.ast; +import java.util.List; + import org.mmtk.harness.lang.Visitor; import org.mmtk.harness.lang.parser.Token; +import org.mmtk.harness.lang.type.UserType; /** * AST node for the general alloc(refs,nonrefs,align) allocation method @@ -21,27 +24,34 @@ public class Alloc extends AbstractAST implements Expression { /** Call site ID */ private final int site; - /** Number of reference fields */ - private final Expression refCount; - /** Number of data fields */ - private final Expression dataCount; - /** Double align the object? */ - private final Expression doubleAlign; + /** arguments - there are a couple of variants of 'alloc' */ + private final List<Expression> args; + /** + * During semantic analysis, we decide what kind of allocation request this is, + * and set this flag to show which. null indicates that analysis hasn't yet happened. + */ + private Boolean typedAlloc = null; + + /** + * The result type - only available if typedAlloc == true + */ + private UserType type = null; + + /** * Allocate an object. + * * @param t The parser token for this node * @param site A unique site ID * @param refCount Integer expression - number of reference fields * @param dataCount Integer expression - number of data fields * @param doubleAlign Boolean expression - whether to 8-byte align */ - public Alloc(Token t, int site, Expression refCount, Expression dataCount, Expression doubleAlign) { + public Alloc(Token t, int site, List<Expression> args) { super(t); this.site = site; - this.refCount = refCount; - this.dataCount = dataCount; - this.doubleAlign = doubleAlign; + this.args = args; } /** @see org.mmtk.harness.lang.ast.AbstractAST#accept(org.mmtk.harness.lang.Visitor) */ @@ -50,14 +60,44 @@ return v.visit(this); } + public void setTyped(boolean isTyped) { + assert typedAlloc == null; + typedAlloc = isTyped; + } + + public boolean isTyped() { + assert typedAlloc != null : "Semantic analysis has not yet been run!"; + return typedAlloc; + } + + public void setType(UserType type) { + assert typedAlloc; + this.type = type; + } + /** * @return The allocation site number */ - public int getSite() { return site; } + public int getSite() { + return site; + } + /** @return refCount */ - public Expression getRefCount() { return refCount; } - /** @return dataCount */ - public Expression getDataCount() { return dataCount; } - /** @return doubleAlign */ - public Expression getDoubleAlign() { return doubleAlign; } + public Expression getArg(int i) { + return args.get(i); + } + + /** Get # args */ + public int numArgs() { + return args.size(); + } + + public List<Expression> getArgs() { + return args; + } + + public UserType getType() { + assert typedAlloc; + return type; + } } Deleted: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/AllocUserType.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/AllocUserType.java 2010-05-14 06:34:31 UTC (rev 15840) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/AllocUserType.java 2010-05-21 06:17:39 UTC (rev 15841) @@ -1,51 +0,0 @@ -/* - * This file is part of the Jikes RVM project (http://jikesrvm.org). - * - * This file is licensed to You under the Eclipse Public License (EPL); - * You may not use this file except in compliance with the License. You - * may obtain a copy of the License at - * - * http://www.opensource.org/licenses/eclipse-1.0.php - * - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. - */ -package org.mmtk.harness.lang.ast; - -import org.mmtk.harness.lang.Visitor; -import org.mmtk.harness.lang.parser.Token; -import org.mmtk.harness.lang.type.Type; - -/** - * Allocation of a user-defined type. - */ -public class AllocUserType extends AbstractAST implements Expression { - /** Call site ID */ - private final int site; - /** The type to allocate */ - private final Type type; - - /** - * Allocate an object. - * @param t The source token - * @param site The allocation site ID - * @param type The type to allocate - */ - public AllocUserType(Token t, int site, Type type) { - super(t); - this.site = site; - this.type = type; - } - - /** @see org.mmtk.harness.lang.ast.AbstractAST#accept(org.mmtk.harness.lang.Visitor) */ - @Override - public Object accept(Visitor v) { - return v.visit(this); - } - - /** @return The call site */ - public int getSite() { return site; } - - /** @return The type of the allocated object */ - public Type getType() { return type; } -} Added: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/TypeLiteral.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/TypeLiteral.java (rev 0) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/ast/TypeLiteral.java 2010-05-21 06:17:39 UTC (rev 15841) @@ -0,0 +1,40 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Eclipse Public License (EPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/eclipse-1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ +package org.mmtk.harness.lang.ast; + +import org.mmtk.harness.lang.Visitor; +import org.mmtk.harness.lang.parser.Token; +import org.mmtk.harness.lang.type.Type; + +/** + * A literal type name, used as an argument to (eg) the alloc function. + */ +public class TypeLiteral extends AbstractAST implements Expression { + + /** The type of the literal */ + private final Type type; + + public TypeLiteral(Token t, Type type) { + super(t); + this.type = type; + } + + @Override + public Object accept(Visitor v) { + return v.visit(this); + } + + public Type getType() { + return type; + } +} Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/AllocUserOp.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/AllocUserOp.java 2010-05-14 06:34:31 UTC (rev 15840) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/pcode/AllocUserOp.java 2010-05-21 06:17:39 UTC (rev 15841) @@ -31,13 +31,12 @@ * - alignment * Always produces a result. */ -public final class AllocUserOp extends NullaryOp { +public final class AllocUserOp extends UnaryOp { /** Call site */ private final int site; private final int dataCount; private final int refCount; - private final boolean doubleAlign; private final Type type; /** @@ -48,14 +47,17 @@ * @param doubleAlign Does the object require double-word alignment ? * @param site Call site identifier */ - public AllocUserOp(AST source, Register resultTemp, UserType type, boolean doubleAlign, int site) { - super(source,"alloc",resultTemp); + public AllocUserOp(AST source, Register resultTemp, UserType type, Register doubleAlign, int site) { + super(source,"alloc",resultTemp,doubleAlign); this.site = site; this.dataCount = type.dataFieldCount(); this.refCount = type.referenceFieldCount(); - this.doubleAlign = doubleAlign; this.type = type; } + /** Get the alignment operand from <code>frame</code> */ + private boolean getDoubleAlign(StackFrame frame) { + return frame.get(operand).getBoolValue(); + } /** * @see PseudoOp#exec(Env) @@ -65,12 +67,12 @@ StackFrame frame = env.top(); ObjectReference object; try { - object = env.alloc(refCount, dataCount, doubleAlign,site); + object = env.alloc(refCount, dataCount, getDoubleAlign(frame), site); } catch (OutOfMemory e) { throw e; } catch (Exception e) { throw new RuntimeException("Error allocating object id:"+ObjectModel.lastObjectId()+" refs:"+refCount+ - " ints: "+dataCount+" align:"+doubleAlign+" site:"+site,e); + " ints: "+dataCount+" align:"+getDoubleAlign(frame)+" site:"+site,e); } setResult(frame,new ObjectValue(object)); if (Harness.gcEveryAlloc()) { Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/type/AbstractType.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/type/AbstractType.java 2010-05-14 06:34:31 UTC (rev 15840) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/type/AbstractType.java 2010-05-21 06:17:39 UTC (rev 15841) @@ -51,6 +51,14 @@ } /** + * @see org.mmtk.harness.lang.type.Type#isUserType() + */ + @Override + public boolean isUserType() { + return false; + } + + /** * @see org.mmtk.harness.lang.type.Type#isCompatibleWith(org.mmtk.harness.lang.type.Type) */ public boolean isCompatibleWith(Type rhs) { Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/type/Type.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/type/Type.java 2010-05-14 06:34:31 UTC (rev 15840) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/type/Type.java 2010-05-21 06:17:39 UTC (rev 15841) @@ -53,4 +53,7 @@ /** @return is this an object type (as opposed to a primitive) */ boolean isObject(); + + /** @return is this user-defined (as opposed to built-in) */ + boolean isUserType(); } Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/type/TypeReference.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/type/TypeReference.java 2010-05-14 06:34:31 UTC (rev 15840) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/type/TypeReference.java 2010-05-21 06:17:39 UTC (rev 15841) @@ -34,7 +34,7 @@ this.table = table; this.name = name; // CHECKSTYLE:OFF - assert name != "int" && name != "boolean" && name != "string" && name != "void" + assert name != "int" && name != "boolean" && name != "string" && name != "void" && name != "weakref"; // CHECKSTYLE:ON } @@ -111,4 +111,9 @@ return resolve().getToken(); } + @Override + public boolean isUserType() { + return true; + } + } Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/type/UserTypeImpl.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/type/UserTypeImpl.java 2010-05-14 06:34:31 UTC (rev 15840) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/lang/type/UserTypeImpl.java 2010-05-21 06:17:39 UTC (rev 15841) @@ -96,6 +96,11 @@ return true; } + @Override + public boolean isUserType() { + return true; + } + /* * Delegate AST-nature to the 'ast' object */ Modified: rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/HarnessOptionSet.java =================================================================== --- rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/HarnessOptionSet.java 2010-05-14 06:34:31 UTC (rev 15840) +++ rvmroot/trunk/MMTk/harness/src/org/mmtk/harness/options/HarnessOptionSet.java 2010-05-21 06:17:39 UTC (rev 15841) @@ -107,7 +107,7 @@ return false; case Option.ADDRESS_OPTION: try { - int ival = Integer.parseInt(value); + int ival = Integer.parseInt(value,16); ((AddressOption)o).setValue(ival); return true; } catch (NumberFormatException nfe) {} Added: rvmroot/trunk/MMTk/harness/test-scripts/AlignedLists.options =================================================================== --- rvmroot/trunk/MMTk/harness/test-scripts/AlignedLists.options (rev 0) +++ rvmroot/trunk/MMTk/harness/test-scripts/AlignedLists.options 2010-05-21 06:17:39 UTC (rev 15841) @@ -0,0 +1 @@ +initHeap=5m Added: rvmroot/trunk/MMTk/harness/test-scripts/AlignedLists.script =================================================================== --- rvmroot/trunk/MMTk/harness/test-scripts/AlignedLists.script (rev 0) +++ rvmroot/trunk/MMTk/harness/test-scripts/AlignedLists.script 2010-05-21 06:17:39 UTC (rev 15841) @@ -0,0 +1,158 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Eclipse Public License (EPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/eclipse-1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ + + +/* + * This script is designed to work-out the write barriers in a generational + * collector. + * + * Initially we create a series of doubly-linked lists of length + * 1,2,4,...,2^15, then iterate adding elements to the front and + * dropping them off the end. At steady state we should have the + * list-heads in the mature space, the shorter lists entirely + * in the nursery, and longer lists with the head in + * the nursery and the tail in the mature space. + * + * This script differs from Lists in that roughly half of the objects + * are 64-bit aligned. + */ + +/* A cell in a linked list */ +type cell { + cell next; + cell prev; +} + +/* A list head - points to the head and tail */ +type list { + cell head; + cell tail; +} + +/* A singly-linked list, so we can provide a chain of pointers stack -> nursery -> mature */ +type single { + single next; +} + +void main() { + int nLists = 15; + int rotations = 10000; + object lists = alloc(nLists,0,false); + single s = alloc(single); + + // Create the lists + int i=0; + int n=1; + while (i < nLists) { + print( "Creating list of length ",n); + lists.object[i] = create(n); + i = i + 1; + n = n * 2; + } + gc(); + + // Rotate them + print ("Rotating lists"); + int j = 0; + while (j < rotations) { + i = 0; + while (i < nLists) { + rotate(lists.object[i],(j%2) == 1); + i = i + 1; + } + //if ( (j%1000) == 0 ) { + // lengths(lists,nLists); + //} + s = cons(s,(j%2) == 1); + j = j + 1; + } +} + +/* + * Create a list of length n + */ +list create(int n) { + list result = alloc(list,n > 255); + while (n > 0) { + insert(result,(n%2) == 0); + n = n - 1; + } + return result; +} + +/* + * Insert a cell at the head of a list + */ +void insert(list l, boolean align) { + cell c = alloc(cell,align); + if (l.head == null) { + l.head = c; + l.tail = c; + return; + } + cell head = l.head; // Language doesn't (yet) support x.y.z + c.next = head; + head.prev = c; + l.head = c; +} + +/* + * Insert a cell at the head, and remove one from the tail + * of a list + */ +void rotate(list l, boolean align) { + insert(l,align); + cell tail = l.tail; + cell prev = tail.prev; + l.tail = prev; + prev.next = null; // Kill the last element +} + +/* + * Print the lengths of an array of lists + */ +void lengths(object lists, int n) { + int i=0; + while (i < n) { + print("List has length ", length(lists.object[i])); + i = i + 1; + } +} + +/* + * Return the length of a list + */ +int length(list l) { + if (l == null) { + return 0; + } elif (l.head == null) { + return 0; + } + cell c = l.head; + int n = 0; + while (c != null) { + c = c.next; + n = n + 1; + } + return n; +} + +/* + * Prepend a singly-linked list cell onto a list + */ +single cons(single l, boolean align) { + single result = alloc(single,align); + result.next = l; + return result; +} + Added: rvmroot/trunk/MMTk/harness/test-scripts/OneObject.script =================================================================== --- rvmroot/trunk/MMTk/harness/test-scripts/OneObject.script (rev 0) +++ rvmroot/trunk/MMTk/harness/test-scripts/OneObject.script 2010-05-21 06:17:39 UTC (rev 15841) @@ -0,0 +1,33 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Eclipse Public License (EPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/eclipse-1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ + +/* + * Allocate a single object and collect twice. + * + * Remove the reference, and collect again. + * + * Note that due to shortcomings in the scripting engine (it has no liveness + * analysis), returning from a function is the only way to guarantee + * removal of any dangling references. (RJG - 27 May 2010) + */ +void main() { + create(); + gc(); +} + +void create() { + object o = alloc(1,1); + gc(); + gc(); +} + Added: rvmroot/trunk/MMTk/harness/test-scripts/TwoObjects.script =================================================================== --- rvmroot/trunk/MMTk/harness/test-scripts/TwoObjects.script (rev 0) +++ rvmroot/trunk/MMTk/harness/test-scripts/TwoObjects.script 2010-05-21 06:17:39 UTC (rev 15841) @@ -0,0 +1,44 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Eclipse Public License (EPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/eclipse-1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ + +/* + * Allocate a single object and collect. Allocate a second one and collect. + * Delete the second one, then the first one. + * + * Then do it in the reveres order. + */ +void main() { + one_first(); + gc(); + one_second(); + gc(); +} + +void one_first() { + object o = alloc(1,1); + gc(); + two(); + gc(); +} + +void one_second() { + two(); + object o = alloc(1,1); + gc(); +} + +void two() { + object o = alloc(2,2); + gc(); +} + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ste...@us...> - 2010-05-26 06:18:05
|
Revision: 15846 http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=15846&view=rev Author: steveb-oss Date: 2010-05-26 06:17:58 +0000 (Wed, 26 May 2010) Log Message: ----------- Improve debugging output Modified Paths: -------------- rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Assert.java rvmroot/trunk/MMTk/src/org/mmtk/utility/heap/Mmapper.java Modified: rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Assert.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Assert.java 2010-05-21 08:16:12 UTC (rev 15845) +++ rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Assert.java 2010-05-26 06:17:58 UTC (rev 15846) @@ -42,6 +42,8 @@ * @param message the string to log */ public final void fail(String message) { + Space.printUsagePages(); + Space.printUsageMB(); VM.sysFail(message); } Modified: rvmroot/trunk/MMTk/src/org/mmtk/utility/heap/Mmapper.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/utility/heap/Mmapper.java 2010-05-21 08:16:12 UTC (rev 15845) +++ rvmroot/trunk/MMTk/src/org/mmtk/utility/heap/Mmapper.java 2010-05-26 06:17:58 UTC (rev 15846) @@ -129,7 +129,7 @@ lock.release(); Log.write("ensureMapped failed with errno "); Log.write(errno); Log.write(" on address "); Log.writeln(mmapStart); - if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + VM.assertions.fail("Can't get more space with mmap()"); } else { if (verbose) { Log.write("mmap succeeded at chunk "); Log.write(chunk); Log.write(" "); Log.write(mmapStart); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dfr...@us...> - 2010-09-22 06:20:07
|
Revision: 15997 http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=15997&view=rev Author: dframpton-oss Date: 2010-09-22 06:19:58 +0000 (Wed, 22 Sep 2010) Log Message: ----------- Significant change to accounting code. Still to be reviewed/refined but should reduce some of the current out of memory issues, and make our accounting more accurate in general. Modified Paths: -------------- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Memory.java rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Memory.java rvmroot/trunk/MMTk/src/org/mmtk/plan/GCspyPlan.java rvmroot/trunk/MMTk/src/org/mmtk/plan/Plan.java rvmroot/trunk/MMTk/src/org/mmtk/plan/concurrent/marksweep/CMS.java rvmroot/trunk/MMTk/src/org/mmtk/plan/copyms/CopyMS.java rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/Gen.java rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/GenMutator.java rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/copying/GenCopy.java rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/immix/GenImmix.java rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/marksweep/GenMS.java rvmroot/trunk/MMTk/src/org/mmtk/plan/immix/Immix.java rvmroot/trunk/MMTk/src/org/mmtk/plan/markcompact/MC.java rvmroot/trunk/MMTk/src/org/mmtk/plan/marksweep/MS.java rvmroot/trunk/MMTk/src/org/mmtk/plan/nogc/NoGC.java rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/RCBase.java rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/generational/GenRC.java rvmroot/trunk/MMTk/src/org/mmtk/plan/semispace/SS.java rvmroot/trunk/MMTk/src/org/mmtk/plan/semispace/gctrace/GCTrace.java rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyimmix/StickyImmix.java rvmroot/trunk/MMTk/src/org/mmtk/policy/BaseLargeObjectSpace.java rvmroot/trunk/MMTk/src/org/mmtk/policy/CopySpace.java rvmroot/trunk/MMTk/src/org/mmtk/policy/ExplicitFreeListSpace.java rvmroot/trunk/MMTk/src/org/mmtk/policy/ExplicitLargeObjectSpace.java rvmroot/trunk/MMTk/src/org/mmtk/policy/ImmortalSpace.java rvmroot/trunk/MMTk/src/org/mmtk/policy/LargeObjectSpace.java rvmroot/trunk/MMTk/src/org/mmtk/policy/MarkCompactSpace.java rvmroot/trunk/MMTk/src/org/mmtk/policy/MarkSweepSpace.java rvmroot/trunk/MMTk/src/org/mmtk/policy/RawPageSpace.java rvmroot/trunk/MMTk/src/org/mmtk/policy/SegregatedFreeListSpace.java rvmroot/trunk/MMTk/src/org/mmtk/policy/Space.java rvmroot/trunk/MMTk/src/org/mmtk/policy/immix/Defrag.java rvmroot/trunk/MMTk/src/org/mmtk/policy/immix/ImmixSpace.java rvmroot/trunk/MMTk/src/org/mmtk/utility/alloc/Allocator.java rvmroot/trunk/MMTk/src/org/mmtk/utility/alloc/EmbeddedMetaData.java rvmroot/trunk/MMTk/src/org/mmtk/utility/heap/FreeListPageResource.java rvmroot/trunk/MMTk/src/org/mmtk/utility/heap/MonotonePageResource.java rvmroot/trunk/MMTk/src/org/mmtk/utility/heap/PageResource.java rvmroot/trunk/MMTk/src/org/mmtk/utility/options/StressFactor.java Modified: rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Memory.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Memory.java 2010-09-22 05:47:44 UTC (rev 15996) +++ rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Memory.java 2010-09-22 06:19:58 UTC (rev 15997) @@ -66,7 +66,7 @@ @Interruptible public ImmortalSpace getVMSpace() { if (vmSpace == null) { - vmSpace = new ImmortalSpace("vm", 0, VMRequest.create(VMSPACE_SIZE, false)); + vmSpace = new ImmortalSpace("vm", VMRequest.create(VMSPACE_SIZE, false)); } return vmSpace; } Modified: rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Memory.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Memory.java 2010-09-22 05:47:44 UTC (rev 15996) +++ rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Memory.java 2010-09-22 06:19:58 UTC (rev 15997) @@ -12,7 +12,6 @@ */ package org.jikesrvm.mm.mmtk; -import org.mmtk.plan.Plan; import org.mmtk.policy.ImmortalSpace; import org.mmtk.utility.Constants; import org.mmtk.utility.heap.VMRequest; @@ -69,7 +68,7 @@ @Interruptible public final ImmortalSpace getVMSpace() { if (bootSpace == null) { - bootSpace = new ImmortalSpace("boot", Plan.DEFAULT_POLL_FREQUENCY, VMRequest.create(BOOT_SEGMENT_MB)); + bootSpace = new ImmortalSpace("boot", VMRequest.create(BOOT_SEGMENT_MB)); } return bootSpace; } Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/GCspyPlan.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/GCspyPlan.java 2010-09-22 05:47:44 UTC (rev 15996) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/GCspyPlan.java 2010-09-22 06:19:58 UTC (rev 15997) @@ -24,8 +24,7 @@ * Any GCspy objects allocated after booting are allocated * in a separate immortal space. */ - ImmortalSpace gcspySpace = - new ImmortalSpace("gcspy", Plan.DEFAULT_POLL_FREQUENCY, VMRequest.create()); + ImmortalSpace gcspySpace = new ImmortalSpace("gcspy", VMRequest.create()); /** The descriptor for the GCspy allocation space */ int GCSPY = gcspySpace.getDescriptor(); Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/Plan.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/Plan.java 2010-09-22 05:47:44 UTC (rev 15996) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/Plan.java 2010-09-22 06:19:58 UTC (rev 15997) @@ -65,10 +65,6 @@ public static final int GC_PREPARE = 1; // before setup and obtaining root public static final int GC_PROPER = 2; - /* Polling */ - public static final int DEFAULT_POLL_FREQUENCY = (128 << 10) >> LOG_BYTES_IN_PAGE; - public static final int META_DATA_POLL_FREQUENCY = DEFAULT_POLL_FREQUENCY; - /* Space Size Constants. */ public static final boolean USE_CODE_SPACE = true; public static final int HEAP_FULL_MINIMUM = (1 << 17) >> LOG_BYTES_IN_PAGE; // 128K @@ -113,22 +109,22 @@ public static final Space vmSpace = VM.memory.getVMSpace(); /** Any immortal objects allocated after booting are allocated here. */ - public static final ImmortalSpace immortalSpace = new ImmortalSpace("immortal", DEFAULT_POLL_FREQUENCY, VMRequest.create()); + public static final ImmortalSpace immortalSpace = new ImmortalSpace("immortal", VMRequest.create()); /** All meta data that is used by MMTk is allocated (and accounted for) in the meta data space. */ - public static final RawPageSpace metaDataSpace = new RawPageSpace("meta", DEFAULT_POLL_FREQUENCY, VMRequest.create()); + public static final RawPageSpace metaDataSpace = new RawPageSpace("meta", VMRequest.create()); /** Large objects are allocated into a special large object space. */ - public static final LargeObjectSpace loSpace = new LargeObjectSpace("los", DEFAULT_POLL_FREQUENCY, VMRequest.create()); + public static final LargeObjectSpace loSpace = new LargeObjectSpace("los", VMRequest.create()); /** Space used by the sanity checker (used at runtime only if sanity checking enabled */ - public static final RawPageSpace sanitySpace = new RawPageSpace("sanity", Integer.MAX_VALUE, VMRequest.create()); + public static final RawPageSpace sanitySpace = new RawPageSpace("sanity", VMRequest.create()); /** Space used to allocate objects that cannot be moved. we do not need a large space as the LOS is non-moving. */ - public static final MarkSweepSpace nonMovingSpace = new MarkSweepSpace("non-moving", DEFAULT_POLL_FREQUENCY, VMRequest.create()); + public static final MarkSweepSpace nonMovingSpace = new MarkSweepSpace("non-moving", VMRequest.create()); - public static final MarkSweepSpace smallCodeSpace = USE_CODE_SPACE ? new MarkSweepSpace("sm-code", DEFAULT_POLL_FREQUENCY, VMRequest.create()) : null; - public static final LargeObjectSpace largeCodeSpace = USE_CODE_SPACE ? new LargeObjectSpace("lg-code", DEFAULT_POLL_FREQUENCY, VMRequest.create()) : null; + public static final MarkSweepSpace smallCodeSpace = USE_CODE_SPACE ? new MarkSweepSpace("sm-code", VMRequest.create()) : null; + public static final LargeObjectSpace largeCodeSpace = USE_CODE_SPACE ? new LargeObjectSpace("lg-code", VMRequest.create()) : null; /* Space descriptors */ public static final int IMMORTAL = immortalSpace.getDescriptor(); @@ -562,6 +558,11 @@ Log.write(" MB ("); Log.write(getPagesReserved()); Log.write(" pgs)"); + Log.write(" used = "); + Log.write(Conversions.pagesToMBytes(getPagesUsed())); + Log.write(" MB ("); + Log.write(getPagesUsed()); + Log.write(" pgs)"); Log.write(" total = "); Log.write(Conversions.pagesToMBytes(getTotalPages())); Log.write(" MB ("); @@ -590,7 +591,6 @@ /** * MMTK has requested stop-the-world activity (e.g., stw within a concurrent gc). */ - @Unpreemptible public static void triggerInternalCollectionRequest() { // Mark this as a user triggered collection internalTriggeredCollection = lastInternalTriggeredCollection = true; @@ -839,7 +839,6 @@ * @param space The space that triggered the poll. * @return true if a collection is required. */ - @LogicallyUninterruptible public final boolean poll(boolean spaceFull, Space space) { if (collectionRequired(spaceFull)) { if (space == metaDataSpace) { @@ -853,7 +852,6 @@ } logPoll(space, "Triggering collection"); controlCollectorContext.request(); - VM.collection.blockForGC(); return true; } @@ -865,7 +863,6 @@ } else { logPoll(space, "Triggering concurrent collection"); triggerInternalCollectionRequest(); - VM.collection.blockForGC(); return true; } } Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/concurrent/marksweep/CMS.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/concurrent/marksweep/CMS.java 2010-09-22 05:47:44 UTC (rev 15996) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/concurrent/marksweep/CMS.java 2010-09-22 06:19:58 UTC (rev 15997) @@ -35,7 +35,7 @@ * Class variables */ - public static final MarkSweepSpace msSpace = new MarkSweepSpace("ms", DEFAULT_POLL_FREQUENCY, VMRequest.create()); + public static final MarkSweepSpace msSpace = new MarkSweepSpace("ms", VMRequest.create()); public static final int MARK_SWEEP = msSpace.getDescriptor(); static { Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/copyms/CopyMS.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/copyms/CopyMS.java 2010-09-22 05:47:44 UTC (rev 15996) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/copyms/CopyMS.java 2010-09-22 06:19:58 UTC (rev 15997) @@ -54,8 +54,8 @@ /**************************************************************************** * Class variables */ - public static final CopySpace nurserySpace = new CopySpace("nursery", DEFAULT_POLL_FREQUENCY, false, VMRequest.create(0.15f, true)); - public static final MarkSweepSpace msSpace = new MarkSweepSpace("ms", DEFAULT_POLL_FREQUENCY, VMRequest.create()); + public static final CopySpace nurserySpace = new CopySpace("nursery", false, VMRequest.create(0.15f, true)); + public static final MarkSweepSpace msSpace = new MarkSweepSpace("ms", VMRequest.create()); public static final int NURSERY = nurserySpace.getDescriptor(); public static final int MARK_SWEEP = msSpace.getDescriptor(); Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/Gen.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/Gen.java 2010-09-22 05:47:44 UTC (rev 15996) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/Gen.java 2010-09-22 06:19:58 UTC (rev 15997) @@ -90,7 +90,7 @@ /** The nursery space is where all new objects are allocated by default */ private static final VMRequest vmRequest = USE_DISCONTIGUOUS_NURSERY ? VMRequest.create() : VMRequest.create(NURSERY_VM_FRACTION, true); - public static final CopySpace nurserySpace = new CopySpace("nursery", DEFAULT_POLL_FREQUENCY, false, vmRequest); + public static final CopySpace nurserySpace = new CopySpace("nursery", false, vmRequest); public static final int NURSERY = nurserySpace.getDescriptor(); private static final Address NURSERY_START = nurserySpace.getStart(); Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/GenMutator.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/GenMutator.java 2010-09-22 05:47:44 UTC (rev 15996) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/GenMutator.java 2010-09-22 06:19:58 UTC (rev 15997) @@ -318,8 +318,8 @@ if (global().traceFullHeap()) { super.collectionPhase(phaseId, primary); modbuf.flushLocal(); - remset.resetLocal(); - arrayRemset.resetLocal(); + remset.flushLocal(); + arrayRemset.flushLocal(); } else { flushRememberedSets(); } Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/copying/GenCopy.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/copying/GenCopy.java 2010-09-22 05:47:44 UTC (rev 15996) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/copying/GenCopy.java 2010-09-22 06:19:58 UTC (rev 15997) @@ -66,14 +66,14 @@ * The low half of the copying mature space. We allocate into this space * when <code>hi</code> is <code>false</code>. */ - static CopySpace matureSpace0 = new CopySpace("ss0", DEFAULT_POLL_FREQUENCY, false, VMRequest.create()); + static CopySpace matureSpace0 = new CopySpace("ss0", false, VMRequest.create()); static final int MS0 = matureSpace0.getDescriptor(); /** * The high half of the copying mature space. We allocate into this space * when <code>hi</code> is <code>true</code>. */ - static CopySpace matureSpace1 = new CopySpace("ss1", DEFAULT_POLL_FREQUENCY, true, VMRequest.create()); + static CopySpace matureSpace1 = new CopySpace("ss1", true, VMRequest.create()); static final int MS1 = matureSpace1.getDescriptor(); Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/immix/GenImmix.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/immix/GenImmix.java 2010-09-22 05:47:44 UTC (rev 15996) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/immix/GenImmix.java 2010-09-22 06:19:58 UTC (rev 15997) @@ -58,7 +58,7 @@ */ /** The mature space, which for GenImmix uses a mark sweep collection policy. */ - public static final ImmixSpace immixSpace = new ImmixSpace("immix", DEFAULT_POLL_FREQUENCY, VMRequest.create()); + public static final ImmixSpace immixSpace = new ImmixSpace("immix", VMRequest.create()); public static final int IMMIX = immixSpace.getDescriptor(); @@ -154,6 +154,17 @@ return immixSpace.availablePhysicalPages(); } + /** + * Return the number of pages reserved for copying. + * + * @return The number of pages reserved given the pending + * allocation, including space reserved for copying. + */ + @Override + public int getCollectionReserve() { + return super.getCollectionReserve() + immixSpace.defragHeadroomPages(); + } + /***************************************************************************** * * Miscellaneous Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/marksweep/GenMS.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/marksweep/GenMS.java 2010-09-22 05:47:44 UTC (rev 15996) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/generational/marksweep/GenMS.java 2010-09-22 06:19:58 UTC (rev 15997) @@ -54,7 +54,7 @@ */ /** The mature space, which for GenMS uses a mark sweep collection policy. */ - public static final MarkSweepSpace msSpace = new MarkSweepSpace("ms", DEFAULT_POLL_FREQUENCY, VMRequest.create()); + public static final MarkSweepSpace msSpace = new MarkSweepSpace("ms", VMRequest.create()); public static final int MS = msSpace.getDescriptor(); Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/immix/Immix.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/immix/Immix.java 2010-09-22 05:47:44 UTC (rev 15996) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/immix/Immix.java 2010-09-22 06:19:58 UTC (rev 15997) @@ -52,7 +52,7 @@ /**************************************************************************** * Class variables */ - public static final ImmixSpace immixSpace = new ImmixSpace("immix", DEFAULT_POLL_FREQUENCY, VMRequest.create()); + public static final ImmixSpace immixSpace = new ImmixSpace("immix", VMRequest.create()); public static final int IMMIX = immixSpace.getDescriptor(); public static final int SCAN_IMMIX = 0; @@ -142,6 +142,17 @@ } /** + * Return the number of pages reserved for collection. + * + * @return The number of pages reserved given the pending + * allocation, including space reserved for collection. + */ + @Override + public int getCollectionReserve() { + return super.getCollectionReserve() + immixSpace.defragHeadroomPages(); + } + + /** * @see org.mmtk.plan.Plan#willNeverMove * * @param object Object in question Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/markcompact/MC.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/markcompact/MC.java 2010-09-22 05:47:44 UTC (rev 15996) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/markcompact/MC.java 2010-09-22 06:19:58 UTC (rev 15997) @@ -49,7 +49,7 @@ */ /** The mark compact space itself */ - public static final MarkCompactSpace mcSpace = new MarkCompactSpace("mc", DEFAULT_POLL_FREQUENCY, VMRequest.create(0.6f)); + public static final MarkCompactSpace mcSpace = new MarkCompactSpace("mc", VMRequest.create(0.6f)); /** The space descriptor */ public static final int MARK_COMPACT = mcSpace.getDescriptor(); Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/marksweep/MS.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/marksweep/MS.java 2010-09-22 05:47:44 UTC (rev 15996) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/marksweep/MS.java 2010-09-22 06:19:58 UTC (rev 15997) @@ -44,7 +44,7 @@ /**************************************************************************** * Class variables */ - public static final MarkSweepSpace msSpace = new MarkSweepSpace("ms", DEFAULT_POLL_FREQUENCY, VMRequest.create()); + public static final MarkSweepSpace msSpace = new MarkSweepSpace("ms", VMRequest.create()); public static final int MARK_SWEEP = msSpace.getDescriptor(); public static final int SCAN_MARK = 0; Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/nogc/NoGC.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/nogc/NoGC.java 2010-09-22 05:47:44 UTC (rev 15996) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/nogc/NoGC.java 2010-09-22 06:19:58 UTC (rev 15997) @@ -30,7 +30,7 @@ /***************************************************************************** * Class variables */ - public static final ImmortalSpace noGCSpace = new ImmortalSpace("default", DEFAULT_POLL_FREQUENCY, VMRequest.create()); + public static final ImmortalSpace noGCSpace = new ImmortalSpace("default", VMRequest.create()); public static final int NOGC = noGCSpace.getDescriptor(); Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/RCBase.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/RCBase.java 2010-09-22 05:47:44 UTC (rev 15996) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/RCBase.java 2010-09-22 06:19:58 UTC (rev 15997) @@ -101,8 +101,8 @@ * * Class fields */ - public static final ExplicitFreeListSpace rcSpace = new ExplicitFreeListSpace("rc", DEFAULT_POLL_FREQUENCY, VMRequest.create()); - public static final ExplicitLargeObjectSpace rcloSpace = new ExplicitLargeObjectSpace("rclos", DEFAULT_POLL_FREQUENCY, VMRequest.create()); + public static final ExplicitFreeListSpace rcSpace = new ExplicitFreeListSpace("rc", VMRequest.create()); + public static final ExplicitLargeObjectSpace rcloSpace = new ExplicitLargeObjectSpace("rclos", VMRequest.create()); public static final int REF_COUNT = rcSpace.getDescriptor(); public static final int REF_COUNT_LOS = rcloSpace.getDescriptor(); Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/generational/GenRC.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/generational/GenRC.java 2010-09-22 05:47:44 UTC (rev 15996) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/refcount/generational/GenRC.java 2010-09-22 06:19:58 UTC (rev 15997) @@ -30,7 +30,7 @@ public static final int ALLOC_RC = RCBase.ALLOCATORS + 1; /** The nursery space is where all new objects are allocated by default */ - public static final CopySpace nurserySpace = new CopySpace("nursery", DEFAULT_POLL_FREQUENCY, false, VMRequest.create(0.15f, true)); + public static final CopySpace nurserySpace = new CopySpace("nursery", false, VMRequest.create(0.15f, true)); public static final int NURSERY = nurserySpace.getDescriptor(); Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/semispace/SS.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/semispace/SS.java 2010-09-22 05:47:44 UTC (rev 15996) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/semispace/SS.java 2010-09-22 06:19:58 UTC (rev 15997) @@ -50,11 +50,11 @@ public static boolean hi = false; // True if allocing to "higher" semispace /** One of the two semi spaces that alternate roles at each collection */ - public static final CopySpace copySpace0 = new CopySpace("ss0", DEFAULT_POLL_FREQUENCY, false, VMRequest.create()); + public static final CopySpace copySpace0 = new CopySpace("ss0", false, VMRequest.create()); public static final int SS0 = copySpace0.getDescriptor(); /** One of the two semi spaces that alternate roles at each collection */ - public static final CopySpace copySpace1 = new CopySpace("ss1", DEFAULT_POLL_FREQUENCY, true, VMRequest.create()); + public static final CopySpace copySpace1 = new CopySpace("ss1", true, VMRequest.create()); public static final int SS1 = copySpace1.getDescriptor(); public final Trace ssTrace; Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/semispace/gctrace/GCTrace.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/semispace/gctrace/GCTrace.java 2010-09-22 05:47:44 UTC (rev 15996) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/semispace/gctrace/GCTrace.java 2010-09-22 06:19:58 UTC (rev 15997) @@ -84,7 +84,7 @@ */ /* Spaces */ - public static final RawPageSpace traceSpace = new RawPageSpace("trace", DEFAULT_POLL_FREQUENCY, VMRequest.create()); + public static final RawPageSpace traceSpace = new RawPageSpace("trace", VMRequest.create()); public static final int TRACE = traceSpace.getDescriptor(); /* GC state */ Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyimmix/StickyImmix.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyimmix/StickyImmix.java 2010-09-22 05:47:44 UTC (rev 15996) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/stickyimmix/StickyImmix.java 2010-09-22 06:19:58 UTC (rev 15997) @@ -185,6 +185,17 @@ } /** + * Return the number of pages reserved for collection. + * + * @return The number of pages reserved given the pending + * allocation, including space reserved for collection. + */ + @Override + public int getCollectionReserve() { + return super.getCollectionReserve() + immixSpace.defragHeadroomPages(); + } + + /** * Print pre-collection statistics. In this class we prefix the output * indicating whether the collection was full heap or not. */ Modified: rvmroot/trunk/MMTk/src/org/mmtk/policy/BaseLargeObjectSpace.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/policy/BaseLargeObjectSpace.java 2010-09-22 05:47:44 UTC (rev 15996) +++ rvmroot/trunk/MMTk/src/org/mmtk/policy/BaseLargeObjectSpace.java 2010-09-22 06:19:58 UTC (rev 15997) @@ -50,16 +50,14 @@ * then the constructor will fail. * * @param name The name of this space (used when printing error messages etc) - * @param pageBudget The number of pages this space may consume - * before consulting the plan * @param vmRequest An object describing the virtual memory requested. */ - public BaseLargeObjectSpace(String name, int pageBudget, VMRequest vmRequest) { + public BaseLargeObjectSpace(String name, VMRequest vmRequest) { super(name, false, false, vmRequest); if (vmRequest.isDiscontiguous()) { - pr = new FreeListPageResource(pageBudget, this, 0); + pr = new FreeListPageResource(this, 0); } else { - pr = new FreeListPageResource(pageBudget, this, start, extent); + pr = new FreeListPageResource(this, start, extent); } } Modified: rvmroot/trunk/MMTk/src/org/mmtk/policy/CopySpace.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/policy/CopySpace.java 2010-09-22 05:47:44 UTC (rev 15996) +++ rvmroot/trunk/MMTk/src/org/mmtk/policy/CopySpace.java 2010-09-22 06:19:58 UTC (rev 15997) @@ -70,19 +70,17 @@ * then the constructor will fail. * * @param name The name of this space (used when printing error messages etc) - * @param pageBudget The number of pages this space may consume - * before consulting the plan * @param fromSpace The does this instance start life as from-space * (or to-space)? * @param vmRequest An object describing the virtual memory requested. */ - public CopySpace(String name, int pageBudget, boolean fromSpace, VMRequest vmRequest) { + public CopySpace(String name, boolean fromSpace, VMRequest vmRequest) { super(name, true, false, vmRequest); this.fromSpace = fromSpace; if (vmRequest.isDiscontiguous()) { - pr = new MonotonePageResource(pageBudget, this, META_DATA_PAGES_PER_REGION); + pr = new MonotonePageResource(this, META_DATA_PAGES_PER_REGION); } else { - pr = new MonotonePageResource(pageBudget, this, start, extent, META_DATA_PAGES_PER_REGION); + pr = new MonotonePageResource(this, start, extent, META_DATA_PAGES_PER_REGION); } } Modified: rvmroot/trunk/MMTk/src/org/mmtk/policy/ExplicitFreeListSpace.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/policy/ExplicitFreeListSpace.java 2010-09-22 05:47:44 UTC (rev 15996) +++ rvmroot/trunk/MMTk/src/org/mmtk/policy/ExplicitFreeListSpace.java 2010-09-22 06:19:58 UTC (rev 15997) @@ -50,12 +50,10 @@ * then the constructor will fail. * * @param name The name of this space (used when printing error messages etc) - * @param pageBudget The number of pages this space may consume - * before consulting the plan * @param vmRequest An object describing the virtual memory requested. */ - public ExplicitFreeListSpace(String name, int pageBudget, VMRequest vmRequest) { - super(name, pageBudget, 0, vmRequest); + public ExplicitFreeListSpace(String name, VMRequest vmRequest) { + super(name, 0, vmRequest); } /** Modified: rvmroot/trunk/MMTk/src/org/mmtk/policy/ExplicitLargeObjectSpace.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/policy/ExplicitLargeObjectSpace.java 2010-09-22 05:47:44 UTC (rev 15996) +++ rvmroot/trunk/MMTk/src/org/mmtk/policy/ExplicitLargeObjectSpace.java 2010-09-22 06:19:58 UTC (rev 15997) @@ -46,12 +46,10 @@ * then the constructor will fail. * * @param name The name of this space (used when printing error messages etc) - * @param pageBudget The number of pages this space may consume - * before consulting the plan * @param vmRequest An object describing the virtual memory requested. */ - public ExplicitLargeObjectSpace(String name, int pageBudget, VMRequest vmRequest) { - super(name, pageBudget, vmRequest); + public ExplicitLargeObjectSpace(String name, VMRequest vmRequest) { + super(name, vmRequest); cells = new DoublyLinkedList(LOG_BYTES_IN_PAGE, true); } Modified: rvmroot/trunk/MMTk/src/org/mmtk/policy/ImmortalSpace.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/policy/ImmortalSpace.java 2010-09-22 05:47:44 UTC (rev 15996) +++ rvmroot/trunk/MMTk/src/org/mmtk/policy/ImmortalSpace.java 2010-09-22 06:19:58 UTC (rev 15997) @@ -57,16 +57,14 @@ * then the constructor will fail. * * @param name The name of this space (used when printing error messages etc) - * @param pageBudget The number of pages this space may consume - * before consulting the plan * @param vmRequest An object describing the virtual memory requested. */ - public ImmortalSpace(String name, int pageBudget, VMRequest vmRequest) { + public ImmortalSpace(String name, VMRequest vmRequest) { super(name, false, true, vmRequest); if (vmRequest.isDiscontiguous()) { - pr = new MonotonePageResource(pageBudget, this, META_DATA_PAGES_PER_REGION); + pr = new MonotonePageResource(this, META_DATA_PAGES_PER_REGION); } else { - pr = new MonotonePageResource(pageBudget, this, start, extent, META_DATA_PAGES_PER_REGION); + pr = new MonotonePageResource(this, start, extent, META_DATA_PAGES_PER_REGION); } } Modified: rvmroot/trunk/MMTk/src/org/mmtk/policy/LargeObjectSpace.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/policy/LargeObjectSpace.java 2010-09-22 05:47:44 UTC (rev 15996) +++ rvmroot/trunk/MMTk/src/org/mmtk/policy/LargeObjectSpace.java 2010-09-22 06:19:58 UTC (rev 15997) @@ -59,12 +59,10 @@ * then the constructor will fail. * * @param name The name of this space (used when printing error messages etc) - * @param pageBudget The number of pages this space may consume - * before consulting the plan * @param vmRequest An object describing the virtual memory requested. */ - public LargeObjectSpace(String name, int pageBudget, VMRequest vmRequest) { - super(name, pageBudget, vmRequest); + public LargeObjectSpace(String name, VMRequest vmRequest) { + super(name, vmRequest); treadmill = new Treadmill(LOG_BYTES_IN_PAGE, true); markState = 0; } Modified: rvmroot/trunk/MMTk/src/org/mmtk/policy/MarkCompactSpace.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/policy/MarkCompactSpace.java 2010-09-22 05:47:44 UTC (rev 15996) +++ rvmroot/trunk/MMTk/src/org/mmtk/policy/MarkCompactSpace.java 2010-09-22 06:19:58 UTC (rev 15997) @@ -67,16 +67,14 @@ * then the constructor will fail. * * @param name The name of this space (used when printing error messages etc) - * @param pageBudget The number of pages this space may consume - * before consulting the plan * @param vmRequest An object describing the virtual memory requested. */ - public MarkCompactSpace(String name, int pageBudget, VMRequest vmRequest) { + public MarkCompactSpace(String name, VMRequest vmRequest) { super(name, true, false, vmRequest); if (vmRequest.isDiscontiguous()) { - pr = new FreeListPageResource(pageBudget, this, 0); + pr = new FreeListPageResource(this, 0); } else { - pr = new FreeListPageResource(pageBudget, this, start, extent, 0); + pr = new FreeListPageResource(this, start, extent, 0); } } Modified: rvmroot/trunk/MMTk/src/org/mmtk/policy/MarkSweepSpace.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/policy/MarkSweepSpace.java 2010-09-22 05:47:44 UTC (rev 15996) +++ rvmroot/trunk/MMTk/src/org/mmtk/policy/MarkSweepSpace.java 2010-09-22 06:19:58 UTC (rev 15997) @@ -93,12 +93,10 @@ * then the constructor will fail. * * @param name The name of this space (used when printing error messages etc) - * @param pageBudget The number of pages this space may consume - * before consulting the plan * @param vmRequest An object describing the virtual memory requested. */ - public MarkSweepSpace(String name, int pageBudget, VMRequest vmRequest) { - super(name, pageBudget, 0, vmRequest); + public MarkSweepSpace(String name, VMRequest vmRequest) { + super(name, 0, vmRequest); if (usingStickyMarkBits) allocState |= HeaderByte.UNLOGGED_BIT; } Modified: rvmroot/trunk/MMTk/src/org/mmtk/policy/RawPageSpace.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/policy/RawPageSpace.java 2010-09-22 05:47:44 UTC (rev 15996) +++ rvmroot/trunk/MMTk/src/org/mmtk/policy/RawPageSpace.java 2010-09-22 06:19:58 UTC (rev 15997) @@ -28,8 +28,8 @@ * This class provides access to raw memory for managing internal meta * data. */ -@Uninterruptible public final class RawPageSpace extends Space - implements Constants { +@Uninterruptible +public final class RawPageSpace extends Space implements Constants { /** * The caller specifies the region of virtual memory to be used for @@ -37,16 +37,14 @@ * then the constructor will fail. * * @param name The name of this space (used when printing error messages etc) - * @param pageBudget The number of pages this space may consume - * before consulting the plan * @param vmRequest An object describing the virtual memory requested. */ - public RawPageSpace(String name, int pageBudget, VMRequest vmRequest) { + public RawPageSpace(String name, VMRequest vmRequest) { super(name, false, false, vmRequest); if (vmRequest.isDiscontiguous()) { - pr = new FreeListPageResource(pageBudget, this, 0); + pr = new FreeListPageResource(this, 0); } else { - pr = new FreeListPageResource(pageBudget, this, start, extent); + pr = new FreeListPageResource(this, start, extent); } } Modified: rvmroot/trunk/MMTk/src/org/mmtk/policy/SegregatedFreeListSpace.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/policy/SegregatedFreeListSpace.java 2010-09-22 05:47:44 UTC (rev 15996) +++ rvmroot/trunk/MMTk/src/org/mmtk/policy/SegregatedFreeListSpace.java 2010-09-22 06:19:58 UTC (rev 15997) @@ -89,11 +89,10 @@ * then the constructor will fail. * * @param name The name of this space (used when printing error messages etc) - * @param pageBudget The number of pages this space may consume before consulting the plan * @param additionalMetadata The number of meta data bytes per region for the subclass. * @param vmRequest An object describing the virtual memory requested. */ - public SegregatedFreeListSpace(String name, int pageBudget, int additionalMetadata, VMRequest vmRequest) { + public SegregatedFreeListSpace(String name, int additionalMetadata, VMRequest vmRequest) { super(name, false, false, vmRequest); initSizeClasses(); int totalMetadata = additionalMetadata; @@ -103,9 +102,9 @@ totalMetadata += META_DATA_PAGES_PER_REGION_NO_BITMAP; } if (vmRequest.isDiscontiguous()) { - pr = new FreeListPageResource(pageBudget, this, totalMetadata); + pr = new FreeListPageResource(this, totalMetadata); } else { - pr = new FreeListPageResource(pageBudget, this, start, extent, totalMetadata); + pr = new FreeListPageResource(this, start, extent, totalMetadata); } } Modified: rvmroot/trunk/MMTk/src/org/mmtk/policy/Space.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/policy/Space.java 2010-09-22 05:47:44 UTC (rev 15996) +++ rvmroot/trunk/MMTk/src/org/mmtk/policy/Space.java 2010-09-22 06:19:58 UTC (rev 15997) @@ -388,25 +388,29 @@ * @return The start of the first page if successful, zero on * failure. */ + @LogicallyUninterruptible public final Address acquire(int pages) { boolean allowPoll = VM.activePlan.isMutator() && Plan.isInitialized(); - /* First check page budget and poll if necessary */ - if (!pr.reservePages(pages)) { - /* Need to poll, either fixing budget or requiring GC */ - if (allowPoll && VM.activePlan.global().poll(false, this)) { - pr.clearRequest(pages); - return Address.zero(); // GC required, return failure - } + /* Check page budget */ + int pagesReserved = pr.reservePages(pages); + + /* Poll, either fixing budget or requiring GC */ + if (allowPoll && VM.activePlan.global().poll(false, this)) { + pr.clearRequest(pagesReserved); + VM.collection.blockForGC(); + return Address.zero(); // GC required, return failure } /* Page budget is ok, try to acquire virtual memory */ - Address rtn = pr.getNewPages(pages); + Address rtn = pr.getNewPages(pagesReserved, pages); if (rtn.isZero()) { /* Failed, so force a GC */ if (!allowPoll) VM.assertions.fail("Physical allocation failed when polling not allowed!"); - VM.activePlan.global().poll(true, this); - pr.clearRequest(pages); + boolean gcPerformed = VM.activePlan.global().poll(true, this); + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(gcPerformed, "GC not performed when forced."); + pr.clearRequest(pagesReserved); + VM.collection.blockForGC(); return Address.zero(); } Modified: rvmroot/trunk/MMTk/src/org/mmtk/policy/immix/Defrag.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/policy/immix/Defrag.java 2010-09-22 05:47:44 UTC (rev 15996) +++ rvmroot/trunk/MMTk/src/org/mmtk/policy/immix/Defrag.java 2010-09-22 06:19:58 UTC (rev 15997) @@ -34,10 +34,6 @@ @Uninterruptible public class Defrag implements Constants { - - - private int defragHeadroomPages = 0; - private int defragFreeHeadroomPages = 0; private boolean inDefragCollection = false; private int debugBytesDefraged = 0; private int availableCleanPagesForDefrag; @@ -45,7 +41,8 @@ private int[][] spillMarkHistograms = new int[MAX_COLLECTORS][SPILL_HISTOGRAM_BUCKETS]; private int[] spillAvailHistogram = new int[SPILL_HISTOGRAM_BUCKETS]; public static SizeCounter defragCleanBytesUsed = new SizeCounter("cleanUsed"); - /* verbose stats (used only on stats runs since they induce overhead when gathred) */ + + /* verbose stats (used only on stats runs since they induce overhead when gathered) */ public static SizeCounter defragBytesNotFreed = new SizeCounter("bytesNotFreed"); public static SizeCounter defragBytesFreed = new SizeCounter("bytesFreed"); public static SizeCounter defragCleanBytesAvailable = new SizeCounter("cleanAvail"); @@ -74,13 +71,17 @@ boolean inDefrag() { return inDefragCollection; } void prepare(ChunkList chunkMap, ImmixSpace space) { - if (defragHeadroomPages > 0) - pr.unconditionallyReleasePages(defragHeadroomPages); - - availableCleanPagesForDefrag = VM.activePlan.global().getTotalPages() - VM.activePlan.global().getPagesReserved(); + availableCleanPagesForDefrag = VM.activePlan.global().getTotalPages() - VM.activePlan.global().getPagesReserved() + getDefragHeadroomPages(); if (availableCleanPagesForDefrag < 0) availableCleanPagesForDefrag = 0; defragSpaceExhausted = false; - availableCleanPagesForDefrag += defragFreeHeadroomPages; + + /* Free defrag pages (not budgeted, used for experimentation) */ + if (Options.defragFreeHeadroom.getPages() > 0) { + availableCleanPagesForDefrag += Options.defragFreeHeadroom.getPages(); + } else if (Options.defragFreeHeadroomFraction.getValue() > 0) { + availableCleanPagesForDefrag += (int) (pr.reservedPages() * Options.defragFreeHeadroomFraction.getValue()); + } + if (inDefragCollection) { if (Options.verbose.getValue() > 0) { Log.write("[Defrag]"); @@ -94,22 +95,6 @@ } void globalRelease() { - if (Options.defragHeadroom.getPages() > 0) - defragHeadroomPages = Options.defragHeadroom.getPages(); - else if (Options.defragHeadroomFraction.getValue() > 0) - defragHeadroomPages = (int) (pr.reservedPages() * Options.defragHeadroomFraction.getValue()); - else - defragHeadroomPages = 0; - if (Options.defragFreeHeadroom.getPages() > 0) - defragFreeHeadroomPages = Options.defragFreeHeadroom.getPages(); - else if (Options.defragFreeHeadroomFraction.getValue() > 0) - defragFreeHeadroomPages = (int) (pr.reservedPages() * Options.defragFreeHeadroomFraction.getValue()); - else - defragFreeHeadroomPages = 0; - - if (defragHeadroomPages > 0) - pr.unconditionallyReservePages(defragHeadroomPages); - if (inDefragCollection && Options.verbose.getValue() > 2) { Log.write("(Defrag summary: cu: "); defragCleanBytesUsed.printCurrentVolume(); Log.write(" nf: "); defragBytesNotFreed.printCurrentVolume(); @@ -122,6 +107,15 @@ debugCollectionTypeDetermined = false; } + int getDefragHeadroomPages() { + if (Options.defragHeadroom.getPages() > 0) { + return Options.defragHeadroom.getPages(); + } else if (Options.defragHeadroomFraction.getValue() > 0) { + return (int) (pr.reservedPages() * Options.defragHeadroomFraction.getValue()); + } + return 0; + } + void decideWhetherToDefrag(boolean emergencyCollection, boolean collectWholeHeap, int collectionAttempt, boolean userTriggered, boolean exhaustedReusableSpace) { inDefragCollection = (collectionAttempt > 1) || emergencyCollection || Modified: rvmroot/trunk/MMTk/src/org/mmtk/policy/immix/ImmixSpace.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/policy/immix/ImmixSpace.java 2010-09-22 05:47:44 UTC (rev 15996) +++ rvmroot/trunk/MMTk/src/org/mmtk/policy/immix/ImmixSpace.java 2010-09-22 06:19:58 UTC (rev 15997) @@ -86,15 +86,14 @@ * then the constructor will fail. * * @param name The name of this space (used when printing error messages etc) - * @param pageBudget The number of pages this space may consume before consulting the plan * @param vmRequest The virtual memory request */ - public ImmixSpace(String name, int pageBudget, VMRequest vmRequest) { + public ImmixSpace(String name, VMRequest vmRequest) { super(name, false, false, vmRequest); if (vmRequest.isDiscontiguous()) - pr = new FreeListPageResource(pageBudget, this, Chunk.getRequiredMetaDataPages()); + pr = new FreeListPageResource(this, Chunk.getRequiredMetaDataPages()); else - pr = new FreeListPageResource(pageBudget, this, start, extent, Chunk.getRequiredMetaDataPages()); + pr = new FreeListPageResource(this, start, extent, Chunk.getRequiredMetaDataPages()); defrag = new Defrag((FreeListPageResource) pr); } @@ -163,6 +162,15 @@ defrag.decideWhetherToDefrag(emergencyCollection, collectWholeHeap, collectionAttempt, userTriggeredCollection, exhaustedReusableSpace); } + /** + * Return the amount of headroom required to allow defrag, so this can be included in a collection reserve. + * + * @return The number of pages. + */ + public int defragHeadroomPages() { + return defrag.getDefragHeadroomPages(); + } + /**************************************************************************** * * Collection state access methods Modified: rvmroot/trunk/MMTk/src/org/mmtk/utility/alloc/Allocator.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/utility/alloc/Allocator.java 2010-09-22 05:47:44 UTC (rev 15996) +++ rvmroot/trunk/MMTk/src/org/mmtk/utility/alloc/Allocator.java 2010-09-22 06:19:58 UTC (rev 15997) @@ -280,7 +280,8 @@ // Check if we are in an OutOfMemory situation oomLock.acquire(); boolean failWithOOM = !allocationSuccess; - //Log.prependThreadId();Log.write(" allocation failed in emergency, failWithOOM = ");Log.writeln(failWithOOM ? "1" : "0"); + // This seems odd, but we must allow each OOM to run its course (and maybe give us back memory) + allocationSuccess = true; oomLock.release(); if (failWithOOM) { // Nobody has successfully allocated since an emergency collection: OutOfMemory Modified: rvmroot/trunk/MMTk/src/org/mmtk/utility/alloc/EmbeddedMetaData.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/utility/alloc/EmbeddedMetaData.java 2010-09-22 05:47:44 UTC (rev 15996) +++ rvmroot/trunk/MMTk/src/org/mmtk/utility/alloc/EmbeddedMetaData.java 2010-09-22 06:19:58 UTC (rev 15997) @@ -28,7 +28,8 @@ * of each page which will cause those few cache lines corresponding * to the start of each page to be heavily conflicted). */ -@Uninterruptible public final class EmbeddedMetaData implements Constants { +@Uninterruptible +public final class EmbeddedMetaData implements Constants { /* The (log of the) size of each region of meta data management */ public static final int LOG_BYTES_IN_REGION = 22; Modified: rvmroot/trunk/MMTk/src/org/mmtk/utility/heap/FreeListPageResource.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/utility/heap/FreeListPageResource.java 2010-09-22 05:47:44 UTC (rev 15996) +++ rvmroot/trunk/MMTk/src/org/mmtk/utility/heap/FreeListPageResource.java 2010-09-22 06:19:58 UTC (rev 15997) @@ -14,6 +14,7 @@ import org.mmtk.plan.Plan; import org.mmtk.policy.Space; + import static org.mmtk.policy.Space.PAGES_IN_CHUNK; import org.mmtk.utility.alloc.EmbeddedMetaData; import org.mmtk.utility.Conversions; @@ -44,15 +45,12 @@ * Contiguous free list resource. The address range is pre-defined at * initialization time and is immutable. * - * @param pageBudget The budget of pages available to this memory - * manager before it must poll the collector. * @param space The space to which this resource is attached * @param start The start of the address range allocated to this resource * @param bytes The size of the address rage allocated to this resource */ - public FreeListPageResource(int pageBudget, Space space, Address start, - Extent bytes) { - super(pageBudget, space, start); + public FreeListPageResource(Space space, Address start, Extent bytes) { + super(space, start); int pages = Conversions.bytesToPages(bytes); freeList = new GenericFreeList(pages); pagesCurrentlyOnFreeList = pages; @@ -65,17 +63,14 @@ * Contiguous free list resource. The address range is pre-defined at * initialization time and is immutable. * - * @param pageBudget The budget of pages available to this memory - * manager before it must poll the collector. * @param space The space to which this resource is attached * @param start The start of the address range allocated to this resource * @param bytes The size of the address rage allocated to this resource * @param metaDataPagesPerRegion The number of pages of meta data * that are embedded in each region. */ - public FreeListPageResource(int pageBudget, Space space, Address start, - Extent bytes, int metaDataPagesPerRegion) { - super(pageBudget, space, start); + public FreeListPageResource(Space space, Address start, Extent bytes, int metaDataPagesPerRegion) { + super(space, start); this.metaDataPagesPerRegion = metaDataPagesPerRegion; int pages = Conversions.bytesToPages(bytes); freeList = new GenericFreeList(pages, EmbeddedMetaData.PAGES_IN_REGION); @@ -90,12 +85,10 @@ * pre-defined at initialization time and is dynamically defined to * be some set of pages, according to demand and availability. * - * @param pageBudget The budget of pages available to this memory - * manager before it must poll the collector. * @param space The space to which this resource is attached */ - public FreeListPageResource(int pageBudget, Space space, int metaDataPagesPerRegion) { - super(pageBudget, space); + public FreeListPageResource(Space space, int metaDataPagesPerRegion) { + super(space); this.metaDataPagesPerRegion = metaDataPagesPerRegion; this.start = Space.AVAILABLE_START; freeList = new GenericFreeList(Map.globalPageMap, Map.getDiscontigFreeListPROrdinal(this)); @@ -139,25 +132,26 @@ * mmpapped and zeroed before returning the address of the start of * the region. If the request cannot be satisfied, return zero. * - * @param pages The number of pages to be allocated. + * @param reservedPages The number of pages reserved due to the initial request. + * @param requiredPages The number of pages required to be allocated. * @return The start of the first page if successful, zero on * failure. */ @Inline - protected Address allocPages(int pages) { - if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(metaDataPagesPerRegion == 0 || pages <= PAGES_IN_CHUNK - metaDataPagesPerRegion); + protected Address allocPages(int reservedPages, int requiredPages) { + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(metaDataPagesPerRegion == 0 || requiredPages <= PAGES_IN_CHUNK - metaDataPagesPerRegion); lock(); boolean newChunk = false; - int pageOffset = freeList.alloc(pages); + int pageOffset = freeList.alloc(requiredPages); if (pageOffset == GenericFreeList.FAILURE && !contiguous) { - pageOffset = allocateContiguousChunks(pages); + pageOffset = allocateContiguousChunks(requiredPages); newChunk = true; } if (pageOffset == -1) { unlock(); return Address.zero(); } else { - pagesCurrentlyOnFreeList -= pages; + pagesCurrentlyOnFreeList -= requiredPages; if (pageOffset > highWaterMark) { if (highWaterMark == 0 || (pageOffset ^ highWaterMark) > EmbeddedMetaData.PAGES_IN_REGION) { int regions = 1 + ((pageOffset - highWaterMark) >> EmbeddedMetaData.LOG_PAGES_IN_REGION); @@ -169,13 +163,14 @@ highWaterMark = pageOffset; } Address rtn = start.plus(Conversions.pagesToBytes(pageOffset)); - Extent bytes = Conversions.pagesToBytes(pages); - commitPages(pages, pages); + Extent bytes = Conversions.pagesToBytes(requiredPages); + // The meta-data portion of reserved Pages was committed above. + commitPages(reservedPages, requiredPages); space.growSpace(rtn, bytes, newChunk); unlock(); - Mmapper.ensureMapped(rtn, pages); + Mmapper.ensureMapped(rtn, requiredPages); VM.memory.zero(rtn, bytes); - VM.events.tracePageAcquired(space, rtn, pages); + VM.events.tracePageAcquired(space, rtn, requiredPages); return rtn; } } Modified: rvmroot/trunk/MMTk/src/org/mmtk/utility/heap/MonotonePageResource.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/utility/heap/MonotonePageResource.java 2010-09-22 05:47:44 UTC (rev 15996) +++ rvmroot/trunk/MMTk/src/org/mmtk/utility/heap/MonotonePageResource.java 2010-09-22 06:19:58 UTC (rev 15997) @@ -48,17 +48,14 @@ * Contiguous monotone resource. The address range is pre-defined at * initialization time and is immutable. * - * @param pageBudget The budget of pages available to this memory - * manager before it must poll the collector. * @param space The space to which this resource is attached * @param start The start of the address range allocated to this resource * @param bytes The size of the address rage allocated to this resource * @param metaDataPagesPerRegion The number of pages of meta data * that are embedded in each region. */ - public MonotonePageResource(int pageBudget, Space space, Address start, - Extent bytes, int metaDataPagesPerRegion) { - super(pageBudget, space, start); + public MonotonePageResource(Space space, Address start, Extent bytes, int metaDataPagesPerRegion) { + super(space, start); this.cursor = start; this.sentinel = start.plus(bytes); this.metaDataPagesPerRegion = metaDataPagesPerRegion; @@ -73,14 +70,12 @@ * * CURRENTLY UNIMPLEMENTED * - * @param pageBudget The budget of pages available to this memory - * manager before it must poll the collector. * @param space The space to which this resource is attached * @param metaDataPagesPerRegion The number of pages of meta data * that are embedded in each region. */ - public MonotonePageResource(int pageBudget, Space space, int metaDataPagesPerRegion) { - super(pageBudget, space); + public MonotonePageResource(Space space, int metaDataPagesPerRegion) { + super(space); /* unimplemented */ this.start = Address.zero(); this.cursor = Address.zero(); @@ -123,13 +118,13 @@ * mmpapped and zeroed before returning the address of the start of * the region. If the request cannot be satisfied, return zero. * - * @param requestPages The number of pages to be allocated. + * @param reservedPages The number of pages reserved due to the initial request. + * @param requiredPages The number of pages required to be allocated. * @return The start of the first page if successful, zero on * failure. */ @Inline - protected Address allocPages(int requestPages) { - int pages = requestPages; + protected Address allocPages(int reservedPages, int requiredPages) { boolean newChunk = false; lock(); Address rtn = cursor; @@ -140,20 +135,20 @@ if (metaDataPagesPerRegion != 0) { /* adjust allocation for metadata */ - Address regionStart = getRegionStart(cursor.plus(Conversions.pagesToBytes(pages))); + Address regionStart = getRegionStart(cursor.plus(Conversions.pagesToBytes(requiredPages))); Offset regionDelta = regionStart.diff(cursor); if (regionDelta.sGE(Offset.zero())) { /* start new region, so adjust pages and return address accordingly */ - pages += Conversions.bytesToPages(regionDelta) + metaDataPagesPerRegion; + requiredPages += Conversions.bytesToPages(regionDelta) + metaDataPagesPerRegion; rtn = regionStart.plus(Conversions.pagesToBytes(metaDataPagesPerRegion)); } } - Extent bytes = Conversions.pagesToBytes(pages); + Extent bytes = Conversions.pagesToBytes(requiredPages); Address tmp = cursor.plus(bytes); if (!contiguous && tmp.GT(sentinel)) { /* we're out of virtual memory within our discontiguous region, so ask for more */ - int requiredChunks = Space.requiredChunks(pages); + int requiredChunks = Space.requiredChunks(requiredPages); start = space.growDiscontiguousSpace(requiredChunks); cursor = start; sentinel = cursor.plus(start.isZero() ? 0 : requiredChunks<<Space.LOG_BYTES_IN_CHUNK); @@ -169,12 +164,12 @@ } else { Address old = cursor; cursor = tmp; - commitPages(requestPages, pages); + commitPages(reservedPages, requiredPages); space.growSpace(old, bytes, newChunk); unlock(); - Mmapper.ensureMapped(old, pages); + Mmapper.ensureMapped(old, requiredPages); VM.memory.zero(old, bytes); - VM.events.tracePageAcquired(space, rtn, pages); + VM.events.tracePageAcquired(space, rtn, requiredPages); return rtn; } } @@ -189,8 +184,8 @@ * @return The number of required pages, inclusive of any metadata */ public int adjustForMetaData(int pages) { - return (metaDataPagesPerRegion * pages) / EmbeddedMetaData.PAGES_IN_REGION; - } + return pages + ((pages + EmbeddedMetaData.PAGES_IN_REGION - 1) >> EmbeddedMetaData.LOG_PAGES_IN_REGION) * metaDataPagesPerRegion; + } /** * Adjust a page request to include metadata requirements, if any.<p> @@ -208,10 +203,11 @@ * @return The number of required pages, inclusive of any metadata */ public int adjustForMetaData(int pages, Address begin) { - if (getRegionStart(begin).plus(metaDataPagesPerRegion<<LOG_BYTES_IN_PAGE).EQ(begin)) + if (getRegionStart(begin).plus(metaDataPagesPerRegion<<LOG_BYTES_IN_PAGE).EQ(begin)) { pages += metaDataPagesPerRegion; + } return pages; - } + } private static Address getRegionStart(Address addr) { return addr.toWord().and(Word.fromIntSignExtend(EmbeddedMetaData.BYTES_IN_REGION - 1).not()).toAddress(); Modified: rvmroot/trunk/MMTk/src/org/mmtk/utility/heap/PageResource.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/utility/heap/PageResource.java 2010-09-22 05:47:44 UTC (rev 15996) +++ rvmroot/trunk/MMTk/src/org/mmtk/utility/heap/PageResource.java 2010-09-22 06:19:58 UTC (rev 15997) @@ -56,14 +56,13 @@ // page budgeting protected int reserved; protected int committed; - private final int pageBudget; protected final boolean contiguous; protected final Space space; protected Address start; // only for contiguous // locking - private final Lock lock; // used by mutators + private final Lock lock; /**************************************************************************** * @@ -77,12 +76,9 @@ /** * Constructor * - * @param pageBudget The budget of pages available to this memory - * manager before it must poll the collector. * @param space The space to which this resource is attached */ - private PageResource(int pageBudget, Space space, boolean contiguous) { - this.pageBudget = pageBudget; + private PageResource(Space space, boolean contiguous) { this.contiguous = contiguous; this.space = space; lock = VM.newLock(space.getName() + ".lock"); @@ -91,23 +87,19 @@ /** * Constructor for discontiguous spaces * - * @param pageBudget The budget of pages available to this memory - * manager before it must poll the collector. * @param space The space to which this resource is attached */ - PageResource(int pageBudget, Space space) { - this(pageBudget, space, false); + PageResource(Space space) { + this(space, false); } /** * Constructor for contiguous spaces * - * @param pageBudget The budget of pages available to this memory - * manager before it must poll the collector. * @param space The space to which this resource is attached */ - PageResource(int pageBudget, Space space, Address start) { - this(pageBudget, space, true); + PageResource(Space space, Address start) { + this(space, true); this.start = start; } @@ -138,69 +130,32 @@ * page budget then the caller must poll in case a GC is necessary. * * @param pages The number of pages requested - * @return True if the page budget could satisfy the request. + * @return The actual number of pages reserved (including metadata, etc.) */ @Inline - public final boolean reservePages(int pages) { + public final int reservePages(int pages) { lock(); - reserved += adjustForMetaData(pages); - boolean satisfied = reserved <= pageBudget; + pages = adjustForMetaData(pages); + reserved += pages; unlock(); - return satisfied; + return pages; } /** * Remove a request to the space. * - * @param pages The number of pages in the request. + * @param pages The number of pages returned due to the request. */ @Inline - public final void clearRequest(int pages) { + public final void clearRequest(int reservedPages) { lock(); - reserved -= adjustForMetaData(pages); + reserved -= reservedPages; unlock(); } - /** - * Reserve pages unconditionally.<p> - * - * An example of where this is useful is in cases where it is - * desirable to put some space aside as head-room. By - * unconditionally reserving the pages, the pages are counted - * against the collecto... [truncated message content] |
From: <dfr...@us...> - 2010-10-06 06:32:33
|
Revision: 16012 http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=16012&view=rev Author: dframpton-oss Date: 2010-10-06 06:32:27 +0000 (Wed, 06 Oct 2010) Log Message: ----------- Fixes for mark compact. Make sure we snip obsolete methods before we report those methods as roots. Modified Paths: -------------- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Scanning.java rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Scanning.java rvmroot/trunk/MMTk/src/org/mmtk/plan/Simple.java rvmroot/trunk/MMTk/src/org/mmtk/vm/Scanning.java Modified: rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Scanning.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Scanning.java 2010-10-06 05:30:21 UTC (rev 16011) +++ rvmroot/trunk/MMTk/ext/vm/harness/org/mmtk/harness/vm/Scanning.java 2010-10-06 06:32:27 UTC (rev 16012) @@ -120,6 +120,15 @@ } /** + * Called the first time during a collection that thread's stacks + * have been scanned. This can be used (for example) to clean up + * obsolete compiled methods that are no longer being executed. + */ + @Override + public void notifyInitialThreadScanComplete() { + } + + /** * Computes static roots. This method establishes all such roots for * collection and places them in the root locations queue. This method * should not have side effects (such as copying or forwarding of Modified: rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Scanning.java =================================================================== --- rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Scanning.java 2010-10-06 05:30:21 UTC (rev 16011) +++ rvmroot/trunk/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Scanning.java 2010-10-06 06:32:27 UTC (rev 16012) @@ -92,8 +92,15 @@ */ public void resetThreadCounter() { threadCounter.reset(); + } + + /** + * Called the first time during a collection that thread's stacks + * have been scanned. This can be used (for example) to clean up + * obsolete compiled methods that are no longer being executed. + */ + public void notifyInitialThreadScanComplete() { CompiledMethods.snipObsoleteCompiledMethods(); - /* flush out any remset entries generated during the above activities */ Selected.Mutator.get().flushRememberedSets(); } Modified: rvmroot/trunk/MMTk/src/org/mmtk/plan/Simple.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/plan/Simple.java 2010-10-06 05:30:21 UTC (rev 16011) +++ rvmroot/trunk/MMTk/src/org/mmtk/plan/Simple.java 2010-10-06 06:32:27 UTC (rev 16012) @@ -115,6 +115,7 @@ Phase.scheduleCollector (PREPARE), Phase.scheduleComplex (prepareStacks), Phase.scheduleCollector (STACK_ROOTS), + Phase.scheduleGlobal (STACK_ROOTS), Phase.scheduleCollector (ROOTS), Phase.scheduleGlobal (ROOTS), Phase.scheduleGlobal (CLOSURE), @@ -221,6 +222,12 @@ return; } + if (phaseId == STACK_ROOTS) { + VM.scanning.notifyInitialThreadScanComplete(); + setGCStatus(GC_PROPER); + return; + } + if (phaseId == ROOTS) { VM.scanning.resetThreadCounter(); setGCStatus(GC_PROPER); Modified: rvmroot/trunk/MMTk/src/org/mmtk/vm/Scanning.java =================================================================== --- rvmroot/trunk/MMTk/src/org/mmtk/vm/Scanning.java 2010-10-06 05:30:21 UTC (rev 16011) +++ rvmroot/trunk/MMTk/src/org/mmtk/vm/Scanning.java 2010-10-06 06:32:27 UTC (rev 16012) @@ -48,6 +48,13 @@ public abstract void resetThreadCounter(); /** + * Called the first time during a collection that thread's stacks + * have been scanned. This can be used (for example) to clean up + * obsolete compiled methods that are no longer being executed. + */ + public abstract void notifyInitialThreadScanComplete(); + + /** * Computes static roots. This method establishes all such roots for * collection and places them in the root locations queue. This method * should not have side effects (such as copying or forwarding of This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |