001 /*
002 * This file is part of the Jikes RVM project (http://jikesrvm.org).
003 *
004 * This file is licensed to You under the Eclipse Public License (EPL);
005 * You may not use this file except in compliance with the License. You
006 * may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/eclipse-1.0.php
009 *
010 * See the COPYRIGHT.txt file distributed with this work for information
011 * regarding copyright ownership.
012 */
013 package org.mmtk.plan.nogc;
014
015 import org.mmtk.plan.*;
016 import org.mmtk.policy.ImmortalSpace;
017 import org.mmtk.utility.heap.VMRequest;
018 import org.mmtk.vm.VM;
019
020 import org.vmmagic.pragma.*;
021
022
023 /**
024 * This class implements the global state of a a simple allocator
025 * without a collector.
026 */
027 @Uninterruptible
028 public class NoGC extends Plan {
029
030 /*****************************************************************************
031 * Class variables
032 */
033 public static final ImmortalSpace noGCSpace = new ImmortalSpace("default", DEFAULT_POLL_FREQUENCY, VMRequest.create());
034 public static final int NOGC = noGCSpace.getDescriptor();
035
036
037 /*****************************************************************************
038 * Instance variables
039 */
040 public final Trace trace = new Trace(metaDataSpace);
041
042
043 /*****************************************************************************
044 * Collection
045 */
046
047 /**
048 * Perform a (global) collection phase.
049 *
050 * @param phaseId Collection phase
051 */
052 @Inline
053 @Override
054 public final void collectionPhase(short phaseId) {
055 if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
056 /*
057 if (phaseId == PREPARE) {
058 }
059 if (phaseId == CLOSURE) {
060 }
061 if (phaseId == RELEASE) {
062 }
063 super.collectionPhase(phaseId);
064 */
065 }
066
067 /*****************************************************************************
068 * Accounting
069 */
070
071 /**
072 * Return the number of pages reserved for use given the pending
073 * allocation. The superclass accounts for its spaces, we just
074 * augment this with the default space's contribution.
075 *
076 * @return The number of pages reserved given the pending
077 * allocation, excluding space reserved for copying.
078 */
079 @Override
080 public int getPagesUsed() {
081 return (noGCSpace.reservedPages() + super.getPagesUsed());
082 }
083
084
085 /*****************************************************************************
086 * Miscellaneous
087 */
088
089 /**
090 * Register specialized methods.
091 */
092 @Interruptible
093 @Override
094 protected void registerSpecializedMethods() {
095 super.registerSpecializedMethods();
096 }
097 }