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.gcspy;
014    
015    import org.mmtk.utility.gcspy.drivers.AbstractDriver;
016    
017    import org.vmmagic.unboxed.*;
018    import 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) { driver = d; }
034    
035      /**
036       * Scan an object. The object reference is passed to the scan method of the
037       * GCspy driver registered with this scanner.
038       * @param obj The object to scan.
039       */
040      @Override
041      public void scan(ObjectReference obj) { driver.scan(obj);  }
042    }
043