001    /*
002     *  This file is part of the Jikes RVM project (http://jikesrvm.org).
003     *
004     *  This file is licensed to You under the Common Public License (CPL);
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/cpl1.0.php
009     *
010     *  See the COPYRIGHT.txt file distributed with this work for information
011     *  regarding copyright ownership.
012     */
013    package org.jikesrvm.compilers.opt.ir;
014    
015    import java.util.Enumeration;
016    
017    /**
018     * Extend java.util.Enumeration to avoid downcasts from object.
019     * Also provide a preallocated empty basic block enumeration.
020     */
021    public interface BasicBlockEnumeration extends Enumeration<BasicBlock> {
022      /**
023       * Same as nextElement but avoid the need to downcast from Object.
024       */
025      BasicBlock next();
026    
027      /**
028       * Single preallocated empty BasicBlockEnumeration.
029       * WARNING: Think before you use this; getting two possible concrete
030       * types may prevent inlining of hasMoreElements and next(), thus
031       * blocking scalar replacement.  Only use Empty when we have no hope
032       * of scalar replacing the alternative (real) enumeration object.
033       */
034      BasicBlockEnumeration Empty = new EmptyBasicBlockEnumeration();
035    }