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.vm;
014
015import org.vmmagic.unboxed.*;
016import org.vmmagic.pragma.*;
017
018/**
019 * Class that supports scanning Objects or Arrays for references
020 * during tracing, handling those references, and computing death times
021 */
022@Uninterruptible public abstract class TraceInterface {
023
024
025  /***********************************************************************
026   *
027   * Public Methods
028   */
029
030  /**
031   * Returns {@code true} if the VM is ready for a garbage collection.
032   *
033   * @return {@code true} if the VM is ready for GC, {@code false} otherwise.
034   */
035  public abstract boolean gcEnabled();
036
037  /**
038   * This adjusts the offset into an object to reflect what it would look like
039   * if the fields were laid out in memory space immediately after the object
040   * pointer.
041   *
042   * @param isScalar If this is a pointer store to a scalar object
043   * @param src The address of the source object
044   * @param slot The address within <code>src</code> into which
045   * the update will be stored
046   * @return The easy to understand offset of the slot
047   */
048  public abstract Offset adjustSlotOffset(boolean isScalar,
049                                              ObjectReference src,
050                                              Address slot);
051
052  /**
053   * This skips over the frames added by the tracing algorithm, outputs
054   * information identifying the method the containts the "new" call triggering
055   * the allocation, and returns the address of the first non-trace, non-alloc
056   * stack frame.
057   *
058   *@param typeRef The type reference (tib) of the object just allocated
059   * @return The frame pointer address for the method that allocated the object
060   */
061  @Interruptible
062  public abstract Address skipOwnFramesAndDump(ObjectReference typeRef);
063
064  /***********************************************************************
065  *
066  * Wrapper methods
067  */
068
069  /**
070   * Update an object's death time.
071   * @param obj the object
072   */
073  public abstract void updateDeathTime(ObjectReference obj);
074  public abstract void setDeathTime(ObjectReference ref, Word time_);
075  public abstract void setLink(ObjectReference ref, ObjectReference link);
076  public abstract void updateTime(Word time_);
077  public abstract Word getOID(ObjectReference ref);
078  public abstract Word getDeathTime(ObjectReference ref);
079  public abstract ObjectReference getLink(ObjectReference ref);
080  public abstract Address getBootImageLink();
081  public abstract Word getOID();
082  public abstract void setOID(Word oid);
083  public abstract int getHeaderSize();
084  public abstract int getHeaderEndOffset();
085}