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


Java FieldInsnNode类代码示例

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


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

示例1: newOperation

import org.objectweb.asm.tree.FieldInsnNode; //导入依赖的package包/类
@Override
public SourceValue newOperation(final AbstractInsnNode insn) {
    int size;
    switch (insn.getOpcode()) {
    case LCONST_0:
    case LCONST_1:
    case DCONST_0:
    case DCONST_1:
        size = 2;
        break;
    case LDC:
        Object cst = ((LdcInsnNode) insn).cst;
        size = cst instanceof Long || cst instanceof Double ? 2 : 1;
        break;
    case GETSTATIC:
        size = Type.getType(((FieldInsnNode) insn).desc).getSize();
        break;
    default:
        size = 1;
    }
    return new SourceValue(size, insn);
}
 
开发者ID:ItzSomebody,项目名称:DirectLeaks-AntiReleak-Remover,代码行数:23,代码来源:SourceInterpreter.java

示例2: unaryOperation

import org.objectweb.asm.tree.FieldInsnNode; //导入依赖的package包/类
@Override
public SourceValue unaryOperation(final AbstractInsnNode insn,
        final SourceValue value) {
    int size;
    switch (insn.getOpcode()) {
    case LNEG:
    case DNEG:
    case I2L:
    case I2D:
    case L2D:
    case F2L:
    case F2D:
    case D2L:
        size = 2;
        break;
    case GETFIELD:
        size = Type.getType(((FieldInsnNode) insn).desc).getSize();
        break;
    default:
        size = 1;
    }
    return new SourceValue(size, insn);
}
 
开发者ID:ItzSomebody,项目名称:DirectLeaks-AntiReleak-Remover,代码行数:24,代码来源:SourceInterpreter.java

示例3: updateState

import org.objectweb.asm.tree.FieldInsnNode; //导入依赖的package包/类
private void updateState(FieldInsnNode insn) {
  Type type = Type.getType(insn.desc);
  switch (insn.getOpcode()) {
    case Opcodes.GETSTATIC:
      state.push(type);
      break;
    case Opcodes.PUTSTATIC:
      state.pop();
      break;
    case Opcodes.GETFIELD: {
      state.pop(JarState.OBJECT_TYPE);
      state.push(type);
      break;
    }
    case Opcodes.PUTFIELD: {
      state.pop();
      state.pop(JarState.OBJECT_TYPE);
      break;
    }
    default:
      throw new Unreachable("Unexpected FieldInsn opcode: " + insn.getOpcode());
  }
}
 
开发者ID:inferjay,项目名称:r8,代码行数:24,代码来源:JarSourceCode.java

示例4: toClosureFieldInstance

import org.objectweb.asm.tree.FieldInsnNode; //导入依赖的package包/类
public RunMethod.ClosureFieldInstance toClosureFieldInstance() {
  assert (this.isClosed());

  FieldNode fieldNode = instanceFieldNode();

  InsnList il = new InsnList();
  il.add(new VarInsnNode(ALOAD, 0));
  il.add(instantiationInsns());
  il.add(new FieldInsnNode(
      PUTFIELD,
      context.thisClassType().getInternalName(),
      instanceFieldName(),
      instanceType().getDescriptor()));

  return new RunMethod.ClosureFieldInstance(instanceFieldNode(), il);
}
 
开发者ID:kroepke,项目名称:luna,代码行数:17,代码来源:BytecodeEmitVisitor.java

示例5: fetchInstanceInsns

import org.objectweb.asm.tree.FieldInsnNode; //导入依赖的package包/类
private InsnList fetchInstanceInsns() {
  InsnList il = new InsnList();

  if (this.isClosed()) {
    if (this.isPure()) {
      il.add(new FieldInsnNode(
          GETSTATIC,
          instanceType().getInternalName(),
          ASMBytecodeEmitter.instanceFieldName(),
          instanceType().getDescriptor()));
    } else {
      il.add(new VarInsnNode(ALOAD, 0));
      il.add(new FieldInsnNode(
          GETFIELD,
          context.thisClassType().getInternalName(),
          instanceFieldName(),
          instanceType().getDescriptor()));
    }
  } else {
    il.add(instantiationInsns());
  }

  return il;
}
 
开发者ID:kroepke,项目名称:luna,代码行数:25,代码来源:BytecodeEmitVisitor.java

示例6: transform

import org.objectweb.asm.tree.FieldInsnNode; //导入依赖的package包/类
@Override
public void transform(ClassNode clazz, MethodNode method, InsnMatcher matcher) {
	method.tryCatchBlocks.clear();
	method.localVariables.clear();
	method.instructions.clear();

	/* this.loginHandlerList.put(SteamIdAsString, loginHandler); */
	method.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0));
	method.instructions.add(new FieldInsnNode(Opcodes.GETFIELD, "com/wurmonline/server/steam/SteamHandler", "loginHandlerList", "Ljava/util/Map;"));
	method.instructions.add(new VarInsnNode(Opcodes.ALOAD, 1));
	method.instructions.add(new VarInsnNode(Opcodes.ALOAD, 2));
	method.instructions.add(new MethodInsnNode(Opcodes.INVOKEINTERFACE, "java/util/Map", "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;", true));
	method.instructions.add(new InsnNode(Opcodes.POP));

	/* return true; */
	method.instructions.add(new InsnNode(Opcodes.ICONST_1));
	method.instructions.add(new InsnNode(Opcodes.IRETURN));
}
 
开发者ID:jonathanedgecombe,项目名称:anvil,代码行数:19,代码来源:SteamAuthDuplicateTransformer.java

示例7: build

import org.objectweb.asm.tree.FieldInsnNode; //导入依赖的package包/类
public static CallGraph build(Map<String, ClassFactory> classes, boolean includeFields) {
    CallGraph graph = new CallGraph();
    ClassMethodVisitor callVisitor = new ClassMethodVisitor() {
        public void visitMethodInsn(MethodInsnNode min) {
            if (classes.containsKey(min.owner)) {
                graph.addClassCall(min.owner, method);
                graph.addMethodCall(min.owner + "." + min.name + min.desc, method);
            }
        }
        public void visitFieldInsn(FieldInsnNode fin) {
            if (includeFields && classes.containsKey(fin.owner)) {
                graph.addClassCall(fin.owner, method);
            }
            if (classes.containsKey(fin.owner)) {
                graph.addFieldCall(fin.owner + "." + fin.name, method);
            }
        }
    };
    classes.values().forEach(factory -> factory.dispatch(callVisitor));
    return graph;
}
 
开发者ID:disassemble-io,项目名称:kNN,代码行数:22,代码来源:CallGraph.java

示例8: collectAdvancedData

import org.objectweb.asm.tree.FieldInsnNode; //导入依赖的package包/类
private static void collectAdvancedData(Map<String, ClassFactory> classes) {
    linearized.forEach((method, list) -> {
        list.stream().filter(ain -> ain instanceof FieldInsnNode).forEach(ain -> {
            int index = list.indexOf(ain);
            int dist = 3;
            if (index - dist >= 0 && index + dist < list.size()) {
                FieldInsnNode fin = (FieldInsnNode) ain;
                String key = (fin.owner + "." + fin.name);
                int sum = 0;
                for (int i = 0; i < dist; i++) {
                    AbstractInsnNode p = list.get(index - i);
                    AbstractInsnNode n = list.get(index + i);
                    int extraP = extraWeight(classes, p);
                    int extraN = extraWeight(classes, n);
                    sum += (p.getOpcode() + extraP + n.getOpcode() + extraN);
                }
                boolean getter = (fin.getOpcode() == GETFIELD || fin.getOpcode() == GETSTATIC);
                Map<String, List<Integer>> map = (getter ? getsums : putsums);
                if (!map.containsKey(key)) {
                    map.put(key, new ArrayList<>());
                }
                map.get(key).add(sum);
            }
        });
    });
}
 
开发者ID:disassemble-io,项目名称:kNN,代码行数:27,代码来源:FieldFeatures.java

示例9: patchMethod

import org.objectweb.asm.tree.FieldInsnNode; //导入依赖的package包/类
@Override
public void patchMethod(MethodNode methodNode, ClassNode classNode, boolean obfuscated) {
	AbstractInsnNode insert = ASMUtil.findFirstInstruction(methodNode, Opcodes.DSTORE, 5);
	if (insert == null) return;
	InsnList insnList = new InsnList();
	insnList.add(new VarInsnNode(Opcodes.ALOAD, 0));
	insnList.add(new FieldInsnNode(Opcodes.GETFIELD, obfuscated ? "nh" : "net/minecraft/network/NetHandlerPlayServer", obfuscated ? "b" : "playerEntity", obfuscated ? "Lmw;" : "Lnet/minecraft/entity/player/EntityPlayerMP;"));
	insnList.add(new VarInsnNode(Opcodes.DLOAD, 5));
	insnList.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "com/techjar/vivecraftforge/util/ASMDelegator", "playerEntityReachDistance", obfuscated ? "(Lyz;D)D" : "(Lnet/minecraft/entity/player/EntityPlayer;D)D", false));
	insnList.add(new VarInsnNode(Opcodes.DSTORE, 5));
	methodNode.instructions.insert(insert, insnList);
	VivecraftForgeLog.debug("Inserted delegate method call.");
	
	AbstractInsnNode removeInsn = ASMUtil.findFirstInstruction(methodNode, Opcodes.LDC, 9.0D);
	if (removeInsn != null) {
		int remove = methodNode.instructions.indexOf(removeInsn);
		for (int i = 0; i < 2; i++) {
			methodNode.instructions.remove(methodNode.instructions.get(remove));
		}
		VivecraftForgeLog.debug("Removed variable assignment.");
	} else {
		VivecraftForgeLog.debug("Variable assignment not found.");
	}
}
 
开发者ID:Techjar,项目名称:VivecraftForgeExtensions,代码行数:25,代码来源:ASMHandlerIncreaseReachDistance.java

示例10: isSmokeMethod

import org.objectweb.asm.tree.FieldInsnNode; //导入依赖的package包/类
private boolean isSmokeMethod(MethodNode method)
  {
boolean containsArray = false;
int putstatic = 0;
int getstatic = 0;
  	for(AbstractInsnNode ain : method.instructions.toArray())
  		if(ain.getOpcode() == Opcodes.ANEWARRAY)
  			containsArray = true;
  		else if(ain.getOpcode() == Opcodes.PUTSTATIC || ain.getOpcode() == Opcodes.GETSTATIC)
  			if(((FieldInsnNode)ain).desc.equals("[Ljava/lang/String;"))
  			{
  				if(ain.getOpcode() == Opcodes.PUTSTATIC)
  					putstatic++;
  				else
  					getstatic++;
  			}
  			
  	return containsArray && putstatic == 2 && getstatic == 2;
  }
 
开发者ID:java-deobfuscator,项目名称:deobfuscator,代码行数:20,代码来源:StringEncryptionTransformer.java

示例11: insnEqual

import org.objectweb.asm.tree.FieldInsnNode; //导入依赖的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

示例12: shouldMarkStack

import org.objectweb.asm.tree.FieldInsnNode; //导入依赖的package包/类
public static boolean shouldMarkStack(MethodNode methodNode) {
	for (Iterator<AbstractInsnNode> iterator = methodNode.instructions.iterator(); iterator.hasNext();) {
		AbstractInsnNode insn = iterator.next();
		if (insn instanceof FieldInsnNode) {
			FieldInsnNode field = (FieldInsnNode) insn;
			if (field.getOpcode() == PUTFIELD && field.name.equals("stackContext") &&
					field.owner.equals(AlchemyTransformerManager.HOOK_RESULT_DESC))
				return true;
		}
		if (insn instanceof MethodInsnNode) {
			MethodInsnNode method = (MethodInsnNode) insn;
			if (method.name.equals("operationStack") && method.owner.equals(AlchemyTransformerManager.HOOK_RESULT_DESC))
				return true;
		}
	}
	return false;
}
 
开发者ID:NekoCaffeine,项目名称:Alchemy,代码行数:18,代码来源:TransformerHook.java

示例13: hookClassVariable

import org.objectweb.asm.tree.FieldInsnNode; //导入依赖的package包/类
/**
 * TODO: Complete JavaDoc
 * 
 * @param methodNode
 * @param owner The class of the variable to be hooked
 * @param var The variable to be hooked
 * @param desc
 * @param newClass The class the hooked variable will be stored in
 * @param newVar The variable name the hooked variable will be stored in
 * @param newDesc
 * @param canRead Specifies if the hooked variable should be readable
 * @param canWrite Specifies if the hooked variable should be writable
 */
private void hookClassVariable(MethodNode methodNode, String owner, String var, String desc, String newClass, String newVar, String newDesc, boolean canRead,
		boolean canWrite) {
	Iterator<AbstractInsnNode> insnNodeList = methodNode.instructions.iterator();
	while (insnNodeList.hasNext()) {
		AbstractInsnNode insnNode = insnNodeList.next();
		
		int opcode = insnNode.getOpcode();
		if (opcode == Opcodes.GETFIELD || opcode == Opcodes.PUTFIELD) {
			FieldInsnNode field = (FieldInsnNode)insnNode;
			if (field.owner.equals(owner) && field.name.equals(var) && field.desc.equals(desc)) {
				if (opcode == Opcodes.GETFIELD && canWrite) {
					methodNode.instructions.insert(insnNode, new FieldInsnNode(Opcodes.GETSTATIC, newClass, newVar, newDesc));
					methodNode.instructions.insert(insnNode, new InsnNode(Opcodes.POP));
				} else if (opcode == Opcodes.PUTFIELD && canRead) {
					methodNode.instructions.insertBefore(insnNode, new InsnNode(Opcodes.DUP_X1));
					methodNode.instructions.insert(insnNode, new FieldInsnNode(Opcodes.PUTSTATIC, newClass, newVar, newDesc));
				}
			}
		}
	}
}
 
开发者ID:OrN,项目名称:rscplus,代码行数:35,代码来源:JClassPatcher.java

示例14: hookStaticVariable

import org.objectweb.asm.tree.FieldInsnNode; //导入依赖的package包/类
/**
 * TODO: Complete JavaDoc
 * 
 * @param methodNode
 * @param owner The class of the variable to be hooked
 * @param var The variable to be hooked
 * @param desc
 * @param newClass The class the hooked variable will be stored in
 * @param newVar The variable name the hooked variable will be stored in
 * @param newDesc
 */
private void hookStaticVariable(MethodNode methodNode, String owner, String var, String desc, String newClass, String newVar, String newDesc) {
	Iterator<AbstractInsnNode> insnNodeList = methodNode.instructions.iterator();
	while (insnNodeList.hasNext()) {
		AbstractInsnNode insnNode = insnNodeList.next();
		
		int opcode = insnNode.getOpcode();
		if (opcode == Opcodes.GETSTATIC || opcode == Opcodes.PUTSTATIC) {
			FieldInsnNode field = (FieldInsnNode)insnNode;
			if (field.owner.equals(owner) && field.name.equals(var) && field.desc.equals(desc)) {
				field.owner = newClass;
				field.name = newVar;
				field.desc = newDesc;
			}
		}
	}
}
 
开发者ID:OrN,项目名称:rscplus,代码行数:28,代码来源:JClassPatcher.java

示例15: newOperation

import org.objectweb.asm.tree.FieldInsnNode; //导入依赖的package包/类
public Value newOperation(final AbstractInsnNode insn) {
    int size;
    switch (insn.getOpcode()) {
        case LCONST_0:
        case LCONST_1:
        case DCONST_0:
        case DCONST_1:
            size = 2;
            break;
        case LDC:
            Object cst = ((LdcInsnNode) insn).cst;
            size = cst instanceof Long || cst instanceof Double ? 2 : 1;
            break;
        case GETSTATIC:
            size = Type.getType(((FieldInsnNode) insn).desc).getSize();
            break;
        default:
            size = 1;
    }
    return new DataflowValue(size, insn);
}
 
开发者ID:vilie,项目名称:javify,代码行数:22,代码来源:DataflowInterpreter.java


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