com.android.dx.rop.cst.CstLiteralBits Java Examples
The following examples show how to use
com.android.dx.rop.cst.CstLiteralBits.
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: Form21h.java From Box with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override public void writeTo(AnnotatedOutput out, DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); CstLiteralBits cb = (CstLiteralBits) ((CstInsn) insn).getConstant(); short bits; // Where the high bits are depends on the category of the target. if (regs.get(0).getCategory() == 1) { bits = (short) (cb.getIntBits() >>> 16); } else { bits = (short) (cb.getLongBits() >>> 48); } write(out, opcodeUnit(insn, regs.get(0).getReg()), bits); }
Example #2
Source File: Form21s.java From buck with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override public boolean isCompatible(DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); if (!((insn instanceof CstInsn) && (regs.size() == 1) && unsignedFitsInByte(regs.get(0).getReg()))) { return false; } CstInsn ci = (CstInsn) insn; Constant cst = ci.getConstant(); if (!(cst instanceof CstLiteralBits)) { return false; } CstLiteralBits cb = (CstLiteralBits) cst; return cb.fitsInInt() && signedFitsInShort(cb.getIntBits()); }
Example #3
Source File: Form21h.java From buck with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override public void writeTo(AnnotatedOutput out, DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); CstLiteralBits cb = (CstLiteralBits) ((CstInsn) insn).getConstant(); short bits; // Where the high bits are depends on the category of the target. if (regs.get(0).getCategory() == 1) { bits = (short) (cb.getIntBits() >>> 16); } else { bits = (short) (cb.getLongBits() >>> 48); } write(out, opcodeUnit(insn, regs.get(0).getReg()), bits); }
Example #4
Source File: Form31i.java From Box with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override public boolean isCompatible(DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); if (!((insn instanceof CstInsn) && (regs.size() == 1) && unsignedFitsInByte(regs.get(0).getReg()))) { return false; } CstInsn ci = (CstInsn) insn; Constant cst = ci.getConstant(); if (!(cst instanceof CstLiteralBits)) { return false; } return ((CstLiteralBits) cst).fitsInInt(); }
Example #5
Source File: Form22s.java From Box with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override public boolean isCompatible(DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); if (!((insn instanceof CstInsn) && (regs.size() == 2) && unsignedFitsInNibble(regs.get(0).getReg()) && unsignedFitsInNibble(regs.get(1).getReg()))) { return false; } CstInsn ci = (CstInsn) insn; Constant cst = ci.getConstant(); if (!(cst instanceof CstLiteralBits)) { return false; } CstLiteralBits cb = (CstLiteralBits) cst; return cb.fitsInInt() && signedFitsInShort(cb.getIntBits()); }
Example #6
Source File: Form31i.java From buck with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override public boolean isCompatible(DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); if (!((insn instanceof CstInsn) && (regs.size() == 1) && unsignedFitsInByte(regs.get(0).getReg()))) { return false; } CstInsn ci = (CstInsn) insn; Constant cst = ci.getConstant(); if (!(cst instanceof CstLiteralBits)) { return false; } return ((CstLiteralBits) cst).fitsInInt(); }
Example #7
Source File: Form21s.java From Box with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override public boolean isCompatible(DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); if (!((insn instanceof CstInsn) && (regs.size() == 1) && unsignedFitsInByte(regs.get(0).getReg()))) { return false; } CstInsn ci = (CstInsn) insn; Constant cst = ci.getConstant(); if (!(cst instanceof CstLiteralBits)) { return false; } CstLiteralBits cb = (CstLiteralBits) cst; return cb.fitsInInt() && signedFitsInShort(cb.getIntBits()); }
Example #8
Source File: Form11n.java From J2ME-Loader with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override public boolean isCompatible(DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); if (!((insn instanceof CstInsn) && (regs.size() == 1) && unsignedFitsInNibble(regs.get(0).getReg()))) { return false; } CstInsn ci = (CstInsn) insn; Constant cst = ci.getConstant(); if (!(cst instanceof CstLiteralBits)) { return false; } CstLiteralBits cb = (CstLiteralBits) cst; return cb.fitsInInt() && signedFitsInNibble(cb.getIntBits()); }
Example #9
Source File: Form22b.java From buck with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override public boolean isCompatible(DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); if (!((insn instanceof CstInsn) && (regs.size() == 2) && unsignedFitsInByte(regs.get(0).getReg()) && unsignedFitsInByte(regs.get(1).getReg()))) { return false; } CstInsn ci = (CstInsn) insn; Constant cst = ci.getConstant(); if (!(cst instanceof CstLiteralBits)) { return false; } CstLiteralBits cb = (CstLiteralBits) cst; return cb.fitsInInt() && signedFitsInByte(cb.getIntBits()); }
Example #10
Source File: Form22b.java From Box with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override public boolean isCompatible(DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); if (!((insn instanceof CstInsn) && (regs.size() == 2) && unsignedFitsInByte(regs.get(0).getReg()) && unsignedFitsInByte(regs.get(1).getReg()))) { return false; } CstInsn ci = (CstInsn) insn; Constant cst = ci.getConstant(); if (!(cst instanceof CstLiteralBits)) { return false; } CstLiteralBits cb = (CstLiteralBits) cst; return cb.fitsInInt() && signedFitsInByte(cb.getIntBits()); }
Example #11
Source File: Form22s.java From Box with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override public boolean isCompatible(DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); if (!((insn instanceof CstInsn) && (regs.size() == 2) && unsignedFitsInNibble(regs.get(0).getReg()) && unsignedFitsInNibble(regs.get(1).getReg()))) { return false; } CstInsn ci = (CstInsn) insn; Constant cst = ci.getConstant(); if (!(cst instanceof CstLiteralBits)) { return false; } CstLiteralBits cb = (CstLiteralBits) cst; return cb.fitsInInt() && signedFitsInShort(cb.getIntBits()); }
Example #12
Source File: Form11n.java From buck with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override public boolean isCompatible(DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); if (!((insn instanceof CstInsn) && (regs.size() == 1) && unsignedFitsInNibble(regs.get(0).getReg()))) { return false; } CstInsn ci = (CstInsn) insn; Constant cst = ci.getConstant(); if (!(cst instanceof CstLiteralBits)) { return false; } CstLiteralBits cb = (CstLiteralBits) cst; return cb.fitsInInt() && signedFitsInNibble(cb.getIntBits()); }
Example #13
Source File: Form21s.java From Box with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override public boolean isCompatible(DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); if (!((insn instanceof CstInsn) && (regs.size() == 1) && unsignedFitsInByte(regs.get(0).getReg()))) { return false; } CstInsn ci = (CstInsn) insn; Constant cst = ci.getConstant(); if (!(cst instanceof CstLiteralBits)) { return false; } CstLiteralBits cb = (CstLiteralBits) cst; return cb.fitsInInt() && signedFitsInShort(cb.getIntBits()); }
Example #14
Source File: Form11n.java From Box with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override public boolean isCompatible(DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); if (!((insn instanceof CstInsn) && (regs.size() == 1) && unsignedFitsInNibble(regs.get(0).getReg()))) { return false; } CstInsn ci = (CstInsn) insn; Constant cst = ci.getConstant(); if (!(cst instanceof CstLiteralBits)) { return false; } CstLiteralBits cb = (CstLiteralBits) cst; return cb.fitsInInt() && signedFitsInNibble(cb.getIntBits()); }
Example #15
Source File: InsnFormat.java From Box with Apache License 2.0 | 6 votes |
/** * Helper method to return a literal bits argument string. * * @param value the value * @return {@code non-null;} the string form */ protected static String literalBitsString(CstLiteralBits value) { StringBuilder sb = new StringBuilder(100); sb.append('#'); if (value instanceof CstKnownNull) { sb.append("null"); } else { sb.append(value.typeName()); sb.append(' '); sb.append(value.toHuman()); } return sb.toString(); }
Example #16
Source File: Form21h.java From J2ME-Loader with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override public void writeTo(AnnotatedOutput out, DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); CstLiteralBits cb = (CstLiteralBits) ((CstInsn) insn).getConstant(); short bits; // Where the high bits are depends on the category of the target. if (regs.get(0).getCategory() == 1) { bits = (short) (cb.getIntBits() >>> 16); } else { bits = (short) (cb.getLongBits() >>> 48); } write(out, opcodeUnit(insn, regs.get(0).getReg()), bits); }
Example #17
Source File: Form22b.java From J2ME-Loader with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override public boolean isCompatible(DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); if (!((insn instanceof CstInsn) && (regs.size() == 2) && unsignedFitsInByte(regs.get(0).getReg()) && unsignedFitsInByte(regs.get(1).getReg()))) { return false; } CstInsn ci = (CstInsn) insn; Constant cst = ci.getConstant(); if (!(cst instanceof CstLiteralBits)) { return false; } CstLiteralBits cb = (CstLiteralBits) cst; return cb.fitsInInt() && signedFitsInByte(cb.getIntBits()); }
Example #18
Source File: Form31i.java From J2ME-Loader with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override public boolean isCompatible(DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); if (!((insn instanceof CstInsn) && (regs.size() == 1) && unsignedFitsInByte(regs.get(0).getReg()))) { return false; } CstInsn ci = (CstInsn) insn; Constant cst = ci.getConstant(); if (!(cst instanceof CstLiteralBits)) { return false; } return ((CstLiteralBits) cst).fitsInInt(); }
Example #19
Source File: InsnFormat.java From buck with Apache License 2.0 | 6 votes |
/** * Helper method to return a literal bits argument string. * * @param value the value * @return {@code non-null;} the string form */ protected static String literalBitsString(CstLiteralBits value) { StringBuffer sb = new StringBuffer(100); sb.append('#'); if (value instanceof CstKnownNull) { sb.append("null"); } else { sb.append(value.typeName()); sb.append(' '); sb.append(value.toHuman()); } return sb.toString(); }
Example #20
Source File: Form21s.java From J2ME-Loader with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override public boolean isCompatible(DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); if (!((insn instanceof CstInsn) && (regs.size() == 1) && unsignedFitsInByte(regs.get(0).getReg()))) { return false; } CstInsn ci = (CstInsn) insn; Constant cst = ci.getConstant(); if (!(cst instanceof CstLiteralBits)) { return false; } CstLiteralBits cb = (CstLiteralBits) cst; return cb.fitsInInt() && signedFitsInShort(cb.getIntBits()); }
Example #21
Source File: Form21h.java From Box with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override public String insnArgString(DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); CstLiteralBits value = (CstLiteralBits) ((CstInsn) insn).getConstant(); return regs.get(0).regString() + ", " + literalBitsString(value); }
Example #22
Source File: Form21h.java From Box with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override public String insnCommentString(DalvInsn insn, boolean noteIndices) { RegisterSpecList regs = insn.getRegisters(); CstLiteralBits value = (CstLiteralBits) ((CstInsn) insn).getConstant(); return literalBitsComment(value, (regs.get(0).getCategory() == 1) ? 32 : 64); }
Example #23
Source File: Form31i.java From Box with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override public String insnArgString(DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); CstLiteralBits value = (CstLiteralBits) ((CstInsn) insn).getConstant(); return regs.get(0).regString() + ", " + literalBitsString(value); }
Example #24
Source File: Form31i.java From Box with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override public void writeTo(AnnotatedOutput out, DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); int value = ((CstLiteralBits) ((CstInsn) insn).getConstant()).getIntBits(); write(out, opcodeUnit(insn, regs.get(0).getReg()), value); }
Example #25
Source File: Form51l.java From buck with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override public String insnArgString(DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); CstLiteralBits value = (CstLiteralBits) ((CstInsn) insn).getConstant(); return regs.get(0).regString() + ", " + literalBitsString(value); }
Example #26
Source File: Form22s.java From Box with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override public void writeTo(AnnotatedOutput out, DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); int value = ((CstLiteralBits) ((CstInsn) insn).getConstant()).getIntBits(); write(out, opcodeUnit(insn, makeByte(regs.get(0).getReg(), regs.get(1).getReg())), (short) value); }
Example #27
Source File: Form31i.java From buck with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override public void writeTo(AnnotatedOutput out, DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); int value = ((CstLiteralBits) ((CstInsn) insn).getConstant()).getIntBits(); write(out, opcodeUnit(insn, regs.get(0).getReg()), value); }
Example #28
Source File: LiteralOpUpgrader.java From J2ME-Loader with Apache License 2.0 | 5 votes |
/** * Returns true if the register contains an integer 0 or a known-null * object reference * * @param spec non-null spec * @return true for 0 or null type bearers */ private static boolean isConstIntZeroOrKnownNull(RegisterSpec spec) { TypeBearer tb = spec.getTypeBearer(); if (tb instanceof CstLiteralBits) { CstLiteralBits clb = (CstLiteralBits) tb; return (clb.getLongBits() == 0); } return false; }
Example #29
Source File: Form11n.java From Box with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override public String insnArgString(DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); CstLiteralBits value = (CstLiteralBits) ((CstInsn) insn).getConstant(); return regs.get(0).regString() + ", " + literalBitsString(value); }
Example #30
Source File: Form21h.java From buck with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override public String insnCommentString(DalvInsn insn, boolean noteIndices) { RegisterSpecList regs = insn.getRegisters(); CstLiteralBits value = (CstLiteralBits) ((CstInsn) insn).getConstant(); return literalBitsComment(value, (regs.get(0).getCategory() == 1) ? 32 : 64); }