Java Code Examples for proguard.classfile.instruction.InstructionConstants#OP_ICONST_0

The following examples show how to use proguard.classfile.instruction.InstructionConstants#OP_ICONST_0 . 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: EvaluationShrinker.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the opcode of a push instruction corresponding to the given
 * computational type.
 * @param computationalType the computational type to be pushed on the stack.
 */
private byte pushOpcode(int computationalType)
{
    switch (computationalType)
    {
        case Value.TYPE_INTEGER:            return InstructionConstants.OP_ICONST_0;
        case Value.TYPE_LONG:               return InstructionConstants.OP_LCONST_0;
        case Value.TYPE_FLOAT:              return InstructionConstants.OP_FCONST_0;
        case Value.TYPE_DOUBLE:             return InstructionConstants.OP_DCONST_0;
        case Value.TYPE_REFERENCE:
        case Value.TYPE_INSTRUCTION_OFFSET: return InstructionConstants.OP_ACONST_NULL;
    }

    throw new IllegalArgumentException("No push opcode for computational type ["+computationalType+"]");
}
 
Example 2
Source File: DuplicateInitializerInvocationFixer.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
public void visitConstantInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction)
{
    if (constantInstruction.opcode == InstructionConstants.OP_INVOKESPECIAL)
    {
        hasBeenFixed = false;
        clazz.constantPoolEntryAccept(constantInstruction.constantIndex, this);

        if (hasBeenFixed)
        {
            Instruction extraInstruction =
                new SimpleInstruction(InstructionConstants.OP_ICONST_0);

            codeAttributeEditor.insertBeforeInstruction(offset,
                                                        extraInstruction);

            if (DEBUG)
            {
                System.out.println("  ["+clazz.getName()+"."+method.getName(clazz)+method.getDescriptor(clazz)+"] Inserting "+extraInstruction.toString()+" before "+constantInstruction.toString(offset));
            }

            if (extraAddedInstructionVisitor != null)
            {
                extraInstruction.accept(null, null, null, offset, extraAddedInstructionVisitor);
            }
        }
    }
}