From: Atnip, T. W <at...@ro...> - 2012-12-14 01:40:33
|
Following Mark-Sweep Collector Tutorial, was informed there was a post asking for my code $ jikesrvm-3.1.2/dist/BaseBaseTutorial_x86_64-linux/rvm -X:gc:verbose=1 helloworld used = 14 pgs = boot 0 pgs + immortal 0 pgs + meta 0 pgs + los 0 pgs + sanity 0 pgs + non-moving 5 pgs + sm-code 0 pgs + lg-code 0 pgs + nursery 0 pgs + mark-sweep 9 pgs + ms 0 pgs used = 0.05 Mb = boot 0.00 Mb + immortal 0.00 Mb + meta 0.00 Mb + los 0.00 Mb + sanity 0.00 Mb + non-moving 0.01 Mb + sm-code 0.00 Mb + lg-code 0.00 Mb + nursery 0.00 Mb + mark-sweep 0.03 Mb + ms 0.00 Mb used = 15 pgs = boot 0 pgs + immortal 0 pgs + meta 0 pgs + los 0 pgs + sanity 0 pgs + non-moving 5 pgs + sm-code 0 pgs + lg-code 0 pgs + nursery 0 pgs + mark-sweep 10 pgs + ms 0 pgs used = 0.05 Mb = boot 0.00 Mb + immortal 0.00 Mb + meta 0.00 Mb + los 0.00 Mb + sanity 0.00 Mb + non-moving 0.01 Mb + sm-code 0.00 Mb + lg-code 0.00 Mb + nursery 0.00 Mb + mark-sweep 0.03 Mb + ms 0.00 Mb Thread 1: VM.sysFail(): We're in a (likely) recursive call to VM.sysFail(), 2 deep sysFail was called with the message: No such allocator JikesRVM: internal error: recursive use of hardware exception registers (exiting) -- Stack -- at [0x6102b3fc, 0x6422e765] Lorg/jikesrvm/VM; sysFail(Ljava/lang/String;)V at line 2282 at [0x6102b41c, 0x641ccf92] Lorg/jikesrvm/mm/mmtk/Assert; fail(Ljava/lang/String;)V at line 47 at [0x6102b44c, 0x641ce961] Lorg/mmtk/plan/MutatorContext; postAlloc(Lorg/vmmagic/unboxed/ObjectReference;Lorg/vmmagic/unboxed/ObjectReference;II)V at line 226 at [0x6102b488, 0x64310d25] Lorg/mmtk/plan/tutorial/TutorialMutator; postAlloc(Lorg/vmmagic/unboxed/ObjectReference;Lorg/vmmagic/unboxed/ObjectReference;II)V at line 97 at [0x6102b4d4, 0x6432505a] Lorg/jikesrvm/mm/mminterface/MemoryManager; allocateScalar(ILorg/jikesrvm/objectmodel/TIB;IIII)Ljava/lang/Object; at line 489 at [0x6102b520, 0x64323d5f] Lorg/jikesrvm/runtime/RuntimeEntrypoints; resolvedNewScalar(ILorg/jikesrvm/objectmodel/TIB;ZIIII)Ljava/lang/Object; at line 326 at [0x6102b574, 0x64318077] Lorg/jikesrvm/runtime/RuntimeEntrypoints; deliverHardwareException(II)V at line 767 at [0x6102b590, 0x64318077] <hardware trap> at [0x61033d1c, 0x6432aa34] Lorg/jikesrvm/scheduler/RVMThread; traceback(Ljava/lang/String;)V at line 4780 at [0x61033d38, 0x6422e765] Lorg/jikesrvm/VM; sysFail(Ljava/lang/String;)V at line 2282 at [0x61033d58, 0x641ccf92] Lorg/jikesrvm/mm/mmtk/Assert; fail(Ljava/lang/String;)V at line 47 at [0x61033d88, 0x641ce961] Lorg/mmtk/plan/MutatorContext; postAlloc(Lorg/vmmagic/unboxed/ObjectReference;Lorg/vmmagic/unboxed/ObjectReference;II)V at line 226 at [0x61033dc4, 0x64310d25] Lorg/mmtk/plan/tutorial/TutorialMutator; postAlloc(Lorg/vmmagic/unboxed/ObjectReference;Lorg/vmmagic/unboxed/ObjectReference;II)V at line 97 at [0x61033e10, 0x6432505a] Lorg/jikesrvm/mm/mminterface/MemoryManager; allocateScalar(ILorg/jikesrvm/objectmodel/TIB;IIII)Ljava/lang/Object; at line 489 at [0x61033e5c, 0x642443db] Lorg/jikesrvm/runtime/RuntimeEntrypoints; resolvedNewScalar(ILorg/jikesrvm/objectmodel/TIB;ZIIII)Ljava/lang/Object; at line 326 at [0x61033e98, 0x6424d05a] Lorg/jikesrvm/Callbacks; addExitMonitor(Lorg/jikesrvm/Callbacks$ExitMonitor;)V at line 773 at [0x61033eb0, 0x64311999] Lorg/jikesrvm/mm/mminterface/Monitor; boot()V at line 27 at [0x61033ec8, 0x6432fd01] Lorg/jikesrvm/mm/mminterface/MemoryManager; boot(Lorg/jikesrvm/runtime/BootRecord;)V at line 120 at [0x61033ee8, 0x64330773] Lorg/jikesrvm/VM; finishBooting()V at line 175 at [0x61033f00, 0x0804fe86] Lorg/jikesrvm/VM; boot()V at line 145 helloworld.java cat helloworld.java /* Hello World Java Program */ class helloworld { public static void main(String[] args) { System.out.println("Hello World!"); } } Tutorial.java /* * 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.plan.tutorial; import org.mmtk.plan.StopTheWorld; import org.mmtk.plan.Trace; import org.mmtk.policy.MarkSweepSpace; import org.mmtk.policy.Space; import org.mmtk.utility.heap.VMRequest; import org.vmmagic.pragma.Inline; import org.vmmagic.pragma.Interruptible; import org.vmmagic.pragma.Uninterruptible; import org.vmmagic.unboxed.ObjectReference; /** * This class implements the global state of a a simple allocator * without a collector. */ @Uninterruptible public class Tutorial extends StopTheWorld { /***************************************************************************** * Class variables */ public static final MarkSweepSpace msSpace = new MarkSweepSpace("mark-sweep", VMRequest.create()); public static final int MARK_SWEEP = msSpace.getDescriptor(); /***************************************************************************** * Instance variables */ public final Trace msTrace = new Trace(metaDataSpace); /***************************************************************************** * Collection */ /** * Perform a (global) collection phase. * * @param phaseId Collection phase */ @Inline @Override public final void collectionPhase(short phaseId) { //if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); if (phaseId == PREPARE) { super.collectionPhase(phaseId); msTrace.prepare(); msSpace.prepare(true); return; } if (phaseId == CLOSURE) { msTrace.prepare(); return; } if (phaseId == RELEASE) { msTrace.release(); msSpace.release(); super.collectionPhase(phaseId); return; } super.collectionPhase(phaseId); } /***************************************************************************** * Accounting */ /** * 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 (msSpace.reservedPages() + super.getPagesUsed()); } /** * Method not found in super class */ /* @Override public int getPagesRequired() { return super.getPagesRequired() + msSpace.requiredPages(); } */ @Override public boolean willNeverMove(ObjectReference object) { if (Space.isInSpace(MARK_SWEEP, object)) return true; return super.willNeverMove(object); } /***************************************************************************** * Miscellaneous */ /** * Register specialized methods. */ @Interruptible @Override protected void registerSpecializedMethods() { super.registerSpecializedMethods(); } } TutorialCollector.java /* * 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.plan.tutorial; import org.mmtk.plan.*; import org.mmtk.vm.VM; 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 * until the available space is exhausted.<p> * * Specifically, this class <i>would</i> define <i>NoGC</i> collection time semantics, * however, since this plan never collects, this class consists only of stubs which * may be useful as a template for implementing a basic collector. * * @see Tutorial * @see TutorialMutator * @see CollectorContext */ @Uninterruptible public class TutorialCollector extends StopTheWorldCollector { /************************************************************************ * Instance fields */ private final TutorialTraceLocal trace = new TutorialTraceLocal(global().msTrace); protected final TraceLocal currentTrace = 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 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 == Tutorial.PREPARE) { super.collectionPhase(phaseId, primary); trace.prepare(); return; } if (phaseId == Tutorial.CLOSURE) { trace.completeTrace(); return; } if (phaseId == Tutorial.RELEASE) { trace.release(); super.collectionPhase(phaseId, primary); return; } super.collectionPhase(phaseId, primary); } /**************************************************************************** * Miscellaneous */ /** @return The active global plan as a <code>NoGC</code> instance. */ @Inline private static Tutorial global() { return (Tutorial) VM.activePlan.global(); } /** @return The current trace instance. */ @Override public final TraceLocal getCurrentTrace() { return currentTrace; } } TutorialConstraints.java /* * 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.plan.tutorial; import org.mmtk.plan.*; import org.mmtk.vm.VM; 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 * until the available space is exhausted.<p> * * Specifically, this class <i>would</i> define <i>NoGC</i> collection time semantics, * however, since this plan never collects, this class consists only of stubs which * may be useful as a template for implementing a basic collector. * * @see Tutorial * @see TutorialMutator * @see CollectorContext */ @Uninterruptible public class TutorialCollector extends StopTheWorldCollector { /************************************************************************ * Instance fields */ private final TutorialTraceLocal trace = new TutorialTraceLocal(global().msTrace); protected final TraceLocal currentTrace = 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 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 == Tutorial.PREPARE) { super.collectionPhase(phaseId, primary); trace.prepare(); return; } if (phaseId == Tutorial.CLOSURE) { trace.completeTrace(); return; } if (phaseId == Tutorial.RELEASE) { trace.release(); super.collectionPhase(phaseId, primary); return; } super.collectionPhase(phaseId, primary); } /**************************************************************************** * Miscellaneous */ /** @return The active global plan as a <code>NoGC</code> instance. */ @Inline private static Tutorial global() { return (Tutorial) VM.activePlan.global(); } /** @return The current trace instance. */ @Override public final TraceLocal getCurrentTrace() { return currentTrace; } } atniptw@rock:~/Documents/jikesrvm-3.1.2/MMTk/src/org/mmtk/plan/tutorial$ ls TutorialCollector.java Tutorial.java TutorialTraceLocal.java TutorialConstraints.java TutorialMutator.java atniptw@rock:~/Documents/jikesrvm-3.1.2/MMTk/src/org/mmtk/plan/tutorial$ cat TutorialConstraints.java /* * 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.plan.tutorial; import org.mmtk.plan.StopTheWorldConstraints; import org.mmtk.policy.MarkSweepSpace; import org.mmtk.policy.SegregatedFreeListSpace; import org.vmmagic.pragma.Uninterruptible; /** * This class and its subclasses communicate to the host VM/Runtime * any features of the selected plan that it needs to know. This is * separate from the main Plan/PlanLocal class in order to bypass any * issues with ordering of static initialization. */ @Uninterruptible public class TutorialConstraints extends StopTheWorldConstraints { @Override public int gcHeaderBits() { return MarkSweepSpace.LOCAL_GC_BITS_REQUIRED; } @Override public int gcHeaderWords() { return MarkSweepSpace.GC_HEADER_WORDS_REQUIRED; } @Override public int maxNonLOSDefaultAllocBytes() { return SegregatedFreeListSpace.MAX_FREELIST_OBJECT_BYTES;} } TutorialMutator.java /* * 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.plan.tutorial; import org.mmtk.plan.StopTheWorldMutator; import org.mmtk.plan.marksweep.MS; import org.mmtk.policy.MarkSweepLocal; import org.mmtk.policy.Space; import org.mmtk.utility.alloc.Allocator; import org.vmmagic.pragma.Inline; import org.vmmagic.pragma.Uninterruptible; import org.vmmagic.unboxed.Address; import org.vmmagic.unboxed.ObjectReference; /** * This class implements <i>per-mutator thread</i> behavior and state for the * <i>NoGC</i> plan, which simply allocates (without ever collecting until the * available space is exhausted. * <p> * * Specifically, this class defines <i>NoGC</i> mutator-time allocation through * a bump pointer (<code>def</code>) and includes stubs for per-mutator thread * collection semantics (since there is no collection in this plan, these remain * just stubs). * * @see Tutorial * @see TutorialCollector * @see org.mmtk.plan.StopTheWorldMutator * @see org.mmtk.plan.MutatorContext */ @Uninterruptible public class TutorialMutator extends StopTheWorldMutator { /************************************************************************ * Instance fields */ private final MarkSweepLocal ms = new MarkSweepLocal(Tutorial.msSpace); /**************************************************************************** * Mutator-time allocation */ /** * Allocate memory for an object. * * @param bytes * The number of bytes required for the object. * @param align * Required alignment for the object. * @param offset * Offset associated with the alignment. * @param allocator * The allocator associated with this request. * @param site * Allocation site * @return The address of the newly allocated memory. */ @Inline @Override public Address alloc(int bytes, int align, int offset, int allocator, int site) { if (allocator == Tutorial.ALLOC_DEFAULT) { return ms.alloc(bytes, align, offset); } return super.alloc(bytes, align, offset, allocator, site); } /** * Perform post-allocation actions. For many allocators none are required. * * @param ref * The newly allocated object * @param typeRef * the type reference for the instance being created * @param bytes * The size of the space to be allocated (in bytes) * @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 != Tutorial.ALLOC_DEFAULT) { Tutorial.msSpace.postAlloc(ref); } else { super.postAlloc(ref, typeRef, bytes, allocator); } } /** * Return the allocator instance associated with a space <code>space</code>, * for this plan instance. * * @param space * The space for which the allocator instance is desired. * @return The allocator instance associated with this plan instance 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 == Tutorial.msSpace) return ms; return super.getAllocatorFromSpace(space); } /**************************************************************************** * Collection */ /** * Perform a per-mutator 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 == MS.PREPARE) { super.collectionPhase(phaseId, primary); ms.prepare(); return; } if (phaseId == MS.RELEASE) { ms.release(); super.collectionPhase(phaseId, primary); return; } super.collectionPhase(phaseId, primary); } } ********************************** Thomas W Atnip Computer Science and Software Engineering Rose-Hulman Institute of Technology Phone: 765-315-2785 ********************************** |