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.utility.gcspy;
014
015import org.mmtk.utility.gcspy.drivers.AbstractDriver;
016
017import org.vmmagic.unboxed.*;
018import org.vmmagic.pragma.*;
019
020/**
021 * This class is only necessary because we cannot implement
022 * org.mmtk.utility.alloc.LinearScan as an interface since the invokeinterface
023 * bytecode is forbidden in uninterruptible code.
024 */
025@Uninterruptible public class LinearScan extends org.mmtk.utility.alloc.LinearScan {
026
027  private final AbstractDriver driver;
028
029  /**
030   * Create a new scanner.
031   * @param d The GCspy driver that provides the callback.
032   */
033  public LinearScan(AbstractDriver d) {
034    driver = d;
035  }
036
037  /**
038   * Scan an object. The object reference is passed to the scan method of the
039   * GCspy driver registered with this scanner.
040   * @param obj The object to scan.
041   */
042  @Override
043  public void scan(ObjectReference obj) {
044    driver.scan(obj);
045  }
046}
047