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