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.utility.deque;
014
015 import org.mmtk.policy.RawPageSpace;
016 import org.mmtk.vm.VM;
017
018 import org.vmmagic.unboxed.*;
019 import org.vmmagic.pragma.*;
020
021 /**
022 * This class specializes SortSharedQueue to sort objects according to
023 * their time of death (TOD).
024 */
025 @Uninterruptible
026 public final class SortTODSharedDeque extends SortSharedDeque {
027
028 /**
029 * Constructor
030 *
031 * @param rps The space from which the instance should obtain buffers.
032 * @param arity The arity of the data to be enqueued
033 */
034 public SortTODSharedDeque(String name, RawPageSpace rps, int arity) {
035 super(name, rps, arity);
036 }
037
038 /**
039 * Return the sorting key for the object passed as a parameter.
040 *
041 * @param obj The address of the object whose key is wanted
042 * @return The value of the sorting key for this object
043 */
044 protected Word getKey(Address obj) {
045 return VM.traceInterface.getDeathTime(obj.toObjectReference());
046 }
047 }