com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator Java Examples
The following examples show how to use
com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator.
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: FunctionCall.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Compile the function call and treat as an expression * Update true/false-lists. */ @Override public void translateDesynthesized(ClassGenerator classGen, MethodGenerator methodGen) { Type type = Type.Boolean; if (_chosenMethodType != null) type = _chosenMethodType.resultType(); final InstructionList il = methodGen.getInstructionList(); translate(classGen, methodGen); if ((type instanceof BooleanType) || (type instanceof IntType)) { _falseList.add(il.append(new IFEQ(null))); } }
Example #2
Source File: PositionCall.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final InstructionList il = methodGen.getInstructionList(); if (methodGen instanceof CompareGenerator) { il.append(((CompareGenerator)methodGen).loadCurrentNode()); } else if (methodGen instanceof TestGenerator) { il.append(new ILOAD(POSITION_INDEX)); } else { final ConstantPoolGen cpg = classGen.getConstantPool(); final int index = cpg.addInterfaceMethodref(NODE_ITERATOR, "getPosition", "()I"); il.append(methodGen.loadIterator()); il.append(new INVOKEINTERFACE(index,1)); } }
Example #3
Source File: VariableBase.java From Bytecoder with Apache License 2.0 | 6 votes |
/** * Remove the mapping of this variable to a register. * Called when we leave the AST scope of the variable's declaration */ public void unmapRegister(ClassGenerator classGen, MethodGenerator methodGen) { if (_local != null) { if (_type instanceof ResultTreeType) { 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(loadInstruction()); 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(loadInstruction()); il.append(new INVOKEINTERFACE(release, 1)); } _local.setEnd(methodGen.getInstructionList().getEnd()); methodGen.removeLocalVariable(_local); _refs = null; _local = null; } }
Example #4
Source File: LastCall.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final InstructionList il = methodGen.getInstructionList(); if (methodGen instanceof CompareGenerator) { il.append(((CompareGenerator)methodGen).loadLastNode()); } else if (methodGen instanceof TestGenerator) { il.append(new ILOAD(LAST_INDEX)); } else { final ConstantPoolGen cpg = classGen.getConstantPool(); final int getLast = cpg.addInterfaceMethodref(NODE_ITERATOR, "getLast", "()I"); il.append(methodGen.loadIterator()); il.append(new INVOKEINTERFACE(getLast, 1)); } }
Example #5
Source File: PositionCall.java From Bytecoder with Apache License 2.0 | 6 votes |
public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final InstructionList il = methodGen.getInstructionList(); if (methodGen instanceof CompareGenerator) { il.append(((CompareGenerator)methodGen).loadCurrentNode()); } else if (methodGen instanceof TestGenerator) { il.append(new ILOAD(POSITION_INDEX)); } else { final ConstantPoolGen cpg = classGen.getConstantPool(); final int index = cpg.addInterfaceMethodref(NODE_ITERATOR, "getPosition", "()I"); il.append(methodGen.loadIterator()); il.append(new INVOKEINTERFACE(index,1)); } }
Example #6
Source File: LocalNameCall.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * This method is called when the constructor is compiled in * Stylesheet.compileConstructor() and not as the syntax tree is traversed. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // Returns the name of a node in the DOM final int getNodeName = cpg.addInterfaceMethodref(DOM_INTF, "getNodeName", "(I)"+STRING_SIG); final int getLocalName = cpg.addMethodref(BASIS_LIBRARY_CLASS, "getLocalName", "(Ljava/lang/String;)"+ "Ljava/lang/String;"); super.translate(classGen, methodGen); il.append(new INVOKEINTERFACE(getNodeName, 2)); il.append(new INVOKESTATIC(getLocalName)); }
Example #7
Source File: Mode.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * Compiles the default handling for DOM elements: traverse all children */ private InstructionList compileDefaultRecursion(ClassGenerator classGen, MethodGenerator methodGen, InstructionHandle next) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = new InstructionList(); final String applyTemplatesSig = classGen.getApplyTemplatesSig(); final int git = cpg.addInterfaceMethodref(DOM_INTF, GET_CHILDREN, GET_CHILDREN_SIG); final int applyTemplates = cpg.addMethodref(getClassName(), functionName(), applyTemplatesSig); il.append(classGen.loadTranslet()); il.append(methodGen.loadDOM()); il.append(methodGen.loadDOM()); il.append(new ILOAD(_currentIndex)); il.append(new INVOKEINTERFACE(git, 2)); il.append(methodGen.loadHandler()); il.append(new INVOKEVIRTUAL(applyTemplates)); il.append(new GOTO_W(next)); return il; }
Example #8
Source File: XslElement.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * 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()); } }
Example #9
Source File: Mode.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private void compileTemplateCalls(ClassGenerator classGen, MethodGenerator methodGen, InstructionHandle next, int min, int max){ for (Template template : _neededTemplates.keySet()) { final int prec = template.getImportPrecedence(); if ((prec >= min) && (prec < max)) { if (template.hasContents()) { InstructionList til = template.compile(classGen, methodGen); til.append(new GOTO_W(next)); _templateILs.put(template, til); _templateIHs.put(template, til.getStart()); } else { // empty template _templateIHs.put(template, next); } } } }
Example #10
Source File: Expression.java From JDKSourceCode1.8 with MIT License | 6 votes |
/** * If this expression is of type node-set and it is not a variable * reference, then call setStartNode() passing the context node. */ public void startIterator(ClassGenerator classGen, MethodGenerator methodGen) { // Ignore if type is not node-set if (_type instanceof NodeSetType == false) { return; } // setStartNode() should not be called if expr is a variable ref Expression expr = this; if (expr instanceof CastExpr) { expr = ((CastExpr) expr).getExpr(); } if (expr instanceof VariableRefBase == false) { final InstructionList il = methodGen.getInstructionList(); il.append(methodGen.loadContextNode()); il.append(methodGen.setStartNode()); } }
Example #11
Source File: NameBase.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Translate the code required for getting the node for which the * QName, local-name or namespace URI should be extracted. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(methodGen.loadDOM()); // Function was called with no parameters if (argumentCount() == 0) { il.append(methodGen.loadContextNode()); } // Function was called with node parameter else if (_paramType == Type.Node) { _param.translate(classGen, methodGen); } else if (_paramType == Type.Reference) { _param.translate(classGen, methodGen); il.append(new INVOKESTATIC(cpg.addMethodref (BASIS_LIBRARY_CLASS, "referenceToNodeSet", "(" + OBJECT_SIG + ")" + NODE_ITERATOR_SIG))); il.append(methodGen.nextNode()); } // Function was called with node-set parameter else { _param.translate(classGen, methodGen); _param.startIterator(classGen, methodGen); il.append(methodGen.nextNode()); } }
Example #12
Source File: RoundCall.java From JDKSourceCode1.8 with MIT License | 5 votes |
public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // Get two copies of the argument on the stack argument().translate(classGen, methodGen); il.append(new INVOKESTATIC(cpg.addMethodref(BASIS_LIBRARY_CLASS, "roundF", "(D)D"))); }
Example #13
Source File: UnionPathExpr.java From hottub with GNU General Public License v2.0 | 5 votes |
public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); final int init = cpg.addMethodref(UNION_ITERATOR_CLASS, "<init>", "("+DOM_INTF_SIG+")V"); final int iter = cpg.addMethodref(UNION_ITERATOR_CLASS, ADD_ITERATOR, ADD_ITERATOR_SIG); // Create the UnionIterator and leave it on the stack il.append(new NEW(cpg.addClass(UNION_ITERATOR_CLASS))); il.append(DUP); il.append(methodGen.loadDOM()); il.append(new INVOKESPECIAL(init)); // Add the various iterators to the UnionIterator final int length = _components.length; for (int i = 0; i < length; i++) { _components[i].translate(classGen, methodGen); il.append(new INVOKEVIRTUAL(iter)); } // Order the iterator only if strictly needed if (_reverse) { 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 #14
Source File: StartsWithCall.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Compile the expression - leave boolean expression on stack */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); _base.translate(classGen, methodGen); _token.translate(classGen, methodGen); il.append(new INVOKEVIRTUAL(cpg.addMethodref(STRING_CLASS, "startsWith", "("+STRING_SIG+")Z"))); }
Example #15
Source File: Expression.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Synthesize a boolean expression, i.e., either push a 0 or 1 onto the * operand stack for the next statement to succeed. Returns the handle * of the instruction to be backpatched. */ public void synthesize(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); _trueList.backPatch(il.append(ICONST_1)); final BranchHandle truec = il.append(new GOTO_W(null)); _falseList.backPatch(il.append(ICONST_0)); truec.setTarget(il.append(NOP)); }
Example #16
Source File: NameBase.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** * Translate the code required for getting the node for which the * QName, local-name or namespace URI should be extracted. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(methodGen.loadDOM()); // Function was called with no parameters if (argumentCount() == 0) { il.append(methodGen.loadContextNode()); } // Function was called with node parameter else if (_paramType == Type.Node) { _param.translate(classGen, methodGen); } else if (_paramType == Type.Reference) { _param.translate(classGen, methodGen); il.append(new INVOKESTATIC(cpg.addMethodref (BASIS_LIBRARY_CLASS, "referenceToNodeSet", "(" + OBJECT_SIG + ")" + NODE_ITERATOR_SIG))); il.append(methodGen.nextNode()); } // Function was called with node-set parameter else { _param.translate(classGen, methodGen); _param.startIterator(classGen, methodGen); il.append(methodGen.nextNode()); } }
Example #17
Source File: BooleanCall.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public void translate(ClassGenerator classGen, MethodGenerator methodGen) { _arg.translate(classGen, methodGen); final Type targ = _arg.getType(); if (!targ.identicalTo(Type.Boolean)) { _arg.startIterator(classGen, methodGen); targ.translateTo(classGen, methodGen, Type.Boolean); } }
Example #18
Source File: StartsWithCall.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Compile the expression - leave boolean expression on stack */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); _base.translate(classGen, methodGen); _token.translate(classGen, methodGen); il.append(new INVOKEVIRTUAL(cpg.addMethodref(STRING_CLASS, "startsWith", "("+STRING_SIG+")Z"))); }
Example #19
Source File: NotCall.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public void translateDesynthesized(ClassGenerator classGen, MethodGenerator methodGen) { final InstructionList il = methodGen.getInstructionList(); final Expression exp = argument(); exp.translateDesynthesized(classGen, methodGen); final BranchHandle gotoh = il.append(new GOTO(null)); _trueList = exp._falseList; // swap flow lists _falseList = exp._trueList; _falseList.add(gotoh); }
Example #20
Source File: Mode.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public static void compileGetChildren(ClassGenerator classGen, MethodGenerator methodGen, int node) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); final int git = cpg.addInterfaceMethodref(DOM_INTF, GET_CHILDREN, GET_CHILDREN_SIG); il.append(methodGen.loadDOM()); il.append(new ILOAD(node)); il.append(new INVOKEINTERFACE(git, 2)); }
Example #21
Source File: Stylesheet.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Add a static field */ private void addStaticField(ClassGenerator classGen, String type, String name) { final FieldGen fgen = new FieldGen(ACC_PROTECTED|ACC_STATIC, Util.getJCRefType(type), name, classGen.getConstantPool()); classGen.addField(fgen.getField()); }
Example #22
Source File: Expression.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Redefined by expressions of type boolean that use flow lists. */ public void translateDesynthesized(ClassGenerator classGen, MethodGenerator methodGen) { translate(classGen, methodGen); if (_type instanceof BooleanType) { desynthesize(classGen, methodGen); } }
Example #23
Source File: If.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Translate the "test" expression and contents of this element. * The contents will be ignored if we know the test will always fail. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final InstructionList il = methodGen.getInstructionList(); _test.translateDesynthesized(classGen, methodGen); // remember end of condition final InstructionHandle truec = il.getEnd(); if (!_ignore) { translateContents(classGen, methodGen); } _test.backPatchFalseList(il.append(NOP)); _test.backPatchTrueList(truec.getNext()); }
Example #24
Source File: GenerateIdCall.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final InstructionList il = methodGen.getInstructionList(); if (argumentCount() == 0) { il.append(methodGen.loadContextNode()); } else { // one argument argument().translate(classGen, methodGen); } final ConstantPoolGen cpg = classGen.getConstantPool(); il.append(new INVOKESTATIC(cpg.addMethodref(BASIS_LIBRARY_CLASS, "generate_idF", // reuse signature GET_NODE_NAME_SIG))); }
Example #25
Source File: Mode.java From JDKSourceCode1.8 with MIT License | 5 votes |
public static void compileGetChildren(ClassGenerator classGen, MethodGenerator methodGen, int node) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); final int git = cpg.addInterfaceMethodref(DOM_INTF, GET_CHILDREN, GET_CHILDREN_SIG); il.append(methodGen.loadDOM()); il.append(new ILOAD(node)); il.append(new INVOKEINTERFACE(git, 2)); }
Example #26
Source File: BooleanCall.java From Bytecoder with Apache License 2.0 | 5 votes |
public void translate(ClassGenerator classGen, MethodGenerator methodGen) { _arg.translate(classGen, methodGen); final Type targ = _arg.getType(); if (!targ.identicalTo(Type.Boolean)) { _arg.startIterator(classGen, methodGen); targ.translateTo(classGen, methodGen, Type.Boolean); } }
Example #27
Source File: CastCall.java From JDKSourceCode1.8 with MIT License | 5 votes |
public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); _right.translate(classGen, methodGen); il.append(new CHECKCAST(cpg.addClass(_className))); }
Example #28
Source File: Sort.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public void translateCaseOrder(ClassGenerator classGen, MethodGenerator methodGen) { _caseOrder.translate(classGen, methodGen); }
Example #29
Source File: LogicalExpr.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** * Compile the expression - leave boolean expression on stack */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { translateDesynthesized(classGen, methodGen); synthesize(classGen, methodGen); }
Example #30
Source File: Instruction.java From JDKSourceCode1.8 with MIT License | 4 votes |
/** * Translate this node into JVM bytecodes. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { ErrorMsg msg = new ErrorMsg(ErrorMsg.NOT_IMPLEMENTED_ERR, getClass(), this); getParser().reportError(FATAL, msg); }