com.sun.org.apache.bcel.internal.generic.ALOAD Java Examples
The following examples show how to use
com.sun.org.apache.bcel.internal.generic.ALOAD.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MethodGenerator.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Helper method to generate an instance of a subclass of * {@link LoadInstruction} based on the specified {@link Type} that will * load the specified local variable * @param index the JVM stack frame index of the variable that is to be * loaded * @param type the {@link Type} of the variable * @return the generated {@link LoadInstruction} */ private static Instruction loadLocal(int index, Type type) { if (type == Type.BOOLEAN) { return new ILOAD(index); } else if (type == Type.INT) { return new ILOAD(index); } else if (type == Type.SHORT) { return new ILOAD(index); } else if (type == Type.LONG) { return new LLOAD(index); } else if (type == Type.BYTE) { return new ILOAD(index); } else if (type == Type.CHAR) { return new ILOAD(index); } else if (type == Type.FLOAT) { return new FLOAD(index); } else if (type == Type.DOUBLE) { return new DLOAD(index); } else { return new ALOAD(index); } }
Example #2
Source File: MethodGenerator.java From JDKSourceCode1.8 with MIT License | 6 votes |
/** * Helper method to generate an instance of a subclass of * {@link LoadInstruction} based on the specified {@link Type} that will * load the specified local variable * @param index the JVM stack frame index of the variable that is to be * loaded * @param type the {@link Type} of the variable * @return the generated {@link LoadInstruction} */ private static Instruction loadLocal(int index, Type type) { if (type == Type.BOOLEAN) { return new ILOAD(index); } else if (type == Type.INT) { return new ILOAD(index); } else if (type == Type.SHORT) { return new ILOAD(index); } else if (type == Type.LONG) { return new LLOAD(index); } else if (type == Type.BYTE) { return new ILOAD(index); } else if (type == Type.CHAR) { return new ILOAD(index); } else if (type == Type.FLOAT) { return new FLOAD(index); } else if (type == Type.DOUBLE) { return new DLOAD(index); } else { return new ALOAD(index); } }
Example #3
Source File: CompareGenerator.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public CompareGenerator(int access_flags, Type return_type, Type[] arg_types, String[] arg_names, String method_name, String class_name, InstructionList il, ConstantPoolGen cp) { super(access_flags, return_type, arg_types, arg_names, method_name, class_name, il, cp); _iloadCurrent = new ILOAD(CURRENT_INDEX); _istoreCurrent = new ISTORE(CURRENT_INDEX); _aloadDom = new ALOAD(DOM_INDEX); _iloadLast = new ILOAD(LAST_INDEX); LocalVariableGen iterator = addLocalVariable("iterator", Util.getJCRefType(Constants.NODE_ITERATOR_SIG), null, null); ITERATOR_INDEX = iterator.getIndex(); _aloadIterator = new ALOAD(ITERATOR_INDEX); _astoreIterator = new ASTORE(ITERATOR_INDEX); il.append(new ACONST_NULL()); il.append(storeIterator()); }
Example #4
Source File: CompareGenerator.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public CompareGenerator(int access_flags, Type return_type, Type[] arg_types, String[] arg_names, String method_name, String class_name, InstructionList il, ConstantPoolGen cp) { super(access_flags, return_type, arg_types, arg_names, method_name, class_name, il, cp); _iloadCurrent = new ILOAD(CURRENT_INDEX); _istoreCurrent = new ISTORE(CURRENT_INDEX); _aloadDom = new ALOAD(DOM_INDEX); _iloadLast = new ILOAD(LAST_INDEX); LocalVariableGen iterator = addLocalVariable("iterator", Util.getJCRefType(Constants.NODE_ITERATOR_SIG), null, null); ITERATOR_INDEX = iterator.getIndex(); _aloadIterator = new ALOAD(ITERATOR_INDEX); _astoreIterator = new ASTORE(ITERATOR_INDEX); il.append(new ACONST_NULL()); il.append(storeIterator()); }
Example #5
Source File: MethodGenerator.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Helper method to generate an instance of a subclass of * {@link LoadInstruction} based on the specified {@link Type} that will * load the specified local variable * @param index the JVM stack frame index of the variable that is to be * loaded * @param type the {@link Type} of the variable * @return the generated {@link LoadInstruction} */ private static Instruction loadLocal(int index, Type type) { if (type == Type.BOOLEAN) { return new ILOAD(index); } else if (type == Type.INT) { return new ILOAD(index); } else if (type == Type.SHORT) { return new ILOAD(index); } else if (type == Type.LONG) { return new LLOAD(index); } else if (type == Type.BYTE) { return new ILOAD(index); } else if (type == Type.CHAR) { return new ILOAD(index); } else if (type == Type.FLOAT) { return new FLOAD(index); } else if (type == Type.DOUBLE) { return new DLOAD(index); } else { return new ALOAD(index); } }
Example #6
Source File: MethodGenerator.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
/** * Helper method to generate an instance of a subclass of * {@link LoadInstruction} based on the specified {@link Type} that will * load the specified local variable * @param index the JVM stack frame index of the variable that is to be * loaded * @param type the {@link Type} of the variable * @return the generated {@link LoadInstruction} */ private static Instruction loadLocal(int index, Type type) { if (type == Type.BOOLEAN) { return new ILOAD(index); } else if (type == Type.INT) { return new ILOAD(index); } else if (type == Type.SHORT) { return new ILOAD(index); } else if (type == Type.LONG) { return new LLOAD(index); } else if (type == Type.BYTE) { return new ILOAD(index); } else if (type == Type.CHAR) { return new ILOAD(index); } else if (type == Type.FLOAT) { return new FLOAD(index); } else if (type == Type.DOUBLE) { return new DLOAD(index); } else { return new ALOAD(index); } }
Example #7
Source File: ClassGenerator.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public ClassGenerator(String class_name, String super_class_name, String file_name, int access_flags, String[] interfaces, Stylesheet stylesheet) { super(class_name, super_class_name, file_name, access_flags, interfaces); _stylesheet = stylesheet; _parser = stylesheet.getParser(); _aloadTranslet = new ALOAD(TRANSLET_INDEX); if (stylesheet.isMultiDocument()) { _domClass = "com.sun.org.apache.xalan.internal.xsltc.dom.MultiDOM"; _domClassSig = "Lcom/sun/org/apache/xalan/internal/xsltc/dom/MultiDOM;"; } else { _domClass = "com.sun.org.apache.xalan.internal.xsltc.dom.DOMAdapter"; _domClassSig = "Lcom/sun/org/apache/xalan/internal/xsltc/dom/DOMAdapter;"; } _applyTemplatesSig = "(" + Constants.DOM_INTF_SIG + Constants.NODE_ITERATOR_SIG + Constants.TRANSLET_OUTPUT_SIG + ")V"; _applyTemplatesSigForImport = "(" + Constants.DOM_INTF_SIG + Constants.NODE_ITERATOR_SIG + Constants.TRANSLET_OUTPUT_SIG + Constants.NODE_FIELD_SIG + ")V"; }
Example #8
Source File: NodeSortRecordGenerator.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public NodeSortRecordGenerator(String className, String superClassName, String fileName, int accessFlags, String[] interfaces, Stylesheet stylesheet) { super(className, superClassName, fileName, accessFlags, interfaces, stylesheet); _aloadTranslet = new ALOAD(TRANSLET_INDEX); }
Example #9
Source File: NodeSortRecordGenerator.java From JDKSourceCode1.8 with MIT License | 5 votes |
public NodeSortRecordGenerator(String className, String superClassName, String fileName, int accessFlags, String[] interfaces, Stylesheet stylesheet) { super(className, superClassName, fileName, accessFlags, interfaces, stylesheet); _aloadTranslet = new ALOAD(TRANSLET_INDEX); }
Example #10
Source File: FilterGenerator.java From JDKSourceCode1.8 with MIT License | 5 votes |
public FilterGenerator(String className, String superClassName, String fileName, int accessFlags, String[] interfaces, Stylesheet stylesheet) { super(className, superClassName, fileName, accessFlags, interfaces, stylesheet); _aloadTranslet = new ALOAD(TRANSLET_INDEX); }
Example #11
Source File: WithParam.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Release the compiled result tree. */ public void releaseResultTree(ClassGenerator classGen, MethodGenerator methodGen) { if (_domAdapter != null) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); if (classGen.getStylesheet().callsNodeset() && classGen.getDOMClass().equals(MULTI_DOM_CLASS)) { final int removeDA = cpg.addMethodref(MULTI_DOM_CLASS, "removeDOMAdapter", "(" + DOM_ADAPTER_SIG + ")V"); il.append(methodGen.loadDOM()); il.append(new CHECKCAST(cpg.addClass(MULTI_DOM_CLASS))); il.append(new ALOAD(_domAdapter.getIndex())); il.append(new CHECKCAST(cpg.addClass(DOM_ADAPTER_CLASS))); il.append(new INVOKEVIRTUAL(removeDA)); } final int release = cpg.addInterfaceMethodref(DOM_IMPL_CLASS, "release", "()V"); il.append(new ALOAD(_domAdapter.getIndex())); il.append(new INVOKEINTERFACE(release, 1)); _domAdapter.setEnd(il.getEnd()); methodGen.removeLocalVariable(_domAdapter); _domAdapter = null; } }
Example #12
Source File: FilterGenerator.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public FilterGenerator(String className, String superClassName, String fileName, int accessFlags, String[] interfaces, Stylesheet stylesheet) { super(className, superClassName, fileName, accessFlags, interfaces, stylesheet); _aloadTranslet = new ALOAD(TRANSLET_INDEX); }
Example #13
Source File: ClassGenerator.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
public ClassGenerator(String class_name, String super_class_name, String file_name, int access_flags, String[] interfaces, Stylesheet stylesheet) { super(class_name, super_class_name, file_name, access_flags, interfaces); _stylesheet = stylesheet; _parser = stylesheet.getParser(); _aloadTranslet = new ALOAD(TRANSLET_INDEX); if (stylesheet.isMultiDocument()) { _domClass = "com.sun.org.apache.xalan.internal.xsltc.dom.MultiDOM"; _domClassSig = "Lcom/sun/org/apache/xalan/internal/xsltc/dom/MultiDOM;"; } else { _domClass = "com.sun.org.apache.xalan.internal.xsltc.dom.DOMAdapter"; _domClassSig = "Lcom/sun/org/apache/xalan/internal/xsltc/dom/DOMAdapter;"; } _applyTemplatesSig = "(" + Constants.DOM_INTF_SIG + Constants.NODE_ITERATOR_SIG + Constants.TRANSLET_OUTPUT_SIG + ")V"; _applyTemplatesSigForImport = "(" + Constants.DOM_INTF_SIG + Constants.NODE_ITERATOR_SIG + Constants.TRANSLET_OUTPUT_SIG + Constants.NODE_FIELD_SIG + ")V"; }
Example #14
Source File: FilterGenerator.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public FilterGenerator(String className, String superClassName, String fileName, int accessFlags, String[] interfaces, Stylesheet stylesheet) { super(className, superClassName, fileName, accessFlags, interfaces, stylesheet); _aloadTranslet = new ALOAD(TRANSLET_INDEX); }
Example #15
Source File: RtMethodGenerator.java From JDKSourceCode1.8 with MIT License | 5 votes |
public RtMethodGenerator(int access_flags, Type return_type, Type[] arg_types, String[] arg_names, String method_name, String class_name, InstructionList il, ConstantPoolGen cp) { super(access_flags, return_type, arg_types, arg_names, method_name, class_name, il, cp); _astoreHandler = new ASTORE(HANDLER_INDEX); _aloadHandler = new ALOAD(HANDLER_INDEX); }
Example #16
Source File: FilterGenerator.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
public FilterGenerator(String className, String superClassName, String fileName, int accessFlags, String[] interfaces, Stylesheet stylesheet) { super(className, superClassName, fileName, accessFlags, interfaces, stylesheet); _aloadTranslet = new ALOAD(TRANSLET_INDEX); }
Example #17
Source File: TestGenerator.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public TestGenerator(int access_flags, Type return_type, Type[] arg_types, String[] arg_names, String method_name, String class_name, InstructionList il, ConstantPoolGen cp) { super(access_flags, return_type, arg_types, arg_names, method_name, class_name, il, cp); _iloadCurrent = new ILOAD(CURRENT_NODE_INDEX); _istoreCurrent = new ISTORE(CURRENT_NODE_INDEX); _iloadContext = new ILOAD(CONTEXT_NODE_INDEX); _istoreContext = new ILOAD(CONTEXT_NODE_INDEX); _astoreIterator = new ASTORE(ITERATOR_INDEX); _aloadIterator = new ALOAD(ITERATOR_INDEX); }
Example #18
Source File: NodeSortRecordGenerator.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
public NodeSortRecordGenerator(String className, String superClassName, String fileName, int accessFlags, String[] interfaces, Stylesheet stylesheet) { super(className, superClassName, fileName, accessFlags, interfaces, stylesheet); _aloadTranslet = new ALOAD(TRANSLET_INDEX); }
Example #19
Source File: TestGenerator.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public TestGenerator(int access_flags, Type return_type, Type[] arg_types, String[] arg_names, String method_name, String class_name, InstructionList il, ConstantPoolGen cp) { super(access_flags, return_type, arg_types, arg_names, method_name, class_name, il, cp); _iloadCurrent = new ILOAD(CURRENT_NODE_INDEX); _istoreCurrent = new ISTORE(CURRENT_NODE_INDEX); _iloadContext = new ILOAD(CONTEXT_NODE_INDEX); _istoreContext = new ILOAD(CONTEXT_NODE_INDEX); _astoreIterator = new ASTORE(ITERATOR_INDEX); _aloadIterator = new ALOAD(ITERATOR_INDEX); }
Example #20
Source File: ClassGenerator.java From JDKSourceCode1.8 with MIT License | 5 votes |
public ClassGenerator(String class_name, String super_class_name, String file_name, int access_flags, String[] interfaces, Stylesheet stylesheet) { super(class_name, super_class_name, file_name, access_flags, interfaces); _stylesheet = stylesheet; _parser = stylesheet.getParser(); _aloadTranslet = new ALOAD(TRANSLET_INDEX); if (stylesheet.isMultiDocument()) { _domClass = "com.sun.org.apache.xalan.internal.xsltc.dom.MultiDOM"; _domClassSig = "Lcom/sun/org/apache/xalan/internal/xsltc/dom/MultiDOM;"; } else { _domClass = "com.sun.org.apache.xalan.internal.xsltc.dom.DOMAdapter"; _domClassSig = "Lcom/sun/org/apache/xalan/internal/xsltc/dom/DOMAdapter;"; } _applyTemplatesSig = "(" + Constants.DOM_INTF_SIG + Constants.NODE_ITERATOR_SIG + Constants.TRANSLET_OUTPUT_SIG + ")V"; _applyTemplatesSigForImport = "(" + Constants.DOM_INTF_SIG + Constants.NODE_ITERATOR_SIG + Constants.TRANSLET_OUTPUT_SIG + Constants.NODE_FIELD_SIG + ")V"; }
Example #21
Source File: RtMethodGenerator.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public RtMethodGenerator(int access_flags, Type return_type, Type[] arg_types, String[] arg_names, String method_name, String class_name, InstructionList il, ConstantPoolGen cp) { super(access_flags, return_type, arg_types, arg_names, method_name, class_name, il, cp); _astoreHandler = new ASTORE(HANDLER_INDEX); _aloadHandler = new ALOAD(HANDLER_INDEX); }
Example #22
Source File: ResultTreeType.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public Instruction LOAD(int slot) { return new ALOAD(slot); }
Example #23
Source File: NamedMethodGenerator.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public Instruction loadParameter(int index) { return new ALOAD(index + PARAM_START_INDEX); }
Example #24
Source File: FilterParentPath.java From JDKSourceCode1.8 with MIT License | 4 votes |
public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // Create new StepIterator final int initSI = cpg.addMethodref(STEP_ITERATOR_CLASS, "<init>", "(" +NODE_ITERATOR_SIG +NODE_ITERATOR_SIG +")V"); // Backwards branches are prohibited if an uninitialized object is // on the stack by section 4.9.4 of the JVM Specification, 2nd Ed. // We don't know whether this code might contain backwards branches, // so we mustn't create the new object until after we've created // the suspect arguments to its constructor. Instead we calculate // the values of the arguments to the constructor first, store them // in temporary variables, create the object and reload the // arguments from the temporaries to avoid the problem. // Recursively compile 2 iterators _filterExpr.translate(classGen, methodGen); LocalVariableGen filterTemp = methodGen.addLocalVariable("filter_parent_path_tmp1", Util.getJCRefType(NODE_ITERATOR_SIG), null, null); filterTemp.setStart(il.append(new ASTORE(filterTemp.getIndex()))); _path.translate(classGen, methodGen); LocalVariableGen pathTemp = methodGen.addLocalVariable("filter_parent_path_tmp2", Util.getJCRefType(NODE_ITERATOR_SIG), null, null); pathTemp.setStart(il.append(new ASTORE(pathTemp.getIndex()))); il.append(new NEW(cpg.addClass(STEP_ITERATOR_CLASS))); il.append(DUP); filterTemp.setEnd(il.append(new ALOAD(filterTemp.getIndex()))); pathTemp.setEnd(il.append(new ALOAD(pathTemp.getIndex()))); // Initialize StepIterator with iterators from the stack il.append(new INVOKESPECIAL(initSI)); // This is a special case for the //* path with or without predicates if (_hasDescendantAxis) { final int incl = cpg.addMethodref(NODE_ITERATOR_BASE, "includeSelf", "()" + NODE_ITERATOR_SIG); il.append(new INVOKEVIRTUAL(incl)); } SyntaxTreeNode parent = getParent(); boolean parentAlreadyOrdered = (parent instanceof RelativeLocationPath) || (parent instanceof FilterParentPath) || (parent instanceof KeyCall) || (parent instanceof CurrentCall) || (parent instanceof DocumentCall); if (!parentAlreadyOrdered) { final int order = cpg.addInterfaceMethodref(DOM_INTF, ORDER_ITERATOR, ORDER_ITERATOR_SIG); il.append(methodGen.loadDOM()); il.append(SWAP); il.append(methodGen.loadContextNode()); il.append(new INVOKEINTERFACE(order, 3)); } }
Example #25
Source File: NamedMethodGenerator.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public Instruction loadParameter(int index) { return new ALOAD(index + PARAM_START_INDEX); }
Example #26
Source File: StepPattern.java From JDKSourceCode1.8 with MIT License | 4 votes |
private void translateGeneralContext(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); int iteratorIndex = 0; BranchHandle ifBlock = null; LocalVariableGen iter, node, node2; final String iteratorName = getNextFieldName(); // Store node on the stack into a local variable node = methodGen.addLocalVariable("step_pattern_tmp1", Util.getJCRefType(NODE_SIG), null, null); node.setStart(il.append(new ISTORE(node.getIndex()))); // Create a new local to store the iterator iter = methodGen.addLocalVariable("step_pattern_tmp2", Util.getJCRefType(NODE_ITERATOR_SIG), null, null); // Add a new private field if this is the main class if (!classGen.isExternal()) { final Field iterator = new Field(ACC_PRIVATE, cpg.addUtf8(iteratorName), cpg.addUtf8(NODE_ITERATOR_SIG), null, cpg.getConstantPool()); classGen.addField(iterator); iteratorIndex = cpg.addFieldref(classGen.getClassName(), iteratorName, NODE_ITERATOR_SIG); il.append(classGen.loadTranslet()); il.append(new GETFIELD(iteratorIndex)); il.append(DUP); iter.setStart(il.append(new ASTORE(iter.getIndex()))); ifBlock = il.append(new IFNONNULL(null)); il.append(classGen.loadTranslet()); } // Compile the step created at type checking time _step.translate(classGen, methodGen); InstructionHandle iterStore = il.append(new ASTORE(iter.getIndex())); // If in the main class update the field too if (!classGen.isExternal()) { il.append(new ALOAD(iter.getIndex())); il.append(new PUTFIELD(iteratorIndex)); ifBlock.setTarget(il.append(NOP)); } else { // If class is not external, start of range for iter variable was // set above iter.setStart(iterStore); } // Get the parent of the node on the stack il.append(methodGen.loadDOM()); il.append(new ILOAD(node.getIndex())); int index = cpg.addInterfaceMethodref(DOM_INTF, GET_PARENT, GET_PARENT_SIG); il.append(new INVOKEINTERFACE(index, 2)); // Initialize the iterator with the parent il.append(new ALOAD(iter.getIndex())); il.append(SWAP); il.append(methodGen.setStartNode()); /* * Inline loop: * * int node2; * while ((node2 = iter.next()) != NodeIterator.END * && node2 < node); * return node2 == node; */ BranchHandle skipNext; InstructionHandle begin, next; node2 = methodGen.addLocalVariable("step_pattern_tmp3", Util.getJCRefType(NODE_SIG), null, null); skipNext = il.append(new GOTO(null)); next = il.append(new ALOAD(iter.getIndex())); node2.setStart(next); begin = il.append(methodGen.nextNode()); il.append(DUP); il.append(new ISTORE(node2.getIndex())); _falseList.add(il.append(new IFLT(null))); // NodeIterator.END il.append(new ILOAD(node2.getIndex())); il.append(new ILOAD(node.getIndex())); iter.setEnd(il.append(new IF_ICMPLT(next))); node2.setEnd(il.append(new ILOAD(node2.getIndex()))); node.setEnd(il.append(new ILOAD(node.getIndex()))); _falseList.add(il.append(new IF_ICMPNE(null))); skipNext.setTarget(begin); }
Example #27
Source File: MatchGenerator.java From JDKSourceCode1.8 with MIT License | 4 votes |
/** * Set index where the reference to the DOM is stored. */ public void setDomIndex(int domIndex) { _aloadDom = new ALOAD(domIndex); }
Example #28
Source File: NodeSetType.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public Instruction LOAD(int slot) { return new ALOAD(slot); }
Example #29
Source File: Sort.java From JDKSourceCode1.8 with MIT License | 4 votes |
/** * Compiles code that instantiates a SortingIterator object. * This object's constructor needs referencdes to the current iterator * and a node sort record producing objects as its parameters. */ public static void translateSortIterator(ClassGenerator classGen, MethodGenerator methodGen, Expression nodeSet, Vector<Sort> sortObjects) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // SortingIterator.SortingIterator(NodeIterator,NodeSortRecordFactory); final int init = cpg.addMethodref(SORT_ITERATOR, "<init>", "(" + NODE_ITERATOR_SIG + NODE_SORT_FACTORY_SIG + ")V"); // Backwards branches are prohibited if an uninitialized object is // on the stack by section 4.9.4 of the JVM Specification, 2nd Ed. // We don't know whether this code might contain backwards branches // so we mustn't create the new object until after we've created // the suspect arguments to its constructor. Instead we calculate // the values of the arguments to the constructor first, store them // in temporary variables, create the object and reload the // arguments from the temporaries to avoid the problem. LocalVariableGen nodesTemp = methodGen.addLocalVariable("sort_tmp1", Util.getJCRefType(NODE_ITERATOR_SIG), null, null); LocalVariableGen sortRecordFactoryTemp = methodGen.addLocalVariable("sort_tmp2", Util.getJCRefType(NODE_SORT_FACTORY_SIG), null, null); // Get the current node iterator if (nodeSet == null) { // apply-templates default final int children = cpg.addInterfaceMethodref(DOM_INTF, "getAxisIterator", "(I)"+ NODE_ITERATOR_SIG); il.append(methodGen.loadDOM()); il.append(new PUSH(cpg, Axis.CHILD)); il.append(new INVOKEINTERFACE(children, 2)); } else { nodeSet.translate(classGen, methodGen); } nodesTemp.setStart(il.append(new ASTORE(nodesTemp.getIndex()))); // Compile the code for the NodeSortRecord producing class and pass // that as the last argument to the SortingIterator constructor. compileSortRecordFactory(sortObjects, classGen, methodGen); sortRecordFactoryTemp.setStart( il.append(new ASTORE(sortRecordFactoryTemp.getIndex()))); il.append(new NEW(cpg.addClass(SORT_ITERATOR))); il.append(DUP); nodesTemp.setEnd(il.append(new ALOAD(nodesTemp.getIndex()))); sortRecordFactoryTemp.setEnd( il.append(new ALOAD(sortRecordFactoryTemp.getIndex()))); il.append(new INVOKESPECIAL(init)); }
Example #30
Source File: MatchGenerator.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
/** * Set index where the reference to the DOM is stored. */ public void setDomIndex(int domIndex) { _aloadDom = new ALOAD(domIndex); }