switch (insn.getOpcode().getBranchingness()) { case BRANCH_NONE: if (branch != null) {
/** * Gets whether this instruction can possibly throw an exception. This * is just a convenient wrapper for {@code getOpcode().canThrow()}. * * @return {@code true} iff this instruction can possibly throw */ public final boolean canThrow() { return opcode.canThrow(); }
/** * Gets the nickname. If this instance has no nickname, this returns * the result of calling {@link #toString}. * * @return {@code non-null;} the nickname */ public String getNickname() { if (nickname != null) { return nickname; } return toString(); }
if (dest != null && rop.isCallLike()) { if (rop.getOpcode() == RegOps.INVOKE_CUSTOM) { returnType = ((CstCallSiteRef) cst).getReturnType(); } else { } else if (dest != null && rop.canThrow()) { cst = CstType.intern(rop.getResult()); } else if ((cst == null) && (sourceCount == 2)) { TypeBearer firstType = sources.get(0).getTypeBearer(); if (rop.getOpcode() == RegOps.SUB) { ropOpcode = RegOps.ADD; CstInteger cstInt = (CstInteger) lastType; boolean canThrow = rop.canThrow(); } else if (cst != null) { if (canThrow) { if (rop.getOpcode() == RegOps.INVOKE_POLYMORPHIC) { insn = makeInvokePolymorphicInsn(rop, pos, sources, catches, cst); } else {
if (opcode.getBranchingness() == Rop.BRANCH_IF) { RegOps.flippedIfOpcode(opcode.getOpcode())); } else if (isConstIntZeroOrKnownNull(sources.get(1))) { replacePlainInsn(insn, sources.withoutLast(), opcode.getOpcode()); } else if (opcode.isCommutative() && advice.hasConstantOperation( opcode, sources.get(1), sources.get(0))) {
Constant cst = insn.getConstant(); if (rop.getBranchingness() != Rop.BRANCH_THROW) { throw new RuntimeException("Expected BRANCH_THROW got " + rop.getBranchingness()); if (rop.isCallLike()) { RegisterSpecList regs = insn.getSources(); DalvInsn di = new CstInsn(opcode, pos, regs, cst); || (rop.getOpcode() == RegOps.CHECK_CAST); if ((rop.getOpcode() == RegOps.NEW_ARRAY) && (opcode.getOpcode() != Opcodes.NEW_ARRAY)) {
if (dest != null && rop.isCallLike()) { } else if (dest != null && rop.canThrow()) { cst = CstType.intern(rop.getResult()); } else if ((cst == null) && (sourceCount == 2)) { TypeBearer lastType = sources.get(1).getTypeBearer(); boolean canThrow = rop.canThrow();
/** * Returns the appropriate {@code move-exception} rop for the * given type. The result may be a shared instance. * * @param type {@code non-null;} type of the exception * @return {@code non-null;} an appropriate instance */ public static Rop opMoveException(TypeBearer type) { return new Rop(RegOps.MOVE_EXCEPTION, type.getType(), StdTypeList.EMPTY, (String) null); }
/** * @return true if this is a move (but not a move-operand) instruction */ @Override public boolean isNormalMoveInsn() { return insn.getOpcode().getOpcode() == RegOps.MOVE; }
/** {@inheritDoc} */ @Override public void visitInvokePolymorphicInsn(InvokePolymorphicInsn insn) { SourcePosition pos = insn.getPosition(); Dop opcode = RopToDop.dopFor(insn); Rop rop = insn.getOpcode(); if (rop.getBranchingness() != Rop.BRANCH_THROW) { throw new RuntimeException("Expected BRANCH_THROW got " + rop.getBranchingness()); } else if (!rop.isCallLike()) { throw new RuntimeException("Expected call-like operation"); } addOutput(lastAddress); RegisterSpecList regs = insn.getSources(); Constant[] constants = new Constant[] { insn.getInvokeMethod(), insn.getCallSiteProto() }; DalvInsn di = new MultiCstInsn(opcode, pos, regs, constants); addOutput(di); }
/** {@inheritDoc} */ @Override public boolean requiresSourcesInOrder(Rop opcode, RegisterSpecList sources) { return !disableSourcesInOrder && opcode.isCallLike() && totalRopWidth(sources) >= MIN_INVOKE_IN_ORDER; }
/** * Gets the complete register list (result and sources) out of a * given rop instruction. For insns that are commutative, have * two register sources, and have a source equal to the result, * place that source first. * * @param insn {@code non-null;} instruction in question * @param resultReg {@code null-ok;} the real result to use (ignore the insn's) * @return {@code non-null;} the instruction's complete register list */ private static RegisterSpecList getRegs(Insn insn, RegisterSpec resultReg) { RegisterSpecList regs = insn.getSources(); if (insn.getOpcode().isCommutative() && (regs.size() == 2) && (resultReg.getReg() == regs.get(1).getReg())) { /* * For commutative ops which have two register sources, * if the second source is the same register as the result, * swap the sources so that an opcode of form 12x can be selected * instead of one of form 23x */ regs = RegisterSpecList.make(regs.get(1), regs.get(0)); } if (resultReg == null) { return regs; } return regs.withFirst(resultReg); }
sb.append(opcode.getNickname());
TypeList sourceTypes = returnOp.getSources(); RegisterSpecList sources;
if (dest != null && rop.isCallLike()) { } else if (dest != null && rop.canThrow()) { cst = CstType.intern(rop.getResult()); } else if ((cst == null) && (sourceCount == 2)) { TypeBearer firstType = sources.get(0).getTypeBearer(); if (rop.getOpcode() == RegOps.SUB) { ropOpcode = RegOps.ADD; CstInteger cstInt = (CstInteger) lastType; boolean canThrow = rop.canThrow(); } else if (cst != null) { if (canThrow) { if (rop.getOpcode() == RegOps.INVOKE_POLYMORPHIC) { insn = makeInvokePolymorphicInsn(rop, pos, sources, catches, cst); } else {
if (opcode.getBranchingness() == Rop.BRANCH_IF) { RegOps.flippedIfOpcode(opcode.getOpcode()), null); } else if (isConstIntZeroOrKnownNull(sources.get(1))) { replacePlainInsn(insn, sources.withoutLast(), opcode.getOpcode(), null); } else if (opcode.isCommutative() && advice.hasConstantOperation( opcode, sources.get(1), sources.get(0))) {
Constant cst = insn.getConstant(); if (rop.getBranchingness() != Rop.BRANCH_THROW) { throw new RuntimeException("shouldn't happen"); if (rop.isCallLike()) { RegisterSpecList regs = insn.getSources(); DalvInsn di = new CstInsn(opcode, pos, regs, cst); || (rop.getOpcode() == RegOps.CHECK_CAST); if ((rop.getOpcode() == RegOps.NEW_ARRAY) && (opcode.getOpcode() != Opcodes.NEW_ARRAY)) {
/** * Returns the appropriate {@code move-result-pseudo} rop for the * given type. The result may be a shared instance. * * @param type {@code non-null;} type of the parameter * @return {@code non-null;} an appropriate instance */ public static Rop opMoveResultPseudo(TypeBearer type) { return new Rop(RegOps.MOVE_RESULT_PSEUDO, type.getType(), StdTypeList.EMPTY, (String) null); }
/** * @return true if this is a move (but not a move-operand) instruction */ @Override public boolean isNormalMoveInsn() { return insn.getOpcode().getOpcode() == RegOps.MOVE; }
/** {@inheritDoc} */ @Override public void visitInvokePolymorphicInsn(InvokePolymorphicInsn insn) { SourcePosition pos = insn.getPosition(); Dop opcode = RopToDop.dopFor(insn); Rop rop = insn.getOpcode(); if (rop.getBranchingness() != Rop.BRANCH_THROW) { throw new RuntimeException("Expected BRANCH_THROW got " + rop.getBranchingness()); } else if (!rop.isCallLike()) { throw new RuntimeException("Expected call-like operation"); } addOutput(lastAddress); RegisterSpecList regs = insn.getSources(); Constant[] constants = new Constant[] { insn.getPolymorphicMethod(), insn.getCallSiteProto() }; DalvInsn di = new MultiCstInsn(opcode, pos, regs, constants); addOutput(di); }