本文整理汇总了Java中jdk.internal.org.objectweb.asm.tree.AbstractInsnNode类的典型用法代码示例。如果您正苦于以下问题:Java AbstractInsnNode类的具体用法?Java AbstractInsnNode怎么用?Java AbstractInsnNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AbstractInsnNode类属于jdk.internal.org.objectweb.asm.tree包,在下文中一共展示了AbstractInsnNode类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newOperation
import jdk.internal.org.objectweb.asm.tree.AbstractInsnNode; //导入依赖的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);
}
示例2: unaryOperation
import jdk.internal.org.objectweb.asm.tree.AbstractInsnNode; //导入依赖的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);
}
示例3: checkNoForName
import jdk.internal.org.objectweb.asm.tree.AbstractInsnNode; //导入依赖的package包/类
private static void checkNoForName(MethodNode m) throws Exception {
Iterator<AbstractInsnNode> it = m.instructions.iterator();
while (it.hasNext()) {
AbstractInsnNode n = it.next();
if (n instanceof MethodInsnNode) {
MethodInsnNode met = (MethodInsnNode) n;
if (met.name.equals("forName")
&& met.owner.equals("java/lang/Class")
&& met.desc.equals("(Ljava/lang/String;)Ljava/lang/Class;")) {
throw new Exception("forName not removed in " + m.name);
}
}
}
for (TryCatchBlockNode tcb : m.tryCatchBlocks) {
if (tcb.type.equals(ClassNotFoundException.class.getName().replaceAll("\\.", "/"))) {
throw new Exception("ClassNotFoundException Block not removed for " + m.name);
}
}
}
示例4: analyse
import jdk.internal.org.objectweb.asm.tree.AbstractInsnNode; //导入依赖的package包/类
@Override
protected String analyse(ClassNode node) {
System.out.println("[ Actor ]\n^ " + node.name + " extends " + node.superName);
node.interfaces.add("org/beatbot/injection/interfaces/IActor");
List<List<AbstractInsnNode>> results = Assembly.findAll(node, Mask.GETFIELD.describe("I"),Mask.LDC.distance(1), Mask.IMUL.distance(1), Mask.LDC.distance(1),Mask.INVOKESTATIC.distance(1));
if(results != null)
{
for(List<AbstractInsnNode> insns : results)
{
FieldInsnNode fin = (FieldInsnNode) insns.get(0);
LdcInsnNode ldc = (LdcInsnNode) insns.get(1);
//public static void addMethod(ClassNode node, String owner,String fieldName, String fieldDesc, String methodName, String returnType,int multiplier,boolean statc)
GenericUtils.addMethod(node,fin.owner,fin.name,fin.desc,"getAnimation","()I",(int)ldc.cst,false);
System.out.println(" * getAnimation() -> " + fin.desc + " " + fin.owner + "." + fin.name+ " * " + ldc.cst);
break;
}
}
classnames.put("Actor", node.name);
classnode = node;
return "Actor";
}
示例5: newOperation
import jdk.internal.org.objectweb.asm.tree.AbstractInsnNode; //导入依赖的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);
}
示例6: unaryOperation
import jdk.internal.org.objectweb.asm.tree.AbstractInsnNode; //导入依赖的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);
}
示例7: StackFrame
import jdk.internal.org.objectweb.asm.tree.AbstractInsnNode; //导入依赖的package包/类
public StackFrame(StackTraceElement trace) {
this.trace = trace;
Predicate<AbstractInsnNode> lineNumber = instanceOf(LineNumberNode.class, line -> line.line == trace.getLineNumber());
aClass = lazy(() -> Class.forName(trace.getClassName()));
classNode = lazy(() -> Asm.classNode(aClass.value()));
methodNode = lazy(() -> Asm.methods(classNode.value()).
filter(m -> m.name.equals(trace.getMethodName())).
filter(m -> Asm.instructions(m).exists(lineNumber)).
head());
instructions = lazy(() -> Asm.instructions(methodNode.value()).
dropWhile(not(lineNumber)).tail().
takeWhile(not(instanceOf(LineNumberNode.class))).
memoize());
method = lazy(() -> sequence(aClass.value().getDeclaredMethods()).
filter(m -> m.getName().equals(trace.getMethodName())).
filter(m -> sequence(Type.getArgumentTypes(m)).
equals(sequence(Type.getArgumentTypes(methodNode.value().desc)))).
head());
constructor = lazy(() -> sequence(aClass.value().getDeclaredConstructors()).
filter(c -> sequence(Asm.getArgumentTypes(c)).
equals(sequence(Type.getArgumentTypes(methodNode.value().desc)))).
head());
}
示例8: naryOperation
import jdk.internal.org.objectweb.asm.tree.AbstractInsnNode; //导入依赖的package包/类
@Override
public BasicValue naryOperation(final AbstractInsnNode insn,
final List<? extends BasicValue> values) throws AnalyzerException {
int opcode = insn.getOpcode();
if (opcode == MULTIANEWARRAY) {
return newValue(Type.getType(((MultiANewArrayInsnNode) insn).desc));
} else if (opcode == INVOKEDYNAMIC) {
return newValue(Type
.getReturnType(((InvokeDynamicInsnNode) insn).desc));
} else {
return newValue(Type.getReturnType(((MethodInsnNode) insn).desc));
}
}
示例9: binaryOperation
import jdk.internal.org.objectweb.asm.tree.AbstractInsnNode; //导入依赖的package包/类
@Override
public SourceValue binaryOperation(final AbstractInsnNode insn,
final SourceValue value1, final SourceValue value2) {
int size;
switch (insn.getOpcode()) {
case LALOAD:
case DALOAD:
case LADD:
case DADD:
case LSUB:
case DSUB:
case LMUL:
case DMUL:
case LDIV:
case DDIV:
case LREM:
case DREM:
case LSHL:
case LSHR:
case LUSHR:
case LAND:
case LOR:
case LXOR:
size = 2;
break;
default:
size = 1;
}
return new SourceValue(size, insn);
}
示例10: naryOperation
import jdk.internal.org.objectweb.asm.tree.AbstractInsnNode; //导入依赖的package包/类
@Override
public SourceValue naryOperation(final AbstractInsnNode insn,
final List<? extends SourceValue> values) {
int size;
int opcode = insn.getOpcode();
if (opcode == MULTIANEWARRAY) {
size = 1;
} else {
String desc = (opcode == INVOKEDYNAMIC) ? ((InvokeDynamicInsnNode) insn).desc
: ((MethodInsnNode) insn).desc;
size = Type.getReturnType(desc).getSize();
}
return new SourceValue(size, insn);
}
示例11: returnOperation
import jdk.internal.org.objectweb.asm.tree.AbstractInsnNode; //导入依赖的package包/类
@Override
public void returnOperation(final AbstractInsnNode insn,
final BasicValue value, final BasicValue expected)
throws AnalyzerException {
if (!isSubTypeOf(value, expected)) {
throw new AnalyzerException(insn, "Incompatible return type",
expected, value);
}
}