001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one
003     * or more contributor license agreements. See the NOTICE file
004     * distributed with this work for additional information
005     * regarding copyright ownership. The ASF licenses this file
006     * to you under the Apache License, Version 2.0 (the  "License");
007     * you may not use this file except in compliance with the License.
008     * You may obtain a copy of the License at
009     *
010     *     http://www.apache.org/licenses/LICENSE-2.0
011     *
012     * Unless required by applicable law or agreed to in writing, software
013     * distributed under the License is distributed on an "AS IS" BASIS,
014     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015     * See the License for the specific language governing permissions and
016     * limitations under the License.
017     */
018    /*
019     * $Id: OutlineableChunkStart.java 1225426 2011-12-29 04:13:08Z mrglavas $
020     */
021    
022    package org.apache.xalan.xsltc.compiler.util;
023    
024    import org.apache.bcel.generic.Instruction;
025    
026    /**
027     * <p>This pseudo-instruction marks the beginning of a region of byte code that
028     * can be copied into a new method, termed an "outlineable" chunk.  The size of
029     * the Java stack must be the same at the start of the region as it is at the
030     * end of the region, any value on the stack at the start of the region must not
031     * be consumed by an instruction in the region of code, the region must not
032     * contain a return instruction, no branch instruction in the region is
033     * permitted to have a target that is outside the region, and no branch
034     * instruction outside the region is permitted to have a target that is inside
035     * the region.</p>
036     * <p>The end of the region is marked by an {@link OutlineableChunkEnd}
037     * pseudo-instruction.</p>
038     * <p>Such a region of code may contain other outlineable regions.</p>
039     */
040    class OutlineableChunkStart extends MarkerInstruction {
041        /**
042         * A constant instance of {@link OutlineableChunkStart}.  As it has no fields,
043         * there should be no need to create an instance of this class. 
044         */
045        public static final Instruction OUTLINEABLECHUNKSTART =
046                                                    new OutlineableChunkStart();
047    
048        /**
049         * Private default constructor.  As it has no fields,
050         * there should be no need to create an instance of this class.  See
051         * {@link OutlineableChunkStart#OUTLINEABLECHUNKSTART}.
052         */
053        private OutlineableChunkStart() {
054        }
055    
056        /**
057         * Get the name of this instruction.  Used for debugging.
058         * @return the instruction name
059         */
060        public String getName() {
061            return OutlineableChunkStart.class.getName();
062        }
063    
064        /**
065         * Get the name of this instruction.  Used for debugging.
066         * @return the instruction name
067         */
068        public String toString() {
069            return getName();
070        }
071    
072        /**
073         * Get the name of this instruction.  Used for debugging.
074         * @return the instruction name
075         */
076        public String toString(boolean verbose) {
077            return getName();
078        }
079    }