changes
This commit is contained in:
@@ -22,8 +22,8 @@ public class Launcher {
|
||||
|
||||
Properties appProps = new Properties();
|
||||
|
||||
String appConfigPath = "/Users/anil.koyuncu/projects/fixminer/fixminer_source/src/main/resource/app.properties";
|
||||
// String appConfigPath = args[0];
|
||||
// String appConfigPath = "/Users/anilkoyuncu/projects/fixminer/fixminer_source/src/main/resource/app.properties";
|
||||
String appConfigPath = args[0];
|
||||
appProps.load(new FileInputStream(appConfigPath));
|
||||
|
||||
String portInner = appProps.getProperty("portInner","6380");
|
||||
@@ -38,12 +38,12 @@ public class Launcher {
|
||||
String redisPath = appProps.getProperty("redisPath","FORKJOIN");
|
||||
String srcMLPath = appProps.getProperty("srcMLPath","FORKJOIN");
|
||||
|
||||
// String parameter = args[2];
|
||||
String parameter = null;
|
||||
String parameter = args[2];
|
||||
// String parameter = null;
|
||||
// String parameter = "if";
|
||||
// String parameter = "L1";
|
||||
// String jobType = args[1];
|
||||
String jobType = "RICHEDITSCRIPT";
|
||||
String jobType = args[1];
|
||||
// String jobType = "RICHEDITSCRIPT";
|
||||
// String jobType = "LOAD";
|
||||
// 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()) {
|
||||
jedis.select(2);
|
||||
for (String samePair : samePairs) {
|
||||
// try (Jedis jedis = outerPool.getResource()) {
|
||||
// jedis.select(2);
|
||||
// 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.set(samePair, "1");
|
||||
}
|
||||
jedis.select(0);
|
||||
// jedis.flushDB();
|
||||
jedis.del("compare");
|
||||
for (String errorPair : errorPairs) {
|
||||
jedis.hset("compare", errorPair, "1");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// }
|
||||
//
|
||||
//
|
||||
// }
|
||||
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) {
|
||||
// log.info("Same pairs size "+samePairs.size());
|
||||
@@ -113,23 +169,20 @@ public class CompareTrees {
|
||||
// JedisPool outerPool = null;
|
||||
switch (treeType) {
|
||||
case "single":
|
||||
oldPair = EDiffHelper.getActions(keyName, i, outerPool, filenames);
|
||||
newPair = EDiffHelper.getActions(keyName, j, outerPool, filenames);
|
||||
ITree oldActionTree = oldPair.getValue0();
|
||||
ITree newActionTree = newPair.getValue0();
|
||||
HierarchicalActionSet oldProject = oldPair.getValue1();
|
||||
HierarchicalActionSet newProject = newPair.getValue1();
|
||||
|
||||
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");
|
||||
|
||||
|
||||
ITree oldShapeTree = EDiffHelper.getShapeTree(oldProject);
|
||||
ITree newShapeTree = EDiffHelper.getShapeTree(newProject);
|
||||
|
||||
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())){
|
||||
if(oldShapeTree.equals(newShapeTree)){
|
||||
if(oldActionTree.equals(newActionTree)){
|
||||
if(oldTargetTree.equals(newTargetTree)){
|
||||
samePairs.add(matchKey);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package edu.lu.uni.serval.fixminer.akka.ediff;
|
||||
|
||||
import com.github.gumtreediff.tree.ITree;
|
||||
import edu.lu.uni.serval.utils.EDiffHelper;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
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);
|
||||
|
||||
// try (Jedis inner = innerPool.getResource()) {
|
||||
//
|
||||
// inner.hset("dump".getBytes(),key.getBytes(),EDiffHelper.kryoSerialize(actionSet));
|
||||
// }
|
||||
File f = new File(root+"dumps/"+astNodeType+"/"+String.valueOf(size)+"/");
|
||||
f.mkdirs();
|
||||
f = new File(root+"dumps/"+key);
|
||||
ITree targetTree = EDiffHelper.getTargets(actionSet);
|
||||
ITree actionTree = EDiffHelper.getActionTrees(actionSet);
|
||||
ITree shapeTree = EDiffHelper.getShapeTree(actionSet);
|
||||
try (Jedis inner = innerPool.getResource()) {
|
||||
|
||||
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,actionSet.toString().getBytes());
|
||||
// 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/"
|
||||
|
||||
// msgFiles = msgFiles.subList(0,1000);
|
||||
// msgFiles = msgFiles.subList(0,3000);
|
||||
if (msgFiles == null)
|
||||
continue;
|
||||
allMessageFiles.addAll(msgFiles);
|
||||
|
||||
@@ -30,12 +30,12 @@ public class ClusterToPattern {
|
||||
while (!outer.ping().equals("PONG")) {
|
||||
log.info("wait");
|
||||
}
|
||||
byte[] s = outer.hget("dump".getBytes(), filename.getBytes());
|
||||
HierarchicalActionSet actionSet = (HierarchicalActionSet) EDiffHelper.kryoDeseerialize(s);
|
||||
if (actionSet == null){
|
||||
throw new Error(filename +" not found");
|
||||
}
|
||||
String s1 = actionSet.toString();
|
||||
// byte[] s = outer.hget("dump".getBytes(), filename.getBytes());
|
||||
// HierarchicalActionSet actionSet = (HierarchicalActionSet) EDiffHelper.kryoDeseerialize(s);
|
||||
// if (actionSet == null){
|
||||
// throw new Error(filename +" not found");
|
||||
// }
|
||||
String s1 = outer.hget("dump",filename);
|
||||
// outer.close();
|
||||
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) {
|
||||
|
||||
@@ -351,12 +371,7 @@ public class EDiffHelper {
|
||||
actionSet = (HierarchicalActionSet) EDiffHelper.kryoDeseerialize(s);
|
||||
|
||||
|
||||
ITree parent = null;
|
||||
ITree children = null;
|
||||
TreeContext tc = new TreeContext();
|
||||
tree = EDiffHelper.getActionTree(actionSet, parent, children, tc);
|
||||
//tree.setParent(null);
|
||||
tc.validate();
|
||||
tree = getActionTrees(actionSet);
|
||||
}catch (Exception e) {
|
||||
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){
|
||||
|
||||
int height = tc.getHeight();
|
||||
|
||||
@@ -3,11 +3,11 @@ pjName = gumInput
|
||||
portInner = 6380
|
||||
portDumps = 6399
|
||||
parallelism = AKKA
|
||||
numOfWorkers = 14
|
||||
numOfWorkers = 7
|
||||
|
||||
inputPath = /Users/anil.koyuncu/projects/fixminer/gumInputLinux
|
||||
redisPath = /Users/anil.koyuncu/projects/fixminer/fixminer-core/python/data/redis
|
||||
srcMLPath= /Users/anil.koyuncu/Downloads/srcML/src2srcml
|
||||
inputPath = /Users/anilkoyuncu/projects/gumInputLinux
|
||||
redisPath = /Users/anilkoyuncu/projects/fixminer/fixminer-core/python/data/redis
|
||||
srcMLPath= /Users/anilkoyuncu/Downloads/srcML2/src2srcml
|
||||
actionType = ALL
|
||||
eDiffTimeout = 900
|
||||
|
||||
|
||||
Reference in New Issue
Block a user