changeset 8284:d01bdf1b0f50

Patch to serialization mangler to use official ASM constants. Contributed-by: ksrini
author briangoetz
date Sun, 21 Apr 2013 20:22:10 -0400
parents 720ee175d43d
children 3c6ed69e14df 6e7e8ae1494b
files test-ng/agent/src/com/oracle/lambda/SerializationInjector.java test-ng/build.xml
diffstat 2 files changed, 14 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/test-ng/agent/src/com/oracle/lambda/SerializationInjector.java	Sun Apr 21 16:01:35 2013 -0400
+++ b/test-ng/agent/src/com/oracle/lambda/SerializationInjector.java	Sun Apr 21 20:22:10 2013 -0400
@@ -138,7 +138,7 @@
         Map<String, Integer> locals = getLocals(classBuffer);
         ClassReader classReader = new ClassReader(classBuffer);
         ClassWriter classWriter = new ClassWriter(classReader,
-                ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);
+                ClassWriter.COMPUTE_MAXS /*| ClassWriter.COMPUTE_FRAMES*/);
         classReader.accept(makeSANDVisitor(classWriter, locals), 0);
         byte[] byteArray = classWriter.toByteArray();
 //        CheckClassAdapter.verify(new ClassReader(byteArray), cl, false,
@@ -149,7 +149,7 @@
     Map<String, Integer> getLocals(byte[] classBuffer) {
         ClassReader cr = new ClassReader(classBuffer);
         final Map<String, Integer> locals = new HashMap<>();
-        cr.accept(new ClassVisitor(V1_8, null) {
+        cr.accept(new ClassVisitor(ASM4, null) {
             String cname;
             @Override
             public void visit(int version, int access, String name,
@@ -161,7 +161,7 @@
             @Override
             public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
                 final String mid = cname + "+" + name + "+" + desc + "+" + signature;
-                return new MethodVisitor(V1_8,
+                return new MethodVisitor(ASM4,
                         super.visitMethod(access, name, desc, signature, exceptions)) {
                     @Override
                     public void visitMaxs(int maxStack, int maxLocals) {
@@ -178,7 +178,7 @@
     }
 
     ClassVisitor makeSANDVisitor(ClassWriter cw, final Map<String, Integer>methodLocals) {
-        return new ClassVisitor(V1_8, cw) {
+        return new ClassVisitor(ASM4, cw) {
             String cname = null;
             @Override
             public void visit(int version, int access, String name,
@@ -194,7 +194,7 @@
                 if (name.equals("$deserializeLambda$")) {
                     return super.visitMethod(access, name, desc, signature, exceptions);
                 }
-                return new MethodVisitor(V1_8,
+                return new MethodVisitor(ASM4,
                         super.visitMethod(access, name, desc, signature, exceptions)) {
                     final String mid = cname + "+" + name + "+" + desc + "+" + signature;
                     int locals = methodLocals.containsKey(mid) ? methodLocals.get(mid) : 0;
@@ -298,7 +298,7 @@
     private byte[] injectSerialization(byte[] classBuffer, ClassLoader cl) {
         ClassReader classReader = new ClassReader(classBuffer);
         ClassWriter classWriter = new ClassWriter(classReader,
-                ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);
+                ClassWriter.COMPUTE_MAXS /*| ClassWriter.COMPUTE_FRAMES*/);
         boolean hasNoArgCtor = hasNoArgCtor(classBuffer);
         classReader.accept(makeSerializationVisitor(classWriter, !hasNoArgCtor), 0);
         byte[] byteArray = classWriter.toByteArray();
@@ -314,7 +314,7 @@
 
     private boolean hasNoArgCtor(byte[] buffer) {
         final AtomicBoolean foundNoArg = new AtomicBoolean();
-        new ClassReader(buffer).accept(new ClassVisitor(V1_8, null) {
+        new ClassReader(buffer).accept(new ClassVisitor(ASM4, null) {
             @Override
             public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
                 if (name.equals("<init>") && desc.equals("()V"))
@@ -326,7 +326,7 @@
     }
 
     ClassVisitor makeSerializationVisitor(final ClassWriter cw, final boolean injectNoArg) {
-        return new ClassVisitor(V1_8, cw) {
+        return new ClassVisitor(ASM4, cw) {
             @Override
             public void visit(int version, int access, String name,
                               String signature, String superName,
--- a/test-ng/build.xml	Sun Apr 21 16:01:35 2013 -0400
+++ b/test-ng/build.xml	Sun Apr 21 20:22:10 2013 -0400
@@ -47,6 +47,7 @@
     <property name="agent.jar"       value="${build.dir}/agent/dist/SerializationInjectorAgent.jar" />
     <property name="agent.serial.file" value="${agent.dir}/conf/serialize.list" />
     <property name="agent.rt.jar"    value="${java.home}/lib/rt.jar" />
+    <property name="agent.heap.size" value="-Xmx4g"/>
     <property name="parallel.mode"    value="classes" />
     <property name="parallel.suitePool"    value="1" />
     <property name="parallel.providerPool"    value="1" />
@@ -159,8 +160,9 @@
         <condition property="agent.rt.jar.available">
             <available file="${agent.rt.jar}"/>
         </condition>
-        <echo message="java.home   : ${java.home}"/>
-        <echo message="agent.rt.jar: ${agent.rt.jar}"/>
+        <echo message="java.home        : ${java.home}"/>
+        <echo message="agent.rt.jar     : ${agent.rt.jar}"/>
+        <echo message="agent.heap.size  : ${agent.heap.size}"/>
         <fail message="agent.rt.jar was not found, please set it to a valid rt.jar"
               unless="agent.rt.jar.available"/>
     </target>
@@ -217,7 +219,7 @@
         separately.  This is because serialization/deserialization severs the aliasing that this test
         strategy depends on.  So we mark and exclude these classes.
     -->
-    <target name="test-mangled" depends="test-compile, build-mangler" >
+    <target name="test-mangled" depends="mangler-sanity, test-compile, build-mangler" >
         <testng classpathref="mangled.class.path" outputdir="${test.reports.dir}"
                 excludedgroups="serialization-hostile">
             <classfileset dir="${mangled.tests.dir}" includes="org/openjdk/tests/java/**/*.class"
@@ -232,7 +234,7 @@
             <jvmarg value="-ea" />
             <jvmarg value="-esa" />
             <jvmarg value="-Xverify:none" />
-            <jvmarg value="-Xmx4g" />
+            <jvmarg value="${agent.heap.size}"/>
             <sysproperty key="org.openjdk.java.util.stream.tripwire" value="true"/>
             <!-- properties specific to agent config -->
             <jvmarg value="-Dcom.oracle.lambda.store.frames=false"/>