changes
This commit is contained in:
@@ -22,8 +22,8 @@ public class Launcher {
|
|||||||
|
|
||||||
Properties appProps = new Properties();
|
Properties appProps = new Properties();
|
||||||
|
|
||||||
String appConfigPath = "/Users/anil.koyuncu/projects/fixminer/fixminer_source/src/main/resource/app.properties";
|
// String appConfigPath = "/Users/anilkoyuncu/projects/fixminer/fixminer_source/src/main/resource/app.properties";
|
||||||
// String appConfigPath = args[0];
|
String appConfigPath = args[0];
|
||||||
appProps.load(new FileInputStream(appConfigPath));
|
appProps.load(new FileInputStream(appConfigPath));
|
||||||
|
|
||||||
String portInner = appProps.getProperty("portInner","6380");
|
String portInner = appProps.getProperty("portInner","6380");
|
||||||
@@ -38,12 +38,12 @@ public class Launcher {
|
|||||||
String redisPath = appProps.getProperty("redisPath","FORKJOIN");
|
String redisPath = appProps.getProperty("redisPath","FORKJOIN");
|
||||||
String srcMLPath = appProps.getProperty("srcMLPath","FORKJOIN");
|
String srcMLPath = appProps.getProperty("srcMLPath","FORKJOIN");
|
||||||
|
|
||||||
// String parameter = args[2];
|
String parameter = args[2];
|
||||||
String parameter = null;
|
// String parameter = null;
|
||||||
// String parameter = "if";
|
// String parameter = "if";
|
||||||
// String parameter = "L1";
|
// String parameter = "L1";
|
||||||
// String jobType = args[1];
|
String jobType = args[1];
|
||||||
String jobType = "RICHEDITSCRIPT";
|
// String jobType = "RICHEDITSCRIPT";
|
||||||
// String jobType = "LOAD";
|
// String jobType = "LOAD";
|
||||||
// String jobType = "COMPARE";
|
// String jobType = "COMPARE";
|
||||||
|
|
||||||
|
|||||||
@@ -60,26 +60,82 @@ public class CompareTrees {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
listOfPairs.stream().parallel().forEach(m->coreCompare(m, job,null, samePairs,errorPairs,filenames,outerPool));
|
// listOfPairs.stream().parallel().forEach(m->coreCompare(m, job,null, samePairs,errorPairs,filenames,outerPool));
|
||||||
|
listOfPairs.stream().parallel().forEach(m->newCoreCompare(m, job, samePairs,errorPairs,filenames,outerPool));
|
||||||
|
|
||||||
try (Jedis jedis = outerPool.getResource()) {
|
// try (Jedis jedis = outerPool.getResource()) {
|
||||||
jedis.select(2);
|
// jedis.select(2);
|
||||||
for (String samePair : samePairs) {
|
// for (String samePair : samePairs) {
|
||||||
|
//// jedis.hset("compare", errorPair, "1");
|
||||||
|
// jedis.set(samePair, "1");
|
||||||
|
// }
|
||||||
|
// jedis.select(0);
|
||||||
|
//// jedis.flushDB();
|
||||||
|
// jedis.del("compare");
|
||||||
|
// for (String errorPair : errorPairs) {
|
||||||
// jedis.hset("compare", errorPair, "1");
|
// jedis.hset("compare", errorPair, "1");
|
||||||
jedis.set(samePair, "1");
|
// }
|
||||||
}
|
//
|
||||||
jedis.select(0);
|
//
|
||||||
// jedis.flushDB();
|
// }
|
||||||
jedis.del("compare");
|
|
||||||
for (String errorPair : errorPairs) {
|
|
||||||
jedis.hset("compare", errorPair, "1");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
log.info("End process");
|
log.info("End process");
|
||||||
}
|
}
|
||||||
public static void coreCompare(String pairName, String treeType,JedisPool innerPool,ArrayList<String> samePairs,ArrayList<String> errorPairs, HashMap<String, String> filenames,JedisPool outerPool ) {
|
public static void newCoreCompare(String pairName, String treeType,ArrayList<String> samePairs,ArrayList<String> errorPairs, HashMap<String, String> filenames,JedisPool outerPool ) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
String matchKey = null;
|
||||||
|
try {
|
||||||
|
|
||||||
|
String[] split = pairName.split("/");
|
||||||
|
|
||||||
|
|
||||||
|
String i = split[1];
|
||||||
|
String j = split[2];
|
||||||
|
String keyName = split[0];
|
||||||
|
matchKey = keyName + "/" + (String.valueOf(i)) + "/" + String.valueOf(j);
|
||||||
|
|
||||||
|
switch (treeType) {
|
||||||
|
case "single":
|
||||||
|
|
||||||
|
if (matchKey == null){
|
||||||
|
System.out.println();
|
||||||
|
}
|
||||||
|
String oldShapeTree = EDiffHelper.getTreeString(keyName, i, outerPool, filenames, "shapeTree");
|
||||||
|
String newShapeTree = EDiffHelper.getTreeString(keyName, j, outerPool, filenames, "shapeTree");
|
||||||
|
|
||||||
|
String oldActionTree = EDiffHelper.getTreeString(keyName, i, outerPool, filenames, "actionTree");
|
||||||
|
String newActionTree = EDiffHelper.getTreeString(keyName, j, outerPool, filenames, "actionTree");
|
||||||
|
|
||||||
|
String oldTargetTree = EDiffHelper.getTreeString(keyName, i, outerPool, filenames, "targetTree");
|
||||||
|
String newTargetTree = EDiffHelper.getTreeString(keyName, j, outerPool, filenames, "targetTree");
|
||||||
|
|
||||||
|
|
||||||
|
if (oldShapeTree.equals(newShapeTree)) {
|
||||||
|
if (oldActionTree.equals(newActionTree)) {
|
||||||
|
if (oldTargetTree.equals(newTargetTree)) {
|
||||||
|
// samePairs.add(matchKey);
|
||||||
|
try (Jedis jedis = outerPool.getResource()) {
|
||||||
|
//// jedis.del(matchKey);
|
||||||
|
jedis.select(2);
|
||||||
|
jedis.set(matchKey, "1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}catch (Exception e) {
|
||||||
|
errorPairs.add(matchKey);
|
||||||
|
log.debug("{} not comparable", pairName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void coreCompare(String pairName, String treeType,JedisPool innerPool,ArrayList<String> samePairs,ArrayList<String> errorPairs, HashMap<String, String> filenames,JedisPool outerPool ) {
|
||||||
|
|
||||||
// if (samePairs.size() % 1000 == 0) {
|
// if (samePairs.size() % 1000 == 0) {
|
||||||
// log.info("Same pairs size "+samePairs.size());
|
// log.info("Same pairs size "+samePairs.size());
|
||||||
@@ -113,23 +169,20 @@ public class CompareTrees {
|
|||||||
// JedisPool outerPool = null;
|
// JedisPool outerPool = null;
|
||||||
switch (treeType) {
|
switch (treeType) {
|
||||||
case "single":
|
case "single":
|
||||||
oldPair = EDiffHelper.getActions(keyName, i, outerPool, filenames);
|
|
||||||
newPair = EDiffHelper.getActions(keyName, j, outerPool, filenames);
|
String oldShapeTree = EDiffHelper.getTreeString(keyName, i, outerPool, filenames,"shapeTree");
|
||||||
ITree oldActionTree = oldPair.getValue0();
|
String newShapeTree = EDiffHelper.getTreeString(keyName, j, outerPool, filenames,"shapeTree");
|
||||||
ITree newActionTree = newPair.getValue0();
|
|
||||||
HierarchicalActionSet oldProject = oldPair.getValue1();
|
String oldActionTree = EDiffHelper.getTreeString(keyName, i, outerPool, filenames,"actionTree");
|
||||||
HierarchicalActionSet newProject = newPair.getValue1();
|
String newActionTree = EDiffHelper.getTreeString(keyName, j, outerPool, filenames,"actionTree");
|
||||||
|
|
||||||
|
String oldTargetTree = EDiffHelper.getTreeString(keyName, i, outerPool, filenames,"targetTree");
|
||||||
|
String newTargetTree = EDiffHelper.getTreeString(keyName, j, outerPool, filenames,"targetTree");
|
||||||
|
|
||||||
|
|
||||||
ITree oldShapeTree = EDiffHelper.getShapeTree(oldProject);
|
if(oldShapeTree.equals(newShapeTree)){
|
||||||
ITree newShapeTree = EDiffHelper.getShapeTree(newProject);
|
if(oldActionTree.equals(newActionTree)){
|
||||||
|
if(oldTargetTree.equals(newTargetTree)){
|
||||||
ITree oldTargetTree = EDiffHelper.getTargets(oldProject);
|
|
||||||
ITree newTargetTree = EDiffHelper.getTargets(newProject);
|
|
||||||
|
|
||||||
if(oldShapeTree.toStaticHashString().equals(newShapeTree.toStaticHashString())){
|
|
||||||
if(oldActionTree.toStaticHashString().equals(newActionTree.toStaticHashString())){
|
|
||||||
if(oldTargetTree.toStaticHashString().equals(newTargetTree.toStaticHashString())){
|
|
||||||
samePairs.add(matchKey);
|
samePairs.add(matchKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package edu.lu.uni.serval.fixminer.akka.ediff;
|
package edu.lu.uni.serval.fixminer.akka.ediff;
|
||||||
|
|
||||||
|
import com.github.gumtreediff.tree.ITree;
|
||||||
import edu.lu.uni.serval.utils.EDiffHelper;
|
import edu.lu.uni.serval.utils.EDiffHelper;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -53,15 +54,21 @@ public class EDiffHunkParser extends EDiffParser {
|
|||||||
|
|
||||||
String key = astNodeType+"/"+String.valueOf(size)+"/" + pj +"_" + diffentryFile.getName() + "_" + String.valueOf(hunkSet);
|
String key = astNodeType+"/"+String.valueOf(size)+"/" + pj +"_" + diffentryFile.getName() + "_" + String.valueOf(hunkSet);
|
||||||
|
|
||||||
// try (Jedis inner = innerPool.getResource()) {
|
ITree targetTree = EDiffHelper.getTargets(actionSet);
|
||||||
//
|
ITree actionTree = EDiffHelper.getActionTrees(actionSet);
|
||||||
// inner.hset("dump".getBytes(),key.getBytes(),EDiffHelper.kryoSerialize(actionSet));
|
ITree shapeTree = EDiffHelper.getShapeTree(actionSet);
|
||||||
// }
|
try (Jedis inner = innerPool.getResource()) {
|
||||||
File f = new File(root+"dumps/"+astNodeType+"/"+String.valueOf(size)+"/");
|
|
||||||
f.mkdirs();
|
|
||||||
f = new File(root+"dumps/"+key);
|
|
||||||
|
|
||||||
FileUtils.writeByteArrayToFile(f,EDiffHelper.kryoSerialize(actionSet));
|
inner.hset("dump",key,actionSet.toString());
|
||||||
|
inner.hset(key,"actionTree",actionTree.toStaticHashString());
|
||||||
|
inner.hset(key,"targetTree",targetTree.toStaticHashString());
|
||||||
|
inner.hset(key,"shapeTree",shapeTree.toStaticHashString());
|
||||||
|
}
|
||||||
|
// File f = new File(root+"dumps/"+astNodeType+"/"+String.valueOf(size)+"/");
|
||||||
|
// f.mkdirs();
|
||||||
|
// f = new File(root+"dumps/"+key);
|
||||||
|
//
|
||||||
|
// FileUtils.writeByteArrayToFile(f,EDiffHelper.kryoSerialize(actionSet));
|
||||||
// FileUtils.writeByteArrayToFile(f,EDiffHelper.commonsSerialize(actionSet));
|
// FileUtils.writeByteArrayToFile(f,EDiffHelper.commonsSerialize(actionSet));
|
||||||
// FileUtils.writeByteArrayToFile(f,actionSet.toString().getBytes());
|
// FileUtils.writeByteArrayToFile(f,actionSet.toString().getBytes());
|
||||||
// FileOutputStream fos = new FileOutputStream(f);
|
// FileOutputStream fos = new FileOutputStream(f);
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public class EnhancedASTDiff {
|
|||||||
|
|
||||||
List<MessageFile> msgFiles = getMessageFiles(target.toString() + "/"); //"/Users/anilkoyuncu/bugStudy/code/python/GumTreeInput/Apache/CAMEL/"
|
List<MessageFile> msgFiles = getMessageFiles(target.toString() + "/"); //"/Users/anilkoyuncu/bugStudy/code/python/GumTreeInput/Apache/CAMEL/"
|
||||||
|
|
||||||
// msgFiles = msgFiles.subList(0,1000);
|
// msgFiles = msgFiles.subList(0,3000);
|
||||||
if (msgFiles == null)
|
if (msgFiles == null)
|
||||||
continue;
|
continue;
|
||||||
allMessageFiles.addAll(msgFiles);
|
allMessageFiles.addAll(msgFiles);
|
||||||
|
|||||||
@@ -30,12 +30,12 @@ public class ClusterToPattern {
|
|||||||
while (!outer.ping().equals("PONG")) {
|
while (!outer.ping().equals("PONG")) {
|
||||||
log.info("wait");
|
log.info("wait");
|
||||||
}
|
}
|
||||||
byte[] s = outer.hget("dump".getBytes(), filename.getBytes());
|
// byte[] s = outer.hget("dump".getBytes(), filename.getBytes());
|
||||||
HierarchicalActionSet actionSet = (HierarchicalActionSet) EDiffHelper.kryoDeseerialize(s);
|
// HierarchicalActionSet actionSet = (HierarchicalActionSet) EDiffHelper.kryoDeseerialize(s);
|
||||||
if (actionSet == null){
|
// if (actionSet == null){
|
||||||
throw new Error(filename +" not found");
|
// throw new Error(filename +" not found");
|
||||||
}
|
// }
|
||||||
String s1 = actionSet.toString();
|
String s1 = outer.hget("dump",filename);
|
||||||
// outer.close();
|
// outer.close();
|
||||||
return s1;
|
return s1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -328,6 +328,26 @@ public class EDiffHelper {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getTreeString(String prefix, String fn, JedisPool outerPool, HashMap<String, String> filenames, String treeType) {
|
||||||
|
try (Jedis outer = outerPool.getResource()) {
|
||||||
|
try {
|
||||||
|
while (!outer.ping().equals("PONG")) {
|
||||||
|
log.info("wait");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
String dist2load = filenames.get(prefix + "-" + fn);
|
||||||
|
|
||||||
|
String[] split = prefix.split("-");
|
||||||
|
String key = split[0] + "/" + split[1] + "/" + dist2load;
|
||||||
|
String treeString = outer.hget(key, treeType);
|
||||||
|
return treeString;
|
||||||
|
}catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public static Pair<ITree,HierarchicalActionSet> getActions(String prefix, String fn, JedisPool outerPool, HashMap<String, String> filenames) {
|
public static Pair<ITree,HierarchicalActionSet> getActions(String prefix, String fn, JedisPool outerPool, HashMap<String, String> filenames) {
|
||||||
|
|
||||||
@@ -351,12 +371,7 @@ public class EDiffHelper {
|
|||||||
actionSet = (HierarchicalActionSet) EDiffHelper.kryoDeseerialize(s);
|
actionSet = (HierarchicalActionSet) EDiffHelper.kryoDeseerialize(s);
|
||||||
|
|
||||||
|
|
||||||
ITree parent = null;
|
tree = getActionTrees(actionSet);
|
||||||
ITree children = null;
|
|
||||||
TreeContext tc = new TreeContext();
|
|
||||||
tree = EDiffHelper.getActionTree(actionSet, parent, children, tc);
|
|
||||||
//tree.setParent(null);
|
|
||||||
tc.validate();
|
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -367,6 +382,17 @@ public class EDiffHelper {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ITree getActionTrees(HierarchicalActionSet actionSet) {
|
||||||
|
ITree tree = null;
|
||||||
|
ITree parent = null;
|
||||||
|
ITree children = null;
|
||||||
|
TreeContext tc = new TreeContext();
|
||||||
|
tree = EDiffHelper.getActionTree(actionSet, parent, children, tc);
|
||||||
|
//tree.setParent(null);
|
||||||
|
tc.validate();
|
||||||
|
return tree;
|
||||||
|
}
|
||||||
|
|
||||||
public static void getLeaves(ITree tc){
|
public static void getLeaves(ITree tc){
|
||||||
|
|
||||||
int height = tc.getHeight();
|
int height = tc.getHeight();
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ pjName = gumInput
|
|||||||
portInner = 6380
|
portInner = 6380
|
||||||
portDumps = 6399
|
portDumps = 6399
|
||||||
parallelism = AKKA
|
parallelism = AKKA
|
||||||
numOfWorkers = 14
|
numOfWorkers = 7
|
||||||
|
|
||||||
inputPath = /Users/anil.koyuncu/projects/fixminer/gumInputLinux
|
inputPath = /Users/anilkoyuncu/projects/gumInputLinux
|
||||||
redisPath = /Users/anil.koyuncu/projects/fixminer/fixminer-core/python/data/redis
|
redisPath = /Users/anilkoyuncu/projects/fixminer/fixminer-core/python/data/redis
|
||||||
srcMLPath= /Users/anil.koyuncu/Downloads/srcML/src2srcml
|
srcMLPath= /Users/anilkoyuncu/Downloads/srcML2/src2srcml
|
||||||
actionType = ALL
|
actionType = ALL
|
||||||
eDiffTimeout = 900
|
eDiffTimeout = 900
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user