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

All Implemented Interfaces:
  java.lang.Cloneable, org.apache.bcel.generic.InstructionConstants, org.apache.bcel.generic.NamedAndTyped, Constants

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

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

Author:
  Jacek Ambroziak, Santiago Pericas-Geertsen

### Nested Class Summary

### Nested classes/interfaces inherited from interface org.apache.bcel.generic.InstructionConstants

`org.apache.bcel.generic.InstructionConstants.Clinit`

### Field Summary

### Fields inherited from interface org.apache.xalan.xsltc.compiler.Constants

`ABSOLUTE_ITERATOR, ACC_FINAL, ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC, ACC_STATIC, ACC_SUPER, ADD_ATTRIBUTE, ADD_ATTRIBUTE_SIG, ADD_ITERATOR, ADD_ITERATOR_SIG, ADD_PARAMETER, ADD_PARAMETER_SIG, APPLY_TEMPLATES, ATTR_SET_SIG, ATTRIBUTE_LIST_FIELD, ATTRIBUTE_LIST_IMPL_CLASS, ATTRIBUTE_LIST_IMPL_SIG, ATTRIBUTES_SIG, BASIS_LIBRARY_CLASS, BOOLEAN_CLASS, BOOLEAN_VALUE, BOOLEAN_VALUE_SIG, CACHED_NODE_LIST_ITERATOR_CLASS, CHARACTERS, CHARACTERS_SIG, CHARACTERSW, CHARACTERSW_SIG, CLEAR_ATTRIBUTES, CLEAR_ATTRIBUTES_SIG, COLLATOR_CLASS, COLLATOR_SIG, COMPILER_PACKAGE, CURRENT_NODE_LIST_FILTER, CURRENT_NODE_LIST_FILTER_SIG, CURRENT_NODE_LIST_ITERATOR, CURRENT_NODE_LIST_ITERATOR_SIG, DEFAULT_NODE_COUNTER, DEFAULT_NODE_COUNTER_SIG, DOCUMENT_PNAME, DOM_ADAPTER_CLASS, DOM_ADAPTER_SIG, DOM_FIELD, DOM_IMPL, DOM_IMPL_CLASS, DOM_IMPL_SIG, DOM_INTF, DOM_INTF_SIG, DOM_PNAME, DOUBLE_CLASS, DOUBLE_SIG, DOUBLE_VALUE, DOUBLE_VALUE_SIG, DUP_FILTERED_ITERATOR, EMPTYATTR_FIELD, EMPTYSTRING, ERROR, EXPAND_STYLESHEET_QNAME_REF, EXPAND_STYLESHEET_QNAME_SIG, FALLBACK_CLASS, FATAL, FILTER_INTERFACE, FILTER_INTERFACE_SIG, FILTER_ITERATOR, FILTER_STEP_ITERATOR, FORMAT_SYMBOLS_FIELD, GET_ATTRIBUTE_VALUE, GET_ATTRIBUTE_VALUE_SIG, GET_CHILDREN, GET_CHILDREN_SIG, GET_ELEMENT_VALUE, GET_ELEMENT_VALUE_SIG, GET_ITERATOR_SIG, GET_NODE_NAME, GET_NODE_NAME_SIG, GET_NODE_TYPE, GET_NODE_TYPE_SIG, GET_NODE_VALUE, GET_NODE_VALUE_ITERATOR, GET_NODE_VALUE_ITERATOR_SIG, GET_NODE_VALUE_SIG, GET_PARAMETER, GET_PARAMETER_SIG, GET_PARENT, GET_PARENT_SIG, GET_TYPED_CHILDREN, GET_TYPED_CHILDREN_SIG, GET_UNPARSED_ENTITY_URI, GET_UNPARSED_ENTITY_URI_SIG, HAS_ATTRIBUTE, HAS_ATTRIBUTE_SIG, HASIDCALL_INDEX, HASIDCALL_INDEX_SIG, INT_VALUE, INT_VALUE_SIG, INTEGER_CLASS, INTEGER_SIG, INTERNAL, INVOKE_METHOD, ITERATOR_FIELD_SIG, ITERATOR_PNAME, KEY_INDEX_CLASS, KEY_INDEX_ITERATOR_SIG, KEY_INDEX_SIG, LAST_INDEX, LOAD_DOCUMENT_CLASS, LOCALE_CLASS, LOCALE_SIG, LOOKUP_STYLESHEET_QNAME_NS_REF, LOOKUP_STYLESHEET_QNAME_NS_SIG, MAKE_NODE, MAKE_NODE_LIST, MAKE_NODE_LIST_SIG, MAKE_NODE_LIST_SIG2, MAKE_NODE_SIG, MAKE_NODE_SIG2, MATCHING_ITERATOR, MATH_CLASS, MULTI_DOM_CLASS, MULTI_DOM_SIG, NAMES_INDEX, NAMES_INDEX_SIG, NAMESPACE_FEATURE, NAMESPACE_INDEX, NAMESPACE_INDEX_SIG, NEXT, NEXT_SIG, NEXTID, NODE, NODE_COUNTER, NODE_COUNTER_SIG, NODE_FIELD, NODE_FIELD_SIG, NODE_ITERATOR, NODE_ITERATOR_BASE, NODE_ITERATOR_SIG, NODE_PNAME, NODE_SIG, NODE_SORT_FACTORY, NODE_SORT_FACTORY_SIG, NODE_SORT_RECORD, NODE_SORT_RECORD_SIG, NS_ANCESTORS_INDEX_SIG, NTH_ITERATOR_CLASS, OBJECT_CLASS, OBJECT_SIG, ORDER_ITERATOR, ORDER_ITERATOR_SIG, OUTPUT_BASE, OUTPUT_HANDLER, OUTPUT_HANDLER_SIG, POP_PARAM_FRAME, POP_PARAM_FRAME_SIG, POSITION_INDEX, PREFIX_URIS_ARRAY_SIG, PREFIX_URIS_IDX_SIG, PUSH_PARAM_FRAME, PUSH_PARAM_FRAME_SIG, REDIRECT_URI, RESET, RESET_SIG, RTF_INITIAL_SIZE, RUNTIME_NODE_CLASS, RUNTIME_PACKAGE, SAX_IMPL, SAX_IMPL_CLASS, SAX_IMPL_SIG, SET_START_NODE, SET_START_NODE_SIG, SINGLETON_ITERATOR, SORT_ITERATOR, SORT_ITERATOR_SIG, STATIC_CHAR_DATA_FIELD, STATIC_CHAR_DATA_FIELD_SIG, STATIC_NAMES_ARRAY_FIELD, STATIC_NAMESPACE_ARRAY_FIELD, STATIC_NS_ANCESTORS_ARRAY_FIELD, STATIC_PREFIX_URIS_ARRAY_FIELD, STATIC_PREFIX_URIS_IDX_ARRAY_FIELD, STATIC_TYPES_ARRAY_FIELD, STATIC_URIS_ARRAY_FIELD, STEP_ITERATOR_CLASS, STREAM_XML_OUTPUT, STRING, STRING_BUFFER_CLASS, STRING_BUFFER_SIG, STRING_CLASS, STRING_SIG, STRING_TO_INT, STRING_TO_INT_SIG, STRING_TO_REAL, STRING_TO_REAL_SIG, STRING_VALUE_HANDLER, STRING_VALUE_HANDLER_SIG, STRING_WRITER, STRIP_SPACE, STRIP_SPACE_INTF, STRIP_SPACE_PARAMS, STRIP_SPACE_SIG, TRANSLET_CLASS, TRANSLET_FIELD, TRANSLET_FIELD_SIG, TRANSLET_INTF, TRANSLET_INTF_SIG, TRANSLET_OUTPUT_BASE, TRANSLET_OUTPUT_INTERFACE, TRANSLET_OUTPUT_PNAME, TRANSLET_OUTPUT_SIG, TRANSLET_PNAME, TRANSLET_SIG, TRANSLET_URI, TRANSLET_VERSION_INDEX, TRANSLET_VERSION_INDEX_SIG, TYPES_INDEX, TYPES_INDEX_SIG, UNION_ITERATOR_CLASS, UNION_ITERATOR_SIG, UNSUPPORTED, URIS_INDEX, URIS_INDEX_SIG, WARNING, WRITER_SIG, XHTML_URI, XMLNS_PREFIX, XMLNS_STRING, XMLNS_URI, XSLT_PACKAGE, XSLT_URI`

### Fields inherited from interface org.apache.bcel.generic.InstructionConstants

`AALOAD, AASTORE, ACONST_NULL, ALOAD_0, ALOAD_1, ALOAD_2, ARETURN, ARRAYLENGTH, ASTORE_0, ASTORE_1, ASTORE_2, ATHROW, BALOAD, BASTORE, bla, CALOAD, CASTORE, D2F, D2I, D2L, DADD, DALOAD, DASTORE, DCMPG, DCMPL, DCONST_0, DCONST_1, DDIV, DMUL, DNEG, DREM, DRETURN, DSUB, DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1, DUP2_X2, F2D, F2I, F2L, FADD, FALOAD, FASTORE, FCMPG, FCMPL, FCONST_0, FCONST_1, FCONST_2, FDIV, FMUL, FNEG, FREM, FRETURN, FSUB, I2B, I2C, I2D, I2F, I2L, I2S, IADD, IALOAD, IAND, IASTORE, ICONST_0, ICONST_1, ICONST_2, ICONST_3, ICONST_4, ICONST_5, ICONST_M1, IDIV, ILOAD_0, ILOAD_1, ILOAD_2, IMUL, INEG, INSTRUCTIONS, IOR, IREM, IRETURN, ISHL, ISHR, ISTORE_0, ISTORE_1, ISTORE_2, ISUB, IUSHR, IXOR, L2D, L2F, L2I, LADD, LALOAD, LAND, LASTORE, LCMP, LCONST_0, LCONST_1, LDIV, LMUL, LNEG, LOR, LREM, LRETURN, LSHL, LSHR, LSUB, LUSHR, LXOR, MONITORENTER, MONITOREXIT, NOP, POP, POP2, RETURN, SALOAD, SASTORE, SWAP, THIS`

### Constructor Summary

Constructors
Constructor and Description
`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

Methods
`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.