• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SourcePosition类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.android.dx.rop.code.SourcePosition的典型用法代码示例。如果您正苦于以下问题:Java SourcePosition类的具体用法?Java SourcePosition怎么用?Java SourcePosition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SourcePosition类属于com.android.dx.rop.code包,在下文中一共展示了SourcePosition类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setupArrays

import com.android.dx.rop.code.SourcePosition; //导入依赖的package包/类
/**
 * Sets up the address arrays.
 */
private void setupArrays(RopMethod method) {
    BasicBlockList blocks = method.getBlocks();
    int sz = blocks.size();

    for (int i = 0; i < sz; i++) {
        BasicBlock one = blocks.get(i);
        int label = one.getLabel();
        Insn insn = one.getInsns().get(0);

        starts[label] = new CodeAddress(insn.getPosition());

        SourcePosition pos = one.getLastInsn().getPosition();

        lasts[label] = new CodeAddress(pos);
        ends[label] = new CodeAddress(pos);
    }
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:21,代码来源:BlockAddresses.java


示例2: makeMove

import com.android.dx.rop.code.SourcePosition; //导入依赖的package包/类
/**
 * Makes a move instruction, appropriate and ideal for the given arguments.
 *
 * @param position {@code non-null;} source position information
 * @param dest {@code non-null;} destination register
 * @param src {@code non-null;} source register
 * @return {@code non-null;} an appropriately-constructed instance
 */
public static SimpleInsn makeMove(SourcePosition position,
        RegisterSpec dest, RegisterSpec src) {
    boolean category1 = dest.getCategory() == 1;
    boolean reference = dest.getType().isReference();
    int destReg = dest.getReg();
    int srcReg = src.getReg();
    Dop opcode;

    if ((srcReg | destReg) < 16) {
        opcode = reference ? Dops.MOVE_OBJECT :
            (category1 ? Dops.MOVE : Dops.MOVE_WIDE);
    } else if (destReg < 256) {
        opcode = reference ? Dops.MOVE_OBJECT_FROM16 :
            (category1 ? Dops.MOVE_FROM16 : Dops.MOVE_WIDE_FROM16);
    } else {
        opcode = reference ? Dops.MOVE_OBJECT_16 :
            (category1 ? Dops.MOVE_16 : Dops.MOVE_WIDE_16);
    }

    return new SimpleInsn(opcode, position,
                          RegisterSpecList.make(dest, src));
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:31,代码来源:DalvInsn.java


示例3: DalvInsn

import com.android.dx.rop.code.SourcePosition; //导入依赖的package包/类
/**
 * Constructs an instance. The output address of this instance is initially
 * unknown ({@code -1}).
 *
 * <p><b>Note:</b> In the unlikely event that an instruction takes
 * absolutely no registers (e.g., a {@code nop} or a
 * no-argument no-result static method call), then the given
 * register list may be passed as {@link
 * RegisterSpecList#EMPTY}.</p>
 *
 * @param opcode the opcode; one of the constants from {@link Dops}
 * @param position {@code non-null;} source position
 * @param registers {@code non-null;} register list, including a
 * result register if appropriate (that is, registers may be either
 * ins and outs)
 */
public DalvInsn(Dop opcode, SourcePosition position,
                RegisterSpecList registers) {
    if (opcode == null) {
        throw new NullPointerException("opcode == null");
    }

    if (position == null) {
        throw new NullPointerException("position == null");
    }

    if (registers == null) {
        throw new NullPointerException("registers == null");
    }

    this.address = -1;
    this.opcode = opcode;
    this.position = position;
    this.registers = registers;
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:36,代码来源:DalvInsn.java


示例4: visitFillArrayDataInsn

import com.android.dx.rop.code.SourcePosition; //导入依赖的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:johnlee175,项目名称:dex,代码行数:26,代码来源:RopTranslator.java


示例5: visitThrowingInsn

import com.android.dx.rop.code.SourcePosition; //导入依赖的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


示例6: updateReturnOp

import com.android.dx.rop.code.SourcePosition; //导入依赖的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


示例7: CstInsn

import com.android.dx.rop.code.SourcePosition; //导入依赖的package包/类
/**
 * Constructs an instance. The output address of this instance is
 * initially unknown ({@code -1}) as is the constant pool index.
 *
 * @param opcode the opcode; one of the constants from {@link Dops}
 * @param position {@code non-null;} source position
 * @param registers {@code non-null;} register list, including a
 * result register if appropriate (that is, registers may be either
 * ins or outs)
 * @param constant {@code non-null;} constant argument
 */
public CstInsn(Dop opcode, SourcePosition position,
               RegisterSpecList registers, Constant constant) {
    super(opcode, position, registers);

    if (constant == null) {
        throw new NullPointerException("constant == null");
    }

    this.constant = constant;
    this.index = -1;
    this.classIndex = -1;
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:24,代码来源:CstInsn.java


示例8: LocalSnapshot

import com.android.dx.rop.code.SourcePosition; //导入依赖的package包/类
/**
 * Constructs an instance. The output address of this instance is initially
 * unknown ({@code -1}).
 *
 * @param position {@code non-null;} source position
 * @param locals {@code non-null;} associated local variable state
 */
public LocalSnapshot(SourcePosition position, RegisterSpecSet locals) {
    super(position);

    if (locals == null) {
        throw new NullPointerException("locals == null");
    }

    this.locals = locals;
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:17,代码来源:LocalSnapshot.java


示例9: HighRegisterPrefix

import com.android.dx.rop.code.SourcePosition; //导入依赖的package包/类
/**
 * Constructs an instance. The output address of this instance is initially
 * unknown ({@code -1}).
 *
 * @param position {@code non-null;} source position
 * @param registers {@code non-null;} source registers
 */
public HighRegisterPrefix(SourcePosition position,
                          RegisterSpecList registers) {
    super(position, registers);

    if (registers.size() == 0) {
        throw new IllegalArgumentException("registers.size() == 0");
    }

    insns = null;
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:18,代码来源:HighRegisterPrefix.java


示例10: Entry

import com.android.dx.rop.code.SourcePosition; //导入依赖的package包/类
/**
 * Constructs an instance.
 *
 * @param address {@code >= 0;} address of this entry
 * @param position {@code non-null;} corresponding source position information
 */
public Entry (int address, SourcePosition position) {
    if (address < 0) {
        throw new IllegalArgumentException("address < 0");
    }

    if (position == null) {
        throw new NullPointerException("position == null");
    }

    this.address = address;
    this.position = position;
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:19,代码来源:PositionList.java


示例11: LocalStart

import com.android.dx.rop.code.SourcePosition; //导入依赖的package包/类
/**
 * Constructs an instance. The output address of this instance is initially
 * unknown ({@code -1}).
 *
 * @param position {@code non-null;} source position
 * @param local {@code non-null;} register spec representing the local
 * variable introduced by this instance
 */
public LocalStart(SourcePosition position, RegisterSpec local) {
    super(position);

    if (local == null) {
        throw new NullPointerException("local == null");
    }

    this.local = local;
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:18,代码来源:LocalStart.java


示例12: SwitchData

import com.android.dx.rop.code.SourcePosition; //导入依赖的package包/类
/**
 * Constructs an instance. The output address of this instance is initially
 * unknown ({@code -1}).
 *
 * @param position {@code non-null;} source position
 * @param user {@code non-null;} address representing the instruction that
 * uses this instance
 * @param cases {@code non-null;} sorted list of switch cases (keys)
 * @param targets {@code non-null;} corresponding list of code addresses; the
 * branch target for each case
 */
public SwitchData(SourcePosition position, CodeAddress user,
                  IntList cases, CodeAddress[] targets) {
    super(position, RegisterSpecList.EMPTY);

    if (user == null) {
        throw new NullPointerException("user == null");
    }

    if (cases == null) {
        throw new NullPointerException("cases == null");
    }

    if (targets == null) {
        throw new NullPointerException("targets == null");
    }

    int sz = cases.size();

    if (sz != targets.length) {
        throw new IllegalArgumentException("cases / targets mismatch");
    }

    if (sz > 65535) {
        throw new IllegalArgumentException("too many cases");
    }

    this.user = user;
    this.cases = cases;
    this.targets = targets;
    this.packed = shouldPack(cases);
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:43,代码来源:SwitchData.java


示例13: updateInfo

import com.android.dx.rop.code.SourcePosition; //导入依赖的package包/类
/**
 * Helper for {@link #add} and {@link #insert},
 * which updates the position and local info flags.
 *
 * @param insn {@code non-null;} an instruction that was just introduced
 */
private void updateInfo(DalvInsn insn) {
    if (! hasAnyPositionInfo) {
        SourcePosition pos = insn.getPosition();
        if (pos.getLine() >= 0) {
            hasAnyPositionInfo = true;
        }
    }

    if (! hasAnyLocalInfo) {
        if (hasLocalInfo(insn)) {
            hasAnyLocalInfo = true;
        }
    }
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:21,代码来源:OutputFinisher.java


示例14: fixLocalAssignment

import com.android.dx.rop.code.SourcePosition; //导入依赖的package包/类
/**
 * Inserts mark-locals if necessary when changing a register. If
 * the definition of {@code origReg} is associated with a local
 * variable, then insert a mark-local for {@code newReg} just below
 * it. We expect the definition of  {@code origReg} to ultimately
 * be removed by the dead code eliminator
 *
 * @param origReg {@code non-null;} original register
 * @param newReg {@code non-null;} new register that will replace
 * {@code origReg}
 */
private void fixLocalAssignment(RegisterSpec origReg,
        RegisterSpec newReg) {
    for (SsaInsn use : ssaMeth.getUseListForRegister(origReg.getReg())) {
        RegisterSpec localAssignment = use.getLocalAssignment();
        if (localAssignment == null) {
            continue;
        }

        if (use.getResult() == null) {
            /*
             * This is a mark-local. it will be updated when all uses
             * are updated.
             */
            continue;
        }

        LocalItem local = localAssignment.getLocalItem();

        // Un-associate original use.
        use.setResultLocal(null);

        // Now add a mark-local to the new reg immediately after.
        newReg = newReg.withLocalItem(local);

        SsaInsn newInsn
                = SsaInsn.makeFromRop(
                    new PlainInsn(Rops.opMarkLocal(newReg),
                    SourcePosition.NO_INFO, null,
                            RegisterSpecList.make(newReg)),
                use.getBlock());

        ArrayList<SsaInsn> insns = use.getBlock().getInsns();

        insns.add(insns.indexOf(use) + 1, newInsn);
    }
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:48,代码来源:ConstCollector.java


示例15: addMoveToBeginning

import com.android.dx.rop.code.SourcePosition; //导入依赖的package包/类
/**
 * Adds a move instruction after the phi insn block.
 *
 * @param result move destination
 * @param source move source
 */
public void addMoveToBeginning (RegisterSpec result, RegisterSpec source) {
    if (result.getReg() == source.getReg()) {
        // Sometimes we end up with no-op moves. Ignore them here.
        return;
    }

    RegisterSpecList sources = RegisterSpecList.make(source);
    NormalSsaInsn toAdd = new NormalSsaInsn(
            new PlainInsn(Rops.opMove(result.getType()),
                    SourcePosition.NO_INFO, result, sources), this);

    insns.add(getCountPhiInsns(), toAdd);
    movesFromPhisAtBeginning++;
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:21,代码来源:SsaBasicBlock.java


示例16: deleteInsns

import com.android.dx.rop.code.SourcePosition; //导入依赖的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


示例17: toHumanWithInline

import com.android.dx.rop.code.SourcePosition; //导入依赖的package包/类
/**
 * Returns human-readable string for listing dumps. This method
 * allows sub-classes to specify extra text.
 *
 * @param extra {@code null-ok;} the argument to print after the opcode
 * @return human-readable string for listing dumps
 */
protected final String toHumanWithInline(String extra) {
    StringBuffer sb = new StringBuffer(80);

    sb.append(SourcePosition.NO_INFO);
    sb.append(": phi");

    if (extra != null) {
        sb.append("(");
        sb.append(extra);
        sb.append(")");
    }

    RegisterSpec result = getResult();

    if (result == null) {
        sb.append(" .");
    } else {
        sb.append(" ");
        sb.append(result.toHuman());
    }

    sb.append(" <-");

    int sz = getSources().size();
    if (sz == 0) {
        sb.append(" .");
    } else {
        for (int i = 0; i < sz; i++) {
            sb.append(" ");
            sb.append(sources.get(i).toHuman()
                    + "[b="
                    + Hex.u2(operands.get(i).ropLabel)  + "]");
        }
    }

    return sb.toString();
}
 
开发者ID:johnlee175,项目名称:dex,代码行数:45,代码来源:PhiInsn.java


示例18: LocalEnd

import com.android.dx.rop.code.SourcePosition; //导入依赖的package包/类
/**
 * Constructs an instance. The output address of this instance is initially
 * unknown ({@code -1}).
 *
 * @param position {@code non-null;} source position
 * @param local {@code non-null;} register spec representing the local
 * variable introduced by this instance
 */
public LocalEnd(SourcePosition position, RegisterSpec local) {
    super(position);

    if (local == null) {
        throw new NullPointerException("local == null");
    }

    this.local = local;
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:18,代码来源:LocalEnd.java



注:本文中的com.android.dx.rop.code.SourcePosition类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java OrExpr类代码示例发布时间:2022-05-22
下一篇:
Java ChosenImage类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap