new MethodGenerator(ACC_PUBLIC, org.apache.bcel.generic.Type.VOID, argTypes, argNames, classGen.getConstantPool()); toplevel.addException("org.apache.xalan.xsltc.TransletException"); toplevel.addLocalVariable("current", org.apache.bcel.generic.Type.INT, null, null); "getIterator", "()"+NODE_ITERATOR_SIG); il.append(toplevel.loadDOM()); il.append(new INVOKEINTERFACE(gitr, 1)); il.append(toplevel.nextNode()); current.setStart(il.append(new ISTORE(current.getIndex()))); il.append(toplevel.loadDOM()); il.append(classGen.loadTranslet()); il.append(new INVOKEINTERFACE(setFilter, 2));
/** * 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. */ public LocalVariableGen addLocalVariable(String name, Type type, InstructionHandle start, InstructionHandle end) { LocalVariableGen lvg; if (_allocatorInit) { lvg = addLocalVariable2(name, type, start); } else { lvg = super.addLocalVariable(name, type, start, end); getLocalVariableRegistry().registerLocalVariable(lvg); } return lvg; }
public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(methodGen.loadHandler()); il.append(methodGen.uniqueAttribute()); il.append(methodGen.attribute());
/** * Translate this node into a fresh instruction list. * The original instruction list is saved and restored. */ public InstructionList compile(ClassGenerator classGen, MethodGenerator methodGen) { final InstructionList result, save = methodGen.getInstructionList(); methodGen.setInstructionList(result = new InstructionList()); translate(classGen, methodGen); methodGen.setInstructionList(save); return result; }
/** * Remove the mapping of this variable to a register. * Called when we leave the AST scope of the variable's declaration */ public void unmapRegister(MethodGenerator methodGen) { if (_local != null) { _local.setEnd(methodGen.getInstructionList().getEnd()); methodGen.removeLocalVariable(_local); _refs = null; _local = null; } }
public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); methodGen.addLocalVariable2("name", Util.getJCRefType(STRING_SIG), null); final LocalVariableGen length = methodGen.addLocalVariable2("length", Util.getJCRefType("I"), null); il.append(methodGen.loadDOM()); il.append(methodGen.loadCurrentNode()); il.append(methodGen.loadHandler()); final int cpy = cpg.addInterfaceMethodref(DOM_INTF, "shallowCopy", il.append(methodGen.loadHandler()); name.setEnd(il.append(new ALOAD(name.getIndex()))); il.append(methodGen.endElement()); methodGen.removeLocalVariable(name); methodGen.removeLocalVariable(length);
new MethodGenerator(ACC_PUBLIC, org.apache.bcel.generic.Type.VOID, argTypes, argNames, il, classGen.getConstantPool()); transf.addException("org.apache.xalan.xsltc.TransletException"); transf.addLocalVariable("current", org.apache.bcel.generic.Type.INT, null, null); il.append(transf.loadDOM()); il.append(new INVOKEVIRTUAL(cpg.addMethodref(TRANSLET_CLASS, "makeDOMAdapter", "getIterator", "()"+NODE_ITERATOR_SIG); il.append(transf.loadDOM()); il.append(new INVOKEINTERFACE(gitr, 1)); il.append(transf.nextNode()); current.setStart(il.append(new ISTORE(current.getIndex()))); il.append(transf.loadHandler()); final int index = cpg.addMethodref(TRANSLET_CLASS, "transferOutputSettings", il.append(transf.loadIterator()); il.append(transf.loadHandler()); // The output handler
/** * This method is called when the name of the element is known at compile time. * In this case, there is no need to inspect the element name at runtime to * determine if a prefix exists, needs to be generated, etc. */ public void translateLiteral(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); if (!_ignore) { il.append(methodGen.loadHandler()); _name.translate(classGen, methodGen); il.append(DUP2); il.append(methodGen.startElement()); if (_namespace != null) { il.append(methodGen.loadHandler()); il.append(new PUSH(cpg, _prefix)); _namespace.translate(classGen,methodGen); il.append(methodGen.namespace()); } } translateContents(classGen, methodGen); if (!_ignore) { il.append(methodGen.endElement()); } }
final InstructionList il = methodGen.getInstructionList(); il.append(methodGen.loadHandler()); il.append(new PUSH(cpg,_prefix)); _namespace.translate(classGen,methodGen); il.append(methodGen.namespace()); methodGen.addLocalVariable2("nameValue", Util.getJCRefType(STRING_SIG), null); il.append(methodGen.loadHandler()); } else { il.append(methodGen.loadHandler()); STRING_VALUE_HANDLER_SIG))); il.append(DUP); il.append(methodGen.storeHandler()); il.append(methodGen.uniqueAttribute()); il.append(methodGen.attribute()); il.append(methodGen.storeHandler());
if (getExceptionHandlers().length != 0) { String msg = (new ErrorMsg(ErrorMsg.OUTLINE_ERR_TRY_CATCH)) .toString(); ConstantPoolGen cpg = getConstantPool(); final boolean isStaticMethod = (getAccessFlags() & ACC_STATIC) != 0; new MethodGenerator(methodAttributes, org.apache.bcel.generic.Type.VOID, argTypes, argNames, outlinedMethodName, getClassName(), newIL, cpg); classGen.getClassName(), outlinedMethodName, outlinedMethodGen.getSignature()))); } else { oldMethCopyOutIL.append(InstructionConstants.THIS); classGen.getClassName(), outlinedMethodName, outlinedMethodGen.getSignature()))); int oldLocalVarIndex = lvi.getIndex(); LocalVariableGen oldLVG = getLocalVariableRegistry() .lookupRegisteredLocalVariable(oldLocalVarIndex, ih.getPosition());
final InstructionList il = methodGen.getInstructionList(); final Stylesheet stylesheet = classGen.getStylesheet(); il.append(methodGen.loadHandler()); il.append(methodGen.loadDOM()); int index = cpg.addInterfaceMethodref(DOM_INTF, "getResultTreeFrag", il.append(methodGen.storeHandler()); il.append(methodGen.startDocument()); il.append(methodGen.loadHandler()); il.append(methodGen.endDocument()); il.append(methodGen.loadDOM()); il.append(new CHECKCAST(cpg.addClass(classGen.getDOMClass()))); il.append(SWAP); il.append(methodGen.storeHandler());
int buildKeyIndex) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); methodGen.addLocalVariable("parentNode", Util.getJCRefType("I"), null, null); il.append(methodGen.loadCurrentNode()); il.append(methodGen.loadIterator()); il.append(methodGen.storeIterator()); il.append(methodGen.loadDOM()); il.append(methodGen.loadCurrentNode()); il.append(new INVOKEINTERFACE(getNodeValue, 2)); il.append(methodGen.loadDOM()); il.append(new INVOKEVIRTUAL(keyDom)); nextNode.setTarget(il.append(methodGen.loadIterator())); il.append(methodGen.nextNode()); il.append(methodGen.storeCurrentNode()); il.append(new IFGE(loop)); // Go on to next matching node.... il.append(methodGen.storeIterator()); il.append(methodGen.storeCurrentNode());
int index; final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); match = methodGen.addLocalVariable("step_pattern_tmp1", Util.getJCRefType(NODE_SIG), null, null); il.append(methodGen.loadCurrentNode()); il.append(methodGen.loadIterator()); methodGen.addLocalVariable("step_pattern_tmp2", Util.getJCRefType(NODE_ITERATOR_SIG), null, null); il.append(methodGen.loadDOM()); il.append(new ILOAD(match.getIndex())); index = cpg.addInterfaceMethodref(DOM_INTF, GET_PARENT, GET_PARENT_SIG); il.append(methodGen.setStartNode()); il.append(methodGen.storeIterator()); match.setEnd(il.append(new ILOAD(match.getIndex()))); il.append(methodGen.storeCurrentNode()); InstructionHandle restore = il.append(methodGen.storeIterator()); il.append(methodGen.storeCurrentNode()); exp.backPatchTrueList(restore); BranchHandle skipFalse = il.append(new GOTO(null));
final int n = argumentCount(); final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); final boolean isSecureProcessing = classGen.getParser().getXSLTC().isSecureProcessing(); int index; il.append(methodGen.loadDOM()); equals("()Ljava/lang/String;")) { args = "I"+DOM_INTF_SIG; il.append(methodGen.loadContextNode()); il.append(methodGen.loadDOM()); expType.translateTo(classGen, methodGen, paramTypes[i]); paramTemp[i] = methodGen.addLocalVariable("function_call_tmp"+i, expType.toJCType(), null, null);
String originalMethodName = getName(); ArrayList candidateChunks = getCandidateChunks(classGen, currentMethodSize); Collections.sort(candidateChunks); Chunk chunkToOutline = (Chunk)candidateChunks.get(i); methodsOutlined.add(outline(chunkToOutline.getChunkStart(), chunkToOutline.getChunkEnd(), originalMethodName + "$outline$" moreMethodsOutlined = true; InstructionList il = getInstructionList(); InstructionHandle lastInst = il.getEnd(); il.setPositions(); methodsOutlined.toArray(methodsArr); methodsArr[methodsOutlined.size()] = getThisMethod();
public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); if (_path != null) { final int initDFI = cpg.addMethodref(DUP_FILTERED_ITERATOR, methodGen.addLocalVariable("filtered_absolute_location_path_tmp", Util.getJCRefType(NODE_ITERATOR_SIG), null, null); "getIterator", "()"+NODE_ITERATOR_SIG); il.append(methodGen.loadDOM()); il.append(new INVOKEINTERFACE(git, 1));
il.append(methodGen.loadCurrentNode()); InstructionList ilist = methodGen.getInstructionList(pattern); if (ilist == null) { ilist = pattern.compile(classGen, methodGen); methodGen.addInstructionList(pattern, ilist);
new MethodGenerator(ACC_PUBLIC | ACC_FINAL, org.apache.bcel.generic.Type.VOID, argTypes, argNames, functionName(), getClassName(), mainIL, classGen.getConstantPool()); methodGen.addException("org.apache.xalan.xsltc.TransletException"); current = methodGen.addLocalVariable2("current", org.apache.bcel.generic.Type.INT, null); ilLoop.append(methodGen.loadIterator()); ilLoop.append(methodGen.nextNode()); ilLoop.append(DUP); ilLoop.append(new ISTORE(_currentIndex)); "getExpandedTypeID", "(I)I"); body.append(methodGen.loadDOM()); body.append(new ILOAD(_currentIndex)); body.append(new INVOKEINTERFACE(getType, 2));
public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); final LocalVariableGen local = methodGen.addLocalVariable2("ppt", Util.getJCRefType(NODE_SIG), null); il.append(methodGen.loadDOM()); il.append(SWAP); il.append(methodGen.loadDOM()); local.setEnd(il.append(loadLocal)); il.append(methodGen.loadDOM()); il.append(SWAP); il.append(methodGen.loadDOM()); local.setEnd(il.append(loadLocal)); methodGen.removeLocalVariable(local);
private void translateGeneralContext(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); node = methodGen.addLocalVariable("step_pattern_tmp1", Util.getJCRefType(NODE_SIG), null, null); iter = methodGen.addLocalVariable("step_pattern_tmp2", Util.getJCRefType(NODE_ITERATOR_SIG), null, null); il.append(methodGen.loadDOM()); il.append(new ILOAD(node.getIndex())); int index = cpg.addInterfaceMethodref(DOM_INTF, il.append(methodGen.setStartNode()); node2 = methodGen.addLocalVariable("step_pattern_tmp3", Util.getJCRefType(NODE_SIG), null, 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()));