Java Code Examples for com.sun.org.apache.bcel.internal.generic.INVOKESTATIC

The following examples show how to use com.sun.org.apache.bcel.internal.generic.INVOKESTATIC. These examples are extracted from open source projects. 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 Project: JDKSourceCode1.8   Author: wupeixuan   File: ReferenceType.java    License: MIT License 6 votes vote down vote up
/**
 * Translates reference into object of internal type <code>type</code>.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        StringType type) {
    final int current = methodGen.getLocalIndex("current");
    ConstantPoolGen cpg = classGen.getConstantPool();
    InstructionList il = methodGen.getInstructionList();

    // If no current, conversion is a top-level
    if (current < 0) {
        il.append(new PUSH(cpg, DTM.ROOT_NODE));  // push root node
    }
    else {
        il.append(new ILOAD(current));
    }
    il.append(methodGen.loadDOM());
    final int stringF = cpg.addMethodref(BASIS_LIBRARY_CLASS,
                                         "stringF",
                                         "("
                                         + OBJECT_SIG
                                         + NODE_SIG
                                         + DOM_INTF_SIG
                                         + ")" + STRING_SIG);
    il.append(new INVOKESTATIC(stringF));
}
 
Example #2
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: UnsupportedElement.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Translate the fallback element (if any).
 */
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    if (_fallbacks != null) {
        int count = _fallbacks.size();
        for (int i = 0; i < count; i++) {
            Fallback fallback = (Fallback)_fallbacks.elementAt(i);
            fallback.translate(classGen, methodGen);
        }
    }
    // We only go into the else block in forward-compatibility mode, when
    // the unsupported element has no fallback.
    else {
        // If the unsupported element does not have any fallback child, then
        // at runtime, a runtime error should be raised when the unsupported
        // element is instantiated. Otherwise, no error is thrown.
        ConstantPoolGen cpg = classGen.getConstantPool();
        InstructionList il = methodGen.getInstructionList();

        final int unsupportedElem = cpg.addMethodref(BASIS_LIBRARY_CLASS, "unsupported_ElementF",
                                                     "(" + STRING_SIG + "Z)V");
        il.append(new PUSH(cpg, getQName().toString()));
        il.append(new PUSH(cpg, _isExtension));
        il.append(new INVOKESTATIC(unsupportedElem));
    }
}
 
Example #3
Source Project: jdk1.8-source-analysis   Author: raysonfang   File: UnsupportedElement.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Translate the fallback element (if any).
 */
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    if (_fallbacks != null) {
        int count = _fallbacks.size();
        for (int i = 0; i < count; i++) {
            Fallback fallback = (Fallback)_fallbacks.elementAt(i);
            fallback.translate(classGen, methodGen);
        }
    }
    // We only go into the else block in forward-compatibility mode, when
    // the unsupported element has no fallback.
    else {
        // If the unsupported element does not have any fallback child, then
        // at runtime, a runtime error should be raised when the unsupported
        // element is instantiated. Otherwise, no error is thrown.
        ConstantPoolGen cpg = classGen.getConstantPool();
        InstructionList il = methodGen.getInstructionList();

        final int unsupportedElem = cpg.addMethodref(BASIS_LIBRARY_CLASS, "unsupported_ElementF",
                                                     "(" + STRING_SIG + "Z)V");
        il.append(new PUSH(cpg, getQName().toString()));
        il.append(new PUSH(cpg, _isExtension));
        il.append(new INVOKESTATIC(unsupportedElem));
    }
}
 
Example #4
Source Project: jdk1.8-source-analysis   Author: raysonfang   File: ReferenceType.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Translates reference into object of internal type <code>type</code>.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        StringType type) {
    final int current = methodGen.getLocalIndex("current");
    ConstantPoolGen cpg = classGen.getConstantPool();
    InstructionList il = methodGen.getInstructionList();

    // If no current, conversion is a top-level
    if (current < 0) {
        il.append(new PUSH(cpg, DTM.ROOT_NODE));  // push root node
    }
    else {
        il.append(new ILOAD(current));
    }
    il.append(methodGen.loadDOM());
    final int stringF = cpg.addMethodref(BASIS_LIBRARY_CLASS,
                                         "stringF",
                                         "("
                                         + OBJECT_SIG
                                         + NODE_SIG
                                         + DOM_INTF_SIG
                                         + ")" + STRING_SIG);
    il.append(new INVOKESTATIC(stringF));
}
 
Example #5
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: ReferenceType.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Translates reference into object of internal type <code>type</code>.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        StringType type) {
    final int current = methodGen.getLocalIndex("current");
    ConstantPoolGen cpg = classGen.getConstantPool();
    InstructionList il = methodGen.getInstructionList();

    // If no current, conversion is a top-level
    if (current < 0) {
        il.append(new PUSH(cpg, DTM.ROOT_NODE));  // push root node
    }
    else {
        il.append(new ILOAD(current));
    }
    il.append(methodGen.loadDOM());
    final int stringF = cpg.addMethodref(BASIS_LIBRARY_CLASS,
                                         "stringF",
                                         "("
                                         + OBJECT_SIG
                                         + NODE_SIG
                                         + DOM_INTF_SIG
                                         + ")" + STRING_SIG);
    il.append(new INVOKESTATIC(stringF));
}
 
Example #6
Source Project: jdk1.8-source-analysis   Author: raysonfang   File: ReferenceType.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Casts a reference into a NodeIterator.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        NodeSetType type) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();
    int index = cpg.addMethodref(BASIS_LIBRARY_CLASS, "referenceToNodeSet",
                                 "("
                                 + OBJECT_SIG
                                 + ")"
                                 + NODE_ITERATOR_SIG);
    il.append(new INVOKESTATIC(index));

    // Reset this iterator
    index = cpg.addInterfaceMethodref(NODE_ITERATOR, RESET, RESET_SIG);
    il.append(new INVOKEINTERFACE(index, 1));
}
 
Example #7
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: LangCall.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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();

    final int tst = cpg.addMethodref(BASIS_LIBRARY_CLASS,
                                     "testLanguage",
                                     "("+STRING_SIG+DOM_INTF_SIG+"I)Z");
    _lang.translate(classGen,methodGen);
    il.append(methodGen.loadDOM());
    if (classGen instanceof FilterGenerator)
        il.append(new ILOAD(1));
    else
        il.append(methodGen.loadContextNode());
    il.append(new INVOKESTATIC(tst));
}
 
Example #8
Source Project: JDKSourceCode1.8   Author: wupeixuan   File: UnsupportedElement.java    License: MIT License 6 votes vote down vote up
/**
 * Translate the fallback element (if any).
 */
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    if (_fallbacks != null) {
        int count = _fallbacks.size();
        for (int i = 0; i < count; i++) {
            Fallback fallback = (Fallback)_fallbacks.elementAt(i);
            fallback.translate(classGen, methodGen);
        }
    }
    // We only go into the else block in forward-compatibility mode, when
    // the unsupported element has no fallback.
    else {
        // If the unsupported element does not have any fallback child, then
        // at runtime, a runtime error should be raised when the unsupported
        // element is instantiated. Otherwise, no error is thrown.
        ConstantPoolGen cpg = classGen.getConstantPool();
        InstructionList il = methodGen.getInstructionList();

        final int unsupportedElem = cpg.addMethodref(BASIS_LIBRARY_CLASS, "unsupported_ElementF",
                                                     "(" + STRING_SIG + "Z)V");
        il.append(new PUSH(cpg, getQName().toString()));
        il.append(new PUSH(cpg, _isExtension));
        il.append(new INVOKESTATIC(unsupportedElem));
    }
}
 
Example #9
Source Project: TencentKona-8   Author: Tencent   File: UnsupportedElement.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Translate the fallback element (if any).
 */
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    if (_fallbacks != null) {
        int count = _fallbacks.size();
        for (int i = 0; i < count; i++) {
            Fallback fallback = (Fallback)_fallbacks.elementAt(i);
            fallback.translate(classGen, methodGen);
        }
    }
    // We only go into the else block in forward-compatibility mode, when
    // the unsupported element has no fallback.
    else {
        // If the unsupported element does not have any fallback child, then
        // at runtime, a runtime error should be raised when the unsupported
        // element is instantiated. Otherwise, no error is thrown.
        ConstantPoolGen cpg = classGen.getConstantPool();
        InstructionList il = methodGen.getInstructionList();

        final int unsupportedElem = cpg.addMethodref(BASIS_LIBRARY_CLASS, "unsupported_ElementF",
                                                     "(" + STRING_SIG + "Z)V");
        il.append(new PUSH(cpg, getQName().toString()));
        il.append(new PUSH(cpg, _isExtension));
        il.append(new INVOKESTATIC(unsupportedElem));
    }
}
 
Example #10
Source Project: TencentKona-8   Author: Tencent   File: LangCall.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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();

    final int tst = cpg.addMethodref(BASIS_LIBRARY_CLASS,
                                     "testLanguage",
                                     "("+STRING_SIG+DOM_INTF_SIG+"I)Z");
    _lang.translate(classGen,methodGen);
    il.append(methodGen.loadDOM());
    if (classGen instanceof FilterGenerator)
        il.append(new ILOAD(1));
    else
        il.append(methodGen.loadContextNode());
    il.append(new INVOKESTATIC(tst));
}
 
Example #11
Source Project: TencentKona-8   Author: Tencent   File: ReferenceType.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Translates reference into object of internal type <code>type</code>.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        StringType type) {
    final int current = methodGen.getLocalIndex("current");
    ConstantPoolGen cpg = classGen.getConstantPool();
    InstructionList il = methodGen.getInstructionList();

    // If no current, conversion is a top-level
    if (current < 0) {
        il.append(new PUSH(cpg, DTM.ROOT_NODE));  // push root node
    }
    else {
        il.append(new ILOAD(current));
    }
    il.append(methodGen.loadDOM());
    final int stringF = cpg.addMethodref(BASIS_LIBRARY_CLASS,
                                         "stringF",
                                         "("
                                         + OBJECT_SIG
                                         + NODE_SIG
                                         + DOM_INTF_SIG
                                         + ")" + STRING_SIG);
    il.append(new INVOKESTATIC(stringF));
}
 
Example #12
Source Project: JDKSourceCode1.8   Author: wupeixuan   File: ReferenceType.java    License: MIT License 6 votes vote down vote up
/**
 * Casts a reference into a NodeIterator.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        NodeSetType type) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();
    int index = cpg.addMethodref(BASIS_LIBRARY_CLASS, "referenceToNodeSet",
                                 "("
                                 + OBJECT_SIG
                                 + ")"
                                 + NODE_ITERATOR_SIG);
    il.append(new INVOKESTATIC(index));

    // Reset this iterator
    index = cpg.addInterfaceMethodref(NODE_ITERATOR, RESET, RESET_SIG);
    il.append(new INVOKEINTERFACE(index, 1));
}
 
Example #13
Source Project: jdk8u60   Author: chenghanpeng   File: LocalNameCall.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 #14
Source Project: jdk8u60   Author: chenghanpeng   File: UnsupportedElement.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Translate the fallback element (if any).
 */
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    if (_fallbacks != null) {
        int count = _fallbacks.size();
        for (int i = 0; i < count; i++) {
            Fallback fallback = (Fallback)_fallbacks.elementAt(i);
            fallback.translate(classGen, methodGen);
        }
    }
    // We only go into the else block in forward-compatibility mode, when
    // the unsupported element has no fallback.
    else {
        // If the unsupported element does not have any fallback child, then
        // at runtime, a runtime error should be raised when the unsupported
        // element is instantiated. Otherwise, no error is thrown.
        ConstantPoolGen cpg = classGen.getConstantPool();
        InstructionList il = methodGen.getInstructionList();

        final int unsupportedElem = cpg.addMethodref(BASIS_LIBRARY_CLASS, "unsupported_ElementF",
                                                     "(" + STRING_SIG + "Z)V");
        il.append(new PUSH(cpg, getQName().toString()));
        il.append(new PUSH(cpg, _isExtension));
        il.append(new INVOKESTATIC(unsupportedElem));
    }
}
 
Example #15
Source Project: jdk8u60   Author: chenghanpeng   File: LangCall.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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();

    final int tst = cpg.addMethodref(BASIS_LIBRARY_CLASS,
                                     "testLanguage",
                                     "("+STRING_SIG+DOM_INTF_SIG+"I)Z");
    _lang.translate(classGen,methodGen);
    il.append(methodGen.loadDOM());
    if (classGen instanceof FilterGenerator)
        il.append(new ILOAD(1));
    else
        il.append(methodGen.loadContextNode());
    il.append(new INVOKESTATIC(tst));
}
 
Example #16
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: ReferenceType.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Casts a reference into a NodeIterator.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        NodeSetType type) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();
    int index = cpg.addMethodref(BASIS_LIBRARY_CLASS, "referenceToNodeSet",
                                 "("
                                 + OBJECT_SIG
                                 + ")"
                                 + NODE_ITERATOR_SIG);
    il.append(new INVOKESTATIC(index));

    // Reset this iterator
    index = cpg.addInterfaceMethodref(NODE_ITERATOR, RESET, RESET_SIG);
    il.append(new INVOKEINTERFACE(index, 1));
}
 
Example #17
Source Project: jdk8u60   Author: chenghanpeng   File: ReferenceType.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Translates reference into object of internal type <code>type</code>.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        StringType type) {
    final int current = methodGen.getLocalIndex("current");
    ConstantPoolGen cpg = classGen.getConstantPool();
    InstructionList il = methodGen.getInstructionList();

    // If no current, conversion is a top-level
    if (current < 0) {
        il.append(new PUSH(cpg, DTM.ROOT_NODE));  // push root node
    }
    else {
        il.append(new ILOAD(current));
    }
    il.append(methodGen.loadDOM());
    final int stringF = cpg.addMethodref(BASIS_LIBRARY_CLASS,
                                         "stringF",
                                         "("
                                         + OBJECT_SIG
                                         + NODE_SIG
                                         + DOM_INTF_SIG
                                         + ")" + STRING_SIG);
    il.append(new INVOKESTATIC(stringF));
}
 
Example #18
Source Project: jdk1.8-source-analysis   Author: raysonfang   File: NameBase.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 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 #19
Source Project: jdk1.8-source-analysis   Author: raysonfang   File: RelationalExpr.java    License: Apache License 2.0 5 votes vote down vote up
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    if (hasNodeSetArgs() || hasReferenceArgs()) {
        final ConstantPoolGen cpg = classGen.getConstantPool();
        final InstructionList il = methodGen.getInstructionList();

        // Call compare() from the BasisLibrary
        _left.translate(classGen, methodGen);
        _left.startIterator(classGen, methodGen);
        _right.translate(classGen, methodGen);
        _right.startIterator(classGen, methodGen);

        il.append(new PUSH(cpg, _op));
        il.append(methodGen.loadDOM());

        int index = cpg.addMethodref(BASIS_LIBRARY_CLASS, "compare",
                                     "("
                                     + _left.getType().toSignature()
                                     + _right.getType().toSignature()
                                     + "I"
                                     + DOM_INTF_SIG
                                     + ")Z");
        il.append(new INVOKESTATIC(index));
    }
    else {
        translateDesynthesized(classGen, methodGen);
        synthesize(classGen, methodGen);
    }
}
 
Example #20
Source Project: JDKSourceCode1.8   Author: wupeixuan   File: ReferenceType.java    License: MIT License 5 votes vote down vote up
/**
 * Translates a reference to an object of internal type <code>type</code>.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        BooleanType type) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    int index = cpg.addMethodref(BASIS_LIBRARY_CLASS, "booleanF",
                                 "("
                                 + OBJECT_SIG
                                 + ")Z");
    il.append(new INVOKESTATIC(index));
}
 
Example #21
Source Project: jdk1.8-source-analysis   Author: raysonfang   File: RoundCall.java    License: Apache License 2.0 5 votes vote down vote up
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 #22
Source Project: jdk1.8-source-analysis   Author: raysonfang   File: CeilingCall.java    License: Apache License 2.0 5 votes vote down vote up
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();
    argument(0).translate(classGen, methodGen);
    il.append(new INVOKESTATIC(cpg.addMethodref(MATH_CLASS,
                                                "ceil", "(D)D")));
}
 
Example #23
Source Project: jdk8u60   Author: chenghanpeng   File: FloorCall.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    argument().translate(classGen, methodGen);
    methodGen.getInstructionList()
        .append(new INVOKESTATIC(classGen.getConstantPool()
                                 .addMethodref(MATH_CLASS,
                                               "floor", "(D)D")));
}
 
Example #24
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: CeilingCall.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();
    argument(0).translate(classGen, methodGen);
    il.append(new INVOKESTATIC(cpg.addMethodref(MATH_CLASS,
                                                "ceil", "(D)D")));
}
 
Example #25
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: ReferenceType.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Translates a reference to an object of internal type <code>type</code>.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        BooleanType type) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    int index = cpg.addMethodref(BASIS_LIBRARY_CLASS, "booleanF",
                                 "("
                                 + OBJECT_SIG
                                 + ")Z");
    il.append(new INVOKESTATIC(index));
}
 
Example #26
Source Project: jdk1.8-source-analysis   Author: raysonfang   File: IntType.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Expects an integer on the stack and pushes its string value by calling
 * <code>Integer.toString(int i)</code>.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        StringType type) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();
    il.append(new INVOKESTATIC(cpg.addMethodref(INTEGER_CLASS,
                                                "toString",
                                                "(I)" + STRING_SIG)));
}
 
Example #27
Source Project: JDKSourceCode1.8   Author: wupeixuan   File: RoundCall.java    License: MIT License 5 votes vote down vote up
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 #28
Source Project: jdk1.8-source-analysis   Author: raysonfang   File: RealType.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Expects a real on the stack and pushes a truncated integer value
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        IntType type) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();
    il.append(new INVOKESTATIC(cpg.addMethodref(BASIS_LIBRARY_CLASS,
                                                "realToInt","(D)I")));
}
 
Example #29
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: StringType.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Translates a string into a real by calling stringToReal() from the
 * basis library.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        RealType type) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();
    il.append(new INVOKESTATIC(cpg.addMethodref(BASIS_LIBRARY_CLASS,
                                                STRING_TO_REAL,
                                                STRING_TO_REAL_SIG)));
}
 
Example #30
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: FloorCall.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    argument().translate(classGen, methodGen);
    methodGen.getInstructionList()
        .append(new INVOKESTATIC(classGen.getConstantPool()
                                 .addMethodref(MATH_CLASS,
                                               "floor", "(D)D")));
}