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.vm;
014
015 import org.mmtk.plan.TraceLocal;
016 import org.vmmagic.pragma.Uninterruptible;
017
018 /**
019 * This class manages SoftReferences, WeakReferences, and
020 * PhantomReferences.
021 */
022 @Uninterruptible
023 public abstract class ReferenceProcessor {
024
025 public enum Semantics { SOFT, WEAK, PHANTOM }
026
027 /**
028 * Clear the contents of the table. This is called when reference types are
029 * disabled to make it easier for VMs to change this setting at runtime.
030 */
031 public abstract void clear();
032
033 /**
034 * Scan through the list of references.
035 *
036 * @param trace the thread local trace element.
037 * @param nursery {@code true} if it is safe to only scan new references.
038 */
039 public abstract void scan(TraceLocal trace, boolean nursery);
040
041 /**
042 * Iterate over all references and forward.
043 *
044 * @param trace The MMTk trace to forward to
045 * @param nursery The nursery collection hint
046 */
047 public abstract void forward(TraceLocal trace, boolean nursery);
048
049 /**
050 * @return the number of references objects on the queue
051 */
052 public abstract int countWaitingReferences();
053 }