com.sun.org.apache.bcel.internal.generic.CHECKCAST Java Examples

The following examples show how to use com.sun.org.apache.bcel.internal.generic.CHECKCAST. 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: Predicate.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * Translate a predicate expression. If non of the optimizations apply
 * then this translation pushes two references on the stack: a reference
 * to a newly created filter object and a reference to the predicate's
 * closure. See class <code>Step</code> for further details.
 */
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {

    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    if (_nthPositionFilter || _nthDescendant) {
        _exp.translate(classGen, methodGen);
    }
    else if (isNodeValueTest() && (getParent() instanceof Step)) {
        _value.translate(classGen, methodGen);
        il.append(new CHECKCAST(cpg.addClass(STRING_CLASS)));
        il.append(new PUSH(cpg, ((EqualityExpr)_exp).getOp()));
    }
    else {
        translateFilter(classGen, methodGen);
    }
}
 
Example #2
Source File: Predicate.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Translate a predicate expression. If non of the optimizations apply
 * then this translation pushes two references on the stack: a reference
 * to a newly created filter object and a reference to the predicate's
 * closure. See class <code>Step</code> for further details.
 */
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {

    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    if (_nthPositionFilter || _nthDescendant) {
        _exp.translate(classGen, methodGen);
    }
    else if (isNodeValueTest() && (getParent() instanceof Step)) {
        _value.translate(classGen, methodGen);
        il.append(new CHECKCAST(cpg.addClass(STRING_CLASS)));
        il.append(new PUSH(cpg, ((EqualityExpr)_exp).getOp()));
    }
    else {
        translateFilter(classGen, methodGen);
    }
}
 
Example #3
Source File: VariableBase.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * 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: WithParam.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * 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 = null;
     }
 }
 
Example #5
Source File: Predicate.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * Translate a predicate expression. If non of the optimizations apply
 * then this translation pushes two references on the stack: a reference
 * to a newly created filter object and a reference to the predicate's
 * closure. See class <code>Step</code> for further details.
 */
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {

    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    if (_nthPositionFilter || _nthDescendant) {
        _exp.translate(classGen, methodGen);
    }
    else if (isNodeValueTest() && (getParent() instanceof Step)) {
        _value.translate(classGen, methodGen);
        il.append(new CHECKCAST(cpg.addClass(STRING_CLASS)));
        il.append(new PUSH(cpg, ((EqualityExpr)_exp).getOp()));
    }
    else {
        translateFilter(classGen, methodGen);
    }
}
 
Example #6
Source File: Predicate.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Translate a predicate expression. If non of the optimizations apply
 * then this translation pushes two references on the stack: a reference
 * to a newly created filter object and a reference to the predicate's
 * closure. See class <code>Step</code> for further details.
 */
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {

    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    if (_nthPositionFilter || _nthDescendant) {
        _exp.translate(classGen, methodGen);
    }
    else if (isNodeValueTest() && (getParent() instanceof Step)) {
        _value.translate(classGen, methodGen);
        il.append(new CHECKCAST(cpg.addClass(STRING_CLASS)));
        il.append(new PUSH(cpg, ((EqualityExpr)_exp).getOp()));
    }
    else {
        translateFilter(classGen, methodGen);
    }
}
 
Example #7
Source File: VariableBase.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 #8
Source File: Predicate.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Translate a predicate expression. If non of the optimizations apply
 * then this translation pushes two references on the stack: a reference
 * to a newly created filter object and a reference to the predicate's
 * closure. See class <code>Step</code> for further details.
 */
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {

    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    if (_nthPositionFilter || _nthDescendant) {
        _exp.translate(classGen, methodGen);
    }
    else if (isNodeValueTest() && (getParent() instanceof Step)) {
        _value.translate(classGen, methodGen);
        il.append(new CHECKCAST(cpg.addClass(STRING_CLASS)));
        il.append(new PUSH(cpg, ((EqualityExpr)_exp).getOp()));
    }
    else {
        translateFilter(classGen, methodGen);
    }
}
 
Example #9
Source File: VariableBase.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 #10
Source File: VariableBase.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * 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 #11
Source File: Predicate.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Translate a predicate expression. If non of the optimizations apply
 * then this translation pushes two references on the stack: a reference
 * to a newly created filter object and a reference to the predicate's
 * closure. See class <code>Step</code> for further details.
 */
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {

    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    if (_nthPositionFilter || _nthDescendant) {
        _exp.translate(classGen, methodGen);
    }
    else if (isNodeValueTest() && (getParent() instanceof Step)) {
        _value.translate(classGen, methodGen);
        il.append(new CHECKCAST(cpg.addClass(STRING_CLASS)));
        il.append(new PUSH(cpg, ((EqualityExpr)_exp).getOp()));
    }
    else {
        translateFilter(classGen, methodGen);
    }
}
 
Example #12
Source File: BooleanType.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Translates an object of this type to its unboxed representation.
 */
public void translateUnBox(ClassGenerator classGen,
                           MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();
    il.append(new CHECKCAST(cpg.addClass(BOOLEAN_CLASS)));
    il.append(new INVOKEVIRTUAL(cpg.addMethodref(BOOLEAN_CLASS,
                                                 BOOLEAN_VALUE,
                                                 BOOLEAN_VALUE_SIG)));
}
 
Example #13
Source File: CastCall.java    From openjdk-jdk8u-backup with 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();

    _right.translate(classGen, methodGen);
    il.append(new CHECKCAST(cpg.addClass(_className)));
}
 
Example #14
Source File: NodeType.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Translates an object of this type to its unboxed representation.
 */
public void translateUnBox(ClassGenerator classGen,
                           MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();
    il.append(new CHECKCAST(cpg.addClass(RUNTIME_NODE_CLASS)));
    il.append(new GETFIELD(cpg.addFieldref(RUNTIME_NODE_CLASS,
                                           NODE_FIELD,
                                           NODE_FIELD_SIG)));
}
 
Example #15
Source File: BooleanType.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Translates an object of this type to its unboxed representation.
 */
public void translateUnBox(ClassGenerator classGen,
                           MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();
    il.append(new CHECKCAST(cpg.addClass(BOOLEAN_CLASS)));
    il.append(new INVOKEVIRTUAL(cpg.addMethodref(BOOLEAN_CLASS,
                                                 BOOLEAN_VALUE,
                                                 BOOLEAN_VALUE_SIG)));
}
 
Example #16
Source File: RealType.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Translates an object of this type to its unboxed representation.
 */
public void translateUnBox(ClassGenerator classGen,
                           MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();
    il.append(new CHECKCAST(cpg.addClass(DOUBLE_CLASS)));
    il.append(new INVOKEVIRTUAL(cpg.addMethodref(DOUBLE_CLASS,
                                                 DOUBLE_VALUE,
                                                 DOUBLE_VALUE_SIG)));
}
 
Example #17
Source File: RealType.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Translates an object of this type to its unboxed representation.
 */
public void translateUnBox(ClassGenerator classGen,
                           MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();
    il.append(new CHECKCAST(cpg.addClass(DOUBLE_CLASS)));
    il.append(new INVOKEVIRTUAL(cpg.addMethodref(DOUBLE_CLASS,
                                                 DOUBLE_VALUE,
                                                 DOUBLE_VALUE_SIG)));
}
 
Example #18
Source File: RealType.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Translates an object of this type to its unboxed representation.
 */
public void translateUnBox(ClassGenerator classGen,
                           MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();
    il.append(new CHECKCAST(cpg.addClass(DOUBLE_CLASS)));
    il.append(new INVOKEVIRTUAL(cpg.addMethodref(DOUBLE_CLASS,
                                                 DOUBLE_VALUE,
                                                 DOUBLE_VALUE_SIG)));
}
 
Example #19
Source File: WithParam.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 #20
Source File: IntType.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Translates an object of this type to its unboxed representation.
 */
public void translateUnBox(ClassGenerator classGen,
                           MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();
    il.append(new CHECKCAST(cpg.addClass(INTEGER_CLASS)));
    final int index = cpg.addMethodref(INTEGER_CLASS,
                                       INT_VALUE,
                                       INT_VALUE_SIG);
    il.append(new INVOKEVIRTUAL(index));
}
 
Example #21
Source File: CastCall.java    From openjdk-jdk8u with 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();

    _right.translate(classGen, methodGen);
    il.append(new CHECKCAST(cpg.addClass(_className)));
}
 
Example #22
Source File: RealType.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Translates an object of this type to its unboxed representation.
 */
public void translateUnBox(ClassGenerator classGen,
                           MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();
    il.append(new CHECKCAST(cpg.addClass(DOUBLE_CLASS)));
    il.append(new INVOKEVIRTUAL(cpg.addMethodref(DOUBLE_CLASS,
                                                 DOUBLE_VALUE,
                                                 DOUBLE_VALUE_SIG)));
}
 
Example #23
Source File: WithParam.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * 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 #24
Source File: CastCall.java    From jdk1.8-source-analysis with 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();

    _right.translate(classGen, methodGen);
    il.append(new CHECKCAST(cpg.addClass(_className)));
}
 
Example #25
Source File: WithParam.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * 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 #26
Source File: NodeType.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Translates an object of this type to its unboxed representation.
 */
public void translateUnBox(ClassGenerator classGen,
                           MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();
    il.append(new CHECKCAST(cpg.addClass(RUNTIME_NODE_CLASS)));
    il.append(new GETFIELD(cpg.addFieldref(RUNTIME_NODE_CLASS,
                                           NODE_FIELD,
                                           NODE_FIELD_SIG)));
}
 
Example #27
Source File: BooleanType.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Translates an object of this type to its unboxed representation.
 */
public void translateUnBox(ClassGenerator classGen,
                           MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();
    il.append(new CHECKCAST(cpg.addClass(BOOLEAN_CLASS)));
    il.append(new INVOKEVIRTUAL(cpg.addMethodref(BOOLEAN_CLASS,
                                                 BOOLEAN_VALUE,
                                                 BOOLEAN_VALUE_SIG)));
}
 
Example #28
Source File: WithParam.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 #29
Source File: IntType.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Translates an object of this type to its unboxed representation.
 */
public void translateUnBox(ClassGenerator classGen,
                           MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();
    il.append(new CHECKCAST(cpg.addClass(INTEGER_CLASS)));
    final int index = cpg.addMethodref(INTEGER_CLASS,
                                       INT_VALUE,
                                       INT_VALUE_SIG);
    il.append(new INVOKEVIRTUAL(index));
}
 
Example #30
Source File: IntType.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Translates an object of this type to its unboxed representation.
 */
public void translateUnBox(ClassGenerator classGen,
                           MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();
    il.append(new CHECKCAST(cpg.addClass(INTEGER_CLASS)));
    final int index = cpg.addMethodref(INTEGER_CLASS,
                                       INT_VALUE,
                                       INT_VALUE_SIG);
    il.append(new INVOKEVIRTUAL(index));
}