@Override public void visitMethodInsn(final int opcode, final String owner, final String name, final String desc, final boolean itf) { if (api < Opcodes.ASM5) { super.visitMethodInsn(opcode, owner, name, desc, itf); return; } doVisitMethodInsn(opcode, owner, name, desc, itf); }
@Override public void visitVarInsn(final int opcode, final int var) { if (mv != null) { mv.visitVarInsn(opcode, var); } execute(opcode, var, null); }
@Override public void visitInvokeDynamicInsn( final String name, final String descriptor, final Handle bootstrapMethodHandle, final Object... bootstrapMethodArguments) { super.visitInvokeDynamicInsn(name, descriptor, bootstrapMethodHandle, bootstrapMethodArguments); if (this.locals == null) { labels = null; return; } pop(descriptor); pushDescriptor(descriptor); labels = null; }
push(Opcodes.INTEGER); } else if (value instanceof Long) { push(Opcodes.LONG); push(Opcodes.TOP); } else if (value instanceof Float) { push(Opcodes.FLOAT); } else if (value instanceof Double) { push(Opcodes.DOUBLE); push(Opcodes.TOP); } else if (value instanceof String) { push("java/lang/String"); } else if (value instanceof Type) { int sort = ((Type) value).getSort(); if (sort == Type.OBJECT || sort == Type.ARRAY) { push("java/lang/Class"); } else if (sort == Type.METHOD) { push("java/lang/invoke/MethodType"); } else { throw new IllegalArgumentException(); push("java/lang/invoke/MethodHandle"); } else if (value instanceof ConstantDynamic) { pushDescriptor(((ConstantDynamic) value).getDescriptor()); } else { throw new IllegalArgumentException();
break; case Opcodes.ACONST_NULL: push(Opcodes.NULL); break; case Opcodes.ICONST_M1: case Opcodes.BIPUSH: case Opcodes.SIPUSH: push(Opcodes.INTEGER); break; case Opcodes.LCONST_0: case Opcodes.LCONST_1: push(Opcodes.LONG); push(Opcodes.TOP); break; case Opcodes.FCONST_0: case Opcodes.FCONST_1: case Opcodes.FCONST_2: push(Opcodes.FLOAT); break; case Opcodes.DCONST_0: case Opcodes.DCONST_1: push(Opcodes.DOUBLE); push(Opcodes.TOP); break; case Opcodes.ILOAD: case Opcodes.FLOAD: case Opcodes.ALOAD: push(get(intArg));
break; case Opcodes.ACONST_NULL: push(Opcodes.NULL); break; case Opcodes.ICONST_M1: case Opcodes.BIPUSH: case Opcodes.SIPUSH: push(Opcodes.INTEGER); break; case Opcodes.LCONST_0: case Opcodes.LCONST_1: push(Opcodes.LONG); push(Opcodes.TOP); break; case Opcodes.FCONST_0: case Opcodes.FCONST_1: case Opcodes.FCONST_2: push(Opcodes.FLOAT); break; case Opcodes.DCONST_0: case Opcodes.DCONST_1: push(Opcodes.DOUBLE); push(Opcodes.TOP); break; case Opcodes.ILOAD: case Opcodes.FLOAD: case Opcodes.ALOAD: push(get(iarg));
push(Opcodes.INTEGER); } else if (cst instanceof Long) { push(Opcodes.LONG); push(Opcodes.TOP); } else if (cst instanceof Float) { push(Opcodes.FLOAT); } else if (cst instanceof Double) { push(Opcodes.DOUBLE); push(Opcodes.TOP); } else if (cst instanceof String) { push("java/lang/String"); } else if (cst instanceof Type) { int sort = ((Type) cst).getSort(); if (sort == Type.OBJECT || sort == Type.ARRAY) { push("java/lang/Class"); } else if (sort == Type.METHOD) { push("java/lang/invoke/MethodType"); } else { throw new IllegalArgumentException(); push("java/lang/invoke/MethodHandle"); } else { throw new IllegalArgumentException();
private void pop(final String descriptor) { char firstDescriptorChar = descriptor.charAt(0); if (firstDescriptorChar == '(') { int numSlots = 0; Type[] types = Type.getArgumentTypes(descriptor); for (Type type : types) { numSlots += type.getSize(); } pop(numSlots); } else if (firstDescriptorChar == 'J' || firstDescriptorChar == 'D') { pop(2); } else { pop(1); } }
@Override public void visitFrame(final int type, final int nLocal, final Object[] local, final int nStack, final Object[] stack) { if (type != Opcodes.F_NEW) { // uncompressed frame throw new IllegalStateException( "ClassReader.accept() should be called with EXPAND_FRAMES flag"); } if (mv != null) { mv.visitFrame(type, nLocal, local, nStack, stack); } if (this.locals != null) { this.locals.clear(); this.stack.clear(); } else { this.locals = new ArrayList<Object>(); this.stack = new ArrayList<Object>(); } visitFrameTypes(nLocal, local, this.locals); visitFrameTypes(nStack, stack, this.stack); maxStack = Math.max(maxStack, this.stack.size()); }
public TaintTrackingMethodVisitor(InheritanceMap inheritanceMap, Map<MethodReference.Handle, Set<Integer>> passthroughDataflow, final int api, final MethodVisitor mv, final String owner, int access, String name, String desc, String signature, String[] exceptions) { super(api, new AnalyzerAdapter(owner, access, name, desc, mv)); this.inheritanceMap = inheritanceMap; this.passthroughDataflow = passthroughDataflow; this.analyzerAdapter = (AnalyzerAdapter)this.mv; this.access = access; this.name = name; this.desc = desc; this.signature = signature; this.exceptions = exceptions; }
break; case Opcodes.ACONST_NULL: push(Opcodes.NULL); break; case Opcodes.ICONST_M1: case Opcodes.BIPUSH: case Opcodes.SIPUSH: push(Opcodes.INTEGER); break; case Opcodes.LCONST_0: case Opcodes.LCONST_1: push(Opcodes.LONG); push(Opcodes.TOP); break; case Opcodes.FCONST_0: case Opcodes.FCONST_1: case Opcodes.FCONST_2: push(Opcodes.FLOAT); break; case Opcodes.DCONST_0: case Opcodes.DCONST_1: push(Opcodes.DOUBLE); push(Opcodes.TOP); break; case Opcodes.ILOAD: case Opcodes.FLOAD: case Opcodes.ALOAD: push(get(intArg));
push(Opcodes.INTEGER); } else if (value instanceof Long) { push(Opcodes.LONG); push(Opcodes.TOP); } else if (value instanceof Float) { push(Opcodes.FLOAT); } else if (value instanceof Double) { push(Opcodes.DOUBLE); push(Opcodes.TOP); } else if (value instanceof String) { push("java/lang/String"); } else if (value instanceof Type) { int sort = ((Type) value).getSort(); if (sort == Type.OBJECT || sort == Type.ARRAY) { push("java/lang/Class"); } else if (sort == Type.METHOD) { push("java/lang/invoke/MethodType"); } else { throw new IllegalArgumentException(); push("java/lang/invoke/MethodHandle"); } else if (value instanceof ConstantDynamic) { pushDescriptor(((ConstantDynamic) value).getDescriptor()); } else { throw new IllegalArgumentException();
case 'S': case 'I': push(Opcodes.INTEGER); return; case 'F': push(Opcodes.FLOAT); return; case 'J': push(Opcodes.LONG); push(Opcodes.TOP); return; case 'D': push(Opcodes.DOUBLE); push(Opcodes.TOP); return; case '[': if (index == 0) { push(descriptor); } else { push(descriptor.substring(index, descriptor.length())); push(descriptor.substring(1, descriptor.length() - 1)); } else { push(descriptor.substring(index + 1, descriptor.length() - 1));
@Override public void visitFrame( final int type, final int numLocal, final Object[] local, final int numStack, final Object[] stack) { if (type != Opcodes.F_NEW) { // Uncompressed frame. throw new IllegalArgumentException( "AnalyzerAdapter only accepts expanded frames (see ClassReader.EXPAND_FRAMES)"); } super.visitFrame(type, numLocal, local, numStack, stack); if (this.locals != null) { this.locals.clear(); this.stack.clear(); } else { this.locals = new ArrayList<Object>(); this.stack = new ArrayList<Object>(); } visitFrameTypes(numLocal, local, this.locals); visitFrameTypes(numStack, stack, this.stack); maxLocals = Math.max(maxLocals, this.locals.size()); maxStack = Math.max(maxStack, this.stack.size()); }
@Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { ReplaceVariablesPossibilitiesMethodAdapter actualAdapter = new ReplaceVariablesPossibilitiesMethodAdapter( super.visitMethod(access, name, desc, signature, exceptions), className, name, mutationPossibilityCollector, possibilities, desc, projectVariables.getStaticVariables(className), projectVariables.getClassVariables(className)); AnalyzerAdapter analyzerAdapter = new AnalyzerAdapter(className, access, name, desc, actualAdapter); actualAdapter.setAnlyzeAdapter(analyzerAdapter); return analyzerAdapter; }
break; case Opcodes.ACONST_NULL: push(Opcodes.NULL); break; case Opcodes.ICONST_M1: case Opcodes.BIPUSH: case Opcodes.SIPUSH: push(Opcodes.INTEGER); break; case Opcodes.LCONST_0: case Opcodes.LCONST_1: push(Opcodes.LONG); push(Opcodes.TOP); break; case Opcodes.FCONST_0: case Opcodes.FCONST_1: case Opcodes.FCONST_2: push(Opcodes.FLOAT); break; case Opcodes.DCONST_0: case Opcodes.DCONST_1: push(Opcodes.DOUBLE); push(Opcodes.TOP); break; case Opcodes.ILOAD: case Opcodes.FLOAD: case Opcodes.ALOAD: push(get(intArg));
@Override public void visitFieldInsn(final int opcode, final String owner, final String name, final String desc) { if (mv != null) { mv.visitFieldInsn(opcode, owner, name, desc); } execute(opcode, 0, desc); }