Package org.apache.bcel.generic

Examples of org.apache.bcel.generic.ACONST_NULL


                    type = Type.INT;
                }
                insList.append(insFactory.createInvoke(STACK_CLASS, getPopMethod(type), type, Type.NO_ARGS, Constants.INVOKEVIRTUAL));
                insList.append(InstructionFactory.createStore(type, i));
            } else if (type == null) {
                insList.append(new ACONST_NULL());
                insList.append(InstructionFactory.createStore(new ObjectType("<null object>"), i));
            } else if (type instanceof UninitializedObjectType) {
                // No uninitilaized objects should be found
                // in the local variables.
            } else if (type instanceof ReferenceType) {
                insList.append(InstructionFactory.createLoad(STACK_TYPE, method.getMaxLocals()+1));
                insList.append(insFactory.createInvoke(STACK_CLASS, getPopMethod(Type.OBJECT), Type.OBJECT, Type.NO_ARGS, Constants.INVOKEVIRTUAL));
                if (!type.equals(Type.OBJECT) && (!type.equals(Type.NULL))) {
                    insList.append(insFactory.createCast(Type.OBJECT, type));
                }
                insList.append(InstructionFactory.createStore(type, i));
            }
        }

        InvokeInstruction inv = (InvokeInstruction) handle.getInstruction();
        Type returnType = getReturnType(method.getConstantPool().getConstantPool(), inv.getIndex());
        boolean skipFirst = returnType.getSize() > 0;

        // restore stack
        OperandStack os = frame.getStack();
        for (int i = os.size() - 1; i >= (skipFirst ? 1 : 0); i--) {
            Type type = os.peek(i);
            if (type instanceof BasicType) {
                if (type.getSize() < 2 && !type.equals(Type.FLOAT)) {
                    type = Type.INT;
                }
                insList.append(InstructionFactory.createLoad(STACK_TYPE, method.getMaxLocals()+1));
                insList.append(insFactory.createInvoke(STACK_CLASS, getPopMethod(type), type, Type.NO_ARGS, Constants.INVOKEVIRTUAL));
            } else if (type == null) {
                insList.append(new ACONST_NULL());
            } else if (type instanceof UninitializedObjectType) {
                // After the remove of new, there shouldn't be a
                // uninitialized object on the stack
            } else if (type instanceof ReferenceType) {
                insList.append(InstructionFactory.createLoad(STACK_TYPE, method.getMaxLocals()+1));
View Full Code Here


                    type = Type.INT;
                }
                insList.append(insFactory.createInvoke(STACK_CLASS, getPopMethod(type), type, Type.NO_ARGS, Constants.INVOKEVIRTUAL));
                insList.append(InstructionFactory.createStore(type, i));
            } else if (type == null) {
                insList.append(new ACONST_NULL());
                insList.append(InstructionFactory.createStore(new ObjectType("<null object>"), i));
            } else if (type instanceof UninitializedObjectType) {
                // No uninitilaized objects should be found
                // in the local variables.
            } else if (type instanceof ReferenceType) {
                insList.append(InstructionFactory.createLoad(STACK_TYPE, method.getMaxLocals()+1));
                insList.append(insFactory.createInvoke(STACK_CLASS, getPopMethod(Type.OBJECT), Type.OBJECT, Type.NO_ARGS, Constants.INVOKEVIRTUAL));
                if (!type.equals(Type.OBJECT) && (!type.equals(Type.NULL))) {
                    insList.append(insFactory.createCast(Type.OBJECT, type));
                }
                insList.append(InstructionFactory.createStore(type, i));
            }
        }

        InvokeInstruction inv = (InvokeInstruction) handle.getInstruction();
        Type returnType = getReturnType(method.getConstantPool().getConstantPool(), inv.getIndex());
        boolean skipFirst = returnType.getSize() > 0;

        // restore stack
        OperandStack os = frame.getStack();
        for (int i = os.size() - 1; i >= (skipFirst ? 1 : 0); i--) {
            Type type = os.peek(i);
            if (type instanceof BasicType) {
                if (type.getSize() < 2 && !type.equals(Type.FLOAT)) {
                    type = Type.INT;
                }
                insList.append(InstructionFactory.createLoad(STACK_TYPE, method.getMaxLocals()+1));
                insList.append(insFactory.createInvoke(STACK_CLASS, getPopMethod(type), type, Type.NO_ARGS, Constants.INVOKEVIRTUAL));
            } else if (type == null) {
                insList.append(new ACONST_NULL());
            } else if (type instanceof UninitializedObjectType) {
                // After the remove of new, there shouldn't be a
                // uninitialized object on the stack
            } else if (type instanceof ReferenceType) {
                insList.append(InstructionFactory.createLoad(STACK_TYPE, method.getMaxLocals()+1));
View Full Code Here

  @SuppressWarnings("unused")
  // Called using reflection
  private Instruction createInstructionAconst_null(Element inst) throws IllegalXMLVMException
  {
    return new ACONST_NULL();
  }
View Full Code Here

TOP

Related Classes of org.apache.bcel.generic.ACONST_NULL

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.