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


Java VarInsnNode类代码示例

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


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

示例1: getMethodTransformers

import org.objectweb.asm.tree.VarInsnNode; //导入依赖的package包/类
@Override
public MethodTransformer[] getMethodTransformers() {
	MethodTransformer loadWorldTransformer = new MethodTransformer() {
		public String getMethodName() {return CoreLoader.isObfuscated ? "a" : "loadWorld";}
		public String getDescName() {return "(L" + (CoreLoader.isObfuscated ? "bnq" : Type.getInternalName(WorldClient.class)) + ";Ljava/lang/String;)V";}
		
		public void transform(ClassNode classNode, MethodNode method, boolean obfuscated) {
			CLTLog.info("Found method: " + method.name + " " + method.desc);
			CLTLog.info("begining at start of method " + getMethodName());
			
			//TransformerUtil.onWorldLoad(WorldClient worldClientIn)
			InsnList toInsert = new InsnList();
			toInsert.add(new VarInsnNode(ALOAD, 1)); //worldClientIn
			toInsert.add(new MethodInsnNode(INVOKESTATIC, Type.getInternalName(TransformerUtil.class),
					"onWorldLoad", "(L" + Type.getInternalName(WorldClient.class) + ";)V", false));
			method.instructions.insertBefore(method.instructions.getFirst(), toInsert);
		}
	};
	
	return new MethodTransformer[] {loadWorldTransformer};
}
 
开发者ID:18107,项目名称:MC-Ray-Tracer,代码行数:22,代码来源:MinecraftTransformer.java

示例2: visit

import org.objectweb.asm.tree.VarInsnNode; //导入依赖的package包/类
@Override
public void visit(LoadConst.Str node) {
  // use byte strings?
  if (context.compilerSettings.byteStrings()) {
    if (context.compilerSettings.constCaching()) {
      il.add(loadCachedConst(node.value()));
    } else {
      il.add(newByteString(node.value()));
    }
  } else {
    // java.lang.String
    il.add(new LdcInsnNode(node.value()));
  }

  il.add(new VarInsnNode(ASTORE, slot(node.dest())));
}
 
开发者ID:kroepke,项目名称:luna,代码行数:17,代码来源:BytecodeEmitVisitor.java

示例3: toClosureFieldInstance

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

示例4: fetchInstanceInsns

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

示例5: dispatchTable

import org.objectweb.asm.tree.VarInsnNode; //导入依赖的package包/类
private InsnList dispatchTable(List<LabelNode> extLabels, List<LabelNode> resumptionLabels,
    LabelNode errorStateLabel) {
  InsnList il = new InsnList();

  assert (!extLabels.isEmpty());

  ArrayList<LabelNode> labels = new ArrayList<>();
  labels.addAll(extLabels);
  labels.addAll(resumptionLabels);
  LabelNode[] labelArray = labels.toArray(new LabelNode[labels.size()]);

  int min = 1 - extLabels.size();
  int max = resumptionLabels.size();

  il.add(new VarInsnNode(ILOAD, LV_RESUME));
  il.add(new TableSwitchInsnNode(min, max, errorStateLabel, labelArray));
  return il;
}
 
开发者ID:kroepke,项目名称:luna,代码行数:19,代码来源:RunMethod.java

示例6: createSnapshot

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

  il.add(new VarInsnNode(ALOAD, 0));  // this
  il.add(new VarInsnNode(ALOAD, 0));
  il.add(new VarInsnNode(ILOAD, LV_RESUME));
  if (context.isVararg()) {
    il.add(new VarInsnNode(ALOAD, LV_VARARGS));
  }
  for (int i = 0; i < numOfRegisters(); i++) {
    il.add(new VarInsnNode(ALOAD, slotOffset() + i));
  }
  il.add(snapshotMethodInvokeInsn());

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

示例7: getMethodTransformers

import org.objectweb.asm.tree.VarInsnNode; //导入依赖的package包/类
@Override
public MethodTransformer[] getMethodTransformers() {
	MethodTransformer transformLoadWorld = new MethodTransformer() {

		@Override
		public MethodName getName() {
			return Names.Minecraft_loadWorld;
		}

		@Override
		public void transform(ClassNode classNode, MethodNode method, boolean obfuscated) {
			CLTLog.info("Found method: " + method.name + " " + method.desc);
			CLTLog.info("begining at start of method " + getName().all());
			
			InsnList toInsert = new InsnList();
			toInsert.add(new VarInsnNode(ALOAD, 1)); //worldClientIn
			toInsert.add(new MethodInsnNode(INVOKESTATIC, Type.getInternalName(RenderUtil.class),
					"onWorldLoad", "(L" + Type.getInternalName(WorldClient.class) + ";)V", false));
			method.instructions.insertBefore(method.instructions.getFirst(), toInsert);
		}
	};
	
	return new MethodTransformer[] {transformLoadWorld};
}
 
开发者ID:shaunlebron,项目名称:flex-fov,代码行数:25,代码来源:MinecraftTransformer.java

示例8: transform

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

示例9: transform

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

示例10: establishCallback

import org.objectweb.asm.tree.VarInsnNode; //导入依赖的package包/类
public static void establishCallback(ClassNode cn, MethodNode mn) {
    if (!mn.desc.startsWith("()")) {
        MethodNode blank = new MethodNode();
        Method method = new Method(mn.name, mn.desc);
        GeneratorAdapter adapter = new GeneratorAdapter(mn.access, method, blank);
        adapter.visitCode();
        adapter.push(cn.name + "." + mn.name + "  " + mn.desc);
        adapter.loadArgArray();
        adapter.invokeStatic(Type.getType(CallFactory.class), new Method("testInvoke",
                "(Ljava/lang/String;[Ljava/lang/Object;)V"));
        for (AbstractInsnNode ain : mn.instructions.toArray()) {
            if (ain instanceof VarInsnNode) {
                mn.instructions.insertBefore(ain, blank.instructions);
                return;
            }
        }
    }
}
 
开发者ID:disassemble-io,项目名称:agent-callback,代码行数:19,代码来源:CallFactory.java

示例11: patchMethod

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

示例12: patch

import org.objectweb.asm.tree.VarInsnNode; //导入依赖的package包/类
@Override
public ClassVisitor patch(String className, ClassVisitor delegate) throws Exception {
	return new FindingVisitor(
		delegate,
		new VarInsnNode(ALOAD, 4),
		new LdcInsnNode(7000L),
		new MethodInsnNode(INVOKEVIRTUAL, "java/lang/Thread", "join", "(J)V", false)
	) {
		@Override
		public void handle(InsnList nodes, MethodVisitor visitor) {
			visitor.visitVarInsn(ALOAD, 4);
			visitor.visitFieldInsn(GETSTATIC, "org/squiddev/cctweaks/lua/Config$Computer", "computerThreadTimeout", "I");
			visitor.visitInsn(I2L);
			visitor.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Thread", "join", "(J)V", false);
		}
	}.onMethod("run").once().mustFind();
}
 
开发者ID:SquidDev-CC,项目名称:CCTweaks-Lua,代码行数:18,代码来源:CustomTimeout.java

示例13: convertVarLoadInsn

import org.objectweb.asm.tree.VarInsnNode; //导入依赖的package包/类
private void convertVarLoadInsn(VarInsnNode insn) {
	int op = insn.getOpcode();
	boolean dword = op == LLOAD || op == DLOAD;
	StackFrame frame = getFrame(insn);
	Operand[] out = frame.out();
	Operand opr;
	if (out == null) {
		opr = new Operand(insn, getLocal(insn.var));
		frame.out(opr);
	} else {
		opr = out[0];
	}
	if (dword)
		pushDual(opr);
	else
		push(opr);
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:18,代码来源:AsmMethodSource.java

示例14: convertVarStoreInsn

import org.objectweb.asm.tree.VarInsnNode; //导入依赖的package包/类
private void convertVarStoreInsn(VarInsnNode insn) {
	int op = insn.getOpcode();
	boolean dword = op == LSTORE || op == DSTORE;
	StackFrame frame = getFrame(insn);
	Operand opr = dword ? popDual() : pop();
	Local local = getLocal(insn.var);
	if (!units.containsKey(insn)) {
		DefinitionStmt as = Jimple.v().newAssignStmt(local, opr.stackOrValue());
		opr.addBox(as.getRightOpBox());
		frame.boxes(as.getRightOpBox());
		frame.in(opr);
		setUnit(insn, as);
	} else {
		frame.mergeIn(opr);
	}
	assignReadOps(local);
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:18,代码来源:AsmMethodSource.java

示例15: insnEqual

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


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