本文整理汇总了Java中proguard.classfile.instruction.InstructionConstants.OP_IRETURN属性的典型用法代码示例。如果您正苦于以下问题:Java InstructionConstants.OP_IRETURN属性的具体用法?Java InstructionConstants.OP_IRETURN怎么用?Java InstructionConstants.OP_IRETURN使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类proguard.classfile.instruction.InstructionConstants
的用法示例。
在下文中一共展示了InstructionConstants.OP_IRETURN属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitSimpleInstruction
public void visitSimpleInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, SimpleInstruction simpleInstruction)
{
// Mark the instruction.
instructionMarks[offset] |= INSTRUCTION;
// Check if this is the first instruction of a subroutine.
checkSubroutine(offset);
byte opcode = simpleInstruction.opcode;
if (opcode == InstructionConstants.OP_IRETURN ||
opcode == InstructionConstants.OP_LRETURN ||
opcode == InstructionConstants.OP_FRETURN ||
opcode == InstructionConstants.OP_DRETURN ||
opcode == InstructionConstants.OP_ARETURN ||
opcode == InstructionConstants.OP_ATHROW)
{
// Mark the branch origin.
markBranchOrigin(offset);
// Mark the next instruction.
markAfterBranchOrigin(offset + simpleInstruction.length(offset));
}
}
示例2: visitSimpleInstruction
public void visitSimpleInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, SimpleInstruction simpleInstruction)
{
byte opcode = simpleInstruction.opcode;
// Some simple instructions exit from the current instruction block.
exitInstructionBlock =
opcode == InstructionConstants.OP_IRETURN ||
opcode == InstructionConstants.OP_LRETURN ||
opcode == InstructionConstants.OP_FRETURN ||
opcode == InstructionConstants.OP_DRETURN ||
opcode == InstructionConstants.OP_ARETURN ||
opcode == InstructionConstants.OP_RETURN ||
opcode == InstructionConstants.OP_ATHROW;
}
示例3: visitSimpleInstruction
public void visitSimpleInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, SimpleInstruction simpleInstruction)
{
byte opcode = simpleInstruction.opcode;
// Check for instructions that might cause side effects.
if (opcode == InstructionConstants.OP_IASTORE ||
opcode == InstructionConstants.OP_LASTORE ||
opcode == InstructionConstants.OP_FASTORE ||
opcode == InstructionConstants.OP_DASTORE ||
opcode == InstructionConstants.OP_AASTORE ||
opcode == InstructionConstants.OP_BASTORE ||
opcode == InstructionConstants.OP_CASTORE ||
opcode == InstructionConstants.OP_SASTORE ||
opcode == InstructionConstants.OP_ATHROW ||
opcode == InstructionConstants.OP_MONITORENTER ||
opcode == InstructionConstants.OP_MONITOREXIT ||
(includeReturnInstructions &&
(opcode == InstructionConstants.OP_IRETURN ||
opcode == InstructionConstants.OP_LRETURN ||
opcode == InstructionConstants.OP_FRETURN ||
opcode == InstructionConstants.OP_DRETURN ||
opcode == InstructionConstants.OP_ARETURN ||
opcode == InstructionConstants.OP_RETURN)))
{
// These instructions always cause a side effect.
hasSideEffects = true;
}
}
示例4: visitSimpleInstruction
public void visitSimpleInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, SimpleInstruction simpleInstruction)
{
byte opcode = simpleInstruction.opcode;
if (opcode == InstructionConstants.OP_IRETURN ||
opcode == InstructionConstants.OP_LRETURN ||
opcode == InstructionConstants.OP_FRETURN ||
opcode == InstructionConstants.OP_DRETURN ||
opcode == InstructionConstants.OP_ARETURN ||
opcode == InstructionConstants.OP_RETURN ||
opcode == InstructionConstants.OP_ATHROW)
{
next = false;
}
}
示例5: visitBranchInstruction
public void visitBranchInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, BranchInstruction branchInstruction)
{
// Check if the instruction is an unconditional goto instruction.
byte opcode = branchInstruction.opcode;
if (opcode == InstructionConstants.OP_GOTO ||
opcode == InstructionConstants.OP_GOTO_W)
{
// Check if the goto instruction points to a return instruction.
int targetOffset = offset + branchInstruction.branchOffset;
if (!codeAttributeEditor.isModified(offset) &&
!codeAttributeEditor.isModified(targetOffset))
{
Instruction targetInstruction = InstructionFactory.create(codeAttribute.code,
targetOffset);
switch (targetInstruction.opcode)
{
case InstructionConstants.OP_IRETURN:
case InstructionConstants.OP_LRETURN:
case InstructionConstants.OP_FRETURN:
case InstructionConstants.OP_DRETURN:
case InstructionConstants.OP_ARETURN:
case InstructionConstants.OP_RETURN:
// Replace the goto instruction by the return instruction.
Instruction returnInstruction =
new SimpleInstruction(targetInstruction.opcode);
codeAttributeEditor.replaceInstruction(offset,
returnInstruction);
// Visit the instruction, if required.
if (extraInstructionVisitor != null)
{
extraInstructionVisitor.visitBranchInstruction(clazz, method, codeAttribute, offset, branchInstruction);
}
break;
}
}
}
}
示例6: visitSimpleInstruction
public void visitSimpleInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, SimpleInstruction simpleInstruction)
{
// Are we inlining this instruction?
if (inlining)
{
// Replace any return instructions by branches to the end of the code.
switch (simpleInstruction.opcode)
{
case InstructionConstants.OP_IRETURN:
case InstructionConstants.OP_LRETURN:
case InstructionConstants.OP_FRETURN:
case InstructionConstants.OP_DRETURN:
case InstructionConstants.OP_ARETURN:
case InstructionConstants.OP_RETURN:
// Are we not at the last instruction?
if (offset < codeAttribute.u4codeLength-1)
{
// Replace the return instruction by a branch instruction.
Instruction branchInstruction =
new BranchInstruction(InstructionConstants.OP_GOTO_W,
codeAttribute.u4codeLength - offset);
codeAttributeComposer.appendInstruction(offset,
branchInstruction.shrink());
}
else
{
// Just leave out the instruction, but put in a label,
// for the sake of any other branch instructions.
codeAttributeComposer.appendLabel(offset);
}
return;
}
}
codeAttributeComposer.appendInstruction(offset, simpleInstruction.shrink());
}
示例7: visitConstantInstruction
public void visitConstantInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction)
{
// Is it a method invocation?
switch (constantInstruction.opcode)
{
case InstructionConstants.OP_INVOKEVIRTUAL:
case InstructionConstants.OP_INVOKESPECIAL:
case InstructionConstants.OP_INVOKESTATIC:
{
// Is it a recursive call?
clazz.constantPoolEntryAccept(constantInstruction.constantIndex, recursionChecker);
if (recursionChecker.isRecursive())
{
// Is the next instruction a return?
int nextOffset =
offset + constantInstruction.length(offset);
Instruction nextInstruction =
InstructionFactory.create(codeAttribute.code, nextOffset);
switch (nextInstruction.opcode)
{
case InstructionConstants.OP_IRETURN:
case InstructionConstants.OP_LRETURN:
case InstructionConstants.OP_FRETURN:
case InstructionConstants.OP_DRETURN:
case InstructionConstants.OP_ARETURN:
case InstructionConstants.OP_RETURN:
{
// Isn't the recursive call inside a try/catch block?
codeAttribute.exceptionsAccept(clazz, method, offset, recursionChecker);
if (recursionChecker.isRecursive())
{
if (DEBUG)
{
System.out.println("TailRecursionSimplifier: ["+
clazz.getName()+"."+method.getName(clazz)+method.getDescriptor(clazz)+"], inlining "+constantInstruction.toString(offset));
}
// Append a label.
codeAttributeComposer.appendLabel(offset);
storeParameters(clazz, method);
// Branch back to the start of the method.
int gotoOffset = offset + 1;
codeAttributeComposer.appendInstruction(gotoOffset,
new BranchInstruction(InstructionConstants.OP_GOTO, -gotoOffset));
// The original return instruction will be
// removed elsewhere, if possible.
// Remember that the code has changed.
inlinedAny = true;
if (extraTailRecursionVisitor != null)
{
extraTailRecursionVisitor.visitConstantInstruction(clazz, method, codeAttribute, offset, constantInstruction);
}
// The invocation itself is no longer necessary.
return;
}
}
}
}
break;
}
}
// Copy the instruction.
codeAttributeComposer.appendInstruction(offset, constantInstruction.shrink());
}