Commit 24d3c3e0 authored by Danilo Ansaloni's avatar Danilo Ansaloni

Senseo example without basic-block analysis.

parent 119a3acd
package ch.usi.dag.disl.example.senseo;
@ch.usi.dag.disl.annotation.ArgumentProcessor
public class ArgumentProcessor {
public static void objPM(Object o) {
DiSLClass.thisAnalysis.profileArgument(o);//==null) ? Null.class : o.getClass());//, pos);
}
// public static void booleanPM(int pos, int n, boolean b) {
// DiSLClass.thisAnalysis.profileArgument(Boolean.class, pos);
// }
//
// public static void bytePM(int pos, int n, byte b) {
// DiSLClass.thisAnalysis.profileArgument(Byte.class, pos);
// }
//
// public static void charPM(int pos, int n, char c) {
// DiSLClass.thisAnalysis.profileArgument(Char.class, pos);
// }
//
// public static void doublePM(int pos, int n, double d) {
// DiSLClass.thisAnalysis.profileArgument(Double.class, pos);
// }
//
// public static void floatPM(int pos, int n, float f) {
// DiSLClass.thisAnalysis.profileArgument(Float.class, pos);
// }
//
// public static void intPM(int pos, int n, int i) {
// DiSLClass.thisAnalysis.profileArgument(Int.class, pos);
// }
//
// public static void longPM(int pos, int n, long l) {
// DiSLClass.thisAnalysis.profileArgument(Long.class, pos);
// }
//
// public static void shortPM(int pos, int n, short s) {
// DiSLClass.thisAnalysis.profileArgument(Short.class, pos);
// }
}
......@@ -10,7 +10,9 @@ public class ConstructorHasObjectArgs {
public static boolean isApplicable(MethodStaticContext msc) {
String desc = msc.thisMethodDescriptor();
return
OnlyInit.isApplicable(msc)
msc.thisMethodName().equals("<init>")
&& !msc.thisClassName().equals("java/lang/Object")
&& !msc.thisClassName().equals("java/lang/Thread")
&& desc.substring(0, desc.indexOf(')')).contains("L");
}
}
......@@ -3,14 +3,16 @@ package ch.usi.dag.disl.example.senseo;
import ch.usi.dag.disl.annotation.GuardMethod;
import ch.usi.dag.disl.staticcontext.MethodStaticContext;
//check if none of the arguments is an Object
//--> if "L" is not in the description of the arguments
// check if none of the arguments is an Object
// --> if "L" is not in the description of the arguments
public class ConstructorHasOnlyPrimitiveArgs {
@GuardMethod
public static boolean isApplicable(MethodStaticContext msc) {
String desc = msc.thisMethodDescriptor();
return
OnlyInit.isApplicable(msc)
msc.thisMethodName().equals("<init>")
&& !msc.thisClassName().equals("java/lang/Object")
&& !msc.thisClassName().equals("java/lang/Thread")
&& !desc.substring(0, desc.indexOf(')')).contains("L");
}
}
package ch.usi.dag.disl.example.senseo;
import ch.usi.dag.disl.annotation.After;
import ch.usi.dag.disl.annotation.AfterReturning;
import ch.usi.dag.disl.annotation.AfterThrowing;
import ch.usi.dag.disl.annotation.Before;
import ch.usi.dag.disl.annotation.SyntheticLocal;
import ch.usi.dag.disl.annotation.ThreadLocal;
import ch.usi.dag.disl.marker.AfterInitBodyMarker;
import ch.usi.dag.disl.dynamiccontext.DynamicContext;
import ch.usi.dag.disl.example.senseo.runtime.Analysis;
import ch.usi.dag.disl.marker.BodyMarker;
import ch.usi.dag.disl.processorcontext.ArgumentContext;
import ch.usi.dag.disl.marker.BytecodeMarker;
import ch.usi.dag.disl.processorcontext.ArgumentProcessorContext;
import ch.usi.dag.disl.processorcontext.ArgumentProcessorMode;
import ch.usi.dag.disl.staticcontext.BasicBlockStaticContext;
import ch.usi.dag.disl.staticcontext.uid.UniqueMethodId;
import ch.usi.dag.disl.example.senseo.runtime.Analysis;
// This is the SENSEO Case study recast in DiSL
// To compile it you have to do once:
// cd test; ant
// An to run it:
// ./run.sh senseo pkg
// To disable full coverage, edit the conf/exclusion.lst
public class DiSLClass {
@SyntheticLocal
......@@ -32,27 +24,25 @@ public class DiSLClass {
/**************************************************
** Constructors **
**************************************************/
@Before(marker = AfterInitBodyMarker.class, order = 1, scope = "*.*", guard = ConstructorHasOnlyPrimitiveArgs.class)
public static void onConstructorEntryPrimitiveArgs(UniqueMethodId id, BasicBlockStaticContext bba) {
@Before(marker = BodyMarker.class, order = 0, guard = ConstructorHasOnlyPrimitiveArgs.class, dynamicBypass = false)
public static void onConstructorEntryPrimitiveArgs(UniqueMethodId id) {
if((thisAnalysis = currentAnalysis) == null) {
thisAnalysis = (currentAnalysis = new Analysis());
}
//TODO: add method getTotBBs() to class BasicBlockAnalysis
thisAnalysis.onEntry(id.get(), true, -1);//bba.getTotBBs());
thisAnalysis.onEntry(id.get(), true);
}
@Before(marker = AfterInitBodyMarker.class, order = 1, scope = "*.*", guard = ConstructorHasObjectArgs.class)
public static void onConstructorEntryObjectArgs(UniqueMethodId id, BasicBlockStaticContext bba, ArgumentProcessorContext pc) {
@Before(marker = BodyMarker.class, order = 0, guard = ConstructorHasObjectArgs.class, dynamicBypass = false)
public static void onConstructorEntryObjectArgs(UniqueMethodId id, ArgumentProcessorContext pc) {
if((thisAnalysis = currentAnalysis) == null) {
thisAnalysis = (currentAnalysis = new Analysis());
}
//TODO: add method getTotBBs() to class BasicBlockAnalysis
thisAnalysis.onEntry(id.get(), false, -1);//bba.getTotBBs());
thisAnalysis.onEntry(id.get(), false);
pc.apply(ArgumentProcessor.class, ArgumentProcessorMode.METHOD_ARGS);
pc.apply(MyArgumentProcessor.class, ArgumentProcessorMode.METHOD_ARGS);
}
@After(marker = BodyMarker.class, order = 1, scope = "*.*", guard = OnlyInit.class)
@After(marker = BodyMarker.class, order = 0, guard = OnlyInit.class, dynamicBypass = false)
public static void onConstructorExit() {
thisAnalysis.onExit();
}
......@@ -60,44 +50,45 @@ public class DiSLClass {
/**************************************************
** Methods **
**************************************************/
@Before(marker = BodyMarker.class, order = 1, scope = "*.*", guard = MethodHasOnlyPrimitiveArgs.class)
public static void onMethodEntryPrimitiveArgs(UniqueMethodId id, BasicBlockStaticContext bba) {
@Before(marker = BodyMarker.class, order = 0, guard = MethodHasOnlyPrimitiveArgs.class, dynamicBypass = false)
public static void onMethodEntryPrimitiveArgs(UniqueMethodId id) {
if((thisAnalysis = currentAnalysis) == null) {
thisAnalysis = (currentAnalysis = new Analysis());
}
//TODO: add method getTotBBs() to class BasicBlockAnalysis
thisAnalysis.onEntry(id.get(), true, -1);//bba.getTotBBs());
thisAnalysis.onEntry(id.get(), true);
}
@Before(marker = BodyMarker.class, order = 1, scope = "*.*", guard = MethodHasObjectArgs.class)
public static void onMethodEntryObjectArgs(UniqueMethodId id, BasicBlockStaticContext bba, ArgumentProcessorContext pc) {
@Before(marker = BodyMarker.class, order = 0, guard = MethodHasObjectArgs.class, dynamicBypass = false)
public static void onMethodEntryObjectArgs(UniqueMethodId id, ArgumentProcessorContext pc) {
if((thisAnalysis = currentAnalysis) == null) {
thisAnalysis = (currentAnalysis = new Analysis());
}
//TODO: add method getTotBBs() to class BasicBlockAnalysis
thisAnalysis.onEntry(id.get(), false, -1);//bba.getTotBBs());
thisAnalysis.onEntry(id.get(), false);
pc.apply(MyArgumentProcessor.class, ArgumentProcessorMode.METHOD_ARGS);
}
pc.apply(ArgumentProcessor.class, ArgumentProcessorMode.METHOD_ARGS);
@AfterReturning(marker = BodyMarker.class, order = 0, guard = MethodReturnsObj.class, dynamicBypass = false)
public static void onMethodReturnObj(DynamicContext dc) {
Object obj = dc.getStackValue(0, Object.class);
thisAnalysis.onExit(obj);
}
@After(marker = BodyMarker.class, order = 1, scope = "*.*", guard = NotInitNorClinit.class)
public static void onMethodExit() {
@AfterReturning(marker = BodyMarker.class, order = 0, guard = MethodReturnsSomethingElse.class, dynamicBypass = false)
public static void onMethodReturnsSomethingElse() {
thisAnalysis.onExit();
}
/**************************************************
** Allocated objects **
**************************************************/
// @AfterReturning(marker = BytecodeMarker.class, param="invokespecial", scope = "TargetClass.*", guard = IsCallToConstructor.class)
// public static void beforeNew(DynamicContext di) {
// thisAnalysis.onAlloc(di.getStackValue(0, Object.class)); // perform analysis
// }
@AfterThrowing(marker = BodyMarker.class, order = 1, guard = NotInitNorClinit.class, dynamicBypass = false)
public static void onMethodThrow() {
thisAnalysis.onExit();
}
/**************************************************
** BBs **
** Calls to constructors **
**************************************************/
// @Before(marker = BasicBlockMarker.class, scope = "*.*", order = 2, guard = NotClinit.class)
// public static void bbAnalysis1(BasicBlockAnalysis bba) {
// thisAnalysis.onBB(bba.getBBindex());
// }
@AfterReturning(marker = BytecodeMarker.class, args = "new, newarray, anewarray, multianewarray", order = 0, guard = NotClinit.class, dynamicBypass = false)
public static void beforeNew() {
thisAnalysis.onAlloc();
}
}
Manifest-Version: 1.0
DiSL-Classes: ch.usi.dag.disl.example.senseo.DiSLClass:ch.usi.dag.disl.example.senseo.ArgumentProcessor
DiSL-Classes: ch.usi.dag.disl.example.senseo.DiSLClass:ch.usi.dag.disl.example.senseo.MyArgumentProcessor
......@@ -3,14 +3,14 @@ package ch.usi.dag.disl.example.senseo;
import ch.usi.dag.disl.annotation.GuardMethod;
import ch.usi.dag.disl.staticcontext.MethodStaticContext;
//check if at least one of the arguments is an Object
//--> if "L" is in the description of the arguments
// check if at least one of the arguments is an Object
// --> if "L" is in the description of the arguments
public class MethodHasObjectArgs {
@GuardMethod
public static boolean isApplicable(MethodStaticContext msc) {
String desc = msc.thisMethodDescriptor();
return
NotInitNorClinit.isApplicable(msc)
!msc.thisMethodName().endsWith("init>")
&& desc.substring(0, desc.indexOf(')')).contains("L");
}
}
......@@ -3,14 +3,14 @@ package ch.usi.dag.disl.example.senseo;
import ch.usi.dag.disl.annotation.GuardMethod;
import ch.usi.dag.disl.staticcontext.MethodStaticContext;
//check if none of the arguments is an Object
//--> if "L" is not in the description of the arguments
// check if none of the arguments is an Object
// --> if "L" is not in the description of the arguments
public class MethodHasOnlyPrimitiveArgs {
@GuardMethod
public static boolean isApplicable(MethodStaticContext msc) {
String desc = msc.thisMethodDescriptor();
return
NotInitNorClinit.isApplicable(msc)
!msc.thisMethodName().endsWith("init>")
&& !desc.substring(0, desc.indexOf(')')).contains("L");
}
}
package ch.usi.dag.disl.example.senseo;
import ch.usi.dag.disl.annotation.GuardMethod;
import ch.usi.dag.disl.staticcontext.MethodStaticContext;
public class MethodReturnsObj {
@GuardMethod
public static boolean isApplicable(MethodStaticContext msc) {
String desc = msc.thisMethodDescriptor();
return !msc.thisMethodName().endsWith("init>")
&& desc.substring(desc.indexOf(')') + 1).startsWith("L");
}
}
package ch.usi.dag.disl.example.senseo;
import ch.usi.dag.disl.annotation.GuardMethod;
import ch.usi.dag.disl.staticcontext.MethodStaticContext;
public class MethodReturnsSomethingElse {
@GuardMethod
public static boolean isApplicable(MethodStaticContext msc) {
String desc = msc.thisMethodDescriptor();
return !msc.thisMethodName().endsWith("init>")
&& !desc.substring(desc.indexOf(')') + 1).startsWith("L");
}
}
package ch.usi.dag.disl.example.senseo;
import ch.usi.dag.disl.annotation.ArgumentProcessor;
@ArgumentProcessor
public class MyArgumentProcessor {
public static void objPM(Object obj) {
DiSLClass.thisAnalysis.profileArgument(obj);
}
}
......@@ -6,6 +6,16 @@ import ch.usi.dag.disl.staticcontext.MethodStaticContext;
public class NotClinit {
@GuardMethod
public static boolean isApplicable(MethodStaticContext msc) {
return (msc.thisMethodName().equals("<clinit>")) ? false : true;
if(
msc.thisMethodName().equals("<clinit>")
|| msc.thisMethodName().equals("<init>")
&& (
msc.thisClassName().equals("java/lang/Object")
|| msc.thisClassName().equals("java/lang/Thread")
)
) {
return false;
}
return true;
}
}
......@@ -6,6 +6,6 @@ import ch.usi.dag.disl.staticcontext.MethodStaticContext;
public class NotInitNorClinit {
@GuardMethod
public static boolean isApplicable(MethodStaticContext msc) {
return (msc.thisMethodName().endsWith("init>")) ? false : true;
return !msc.thisMethodName().endsWith("init>");
}
}
......@@ -6,6 +6,6 @@ import ch.usi.dag.disl.staticcontext.MethodStaticContext;
public class OnlyInit {
@GuardMethod
public static boolean isApplicable(MethodStaticContext msc) {
return (msc.thisMethodName().equals("<init>") && !msc.thisClassName().equals("java/lang/Object")) ? true : false;
return msc.thisMethodName().equals("<init>") && !msc.thisClassName().equals("java/lang/Object") && !msc.thisClassName().equals("java/lang/Thread");
}
}
......@@ -4,8 +4,7 @@ public class TargetClass {
public static final int UNINITIALIZED = -1;
@SuppressWarnings("unused")
private int numberOfArgs = UNINITIALIZED;
private int numberOfArgs = UNINITIALIZED;
public void method1() {
System.out.println("This is the body of TargetClass.method1");
......
package ch.usi.dag.disl.example.senseo.runtime;
import ch.usi.dag.disl.dynamicbypass.DynamicBypass;
import ch.usi.dag.disl.example.senseo.runtime.arguments.Null;
import ch.usi.dag.jborat.runtime.DynamicBypass;
public class Analysis {
private static final int MAX_TL_TREE_UPDATES = 40000;
private static final int MAX_ATTEMPTS = 5;
private static final int MODULE = 8192;
CCTNodeTL localRoot;
private CCTNodeTL currentNode;
private int attempts = 0;
private int cnt;
public Analysis() {
boolean oldState = DynamicBypass.getAndSet();
try {
cnt = MAX_TL_TREE_UPDATES + (Thread.currentThread().hashCode() % MODULE);
currentNode = (localRoot = CCTNodeTL.createRoot());
CCTManager.getManager().register(Thread.currentThread(), this);
} finally {
DynamicBypass.set(oldState);
}
DynamicBypass.activate();
cnt = MAX_TL_TREE_UPDATES + (Thread.currentThread().hashCode() % MODULE);
currentNode = (localRoot = CCTNodeTL.createRoot());
CCTManager.getManager().register(Thread.currentThread(), this);
DynamicBypass.deactivate();
}
public CCTNodeTL onEntry(int methodUID, boolean hasOnlyPrimitiveArgs, int totBBs) {
currentNode = currentNode.getOrCreateCallee(methodUID, 1, hasOnlyPrimitiveArgs, totBBs);
public CCTNodeTL onEntry(int methodUID, boolean hasOnlyPrimitiveArgs) {
currentNode = currentNode.getOrCreateCallee(methodUID, hasOnlyPrimitiveArgs);
return currentNode;
}
// public void profileArgument(Class<?> argClass) {//, int pos) {
// currentNode.profileArgument(argClass);//, pos);
// }
public void onExit() {
currentNode = currentNode.parent;
public void profileArgument(Object obj) {
boolean oldState = DynamicBypass.getAndSet();
try {
currentNode.profileArgument((obj ==null) ? Null.class : obj.getClass());
} finally {
DynamicBypass.set(oldState);
if(--cnt == 0) {
DynamicBypass.activate();
sendCurrentBuffer();
DynamicBypass.deactivate();
}
}
public void onExit() { //int id) {
// if(id != currentNode.methodUID) {
// boolean oldState = DynamicBypass.getAndSet();
// try {
// System.err.println("ERROR! id: " + id + " methodUID: " + currentNode.methodUID);
// System.exit(-1);
// } finally {
// DynamicBypass.set(oldState);
// }
// }
public void onExit(Object obj) {
DynamicBypass.activate();
currentNode.profileReturn((obj == null) ? Null.class : obj.getClass());
currentNode = currentNode.parent;
if(--cnt == 0) {
sendCurrentBuffer();
}
DynamicBypass.deactivate();
}
public void profileArgument(Object obj) {
DynamicBypass.activate();
currentNode.profileArgument((obj == null) ? Null.class : obj.getClass());
DynamicBypass.deactivate();
}
public void onBB(int index) { //, int id) {
// if(id != currentNode.methodUID) {
// boolean oldState = DynamicBypass.getAndSet();
// try {
// System.err.println("ERROR! id: " + id + " methodUID: " + currentNode.methodUID);
// System.exit(-1);
// } finally {
// DynamicBypass.set(oldState);
// }
// }
currentNode.profileBB(index);
public void onAlloc() {
currentNode.profileAlloc();
}
public void sendCurrentBuffer() {
boolean oldState = DynamicBypass.getAndSet();
try {
boolean force = (++attempts <= MAX_ATTEMPTS) ? false : true;
if(CCTManager.getManager().merge(localRoot, force)) {
pruneLocalCCT(currentNode);
cnt = MAX_TL_TREE_UPDATES + (this.hashCode() % MODULE);
attempts = 0;
}
else {
cnt = (MAX_TL_TREE_UPDATES / attempts) + (this.hashCode() % MODULE);
}
} finally {
DynamicBypass.set(oldState);
}
//THE BYPASS MUST BE ACTIVE
private void sendCurrentBuffer() {
CCTManager.getManager().merge(localRoot);
pruneLocalCCT(currentNode);
cnt = MAX_TL_TREE_UPDATES + (this.hashCode() % MODULE);
}
private static void pruneLocalCCT(CCTNodeTL currentNode) { //extreme pruning that keeps only the elements in the stack
CCTNodeTL tempNode = currentNode;
//extreme pruning that keeps only the elements in the stack
//THE BYPASS MUST BE ACTIVE
private static void pruneLocalCCT(CCTNodeTL currentNode) {
CCTNodeTL tempNode1 = currentNode;
CCTNodeTL tempNode2 = null;
do {
tempNode.prune();
} while((tempNode = tempNode.parent) != null);
tempNode1.prune(tempNode2);
tempNode2 = tempNode1;
} while((tempNode1 = tempNode1.parent) != null);
}
}
......@@ -4,8 +4,6 @@ import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import ch.usi.dag.disl.example.senseo.runtime.arguments.PrimitiveWrapper;
import ch.usi.dag.jborat.runtime.DynamicBypass;
public final class ArgumentNode {
private static final String SEPARATOR = " ";
......@@ -16,15 +14,12 @@ public final class ArgumentNode {
private static final AtomicReferenceFieldUpdater<ArgumentNode, ArgumentNode> nextArgsUpdater;
static {
boolean oldState = DynamicBypass.getAndSet();
try {
occurrencesUpdater = AtomicIntegerFieldUpdater.newUpdater(ArgumentNode.class, "occurrences");
leftUpdater = AtomicReferenceFieldUpdater.newUpdater(ArgumentNode.class, ArgumentNode.class, "left");
rightUpdater = AtomicReferenceFieldUpdater.newUpdater(ArgumentNode.class, ArgumentNode.class, "right");
nextArgsUpdater = AtomicReferenceFieldUpdater.newUpdater(ArgumentNode.class, ArgumentNode.class, "nextArgs");
} finally {
DynamicBypass.set(oldState);
}
// DynamicBypass.activate();
occurrencesUpdater = AtomicIntegerFieldUpdater.newUpdater(ArgumentNode.class, "occurrences");
leftUpdater = AtomicReferenceFieldUpdater.newUpdater(ArgumentNode.class, ArgumentNode.class, "left");
rightUpdater = AtomicReferenceFieldUpdater.newUpdater(ArgumentNode.class, ArgumentNode.class, "right");
nextArgsUpdater = AtomicReferenceFieldUpdater.newUpdater(ArgumentNode.class, ArgumentNode.class, "nextArgs");
// DynamicBypass.deactivate();
}
private volatile ArgumentNode left, right;
......@@ -111,6 +106,14 @@ public final class ArgumentNode {
} while ((otherArgs = otherArgs.left) != null);
}
public void prune() {
left = null;
right = null;
nextArgs = null;
occurrences = 0;
}
public void dump(StringBuffer buf) { // must be called with activated DIB
if(nextArgs != null) {
dumpArgs(buf, nextArgs, "");
......
......@@ -30,7 +30,6 @@ public final class ArgumentNodeTL {
ArgumentNodeTL getOrCreateNextArgument(Class<?> arg) {
ArgumentNodeTL n;
if ((n = nextArgs) == null) {
//System.out.println("[ArgumentNodeTL] 1");
return (nextArgs = new ArgumentNodeTL(this, arg));
}
......@@ -58,34 +57,34 @@ public final class ArgumentNodeTL {
}
}
// public void dump(StringBuffer buf) { // must be called with activated DIB
// buf.append('{');
// dumpArgs(buf, nextArgs, "");
// buf.append('}');
// }
//
// private static void dumpArgs(StringBuffer buf, ArgumentNodeTL n, String path) {
// if (n != null) {
// String localPath = path + n.argument.getName();
//
// if((n.dumpArgs(buf, localPath)) && ((n.left != null) || (n.right != null))) {
// buf.append(" - ");
// localPath = "";
// }
// dumpArgs(buf, n.left, localPath);
// dumpArgs(buf, n.right, localPath);
// }
// }
//
// private boolean dumpArgs(StringBuffer buf, String path) {
// if (nextArgs != null) {
// String localPath = path + ", ";
// dumpArgs(buf, nextArgs, localPath);
// return false;
// }
// else {
// buf.append(path + " = " + occurrences);
// return true;
// }
// }
public void dump(StringBuffer buf) {
buf.append('{');
dumpArgs(buf, nextArgs, "");
buf.append('}');
}
private static void dumpArgs(StringBuffer buf, ArgumentNodeTL n, String path) {
if (n != null) {
String localPath = path + n.argument.getName();
if((n.dumpArgs(buf, localPath)) && ((n.left != null) || (n.right != null))) {
buf.append(" - ");
localPath = "";
}
dumpArgs(buf, n.left, localPath);
dumpArgs(buf, n.right, localPath);
}
}
private boolean dumpArgs(StringBuffer buf, String path) {
if (nextArgs != null) {
String localPath = path + ", ";
dumpArgs(buf, nextArgs, localPath);
return false;
}
else {
buf.append(path + " = " + occurrences);
return true;
}
}
}
......@@ -3,63 +3,49 @@ package ch.usi.dag.disl.example.senseo.runtime;
import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.concurrent.locks.ReentrantLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import ch.usi.dag.jborat.runtime.DynamicBypass;
import ch.usi.dag.disl.dynamicbypass.DynamicBypass;
public final class CCTManager {
private class ThreadRef {
Thread thread;
Analysis analysis;
ThreadRef(Thread thread, Analysis analysis) {
this.thread = thread;
this.analysis = analysis;
}
}
private static final int THREAD_LIST_INITIAL_SIZE = 50;
private static final CCTManager theManager;
private static final ReentrantReadWriteLock rwl;
private static final ReentrantReadWriteLock.ReadLock readLock;
private static final ReentrantReadWriteLock.WriteLock writeLock;
private static volatile boolean processCCTFlag = false;
private final ReentrantLock rl;
private final CCTNode root;
private ArrayList<ThreadRef> allThreadRefs = new ArrayList<ThreadRef>(THREAD_LIST_INITIAL_SIZE);
private final IdentityHashMap<Thread, Analysis> allThreadRefs;
private volatile boolean doNotMerge = false;
static {
boolean oldState = DynamicBypass.getAndSet();
try {
theManager = new CCTManager();
rwl = new ReentrantReadWriteLock();
readLock = rwl.readLock();
writeLock = rwl.writeLock();
} finally {
DynamicBypass.set(oldState);
}
// DynamicBypass.activate();
theManager = new CCTManager();
rwl = new ReentrantReadWriteLock();
readLock = rwl.readLock();
writeLock = rwl.writeLock();
// DynamicBypass.deactivate();
}
private CCTManager() {
// writeLock.lock();
root = CCTNode.createRoot();
allThreadRefs = new IdentityHashMap<Thread, Analysis>();