001 /*
002 * This file is part of the Jikes RVM project (http://jikesrvm.org).
003 *
004 * This file is licensed to You under the Common Public License (CPL);
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/cpl1.0.php
009 *
010 * See the COPYRIGHT.txt file distributed with this work for information
011 * regarding copyright ownership.
012 */
013 package org.mmtk.vm;
014
015 import org.mmtk.plan.Plan;
016 import org.mmtk.plan.CollectorContext;
017 import org.mmtk.plan.MutatorContext;
018 import org.mmtk.plan.PlanConstraints;
019
020 import org.mmtk.utility.Log;
021
022 import org.vmmagic.pragma.*;
023
024 /**
025 * Stub to give access to plan local, constraint and global instances
026 */
027 @Uninterruptible public abstract class ActivePlan {
028
029 /** @return The active Plan instance. */
030 public abstract Plan global();
031
032 /** @return The active PlanConstraints instance. */
033 public abstract PlanConstraints constraints();
034
035 /** @return The active <code>CollectorContext</code> instance. */
036 public abstract CollectorContext collector();
037
038 /** @return The active <code>MutatorContext</code> instance. */
039 public abstract MutatorContext mutator();
040
041 /** @return The log for the active thread */
042 public abstract Log log();
043
044 /**
045 * Return the <code>CollectorContext</code> instance given its unique identifier.
046 *
047 * @param id The identifier of the <code>CollectorContext</code> to return
048 * @return The specified <code>CollectorContext</code>
049 */
050 public abstract CollectorContext collector(int id);
051
052 /**
053 * Return the <code>MutatorContext</code> instance given its unique identifier.
054 *
055 * @param id The identifier of the <code>MutatorContext</code> to return
056 * @return The specified <code>MutatorContext</code>
057 */
058 public abstract MutatorContext mutator(int id);
059
060 /** @return The number of registered <code>CollectorContext</code> instances. */
061 public abstract int collectorCount();
062
063 /** @return The number of registered <code>MutatorContext</code> instances. */
064 public abstract int mutatorCount();
065
066 /** Reset the mutator iterator */
067 public abstract void resetMutatorIterator();
068
069 /**
070 * Return the next <code>MutatorContext</code> in a
071 * synchronized iteration of all mutators.
072 *
073 * @return The next <code>MutatorContext</code> in a
074 * synchronized iteration of all mutators, or
075 * <code>null</code> when all mutators have been done.
076 */
077 public abstract MutatorContext getNextMutator();
078
079 /**
080 * Register a new <code>CollectorContext</code> instance.
081 *
082 * @param collector The <code>CollectorContext</code> to register.
083 * @return The <code>CollectorContext</code>'s unique identifier
084 */
085 @Interruptible
086 public abstract int registerCollector(CollectorContext collector);
087
088 /**
089 * Register a new <code>MutatorContext</code> instance.
090 *
091 * @param mutator The <code>MutatorContext</code> to register.
092 * @return The <code>MutatorContext</code>'s unique identifier
093 */
094 @Interruptible
095 public abstract int registerMutator(MutatorContext mutator);
096 }