From: <dfr...@us...> - 2009-02-28 02:36:58
|
Revision: 15547 http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=15547&view=rev Author: dframpton-oss Date: 2009-02-28 02:36:49 +0000 (Sat, 28 Feb 2009) Log Message: ----------- Merge to 15545 Modified Paths: -------------- rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/ext/vm/harness/org/mmtk/harness/vm/ObjectModel.java rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Collection.java rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Factory.java rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/FinalizableProcessor.java rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/ScanThread.java rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Scanning.java rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/harness/vmmagic/org/vmmagic/unboxed/ArchitecturalWord32.java rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/harness/vmmagic/org/vmmagic/unboxed/ArchitecturalWord64.java rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/ControllerCollectorContext.java rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/ParallelCollectorGroup.java rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/copyms/CopyMS.java rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/copyms/CopyMSConstraints.java rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/copyms/CopyMSTraceLocal.java rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/generational/Gen.java rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/generational/marksweep/GenMSCollector.java rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/marksweep/MS.java rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/marksweep/MSCollector.java rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/marksweep/MSConstraints.java rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/marksweep/MSMutator.java rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/marksweep/MSTraceLocal.java rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/nogc/NoGC.java rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/nogc/NoGCCollector.java rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/nogc/NoGCConstraints.java rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/nogc/NoGCMutator.java rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/nogc/NoGCTraceLocal.java rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/stickyms/StickyMSCollector.java rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/policy/Space.java rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/policy/immix/Block.java rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/policy/immix/Chunk.java rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/policy/immix/ImmixConstants.java rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/utility/Conversions.java rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/utility/alloc/ImmixAllocator.java rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/vm/Factory.java rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/vm/VM.java rvmroot/branches/RVM-777-NewMMTkGlue/work/build/components/harmony.xml rvmroot/branches/RVM-777-NewMMTkGlue/work/build/hosts/ppc64-aix.properties rvmroot/branches/RVM-777-NewMMTkGlue/work/build/primordials/Harmony.txt rvmroot/branches/RVM-777-NewMMTkGlue/work/build/primordials/RVM.txt rvmroot/branches/RVM-777-NewMMTkGlue/work/build.xml rvmroot/branches/RVM-777-NewMMTkGlue/work/libraryInterface/Harmony/ASF/src/java/lang/Runtime.java rvmroot/branches/RVM-777-NewMMTkGlue/work/libraryInterface/Harmony/ASF/src/java/lang/Thread.java rvmroot/branches/RVM-777-NewMMTkGlue/work/libraryInterface/Harmony/ASF/src/java/lang/Throwable.java rvmroot/branches/RVM-777-NewMMTkGlue/work/rvm/src/org/jikesrvm/VM.java rvmroot/branches/RVM-777-NewMMTkGlue/work/rvm/src/org/jikesrvm/classloader/ClassFileReader.java rvmroot/branches/RVM-777-NewMMTkGlue/work/rvm/src/org/jikesrvm/classloader/TypeReference.java rvmroot/branches/RVM-777-NewMMTkGlue/work/rvm/src/org/jikesrvm/compilers/baseline/BuildBB.java rvmroot/branches/RVM-777-NewMMTkGlue/work/rvm/src/org/jikesrvm/compilers/baseline/BuildReferenceMaps.java rvmroot/branches/RVM-777-NewMMTkGlue/work/rvm/src/org/jikesrvm/compilers/baseline/JSRInfo.java rvmroot/branches/RVM-777-NewMMTkGlue/work/rvm/src/org/jikesrvm/compilers/baseline/ReferenceMaps.java rvmroot/branches/RVM-777-NewMMTkGlue/work/rvm/src/org/jikesrvm/compilers/baseline/TemplateCompilerFramework.java rvmroot/branches/RVM-777-NewMMTkGlue/work/rvm/src/org/jikesrvm/compilers/baseline/ia32/BaselineCompilerImpl.java rvmroot/branches/RVM-777-NewMMTkGlue/work/rvm/src/org/jikesrvm/compilers/baseline/ia32/BaselineGCMapIterator.java rvmroot/branches/RVM-777-NewMMTkGlue/work/rvm/src/org/jikesrvm/compilers/baseline/ia32/BaselineMagic.java rvmroot/branches/RVM-777-NewMMTkGlue/work/rvm/src/org/jikesrvm/compilers/opt/bc2ir/BC2IR.java rvmroot/branches/RVM-777-NewMMTkGlue/work/rvm/src/org/jikesrvm/ia32/BaselineConstants.java rvmroot/branches/RVM-777-NewMMTkGlue/work/rvm/src/org/jikesrvm/ia32/OutOfLineMachineCode.java rvmroot/branches/RVM-777-NewMMTkGlue/work/rvm/src/org/jikesrvm/ia32/Registers.java rvmroot/branches/RVM-777-NewMMTkGlue/work/rvm/src/org/jikesrvm/jni/JNIEnvironment.java rvmroot/branches/RVM-777-NewMMTkGlue/work/rvm/src/org/jikesrvm/osr/BytecodeTraverser.java rvmroot/branches/RVM-777-NewMMTkGlue/work/rvm/src/org/jikesrvm/osr/bytecodes/InvokeStatic.java rvmroot/branches/RVM-777-NewMMTkGlue/work/rvm/src/org/jikesrvm/ppc/Registers.java rvmroot/branches/RVM-777-NewMMTkGlue/work/rvm/src/org/jikesrvm/runtime/BootRecord.java rvmroot/branches/RVM-777-NewMMTkGlue/work/rvm/src/org/jikesrvm/runtime/Entrypoints.java rvmroot/branches/RVM-777-NewMMTkGlue/work/rvm/src/org/jikesrvm/runtime/FileSystem.java rvmroot/branches/RVM-777-NewMMTkGlue/work/rvm/src/org/jikesrvm/runtime/SysCall.java rvmroot/branches/RVM-777-NewMMTkGlue/work/rvm/src/org/jikesrvm/scheduler/FinalizerThread.java rvmroot/branches/RVM-777-NewMMTkGlue/work/rvm/src/org/jikesrvm/scheduler/Latch.java rvmroot/branches/RVM-777-NewMMTkGlue/work/rvm/src/org/jikesrvm/scheduler/RVMThread.java rvmroot/branches/RVM-777-NewMMTkGlue/work/rvm/src/org/jikesrvm/scheduler/SpinLock.java rvmroot/branches/RVM-777-NewMMTkGlue/work/rvm/src/org/jikesrvm/scheduler/ThinLock.java rvmroot/branches/RVM-777-NewMMTkGlue/work/rvm/src/org/jikesrvm/scheduler/TimerThread.java rvmroot/branches/RVM-777-NewMMTkGlue/work/rvm/src-generated/opt-burs/ia32/IA32.rules rvmroot/branches/RVM-777-NewMMTkGlue/work/rvm/src-generated/options/BooleanOptions.vm.dat rvmroot/branches/RVM-777-NewMMTkGlue/work/testing/tests/perf-jvm98/jvm98.properties rvmroot/branches/RVM-777-NewMMTkGlue/work/tools/bootImageRunner/bootImageRunner.h rvmroot/branches/RVM-777-NewMMTkGlue/work/tools/bootImageRunner/harmony.c rvmroot/branches/RVM-777-NewMMTkGlue/work/tools/bootImageRunner/harmony.exp rvmroot/branches/RVM-777-NewMMTkGlue/work/tools/bootImageRunner/ia32/libvm.c rvmroot/branches/RVM-777-NewMMTkGlue/work/tools/bootImageRunner/jvm.C rvmroot/branches/RVM-777-NewMMTkGlue/work/tools/bootImageRunner/rvm.harmony rvmroot/branches/RVM-777-NewMMTkGlue/work/tools/bootImageRunner/sys.C Added Paths: ----------- rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Monitor.java rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/vm/Monitor.java rvmroot/branches/RVM-777-NewMMTkGlue/work/libraryInterface/GNUClasspath/LGPL/src/gnu/java/nio/VMChannel.java rvmroot/branches/RVM-777-NewMMTkGlue/work/rvm/src/org/jikesrvm/scheduler/Monitor.java rvmroot/branches/RVM-777-NewMMTkGlue/work/rvm/src/org/jikesrvm/scheduler/NoYieldpointsMonitor.java Removed Paths: ------------- rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/HeavyCondLock.java rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/vm/HeavyCondLock.java rvmroot/branches/RVM-777-NewMMTkGlue/work/rvm/src/org/jikesrvm/scheduler/HeavyCondLock.java rvmroot/branches/RVM-777-NewMMTkGlue/work/rvm/src/org/jikesrvm/scheduler/NoYieldpointsCondLock.java Modified: rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/ext/vm/harness/org/mmtk/harness/vm/ObjectModel.java =================================================================== --- rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/ext/vm/harness/org/mmtk/harness/vm/ObjectModel.java 2009-02-28 01:50:45 UTC (rev 15546) +++ rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/ext/vm/harness/org/mmtk/harness/vm/ObjectModel.java 2009-02-28 02:36:49 UTC (rev 15547) @@ -12,6 +12,7 @@ */ package org.mmtk.harness.vm; +import java.io.PrintStream; import java.util.Stack; import org.mmtk.harness.Collector; @@ -37,14 +38,14 @@ * Status Word (includes GC) * References * Data - * - * Only tested using 32 bit and assumes at least 32 bits. */ + private static final boolean IS_32_BIT = ArchitecturalWord.getModel().bitsInWord() == 32; + /** The total header size (including any requested GC words) */ - public static final int HEADER_WORDS = 4 + ActivePlan.constraints.gcHeaderWords(); + public static final int HEADER_WORDS = (IS_32_BIT ? 5 : 3) + ActivePlan.constraints.gcHeaderWords(); /** The number of bytes in the header */ - public static final int HEADER_SIZE = HEADER_WORDS << SimulatedMemory.LOG_BYTES_IN_WORD; + private static final int HEADER_SIZE = HEADER_WORDS << SimulatedMemory.LOG_BYTES_IN_WORD; /** The number of bytes requested for GC in the header */ private static final int GC_HEADER_BYTES = ActivePlan.constraints.gcHeaderWords() << SimulatedMemory.LOG_BYTES_IN_WORD; @@ -63,6 +64,22 @@ /** The offset of the first reference field. */ public static final Offset REFS_OFFSET = STATUS_OFFSET.plus(SimulatedMemory.BYTES_IN_WORD); + @SuppressWarnings("unused") + private static void printObjectLayout(PrintStream wr) { + wr.printf("GC_OFFSET=%s:%d, ID_OFFSET=%s, SITE_OFFSET=%s%n", + GC_OFFSET, GC_HEADER_BYTES, ID_OFFSET, SITE_OFFSET); + wr.printf("DATACOUNT_OFFSET=%s, REFCOUNT_OFFSET=%s, STATUS_OFFSET=%s%n", + DATACOUNT_OFFSET, REFCOUNT_OFFSET, STATUS_OFFSET); + wr.printf("REFS_OFFSET=%s, HEADER_SIZE=%d%n", + REFS_OFFSET,HEADER_SIZE); + wr.flush(); + } + + static { + //printObjectLayout(System.out); + assert REFS_OFFSET.EQ(Offset.fromIntSignExtend(HEADER_SIZE)); + } + public static final int MAX_DATA_FIELDS = Integer.MAX_VALUE; public static final int MAX_REF_FIELDS = Integer.MAX_VALUE; @@ -125,7 +142,7 @@ * Get the number of references in the object. */ public static int getRefs(ObjectReference object) { - return object.toAddress().loadShort(REFCOUNT_OFFSET); + return object.toAddress().loadInt(REFCOUNT_OFFSET); } /** @@ -167,7 +184,7 @@ * Get the number of data words in the object. */ public static int getDataCount(ObjectReference object) { - return object.toAddress().loadShort(DATACOUNT_OFFSET); + return object.toAddress().loadInt(DATACOUNT_OFFSET); } /** Modified: rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Collection.java =================================================================== --- rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Collection.java 2009-02-28 01:50:45 UTC (rev 15546) +++ rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Collection.java 2009-02-28 02:36:49 UTC (rev 15547) @@ -59,6 +59,9 @@ */ @Unpreemptible public void blockForGC() { + RVMThread t=RVMThread.getCurrentThread(); + t.assertAcceptableStates(RVMThread.IN_JAVA, RVMThread.IN_JAVA_TO_BLOCK); + RVMThread.observeExecStatusAtSTW(t.getExecStatus()); RVMThread.getCurrentThread().block(RVMThread.gcBlockAdapter); } Modified: rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Factory.java =================================================================== --- rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Factory.java 2009-02-28 01:50:45 UTC (rev 15546) +++ rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Factory.java 2009-02-28 02:36:49 UTC (rev 15547) @@ -138,18 +138,19 @@ } /** - * Create a new HeavyCondLock instance using the appropriate VM-specific + * Create a new Monitor instance using the appropriate VM-specific * concrete Lock sub-class. * - * @see Lock - * @param name The string to be associated with this lock instance - * @return A concrete VM-specific HeavyCondLock instance. + * @see Monitor + * + * @param name The string to be associated with this monitor instance + * @return A concrete VM-specific Monitor instance. */ - public org.mmtk.vm.HeavyCondLock newHeavyCondLock(String name) { + public org.mmtk.vm.Monitor newMonitor(String name) { try { - return new HeavyCondLock(name); + return new Monitor(name); } catch (Exception e) { - VM.sysFail("Failed to allocate new Lock!"); + VM.sysFail("Failed to allocate new Monitor!"); return null; // never get here } } Modified: rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/FinalizableProcessor.java =================================================================== --- rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/FinalizableProcessor.java 2009-02-28 01:50:45 UTC (rev 15546) +++ rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/FinalizableProcessor.java 2009-02-28 02:36:49 UTC (rev 15547) @@ -20,12 +20,12 @@ import org.jikesrvm.mm.mminterface.Selected; import org.jikesrvm.runtime.Magic; import org.jikesrvm.Services; -import org.jikesrvm.scheduler.RVMThread; import org.mmtk.plan.TraceLocal; /** * This class manages the processing of finalizable objects. */ +// can this be a linked list? @Uninterruptible public final class FinalizableProcessor extends org.mmtk.vm.FinalizableProcessor implements SizeConstants { @@ -64,9 +64,6 @@ /** Index of the first free slot in the table. */ protected volatile int maxIndex = 0; - /** Flag to prevent a race between threads growing the table. */ - private volatile boolean growingTables = false; - /** Next object ready to be finalized */ private volatile int nextReadyIndex = 0; @@ -79,30 +76,50 @@ protected FinalizableProcessor() {} /** - * Grow the table. - * - * Can GC when it allocates, but the rest of the code can't tolerate GC. - * This method is called without the reference processor lock held, but with - * the flag <code>growingTable</code> set. + * 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. */ - @UninterruptibleNoWarn - @Unpreemptible("Non-preemptible but allocates larger table") - private void growTables() { - if (maxIndex >= table.length()) { - int newLength = STRESS ? table.length() + 1 : (int)(table.length() * GROWTH_FACTOR); - AddressArray newTable = AddressArray.create(newLength); - for (int i=0; i < table.length(); i++) { - newTable.set(i, table.get(i)); + @NoInline + @UnpreemptibleNoWarn("Non-preemptible but yield when table needs to be grown") + public void add(Object object) { + lock.acquire(); + while (maxIndex>=table.length() || maxIndex >= freeReady()) { + int newTableSize=-1; + int newReadyForFinalizeSize=-1; + AddressArray newTable=null; + Object[] newReadyForFinalize=null; + + if (maxIndex>=table.length()) { + newTableSize=STRESS ? table.length() + 1 : (int)(table.length() * GROWTH_FACTOR); } - table = newTable; - } - if (maxIndex >= freeReady()) { - /* Logically we need to be able to store all these values in the ready table */ - int readyLength = table.length() + countReady(); - if (readyLength > readyForFinalize.length) { - /* Need to grow the ready table also */ - Object[] newReadyForFinalize = new Object[readyLength]; + if (maxIndex>=freeReady()) { + newReadyForFinalizeSize=table.length() + countReady(); + if (newReadyForFinalizeSize<=readyForFinalize.length) { + newReadyForFinalizeSize=-1; + } + } + + { + lock.release(); + if (newTableSize>=0) { + newTable=AddressArray.create(newTableSize); + } + if (newReadyForFinalizeSize>=0) { + newReadyForFinalize=new Object[newReadyForFinalizeSize]; + } + lock.acquire(); + } + + if (maxIndex>=table.length() && newTable!=null) { + for (int i=0; i < table.length(); i++) { + newTable.set(i, table.get(i)); + } + table = newTable; + } + + if (maxIndex>=freeReady() && newReadyForFinalize!=null) { int j = 0; for(int i=nextReadyIndex; i < lastReadyIndex && i < readyForFinalize.length; i++) { newReadyForFinalize[j++] = readyForFinalize[i]; @@ -117,43 +134,6 @@ readyForFinalize = newReadyForFinalize; } } - } - - /** - * 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. - */ - @NoInline - @Unpreemptible("Non-preemptible but yield when table needs to be grown") - public void add(Object object) { - /* - * Ensure that only one thread at a time can grow the - * table of references. The volatile flag <code>growingTable</code> is - * used to allow growing the table to trigger GC, but to prevent - * any other thread from accessing the table while it is being grown. - * - * If the table has space, threads will add the reference, incrementing maxIndex - * and exit. - * - * If the table is full, the first thread to notice will grow the table. - * Subsequent threads will release the lock and yield at (1) while the - * first thread grows the table. - */ - lock.acquire(); - while (growingTables || maxIndex >= table.length() || maxIndex >= freeReady()) { - if (growingTables) { - lock.release(); - RVMThread.yield(); // (1) Allow another thread to grow the table - lock.acquire(); - } else { - growingTables = true; // Prevent other threads from growing table while lock is released - lock.release(); // Can't hold the lock while allocating - growTables(); - lock.acquire(); - growingTables = false; // Allow other threads to grow the table rather than waiting for us - } - } table.set(maxIndex++, Magic.objectAsAddress(object)); lock.release(); } @@ -212,7 +192,7 @@ /* Make ready for finalize */ ref = trace.retainForFinalize(ref); - + /* Add to object table */ Offset offset = Word.fromIntZeroExtend(lastReadyIndex).lsh(LOG_BYTES_IN_ADDRESS).toOffset(); Selected.Plan.get().storeObjectReference(Magic.objectAsAddress(readyForFinalize).plus(offset), ref); @@ -233,11 +213,6 @@ @Unpreemptible("Non-preemptible but may pause if another thread is growing the table") public Object getReady() { lock.acquire(); - while (growingTables) { - lock.release(); - RVMThread.yield(); // (1) Allow another thread to grow the table - lock.acquire(); - } Object result = null; if (nextReadyIndex != lastReadyIndex) { result = readyForFinalize[nextReadyIndex]; Deleted: rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/HeavyCondLock.java =================================================================== --- rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/HeavyCondLock.java 2009-02-28 01:50:45 UTC (rev 15546) +++ rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/HeavyCondLock.java 2009-02-28 02:36:49 UTC (rev 15547) @@ -1,57 +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.jikesrvm.mm.mmtk; - -import org.vmmagic.pragma.Uninterruptible; - -/** - * Provides MMTk access to a heavy lock with condition variable. - * Functionally similar to Java monitors, but safe in the darker corners of runtime code. - */ -@Uninterruptible -public final class HeavyCondLock extends org.mmtk.vm.HeavyCondLock { - - private final org.jikesrvm.scheduler.HeavyCondLock theLock; - - public HeavyCondLock(String name) { - this.theLock = new org.jikesrvm.scheduler.HeavyCondLock(); - } - - /** - * Block until the lock is acquired. - */ - public void lock() { - theLock.lock(); - } - - /** - * Release the lock. - */ - public void unlock() { - theLock.unlock(); - } - - /** - * Wait for a broadcast. - */ - public void await() { - theLock.await(); - } - - /** - * Send a broadcast. - */ - public void broadcast() { - theLock.broadcast(); - } -} Copied: rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Monitor.java (from rev 15504, rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/HeavyCondLock.java) =================================================================== --- rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Monitor.java (rev 0) +++ rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Monitor.java 2009-02-28 02:36:49 UTC (rev 15547) @@ -0,0 +1,57 @@ +/* + * 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; + +/** + * Provides MMTk access to a heavy lock with condition variable. + * Functionally similar to Java monitors, but safe in the darker corners of runtime code. + */ +@Uninterruptible +public final class Monitor extends org.mmtk.vm.Monitor { + + private final org.jikesrvm.scheduler.Monitor theLock; + + public Monitor(String name) { + this.theLock = new org.jikesrvm.scheduler.Monitor(); + } + + /** + * Block until the lock is acquired. + */ + public void lock() { + theLock.lock(); + } + + /** + * Release the lock. + */ + public void unlock() { + theLock.unlock(); + } + + /** + * Wait for a broadcast. + */ + public void await() { + theLock.await(); + } + + /** + * Send a broadcast. + */ + public void broadcast() { + theLock.broadcast(); + } +} Property changes on: rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Monitor.java ___________________________________________________________________ Added: svn:mergeinfo + Modified: rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/ScanThread.java =================================================================== --- rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/ScanThread.java 2009-02-28 01:50:45 UTC (rev 15546) +++ rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/ScanThread.java 2009-02-28 02:36:49 UTC (rev 15547) @@ -34,6 +34,7 @@ import org.vmmagic.unboxed.Address; import org.vmmagic.unboxed.ObjectReference; import org.vmmagic.unboxed.Offset; +import org.jikesrvm.ArchitectureSpecific.Registers; /** * Class that supports scanning thread stacks for references during @@ -92,7 +93,7 @@ * use these when running with PROCESSORS=1 */ private static final int DEFAULT_VERBOSITY = 0 /*0*/; - private static final int FAILURE_VERBOSITY = 3; + private static final int FAILURE_VERBOSITY = 4; /*********************************************************************** * @@ -126,8 +127,19 @@ */ public static void scanThread(RVMThread thread, TraceLocal trace, boolean processCodeLocations) { + if (DEFAULT_VERBOSITY>=1) { + VM.sysWriteln("scanning ",thread.getThreadSlot()); + } + /* get the gprs associated with this thread */ - Address gprs = Magic.objectAsAddress(thread.getContextRegisters().gprs); + Registers regs=thread.getContextRegisters(); + Address gprs = Magic.objectAsAddress(regs.gprs); + + Address ip=regs.getInnermostInstructionAddress(); + Address fp=regs.getInnermostFramePointer(); + regs.clear(); + regs.setInnermost(ip,fp); + scanThread(thread, trace, processCodeLocations, gprs, Address.zero()); } @@ -153,9 +165,9 @@ * @param topFrame The top frame of the stack being scanned, or zero * if this is to be inferred from the thread (normally the case). */ - public static void scanThread(RVMThread thread, TraceLocal trace, - boolean processCodeLocations, - Address gprs, Address topFrame) { + private static void scanThread(RVMThread thread, TraceLocal trace, + boolean processCodeLocations, + Address gprs, Address topFrame) { // figure out if the thread should be scanned at all; if not, exit if (thread.getExecStatus()==RVMThread.NEW || thread.getIsAboutToTerminate()) { return; @@ -235,7 +247,7 @@ if (false) { VM.sysWriteln("Scanning thread ",thread.getThreadSlot()," from thread ",RVMThread.getCurrentThreadSlot()); } - if (verbosity >= 1) { + if (verbosity >= 2) { Log.writeln("--- Start Of Stack Scan ---\n"); Log.write("Thread #"); Log.writeln(thread.getThreadSlot()); @@ -248,7 +260,7 @@ /* reinitialize the stack iterator group */ iteratorGroup.newStackWalk(thread, gprs); - if (verbosity >= 1) dumpTopFrameInfo(verbosity); + if (verbosity >= 2) dumpTopFrameInfo(verbosity); /* scan each frame if a non-empty stack */ if (fp.NE(ArchitectureSpecific.StackframeLayoutConstants.STACKFRAME_SENTINEL_FP)) { @@ -269,7 +281,7 @@ /* If a thread started via createVM or attachVM, base may need scaning */ checkJNIBase(); - if (verbosity >= 1) Log.writeln("--- End Of Stack Scan ---\n"); + if (verbosity >= 2) Log.writeln("--- End Of Stack Scan ---\n"); } /** @@ -363,7 +375,7 @@ if (compiledMethodType != CompiledMethod.TRAP && compiledMethod.getMethod().getDeclaringClass().hasBridgeFromNativeAnnotation()) { fp = RuntimeEntrypoints.unwindNativeStackFrameForGC(fp); - if (verbosity >= 1) Log.write("scanFrame skipping native C frames\n"); + if (verbosity >= 2) Log.write("scanFrame skipping native C frames\n"); } return fp; } @@ -385,7 +397,7 @@ /* skip "invisible" transition frames generated by reflection and JNI) */ if (compiledMethodId == ArchitectureSpecific.ArchConstants.INVISIBLE_METHOD_ID) { - if (verbosity >= 1) Log.writeln("\n--- METHOD <invisible method>"); + if (verbosity >= 2) Log.writeln("\n--- METHOD <invisible method>"); return false; } @@ -395,7 +407,7 @@ compiledMethodType = compiledMethod.getCompilerType(); - if (verbosity >= 1) printMethodHeader(); + if (verbosity >= 2) printMethodHeader(); /* get the code associated with this frame */ Offset offset = compiledMethod.getInstructionOffset(ip); @@ -404,8 +416,8 @@ iterator = iteratorGroup.selectIterator(compiledMethod); iterator.setupIterator(compiledMethod, offset, fp); - if (verbosity >= 2) dumpStackFrame(verbosity); - if (verbosity >= 3) Log.writeln("--- Refs Reported By GCMap Iterator ---"); + if (verbosity >= 3) dumpStackFrame(verbosity); + if (verbosity >= 4) Log.writeln("--- Refs Reported By GCMap Iterator ---"); return true; } @@ -431,7 +443,7 @@ !refaddr.isZero(); refaddr = iterator.getNextReferenceAddress()) { if (VALIDATE_REFS) checkReference(refaddr, verbosity); - if (verbosity >= 3) dumpRef(refaddr, verbosity); + if (verbosity >= 4) dumpRef(refaddr, verbosity); reportDelayedRootEdge(trace, refaddr); } } @@ -489,7 +501,7 @@ */ private void pushFrameIP(ObjectReference code, int verbosity) { if (prevFp.isZero()) { /* top of stack: IP in thread state */ - if (verbosity >= 2) { + if (verbosity >= 3) { Log.write(" t.contextRegisters.ip = "); Log.writeln(thread.getContextRegisters().ip); Log.write("*t.contextRegisters.iploc = "); @@ -498,13 +510,13 @@ /* skip native code, as it is not (cannot be) moved */ if (compiledMethodType != CompiledMethod.JNI) processCodeLocation(code, initialIPLoc); - else if (verbosity >=3) { + else if (verbosity >= 4) { Log.writeln("GC Warning: SKIPPING return address for JNI code"); } } else { /* below top of stack: IP is return address, in prev frame */ Address returnAddressLoc = Magic.getReturnAddressLocation(prevFp); Address returnAddress = returnAddressLoc.loadAddress(); - if (verbosity >= 3) { + if (verbosity >= 4) { Log.write("--- Processing return address "); Log.write(returnAddress); Log.write(" located at "); Log.writeln(returnAddressLoc); } @@ -599,7 +611,7 @@ Log.write(" ip = "); Log.writeln(ip); Log.write(" fp = "); Log.writeln(fp); Log.write(" registers.ip = "); Log.writeln(thread.getContextRegisters().ip); - if (verbosity >= 2 && thread.getJNIEnv() != null) + if (verbosity >= 3 && thread.getJNIEnv() != null) thread.getJNIEnv().dumpJniRefsStack(); } @@ -613,7 +625,7 @@ private void dumpRef(Address refaddr, int verbosity) { ObjectReference ref = refaddr.loadObjectReference(); VM.sysWrite(refaddr); - if (verbosity >= 4) { + if (verbosity >= 5) { VM.sysWrite(":"); MemoryManager.dumpRef(ref); } else VM.sysWriteln(); @@ -748,7 +760,7 @@ Log.write(value); Log.write(" "); Log.flush(); - if (verbosity >= 3 && MemoryManager.objectInVM(value) && loc.NE(start) && loc.NE(end)) + if (verbosity >= 4 && MemoryManager.objectInVM(value) && loc.NE(start) && loc.NE(end)) MemoryManager.dumpRef(value); else Log.writeln(); Modified: rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Scanning.java =================================================================== --- rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Scanning.java 2009-02-28 01:50:45 UTC (rev 15546) +++ rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Scanning.java 2009-02-28 02:36:49 UTC (rev 15547) @@ -93,7 +93,7 @@ public void resetThreadCounter() { threadCounter.reset(); CompiledMethods.snipObsoleteCompiledMethods(); - + /* flush out any remset entries generated during the above activities */ Selected.Mutator.get().flushRememberedSets(); } Modified: rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/harness/vmmagic/org/vmmagic/unboxed/ArchitecturalWord32.java =================================================================== --- rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/harness/vmmagic/org/vmmagic/unboxed/ArchitecturalWord32.java 2009-02-28 01:50:45 UTC (rev 15546) +++ rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/harness/vmmagic/org/vmmagic/unboxed/ArchitecturalWord32.java 2009-02-28 02:36:49 UTC (rev 15547) @@ -12,9 +12,10 @@ */ package org.vmmagic.unboxed; -public class ArchitecturalWord32 extends ArchitecturalWord { +public final class ArchitecturalWord32 extends ArchitecturalWord { private final int value; + private static final int SIGN_BIT = 1<<31; ArchitecturalWord32(int value) { assert getModel() == Architecture.BITS32; @@ -38,12 +39,12 @@ @Override public long toLongSignExtend() { - return (long)value; + return value; } @Override public long toLongZeroExtend() { - return (long)value & 0xFFFFFFFFL; + return value & 0xFFFFFFFFL; } @Override @@ -51,12 +52,12 @@ return value == word.toInt(); } + /** + * Unsigned comparison - flip bit 31 and then use signed comparison. + */ @Override boolean LT(ArchitecturalWord word) { - if (value >= 0 && word.toInt() >= 0) return value < word.toInt(); - if (value < 0 && word.toInt() < 0) return value < word.toInt(); - if (value < 0) return false; - return true; + return (value ^ SIGN_BIT) < (word.toInt() ^ SIGN_BIT); } @Override Modified: rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/harness/vmmagic/org/vmmagic/unboxed/ArchitecturalWord64.java =================================================================== --- rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/harness/vmmagic/org/vmmagic/unboxed/ArchitecturalWord64.java 2009-02-28 01:50:45 UTC (rev 15546) +++ rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/harness/vmmagic/org/vmmagic/unboxed/ArchitecturalWord64.java 2009-02-28 02:36:49 UTC (rev 15547) @@ -12,9 +12,10 @@ */ package org.vmmagic.unboxed; -public class ArchitecturalWord64 extends ArchitecturalWord { +public final class ArchitecturalWord64 extends ArchitecturalWord { private final long value; + private static final long SIGN_BIT = 1L<<63; ArchitecturalWord64(long value) { assert getModel() == Architecture.BITS64; @@ -52,10 +53,7 @@ @Override boolean LT(ArchitecturalWord word) { - if (value >= 0 && word.toLongSignExtend() >= 0) return value < word.toLongSignExtend(); - if (value < 0 && word.toLongSignExtend() < 0) return value < word.toLongSignExtend(); - if (value < 0) return false; - return true; + return (value ^ SIGN_BIT) < (word.toLongSignExtend() ^ SIGN_BIT); } @Override Modified: rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/ControllerCollectorContext.java =================================================================== --- rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/ControllerCollectorContext.java 2009-02-28 01:50:45 UTC (rev 15546) +++ rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/ControllerCollectorContext.java 2009-02-28 02:36:49 UTC (rev 15547) @@ -15,7 +15,7 @@ import org.mmtk.utility.Log; import org.mmtk.utility.heap.HeapGrowthManager; import org.mmtk.utility.options.Options; -import org.mmtk.vm.HeavyCondLock; +import org.mmtk.vm.Monitor; import org.mmtk.vm.VM; import org.vmmagic.pragma.*; @@ -24,7 +24,7 @@ public class ControllerCollectorContext extends CollectorContext { /** The lock to use to manage collection */ - private HeavyCondLock lock; + private Monitor lock; /** The set of worker threads to use */ private ParallelCollectorGroup workers; Modified: rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/ParallelCollectorGroup.java =================================================================== --- rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/ParallelCollectorGroup.java 2009-02-28 01:50:45 UTC (rev 15546) +++ rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/ParallelCollectorGroup.java 2009-02-28 02:36:49 UTC (rev 15547) @@ -14,7 +14,7 @@ import org.mmtk.utility.Constants; -import org.mmtk.vm.HeavyCondLock; +import org.mmtk.vm.Monitor; import org.mmtk.vm.VM; import org.vmmagic.pragma.*; @@ -37,7 +37,7 @@ private ParallelCollector[] contexts; /** Lock used to manage group state. */ - private HeavyCondLock lock; + private Monitor lock; /** The number of cycles triggered */ private volatile int triggerCount; Modified: rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/copyms/CopyMS.java =================================================================== --- rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/copyms/CopyMS.java 2009-02-28 01:50:45 UTC (rev 15546) +++ rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/copyms/CopyMS.java 2009-02-28 02:36:49 UTC (rev 15547) @@ -78,12 +78,11 @@ trace = new Trace(metaDataSpace); } + /***************************************************************************** - * * Collection */ - /** * Perform a (global) collection phase. * Modified: rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/copyms/CopyMSConstraints.java =================================================================== --- rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/copyms/CopyMSConstraints.java 2009-02-28 01:50:45 UTC (rev 15546) +++ rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/copyms/CopyMSConstraints.java 2009-02-28 02:36:49 UTC (rev 15547) @@ -24,13 +24,15 @@ * separate from the main Plan/PlanLocal class in order to bypass any * issues with ordering of static initialization. */ -@Uninterruptible public class CopyMSConstraints extends StopTheWorldConstraints { +@Uninterruptible +public class CopyMSConstraints extends StopTheWorldConstraints { - public boolean movesObjects() { return true; } - + @Override public int gcHeaderBits() { return CopySpace.LOCAL_GC_BITS_REQUIRED; } - + @Override public int gcHeaderWords() { return CopySpace.GC_HEADER_WORDS_REQUIRED; } - + @Override public int numSpecializedScans() { return 1; } + @Override + public boolean movesObjects() { return true; } } Modified: rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/copyms/CopyMSTraceLocal.java =================================================================== --- rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/copyms/CopyMSTraceLocal.java 2009-02-28 01:50:45 UTC (rev 15546) +++ rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/copyms/CopyMSTraceLocal.java 2009-02-28 02:36:49 UTC (rev 15547) @@ -20,7 +20,7 @@ import org.vmmagic.unboxed.*; /** - * This class implments the thread-local functionality for a + * This class implements the thread-local functionality for a * transitive closure over a coping/mark-sweep hybrid collector. */ @Uninterruptible @@ -44,6 +44,7 @@ * @param object The object. * @return True if the object is live. */ + @Override public boolean isLive(ObjectReference object) { if (object.isNull()) return false; if (Space.isInSpace(CopyMS.NURSERY, object)) { @@ -70,6 +71,7 @@ * @return The new reference to the same object instance. */ @Inline + @Override public ObjectReference traceObject(ObjectReference object) { if (object.isNull()) return object; if (Space.isInSpace(CopyMS.NURSERY, object)) @@ -85,6 +87,7 @@ * @param object The object to query. * @return True if the object will not move during this collection. */ + @Override public boolean willNotMoveInCurrentCollection(ObjectReference object) { return !Space.isInSpace(CopyMS.NURSERY, object); } Modified: rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/generational/Gen.java =================================================================== --- rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/generational/Gen.java 2009-02-28 01:50:45 UTC (rev 15546) +++ rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/generational/Gen.java 2009-02-28 02:36:49 UTC (rev 15547) @@ -266,16 +266,6 @@ */ /** - * Return the number of pages reserved for copying. - * - * @return The number of pages reserved given the pending - * allocation, including space reserved for copying. - */ - public int getCollectionReserve() { - return nurserySpace.reservedPages() + super.getCollectionReserve(); - } - - /** * Return the number of pages in use given the pending * allocation. Simply add the nursery's contribution to that of * the superclass. @@ -283,6 +273,7 @@ * @return The number of pages reserved given the pending * allocation, excluding space reserved for copying. */ + @Override public int getPagesUsed() { return (nurserySpace.reservedPages() + super.getPagesUsed()); } @@ -294,11 +285,23 @@ * @return The number of pages available for allocation, <i>assuming * all future allocation is to the nursery</i>. */ + @Override public int getPagesAvail() { return super.getPagesAvail() >> 1; } /** + * 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 nurserySpace.reservedPages() + super.getCollectionReserve(); + } + + /** * Return the number of pages available for allocation into the mature * space. * Modified: rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/generational/marksweep/GenMSCollector.java =================================================================== --- rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/generational/marksweep/GenMSCollector.java 2009-02-28 01:50:45 UTC (rev 15546) +++ rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/generational/marksweep/GenMSCollector.java 2009-02-28 02:36:49 UTC (rev 15547) @@ -64,7 +64,6 @@ } /**************************************************************************** - * * Collection-time allocation */ @@ -80,6 +79,7 @@ * @return The address of the first byte of the allocated region */ @Inline + @Override public final Address allocCopy(ObjectReference original, int bytes, int align, int offset, int allocator) { if (Stats.GATHER_MARK_CONS_STATS) { @@ -107,6 +107,7 @@ * @param bytes The size of the space to be allocated (in bytes) */ @Inline + @Override public final void postCopy(ObjectReference object, ObjectReference typeRef, int bytes, int allocator) { if (allocator == Plan.ALLOC_LOS) Modified: rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/marksweep/MS.java =================================================================== --- rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/marksweep/MS.java 2009-02-28 01:50:45 UTC (rev 15546) +++ rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/marksweep/MS.java 2009-02-28 02:36:49 UTC (rev 15547) @@ -42,26 +42,21 @@ public class MS extends StopTheWorld { /**************************************************************************** - * Constants - */ - - /**************************************************************************** * Class variables */ - public static final MarkSweepSpace msSpace = new MarkSweepSpace("ms", DEFAULT_POLL_FREQUENCY, VMRequest.create()); public static final int MARK_SWEEP = msSpace.getDescriptor(); public static final int SCAN_MARK = 0; + /**************************************************************************** * Instance variables */ - public final Trace msTrace = new Trace(metaDataSpace); + /***************************************************************************** - * * Collection */ @@ -71,6 +66,7 @@ * @param phaseId Collection phase to execute. */ @Inline + @Override public void collectionPhase(short phaseId) { if (phaseId == PREPARE) { @@ -95,7 +91,6 @@ } /***************************************************************************** - * * Accounting */ @@ -107,10 +102,15 @@ * @return The number of pages reserved given the pending * allocation, excluding space reserved for copying. */ + @Override public int getPagesUsed() { return (msSpace.reservedPages() + super.getPagesUsed()); } + /***************************************************************************** + * Miscellaneous + */ + /** * @see org.mmtk.plan.Plan#willNeverMove * @@ -128,6 +128,7 @@ * Register specialized methods. */ @Interruptible + @Override protected void registerSpecializedMethods() { TransitiveClosure.registerSpecializedScan(SCAN_MARK, MSTraceLocal.class); super.registerSpecializedMethods(); Modified: rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/marksweep/MSCollector.java =================================================================== --- rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/marksweep/MSCollector.java 2009-02-28 01:50:45 UTC (rev 15546) +++ rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/marksweep/MSCollector.java 2009-02-28 02:36:49 UTC (rev 15547) @@ -13,7 +13,6 @@ package org.mmtk.plan.marksweep; import org.mmtk.plan.*; -import org.mmtk.policy.MarkSweepLocal; import org.mmtk.vm.VM; import org.vmmagic.pragma.*; @@ -29,12 +28,6 @@ * * @see MS for an overview of the mark-sweep algorithm.<p> * - * FIXME The SegregatedFreeList class (and its decendents such as - * MarkSweepLocal) does not properly separate mutator and collector - * behaviors, so the ms field below should really not exist in - * this class as there is no collection-time allocation in this - * collector. - * * @see MS * @see MSMutator * @see StopTheWorldCollector @@ -46,25 +39,11 @@ /**************************************************************************** * Instance fields */ - protected MSTraceLocal fullTrace; - protected TraceLocal currentTrace; - protected MarkSweepLocal ms; // see FIXME at top of this class + protected MSTraceLocal fullTrace = new MSTraceLocal(global().msTrace, null);; + protected TraceLocal currentTrace = fullTrace; - /**************************************************************************** - * Initialization - */ - /** - * Constructor - */ - public MSCollector() { - fullTrace = new MSTraceLocal(global().msTrace, null); - currentTrace = fullTrace; - ms = new MarkSweepLocal(MS.msSpace); - } - /**************************************************************************** - * * Collection */ @@ -75,10 +54,10 @@ * @param primary Perform any single-threaded activities using this thread. */ @Inline + @Override public void collectionPhase(short phaseId, boolean primary) { if (phaseId == MS.PREPARE) { super.collectionPhase(phaseId, primary); - ms.prepare(); fullTrace.prepare(); return; } @@ -97,8 +76,8 @@ super.collectionPhase(phaseId, primary); } + /**************************************************************************** - * * Miscellaneous */ @@ -109,6 +88,7 @@ } /** @return The current trace instance. */ + @Override public final TraceLocal getCurrentTrace() { return currentTrace; } Modified: rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/marksweep/MSConstraints.java =================================================================== --- rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/marksweep/MSConstraints.java 2009-02-28 01:50:45 UTC (rev 15546) +++ rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/marksweep/MSConstraints.java 2009-02-28 02:36:49 UTC (rev 15547) @@ -27,12 +27,12 @@ @Uninterruptible public class MSConstraints extends StopTheWorldConstraints { + @Override public int gcHeaderBits() { return MarkSweepSpace.LOCAL_GC_BITS_REQUIRED; } - + @Override public int gcHeaderWords() { return MarkSweepSpace.GC_HEADER_WORDS_REQUIRED; } - + @Override + public boolean requiresLOS() { return true; } + @Override public int numSpecializedScans() { return 1; } - - /** @return true because we cannot accommodate large objects in default allocator */ - public boolean requiresLOS() { return true; } } Modified: rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/marksweep/MSMutator.java =================================================================== --- rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/marksweep/MSMutator.java 2009-02-28 01:50:45 UTC (rev 15546) +++ rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/marksweep/MSMutator.java 2009-02-28 02:36:49 UTC (rev 15547) @@ -15,7 +15,6 @@ import org.mmtk.plan.*; import org.mmtk.policy.MarkSweepLocal; import org.mmtk.policy.Space; - import org.mmtk.utility.alloc.Allocator; import org.vmmagic.pragma.*; @@ -30,14 +29,6 @@ * and per-mutator thread collection semantics (flushing and restoring * per-mutator allocator state).<p> * - * @see org.mmtk.plan.markcompact.MC for an overview of the mark-compact algorithm.<p> - * - * FIXME The SegregatedFreeList class (and its decendents such as - * MarkSweepLocal) does not properly separate mutator and collector - * behaviors, so the ms field below should really not exist in - * this class as there is no collection-time allocation in this - * collector. - * * @see MS * @see MSCollector * @see StopTheWorldMutator @@ -49,23 +40,10 @@ /**************************************************************************** * Instance fields */ + protected MarkSweepLocal ms = new MarkSweepLocal(MS.msSpace); - protected MarkSweepLocal ms; /**************************************************************************** - * - * Initialization - */ - - /** - * Constructor - */ - public MSMutator() { - ms = new MarkSweepLocal(MS.msSpace); - } - - /**************************************************************************** - * * Mutator-time allocation */ @@ -81,6 +59,7 @@ * @return The low address of the allocated memory. */ @Inline + @Override public Address alloc(int bytes, int align, int offset, int allocator, int site) { if (allocator == MS.ALLOC_DEFAULT) { return ms.alloc(bytes, align, offset); @@ -99,6 +78,7 @@ * @param allocator The allocator number to be used for this allocation */ @Inline + @Override public void postAlloc(ObjectReference ref, ObjectReference typeRef, int bytes, int allocator) { if (allocator == MS.ALLOC_DEFAULT) @@ -116,13 +96,14 @@ * which is allocating into <code>space</code>, or <code>null</code> * if no appropriate allocator can be established. */ + @Override public Allocator getAllocatorFromSpace(Space space) { if (space == MS.msSpace) return ms; return super.getAllocatorFromSpace(space); } + /**************************************************************************** - * * Collection */ @@ -133,6 +114,7 @@ * @param primary Perform any single-threaded activities using this thread. */ @Inline + @Override public void collectionPhase(short phaseId, boolean primary) { if (phaseId == MS.PREPARE) { super.collectionPhase(phaseId, primary); Modified: rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/marksweep/MSTraceLocal.java =================================================================== --- rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/marksweep/MSTraceLocal.java 2009-02-28 01:50:45 UTC (rev 15546) +++ rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/marksweep/MSTraceLocal.java 2009-02-28 02:36:49 UTC (rev 15547) @@ -28,12 +28,11 @@ @Uninterruptible public final class MSTraceLocal extends TraceLocal { /**************************************************************************** - * * Instance fields */ private final ObjectReferenceDeque modBuffer; - /** + /** * Constructor */ public MSTraceLocal(Trace trace, ObjectReferenceDeque modBuffer) { @@ -41,8 +40,8 @@ this.modBuffer = modBuffer; } + /**************************************************************************** - * * Externally visible Object processing and tracing */ @@ -50,8 +49,9 @@ * Is the specified object live? * * @param object The object. - * @return True if the object is live. + * @return <code>true</code> if the object is live. */ + @Override public boolean isLive(ObjectReference object) { if (object.isNull()) return false; if (Space.isInSpace(MS.MARK_SWEEP, object)) { @@ -75,6 +75,7 @@ * @return The new reference to the same object instance. */ @Inline + @Override public ObjectReference traceObject(ObjectReference object) { if (object.isNull()) return object; if (Space.isInSpace(MS.MARK_SWEEP, object)) Modified: rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/nogc/NoGC.java =================================================================== --- rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/nogc/NoGC.java 2009-02-28 01:50:45 UTC (rev 15546) +++ rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/nogc/NoGC.java 2009-02-28 02:36:49 UTC (rev 15547) @@ -12,8 +12,7 @@ */ package org.mmtk.plan.nogc; -import org.mmtk.plan.Plan; -import org.mmtk.plan.Trace; +import org.mmtk.plan.*; import org.mmtk.policy.ImmortalSpace; import org.mmtk.utility.heap.VMRequest; import org.mmtk.vm.VM; @@ -25,30 +24,23 @@ * This class implements the global state of a a simple allocator * without a collector. */ -@Uninterruptible public class NoGC extends Plan { +@Uninterruptible +public class NoGC extends Plan { /***************************************************************************** - * - * Class fields + * Class variables */ - public static final ImmortalSpace defSpace = new ImmortalSpace("default", DEFAULT_POLL_FREQUENCY, VMRequest.create(0.6f)); - public static final int DEF = defSpace.getDescriptor(); + public static final ImmortalSpace noGCSpace = new ImmortalSpace("default", DEFAULT_POLL_FREQUENCY, VMRequest.create()); + public static final int NOGC = noGCSpace.getDescriptor(); + /***************************************************************************** - * - * Instance fields + * Instance variables */ - public final Trace trace; + public final Trace trace = new Trace(metaDataSpace); - /** - * Constructor - */ - public NoGC() { - trace = new Trace(metaDataSpace); - } /***************************************************************************** - * * Collection */ @@ -57,35 +49,48 @@ * * @param phaseId Collection phase */ + @Inline + @Override public final void collectionPhase(short phaseId) { if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); - // if (phaseId == PREPARE) { - // } - // if (phaseID == RELEASE) { - // } - // super.collectionPhase(phaseId); + /* + if (phaseId == PREPARE) { + } + if (phaseId == CLOSURE) { + } + if (phaseId == RELEASE) { + } + super.collectionPhase(phaseId); + */ } /***************************************************************************** - * * Accounting */ /** - * Return the number of pages used given the pending - * allocation. + * Return the number of pages reserved for use given the pending + * allocation. The superclass accounts for its spaces, we just + * augment this with the default space's contribution. * * @return The number of pages reserved given the pending * allocation, excluding space reserved for copying. */ + @Override public int getPagesUsed() { - return (defSpace.reservedPages() + super.getPagesUsed()); + return (noGCSpace.reservedPages() + super.getPagesUsed()); } + + /***************************************************************************** + * Miscellaneous + */ + /** * Register specialized methods. */ @Interruptible + @Override protected void registerSpecializedMethods() { super.registerSpecializedMethods(); } Modified: rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/nogc/NoGCCollector.java =================================================================== --- rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/nogc/NoGCCollector.java 2009-02-28 01:50:45 UTC (rev 15546) +++ rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/nogc/NoGCCollector.java 2009-02-28 02:36:49 UTC (rev 15547) @@ -12,12 +12,12 @@ */ package org.mmtk.plan.nogc; -import org.mmtk.plan.ParallelCollector; -import org.mmtk.plan.TraceLocal; +import org.mmtk.plan.*; + import org.mmtk.vm.VM; -import org.vmmagic.pragma.Inline; -import org.vmmagic.pragma.Uninterruptible; +import org.vmmagic.pragma.*; + /** * This class implements <i>per-collector thread</i> behavior and state * for the <i>NoGC</i> plan, which simply allocates (without ever collecting @@ -37,57 +37,47 @@ /************************************************************************ * Instance fields */ - private final NoGCTraceLocal trace; + private final NoGCTraceLocal trace = new NoGCTraceLocal(global().trace); + protected final TraceLocal currentTrace = trace; - /************************************************************************ - * Initialization - */ - /** - * Constructor. One instance is created per physical processor. - */ - public NoGCCollector() { - trace = new NoGCTraceLocal(global().trace); - } - /**************************************************************************** - * * Collection */ /** * Perform a garbage collection */ + @Override public final void collect() { VM.assertions.fail("GC Triggered in NoGC Plan. Is -X:gc:ignoreSystemGC=true ?"); } - /** Perform some concurrent garbage collection */ - public final void concurrentCollect() { - VM.assertions.fail("Concurrent GC Triggered in NoGC Plan."); - } - /** * Perform a per-collector collection phase. * * @param phaseId The collection phase to perform * @param primary perform any single-threaded local activities. */ + @Inline + @Override public final void collectionPhase(short phaseId, boolean primary) { VM.assertions.fail("GC Triggered in NoGC Plan."); - } + /* + if (phaseId == NoGC.PREPARE) { + } - /** - * Perform some concurrent collection work. - * - * @param phaseId The unique phase identifier - */ - public void concurrentCollectionPhase(short phaseId) { - VM.assertions.fail("GC Triggered in NoGC Plan."); + if (phaseId == NoGC.CLOSURE) { + } + + if (phaseId == NoGC.RELEASE) { + } + + super.collectionPhase(phaseId, primary); + */ } /**************************************************************************** - * * Miscellaneous */ @@ -98,5 +88,8 @@ } /** @return The current trace instance. */ - public final TraceLocal getCurrentTrace() { return trace; } + @Override + public final TraceLocal getCurrentTrace() { + return currentTrace; + } } Modified: rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/nogc/NoGCConstraints.java =================================================================== --- rvmroot/branches/RVM-777-NewMMTkGlue/work/MMTk/src/org/mmtk/plan/nogc/NoGCConstraints.java 2009-02-28 01:50:45 UTC (rev 15546) +++ rvmroot/branches/RVM-777-NewMMTkGlue/wo... [truncated message content] |