## org.apache.xalan.xsltc.compiler.util
Class MethodGenerator

    java.lang.Object
      |
      +--org.apache.bcel.classfile.AccessFlags
            |
            +--org.apache.bcel.generic.FieldGenOrMethodGen
                  |
                  +--org.apache.bcel.generic.MethodGen
                        |
                        +--org.apache.xalan.xsltc.compiler.util.MethodGenerator

Direct Known Subclasses:
  AttributeSetMethodGenerator, CompareGenerator, MatchGenerator, NamedMethodGenerator, RtMethodGenerator, TestGenerator

public class MethodGenerator
extends org.apache.bcel.generic.MethodGen
implements Constants

Constructor Summary
`MethodGenerator(int access_flags, org.apache.bcel.generic.Type return_type, org.apache.bcel.generic.Type[] arg_types, java.lang.String[] arg_names, java.lang.String method_name, java.lang.String class_name, org.apache.bcel.generic.InstructionList il, org.apache.bcel.generic.ConstantPoolGen cpg)`

Method Summary
`void` `addInstructionList(Pattern pattern, org.apache.bcel.generic.InstructionList ilist)` Add a pre-compiled pattern to this mode.
`org.apache.bcel.generic.LocalVariableGen` `addLocalVariable(java.lang.String name, org.apache.bcel.generic.Type type, org.apache.bcel.generic.InstructionHandle start, org.apache.bcel.generic.InstructionHandle end)` Allocates a local variable.
`org.apache.bcel.generic.LocalVariableGen` `addLocalVariable2(java.lang.String name, org.apache.bcel.generic.Type type, org.apache.bcel.generic.InstructionHandle start)`
`org.apache.bcel.generic.Instruction` `attribute()`
`org.apache.bcel.generic.Instruction` `endDocument()`
`org.apache.bcel.generic.Instruction` `endElement()`
`org.apache.bcel.generic.InstructionList` `getInstructionList(Pattern pattern)` Get the instruction list for a pre-compiled pattern.
`int` `getLocalIndex(java.lang.String name)`
`org.apache.bcel.generic.LocalVariableGen` `getLocalVariable(java.lang.String name)`
`org.apache.bcel.generic.Instruction` `loadContextNode()` by default context node is the same as current node.
`org.apache.bcel.generic.Instruction` `loadCurrentNode()`
`org.apache.bcel.generic.Instruction` `loadDOM()`
`org.apache.bcel.generic.Instruction` `loadHandler()`
`org.apache.bcel.generic.Instruction` `loadIterator()`
`void` `markChunkEnd()` Mark the end of an outlineable chunk of code.
`void` `markChunkStart()` Mark the end of the method's `InstructionList` as the start of an outlineable chunk of code.
`org.apache.bcel.generic.Instruction` `namespace()`
`org.apache.bcel.generic.Instruction` `nextNode()`
`org.apache.bcel.classfile.Method[]` `outlineChunks(ClassGenerator classGen, int originalMethodSize)` Breaks up the IL for this `MethodGenerator` into separate outlined methods so that no method exceeds the 64KB limit on the length of the byte code associated with a method.
`void` `removeLocalVariable(org.apache.bcel.generic.LocalVariableGen lvg)`
`org.apache.bcel.generic.Instruction` `reset()`
`void` `setMaxLocals()`
`org.apache.bcel.generic.Instruction` `setStartNode()`
`org.apache.bcel.generic.Instruction` `startDocument()`
`org.apache.bcel.generic.Instruction` `startElement()`
`org.apache.bcel.generic.Instruction` `storeContextNode()`
`org.apache.bcel.generic.Instruction` `storeCurrentNode()`
`org.apache.bcel.generic.Instruction` `storeDOM()`
`org.apache.bcel.generic.Instruction` `storeHandler()`
`org.apache.bcel.generic.Instruction` `storeIterator()`
`org.apache.bcel.generic.Instruction` `uniqueAttribute()`

Methods inherited from class org.apache.bcel.generic.MethodGen

`addCodeAttribute, addException, addExceptionHandler, addLineNumber, addLocalVariable, addObserver, copy, getArgumentName, getArgumentNames, getArgumentType, getArgumentTypes, getClassName, getCodeAttributes, getExceptionHandlers, getExceptions, getInstructionList, getLineNumbers, getLineNumberTable, getLocalVariables, getLocalVariableTable, getMaxLocals, getMaxStack, getMaxStack, getMethod, getReturnType, getSignature, removeCodeAttribute, removeCodeAttributes, removeException, removeExceptionHandler, removeExceptionHandlers, removeExceptions, removeLineNumber, removeLineNumbers, removeLocalVariables, removeNOPs, removeObserver, setArgumentName, setArgumentNames, setArgumentType, setArgumentTypes, setClassName, setInstructionList, setMaxLocals, setMaxStack, setMaxStack, setReturnType, stripAttributes, toString, update`

Methods inherited from class org.apache.bcel.generic.FieldGenOrMethodGen
`addAttribute, clone, getAttributes, getConstantPool, getName, getType, removeAttribute, removeAttributes, setConstantPool, setName, setType`

Methods inherited from class org.apache.bcel.classfile.AccessFlags
`getAccessFlags, isAbstract, isAbstract, isFinal, isFinal, isInterface, isInterface, isNative, isNative, isPrivate, isPrivate, isProtected, isProtected, isPublic, isPublic, isStatic, isStatic, isStrictfp, isStrictfp, isSynchronized, isSynchronized, isTransient, isTransient, isVolatile, isVolatile, setAccessFlags`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### MethodGenerator

    public MethodGenerator(int access_flags,
                           org.apache.bcel.generic.Type return_type,
                           org.apache.bcel.generic.Type[] arg_types,
                           java.lang.String[] arg_names,
                           java.lang.String method_name,
                           java.lang.String class_name,
                           org.apache.bcel.generic.InstructionList il,
                           org.apache.bcel.generic.ConstantPoolGen cpg)

Method Detail

### addLocalVariable

    public org.apache.bcel.generic.LocalVariableGen addLocalVariable(java.lang.String name,
                                                                     org.apache.bcel.generic.Type type,
                                                                     org.apache.bcel.generic.InstructionHandle start,
                                                                     org.apache.bcel.generic.InstructionHandle end)

  Allocates a local variable. If the slot allocator has already been initialized, then call addLocalVariable2() so that the new variable is known to the allocator. Failing to do this may cause the allocator to return a slot that is already in use.
  Overrides:
    addLocalVariable in class org.apache.bcel.generic.MethodGen

### addLocalVariable2

    public org.apache.bcel.generic.LocalVariableGen addLocalVariable2(java.lang.String name,
                                                                      org.apache.bcel.generic.Type type,
                                                                      org.apache.bcel.generic.InstructionHandle start)

### removeLocalVariable

    public void removeLocalVariable(org.apache.bcel.generic.LocalVariableGen lvg)

  Overrides:
    removeLocalVariable in class org.apache.bcel.generic.MethodGen

### loadDOM

    public org.apache.bcel.generic.Instruction loadDOM()

### storeDOM

    public org.apache.bcel.generic.Instruction storeDOM()

### storeHandler

    public org.apache.bcel.generic.Instruction storeHandler()

### loadHandler

    public org.apache.bcel.generic.Instruction loadHandler()

### storeIterator

    public org.apache.bcel.generic.Instruction storeIterator()

### loadIterator

    public org.apache.bcel.generic.Instruction loadIterator()

### setStartNode

    public final org.apache.bcel.generic.Instruction setStartNode()

### reset

    public final org.apache.bcel.generic.Instruction reset()

### nextNode

    public final org.apache.bcel.generic.Instruction nextNode()

### startElement

    public final org.apache.bcel.generic.Instruction startElement()

### endElement

    public final org.apache.bcel.generic.Instruction endElement()

### startDocument

    public final org.apache.bcel.generic.Instruction startDocument()

### endDocument

    public final org.apache.bcel.generic.Instruction endDocument()

### attribute

    public final org.apache.bcel.generic.Instruction attribute()

### uniqueAttribute

    public final org.apache.bcel.generic.Instruction uniqueAttribute()

### namespace

    public final org.apache.bcel.generic.Instruction namespace()

### loadCurrentNode

    public org.apache.bcel.generic.Instruction loadCurrentNode()

### storeCurrentNode

    public org.apache.bcel.generic.Instruction storeCurrentNode()

### loadContextNode

    public org.apache.bcel.generic.Instruction loadContextNode()

  by default context node is the same as current node. MK437

### storeContextNode

    public org.apache.bcel.generic.Instruction storeContextNode()

### getLocalIndex

    public int getLocalIndex(java.lang.String name)

### getLocalVariable

    public org.apache.bcel.generic.LocalVariableGen getLocalVariable(java.lang.String name)

### setMaxLocals

    public void setMaxLocals()

  Overrides:
    setMaxLocals in class org.apache.bcel.generic.MethodGen

### addInstructionList

    public void addInstructionList(Pattern pattern,
                                   org.apache.bcel.generic.InstructionList ilist)

  Add a pre-compiled pattern to this mode.

### getInstructionList

    public org.apache.bcel.generic.InstructionList getInstructionList(Pattern pattern)

  Get the instruction list for a pre-compiled pattern. Used by test sequences to avoid compiling patterns more than once.

### outlineChunks

    public org.apache.bcel.classfile.Method[] outlineChunks(ClassGenerator classGen,
                                                            int originalMethodSize)

  Breaks up the IL for this `MethodGenerator` into separate outlined methods so that no method exceeds the 64KB limit on the length of the byte code associated with a method.
  Parameters:
    `classGen` - The `ClassGen` with which the generated methods will be associated
    `originalMethodSize` - The number of bytes of bytecode represented by the `InstructionList` of this method
  Returns:
    an array of the outlined `Method`s and the original method itself

### markChunkStart

    public void markChunkStart()

  Mark the end of the method's `InstructionList` as the start of an outlineable chunk of code. The outlineable chunk begins after the `InstructionHandle` that is at the end of the method's `InstructionList`, or at the start of the method if the `InstructionList` is empty. See `OutlineableChunkStart` for more information.

### markChunkEnd

    public void markChunkEnd()

  Mark the end of an outlineable chunk of code. See `OutlineableChunkStart` for more information.

Copyright © 2006 Apache XML Project. All Rights Reserved.