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.policy;
014    
015    import org.mmtk.utility.alloc.LargeObjectAllocator;
016    import org.mmtk.utility.gcspy.drivers.TreadmillDriver;
017    import org.mmtk.utility.Constants;
018    
019    import org.vmmagic.pragma.*;
020    
021    /**
022     * Each instance of this class is intended to provide fast,
023     * unsynchronized access to a treadmill.  Therefore instances must not
024     * be shared across truly concurrent threads (CPUs).  Rather, one or
025     * more instances of this class should be bound to each CPU.  The
026     * shared VMResource used by each instance is the point of global
027     * synchronization, and synchronization only occurs at the granularity
028     * of acquiring (and releasing) chunks of memory from the VMResource.<p>
029     *
030     * If there are C CPUs and T TreadmillSpaces, there must be C X T
031     * instances of this class, one for each CPU, TreadmillSpace pair.
032     */
033    @Uninterruptible
034    public final class LargeObjectLocal extends LargeObjectAllocator implements Constants {
035    
036      /****************************************************************************
037       *
038       * Class variables
039       */
040    
041      /****************************************************************************
042       *
043       * Instance variables
044       */
045    
046      /****************************************************************************
047       *
048       * Initialization
049       */
050    
051      /**
052       * Constructor
053       *
054       * @param space The treadmill space to which this thread instance is
055       * bound.
056       */
057      public LargeObjectLocal(BaseLargeObjectSpace space) {
058        super(space);
059      }
060    
061      /****************************************************************************
062       *
063       * Allocation
064       */
065    
066      /****************************************************************************
067       *
068       * Collection
069       */
070    
071      /**
072       * Prepare for a collection.  Clear the treadmill to-space head and
073       * prepare the collector.  If paranoid, perform a sanity check.
074       */
075      public void prepare(boolean fullHeap) {
076      }
077    
078      /**
079       * Finish up after a collection.
080       */
081      public void release(boolean fullHeap) {
082      }
083    
084      /****************************************************************************
085       *
086       * Miscellaneous size-related methods
087       */
088    
089      /**
090       * Gather data for GCSpy from the nursery
091       * @param event the gc event
092       * @param losDriver the GCSpy space driver
093       */
094      public void gcspyGatherData(int event, TreadmillDriver losDriver) {
095        // TODO: assumes single threaded
096        // TODO: assumes non-explit LOS
097        ((LargeObjectSpace)space).getTreadmill().gcspyGatherData(event, losDriver);
098      }
099    
100      /**
101       * Gather data for GCSpy for an older space
102       * @param event the gc event
103       * @param losDriver the GCSpy space driver
104       * @param tospace gather from tospace?
105       */
106      public void gcspyGatherData(int event, TreadmillDriver losDriver, boolean tospace) {
107        // TODO: assumes single threaded
108        ((LargeObjectSpace)space).getTreadmill().gcspyGatherData(event, losDriver, tospace);
109      }
110    }