当前位置: 首页>>代码示例>>Java>>正文


Java IntInsnNode类代码示例

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


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

示例1: updateState

import org.objectweb.asm.tree.IntInsnNode; //导入依赖的package包/类
private void updateState(IntInsnNode insn) {
  switch (insn.getOpcode()) {
    case Opcodes.BIPUSH:
    case Opcodes.SIPUSH: {
      state.push(Type.INT_TYPE);
      break;
    }
    case Opcodes.NEWARRAY: {
      String desc = arrayTypeDesc(insn.operand);
      Type type = Type.getType(desc);
      state.pop();
      state.push(type);
      break;
    }
    default:
      throw new Unreachable("Unexpected IntInsn opcode: " + insn.getOpcode());
  }
}
 
开发者ID:inferjay,项目名称:r8,代码行数:19,代码来源:JarSourceCode.java

示例2: build

import org.objectweb.asm.tree.IntInsnNode; //导入依赖的package包/类
private void build(IntInsnNode insn, IRBuilder builder) {
  switch (insn.getOpcode()) {
    case Opcodes.BIPUSH:
    case Opcodes.SIPUSH: {
      int dest = state.push(Type.INT_TYPE);
      builder.addIntConst(dest, insn.operand);
      break;
    }
    case Opcodes.NEWARRAY: {
      String desc = arrayTypeDesc(insn.operand);
      Type type = Type.getType(desc);
      DexType dexType = application.getTypeFromDescriptor(desc);
      int count = state.pop(Type.INT_TYPE).register;
      int array = state.push(type);
      builder.addNewArrayEmpty(array, count, dexType);
      break;
    }
    default:
      throw new Unreachable("Unexpected IntInsn opcode: " + insn.getOpcode());
  }
}
 
开发者ID:inferjay,项目名称:r8,代码行数:22,代码来源:JarSourceCode.java

示例3: newOperation

import org.objectweb.asm.tree.IntInsnNode; //导入依赖的package包/类
@Override
public BasicValue newOperation(AbstractInsnNode insnNode) throws AnalyzerException {
    switch (insnNode.getOpcode()) {
        case ICONST_0: return new IntegerConstantBasicValue(Type.INT_TYPE, 0);
        case ICONST_1: return new IntegerConstantBasicValue(Type.INT_TYPE, 1);
        case ICONST_2: return new IntegerConstantBasicValue(Type.INT_TYPE, 2);
        case ICONST_3: return new IntegerConstantBasicValue(Type.INT_TYPE, 3);
        case ICONST_4: return new IntegerConstantBasicValue(Type.INT_TYPE, 4);
        case ICONST_5: return new IntegerConstantBasicValue(Type.INT_TYPE, 5);
        case BIPUSH:
        case SIPUSH: return new IntegerConstantBasicValue(Type.INT_TYPE, ((IntInsnNode)insnNode).operand);
        case Opcodes.LDC: {
            Object constant = ((LdcInsnNode)insnNode).cst;
            if (constant instanceof Integer) {
                return new IntegerConstantBasicValue(Type.INT_TYPE, (Integer)constant);
            } else {
                return super.newOperation(insnNode);
            }
        }
        default: return super.newOperation(insnNode);
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:23,代码来源:ESLoggerUsageChecker.java

示例4: transform

import org.objectweb.asm.tree.IntInsnNode; //导入依赖的package包/类
@Override
public void transform(ClassNode clazz, MethodNode method, InsnMatcher matcher) {
	AbstractInsnNode[] match = Iterators.getOnlyElement(matcher.match("BIPUSH ISTORE", m -> {
		IntInsnNode push = (IntInsnNode) m[0];
		if (push.operand != 50) {
			return false;
		}

		VarInsnNode store = (VarInsnNode) m[1];
		LocalVariableNode node = AsmUtils.getLocalVariable(method, store.var, store);
		return node != null && node.name.equals("resource") && node.desc.equals("I");
	}));

	method.instructions.remove(match[0]);
	method.instructions.remove(match[1]);
}
 
开发者ID:jonathanedgecombe,项目名称:anvil,代码行数:17,代码来源:VeinCapTransformer.java

示例5: loadInt

import org.objectweb.asm.tree.IntInsnNode; //导入依赖的package包/类
public static AbstractInsnNode loadInt(int i) {
	switch (i) {
		case -1: return new InsnNode(ICONST_M1);
		case 0:  return new InsnNode(ICONST_0);
		case 1:  return new InsnNode(ICONST_1);
		case 2:  return new InsnNode(ICONST_2);
		case 3:  return new InsnNode(ICONST_3);
		case 4:  return new InsnNode(ICONST_4);
		case 5:  return new InsnNode(ICONST_5);
		default: {
			if (i >= Byte.MIN_VALUE && i <= Byte.MAX_VALUE) return new IntInsnNode(BIPUSH, i);
			else if (i >= Short.MIN_VALUE && i <= Short.MAX_VALUE) return new IntInsnNode(SIPUSH, i);
			else return new LdcInsnNode(i);
		}
	}
}
 
开发者ID:mjanicek,项目名称:rembulan,代码行数:17,代码来源:ASMUtils.java

示例6: insnEqual

import org.objectweb.asm.tree.IntInsnNode; //导入依赖的package包/类
public static boolean insnEqual(AbstractInsnNode node1, AbstractInsnNode node2) {
	if (node1.getType() != node2.getType()) {
		return false;
	} else if (node1.getOpcode() != node2.getOpcode()) {
		return false;
	}

	switch (node2.getType()) {
		case VAR_INSN:
			return varInsnEqual((VarInsnNode) node1, (VarInsnNode) node2);
		case TYPE_INSN:
			return typeInsnEqual((TypeInsnNode) node1, (TypeInsnNode) node2);
		case FIELD_INSN:
			return fieldInsnEqual((FieldInsnNode) node1, (FieldInsnNode) node2);
		case METHOD_INSN:
			return methodInsnEqual((MethodInsnNode) node1, (MethodInsnNode) node2);
		case LDC_INSN:
			return ldcInsnEqual((LdcInsnNode) node1, (LdcInsnNode) node2);
		case IINC_INSN:
			return iincInsnEqual((IincInsnNode) node1, (IincInsnNode) node2);
		case INT_INSN:
			return intInsnEqual((IntInsnNode) node1, (IntInsnNode) node2);
		default:
			return true;
	}
}
 
开发者ID:roryclaasen,项目名称:RorysMod,代码行数:27,代码来源:InstructionComparator.java

示例7: handle

import org.objectweb.asm.tree.IntInsnNode; //导入依赖的package包/类
@Override
public void handle(AbstractInsnNode node) throws IncorrectNodeException {
	super.handle(node);
	LOG.debug(logNode(node));
	checkType(node, IntInsnNode.class);

	ExpressionStack stack = mState.getActiveStack();
	int opCode = node.getOpcode();
	switch (opCode) {
		case Opcodes.BIPUSH:
			stack.push(new PrimaryExpression(opCode, ((IntInsnNode) node).operand, DataType.BYTE));
			break;
		case Opcodes.SIPUSH:
			stack.push(new PrimaryExpression(opCode, ((IntInsnNode) node).operand, DataType.SHORT));
			break;
		case Opcodes.NEWARRAY:
			stack.push(new ArrayCreationExpression(opCode, ((IntInsnNode) node).operand));
			break;
	}
}
 
开发者ID:JozefCeluch,项目名称:thesis-disassembler,代码行数:21,代码来源:IntInsnNodeHandler.java

示例8: insnEqual

import org.objectweb.asm.tree.IntInsnNode; //导入依赖的package包/类
public static boolean insnEqual(AbstractInsnNode node1, AbstractInsnNode node2) {
	if (node1.getOpcode() != node2.getOpcode()) {
		return false;
	}

	switch (node2.getType()) {
		case VAR_INSN:
			return varInsnEqual((VarInsnNode) node1, (VarInsnNode) node2);
		case TYPE_INSN:
			return typeInsnEqual((TypeInsnNode) node1, (TypeInsnNode) node2);
		case FIELD_INSN:
			return fieldInsnEqual((FieldInsnNode) node1, (FieldInsnNode) node2);
		case METHOD_INSN:
			return methodInsnEqual((MethodInsnNode) node1, (MethodInsnNode) node2);
		case LDC_INSN:
			return ldcInsnEqual((LdcInsnNode) node1, (LdcInsnNode) node2);
		case IINC_INSN:
			return iincInsnEqual((IincInsnNode) node1, (IincInsnNode) node2);
		case INT_INSN:
			return intInsnEqual((IntInsnNode) node1, (IntInsnNode) node2);
		default:
			return true;
	}
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Core,代码行数:25,代码来源:InstructionComparator.java

示例9: getPushInstruction

import org.objectweb.asm.tree.IntInsnNode; //导入依赖的package包/类
public static AbstractInsnNode getPushInstruction(int value) {

        if (value == -1) {
            return new InsnNode(Opcodes.ICONST_M1);
        } else if (value == 0) {
            return new InsnNode(Opcodes.ICONST_0);
        } else if (value == 1) {
            return new InsnNode(Opcodes.ICONST_1);
        } else if (value == 2) {
            return new InsnNode(Opcodes.ICONST_2);
        } else if (value == 3) {
            return new InsnNode(Opcodes.ICONST_3);
        } else if (value == 4) {
            return new InsnNode(Opcodes.ICONST_4);
        } else if (value == 5) {
            return new InsnNode(Opcodes.ICONST_5);
        } else if ((value >= -128) && (value <= 127)) {
            return new IntInsnNode(Opcodes.BIPUSH, value);
        } else if ((value >= -32768) && (value <= 32767)) {
            return new IntInsnNode(Opcodes.SIPUSH, value);
        } else {
            return new LdcInsnNode(value);
        }
    }
 
开发者ID:brutusin,项目名称:instrumentation,代码行数:25,代码来源:TreeInstructions.java

示例10: transformMethod

import org.objectweb.asm.tree.IntInsnNode; //导入依赖的package包/类
private void transformMethod( MethodNode method )
{
	for ( int i = 0; i < method.instructions.size(); ++i )
	{
		AbstractInsnNode ins = method.instructions.get( i );
		if ( ins.getOpcode() == BIPUSH )
		{
			IntInsnNode node = ( IntInsnNode ) ins;
			// "Remove" 32 page title limit
			if ( node.operand == 16 )
			{
				TextFormattingLog.info( "Found value 32, assuming it to be the title limit." );
				
				node.setOpcode( SIPUSH );
				node.operand = Short.MAX_VALUE;
			}
		}
	}
}
 
开发者ID:spacechase0,项目名称:TextFormatting,代码行数:20,代码来源:BookValidTransformer.java

示例11: getIntConstOperand

import org.objectweb.asm.tree.IntInsnNode; //导入依赖的package包/类
public static Integer getIntConstOperand (final AbstractInsnNode insn) {
    final int opcode = insn.getOpcode();
    if (Opcodes.ICONST_M1 <= opcode && opcode <= Opcodes.ICONST_5) {
        // The opcodes from ICONST_M1 to ICONST_5 are consecutive.
        return opcode - Opcodes.ICONST_0;

    } else if (opcode == Opcodes.BIPUSH || opcode == Opcodes.SIPUSH) {
        return ((IntInsnNode) insn).operand;

    } else if (opcode == Opcodes.LDC) {
        final LdcInsnNode ldc = (LdcInsnNode) insn;
        if (ldc.cst instanceof Integer) {
            return (Integer) ldc.cst;
        }
    }

    // Not an integer literal load instruction.
    return null;
}
 
开发者ID:mur47x111,项目名称:svm-fasttagging,代码行数:20,代码来源:AsmHelper.java

示例12: getRevision

import org.objectweb.asm.tree.IntInsnNode; //导入依赖的package包/类
public static int getRevision(ClassNode node){
    ListIterator<MethodNode> mnIt = node.methods.listIterator();
    while(mnIt.hasNext()){
        MethodNode mn = mnIt.next();
        if(mn.name.equals("init")){
            ListIterator<AbstractInsnNode> abIn = mn.instructions.iterator();
            while(abIn.hasNext()){
                AbstractInsnNode ain = abIn.next();
                if(ain instanceof IntInsnNode){
                    if(((IntInsnNode) ain).operand == 765){
                        ain = ain.getNext();
                        if(ain instanceof IntInsnNode)
                            if(((IntInsnNode) ain).operand == 503)
                                return ((IntInsnNode)ain.getNext()).operand;
                    }
                }
            }


        }
    }
  return -1;
}
 
开发者ID:NKNScripts,项目名称:Updater,代码行数:24,代码来源:JarUtils.java

示例13: loadIntegerConstant

import org.objectweb.asm.tree.IntInsnNode; //导入依赖的package包/类
private AbstractInsnNode loadIntegerConstant(int c) {
	if (c == -1)
		return new InsnNode(Opcodes.ICONST_M1);
	if (c == 0)
		return new InsnNode(Opcodes.ICONST_0);
	if (c == 1)
		return new InsnNode(Opcodes.ICONST_1);
	if (c == 2)
		return new InsnNode(Opcodes.ICONST_2);
	if (c == 3)
		return new InsnNode(Opcodes.ICONST_3);
	if (c == 4)
		return new InsnNode(Opcodes.ICONST_4);
	if (c == 5)
		return new InsnNode(Opcodes.ICONST_5);
	if (Byte.MIN_VALUE <= c && c <= Byte.MAX_VALUE)
		return new IntInsnNode(Opcodes.BIPUSH, c);
	if (Short.MIN_VALUE <= c && c <= Short.MAX_VALUE)
		return new IntInsnNode(Opcodes.SIPUSH, c);
	return new LdcInsnNode(c);
}
 
开发者ID:jbosboom,项目名称:bytecodelib,代码行数:22,代码来源:MethodUnresolver.java

示例14: statusCodeFor

import org.objectweb.asm.tree.IntInsnNode; //导入依赖的package包/类
private Integer statusCodeFor(MethodInsnNode node) {
  if (node.name.equals("noContent")) {
    return 204;
  }
  if (node.name.equals("with")) {
    AbstractInsnNode previous = node.getPrevious();
    if (previous instanceof IntInsnNode) {
      return ((IntInsnNode) previous).operand;
    }
    if (previous instanceof FieldInsnNode) {
      String owner = ((FieldInsnNode) previous).owner.replace("/", ".");
      if (owner.equals(Status.class.getName())) {
        String statusName = ((FieldInsnNode) previous).name;
        return Try.apply(() -> Status.class.getDeclaredField(statusName).get(null))
            .map(it -> ((Status) it).value())
            .orElse(null);
      }
    }
  }
  return null;
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:22,代码来源:BytecodeRouteParser.java

示例15: getIntConstInsn

import org.objectweb.asm.tree.IntInsnNode; //导入依赖的package包/类
private AbstractInsnNode getIntConstInsn(final int value) {
    switch (value) {
    case -1:
        return new InsnNode(ICONST_M1);
    case 0:
        return new InsnNode(ICONST_0);
    case 1:
        return new InsnNode(ICONST_1);
    case 2:
        return new InsnNode(ICONST_2);
    case 3:
        return new InsnNode(ICONST_3);
    case 4:
        return new InsnNode(ICONST_4);
    case 5:
        return new InsnNode(ICONST_5);
    default:
        if ((byte)value == value)
            return new IntInsnNode(BIPUSH, value);
        else if ((short)value == value)
            return new IntInsnNode(SIPUSH, value);
        else
            return new LdcInsnNode(Integer.valueOf(value));
    }
}
 
开发者ID:hammacher,项目名称:javaslicer,代码行数:26,代码来源:TracingMethodInstrumenter.java


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