org.objectweb.asm.Type.getOpcode()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(81)

本文整理了Java中org.objectweb.asm.Type.getOpcode()方法的一些代码示例,展示了Type.getOpcode()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Type.getOpcode()方法的具体详情如下:
包路径:org.objectweb.asm.Type
类名称:Type
方法名:getOpcode

Type.getOpcode介绍

[英]Returns a JVM instruction opcode adapted to this Java type. This method must not be used for method types.
[中]返回适用于此Java类型的JVM指令操作码。此方法不能用于方法类型。

代码示例

代码示例来源:origin: cglib/cglib

public void array_load(Type type) { mv.visitInsn(type.getOpcode(Constants.IALOAD)); }
public void array_store(Type type) { mv.visitInsn(type.getOpcode(Constants.IASTORE)); }

代码示例来源:origin: cglib/cglib

public void math(int op, Type type) { mv.visitInsn(type.getOpcode(op)); }

代码示例来源:origin: cglib/cglib

public void array_store(Type type) { mv.visitInsn(type.getOpcode(Constants.IASTORE)); }

代码示例来源:origin: cglib/cglib

public void array_load(Type type) { mv.visitInsn(type.getOpcode(Constants.IALOAD)); }
public void array_store(Type type) { mv.visitInsn(type.getOpcode(Constants.IASTORE)); }

代码示例来源:origin: cglib/cglib

public void array_store(Type type) { mv.visitInsn(type.getOpcode(Constants.IASTORE)); }

代码示例来源:origin: cglib/cglib

public void math(int op, Type type) { mv.visitInsn(type.getOpcode(op)); }

代码示例来源:origin: cglib/cglib

public void return_value() {
  mv.visitInsn(state.sig.getReturnType().getOpcode(Constants.IRETURN));
}

代码示例来源:origin: cglib/cglib

public void return_value() {
  mv.visitInsn(state.sig.getReturnType().getOpcode(Constants.IRETURN));
}

代码示例来源:origin: pxb1988/dex2jar

mv.visitInsn(DUP);
if (hasThis) {
  mv.visitVarInsn(ALOAD, 0);
  start = 1;
} else {
  mv.visitInsn(ACONST_NULL);
  start = 0;
  mv.visitInsn(ACONST_NULL);
} else {
  mv.visitLdcInsn(args.length);
    mv.visitInsn(DUP);
    mv.visitLdcInsn(i);
    mv.visitVarInsn(args[i].getOpcode(ILOAD), i + start);
    box(args[i], mv);
    mv.visitInsn(AASTORE);
mv.visitInsn(ret.getOpcode(IRETURN));
mv.visitMaxs(-1, -1);
mv.visitEnd();

代码示例来源:origin: JCTools/JCTools

for (Class<?> parameterType : parameterTypes) {
  int localIndexOfParameter = locals.newLocal(parameterType);
  int loadOpCode = Type.getType(parameterType).getOpcode(Opcodes.ILOAD);
  methodVisitor.visitVarInsn(loadOpCode, localIndexOfParameter);
  methodVisitor.visitTypeInsn(Opcodes.CHECKCAST, Type.getInternalName(returnType));
int returnOpcode = Type.getType(returnType).getOpcode(Opcodes.IRETURN);
methodVisitor.visitInsn(returnOpcode);

代码示例来源:origin: pxb1988/dex2jar

mv.visitVarInsn(ILOAD, 3);
mv.visitFieldInsn(PUTFIELD, typeName, "idx", "I");
mv.visitInsn(RETURN);
mv.visitMaxs(-1, -1);
mv.visitEnd();
mv.visitVarInsn(ALOAD, 0);
mv.visitFieldInsn(GETFIELD, typeName, "args", "[Ljava/lang/Object;");
mv.visitInsn(ARETURN);
mv.visitMaxs(-1, -1);
mv.visitEnd();
mv.visitVarInsn(ALOAD, 0);
mv.visitFieldInsn(GETFIELD, typeName, "thiz", "Ljava/lang/Object;");
mv.visitInsn(ARETURN);
mv.visitMaxs(-1, -1);
mv.visitEnd();
  mv.visitInsn(ret.getOpcode(IRETURN));

代码示例来源:origin: glowroot/glowroot

@RequiresNonNull("type")
private void addShim(ShimType shimType) {
  for (java.lang.reflect.Method reflectMethod : shimType.shimMethods()) {
    Method method = Method.getMethod(reflectMethod);
    Shim shim = reflectMethod.getAnnotation(Shim.class);
    checkNotNull(shim);
    if (shim.value().length != 1) {
      throw new IllegalStateException(
          "@Shim annotation must have exactly one value when used on methods");
    }
    Method targetMethod = Method.getMethod(shim.value()[0]);
    MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, method.getName(), method.getDescriptor(),
        null, null);
    mv.visitCode();
    int i = 0;
    mv.visitVarInsn(ALOAD, i++);
    for (Type argumentType : method.getArgumentTypes()) {
      mv.visitVarInsn(argumentType.getOpcode(ILOAD), i++);
    }
    mv.visitMethodInsn(INVOKEVIRTUAL, type.getInternalName(), targetMethod.getName(),
        targetMethod.getDescriptor(), false);
    mv.visitInsn(method.getReturnType().getOpcode(IRETURN));
    mv.visitMaxs(0, 0);
    mv.visitEnd();
  }
}

代码示例来源:origin: org.ow2.asm/asm-commons

/**
 * Generates the instruction to load an element from an array.
 *
 * @param type the type of the array element to be loaded.
 */
public void arrayLoad(final Type type) {
 mv.visitInsn(type.getOpcode(Opcodes.IALOAD));
}

代码示例来源:origin: org.ow2.asm/asm-commons

/**
 * Generates the instruction to store an element in an array.
 *
 * @param type the type of the array element to be stored.
 */
public void arrayStore(final Type type) {
 mv.visitInsn(type.getOpcode(Opcodes.IASTORE));
}

代码示例来源:origin: org.ow2.asm/asm-commons

/**
 * Generates the instruction to do the specified mathematical or logical operation.
 *
 * @param op a mathematical or logical operation. Must be one of ADD, SUB, MUL, DIV, REM, NEG,
 *     SHL, SHR, USHR, AND, OR, XOR.
 * @param type the type of the operand(s) for this operation.
 */
public void math(final int op, final Type type) {
 mv.visitInsn(type.getOpcode(op));
}

代码示例来源:origin: org.ow2.asm/asm-debug-all

/**
 * Generates the instruction to store an element in an array.
 * 
 * @param type
 *            the type of the array element to be stored.
 */
public void arrayStore(final Type type) {
  mv.visitInsn(type.getOpcode(Opcodes.IASTORE));
}

代码示例来源:origin: org.ow2.asm/asm-debug-all

/**
 * Generates the instruction to return the top stack value to the caller.
 */
public void returnValue() {
  mv.visitInsn(returnType.getOpcode(Opcodes.IRETURN));
}

代码示例来源:origin: org.ow2.asm/asm-debug-all

/**
 * Generates the instruction to load an element from an array.
 * 
 * @param type
 *            the type of the array element to be loaded.
 */
public void arrayLoad(final Type type) {
  mv.visitInsn(type.getOpcode(Opcodes.IALOAD));
}

代码示例来源:origin: org.apache.aries.spifly/org.apache.aries.spifly.dynamic.bundle

/**
 * Generates the instruction to load an element from an array.
 *
 * @param type the type of the array element to be loaded.
 */
public void arrayLoad(final Type type) {
 mv.visitInsn(type.getOpcode(Opcodes.IALOAD));
}

代码示例来源:origin: org.apache.aries.spifly/org.apache.aries.spifly.dynamic.framework.extension

/**
 * Generates the instruction to do the specified mathematical or logical operation.
 *
 * @param op a mathematical or logical operation. Must be one of ADD, SUB, MUL, DIV, REM, NEG,
 *     SHL, SHR, USHR, AND, OR, XOR.
 * @param type the type of the operand(s) for this operation.
 */
public void math(final int op, final Type type) {
 mv.visitInsn(type.getOpcode(op));
}

相关文章