forked from JavaTX/JavaCompilerCore
removed useless synchronized-blocks and concenated multiple writes to logfile
This commit is contained in:
parent
0807885465
commit
441e50a70d
@ -378,8 +378,8 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
|
|
||||||
eq0.forEach(x -> x.disableCondWildcards());
|
eq0.forEach(x -> x.disableCondWildcards());
|
||||||
|
|
||||||
writeLog(nOfUnify.toString() + " Unifikation nach applyTypeUnificationRules: " + eq.toString());
|
writeLog(nOfUnify.toString() + " Unifikation nach applyTypeUnificationRules: " + eq.toString() + "\n"
|
||||||
writeLog(nOfUnify.toString() + " Oderconstraints nach applyTypeUnificationRules: " + oderConstraints.toString());
|
+ nOfUnify.toString() + " Oderconstraints nach applyTypeUnificationRules: " + oderConstraints.toString());
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Step 2 and 3: Create a subset eq1s of pairs where both sides are TPH and eq2s of the other pairs
|
* Step 2 and 3: Create a subset eq1s of pairs where both sides are TPH and eq2s of the other pairs
|
||||||
@ -438,8 +438,8 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
if(!undefinedPairs.isEmpty()) {
|
if(!undefinedPairs.isEmpty()) {
|
||||||
noUndefPair++;
|
noUndefPair++;
|
||||||
for (UnifyPair up : undefinedPairs) {
|
for (UnifyPair up : undefinedPairs) {
|
||||||
writeLog(noUndefPair.toString() + " UndefinedPairs; " + up);
|
writeLog(noUndefPair.toString() + " UndefinedPairs; " + up + "\n"
|
||||||
writeLog("BasePair; " + up.getBasePair());
|
+ "BasePair; " + up.getBasePair());
|
||||||
}
|
}
|
||||||
Set<Set<UnifyPair>> error = new HashSet<>();
|
Set<Set<UnifyPair>> error = new HashSet<>();
|
||||||
undefinedPairs = undefinedPairs.stream().map(x -> { x.setUndefinedPair(); return x;}).collect(Collectors.toCollection(HashSet::new));
|
undefinedPairs = undefinedPairs.stream().map(x -> { x.setUndefinedPair(); return x;}).collect(Collectors.toCollection(HashSet::new));
|
||||||
@ -806,8 +806,8 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
*/
|
*/
|
||||||
List<Set<UnifyPair>> nextSetasListOderConstraints = new ArrayList<>();
|
List<Set<UnifyPair>> nextSetasListOderConstraints = new ArrayList<>();
|
||||||
|
|
||||||
writeLog("nextSet: " + nextSet.toString());
|
writeLog("nextSet: " + nextSet.toString() + "\n"
|
||||||
writeLog("nextSetasList: " + nextSetasList.toString());
|
+ "nextSetasList: " + nextSetasList.toString());
|
||||||
|
|
||||||
/* staistics Nextvar an Hand Varianzbestimmung auskommentieren Anfang
|
/* staistics Nextvar an Hand Varianzbestimmung auskommentieren Anfang
|
||||||
if (variance == 1) {
|
if (variance == 1) {
|
||||||
@ -935,15 +935,14 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
}
|
}
|
||||||
/* FORK ENDE */
|
/* FORK ENDE */
|
||||||
|
|
||||||
synchronized (this) {
|
writeLog("a in " + variance + " "+ a + "\n" +
|
||||||
writeLog("a in " + variance + " "+ a);
|
"nextSetasListRest: " + nextSetasListRest.toString());
|
||||||
writeLog("nextSetasListRest: " + nextSetasListRest.toString());
|
|
||||||
}
|
|
||||||
while (!nextSetasList.isEmpty()) {
|
while (!nextSetasList.isEmpty()) {
|
||||||
Set<UnifyPair> nSaL = nextSetasList.remove(0);
|
Set<UnifyPair> nSaL = nextSetasList.remove(0);
|
||||||
synchronized (this) { //nextSetasList.remove(nSaL);
|
//nextSetasList.remove(nSaL);
|
||||||
writeLog("1 RM" + nSaL.toString());
|
writeLog("1 RM" + nSaL.toString());
|
||||||
}
|
|
||||||
|
|
||||||
if (!oderConstraint) {
|
if (!oderConstraint) {
|
||||||
|
|
||||||
@ -975,47 +974,44 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
//res = unify2(newElemsOrig, newEqOrig, newOderConstraintsOrig, fc, parallel, rekTiefe);
|
//res = unify2(newElemsOrig, newEqOrig, newOderConstraintsOrig, fc, parallel, rekTiefe);
|
||||||
|
|
||||||
/* FORK ANFANG */
|
/* FORK ANFANG */
|
||||||
synchronized (this) {
|
|
||||||
writeLog("wait "+ forkOrig.thNo);
|
writeLog("wait "+ forkOrig.thNo);
|
||||||
|
noOfThread--;
|
||||||
|
res = forkOrig.join();
|
||||||
|
synchronized (usedTasks) {
|
||||||
|
if (this.myIsCancelled()) {
|
||||||
|
return new HashSet<>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//noOfThread++;
|
||||||
|
forkOrig.writeLog("final Orig 1");
|
||||||
|
forkOrig.closeLogFile();
|
||||||
|
//Set<Set<UnifyPair>> fork_res = forkOrig.join();
|
||||||
|
writeLog("JoinOrig " + new Integer(forkOrig.thNo).toString());
|
||||||
|
//noOfThread--; an das Ende von compute verschoben
|
||||||
|
//add_res.add(fork_res);
|
||||||
|
/* FORK ENDE */
|
||||||
|
|
||||||
|
forks.forEach(x -> writeLog("wait: " + x.thNo));
|
||||||
|
for(TypeUnify2Task fork : forks) {
|
||||||
noOfThread--;
|
noOfThread--;
|
||||||
res = forkOrig.join();
|
Set<Set<UnifyPair>> fork_res = fork.join();
|
||||||
synchronized (usedTasks) {
|
synchronized (usedTasks) {
|
||||||
if (this.myIsCancelled()) {
|
if (this.myIsCancelled()) {
|
||||||
return new HashSet<>();
|
return new HashSet<>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//noOfThread++;
|
//noOfThread++;
|
||||||
forkOrig.writeLog("final Orig 1");
|
|
||||||
forkOrig.closeLogFile();
|
|
||||||
//Set<Set<UnifyPair>> fork_res = forkOrig.join();
|
|
||||||
writeLog("JoinOrig " + new Integer(forkOrig.thNo).toString());
|
|
||||||
//noOfThread--; an das Ende von compute verschoben
|
//noOfThread--; an das Ende von compute verschoben
|
||||||
//add_res.add(fork_res);
|
writeLog("Join " + new Integer(fork.thNo).toString() + "\n" +
|
||||||
};
|
"fork_res: " + fork_res.toString() + "\n" +
|
||||||
/* FORK ENDE */
|
new Boolean((isUndefinedPairSetSet(fork_res))).toString());
|
||||||
|
add_res.add(fork_res);
|
||||||
forks.forEach(x -> writeLog("wait: " + x.thNo));
|
if (!isUndefinedPairSetSet(fork_res)) {
|
||||||
for(TypeUnify2Task fork : forks) {
|
aParDef.add(fork.getNextSetElement());
|
||||||
synchronized (this) {
|
}
|
||||||
noOfThread--;
|
fork.writeLog("final 1");
|
||||||
Set<Set<UnifyPair>> fork_res = fork.join();
|
fork.closeLogFile();
|
||||||
synchronized (usedTasks) {
|
|
||||||
if (this.myIsCancelled()) {
|
|
||||||
return new HashSet<>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//noOfThread++;
|
|
||||||
writeLog("Join " + new Integer(fork.thNo).toString());
|
|
||||||
//noOfThread--; an das Ende von compute verschoben
|
|
||||||
writeLog("fork_res: " + fork_res.toString());
|
|
||||||
writeLog(new Boolean((isUndefinedPairSetSet(fork_res))).toString());
|
|
||||||
add_res.add(fork_res);
|
|
||||||
if (!isUndefinedPairSetSet(fork_res)) {
|
|
||||||
aParDef.add(fork.getNextSetElement());
|
|
||||||
}
|
|
||||||
fork.writeLog("final 1");
|
|
||||||
fork.closeLogFile();
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
//noOfThread++;
|
//noOfThread++;
|
||||||
} else {
|
} else {
|
||||||
@ -1037,15 +1033,14 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
}
|
}
|
||||||
/* FORK ENDE */
|
/* FORK ENDE */
|
||||||
|
|
||||||
synchronized (this) {
|
|
||||||
writeLog("a in " + variance + " "+ a);
|
writeLog("a in " + variance + " "+ a + "\n" +
|
||||||
writeLog("nextSetasListRest: " + nextSetasListRest.toString());
|
"nextSetasListRest: " + nextSetasListRest.toString());
|
||||||
}
|
|
||||||
while (!nextSetasList.isEmpty()) {
|
while (!nextSetasList.isEmpty()) {
|
||||||
Set<UnifyPair> nSaL = nextSetasList.remove(0);
|
Set<UnifyPair> nSaL = nextSetasList.remove(0);
|
||||||
synchronized (this) { //nextSetasList.remove(nSaL);
|
//nextSetasList.remove(nSaL);
|
||||||
writeLog("-1 RM" + nSaL.toString());
|
writeLog("-1 RM" + nSaL.toString());
|
||||||
}
|
|
||||||
|
|
||||||
if (!oderConstraint) {
|
if (!oderConstraint) {
|
||||||
/* statistics sameEq wird nicht betrachtet ANGFANG
|
/* statistics sameEq wird nicht betrachtet ANGFANG
|
||||||
@ -1076,48 +1071,45 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
//res = unify2(newElemsOrig, newEqOrig, newOderConstraintsOrig, fc, parallel, rekTiefe);
|
//res = unify2(newElemsOrig, newEqOrig, newOderConstraintsOrig, fc, parallel, rekTiefe);
|
||||||
|
|
||||||
/* FORK ANFANG */
|
/* FORK ANFANG */
|
||||||
synchronized (this) {
|
writeLog("wait "+ forkOrig.thNo);
|
||||||
writeLog("wait "+ forkOrig.thNo);
|
noOfThread--;
|
||||||
|
res = forkOrig.join();
|
||||||
|
synchronized (usedTasks) {
|
||||||
|
if (this.myIsCancelled()) {
|
||||||
|
return new HashSet<>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//noOfThread++;
|
||||||
|
forkOrig.writeLog("final Orig -1");
|
||||||
|
forkOrig.closeLogFile();
|
||||||
|
//Set<Set<UnifyPair>> fork_res = forkOrig.join();
|
||||||
|
writeLog("JoinOrig " + new Integer(forkOrig.thNo).toString());
|
||||||
|
//noOfThread--; an das Ende von compute verschoben
|
||||||
|
//add_res.add(fork_res);
|
||||||
|
/* FORK ENDE */
|
||||||
|
|
||||||
|
forks.forEach(x -> writeLog("wait: " + x.thNo));
|
||||||
|
for(TypeUnify2Task fork : forks) {
|
||||||
noOfThread--;
|
noOfThread--;
|
||||||
res = forkOrig.join();
|
Set<Set<UnifyPair>> fork_res = fork.join();
|
||||||
synchronized (usedTasks) {
|
synchronized (usedTasks) {
|
||||||
if (this.myIsCancelled()) {
|
if (this.myIsCancelled()) {
|
||||||
return new HashSet<>();
|
return new HashSet<>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//noOfThread++;
|
//noOfThread++;
|
||||||
forkOrig.writeLog("final Orig -1");
|
writeLog("Join " + new Integer(fork.thNo).toString());
|
||||||
forkOrig.closeLogFile();
|
|
||||||
//Set<Set<UnifyPair>> fork_res = forkOrig.join();
|
|
||||||
writeLog("JoinOrig " + new Integer(forkOrig.thNo).toString());
|
|
||||||
//noOfThread--; an das Ende von compute verschoben
|
//noOfThread--; an das Ende von compute verschoben
|
||||||
//add_res.add(fork_res);
|
writeLog("fork_res: " + fork_res.toString());
|
||||||
|
writeLog(new Boolean((isUndefinedPairSetSet(fork_res))).toString());
|
||||||
|
add_res.add(fork_res);
|
||||||
|
if (!isUndefinedPairSetSet(fork_res)) {
|
||||||
|
aParDef.add(fork.getNextSetElement());
|
||||||
|
}
|
||||||
|
fork.writeLog("final -1");
|
||||||
|
fork.closeLogFile();
|
||||||
};
|
};
|
||||||
/* FORK ENDE */
|
|
||||||
|
|
||||||
forks.forEach(x -> writeLog("wait: " + x.thNo));
|
|
||||||
for(TypeUnify2Task fork : forks) {
|
|
||||||
synchronized (this) {
|
|
||||||
noOfThread--;
|
|
||||||
Set<Set<UnifyPair>> fork_res = fork.join();
|
|
||||||
synchronized (usedTasks) {
|
|
||||||
if (this.myIsCancelled()) {
|
|
||||||
return new HashSet<>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//noOfThread++;
|
|
||||||
writeLog("Join " + new Integer(fork.thNo).toString());
|
|
||||||
//noOfThread--; an das Ende von compute verschoben
|
|
||||||
writeLog("fork_res: " + fork_res.toString());
|
|
||||||
writeLog(new Boolean((isUndefinedPairSetSet(fork_res))).toString());
|
|
||||||
add_res.add(fork_res);
|
|
||||||
if (!isUndefinedPairSetSet(fork_res)) {
|
|
||||||
aParDef.add(fork.getNextSetElement());
|
|
||||||
}
|
|
||||||
fork.writeLog("final -1");
|
|
||||||
fork.closeLogFile();
|
|
||||||
};
|
|
||||||
}
|
|
||||||
//noOfThread++;
|
//noOfThread++;
|
||||||
} else {
|
} else {
|
||||||
if(parallel && (variance == 2) && noOfThread <= MaxNoOfThreads) {
|
if(parallel && (variance == 2) && noOfThread <= MaxNoOfThreads) {
|
||||||
@ -1139,10 +1131,9 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
}
|
}
|
||||||
/* FORK ENDE */
|
/* FORK ENDE */
|
||||||
|
|
||||||
synchronized (this) {
|
writeLog("a in " + variance + " "+ a + "\n" +
|
||||||
writeLog("a in " + variance + " "+ a);
|
"nextSetasListRest: " + nextSetasListRest.toString());
|
||||||
writeLog("nextSetasListRest: " + nextSetasListRest.toString());
|
|
||||||
}
|
|
||||||
while (!nextSetasList.isEmpty()) {
|
while (!nextSetasList.isEmpty()) {
|
||||||
Set<UnifyPair> nSaL = nextSetasList.remove(0);
|
Set<UnifyPair> nSaL = nextSetasList.remove(0);
|
||||||
//nextSetasList.remove(nSaL); //PL einkommentiert 20-02-03
|
//nextSetasList.remove(nSaL); //PL einkommentiert 20-02-03
|
||||||
@ -1162,41 +1153,39 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
//res = unify2(newElemsOrig, newEqOrig, newOderConstraintsOrig, fc, parallel, rekTiefe);
|
//res = unify2(newElemsOrig, newEqOrig, newOderConstraintsOrig, fc, parallel, rekTiefe);
|
||||||
|
|
||||||
/* FORK ANFANG */
|
/* FORK ANFANG */
|
||||||
synchronized (this) {
|
|
||||||
writeLog("wait "+ forkOrig.thNo);
|
writeLog("wait "+ forkOrig.thNo);
|
||||||
noOfThread--;
|
noOfThread--;
|
||||||
res = forkOrig.join();
|
res = forkOrig.join();
|
||||||
|
synchronized (usedTasks) {
|
||||||
|
if (this.myIsCancelled()) {
|
||||||
|
return new HashSet<>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//noOfThread++;
|
||||||
|
forkOrig.writeLog("final Orig 2");
|
||||||
|
forkOrig.closeLogFile();
|
||||||
|
//Set<Set<UnifyPair>> fork_res = forkOrig.join();
|
||||||
|
writeLog("JoinOrig " + new Integer(forkOrig.thNo).toString());
|
||||||
|
//noOfThread--; an das Ende von compute verschoben
|
||||||
|
//add_res.add(fork_res); //vermutlich falsch
|
||||||
|
|
||||||
|
/* FORK ENDE */
|
||||||
|
forks.forEach(x -> writeLog("wait: " + x.thNo));
|
||||||
|
for(TypeUnify2Task fork : forks) {
|
||||||
|
noOfThread--;
|
||||||
|
Set<Set<UnifyPair>> fork_res = fork.join();
|
||||||
synchronized (usedTasks) {
|
synchronized (usedTasks) {
|
||||||
if (this.myIsCancelled()) {
|
if (this.myIsCancelled()) {
|
||||||
return new HashSet<>();
|
return new HashSet<>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//noOfThread++;
|
//noOfThread++;
|
||||||
forkOrig.writeLog("final Orig 2");
|
writeLog("Join " + new Integer(fork.thNo).toString());
|
||||||
forkOrig.closeLogFile();
|
|
||||||
//Set<Set<UnifyPair>> fork_res = forkOrig.join();
|
|
||||||
writeLog("JoinOrig " + new Integer(forkOrig.thNo).toString());
|
|
||||||
//noOfThread--; an das Ende von compute verschoben
|
//noOfThread--; an das Ende von compute verschoben
|
||||||
//add_res.add(fork_res); //vermutlich falsch
|
add_res.add(fork_res);
|
||||||
};
|
fork.writeLog("final 2");
|
||||||
/* FORK ENDE */
|
fork.closeLogFile();
|
||||||
forks.forEach(x -> writeLog("wait: " + x.thNo));
|
|
||||||
for(TypeUnify2Task fork : forks) {
|
|
||||||
synchronized (this) {
|
|
||||||
noOfThread--;
|
|
||||||
Set<Set<UnifyPair>> fork_res = fork.join();
|
|
||||||
synchronized (usedTasks) {
|
|
||||||
if (this.myIsCancelled()) {
|
|
||||||
return new HashSet<>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//noOfThread++;
|
|
||||||
writeLog("Join " + new Integer(fork.thNo).toString());
|
|
||||||
//noOfThread--; an das Ende von compute verschoben
|
|
||||||
add_res.add(fork_res);
|
|
||||||
fork.writeLog("final 2");
|
|
||||||
fork.closeLogFile();
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
//noOfThread++;
|
//noOfThread++;
|
||||||
} else {//parallel = false oder MaxNoOfThreads ist erreicht, sequentiell weiterarbeiten
|
} else {//parallel = false oder MaxNoOfThreads ist erreicht, sequentiell weiterarbeiten
|
||||||
@ -1525,15 +1514,15 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
//NOCH NICHT korrekt PL 2018-10-12
|
//NOCH NICHT korrekt PL 2018-10-12
|
||||||
//nextSetasList = nextSetasList.stream().filter(y -> couldBecorrect(reducedUndefResSubstGroundedBasePair, y))
|
//nextSetasList = nextSetasList.stream().filter(y -> couldBecorrect(reducedUndefResSubstGroundedBasePair, y))
|
||||||
// .collect(Collectors.toCollection(ArrayList::new));
|
// .collect(Collectors.toCollection(ArrayList::new));
|
||||||
writeLog("res (undef): " + res.toString());
|
writeLog("res (undef): " + res.toString() + "\n" +
|
||||||
writeLog("abhSubst: " + abhSubst.toString());
|
"abhSubst: " + abhSubst.toString() + "\n" +
|
||||||
writeLog("a2: " + rekTiefe + " " + a.toString());
|
"a2: " + rekTiefe + " " + a.toString() + "\n" +
|
||||||
writeLog("Durchschnitt: " + durchschnitt.toString());
|
"Durchschnitt: " + durchschnitt.toString() + "\n" +
|
||||||
writeLog("nextSet: " + nextSet.toString());
|
"nextSet: " + nextSet.toString() + "\n" +
|
||||||
writeLog("nextSetasList: " + nextSetasList.toString());
|
"nextSetasList: " + nextSetasList.toString() + "\n" +
|
||||||
writeLog("Number first erased Elements (undef): " + (len - nofstred));
|
"Number first erased Elements (undef): " + (len - nofstred) + "\n" +
|
||||||
writeLog("Number second erased Elements (undef): " + (nofstred- nextSetasList.size()));
|
"Number second erased Elements (undef): " + (nofstred- nextSetasList.size()) + "\n" +
|
||||||
writeLog("Number erased Elements (undef): " + (len - nextSetasList.size()));
|
"Number erased Elements (undef): " + (len - nextSetasList.size()));
|
||||||
noAllErasedElements = noAllErasedElements + (len - nextSetasList.size());
|
noAllErasedElements = noAllErasedElements + (len - nextSetasList.size());
|
||||||
writeLog("Number of all erased Elements (undef): " + noAllErasedElements.toString());
|
writeLog("Number of all erased Elements (undef): " + noAllErasedElements.toString());
|
||||||
noBacktracking++;
|
noBacktracking++;
|
||||||
@ -1993,10 +1982,10 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
writeLog("eq2s: " + eq2s.toString());
|
writeLog("eq2s: " + eq2s.toString() + "\n" +
|
||||||
writeLog("eq2sAsListFst: " + eq2sAsListFst.toString());
|
"eq2sAsListFst: " + eq2sAsListFst.toString() + "\n" +
|
||||||
writeLog("eq2sAsListSnd: " + eq2sAsListSnd.toString());
|
"eq2sAsListSnd: " + eq2sAsListSnd.toString() + "\n" +
|
||||||
writeLog("eq2sAsListBack: " + eq2sAsListBack.toString());
|
"eq2sAsListBack: " + eq2sAsListBack.toString());
|
||||||
|
|
||||||
eq2sAsList.addAll(eq2sAsListFst);
|
eq2sAsList.addAll(eq2sAsListFst);
|
||||||
eq2sAsList.addAll(eq2sAsListSnd);
|
eq2sAsList.addAll(eq2sAsListSnd);
|
||||||
|
Loading…
Reference in New Issue
Block a user