cp-tools-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Cp-tools-discuss] patch for ASM 2.x support in rmic


From: Archit Shah
Subject: [Cp-tools-discuss] patch for ASM 2.x support in rmic
Date: Thu, 30 Mar 2006 02:04:33 -0500
User-agent: Mozilla Thunderbird 1.0.7-1.1.fc4 (X11/20050929)

As promised in PR 26851 [1], here is a patch for ASM 2.x support in rmic. I held off on jumping to ASM 3.x because it is still in beta [2]. Changing to 3.x from 2.x requires updating two lines of code in RMIC.java. If there are no objections, I'll commit this patch to the cp-tools repository.

 -- Archit

Links.

1. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26851
2. http://forge.objectweb.org/projects/asm/
Index: ChangeLog
===================================================================
RCS file: /cvsroot/classpath/cp-tools/ChangeLog,v
retrieving revision 1.50
diff -u -r1.50 ChangeLog
--- ChangeLog   25 Mar 2006 23:06:07 -0000      1.50
+++ ChangeLog   30 Mar 2006 06:45:03 -0000
@@ -1,3 +1,9 @@
+2006-03-30  Archit Shah  <address@hidden>
+
+       * INSTALL: Updated documentation to reference ASM 2.
+       * src/gnu/classpath/tools/rmi/rmic/RMIC.java:
+       Updated to use ASM 2.x API.
+
 2006-03-25  Michael Koch  <address@hidden>
 
        * src/gnu/localegen/PropertiesGenerator.java:
Index: INSTALL
===================================================================
RCS file: /cvsroot/classpath/cp-tools/INSTALL,v
retrieving revision 1.2
diff -u -r1.2 INSTALL
--- INSTALL     6 Feb 2006 12:38:03 -0000       1.2
+++ INSTALL     30 Mar 2006 06:45:03 -0000
@@ -9,16 +9,15 @@
 In order to build this project, you need to download and install the following
 additional libraries:
 
-  1. ASM 1.5.3. The build will fail with ASM 2.0 or newer versions, because
-     they have many public classes rewritten. 
-     
+  1. ASM 2.x. The build will fail with ASM 1.x and 3.x versions.
+
      The ASM can be downloaded from http://forge.objectweb.org/projects/asm/.
      You must rename the downloaded jar into asm.jar and place into
      /usr/local/share/java/ or /usr/share/java/ . Alternatively (if you
      already have the newer version installed), you may not rename the file,
      place into arbitrary location and use ./configure --with-asm, for 
instance:
      
-     sh configure --with-asm=/usr/local/share/java/asm-1.5.3.jar
+     sh configure --with-asm=/usr/local/share/java/asm-2.2.1.jar
   
   2. bytecode.jar. This archive contains the compiled code fragment from the
      KAWA projec and must be composed manually. The simplies way to do this is
Index: src/gnu/classpath/tools/rmi/rmic/RMIC.java
===================================================================
RCS file: 
/cvsroot/classpath/cp-tools/src/gnu/classpath/tools/rmi/rmic/RMIC.java,v
retrieving revision 1.3
diff -u -r1.3 RMIC.java
--- src/gnu/classpath/tools/rmi/rmic/RMIC.java  2 Aug 2005 17:56:51 -0000       
1.3
+++ src/gnu/classpath/tools/rmi/rmic/RMIC.java  30 Mar 2006 06:45:03 -0000
@@ -56,8 +56,8 @@
 import java.util.StringTokenizer;
 import org.objectweb.asm.ClassVisitor;
 import org.objectweb.asm.ClassWriter;
-import org.objectweb.asm.CodeVisitor;
-import org.objectweb.asm.Constants;
+import org.objectweb.asm.Opcodes;
+import org.objectweb.asm.MethodVisitor;
 import org.objectweb.asm.Label;
 import org.objectweb.asm.Type;
 
@@ -86,7 +86,7 @@
   private List mRemoteInterfaces;
 
   private static class C
-    implements Constants
+    implements Opcodes
   {
   }
 
@@ -261,7 +261,7 @@
 
   private static void generateClassForNamer(ClassVisitor cls)
   {
-    CodeVisitor cv =
+    MethodVisitor cv =
       cls.visitMethod
       (C.ACC_PRIVATE + C.ACC_STATIC + C.ACC_SYNTHETIC, forName,
        Type.getMethodDescriptor
@@ -303,7 +303,7 @@
     cv.visitMaxs(-1, -1);
   }
 
-  private void generateClassConstant(CodeVisitor cv, Class cls) {
+  private void generateClassConstant(MethodVisitor cv, Class cls) {
     if (cls.isPrimitive())
       {
         Class boxCls;
@@ -341,7 +341,7 @@
         new Type[] { Type.getType(String.class) }));
   }
 
-  private void generateClassArray(CodeVisitor code, Class[] classes)
+  private void generateClassArray(MethodVisitor code, Class[] classes)
   {
     code.visitLdcInsn(new Integer(classes.length));
     code.visitTypeInsn(C.ANEWARRAY, typeArg(Class.class));
@@ -354,7 +354,7 @@
       }
   }
 
-  private void fillOperationArray(CodeVisitor clinit)
+  private void fillOperationArray(MethodVisitor clinit)
   {
     // Operations array
     clinit.visitLdcInsn(new Integer(remotemethods.length));
@@ -404,7 +404,7 @@
       }
   }
 
-  private void generateStaticMethodObjs(CodeVisitor clinit)
+  private void generateStaticMethodObjs(MethodVisitor clinit)
   {
     for (int i = 0; i < remotemethods.length; i++)
       {
@@ -456,13 +456,13 @@
       internalNameArray((Class[]) mRemoteInterfaces.toArray(new Class[] {}));
     stub.visit
       (C.V1_2, C.ACC_PUBLIC + C.ACC_FINAL, classInternalName,
-       superInternalName, remoteInternalNames, null);
+       null, superInternalName, remoteInternalNames);
 
     if (need12Stubs)
       {
         stub.visitField
           (C.ACC_PRIVATE + C.ACC_STATIC + C.ACC_FINAL, "serialVersionUID",
-           Type.LONG_TYPE.getDescriptor(), new Long(2L), null);
+           Type.LONG_TYPE.getDescriptor(), null, new Long(2L));
       }
 
     if (need11Stubs)
@@ -470,7 +470,7 @@
         stub.visitField
           (C.ACC_PRIVATE + C.ACC_STATIC + C.ACC_FINAL,
            "interfaceHash", Type.LONG_TYPE.getDescriptor(),
-           new Long(RMIHashes.getInterfaceHash(clazz)), null);
+           null, new Long(RMIHashes.getInterfaceHash(clazz)));
 
         if (need12Stubs)
           {
@@ -497,7 +497,7 @@
           }
       }
 
-    CodeVisitor clinit = stub.visitMethod
+    MethodVisitor clinit = stub.visitMethod
       (C.ACC_STATIC, "<clinit>",
        Type.getMethodDescriptor(Type.VOID_TYPE, new Type[] {}), null, null);
 
@@ -589,7 +589,7 @@
     if (need11Stubs)
       {
         // no arg public constructor
-        CodeVisitor code = stub.visitMethod
+        MethodVisitor code = stub.visitMethod
           (C.ACC_PUBLIC, "<init>",
            Type.getMethodDescriptor(Type.VOID_TYPE, new Type[] {}),
            null, null);
@@ -603,7 +603,7 @@
       }
 
     // public RemoteRef constructor
-    CodeVisitor constructor = stub.visitMethod
+    MethodVisitor constructor = stub.visitMethod
       (C.ACC_PUBLIC, "<init>",
        Type.getMethodDescriptor
        (Type.VOID_TYPE, new Type[] {Type.getType(RemoteRef.class)}),
@@ -626,12 +626,13 @@
         Class[] except = sortExceptions
           ((Class[]) remotemethods[i].exceptions.toArray(new Class[0]));
 
-        CodeVisitor code = stub.visitMethod
+        MethodVisitor code = stub.visitMethod
           (C.ACC_PUBLIC,
            m.getName(),
            Type.getMethodDescriptor(Type.getType(returntype), typeArray(sig)),
-           internalNameArray(typeArray(except)),
-           null);
+           null,
+           internalNameArray(typeArray(except)));
+
 
         final Variables var = new Variables();
 
@@ -1053,20 +1054,19 @@
     classInternalName = skelname.replace('.', '/');
     skel.visit
       (C.V1_1, C.ACC_PUBLIC + C.ACC_FINAL,
-       classInternalName, Type.getInternalName(Object.class),
-       new String[] { Type.getType(Skeleton.class).getInternalName() }, null);
+       classInternalName, null, Type.getInternalName(Object.class),
+       new String[] { Type.getType(Skeleton.class).getInternalName() });
 
     skel.visitField
       (C.ACC_PRIVATE + C.ACC_STATIC + C.ACC_FINAL, "interfaceHash",
-       Type.LONG_TYPE.getDescriptor(),
-       new Long(RMIHashes.getInterfaceHash(clazz)),
-       null);
+       Type.LONG_TYPE.getDescriptor(), null,
+       new Long(RMIHashes.getInterfaceHash(clazz)));
 
     skel.visitField
       (C.ACC_PRIVATE + C.ACC_STATIC + C.ACC_FINAL, "operations",
        Type.getDescriptor(Operation[].class), null, null);
 
-    CodeVisitor clinit = skel.visitMethod
+    MethodVisitor clinit = skel.visitMethod
       (C.ACC_STATIC, "<clinit>",
        Type.getMethodDescriptor(Type.VOID_TYPE, new Type[] {}), null, null);
 
@@ -1076,7 +1076,7 @@
     clinit.visitMaxs(-1, -1);
 
     // no arg public constructor
-    CodeVisitor init = skel.visitMethod
+    MethodVisitor init = skel.visitMethod
       (C.ACC_PUBLIC, "<init>",
        Type.getMethodDescriptor(Type.VOID_TYPE, new Type[] {}), null, null);
     init.visitVarInsn(C.ALOAD, 0);
@@ -1090,7 +1090,7 @@
      * public Operation[] getOperations()
      * returns a clone of the operations array
      */
-    CodeVisitor getOp = skel.visitMethod
+    MethodVisitor getOp = skel.visitMethod
       (C.ACC_PUBLIC, "getOperations",
        Type.getMethodDescriptor
        (Type.getType(Operation[].class), new Type[] {}),
@@ -1107,7 +1107,7 @@
     getOp.visitMaxs(-1, -1);
 
     // public void dispatch(Remote, RemoteCall, int opnum, long hash)
-    CodeVisitor dispatch = skel.visitMethod
+    MethodVisitor dispatch = skel.visitMethod
       (C.ACC_PUBLIC,
        "dispatch",
        Type.getMethodDescriptor
@@ -1115,8 +1115,8 @@
         new Type[] { Type.getType(Remote.class),
                      Type.getType(RemoteCall.class),
                      Type.INT_TYPE, Type.LONG_TYPE }),
-       new String[] { Type.getInternalName(Exception.class) },
-       null);
+       null,
+       new String[] { Type.getInternalName(Exception.class) });
 
     Variables var = new Variables();
     var.declare("this");
@@ -1228,7 +1228,7 @@
     fos.close();
   }
 
-  private void generateMethodSkel(CodeVisitor cv, Method m, Variables var)
+  private void generateMethodSkel(MethodVisitor cv, Method m, Variables var)
   {
     Class[] sig = m.getParameterTypes();
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]