Serializable serializable log implemented. Also, when the log gets full threads now wait before making the machine go crazy out of memory. Problems: 1- threads aren't waking up from notifyAll properly. 2- seems like export doesn't happen unless the work threads yield

Jonathan Bell [2012-08-09 03:37:10]
Serializable serializable log implemented. Also, when the log gets full threads now wait before making the machine go crazy out of memory. Problems: 1- threads aren't waking up from notifyAll properly. 2- seems like export doesn't happen unless the work threads yield
Filename
testcase-generation/src/edu/columbia/cs/psl/invivo/record/Constants.java
testcase-generation/src/edu/columbia/cs/psl/invivo/record/ExportedLog.java
testcase-generation/src/edu/columbia/cs/psl/invivo/record/ExportedSerializableLog.java
testcase-generation/src/edu/columbia/cs/psl/invivo/record/Log.java
testcase-generation/src/edu/columbia/cs/psl/invivo/record/MethodCall.java
testcase-generation/src/edu/columbia/cs/psl/invivo/record/SerializableLog.java
testcase-generation/src/edu/columbia/cs/psl/invivo/record/WallaceExportRunner.java
testcase-generation/src/edu/columbia/cs/psl/invivo/record/visitor/CloningAdviceAdapter.java
testcase-generation/src/edu/columbia/cs/psl/invivo/record/visitor/NonDeterministicLoggingClassVisitor.java
testcase-generation/src/edu/columbia/cs/psl/invivo/record/visitor/NonDeterministicLoggingMethodVisitor.java
diff --git a/testcase-generation/src/edu/columbia/cs/psl/invivo/record/Constants.java b/testcase-generation/src/edu/columbia/cs/psl/invivo/record/Constants.java
index e5d677d..c91c52b 100644
--- a/testcase-generation/src/edu/columbia/cs/psl/invivo/record/Constants.java
+++ b/testcase-generation/src/edu/columbia/cs/psl/invivo/record/Constants.java
@@ -9,7 +9,9 @@ public interface Constants {
 	public static String LOG_REPLAY_CLASS = "edu/columbia/cs/psl/invivo/record/ExportedLog";

 	public static int DEFAULT_LOG_SIZE = 1000;
-	public static int MAX_LOG_SIZE = 50000;
+	public static int MAX_LOG_SIZE = 40000000;
+	public static int VERY_MAX_LOG_SIZE = 400000000;
+
 	public static double LOG_GROWTH_RATE = 1.5;
 	public static String REPLAY_CLASS_SUFFIX = "InvivoReplay";
 	public static String INNER_COPY_METHOD_NAME = "_Invivo___copy";
diff --git a/testcase-generation/src/edu/columbia/cs/psl/invivo/record/ExportedLog.java b/testcase-generation/src/edu/columbia/cs/psl/invivo/record/ExportedLog.java
index c803c69..feac8dc 100644
--- a/testcase-generation/src/edu/columbia/cs/psl/invivo/record/ExportedLog.java
+++ b/testcase-generation/src/edu/columbia/cs/psl/invivo/record/ExportedLog.java
@@ -2,37 +2,13 @@ package edu.columbia.cs.psl.invivo.record;

 public class ExportedLog {
 	public static Object[] aLog = new Object[Constants.DEFAULT_LOG_SIZE];
-	public static int[] iLog = new int[Constants.DEFAULT_LOG_SIZE];
-	public static long[] jLog = new long[Constants.DEFAULT_LOG_SIZE];
-	public static float[] fLog = new float[Constants.DEFAULT_LOG_SIZE];
-	public static double[] dLog = new double[Constants.DEFAULT_LOG_SIZE];
-	public static byte[] bLog = new byte[Constants.DEFAULT_LOG_SIZE];
-	public static boolean[] zLog = new boolean[Constants.DEFAULT_LOG_SIZE];
-	public static char[] cLog = new char[Constants.DEFAULT_LOG_SIZE];
-	public static short[] sLog = new short[Constants.DEFAULT_LOG_SIZE];
-	public static Object lock = new Object();
-	public static int aLog_fill, iLog_fill, jLog_fill, fLog_fill, dLog_fill, bLog_fill, zLog_fill, cLog_fill, sLog_fill;
-	public static int aLog_replayIndex , iLog_replayIndex, jLog_replayIndex, fLog_replayIndex, dLog_replayIndex, bLog_replayIndex, zLog_replayIndex, cLog_replayIndex, sLog_replayIndex;
+
+	public static int aLog_fill;
+	public static int aLog_replayIndex;

 	public static void clearLog() {
 		aLog = new Object[Constants.DEFAULT_LOG_SIZE];
-		iLog = new int[Constants.DEFAULT_LOG_SIZE];
-		jLog = new long[Constants.DEFAULT_LOG_SIZE];
-		fLog = new float[Constants.DEFAULT_LOG_SIZE];
-		dLog = new double[Constants.DEFAULT_LOG_SIZE];
-		bLog = new byte[Constants.DEFAULT_LOG_SIZE];
-		zLog = new boolean[Constants.DEFAULT_LOG_SIZE];
-		cLog = new char[Constants.DEFAULT_LOG_SIZE];
-		sLog = new short[Constants.DEFAULT_LOG_SIZE];

 		aLog_fill = 0;
-		iLog_fill = 0;
-		jLog_fill = 0;
-		fLog_fill = 0;
-		dLog_fill = 0;
-		bLog_fill = 0;
-		zLog_fill = 0;
-		cLog_fill = 0;
-		sLog_fill = 0;
 	}
 }
diff --git a/testcase-generation/src/edu/columbia/cs/psl/invivo/record/ExportedSerializableLog.java b/testcase-generation/src/edu/columbia/cs/psl/invivo/record/ExportedSerializableLog.java
index 12bcd76..3d0ffbf 100644
--- a/testcase-generation/src/edu/columbia/cs/psl/invivo/record/ExportedSerializableLog.java
+++ b/testcase-generation/src/edu/columbia/cs/psl/invivo/record/ExportedSerializableLog.java
@@ -6,10 +6,23 @@ import java.io.ObjectOutputStream;
 import java.io.Serializable;

 public class ExportedSerializableLog implements Serializable {
-	public static Serializable[]	aLog	= new Serializable[Constants.DEFAULT_LOG_SIZE];
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = 1166783255069514273L;
+	public static Object[]	aLog	= new Object[Constants.DEFAULT_LOG_SIZE];
+	public static int[] iLog = new int[Constants.DEFAULT_LOG_SIZE];
+	public static long[] jLog = new long[Constants.DEFAULT_LOG_SIZE];
+	public static float[] fLog = new float[Constants.DEFAULT_LOG_SIZE];
+	public static double[] dLog = new double[Constants.DEFAULT_LOG_SIZE];
+	public static byte[] bLog = new byte[Constants.DEFAULT_LOG_SIZE];
+	public static boolean[] zLog = new boolean[Constants.DEFAULT_LOG_SIZE];
+	public static char[] cLog = new char[Constants.DEFAULT_LOG_SIZE];
+	public static short[] sLog = new short[Constants.DEFAULT_LOG_SIZE];
+	public static Object lock = new Object();
+	public static int aLog_fill, iLog_fill, jLog_fill, fLog_fill, dLog_fill, bLog_fill, zLog_fill, cLog_fill, sLog_fill;
+	public static int aLog_replayIndex , iLog_replayIndex, jLog_replayIndex, fLog_replayIndex, dLog_replayIndex, bLog_replayIndex, zLog_replayIndex, cLog_replayIndex, sLog_replayIndex;

-	public static int				aLog_fill;
-	public static int				aLog_replayIndex;

 	public static void clearLog() {
 		aLog = new Serializable[Constants.DEFAULT_LOG_SIZE];
@@ -20,11 +33,43 @@ public class ExportedSerializableLog implements Serializable {
 		oos.defaultWriteObject();
 		oos.writeInt(aLog_fill);
 		oos.writeObject(aLog);
+		oos.writeInt(iLog_fill);
+		oos.writeObject(iLog);
+		oos.writeInt(jLog_fill);
+		oos.writeObject(jLog);
+		oos.writeInt(fLog_fill);
+		oos.writeObject(fLog);
+		oos.writeInt(dLog_fill);
+		oos.writeObject(dLog);
+		oos.writeInt(bLog_fill);
+		oos.writeObject(bLog);
+		oos.writeInt(zLog_fill);
+		oos.writeObject(zLog);
+		oos.writeInt(cLog_fill);
+		oos.writeObject(cLog);
+		oos.writeInt(sLog_fill);
+		oos.writeObject(sLog);
 	}

 	private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
 		ois.defaultReadObject();
 		aLog_fill = ois.readInt();
-		aLog = (Serializable[]) ois.readObject();
+		aLog = (Object[]) ois.readObject();
+		iLog_fill = ois.readInt();
+		iLog = (int[]) ois.readObject();
+		jLog_fill = ois.readInt();
+		jLog = (long[]) ois.readObject();
+		fLog_fill = ois.readInt();
+		fLog = (float[]) ois.readObject();
+		dLog_fill = ois.readInt();
+		dLog = (double[]) ois.readObject();
+		bLog_fill = ois.readInt();
+		bLog = (byte[]) ois.readObject();
+		zLog_fill = ois.readInt();
+		zLog = (boolean[]) ois.readObject();
+		cLog_fill = ois.readInt();
+		cLog = (char[]) ois.readObject();
+		sLog_fill = ois.readInt();
+		sLog = (short[]) ois.readObject();
 	}
 }
\ No newline at end of file
diff --git a/testcase-generation/src/edu/columbia/cs/psl/invivo/record/Log.java b/testcase-generation/src/edu/columbia/cs/psl/invivo/record/Log.java
index cd8abe3..6f9f52d 100644
--- a/testcase-generation/src/edu/columbia/cs/psl/invivo/record/Log.java
+++ b/testcase-generation/src/edu/columbia/cs/psl/invivo/record/Log.java
@@ -2,93 +2,25 @@ package edu.columbia.cs.psl.invivo.record;

 public class Log {
 	public static Object[] aLog = new Object[Constants.DEFAULT_LOG_SIZE];
-	public static int[] iLog = new int[Constants.DEFAULT_LOG_SIZE];
-	public static long[] jLog = new long[Constants.DEFAULT_LOG_SIZE];
-	public static float[] fLog = new float[Constants.DEFAULT_LOG_SIZE];
-	public static double[] dLog = new double[Constants.DEFAULT_LOG_SIZE];
-	public static byte[] bLog = new byte[Constants.DEFAULT_LOG_SIZE];
-	public static boolean[] zLog = new boolean[Constants.DEFAULT_LOG_SIZE];
-	public static char[] cLog = new char[Constants.DEFAULT_LOG_SIZE];
-	public static short[] sLog = new short[Constants.DEFAULT_LOG_SIZE];
+
 	public static Object lock = new Object();
 	public static int logsize = 0;
-	public static int aLog_fill, iLog_fill, jLog_fill, fLog_fill, dLog_fill, bLog_fill, zLog_fill, cLog_fill, sLog_fill;
+	public static int aLog_fill;
 	public static void growaLog()
 	{
 		Object[] newA = new Object[(int) (aLog.length * Constants.LOG_GROWTH_RATE)];
 		System.arraycopy(aLog, 0, newA, 0, aLog.length);
 		aLog = newA;
 	}
-	public static void growiLog()
-	{
-		int[] newA = new int[(int) (aLog.length * Constants.LOG_GROWTH_RATE)];
-		System.arraycopy(iLog, 0, newA, 0, iLog.length);
-		iLog = newA;
-	}
-	public static void growjLog()
-	{
-		long[] newA = new long[(int) (aLog.length * Constants.LOG_GROWTH_RATE)];
-		System.arraycopy(jLog, 0, newA, 0, jLog.length);
-		jLog = newA;
-	}
-	public static void growfLog()
-	{
-		float[] newA = new float[(int) (aLog.length * Constants.LOG_GROWTH_RATE)];
-		System.arraycopy(fLog, 0, newA, 0, fLog.length);
-		fLog = newA;
-	}
-	public static void growdLog()
-	{
-		double[] newA = new double[(int) (aLog.length * Constants.LOG_GROWTH_RATE)];
-		System.arraycopy(dLog, 0, newA, 0, dLog.length);
-		dLog = newA;
-	}
-	public static void growbLog()
-	{
-		byte[] newA = new byte[(int) (aLog.length * Constants.LOG_GROWTH_RATE)];
-		System.arraycopy(bLog, 0, newA, 0, bLog.length);
-		bLog = newA;
-	}
-	public static void growzLog()
-	{
-		boolean[] newA = new boolean[(int) (aLog.length * Constants.LOG_GROWTH_RATE)];
-		System.arraycopy(zLog, 0, newA, 0, zLog.length);
-		zLog = newA;
-	}
-	public static void growcLog()
-	{
-		char[] newA = new char[(int) (aLog.length * Constants.LOG_GROWTH_RATE)];
-		System.arraycopy(cLog, 0, newA, 0, cLog.length);
-		cLog = newA;
-	}
-	public static void growsLog()
-	{
-		short[] newA = new short[(int) (aLog.length * Constants.LOG_GROWTH_RATE)];
-		System.arraycopy(sLog, 0, newA, 0, sLog.length);
-		sLog = newA;
-	}
+
 	public static void clearLog() {
 //		System.err.println("start cl");
 		logsize = 0;
 		aLog = new Object[Constants.DEFAULT_LOG_SIZE];
-		iLog = new int[Constants.DEFAULT_LOG_SIZE];
-		jLog = new long[Constants.DEFAULT_LOG_SIZE];
-		fLog = new float[Constants.DEFAULT_LOG_SIZE];
-		dLog = new double[Constants.DEFAULT_LOG_SIZE];
-		bLog = new byte[Constants.DEFAULT_LOG_SIZE];
-		zLog = new boolean[Constants.DEFAULT_LOG_SIZE];
-		cLog = new char[Constants.DEFAULT_LOG_SIZE];
-		sLog = new short[Constants.DEFAULT_LOG_SIZE];
+

 		aLog_fill = 0;
-		iLog_fill = 0;
-		jLog_fill = 0;
-		fLog_fill = 0;
-		dLog_fill = 0;
-		bLog_fill = 0;
-		zLog_fill = 0;
-		cLog_fill = 0;
-		sLog_fill = 0;
+
 //		System.err.println("starting gc");
 //		System.gc();
 //		System.err.println("Fin gc");
diff --git a/testcase-generation/src/edu/columbia/cs/psl/invivo/record/MethodCall.java b/testcase-generation/src/edu/columbia/cs/psl/invivo/record/MethodCall.java
index 3a8c388..dfc8949 100644
--- a/testcase-generation/src/edu/columbia/cs/psl/invivo/record/MethodCall.java
+++ b/testcase-generation/src/edu/columbia/cs/psl/invivo/record/MethodCall.java
@@ -1,5 +1,7 @@
 package edu.columbia.cs.psl.invivo.record;

+import java.util.HashSet;
+
 import org.objectweb.asm.Type;

 public class MethodCall {
@@ -12,6 +14,11 @@ public class MethodCall {
 	private String methodName;
 	private String methodDesc;
 	private boolean isStatic;
+
+	private static HashSet<String> serializableClasses = new HashSet<String>();
+	static{
+		serializableClasses.add(Type.getType(String.class).getInternalName());
+	}
 	public MethodCall(String sourceMethodName, String sourceMethodDesc, String sourceClass, int pc, int lineNumber, String methodOwner, String methodName, String methodDesc, boolean isStatic) {
 		this.sourceMethodName = sourceMethodName;
 		this.sourceMethodDesc = sourceMethodDesc;
@@ -76,7 +83,9 @@ public class MethodCall {
 	}
 	public static String getLogClassName(Type t)
 	{
-		if(t.getSort() == Type.ARRAY)
+		if((t.getSort() != Type.OBJECT  && t.getSort() != Type.ARRAY)|| //primitives
+				(t.getSort() == Type.OBJECT && serializableClasses.contains(t.getInternalName())) || //serializble
+				(t.getSort() == Type.ARRAY && ((t.getElementType().getSort() != Type.OBJECT && t.getElementType().getSort() != Type.ARRAY)|| serializableClasses.contains(t.getElementType().getInternalName())))) // array of prims or array of serializable
 			return Type.getInternalName(SerializableLog.class);
 		else
 			return Type.getInternalName(Log.class);
diff --git a/testcase-generation/src/edu/columbia/cs/psl/invivo/record/SerializableLog.java b/testcase-generation/src/edu/columbia/cs/psl/invivo/record/SerializableLog.java
index ebd9b66..499e825 100644
--- a/testcase-generation/src/edu/columbia/cs/psl/invivo/record/SerializableLog.java
+++ b/testcase-generation/src/edu/columbia/cs/psl/invivo/record/SerializableLog.java
@@ -5,20 +5,95 @@ import java.io.Serializable;
 public class SerializableLog implements Serializable{

 	private static final long	serialVersionUID	= 4627796984904522647L;
-	public static Serializable[] aLog = new Serializable[Constants.DEFAULT_LOG_SIZE];
+	public static Object[] aLog = new Object[Constants.DEFAULT_LOG_SIZE];
+
+	public static int[] iLog = new int[Constants.DEFAULT_LOG_SIZE];
+	public static long[] jLog = new long[Constants.DEFAULT_LOG_SIZE];
+	public static float[] fLog = new float[Constants.DEFAULT_LOG_SIZE];
+	public static double[] dLog = new double[Constants.DEFAULT_LOG_SIZE];
+	public static byte[] bLog = new byte[Constants.DEFAULT_LOG_SIZE];
+	public static boolean[] zLog = new boolean[Constants.DEFAULT_LOG_SIZE];
+	public static char[] cLog = new char[Constants.DEFAULT_LOG_SIZE];
+	public static short[] sLog = new short[Constants.DEFAULT_LOG_SIZE];
 	public static int logsize = 0;
-	public static int aLog_fill = 0;
+	public static int aLog_fill, iLog_fill, jLog_fill, fLog_fill, dLog_fill, bLog_fill, zLog_fill, cLog_fill, sLog_fill;
+
+
 	public static void growaLog()
 	{
 		Serializable[] newA = new Serializable[(int) (aLog.length * Constants.LOG_GROWTH_RATE)];
 		System.arraycopy(aLog, 0, newA, 0, aLog.length);
 		aLog = newA;
 	}
-
+	public static void growiLog()
+	{
+		int[] newA = new int[(int) (aLog.length * Constants.LOG_GROWTH_RATE)];
+		System.arraycopy(iLog, 0, newA, 0, iLog.length);
+		iLog = newA;
+	}
+	public static void growjLog()
+	{
+		long[] newA = new long[(int) (aLog.length * Constants.LOG_GROWTH_RATE)];
+		System.arraycopy(jLog, 0, newA, 0, jLog.length);
+		jLog = newA;
+	}
+	public static void growfLog()
+	{
+		float[] newA = new float[(int) (aLog.length * Constants.LOG_GROWTH_RATE)];
+		System.arraycopy(fLog, 0, newA, 0, fLog.length);
+		fLog = newA;
+	}
+	public static void growdLog()
+	{
+		double[] newA = new double[(int) (aLog.length * Constants.LOG_GROWTH_RATE)];
+		System.arraycopy(dLog, 0, newA, 0, dLog.length);
+		dLog = newA;
+	}
+	public static void growbLog()
+	{
+		byte[] newA = new byte[(int) (aLog.length * Constants.LOG_GROWTH_RATE)];
+		System.arraycopy(bLog, 0, newA, 0, bLog.length);
+		bLog = newA;
+	}
+	public static void growzLog()
+	{
+		boolean[] newA = new boolean[(int) (aLog.length * Constants.LOG_GROWTH_RATE)];
+		System.arraycopy(zLog, 0, newA, 0, zLog.length);
+		zLog = newA;
+	}
+	public static void growcLog()
+	{
+		char[] newA = new char[(int) (aLog.length * Constants.LOG_GROWTH_RATE)];
+		System.arraycopy(cLog, 0, newA, 0, cLog.length);
+		cLog = newA;
+	}
+	public static void growsLog()
+	{
+		short[] newA = new short[(int) (aLog.length * Constants.LOG_GROWTH_RATE)];
+		System.arraycopy(sLog, 0, newA, 0, sLog.length);
+		sLog = newA;
+	}
 	public static void clearLog() {
 //		System.err.println("start cl");
-		aLog = new Serializable[Constants.DEFAULT_LOG_SIZE];
+		aLog = new Object[Constants.DEFAULT_LOG_SIZE];
+		iLog = new int[Constants.DEFAULT_LOG_SIZE];
+		jLog = new long[Constants.DEFAULT_LOG_SIZE];
+		fLog = new float[Constants.DEFAULT_LOG_SIZE];
+		dLog = new double[Constants.DEFAULT_LOG_SIZE];
+		bLog = new byte[Constants.DEFAULT_LOG_SIZE];
+		zLog = new boolean[Constants.DEFAULT_LOG_SIZE];
+		cLog = new char[Constants.DEFAULT_LOG_SIZE];
+		sLog = new short[Constants.DEFAULT_LOG_SIZE];
 		logsize = 0;
+		iLog_fill = 0;
+		jLog_fill = 0;
+		fLog_fill = 0;
+		dLog_fill = 0;
+		bLog_fill = 0;
+		zLog_fill = 0;
+		cLog_fill = 0;
+		sLog_fill = 0;
+		aLog_fill = 0;
 //		System.err.println("starting gc");
 //		System.gc();
 //		System.err.println("Fin gc");
diff --git a/testcase-generation/src/edu/columbia/cs/psl/invivo/record/WallaceExportRunner.java b/testcase-generation/src/edu/columbia/cs/psl/invivo/record/WallaceExportRunner.java
index 07a24ed..8ae7661 100644
--- a/testcase-generation/src/edu/columbia/cs/psl/invivo/record/WallaceExportRunner.java
+++ b/testcase-generation/src/edu/columbia/cs/psl/invivo/record/WallaceExportRunner.java
@@ -41,12 +41,18 @@ public class WallaceExportRunner extends Thread {
 //							System.out.println("Waking up checking flag");
 							if(shouldExport == 1)
 								export();
+							if(shouldExportSerializable == 1)
+								exportSerializable();
+							if(shouldExport == 1)
+								export();

 		} catch (InterruptedException e) {
 			if(shouldExport == 1)
 				export();
 			if(shouldExportSerializable == 1)
 				exportSerializable();
+			if(shouldExport == 1)
+				export();
 		}
 				}
 	}
@@ -64,25 +70,12 @@ public class WallaceExportRunner extends Thread {
 //			System.out.println("Waiting for the lock");
 			synchronized (Log.lock) {
 				ExportedLog.aLog = Log.aLog;
-				ExportedLog.bLog = Log.bLog;
-				ExportedLog.cLog = Log.cLog;
-				ExportedLog.dLog = Log.dLog;
-				ExportedLog.iLog = Log.iLog;
-				ExportedLog.fLog = Log.fLog;
-				ExportedLog.jLog = Log.jLog;
-				ExportedLog.zLog = Log.zLog;
-				ExportedLog.sLog = Log.sLog;
+

 				ExportedLog.aLog_fill = Log.aLog_fill;
-				ExportedLog.bLog_fill = Log.bLog_fill;
-				ExportedLog.cLog_fill = Log.cLog_fill;
-				ExportedLog.dLog_fill = Log.dLog_fill;
-				ExportedLog.iLog_fill = Log.iLog_fill;
-				ExportedLog.fLog_fill = Log.fLog_fill;
-				ExportedLog.jLog_fill = Log.jLog_fill;
-				ExportedLog.zLog_fill = Log.zLog_fill;
-				ExportedLog.sLog_fill = Log.sLog_fill;
-				Log.clearLog();
+				Log.logsize = 0;
+				Log.aLog = new Object[Constants.DEFAULT_LOG_SIZE];
+				Log.aLog_fill = 0;
 			}
 				System.err.println("Serializing");
 				try{
@@ -92,15 +85,22 @@ public class WallaceExportRunner extends Thread {
 				{
 					System.err.println("NPE" + ex.getMessage());
 				}
-				System.err.println("Clearing");
+//				System.err.println("Clearing");
 				ExportedLog.clearLog();
-				System.err.println("Cleared");
+//				System.err.println("Cleared");

 			//CloningUtils.exportLock.writeLock().unlock();
 			File output = new File("wallace_" + System.currentTimeMillis() + ".log");
 			FileWriter fw = new FileWriter(output);
 			fw.write(xml);
 			fw.close();
+			synchronized (Log.lock) {
+				Log.lock.notifyAll();
+			}
+			synchronized (Log.lock) {
+				Log.lock.notifyAll();
+			}
+

 		} catch (Exception exi) {
 //			System.err.println(exi.getMessage());
@@ -116,23 +116,66 @@ public class WallaceExportRunner extends Thread {
 			synchronized (Log.lock) {
 				ExportedSerializableLog.aLog = SerializableLog.aLog;
 				ExportedSerializableLog.aLog_fill = SerializableLog.aLog_fill;
-				SerializableLog.clearLog();
+				ExportedSerializableLog.bLog = SerializableLog.bLog;
+				ExportedSerializableLog.cLog = SerializableLog.cLog;
+				ExportedSerializableLog.dLog = SerializableLog.dLog;
+				ExportedSerializableLog.iLog = SerializableLog.iLog;
+				ExportedSerializableLog.fLog = SerializableLog.fLog;
+				ExportedSerializableLog.jLog = SerializableLog.jLog;
+				ExportedSerializableLog.zLog = SerializableLog.zLog;
+				ExportedSerializableLog.sLog = SerializableLog.sLog;
+
+				ExportedSerializableLog.bLog_fill = SerializableLog.bLog_fill;
+				ExportedSerializableLog.cLog_fill = SerializableLog.cLog_fill;
+				ExportedSerializableLog.dLog_fill = SerializableLog.dLog_fill;
+				ExportedSerializableLog.iLog_fill = SerializableLog.iLog_fill;
+				ExportedSerializableLog.fLog_fill = SerializableLog.fLog_fill;
+				ExportedSerializableLog.jLog_fill = SerializableLog.jLog_fill;
+				ExportedSerializableLog.zLog_fill = SerializableLog.zLog_fill;
+				ExportedSerializableLog.sLog_fill = SerializableLog.sLog_fill;
+
+
+				SerializableLog.aLog = new Object[Constants.DEFAULT_LOG_SIZE];
+				SerializableLog.iLog = new int[Constants.DEFAULT_LOG_SIZE];
+				SerializableLog.jLog = new long[Constants.DEFAULT_LOG_SIZE];
+				SerializableLog.fLog = new float[Constants.DEFAULT_LOG_SIZE];
+				SerializableLog.dLog = new double[Constants.DEFAULT_LOG_SIZE];
+				SerializableLog.bLog = new byte[Constants.DEFAULT_LOG_SIZE];
+				SerializableLog.zLog = new boolean[Constants.DEFAULT_LOG_SIZE];
+				SerializableLog.cLog = new char[Constants.DEFAULT_LOG_SIZE];
+				SerializableLog.sLog = new short[Constants.DEFAULT_LOG_SIZE];
+				SerializableLog.logsize = 0;
+				SerializableLog.iLog_fill = 0;
+				SerializableLog.jLog_fill = 0;
+				SerializableLog.fLog_fill = 0;
+				SerializableLog.dLog_fill = 0;
+				SerializableLog.bLog_fill = 0;
+				SerializableLog.zLog_fill = 0;
+				SerializableLog.cLog_fill = 0;
+				SerializableLog.sLog_fill = 0;
+				SerializableLog.aLog_fill = 0;
 			}
-				System.err.println("Serializing serializable");
+//				System.err.println("Serializing serializable");
 				File output = new File("wallace_serializable_" + System.currentTimeMillis() + ".log");

 				ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(output));
 				oos.writeObject(logS);
 				oos.flush();
 				oos.close();
-				System.err.println("Clearing serializable");
+//				System.err.println("Clearing serializable");
 				ExportedLog.clearLog();
-				System.err.println("Cleared serializable");
-
+//				System.err.println("Cleared serializable");
+//				System.out.println("Notifying; " + Log.logsize +";"+SerializableLog.logsize);
+				synchronized (Log.lock) {
+					Log.lock.notifyAll();
+				}
+				synchronized (Log.lock) {
+					Log.lock.notifyAll();
+				}
 		} catch (Exception exi) {
 //			System.err.println(exi.getMessage());
 		}
-		shouldExport = -1;
+		shouldExportSerializable = -1;
 	}

 	private static int	shouldExport	= -1;
@@ -140,6 +183,7 @@ public class WallaceExportRunner extends Thread {
 	public static void _exportSerializable() {
 		if(shouldExportSerializable == -1)
 		{
+			System.out.println("Flagged shouldexport serializble");
 			shouldExportSerializable = 1;
 			inst.interrupt();
 		}
diff --git a/testcase-generation/src/edu/columbia/cs/psl/invivo/record/visitor/CloningAdviceAdapter.java b/testcase-generation/src/edu/columbia/cs/psl/invivo/record/visitor/CloningAdviceAdapter.java
index 7fb457c..9f15e57 100644
--- a/testcase-generation/src/edu/columbia/cs/psl/invivo/record/visitor/CloningAdviceAdapter.java
+++ b/testcase-generation/src/edu/columbia/cs/psl/invivo/record/visitor/CloningAdviceAdapter.java
@@ -164,7 +164,7 @@ public class CloningAdviceAdapter extends GeneratorAdapter implements Opcodes {
 			visitLabel(monitorStart);

 			//Lock
-			super.visitFieldInsn(Opcodes.GETSTATIC, logFieldOwner, "lock", "Ljava/lang/Object;");
+			super.visitFieldInsn(Opcodes.GETSTATIC, Type.getInternalName(Log.class), "lock", "Ljava/lang/Object;");
 			dup();
 			super.visitVarInsn(ASTORE, monitorIndx);
 			super.monitorEnter();
@@ -284,22 +284,59 @@ public class CloningAdviceAdapter extends GeneratorAdapter implements Opcodes {
 			}
 			else
 				super.visitInsn(ICONST_1);
+			super.visitVarInsn(ALOAD, monitorIndx);
+			super.monitorEnter();
 			super.visitFieldInsn(getOpcode, logFieldOwner, "logsize", Type.INT_TYPE.getDescriptor());
 			super.visitInsn(IADD);
 			super.visitInsn(DUP);
 			super.visitFieldInsn(PUTSTATIC, logFieldOwner, "logsize", Type.INT_TYPE.getDescriptor());
+
 			super.visitLdcInsn(Constants.MAX_LOG_SIZE);
 //			super.visitInsn(ISUB);
 			super.visitJumpInsn(IF_ICMPLE, endLbl);
 //			super.ifCmp(Type.INT_TYPE, Opcodes.IFGE, endLbl);
+			super.visitVarInsn(ALOAD, monitorIndx);
+			super.monitorExit();
 			if(logFieldOwner.equals(Type.getInternalName(SerializableLog.class)))
 				super.visitMethodInsn(INVOKESTATIC, Type.getInternalName(WallaceExportRunner.class), "_exportSerializable", "()V");
 			else
 				super.visitMethodInsn(INVOKESTATIC, Type.getInternalName(WallaceExportRunner.class), "_export", "()V");
+			super.visitVarInsn(ALOAD, monitorIndx);
+			super.monitorEnter();
+			super.visitFieldInsn(getOpcode, logFieldOwner, "logsize", Type.INT_TYPE.getDescriptor());
+			super.visitLdcInsn(Constants.VERY_MAX_LOG_SIZE);
+			super.visitJumpInsn(IF_ICMPLE, endLbl);

+
+//println("GOing to wait for " + logFieldOwner);
+//			super.visitLabel(tryStart);
+
+			super.visitFieldInsn(Opcodes.GETSTATIC, Type.getInternalName(Log.class), "lock", "Ljava/lang/Object;");
+			super.visitLdcInsn(500L);
+			super.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Object", "wait", "(J)V");
+
+//			super.visitLabel(tryEnd);
+
+//			super.visitJumpInsn(GOTO, endLbl);
+//			super.visitLabel(handlerStart);
+//			int n = newLocal(Type.getType(InterruptedException.class));
+//			super.visitVarInsn(ASTORE, n);
+//			super.visitInsn(POP);
 			visitLabel(endLbl);
+			super.visitVarInsn(ALOAD, monitorIndx);
+			super.monitorExit();
 //			super.visitLocalVariable(logFieldName + "_monitor", "Ljava/lang/Object;", null, monitorStart, monitorEndLabel, monitorIndx);
 //		}

 	}
+	private void magic()
+	{
+		try{
+		Log.lock.wait(500);
+		}
+		catch(InterruptedException ex)
+		{
+
+		}
+	}
 }
diff --git a/testcase-generation/src/edu/columbia/cs/psl/invivo/record/visitor/NonDeterministicLoggingClassVisitor.java b/testcase-generation/src/edu/columbia/cs/psl/invivo/record/visitor/NonDeterministicLoggingClassVisitor.java
index 14c44f2..2b180cc 100644
--- a/testcase-generation/src/edu/columbia/cs/psl/invivo/record/visitor/NonDeterministicLoggingClassVisitor.java
+++ b/testcase-generation/src/edu/columbia/cs/psl/invivo/record/visitor/NonDeterministicLoggingClassVisitor.java
@@ -121,7 +121,7 @@ public class NonDeterministicLoggingClassVisitor extends ClassVisitor implements
 						caa.loadArg(i);
 						//- (mi.getOpcode() == Opcodes.INVOKESTATIC ? 0 : 1)
 						caa.logValueAtTopOfStackToArray(MethodCall.getLogClassName(args[i]), "aLog", "[Ljava/lang/Object;",
-								args[i], true, mi.owner+"."+mi.name+"->_"+i+"\t"+args[i].getDescriptor());
+								args[i], true, mi.owner+"."+mi.name+"->_"+i+"\t"+args[i].getDescriptor()+"\t\t"+className);
 						if (args[i].getSize() == 1)
 							caa.pop();
 						else
diff --git a/testcase-generation/src/edu/columbia/cs/psl/invivo/record/visitor/NonDeterministicLoggingMethodVisitor.java b/testcase-generation/src/edu/columbia/cs/psl/invivo/record/visitor/NonDeterministicLoggingMethodVisitor.java
index a06ea68..dcf2b6a 100644
--- a/testcase-generation/src/edu/columbia/cs/psl/invivo/record/visitor/NonDeterministicLoggingMethodVisitor.java
+++ b/testcase-generation/src/edu/columbia/cs/psl/invivo/record/visitor/NonDeterministicLoggingMethodVisitor.java
@@ -137,13 +137,13 @@ public class NonDeterministicLoggingMethodVisitor extends CloningAdviceAdapter i
 					}
 					mv.visitMethodInsn(invokeOpcode, classDesc, m.getCapturePrefix()+"_capture", captureDesc);
 					logValueAtTopOfStackToArray(m.getLogClassNmae(), m.getLogFieldName(), m.getLogFieldType().getDescriptor(), returnType, true,
-							owner+"."+name + "\t" + desc);
+							owner+"."+name + "\t" + desc+"\t\t"+classDesc+"."+this.name);
 				}
 				else
 				{
 					mv.visitMethodInsn(opcode, owner, name, desc);
 					logValueAtTopOfStackToArray(m.getLogClassNmae(), m.getLogFieldName(), m.getLogFieldType().getDescriptor(), returnType, true,
-							owner+"."+name + "\t" + desc);
+							owner+"."+name + "\t" + desc+"\t\t"+classDesc+"."+this.name);
 				}
 			}
 			else if(opcode == INVOKESPECIAL && name.equals("<init>") && nonDeterministicMethods.contains(owner + "." + name + ":" + desc) && !(owner.equals(Instrumenter.instrumentedClasses.get(classDesc).superName)
@@ -151,7 +151,7 @@ public class NonDeterministicLoggingMethodVisitor extends CloningAdviceAdapter i
 				super.visitMethodInsn(opcode, owner, name, desc);
 				if(analyzer.stack != null && analyzer.stack.size() > 0 && analyzer.stack.get(analyzer.stack.size()-1).equals(owner))
 					logValueAtTopOfStackToArray(MethodCall.getLogClassName(Type.getType("L"+owner+";")), "aLog", "[Ljava/lang/Object;", Type.getType("L"+owner+";"), true,
-							owner+"."+name + "\t" + desc);
+							owner+"."+name + "\t" + desc+"\t\t"+classDesc+"."+this.name);

 			}
 			else