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

Java Opcodes类代码示例

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

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



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

示例1: Dop

import com.android.dx.io.Opcodes; //导入依赖的package包/类
/**
 * Constructs an instance.
 *
 * @param opcode {@code Opcodes.isValid();} the opcode value
 * itself
 * @param family {@code Opcodes.isValid();} the opcode family
 * @param nextOpcode {@code Opcodes.isValid();} what opcode (by
 * number) to try next when attempting to match an opcode to
 * particular arguments; {@code Opcodes.NO_NEXT} to indicate that
 * this is the last opcode to try in a particular chain
 * @param format {@code non-null;} the instruction format
 * @param hasResult whether the opcode has a result register; if so it
 * is always the first register
 */
public Dop(int opcode, int family, int nextOpcode, InsnFormat format,
        boolean hasResult) {
    if (!Opcodes.isValidShape(opcode)) {
        throw new IllegalArgumentException("bogus opcode");
    }

    if (!Opcodes.isValidShape(family)) {
        throw new IllegalArgumentException("bogus family");
    }

    if (!Opcodes.isValidShape(nextOpcode)) {
        throw new IllegalArgumentException("bogus nextOpcode");
    }

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

    this.opcode = opcode;
    this.family = family;
    this.nextOpcode = nextOpcode;
    this.format = format;
    this.hasResult = hasResult;
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:39,代码来源:Dop.java


示例2: getOppositeTest

import com.android.dx.io.Opcodes; //导入依赖的package包/类
/**
 * Gets the opcode for the opposite test of this instance. This is only
 * valid for opcodes which are in fact tests.
 *
 * @return {@code non-null;} the opposite test
 */
public Dop getOppositeTest() {
    switch (opcode) {
        case Opcodes.IF_EQ:  return Dops.IF_NE;
        case Opcodes.IF_NE:  return Dops.IF_EQ;
        case Opcodes.IF_LT:  return Dops.IF_GE;
        case Opcodes.IF_GE:  return Dops.IF_LT;
        case Opcodes.IF_GT:  return Dops.IF_LE;
        case Opcodes.IF_LE:  return Dops.IF_GT;
        case Opcodes.IF_EQZ: return Dops.IF_NEZ;
        case Opcodes.IF_NEZ: return Dops.IF_EQZ;
        case Opcodes.IF_LTZ: return Dops.IF_GEZ;
        case Opcodes.IF_GEZ: return Dops.IF_LTZ;
        case Opcodes.IF_GTZ: return Dops.IF_LEZ;
        case Opcodes.IF_LEZ: return Dops.IF_GTZ;
    }

    throw new IllegalArgumentException("bogus opcode: " + this);
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:25,代码来源:Dop.java


示例3: findOpcodeForInsn

import com.android.dx.io.Opcodes; //导入依赖的package包/类
/**
 * Attempts to fit the given instruction into a specific opcode,
 * returning the opcode whose format that the instruction fits
 * into or {@code null} to indicate that the instruction will need
 * to be expanded. This fitting process starts with the given
 * opcode as a first "best guess" and then pessimizes from there
 * if necessary.
 *
 * @param insn {@code non-null;} the instruction in question
 * @param guess {@code null-ok;} the current guess as to the best
 * opcode; {@code null} means that no simple opcode fits
 * @return {@code null-ok;} a possibly-different opcode; either a
 * {@code non-null} good fit or {@code null} to indicate that no
 * simple opcode fits
 */
private Dop findOpcodeForInsn(DalvInsn insn, Dop guess) {
    /*
     * Note: The initial guess might be null, meaning that an
     * earlier call to this method already determined that there
     * was no possible simple opcode fit.
     */

    while (guess != null) {
        if (guess.getFormat().isCompatible(insn)) {
            /*
             * Don't break out for const_string to generate jumbo version
             * when option is enabled.
             */
            if (!dexOptions.forceJumbo ||
                guess.getOpcode() != Opcodes.CONST_STRING) {
                break;
            }
        }

        guess = Dops.getNextOrNull(guess, dexOptions);
    }

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


示例4: DecodedInstruction

import com.android.dx.io.Opcodes; //导入依赖的package包/类
/**
 * Constructs an instance.
 */
public DecodedInstruction(InstructionCodec format, int opcode,
        int index, IndexType indexType, int target, long literal) {
    if (format == null) {
        throw new NullPointerException("format == null");
    }

    if (!Opcodes.isValidShape(opcode)) {
        throw new IllegalArgumentException("invalid opcode");
    }

    this.format = format;
    this.opcode = opcode;
    this.index = index;
    this.indexType = indexType;
    this.target = target;
    this.literal = literal;
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:21,代码来源:DecodedInstruction.java


示例5: getNextOrNull

import com.android.dx.io.Opcodes; //导入依赖的package包/类
/**
 * Gets the next {@link Dop} in the instruction fitting chain after the
 * given instance, if any.
 *
 * @param opcode {@code non-null;} the opcode
 * @param options {@code non-null;} options, used to determine
 * which opcodes are potentially off-limits
 * @return {@code null-ok;} the next opcode in the same family, in the
 * chain of opcodes to try, or {@code null} if the given opcode is
 * the last in its chain
 */
public static Dop getNextOrNull(Dop opcode, DexOptions options) {
    boolean suppressExtendedOpcodes = !options.canUseExtendedOpcodes();

    for (;;) {
        int nextOpcode = opcode.getNextOpcode();

        if (nextOpcode == Opcodes.NO_NEXT) {
            return null;
        }

        opcode = get(nextOpcode);

        if (suppressExtendedOpcodes && Opcodes.isExtended(nextOpcode)) {
            /*
             * Continuing rather than just returning null here
             * protects against the possibility that an
             * instruction fitting chain might list non-extended
             * opcodes after extended ones.
             */
            continue;
        }

        return opcode;
    }
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:37,代码来源:Dops.java


示例6: getOutsSize

import com.android.dx.io.Opcodes; //导入依赖的package包/类
/**
 * Gets the size of the outgoing arguments area required by this
 * method. This is equal to the largest argument word count of any
 * method referred to by this instance.
 *
 * @return {@code >= 0;} the required outgoing arguments size
 */
public int getOutsSize() {
    int sz = size();
    int result = 0;

    for (int i = 0; i < sz; i++) {
        DalvInsn insn = (DalvInsn) get0(i);

        if (!(insn instanceof CstInsn)) {
            continue;
        }

        Constant cst = ((CstInsn) insn).getConstant();

        if (!(cst instanceof CstBaseMethodRef)) {
            continue;
        }

        boolean isStatic =
            (insn.getOpcode().getFamily() == Opcodes.INVOKE_STATIC);
        int count =
            ((CstBaseMethodRef) cst).getParameterWordCount(isStatic);

        if (count > result) {
            result = count;
        }
    }

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


示例7: get

import com.android.dx.io.Opcodes; //导入依赖的package包/类
/**
 * Gets the {@link Dop} for the given opcode value.
 *
 * @param opcode {@code Opcodes.MIN_VALUE..Opcodes.MAX_VALUE;} the
 * opcode value
 * @return {@code non-null;} the associated opcode instance
 */
public static Dop get(int opcode) {
    int idx = opcode - Opcodes.MIN_VALUE;

    try {
        Dop result = DOPS[idx];
        if (result != null) {
            return result;
        }
    } catch (ArrayIndexOutOfBoundsException ex) {
        // Fall through.
    }

    throw new IllegalArgumentException("bogus opcode");
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:22,代码来源:Dops.java


示例8: getNextOrNull

import com.android.dx.io.Opcodes; //导入依赖的package包/类
/**
 * Gets the next {@link Dop} in the instruction fitting chain after the
 * given instance, if any.
 *
 * @param opcode {@code non-null;} the opcode
 * @param options {@code non-null;} options, used to determine
 * which opcodes are potentially off-limits
 * @return {@code null-ok;} the next opcode in the same family, in the
 * chain of opcodes to try, or {@code null} if the given opcode is
 * the last in its chain
 */
public static Dop getNextOrNull(Dop opcode, DexOptions options) {
  int nextOpcode = opcode.getNextOpcode();

  if (nextOpcode == Opcodes.NO_NEXT) {
    return null;
  }

  opcode = get(nextOpcode);

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


示例9: writeTo

import com.android.dx.io.Opcodes; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public void writeTo(AnnotatedOutput out) {
    if (codeSize() != 0) {
        out.writeShort(InsnFormat.codeUnit(Opcodes.NOP, 0));
    }
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:8,代码来源:OddSpacer.java


示例10: visit

import com.android.dx.io.Opcodes; //导入依赖的package包/类
public void visit(DecodedInstruction[] all, DecodedInstruction one) {
    int stringId = one.getIndex();
    int mappedId = indexMap.adjustString(stringId);
    boolean isJumbo = (one.getOpcode() == Opcodes.CONST_STRING_JUMBO);
    jumboCheck(isJumbo, mappedId);
    mappedInstructions[mappedAt++] = one.withIndex(mappedId);
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:8,代码来源:InstructionTransformer.java


示例11: decode

import com.android.dx.io.Opcodes; //导入依赖的package包/类
/**
 * Decodes an instruction from the given input source.
 */
public static DecodedInstruction decode(CodeInput in) throws EOFException {
    int opcodeUnit = in.read();
    int opcode = Opcodes.extractOpcodeFromUnit(opcodeUnit);
    InstructionCodec format = OpcodeInfo.getFormat(opcode);

    return format.decode(opcodeUnit, in);
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:11,代码来源:DecodedInstruction.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java ArtifactStoreBuilder类代码示例发布时间:2022-05-23
下一篇:
Java InterpreterException类代码示例发布时间: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