本文整理汇总了Java中com.android.dx.rop.code.Rop类的典型用法代码示例。如果您正苦于以下问题:Java Rop类的具体用法?Java Rop怎么用?Java Rop使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Rop类属于com.android.dx.rop.code包,在下文中一共展示了Rop类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: visitThrowingInsn
import com.android.dx.rop.code.Rop; //导入依赖的package包/类
/** {@inheritDoc} */
public void visitThrowingInsn(ThrowingInsn insn) {
SourcePosition pos = insn.getPosition();
Dop opcode = RopToDop.dopFor(insn);
Rop rop = insn.getOpcode();
RegisterSpec realResult;
if (rop.getBranchingness() != Rop.BRANCH_THROW) {
throw new RuntimeException("shouldn't happen");
}
realResult = getNextMoveResultPseudo();
if (opcode.hasResult() != (realResult != null)) {
throw new RuntimeException(
"Insn with result/move-result-pseudo mismatch" + insn);
}
addOutput(lastAddress);
DalvInsn di = new SimpleInsn(opcode, pos,
getRegs(insn, realResult));
addOutput(di);
}
开发者ID:JLLK,项目名称:multidex-maker,代码行数:26,代码来源:RopTranslator.java
示例2: visitFillArrayDataInsn
import com.android.dx.rop.code.Rop; //导入依赖的package包/类
/** {@inheritDoc} */
public void visitFillArrayDataInsn(FillArrayDataInsn insn) {
SourcePosition pos = insn.getPosition();
Constant cst = insn.getConstant();
ArrayList<Constant> values = insn.getInitValues();
Rop rop = insn.getOpcode();
if (rop.getBranchingness() != Rop.BRANCH_NONE) {
throw new RuntimeException("shouldn't happen");
}
CodeAddress dataAddress = new CodeAddress(pos);
ArrayData dataInsn =
new ArrayData(pos, lastAddress, values, cst);
TargetInsn fillArrayDataInsn =
new TargetInsn(Dops.FILL_ARRAY_DATA, pos, getRegs(insn),
dataAddress);
addOutput(lastAddress);
addOutput(fillArrayDataInsn);
addOutputSuffix(new OddSpacer(pos));
addOutputSuffix(dataAddress);
addOutputSuffix(dataInsn);
}
开发者ID:JLLK,项目名称:multidex-maker,代码行数:26,代码来源:RopTranslator.java
示例3: updateReturnOp
import com.android.dx.rop.code.Rop; //导入依赖的package包/类
/**
* Sets or updates the information about the return block.
*
* @param op {@code non-null;} the opcode to use
* @param pos {@code non-null;} the position to use
*/
private void updateReturnOp(Rop op, SourcePosition pos) {
if (op == null) {
throw new NullPointerException("op == null");
}
if (pos == null) {
throw new NullPointerException("pos == null");
}
if (returnOp == null) {
returnOp = op;
returnPosition = pos;
} else {
if (returnOp != op) {
throw new SimException("return op mismatch: " + op + ", " +
returnOp);
}
if (pos.getLine() > returnPosition.getLine()) {
// Pick the largest line number to be the "canonical" return.
returnPosition = pos;
}
}
}
开发者ID:JLLK,项目名称:multidex-maker,代码行数:31,代码来源:RopperMachine.java
示例4: processRegister
import com.android.dx.rop.code.Rop; //导入依赖的package包/类
/**
* Iterate through all the uses of a new object.
*
* @param result {@code non-null;} register where new object is stored
* @param escSet {@code non-null;} EscapeSet for the new object
*/
private void processRegister(RegisterSpec result, EscapeSet escSet) {
ArrayList<RegisterSpec> regWorklist = new ArrayList<RegisterSpec>();
regWorklist.add(result);
// Go through the worklist
while (!regWorklist.isEmpty()) {
int listSize = regWorklist.size() - 1;
RegisterSpec def = regWorklist.remove(listSize);
List<SsaInsn> useList = ssaMeth.getUseListForRegister(def.getReg());
// Handle all the uses of this register
for (SsaInsn use : useList) {
Rop useOpcode = use.getOpcode();
if (useOpcode == null) {
// Handle phis
processPhiUse(use, escSet, regWorklist);
} else {
// Handle other opcodes
processUse(def, use, escSet, regWorklist);
}
}
}
}
开发者ID:JLLK,项目名称:multidex-maker,代码行数:31,代码来源:EscapeAnalysis.java
示例5: hasSideEffect
import com.android.dx.rop.code.Rop; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* TODO: Increase the scope of this.
*/
@Override
public boolean hasSideEffect() {
Rop opcode = getOpcode();
if (opcode.getBranchingness() != Rop.BRANCH_NONE) {
return true;
}
boolean hasLocalSideEffect
= Optimizer.getPreserveLocals() && getLocalAssignment() != null;
switch (opcode.getOpcode()) {
case RegOps.MOVE_RESULT:
case RegOps.MOVE:
case RegOps.CONST:
return hasLocalSideEffect;
default:
return true;
}
}
开发者ID:JLLK,项目名称:multidex-maker,代码行数:26,代码来源:NormalSsaInsn.java
示例6: getParameterIndexForReg
import com.android.dx.rop.code.Rop; //导入依赖的package包/类
/**
* Gets the parameter index for SSA registers that are method parameters.
* {@code -1} is returned for non-parameter registers.
*
* @param ssaReg {@code >=0;} SSA register to look up
* @return parameter index or {@code -1} if not a parameter
*/
private int getParameterIndexForReg(int ssaReg) {
SsaInsn defInsn = ssaMeth.getDefinitionForRegister(ssaReg);
if (defInsn == null) {
return -1;
}
Rop opcode = defInsn.getOpcode();
// opcode == null for phi insns.
if (opcode != null && opcode.getOpcode() == RegOps.MOVE_PARAM) {
CstInsn origInsn = (CstInsn) defInsn.getOriginalRopInsn();
return ((CstInteger) origInsn.getConstant()).getValue();
}
return -1;
}
开发者ID:JLLK,项目名称:multidex-maker,代码行数:24,代码来源:FirstFitLocalCombiningAllocator.java
示例7: hasSideEffect
import com.android.dx.rop.code.Rop; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* TODO: Increase the scope of this.
* @param optimizer
*/
@Override
public boolean hasSideEffect(Optimizer optimizer) {
Rop opcode = getOpcode();
if (opcode.getBranchingness() != Rop.BRANCH_NONE) {
return true;
}
boolean hasLocalSideEffect
= optimizer.getPreserveLocals() && getLocalAssignment() != null;
switch (opcode.getOpcode()) {
case RegOps.MOVE_RESULT:
case RegOps.MOVE:
case RegOps.CONST:
return hasLocalSideEffect;
default:
return true;
}
}
开发者ID:saleehk,项目名称:buck-cutom,代码行数:27,代码来源:NormalSsaInsn.java
示例8: visitPlainCstInsn
import com.android.dx.rop.code.Rop; //导入依赖的package包/类
/** {@inheritDoc} */
public void visitPlainCstInsn(PlainCstInsn insn) {
SourcePosition pos = insn.getPosition();
Dop opcode = RopToDop.dopFor(insn);
Rop rop = insn.getOpcode();
int ropOpcode = rop.getOpcode();
DalvInsn di;
if (rop.getBranchingness() != Rop.BRANCH_NONE) {
throw new RuntimeException("shouldn't happen");
}
if (ropOpcode == RegOps.MOVE_PARAM) {
if (!paramsAreInOrder) {
/*
* Parameters are not in order at the top of the reg space.
* We need to add moves.
*/
RegisterSpec dest = insn.getResult();
int param =
((CstInteger) insn.getConstant()).getValue();
RegisterSpec source =
RegisterSpec.make(regCount - paramSize + param,
dest.getType());
di = new SimpleInsn(opcode, pos,
RegisterSpecList.make(dest, source));
addOutput(di);
}
} else {
// No moves required for the parameters
RegisterSpecList regs = getRegs(insn);
di = new CstInsn(opcode, pos, regs, insn.getConstant());
addOutput(di);
}
}
开发者ID:JLLK,项目名称:multidex-maker,代码行数:37,代码来源:RopTranslator.java
示例9: tryReplacingWithConstant
import com.android.dx.rop.code.Rop; //导入依赖的package包/类
/**
* Tries to replace an instruction with a const instruction. The given
* instruction must have a constant result for it to be replaced.
*
* @param insn {@code non-null;} instruction to try to replace
* @return true if the instruction was replaced
*/
private boolean tryReplacingWithConstant(NormalSsaInsn insn) {
Insn originalRopInsn = insn.getOriginalRopInsn();
Rop opcode = originalRopInsn.getOpcode();
RegisterSpec result = insn.getResult();
if (result != null && !ssaMeth.isRegALocal(result) &&
opcode.getOpcode() != RegOps.CONST) {
TypeBearer type = insn.getResult().getTypeBearer();
if (type.isConstant() && type.getBasicType() == Type.BT_INT) {
// Replace the instruction with a constant
replacePlainInsn(insn, RegisterSpecList.EMPTY,
RegOps.CONST, (Constant) type);
// Remove the source as well if this is a move-result-pseudo
if (opcode.getOpcode() == RegOps.MOVE_RESULT_PSEUDO) {
int pred = insn.getBlock().getPredecessors().nextSetBit(0);
ArrayList<SsaInsn> predInsns =
ssaMeth.getBlocks().get(pred).getInsns();
NormalSsaInsn sourceInsn =
(NormalSsaInsn) predInsns.get(predInsns.size()-1);
replacePlainInsn(sourceInsn, RegisterSpecList.EMPTY,
RegOps.GOTO, null);
}
return true;
}
}
return false;
}
开发者ID:JLLK,项目名称:multidex-maker,代码行数:36,代码来源:LiteralOpUpgrader.java
示例10: verifyValidExitPredecessor
import com.android.dx.rop.code.Rop; //导入依赖的package包/类
/**
* Validates that a basic block is a valid end predecessor. It must
* end in a RETURN or a THROW. Throws a runtime exception on error.
*
* @param b {@code non-null;} block to validate
* @throws RuntimeException on error
*/
private void verifyValidExitPredecessor(SsaBasicBlock b) {
ArrayList<SsaInsn> insns = b.getInsns();
SsaInsn lastInsn = insns.get(insns.size() - 1);
Rop opcode = lastInsn.getOpcode();
if (opcode.getBranchingness() != Rop.BRANCH_RETURN
&& opcode != Rops.THROW) {
throw new RuntimeException("Exit predecessor must end"
+ " in valid exit statement.");
}
}
开发者ID:JLLK,项目名称:multidex-maker,代码行数:19,代码来源:SsaToRop.java
示例11: replaceLastInsn
import com.android.dx.rop.code.Rop; //导入依赖的package包/类
/**
* Replaces the last insn in this block. The provided insn must have
* some branchingness.
*
* @param insn {@code non-null;} rop-form insn to add, which must branch.
*/
public void replaceLastInsn(Insn insn) {
if (insn.getOpcode().getBranchingness() == Rop.BRANCH_NONE) {
throw new IllegalArgumentException("last insn must branch");
}
SsaInsn oldInsn = insns.get(insns.size() - 1);
SsaInsn newInsn = SsaInsn.makeFromRop(insn, this);
insns.set(insns.size() - 1, newInsn);
parent.onInsnRemoved(oldInsn);
parent.onInsnAdded(newInsn);
}
开发者ID:JLLK,项目名称:multidex-maker,代码行数:20,代码来源:SsaBasicBlock.java
示例12: deleteInsns
import com.android.dx.rop.code.Rop; //导入依赖的package包/类
/**
* Deletes all insns in the set from this method.
*
* @param deletedInsns {@code non-null;} insns to delete
*/
public void deleteInsns(Set<SsaInsn> deletedInsns) {
for (SsaBasicBlock block : getBlocks()) {
ArrayList<SsaInsn> insns = block.getInsns();
for (int i = insns.size() - 1; i >= 0; i--) {
SsaInsn insn = insns.get(i);
if (deletedInsns.contains(insn)) {
onInsnRemoved(insn);
insns.remove(i);
}
}
// Check to see if we need to add a GOTO
int insnsSz = insns.size();
SsaInsn lastInsn = (insnsSz == 0) ? null : insns.get(insnsSz - 1);
if (block != getExitBlock() && (insnsSz == 0
|| lastInsn.getOriginalRopInsn() == null
|| lastInsn.getOriginalRopInsn().getOpcode()
.getBranchingness() == Rop.BRANCH_NONE)) {
// We managed to eat a throwable insn
Insn gotoInsn = new PlainInsn(Rops.GOTO,
SourcePosition.NO_INFO, null, RegisterSpecList.EMPTY);
insns.add(SsaInsn.makeFromRop(gotoInsn, block));
// Remove secondary successors from this block
BitSet succs = block.getSuccessors();
for (int i = succs.nextSetBit(0); i >= 0;
i = succs.nextSetBit(i + 1)) {
if (i != block.getPrimarySuccessorIndex()) {
block.removeSuccessor(i);
}
}
}
}
}
开发者ID:JLLK,项目名称:multidex-maker,代码行数:45,代码来源:SsaMethod.java
注:本文中的com.android.dx.rop.code.Rop类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论