List of usage examples for org.objectweb.asm Opcodes ACC_PROTECTED
int ACC_PROTECTED
To view the source code for org.objectweb.asm Opcodes ACC_PROTECTED.
Click Source Link
From source file:cz.vutbr.fit.xhriba01.bc.lib.Utils.java
License:Open Source License
/** * Creates text representation of asm class access flag. * /*from www.ja v a2 s . c o m*/ * @param flag asm class access flag * @return formatted string representing the access flag */ public static String formatClassAccessFlags(int flag) { List<String> accesses = new ArrayList<>(); if ((flag & Opcodes.ACC_PUBLIC) != 0) { accesses.add("public"); } if ((flag & Opcodes.ACC_PROTECTED) != 0) { accesses.add("protected"); } if ((flag & Opcodes.ACC_PRIVATE) != 0) { accesses.add("private"); } if ((flag & Opcodes.ACC_STATIC) != 0) { accesses.add("static"); } if ((flag & Opcodes.ACC_ABSTRACT) != 0) { accesses.add("abstract"); } if ((flag & Opcodes.ACC_FINAL) != 0) { accesses.add("final"); } if ((flag & Opcodes.ACC_ENUM) != 0) { accesses.add("enum"); } else if ((flag & Opcodes.ACC_INTERFACE) != 0) { accesses.add("interface"); } else { accesses.add("class"); } return join(accesses.toArray(new String[accesses.size()]), " "); }
From source file:de.sanandrew.core.manpack.transformer.AnnotationChecker.java
License:Creative Commons License
private static int getAccessLevelInt(int access) { if (checkBitwiseEqual(access, Opcodes.ACC_PRIVATE)) { return 0; } else if (checkBitwiseEqual(access, Opcodes.ACC_PROTECTED)) { return 2; } else if (checkBitwiseEqual(access, Opcodes.ACC_PUBLIC)) { return 3; } else { // if ACC_PACKAGE_LOCAL return 1; }/*from w ww . j a v a 2 s . c o m*/ }
From source file:de.sanandrew.core.manpack.transformer.AnnotationChecker.java
License:Creative Commons License
private static String getAccessLevelName(int access) { if (checkBitwiseEqual(access, Opcodes.ACC_PRIVATE)) { return "private"; } else if (checkBitwiseEqual(access, Opcodes.ACC_PROTECTED)) { return "protected"; } else if (checkBitwiseEqual(access, Opcodes.ACC_PUBLIC)) { return "public"; } else { // if ACC_PACKAGE_LOCAL return "packageLocal"; }//from w w w . j a v a 2 s.c o m }
From source file:de.sanandrew.core.manpack.transformer.AnnotationChecker.java
License:Creative Commons License
private static int getAccessLevelOpcode(String accessName) { String[] accessSplit = accessName.split(";"); int ret = 0;// w w w . j a v a 2 s. c om for (String acc : accessSplit) { switch (acc) { case "private": ret |= Opcodes.ACC_PRIVATE; break; case "protected": ret |= Opcodes.ACC_PROTECTED; break; case "public": ret |= Opcodes.ACC_PUBLIC; break; case "deprecated": ret |= Opcodes.ACC_DEPRECATED; break; } } return ret; }
From source file:de.scoopgmbh.copper.instrument.MethodInfo.java
License:Apache License
public String getDeclaration() { StringBuilder sb = new StringBuilder(); if ((access & Opcodes.ACC_PRIVATE) != 0) sb.append("private "); if ((access & Opcodes.ACC_PROTECTED) != 0) sb.append("protected "); if ((access & Opcodes.ACC_PUBLIC) != 0) sb.append("public "); if ((access & Opcodes.ACC_STATIC) != 0) sb.append("static "); if ((access & Opcodes.ACC_FINAL) != 0) sb.append("final "); sb.append(Type.getReturnType(descriptor).getClassName()).append(' ').append(methodName).append('('); boolean first = true; for (Type t : Type.getArgumentTypes(descriptor)) { if (!first) sb.append(", "); first = false;/* w ww . ja v a 2s . co m*/ sb.append(t.getClassName()); } sb.append(')'); return sb.toString(); }
From source file:de.zib.sfs.instrument.DirectByteBufferAdapter.java
License:BSD License
@Override protected void appendWrappedMethods(ClassVisitor visitor) { // override from MappedByteBuffer so we can re-init the callback // properly/*from www.j av a 2 s. c o m*/ // public void setFileDescriptor(FileDescriptor fileDescriptor) { MethodVisitor settFileDescriptorMV = visitor.visitMethod(Opcodes.ACC_PUBLIC, "setFileDescriptor", Type.getMethodDescriptor(Type.VOID_TYPE, Type.getType(FileDescriptor.class)), null, null); settFileDescriptorMV.visitCode(); // this.fileDescriptor = fileDescriptor; settFileDescriptorMV.visitVarInsn(Opcodes.ALOAD, 0); settFileDescriptorMV.visitVarInsn(Opcodes.ALOAD, 1); settFileDescriptorMV.visitFieldInsn(Opcodes.PUTFIELD, Type.getInternalName(MappedByteBuffer.class), "fileDescriptor", Type.getDescriptor(FileDescriptor.class)); // callback.openCallback(this.fileDescriptor); settFileDescriptorMV.visitVarInsn(Opcodes.ALOAD, 0); settFileDescriptorMV.visitFieldInsn(Opcodes.GETFIELD, this.instrumentedTypeInternalName, "callback", this.callbackTypeDescriptor); settFileDescriptorMV.visitVarInsn(Opcodes.ALOAD, 0); settFileDescriptorMV.visitFieldInsn(Opcodes.GETFIELD, Type.getInternalName(MappedByteBuffer.class), "fileDescriptor", Type.getDescriptor(FileDescriptor.class)); settFileDescriptorMV.visitMethodInsn(Opcodes.INVOKEVIRTUAL, this.callbackTypeInternalName, "openCallback", Type.getMethodDescriptor(Type.VOID_TYPE, Type.getType(FileDescriptor.class)), false); // } settFileDescriptorMV.visitInsn(Opcodes.RETURN); settFileDescriptorMV.visitMaxs(0, 0); settFileDescriptorMV.visitEnd(); // also override from MappedByteBuffer // protected FileDescriptor getFileDescriptorImpl() { MethodVisitor getFileDescriptorImplMV = visitor.visitMethod(Opcodes.ACC_PROTECTED, "getFileDescriptorImpl", Type.getMethodDescriptor(Type.getType(FileDescriptor.class)), null, null); getFileDescriptorImplMV.visitCode(); // return fileDescriptor; // } getFileDescriptorImplMV.visitVarInsn(Opcodes.ALOAD, 0); getFileDescriptorImplMV.visitFieldInsn(Opcodes.GETFIELD, Type.getInternalName(MappedByteBuffer.class), "fileDescriptor", Type.getDescriptor(FileDescriptor.class)); getFileDescriptorImplMV.visitInsn(Opcodes.ARETURN); getFileDescriptorImplMV.visitMaxs(0, 0); getFileDescriptorImplMV.visitEnd(); if (!skipReads()) { wrapMethod(Opcodes.ACC_PUBLIC, "get", Type.getType(ByteBuffer.class), new Type[] { Type.getType(byte[].class), Type.INT_TYPE, Type.INT_TYPE }, null, null, "getCallback", Type.INT_TYPE, new ParameterResultPasser(3)); } if (!skipWrites()) { wrapMethod(Opcodes.ACC_PUBLIC, "put", Type.getType(ByteBuffer.class), new Type[] { Type.getType(byte[].class), Type.INT_TYPE, Type.INT_TYPE }, null, null, "putCallback", Type.INT_TYPE, new ParameterResultPasser(3)); } if (!skipWrites()) { // public ByteBuffer put(ByteBuffer src) { MethodVisitor bulkPutMV = visitor.visitMethod(Opcodes.ACC_PUBLIC, "put", Type.getMethodDescriptor(Type.getType(ByteBuffer.class), Type.getType(ByteBuffer.class)), null, null); bulkPutMV.visitCode(); // if (isInstrumentationActive()) { isInstrumentationActive(bulkPutMV); Label instrumentationActiveLabel = new Label(); bulkPutMV.visitJumpInsn(Opcodes.IFEQ, instrumentationActiveLabel); // return nativeMethodPrefixput(src); bulkPutMV.visitVarInsn(Opcodes.ALOAD, 0); bulkPutMV.visitVarInsn(Opcodes.ALOAD, 1); bulkPutMV.visitMethodInsn(Opcodes.INVOKESPECIAL, this.instrumentedTypeInternalName, this.methodPrefix + "put", Type.getMethodDescriptor(Type.getType(ByteBuffer.class), Type.getType(ByteBuffer.class)), false); bulkPutMV.visitInsn(Opcodes.ARETURN); // } bulkPutMV.visitLabel(instrumentationActiveLabel); // setInstrumentationActive(fromFileChannel); bulkPutMV.visitVarInsn(Opcodes.ALOAD, 0); bulkPutMV.visitVarInsn(Opcodes.ALOAD, 0); bulkPutMV.visitFieldInsn(Opcodes.GETFIELD, this.instrumentedTypeInternalName, "fromFileChannel", Type.getDescriptor(Boolean.TYPE)); bulkPutMV.visitMethodInsn(Opcodes.INVOKEVIRTUAL, this.instrumentedTypeInternalName, "setInstrumentationActive", Type.getMethodDescriptor(Type.VOID_TYPE, Type.BOOLEAN_TYPE), false); // boolean srcInstrumentationActive = false; bulkPutMV.visitInsn(Opcodes.ICONST_0); bulkPutMV.visitVarInsn(Opcodes.ISTORE, 2); // if (src instanceof MappedByteBuffer) { bulkPutMV.visitVarInsn(Opcodes.ALOAD, 1); bulkPutMV.visitTypeInsn(Opcodes.INSTANCEOF, Type.getInternalName(MappedByteBuffer.class)); Label srcInstanceofMappedByteBufferLabel = new Label(); bulkPutMV.visitJumpInsn(Opcodes.IFEQ, srcInstanceofMappedByteBufferLabel); // srcInstrumentationActive = src.isFromFileChannel(); bulkPutMV.visitVarInsn(Opcodes.ALOAD, 1); bulkPutMV.visitMethodInsn(Opcodes.INVOKEVIRTUAL, Type.getInternalName(MappedByteBuffer.class), "isFromFileChannel", Type.getMethodDescriptor(Type.BOOLEAN_TYPE), false); bulkPutMV.visitVarInsn(Opcodes.ISTORE, 2); // src.setInstrumentationActive(true); bulkPutMV.visitVarInsn(Opcodes.ALOAD, 1); bulkPutMV.visitInsn(Opcodes.ICONST_1); bulkPutMV.visitMethodInsn(Opcodes.INVOKEVIRTUAL, Type.getInternalName(MappedByteBuffer.class), "setInstrumentationActive", Type.getMethodDescriptor(Type.VOID_TYPE, Type.BOOLEAN_TYPE), false); // } bulkPutMV.visitLabel(srcInstanceofMappedByteBufferLabel); // int length = src.remaining(); bulkPutMV.visitVarInsn(Opcodes.ALOAD, 1); bulkPutMV.visitMethodInsn(Opcodes.INVOKEVIRTUAL, Type.getInternalName(Buffer.class), "remaining", Type.getMethodDescriptor(Type.INT_TYPE), false); bulkPutMV.visitVarInsn(Opcodes.ISTORE, 4); // long startTime = System.nanoTime(); bulkPutMV.visitMethodInsn(Opcodes.INVOKESTATIC, this.systemInternalName, "nanoTime", this.nanoTimeDescriptor, false); bulkPutMV.visitVarInsn(Opcodes.LSTORE, 5); // ByteBuffer result = nativeMethodPrefixput(src); bulkPutMV.visitVarInsn(Opcodes.ALOAD, 0); bulkPutMV.visitVarInsn(Opcodes.ALOAD, 1); bulkPutMV.visitMethodInsn(Opcodes.INVOKESPECIAL, this.instrumentedTypeInternalName, this.methodPrefix + "put", Type.getMethodDescriptor(Type.getType(ByteBuffer.class), Type.getType(ByteBuffer.class)), false); bulkPutMV.visitVarInsn(Opcodes.ASTORE, 7); // long endTime = System.nanoTime(); bulkPutMV.visitMethodInsn(Opcodes.INVOKESTATIC, this.systemInternalName, "nanoTime", this.nanoTimeDescriptor, false); bulkPutMV.visitVarInsn(Opcodes.LSTORE, 8); // if (isInstrumentationActive()) { isInstrumentationActive(bulkPutMV); Label instrumentationStillActiveLabel = new Label(); bulkPutMV.visitJumpInsn(Opcodes.IFEQ, instrumentationStillActiveLabel); // callback.putCallback(startTime, endTime, length); bulkPutMV.visitVarInsn(Opcodes.ALOAD, 0); bulkPutMV.visitFieldInsn(Opcodes.GETFIELD, this.instrumentedTypeInternalName, "callback", this.callbackTypeDescriptor); bulkPutMV.visitVarInsn(Opcodes.LLOAD, 5); bulkPutMV.visitVarInsn(Opcodes.LLOAD, 8); bulkPutMV.visitVarInsn(Opcodes.ILOAD, 4); bulkPutMV.visitMethodInsn(Opcodes.INVOKEVIRTUAL, this.callbackTypeInternalName, "putCallback", Type.getMethodDescriptor(Type.VOID_TYPE, Type.LONG_TYPE, Type.LONG_TYPE, Type.INT_TYPE), false); // setInstrumentationActive(false); setInstrumentationActive(bulkPutMV, false); // } bulkPutMV.visitLabel(instrumentationStillActiveLabel); // if (srcInstrumentationActive) { bulkPutMV.visitVarInsn(Opcodes.ILOAD, 2); Label srcInstrumentationActiveLabel = new Label(); bulkPutMV.visitJumpInsn(Opcodes.IFEQ, srcInstrumentationActiveLabel); // callback.onGetEnd(src.getFileDescriptor(), startTime, endTime, // length); bulkPutMV.visitVarInsn(Opcodes.ALOAD, 1); bulkPutMV.visitMethodInsn(Opcodes.INVOKEVIRTUAL, Type.getInternalName(MappedByteBuffer.class), "getFileDescriptor", Type.getMethodDescriptor(Type.getType(FileDescriptor.class)), false); bulkPutMV.visitVarInsn(Opcodes.LLOAD, 5); bulkPutMV.visitVarInsn(Opcodes.LLOAD, 8); bulkPutMV.visitVarInsn(Opcodes.ILOAD, 4); bulkPutMV.visitMethodInsn(Opcodes.INVOKESTATIC, this.callbackTypeInternalName, "getCallback", Type.getMethodDescriptor(Type.VOID_TYPE, Type.getType(FileDescriptor.class), Type.LONG_TYPE, Type.LONG_TYPE, Type.INT_TYPE), false); // src.setInstrumentationActive(false); bulkPutMV.visitVarInsn(Opcodes.ALOAD, 1); bulkPutMV.visitInsn(Opcodes.ICONST_0); bulkPutMV.visitMethodInsn(Opcodes.INVOKEVIRTUAL, Type.getInternalName(MappedByteBuffer.class), "setInstrumentationActive", Type.getMethodDescriptor(Type.VOID_TYPE, Type.BOOLEAN_TYPE), false); // } bulkPutMV.visitLabel(srcInstrumentationActiveLabel); // return result; // } bulkPutMV.visitVarInsn(Opcodes.ALOAD, 7); bulkPutMV.visitInsn(Opcodes.ARETURN); bulkPutMV.visitMaxs(0, 0); bulkPutMV.visitEnd(); } ResultPasser resultDiscarder = new DiscardResultPasser(); // regular gets and puts for (Map.Entry<String, Type> type : TYPES.entrySet()) { if (!skipReads()) { // public TYPE getTYPE() { ... } wrapMethod(Opcodes.ACC_PUBLIC, "get" + type.getKey(), type.getValue(), null, null, null, "get" + type.getKey() + "Callback", null, resultDiscarder); // public TYPE getTYPE(int index) { ... } wrapMethod(Opcodes.ACC_PUBLIC, "get" + type.getKey(), type.getValue(), new Type[] { Type.INT_TYPE }, null, null, "get" + type.getKey() + "Callback", null, resultDiscarder); } if (!skipWrites()) { // public ByteBuffer putTYPE(TYPE value) { ... } wrapMethod(Opcodes.ACC_PUBLIC, "put" + type.getKey(), Type.getType(ByteBuffer.class), new Type[] { type.getValue() }, null, null, "put" + type.getKey() + "Callback", null, resultDiscarder); // public ByteBuffer putTYPE(int index, TYPE value) { ... } wrapMethod(Opcodes.ACC_PUBLIC, "put" + type.getKey(), Type.getType(ByteBuffer.class), new Type[] { Type.INT_TYPE, type.getValue() }, null, null, "put" + type.getKey() + "Callback", null, resultDiscarder); } } visitor.visitEnd(); }
From source file:de.zib.sfs.instrument.MappedByteBufferAdapter.java
License:BSD License
@Override protected void appendFields(ClassVisitor visitor) { // add protected field that DirectByteBuffer can access to see if it was // created by a FileChannelImpl // protected boolean fromFileChannel; FieldVisitor fromFileChannelFV = visitor.visitField(Opcodes.ACC_PROTECTED, "fromFileChannel", Type.getDescriptor(Boolean.TYPE), null, null); fromFileChannelFV.visitEnd();// ww w.j a va 2 s . com // protected FileDescriptor fileDescriptor; FieldVisitor filenameFV = visitor.visitField(Opcodes.ACC_PROTECTED, "fileDescriptor", Type.getDescriptor(FileDescriptor.class), null, null); filenameFV.visitEnd(); }
From source file:de.zib.sfs.instrument.MappedByteBufferAdapter.java
License:BSD License
@Override protected void appendWrappedMethods(ClassVisitor visitor) { // public void setFromFileChannel(boolean fromFileChannel) { MethodVisitor setFromFileChannelMV = visitor.visitMethod(Opcodes.ACC_PUBLIC, "setFromFileChannel", Type.getMethodDescriptor(Type.VOID_TYPE, Type.BOOLEAN_TYPE), null, null); setFromFileChannelMV.visitCode();//from ww w .j av a2 s . c o m // this.fromFileChannel = fromFileChannel; setFromFileChannelMV.visitVarInsn(Opcodes.ALOAD, 0); setFromFileChannelMV.visitVarInsn(Opcodes.ILOAD, 1); setFromFileChannelMV.visitFieldInsn(Opcodes.PUTFIELD, Type.getInternalName(MappedByteBuffer.class), "fromFileChannel", Type.getDescriptor(Boolean.TYPE)); // } setFromFileChannelMV.visitInsn(Opcodes.RETURN); setFromFileChannelMV.visitMaxs(0, 0); setFromFileChannelMV.visitEnd(); // public boolean isFromFileChannel() { MethodVisitor isFromFileChannelMV = visitor.visitMethod(Opcodes.ACC_PUBLIC, "isFromFileChannel", Type.getMethodDescriptor(Type.BOOLEAN_TYPE), null, null); isFromFileChannelMV.visitCode(); // return fromFileChannel; // } isFromFileChannelMV.visitVarInsn(Opcodes.ALOAD, 0); isFromFileChannelMV.visitFieldInsn(Opcodes.GETFIELD, Type.getInternalName(MappedByteBuffer.class), "fromFileChannel", Type.getDescriptor(Boolean.TYPE)); isFromFileChannelMV.visitInsn(Opcodes.IRETURN); isFromFileChannelMV.visitMaxs(0, 0); isFromFileChannelMV.visitEnd(); // public void setFileDescriptor(FileDescriptor fileDescriptor) { MethodVisitor settFileDescriptorMV = visitor.visitMethod(Opcodes.ACC_PUBLIC, "setFileDescriptor", Type.getMethodDescriptor(Type.VOID_TYPE, Type.getType(FileDescriptor.class)), null, null); settFileDescriptorMV.visitCode(); // this.fileDescriptor = fileDescriptor; settFileDescriptorMV.visitVarInsn(Opcodes.ALOAD, 0); settFileDescriptorMV.visitVarInsn(Opcodes.ALOAD, 1); settFileDescriptorMV.visitFieldInsn(Opcodes.PUTFIELD, Type.getInternalName(MappedByteBuffer.class), "fileDescriptor", Type.getDescriptor(FileDescriptor.class)); // } settFileDescriptorMV.visitInsn(Opcodes.RETURN); settFileDescriptorMV.visitMaxs(0, 0); settFileDescriptorMV.visitEnd(); // public FileDescriptor getFileDescriptor() { MethodVisitor getFileDescriptorMV = visitor.visitMethod(Opcodes.ACC_PUBLIC, "getFileDescriptor", Type.getMethodDescriptor(Type.getType(FileDescriptor.class)), null, null); getFileDescriptorMV.visitCode(); // return getFileDescriptorImpl(); // } getFileDescriptorMV.visitVarInsn(Opcodes.ALOAD, 0); getFileDescriptorMV.visitMethodInsn(Opcodes.INVOKESPECIAL, this.instrumentedTypeInternalName, "getFileDescriptorImpl", Type.getMethodDescriptor(Type.getType(FileDescriptor.class)), false); getFileDescriptorMV.visitInsn(Opcodes.ARETURN); getFileDescriptorMV.visitMaxs(0, 0); getFileDescriptorMV.visitEnd(); // protected FileDescriptor getFileDescriptorImpl() { MethodVisitor getFileDescriptorImplMV = visitor.visitMethod(Opcodes.ACC_PROTECTED, "getFileDescriptorImpl", Type.getMethodDescriptor(Type.getType(FileDescriptor.class)), null, null); getFileDescriptorImplMV.visitCode(); // return fileDescriptor; // } getFileDescriptorImplMV.visitVarInsn(Opcodes.ALOAD, 0); getFileDescriptorImplMV.visitFieldInsn(Opcodes.GETFIELD, Type.getInternalName(MappedByteBuffer.class), "fileDescriptor", Type.getDescriptor(FileDescriptor.class)); getFileDescriptorImplMV.visitInsn(Opcodes.ARETURN); getFileDescriptorImplMV.visitMaxs(0, 0); getFileDescriptorImplMV.visitEnd(); visitor.visitEnd(); }
From source file:edu.illinois.nondex.instr.IdentityHashMapShufflingAdder.java
License:Open Source License
public void addNextIndex() { MethodVisitor mv = super.visitMethod(Opcodes.ACC_PROTECTED, "nextIndex", "()I", null, null); mv.visitCode();/*from w w w. j a v a2 s.c om*/ mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitFieldInsn(Opcodes.GETFIELD, "java/util/IdentityHashMap$IdentityHashMapIterator", "this$0", "Ljava/util/IdentityHashMap;"); mv.visitFieldInsn(Opcodes.GETFIELD, "java/util/IdentityHashMap", "modCount", "I"); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitFieldInsn(Opcodes.GETFIELD, "java/util/IdentityHashMap$IdentityHashMapIterator", "expectedModCount", "I"); Label l0 = new Label(); mv.visitJumpInsn(Opcodes.IF_ICMPEQ, l0); mv.visitTypeInsn(Opcodes.NEW, "java/util/ConcurrentModificationException"); mv.visitInsn(Opcodes.DUP); mv.visitMethodInsn(Opcodes.INVOKESPECIAL, "java/util/ConcurrentModificationException", "<init>", "()V", false); mv.visitInsn(Opcodes.ATHROW); mv.visitLabel(l0); mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/util/IdentityHashMap$IdentityHashMapIterator", "hasNext", "()Z", false); Label l1 = new Label(); mv.visitJumpInsn(Opcodes.IFNE, l1); mv.visitTypeInsn(Opcodes.NEW, "java/util/NoSuchElementException"); mv.visitInsn(Opcodes.DUP); mv.visitMethodInsn(Opcodes.INVOKESPECIAL, "java/util/NoSuchElementException", "<init>", "()V", false); mv.visitInsn(Opcodes.ATHROW); mv.visitLabel(l1); mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitFieldInsn(Opcodes.GETFIELD, "java/util/IdentityHashMap$IdentityHashMapIterator", "keys", "Ljava/util/List;"); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitInsn(Opcodes.DUP); mv.visitFieldInsn(Opcodes.GETFIELD, "java/util/IdentityHashMap$IdentityHashMapIterator", "idx", "I"); mv.visitInsn(Opcodes.DUP_X1); mv.visitInsn(Opcodes.ICONST_1); mv.visitInsn(Opcodes.IADD); mv.visitFieldInsn(Opcodes.PUTFIELD, "java/util/IdentityHashMap$IdentityHashMapIterator", "idx", "I"); mv.visitMethodInsn(Opcodes.INVOKEINTERFACE, "java/util/List", "get", "(I)Ljava/lang/Object;", true); mv.visitVarInsn(Opcodes.ASTORE, 1); mv.visitInsn(Opcodes.ICONST_0); mv.visitVarInsn(Opcodes.ISTORE, 2); Label l2 = new Label(); mv.visitLabel(l2); mv.visitFrame(Opcodes.F_APPEND, 2, new Object[] { "java/lang/Object", Opcodes.INTEGER }, 0, null); mv.visitVarInsn(Opcodes.ILOAD, 2); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitFieldInsn(Opcodes.GETFIELD, "java/util/IdentityHashMap$IdentityHashMapIterator", "this$0", "Ljava/util/IdentityHashMap;"); mv.visitFieldInsn(Opcodes.GETFIELD, "java/util/IdentityHashMap", "table", "[Ljava/lang/Object;"); mv.visitInsn(Opcodes.ARRAYLENGTH); Label l3 = new Label(); mv.visitJumpInsn(Opcodes.IF_ICMPGE, l3); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitFieldInsn(Opcodes.GETFIELD, "java/util/IdentityHashMap$IdentityHashMapIterator", "this$0", "Ljava/util/IdentityHashMap;"); mv.visitFieldInsn(Opcodes.GETFIELD, "java/util/IdentityHashMap", "table", "[Ljava/lang/Object;"); mv.visitVarInsn(Opcodes.ILOAD, 2); mv.visitInsn(Opcodes.AALOAD); mv.visitVarInsn(Opcodes.ALOAD, 1); Label l4 = new Label(); mv.visitJumpInsn(Opcodes.IF_ACMPNE, l4); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitVarInsn(Opcodes.ILOAD, 2); mv.visitFieldInsn(Opcodes.PUTFIELD, "java/util/IdentityHashMap$IdentityHashMapIterator", "lastReturnedIndex", "I"); mv.visitJumpInsn(Opcodes.GOTO, l3); mv.visitLabel(l4); mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null); mv.visitIincInsn(2, 2); mv.visitJumpInsn(Opcodes.GOTO, l2); mv.visitLabel(l3); mv.visitFrame(Opcodes.F_CHOP, 1, null, 0, null); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitFieldInsn(Opcodes.GETFIELD, "java/util/IdentityHashMap$IdentityHashMapIterator", "lastReturnedIndex", "I"); mv.visitInsn(Opcodes.IRETURN); mv.visitMaxs(5, 3); mv.visitEnd(); }
From source file:edu.ubc.mirrors.holograms.HologramClassGenerator.java
License:Open Source License
private static int forcePublic(int access) { return (~(Opcodes.ACC_ENUM | Opcodes.ACC_PRIVATE | Opcodes.ACC_PROTECTED) & access) | Opcodes.ACC_PUBLIC; }