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    
034      /**
035       *
036       */
037      public static final ImmortalSpace noGCSpace = new ImmortalSpace("default", VMRequest.create());
038      public static final int NOGC = noGCSpace.getDescriptor();
039    
040    
041      /*****************************************************************************
042       * Instance variables
043       */
044    
045      /**
046       *
047       */
048      public final Trace trace = new Trace(metaDataSpace);
049    
050    
051      /*****************************************************************************
052       * Collection
053       */
054    
055      /**
056       * {@inheritDoc}
057       */
058      @Inline
059      @Override
060      public final void collectionPhase(short phaseId) {
061        if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
062        /*
063        if (phaseId == PREPARE) {
064        }
065        if (phaseId == CLOSURE) {
066        }
067        if (phaseId == RELEASE) {
068        }
069        super.collectionPhase(phaseId);
070        */
071      }
072    
073      /*****************************************************************************
074       * Accounting
075       */
076    
077      /**
078       * {@inheritDoc}
079       * The superclass accounts for its spaces, we just
080       * augment this with the default space's contribution.
081       */
082      @Override
083      public int getPagesUsed() {
084        return (noGCSpace.reservedPages() + super.getPagesUsed());
085      }
086    
087    
088      /*****************************************************************************
089       * Miscellaneous
090       */
091    
092      /**
093       * {@inheritDoc}
094       */
095      @Interruptible
096      @Override
097      protected void registerSpecializedMethods() {
098        super.registerSpecializedMethods();
099      }
100    }