From: <cg...@us...> - 2009-09-13 10:00:27
|
Revision: 6793 http://jython.svn.sourceforge.net/jython/?rev=6793&view=rev Author: cgroves Date: 2009-09-13 10:00:14 +0000 (Sun, 13 Sep 2009) Log Message: ----------- Extend MethodAdapter rather than doing the exact same thing ourselves Modified Paths: -------------- branches/customizable-proxymaker/src/org/python/compiler/Code.java Modified: branches/customizable-proxymaker/src/org/python/compiler/Code.java =================================================================== --- branches/customizable-proxymaker/src/org/python/compiler/Code.java 2009-09-12 21:32:08 UTC (rev 6792) +++ branches/customizable-proxymaker/src/org/python/compiler/Code.java 2009-09-13 10:00:14 UTC (rev 6793) @@ -3,26 +3,23 @@ import java.util.BitSet; import java.util.Vector; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.Attribute; import org.objectweb.asm.Label; +import org.objectweb.asm.MethodAdapter; import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; -public class Code implements MethodVisitor, Opcodes { - MethodVisitor mv; - String sig; +public class Code extends MethodAdapter implements Opcodes { + String locals[]; int nlocals; int argcount; int returnLocal; - BitSet finallyLocals = new java.util.BitSet(); + BitSet finallyLocals = new BitSet(); //XXX: I'd really like to get sig and access out of here since MethodVistitor // should already have this information. public Code(MethodVisitor mv, String sig, int access) { - this.mv = mv; - this.sig = sig; + super(mv); nlocals = -sigSize(sig, false); if ((access & ACC_STATIC) != ACC_STATIC) nlocals = nlocals+1; argcount = nlocals; @@ -83,102 +80,6 @@ return ret; } - public AnnotationVisitor visitAnnotation(String arg0, boolean arg1) { - return mv.visitAnnotation(arg0, arg1); - } - - public AnnotationVisitor visitAnnotationDefault() { - return mv.visitAnnotationDefault(); - } - - public void visitAttribute(Attribute arg0) { - mv.visitAttribute(arg0); - } - - public void visitCode() { - mv.visitCode(); - } - - public void visitEnd() { - mv.visitEnd(); - } - - public void visitFieldInsn(int arg0, String arg1, String arg2, String arg3) { - mv.visitFieldInsn(arg0, arg1, arg2, arg3); - } - - public void visitFrame(int arg0, int arg1, Object[] arg2, int arg3, Object[] arg4) { - mv.visitFrame(arg0, arg1, arg2, arg3, arg4); - } - - public void visitIincInsn(int arg0, int arg1) { - mv.visitIincInsn(arg0, arg1); - } - - public void visitInsn(int arg0) { - mv.visitInsn(arg0); - } - - public void visitIntInsn(int arg0, int arg1) { - mv.visitIntInsn(arg0, arg1); - } - - public void visitJumpInsn(int arg0, Label arg1) { - mv.visitJumpInsn(arg0, arg1); - } - - public void visitLabel(Label arg0) { - mv.visitLabel(arg0); - } - - public void visitLdcInsn(Object arg0) { - mv.visitLdcInsn(arg0); - } - - public void visitLineNumber(int arg0, Label arg1) { - mv.visitLineNumber(arg0, arg1); - } - - public void visitLocalVariable(String arg0, String arg1, String arg2, Label arg3, Label arg4, int arg5) { - mv.visitLocalVariable(arg0, arg1, arg2, arg3, arg4, arg5); - } - - public void visitLookupSwitchInsn(Label arg0, int[] arg1, Label[] arg2) { - mv.visitLookupSwitchInsn(arg0, arg1, arg2); - } - - public void visitMaxs(int arg0, int arg1) { - mv.visitMaxs(arg0, arg1); - } - - public void visitMethodInsn(int arg0, String arg1, String arg2, String arg3) { - mv.visitMethodInsn(arg0, arg1, arg2, arg3); - } - - public void visitMultiANewArrayInsn(String arg0, int arg1) { - mv.visitMultiANewArrayInsn(arg0, arg1); - } - - public AnnotationVisitor visitParameterAnnotation(int arg0, String arg1, boolean arg2) { - return mv.visitParameterAnnotation(arg0, arg1, arg2); - } - - public void visitTableSwitchInsn(int arg0, int arg1, Label arg2, Label[] arg3) { - mv.visitTableSwitchInsn(arg0, arg1, arg2, arg3); - } - - public void visitTryCatchBlock(Label arg0, Label arg1, Label arg2, String arg3) { - mv.visitTryCatchBlock(arg0, arg1, arg2, arg3); - } - - public void visitTypeInsn(int arg0, String arg1) { - mv.visitTypeInsn(arg0, arg1); - } - - public void visitVarInsn(int arg0, int arg1) { - mv.visitVarInsn(arg0, arg1); - } - @SuppressWarnings("fallthrough") private int sigSize(String sig, boolean includeReturn) { int stack = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |