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


Java FieldInsnNode.opcode方法代码示例

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


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

示例1: find

import org.objectweb.asm.tree.FieldInsnNode; //导入方法依赖的package包/类
@Override
public List<FieldHook> find(ClassNode cn) {
	List<FieldHook> list = new ArrayList<FieldHook>();

	MethodNode mn = cn.getMethodByName("toString");

	int n = 0;
	for (AbstractInsnNode ain : mn.instructions.toArray()) {
		if (!(ain instanceof FieldInsnNode))
			continue;

		FieldInsnNode fin = (FieldInsnNode) ain;

		if (fin.opcode() != GETFIELD)
			continue;

		switch (n) {
		case 0:
			list.add(asFieldHook(fin, "rx"));
			break;
		case 1:
			list.add(asFieldHook(fin, "ry"));
			break;
		case 2:
			list.add(asFieldHook(fin, "x"));
			break;
		case 3:
			list.add(asFieldHook(fin, "y"));
			break;
		case 4:
			list.add(asFieldHook(fin, "z"));
			break;
		default:
			break;
		}

		n++;
	}

	return list;
}
 
开发者ID:8BitPlus,项目名称:BitPlus,代码行数:42,代码来源:PositionAnalyser.java

示例2: getTreeSize

import org.objectweb.asm.tree.FieldInsnNode; //导入方法依赖的package包/类
public static TreeSize getTreeSize(AbstractInsnNode ain) {
	int c = 0, p = 0;
	if (ain instanceof InsnNode || ain instanceof IntInsnNode || ain instanceof VarInsnNode
			|| ain instanceof JumpInsnNode || ain instanceof TableSwitchInsnNode
			|| ain instanceof LookupSwitchInsnNode) {
		c = CDS[ain.opcode()];
		p = PDS[ain.opcode()];
	} else if (ain instanceof FieldInsnNode) {
		FieldInsnNode fin = (FieldInsnNode) ain;
		char d = fin.desc.charAt(0);
		switch (fin.opcode()) {
		case GETFIELD: {
			c = 1;
			p = d == 'D' || d == 'J' ? 2 : 1;
			break;
		}
		case GETSTATIC: {
			c = 0;
			p = d == 'D' || d == 'J' ? 2 : 1;
			break;
		}
		case PUTFIELD: {
			c = d == 'D' || d == 'J' ? 3 : 2;
			p = 0;
			break;
		}
		case PUTSTATIC: {
			c = d == 'D' || d == 'J' ? 2 : 1;
			p = 0;
			break;
		}
		default: {
			c = 0;
			p = 0;
			break;
		}
		}
	} else if (ain instanceof MethodInsnNode) {
		MethodInsnNode min = (MethodInsnNode) ain;
		int as = Type.getArgumentsAndReturnSizes(min.desc);
		c = (as >> 2) - (min.opcode() == INVOKEDYNAMIC || min.opcode() == INVOKESTATIC ? 1 : 0);
		p = as & 0x03;
	} else if (ain instanceof LdcInsnNode) {
		Object cst = ((LdcInsnNode) ain).cst;
		p = cst instanceof Double || cst instanceof Long ? 2 : 1;
	} else if (ain instanceof MultiANewArrayInsnNode) {
		c = ((MultiANewArrayInsnNode) ain).dims;
		p = 1;
	}
	return new TreeSize(c, p);
}
 
开发者ID:8BitPlus,项目名称:BitPlus,代码行数:52,代码来源:TreeBuilder.java


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