void registerJump(Instruction instr) { if(instr.getOperandCount() == 1 && instr.getOperand(0) instanceof Instruction) { seenLabels.add(instr.getOperand(0)); } }
private static void writeOperandList(final ITextOutput writer, final Instruction instruction) { for (int i = 0, n = instruction.getOperandCount(); i < n; i++) { if (i != 0) { writer.write(", "); } writeOperand(writer, instruction.getOperand(i)); } }
private static void writeOperandList(final ITextOutput writer, final Instruction instruction) { for (int i = 0, n = instruction.getOperandCount(); i < n; i++) { if (i != 0) { writer.write(", "); } writeOperand(writer, instruction.getOperand(i)); } }
private static void writeOperandList(final ITextOutput writer, final Instruction instruction) { for (int i = 0, n = instruction.getOperandCount(); i < n; i++) { if (i != 0) { writer.write(", "); } writeOperand(writer, instruction.getOperand(i)); } }
static void extractCalls(MethodDefinition md, Predicate<MethodReference> action) { MethodBody body = md.getBody(); if(body == null) return; for(Instruction inst : body.getInstructions()) { for(int i=0; i<inst.getOperandCount(); i++) { Object operand = inst.getOperand(i); if(operand instanceof MethodReference) { if(!action.test((MethodReference)operand)) return; } if(operand instanceof DynamicCallSite) { MethodHandle mh = Nodes.getMethodHandle((DynamicCallSite) operand); if(mh != null) { if(!action.test(mh.getMethod())) return; } } } } }
public static Instruction reverseLoadOrStore(final Instruction instruction) { VerifyArgument.notNull(instruction, "instruction"); final OpCode oldCode = instruction.getOpCode(); final OpCode newCode; if (oldCode.isStore()) { newCode = OpCode.valueOf(oldCode.name().replace("STORE", "LOAD")); } else if (oldCode.isLoad()) { newCode = OpCode.valueOf(oldCode.name().replace("LOAD", "STORE")); } else { throw new IllegalArgumentException("Instruction is neither a load nor store: " + instruction.getOpCode()); } if (instruction.getOperandCount() == 1) { return new Instruction(newCode, instruction.getOperand(0)); } return new Instruction(newCode); } }
public static Instruction reverseLoadOrStore(final Instruction instruction) { VerifyArgument.notNull(instruction, "instruction"); final OpCode oldCode = instruction.getOpCode(); final OpCode newCode; if (oldCode.isStore()) { newCode = OpCode.valueOf(oldCode.name().replace("STORE", "LOAD")); } else if (oldCode.isLoad()) { newCode = OpCode.valueOf(oldCode.name().replace("LOAD", "STORE")); } else { throw new IllegalArgumentException("Instruction is neither a load nor store: " + instruction.getOpCode()); } if (instruction.getOperandCount() == 1) { return new Instruction(newCode, instruction.getOperand(0)); } return new Instruction(newCode); } }
public static Instruction reverseLoadOrStore(final Instruction instruction) { VerifyArgument.notNull(instruction, "instruction"); final OpCode oldCode = instruction.getOpCode(); final OpCode newCode; if (oldCode.isStore()) { newCode = OpCode.valueOf(oldCode.name().replace("STORE", "LOAD")); } else if (oldCode.isLoad()) { newCode = OpCode.valueOf(oldCode.name().replace("LOAD", "STORE")); } else { throw new IllegalArgumentException("Instruction is neither a load nor store: " + instruction.getOpCode()); } if (instruction.getOperandCount() == 1) { return new Instruction(newCode, instruction.getOperand(0)); } return new Instruction(newCode); } }
public static MethodDefinition resolveToBridge(MethodDefinition md) { if (md.isBridgeMethod()) { return md; } for (MethodDefinition candidate : md.getDeclaringType().getDeclaredMethods()) { if (candidate.getName().equals(md.getName()) && candidate.isBridgeMethod()) { List<ParameterDefinition> params = candidate.getParameters(); if (params.size() == md.getParameters().size()) { MethodBody body = candidate.getBody(); if (body != null) { for (Instruction instr : body.getInstructions()) { if (instr.getOperandCount() == 1) { Object operand = instr.getOperand(0); if (operand instanceof MethodReference) { MethodReference mr = (MethodReference) operand; if (mr.getName().equals(md.getName()) && mr.getErasedSignature().equals(md .getErasedSignature()) && mr.getDeclaringType().isEquivalentTo(md .getDeclaringType())) { return candidate; } } } } } } } } return md; }
for (int i = 0; i < instruction.getOperandCount(); i++) { final Object operand = instruction.getOperand(i);
for (int i = 0; i < instruction.getOperandCount(); i++) { final Object operand = instruction.getOperand(i);
for (int i = 0; i < instruction.getOperandCount(); i++) { final Object operand = instruction.getOperand(i);
final Instruction copy = new Instruction(instruction.getOffset(), instruction.getOpCode()); if (instruction.getOperandCount() > 1) { final Object[] operands = new Object[instruction.getOperandCount()];
final Instruction copy = new Instruction(instruction.getOffset(), instruction.getOpCode()); if (instruction.getOperandCount() > 1) { final Object[] operands = new Object[instruction.getOperandCount()];
final Instruction copy = new Instruction(instruction.getOffset(), instruction.getOpCode()); if (instruction.getOperandCount() > 1) { final Object[] operands = new Object[instruction.getOperandCount()];
if (load.getOperandCount() == 1) { loadSite.setOperand(load.getOperand(0));
if (load.getOperandCount() == 1) { loadSite.setOperand(load.getOperand(0));
if (instruction.getOperandCount() == 0) { continue;
if (instruction.getOperandCount() == 0) { continue;
if (instruction.getOperandCount() == 0) { continue;