- }
- // Analyze conflicts from next instructions
- if (nextInsn instanceof JVMFieldInstruction) {
- String fieldClass = ((JVMFieldInstruction) nextInsn).getFieldInfo().getFullName();
- // We don't care about libraries
- if (!fieldClass.startsWith("java") &&
- !fieldClass.startsWith("org") &&
- !fieldClass.startsWith("sun") &&
- !fieldClass.startsWith("com") &&
- !fieldClass.startsWith("gov") &&
- !fieldClass.startsWith("groovy") &&
- // and fields generated for the Groovy library
- !fieldClass.endsWith("stMC") &&
- !fieldClass.endsWith("callSiteArray") &&
- !fieldClass.endsWith("metaClass") &&
- !fieldClass.endsWith("staticClassInfo") &&
- !fieldClass.endsWith("__constructor__")) {
- // Check for conflict (go backward from currentChoice and get the first conflict)
- // If the current event has conflicts with multiple events, then these will be detected
- // one by one as this recursively checks backward when backtrack set is revisited and executed.
- for(int eventNumber=choiceCounter-1; eventNumber>=0; eventNumber--) {
- // Skip if this event number does not have any Read/Write set
- if (!readWriteFieldsMap.containsKey(eventNumber)) {
- continue;
- }
- ReadWriteSet rwSet = readWriteFieldsMap.get(eventNumber);
- // 1) Check for conflicts with Write fields for both Read and Write instructions
- // 2) Check for conflicts with Read fields for Write instructions
- if (((nextInsn instanceof WriteInstruction || nextInsn instanceof ReadInstruction) &&
- rwSet.writeFieldExists(fieldClass)) ||
- (nextInsn instanceof WriteInstruction && rwSet.readFieldExists(fieldClass))) {
- // We do not record and service the same backtrack pair/point twice!
- // If it has been serviced before, we just skip this
- if (recordConflictPair(choiceCounter, eventNumber)) {
- createBacktrackChoiceList(choiceCounter, eventNumber);
- // Break if a conflict is found!
- break;
+ // Analyze conflicts from next instructions
+ if (nextInsn instanceof JVMFieldInstruction) {
+ // The constructor is only called once when the object is initialized
+ // It does not have shared access with other objects
+ MethodInfo mi = nextInsn.getMethodInfo();
+ if (!mi.getName().equals("<init>")) {
+ String fieldClass = ((JVMFieldInstruction) nextInsn).getFieldInfo().getFullName();
+ // We don't care about libraries
+ if (!fieldClass.startsWith("java") &&
+ !fieldClass.startsWith("org") &&
+ !fieldClass.startsWith("sun") &&
+ !fieldClass.startsWith("com") &&
+ !fieldClass.startsWith("gov") &&
+ !fieldClass.startsWith("groovy") &&
+ // and fields generated for the Groovy library
+ !fieldClass.endsWith("stMC") &&
+ !fieldClass.endsWith("callSiteArray") &&
+ !fieldClass.endsWith("metaClass") &&
+ !fieldClass.endsWith("staticClassInfo") &&
+ !fieldClass.endsWith("__constructor__")) {
+ // Check for conflict (go backward from currentChoice and get the first conflict)
+ // If the current event has conflicts with multiple events, then these will be detected
+ // one by one as this recursively checks backward when backtrack set is revisited and executed.
+ for (int eventNumber = currentChoice - 1; eventNumber >= 0; eventNumber--) {
+ // Skip if this event number does not have any Read/Write set
+ if (!readWriteFieldsMap.containsKey(eventNumber)) {
+ continue;
+ }
+ ReadWriteSet rwSet = readWriteFieldsMap.get(eventNumber);
+ int currObjId = ((JVMFieldInstruction) nextInsn).getFieldInfo().getClassInfo().getClassObjectRef();
+ // 1) Check for conflicts with Write fields for both Read and Write instructions
+ if (((nextInsn instanceof WriteInstruction || nextInsn instanceof ReadInstruction) &&
+ rwSet.writeFieldExists(fieldClass) && rwSet.writeFieldObjectId(fieldClass) == currObjId) ||
+ (nextInsn instanceof WriteInstruction && rwSet.readFieldExists(fieldClass) &&
+ rwSet.readFieldObjectId(fieldClass) == currObjId)) {
+ // We do not record and service the same backtrack pair/point twice!
+ // If it has been serviced before, we just skip this
+ if (recordConflictPair(currentChoice, eventNumber)) {
+ createBacktrackChoiceList(currentChoice, eventNumber);
+ // Break if a conflict is found!
+ break;
+ }
+ }