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

Java RegisterSpec类代码示例

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

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



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

示例1: isRegALocal

import com.android.dx.rop.code.RegisterSpec; //导入依赖的package包/类
/**
 * Checks to see if the given SSA reg is ever associated with a local
 * local variable. Each SSA reg may be associated with at most one
 * local var.
 *
 * @param spec {@code non-null;} ssa reg
 * @return true if reg is ever associated with a local
 */
public boolean isRegALocal(RegisterSpec spec) {
    SsaInsn defn = getDefinitionForRegister(spec.getReg());

    if (defn == null) {
        // version 0 registers are never used as locals
        return false;
    }

    // Does the definition have a local associated with it?
    if (defn.getLocalAssignment() != null) return true;

    // If not, is there a mark-local insn?
    for (SsaInsn use : getUseListForRegister(spec.getReg())) {
        Insn insn = use.getOriginalRopInsn();

        if (insn != null
                && insn.getOpcode().getOpcode() == RegOps.MARK_LOCAL) {
            return true;
        }
    }

    return false;
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:32,代码来源:SsaMethod.java


示例2: compatibleRegs

import com.android.dx.rop.code.RegisterSpec; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public BitSet compatibleRegs(DalvInsn insn) {
    RegisterSpecList regs = insn.getRegisters();
    int sz = regs.size();
    BitSet bits = new BitSet(sz);

    for (int i = 0; i < sz; i++) {
        RegisterSpec reg = regs.get(i);
        /*
         * The check below adds (category - 1) to the register, to
         * account for the fact that the second half of a
         * category-2 register has to be represented explicitly in
         * the result.
         */
        bits.set(i, unsignedFitsInNibble(reg.getReg() +
                                         reg.getCategory() - 1));
    }

    return bits;
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:22,代码来源:Form35c.java


示例3: processResultReg

import com.android.dx.rop.code.RegisterSpec; //导入依赖的package包/类
/**
 * Renames the result register of this insn and updates the
 * current register mapping. Does nothing if this insn has no result.
 * Applied to all non-move insns.
 *
 * @param insn insn to process.
 */
void processResultReg(SsaInsn insn) {
    RegisterSpec ropResult = insn.getResult();

    if (ropResult == null) {
        return;
    }

    int ropReg = ropResult.getReg();
    if (isBelowThresholdRegister(ropReg)) {
        return;
    }

    insn.changeResultReg(nextSsaReg);
    addMapping(ropReg, insn.getResult());

    if (DEBUG) {
        ssaRegToRopReg.add(ropReg);
    }

    nextSsaReg++;
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:29,代码来源:SsaRenamer.java


示例4: addConstants

import com.android.dx.rop.code.RegisterSpec; //导入依赖的package包/类
/**
 * Helper for {@link #getAllConstants} which adds all the info for
 * a single instruction.
 *
 * @param result {@code non-null;} result set to add to
 * @param insn {@code non-null;} instruction to scrutinize
 */
private static void addConstants(HashSet<Constant> result,
        DalvInsn insn) {
    if (insn instanceof CstInsn) {
        Constant cst = ((CstInsn) insn).getConstant();
        result.add(cst);
    } else if (insn instanceof LocalSnapshot) {
        RegisterSpecSet specs = ((LocalSnapshot) insn).getLocals();
        int size = specs.size();
        for (int i = 0; i < size; i++) {
            addConstants(result, specs.get(i));
        }
    } else if (insn instanceof LocalStart) {
        RegisterSpec spec = ((LocalStart) insn).getLocal();
        addConstants(result, spec);
    }
}
 
开发者ID:johnlee175,项目名称:dex,代码行数:24,代码来源:OutputFinisher.java


示例5: processPhiUse

import com.android.dx.rop.code.RegisterSpec; //导入依赖的package包/类
/**
 * Handles phi uses of new objects. Will merge together the sources of a phi
 * into a single EscapeSet. Adds the result of the phi to the worklist so
 * its uses can be followed.
 *
 * @param use {@code non-null;} phi use being processed
 * @param escSet {@code non-null;} EscapeSet for the object
 * @param regWorklist {@code non-null;} worklist of instructions left to
 * process for this object
 */
private void processPhiUse(SsaInsn use, EscapeSet escSet,
                               ArrayList<RegisterSpec> regWorklist) {
    int setIndex = findSetIndex(use.getResult());
    if (setIndex != latticeValues.size()) {
        // Check if result is in a set already
        EscapeSet mergeSet = latticeValues.get(setIndex);
        if (mergeSet != escSet) {
            // If it is, merge the sets and states, then delete the copy
            escSet.replaceableArray = false;
            escSet.regSet.or(mergeSet.regSet);
            if (escSet.escape.compareTo(mergeSet.escape) < 0) {
                escSet.escape = mergeSet.escape;
            }
            replaceNode(escSet, mergeSet);
            latticeValues.remove(setIndex);
        }
    } else {
        // If no set is found, add it to this escSet and the worklist
        escSet.regSet.set(use.getResult().getReg());
        regWorklist.add(use.getResult());
    }
}
 
开发者ID:johnlee175,项目名称:dex,代码行数:33,代码来源:EscapeAnalysis.java


示例6: getRegs

import com.android.dx.rop.code.RegisterSpec; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:35,代码来源:RopTranslator.java


示例7: getNextMoveResultPseudo

import com.android.dx.rop.code.RegisterSpec; //导入依赖的package包/类
/**
 * Looks forward to the current block's primary successor, returning
 * the RegisterSpec of the result of the move-result-pseudo at the
 * top of that block or null if none.
 *
 * @return {@code null-ok;} result of move-result-pseudo at the beginning of
 * primary successor
 */
private RegisterSpec getNextMoveResultPseudo()
{
    int label = block.getPrimarySuccessor();

    if (label < 0) {
        return null;
    }

    Insn insn
            = method.getBlocks().labelToBlock(label).getInsns().get(0);

    if (insn.getOpcode().getOpcode() != RegOps.MOVE_RESULT_PSEUDO) {
        return null;
    } else {
        return insn.getResult();
    }
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:26,代码来源:RopTranslator.java


示例8: Entry

import com.android.dx.rop.code.RegisterSpec; //导入依赖的package包/类
/**
 * Constructs an instance.
 *
 * @param address {@code >= 0;} address
 * @param disposition {@code non-null;} disposition of the local
 * @param spec {@code non-null;} register spec representing
 * the variable
 */
public Entry(int address, Disposition disposition, RegisterSpec spec) {
    if (address < 0) {
        throw new IllegalArgumentException("address < 0");
    }

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

    try {
        if (spec.getLocalItem() == null) {
            throw new NullPointerException(
                    "spec.getLocalItem() == null");
        }
    } catch (NullPointerException ex) {
        // Elucidate the exception.
        throw new NullPointerException("spec == null");
    }

    this.address = address;
    this.disposition = disposition;
    this.spec = spec;
    this.type = CstType.intern(spec.getType());
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:33,代码来源:LocalList.java


示例9: hasLocalInfo

import com.android.dx.rop.code.RegisterSpec; //导入依赖的package包/类
/**
 * Helper for {@link #add} which scrutinizes a single
 * instruction for local variable information.
 *
 * @param insn {@code non-null;} instruction to scrutinize
 * @return {@code true} iff the instruction refers to any
 * named locals
 */
private static boolean hasLocalInfo(DalvInsn insn) {
    if (insn instanceof LocalSnapshot) {
        RegisterSpecSet specs = ((LocalSnapshot) insn).getLocals();
        int size = specs.size();
        for (int i = 0; i < size; i++) {
            if (hasLocalInfo(specs.get(i))) {
                return true;
            }
        }
    } else if (insn instanceof LocalStart) {
        RegisterSpec spec = ((LocalStart) insn).getLocal();
        if (hasLocalInfo(spec)) {
            return true;
        }
    }

    return false;
}
 
开发者ID:johnlee175,项目名称:dex,代码行数:27,代码来源:OutputFinisher.java


示例10: handleNormalUnassociated

import com.android.dx.rop.code.RegisterSpec; //导入依赖的package包/类
/**
 * Maps all non-parameter, non-local variable registers.
 */
private void handleNormalUnassociated() {
    int szSsaRegs = ssaMeth.getRegCount();

    for (int ssaReg = 0; ssaReg < szSsaRegs; ssaReg++) {
        if (ssaRegsMapped.get(ssaReg)) {
            // We already did this one
            continue;
        }

        RegisterSpec ssaSpec = getDefinitionSpecForSsaReg(ssaReg);

        if (ssaSpec == null) continue;

        int category = ssaSpec.getCategory();
        // Find a rop reg that does not interfere
        int ropReg = findNextUnreservedRopReg(paramRangeEnd, category);
        while (!canMapReg(ssaSpec, ropReg)) {
            ropReg = findNextUnreservedRopReg(ropReg + 1, category);
        }

        addMapping(ssaSpec, ropReg);
    }
}
 
开发者ID:johnlee175,项目名称:dex,代码行数:27,代码来源:FirstFitLocalCombiningAllocator.java


示例11: calculateInsnsIfNecessary

import com.android.dx.rop.code.RegisterSpec; //导入依赖的package包/类
/**
 * Helper for {@link #codeSize} and {@link #writeTo} which sets up
 * {@link #insns} if not already done.
 */
private void calculateInsnsIfNecessary() {
    if (insns != null) {
        return;
    }

    RegisterSpecList registers = getRegisters();
    int sz = registers.size();

    insns = new SimpleInsn[sz];

    for (int i = 0, outAt = 0; i < sz; i++) {
      RegisterSpec src = registers.get(i);
      insns[i] = moveInsnFor(src, outAt);
      outAt += src.getCategory();
    }
}
 
开发者ID:johnlee175,项目名称:dex,代码行数:21,代码来源:HighRegisterPrefix.java


示例12: areAnyPinned

import com.android.dx.rop.code.RegisterSpec; //导入依赖的package包/类
/**
 * Checks to see if any of a set of old-namespace registers are
 * pinned to the specified new-namespace reg + category. Takes into
 * account the category of the old-namespace registers.
 *
 * @param oldSpecs {@code non-null;} set of old-namespace regs
 * @param newReg {@code >= 0;} new-namespace register
 * @param targetCategory {@code 1..2;} the number of adjacent new-namespace
 * registers (starting at ropReg) to consider
 * @return true if any of the old-namespace register have been mapped
 * to the new-namespace register + category
 */
public boolean areAnyPinned(RegisterSpecList oldSpecs,
        int newReg, int targetCategory) {
    int sz = oldSpecs.size();

    for (int i = 0; i < sz; i++) {
        RegisterSpec oldSpec = oldSpecs.get(i);
        int r = oldToNew(oldSpec.getReg());

        /*
         * If oldSpec is a category-2 register, then check both newReg
         * and newReg - 1.
         */
        if (r == newReg
            || (oldSpec.getCategory() == 2 && (r + 1) == newReg)
            || (targetCategory == 2 && (r == newReg + 1))) {
            return true;
        }
    }

    return false;
}
 
开发者ID:johnlee175,项目名称:dex,代码行数:34,代码来源:InterferenceRegisterMapper.java


示例13: processInsn

import com.android.dx.rop.code.RegisterSpec; //导入依赖的package包/类
/**
 * Process a single instruction, looking for new objects resulting from
 * move result or move param.
 *
 * @param insn {@code non-null;} instruction to process
 */
private void processInsn(SsaInsn insn) {
    int op = insn.getOpcode().getOpcode();
    RegisterSpec result = insn.getResult();
    EscapeSet escSet;

    // Identify new objects
    if (op == RegOps.MOVE_RESULT_PSEUDO &&
            result.getTypeBearer().getBasicType() == Type.BT_OBJECT) {
        // Handle objects generated through move_result_pseudo
        escSet = processMoveResultPseudoInsn(insn);
        processRegister(result, escSet);
    } else if (op == RegOps.MOVE_PARAM &&
                  result.getTypeBearer().getBasicType() == Type.BT_OBJECT) {
        // Track method arguments that are objects
        escSet = new EscapeSet(result.getReg(), regCount, EscapeState.NONE);
        latticeValues.add(escSet);
        processRegister(result, escSet);
    } else if (op == RegOps.MOVE_RESULT &&
            result.getTypeBearer().getBasicType() == Type.BT_OBJECT) {
        // Track method return values that are objects
        escSet = new EscapeSet(result.getReg(), regCount, EscapeState.NONE);
        latticeValues.add(escSet);
        processRegister(result, escSet);
    }
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:32,代码来源:EscapeAnalysis.java


示例14: calculateInsnsIfNecessary

import com.android.dx.rop.code.RegisterSpec; //导入依赖的package包/类
/**
 * Helper for {@link #codeSize} and {@link #writeTo} which sets up
 * {@link #insns} if not already done.
 */
private void calculateInsnsIfNecessary() {
    if (insns != null) {
        return;
    }

    RegisterSpecList registers = getRegisters();
    int sz = registers.size();

    insns = new SimpleInsn[sz];

    for (int i = 0, outAt = 0; i < sz; i++) {
        RegisterSpec src = registers.get(i);
        insns[i] = moveInsnFor(src, outAt);
        outAt += src.getCategory();
    }
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:21,代码来源:HighRegisterPrefix.java


示例15: map

import com.android.dx.rop.code.RegisterSpec; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public RegisterSpec map(RegisterSpec registerSpec) {
    if (registerSpec == null) {
        return null;
    }

    int newReg;
    try {
        newReg = oldToNew.get(registerSpec.getReg());
    } catch (IndexOutOfBoundsException ex) {
        newReg = -1;
    }

    if (newReg < 0) {
        throw new RuntimeException("no mapping specified for register");
    }

    return registerSpec.withReg(newReg);
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:21,代码来源:BasicRegisterMapper.java


示例16: replaceDef

import com.android.dx.rop.code.RegisterSpec; //导入依赖的package包/类
/**
 * Replaces the instructions that define an array with equivalent registers.
 * For each entry in the array, a register is created, initialized to zero.
 * A mapping between this register and the corresponding array index is
 * added.
 *
 * @param def {@code non-null;} move result instruction for array
 * @param prev {@code non-null;} instruction for instantiating new array
 * @param length size of the new array
 * @param newRegs {@code non-null;} mapping of array indices to new
 * registers to be populated
 */
private void replaceDef(SsaInsn def, SsaInsn prev, int length,
                            ArrayList<RegisterSpec> newRegs) {
    Type resultType = def.getResult().getType();

    // Create new zeroed out registers for each element in the array
    for (int i = 0; i < length; i++) {
        Constant newZero = Zeroes.zeroFor(resultType.getComponentType());
        TypedConstant typedZero = (TypedConstant) newZero;
        RegisterSpec newReg =
            RegisterSpec.make(ssaMeth.makeNewSsaReg(), typedZero);
        newRegs.add(newReg);
        insertPlainInsnBefore(def, RegisterSpecList.EMPTY, newReg,
                                  RegOps.CONST, newZero);
    }
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:28,代码来源:EscapeAnalysis.java


示例17: changeOneSource

import com.android.dx.rop.code.RegisterSpec; //导入依赖的package包/类
/**
 * Changes one of the insn's sources. New source should be of same type
 * and category.
 *
 * @param index {@code >=0;} index of source to change
 * @param newSpec spec for new source
 */
public final void changeOneSource(int index, RegisterSpec newSpec) {
    RegisterSpecList origSources = insn.getSources();
    int sz = origSources.size();
    RegisterSpecList newSources = new RegisterSpecList(sz);

    for (int i = 0; i < sz; i++) {
        newSources.set(i, i == index ? newSpec : origSources.get(i));
    }

    newSources.setImmutable();

    RegisterSpec origSpec = origSources.get(index);
    if (origSpec.getReg() != newSpec.getReg()) {
        /*
         * If the register remains unchanged, we're only changing
         * the type or local var name so don't update use list
         */
        getBlock().getParent().onSourceChanged(this, origSpec, newSpec);
    }

    insn = insn.withNewRegisters(getResult(), newSources);
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:30,代码来源:NormalSsaInsn.java


示例18: getLocalAssignment

import com.android.dx.rop.code.RegisterSpec; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public RegisterSpec getLocalAssignment() {
    RegisterSpec assignment;

    if (insn.getOpcode().getOpcode() == RegOps.MARK_LOCAL) {
        assignment = insn.getSources().get(0);
    } else {
        assignment = getResult();
    }

    if (assignment == null) {
        return null;
    }

    LocalItem local = assignment.getLocalItem();

    if (local == null) {
        return null;
    }

    return assignment;
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:24,代码来源:NormalSsaInsn.java


示例19: printLocalVars

import com.android.dx.rop.code.RegisterSpec; //导入依赖的package包/类
/**
 * Dumps local variable table to stdout for debugging.
 */
private void printLocalVars() {
    System.out.println("Printing local vars");
    for (Map.Entry<LocalItem, ArrayList<RegisterSpec>> e :
            localVariables.entrySet()) {
        StringBuilder regs = new StringBuilder();

        regs.append('{');
        regs.append(' ');
        for (RegisterSpec reg : e.getValue()) {
            regs.append('v');
            regs.append(reg.getReg());
            regs.append(' ');
        }
        regs.append('}');
        System.out.printf("Local: %s Registers: %s\n", e.getKey(), regs);
    }
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:21,代码来源:FirstFitLocalCombiningAllocator.java


示例20: map

import com.android.dx.rop.code.RegisterSpec; //导入依赖的package包/类
/**
 *
 * @param sources old register set
 * @return new mapped register set, or old if nothing has changed.
 */
public final RegisterSpecSet map(RegisterSpecSet sources) {
    int sz = sources.getMaxSize();
    RegisterSpecSet newSources = new RegisterSpecSet(getNewRegisterCount());

    for (int i = 0; i < sz; i++) {
        RegisterSpec registerSpec = sources.get(i);
        if (registerSpec != null) {
            newSources.put(map(registerSpec));
        }
    }

    newSources.setImmutable();

    // Return the old sources if nothing has changed.
    return newSources.equals(sources) ? sources : newSources;
}
 
开发者ID:johnlee175,项目名称:dex,代码行数:22,代码来源:RegisterMapper.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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