new file: Makefile

deleted:    Test.java
	modified:   src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java
This commit is contained in:
pl@gohorb.ba-horb.de 2023-03-31 15:54:17 +02:00
parent 79335449d0
commit 317f8b1aad
3 changed files with 32 additions and 15 deletions

11
Makefile Normal file
View File

@ -0,0 +1,11 @@
full:
mvn -DskipTests package
cp target/JavaTXcompiler-0.1-jar-with-dependencies.jar target/JavaTXcompiler-0.1-jar-with-dependencies_full.jar
NoMinMax:
mvn -DskipTests package
cp target/JavaTXcompiler-0.1-jar-with-dependencies.jar target/JavaTXcompiler-0.1-jar-with-dependencies_NoMinMax.jar
NoErase:
mvn -DskipTests package
cp target/JavaTXcompiler-0.1-jar-with-dependencies.jar target/JavaTXcompiler-0.1-jar-with-dependencies_NoErase.jar

View File

@ -1,7 +0,0 @@
public interface Test<A, B> extends Base<A, B> {
}
interface Base<A, B> {
}

View File

@ -127,6 +127,8 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
static int noBacktracking; static int noBacktracking;
static int noLoop;
static Integer noShortendElements = 0; static Integer noShortendElements = 0;
Boolean myIsCanceled = false; Boolean myIsCanceled = false;
@ -655,6 +657,10 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
//oneElems: Alle 1-elementigen Mengen, die nur ein Paar //oneElems: Alle 1-elementigen Mengen, die nur ein Paar
//a <. theta, theta <. a oder a =. theta enthalten //a <. theta, theta <. a oder a =. theta enthalten
//statistics
if (finalresult) writeStatistics("\nNumber of Constraints (" + rekTiefe + "): " + topLevelSets.size());
Set<Set<UnifyPair>> oneElems = new HashSet<>(); Set<Set<UnifyPair>> oneElems = new HashSet<>();
oneElems.addAll(topLevelSets.stream() oneElems.addAll(topLevelSets.stream()
.filter(x -> x.size()==1) .filter(x -> x.size()==1)
@ -672,6 +678,9 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
Set<? extends Set<UnifyPair>> nextSet = optNextSet.get(); Set<? extends Set<UnifyPair>> nextSet = optNextSet.get();
//writeLog("nextSet: " + nextSet.toString()); //writeLog("nextSet: " + nextSet.toString());
List<Set<UnifyPair>> nextSetasList =new ArrayList<>(nextSet); List<Set<UnifyPair>> nextSetasList =new ArrayList<>(nextSet);
writeStatistics(" Start Number of elements( " + nextSetasList.get(0).stream().findFirst().get().getBasePair() +"): (" + rekTiefe + "): " + nextSetasList.size());
/* /*
try { try {
//List<Set<UnifyPair>> //List<Set<UnifyPair>>
@ -741,7 +750,6 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
variance = optVariance.isPresent() ? optVariance.get() : 2; variance = optVariance.isPresent() ? optVariance.get() : 2;
} }
/* Varianzbestimmung Ende */ /* Varianzbestimmung Ende */
//variance = 2;//statistics
//writeLog("nextSetasList: " + nextSetasList.toString()); //writeLog("nextSetasList: " + nextSetasList.toString());
Set<UnifyPair> nextSetElem = nextSetasList.get(0); Set<UnifyPair> nextSetElem = nextSetasList.get(0);
@ -784,12 +792,11 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
} }
/* sameEqSet-Bestimmung Ende */ /* sameEqSet-Bestimmung Ende */
//statistics
writeStatistics("\nNumber of Constraints (" + rekTiefe + "): " + topLevelSets.size());
Set<UnifyPair> a = null; Set<UnifyPair> a = null;
while (nextSetasList.size() > 0) { while (nextSetasList.size() > 0) {
//statistics //statistics
writeStatistics(" Number of elements( " + nextSetasList.get(0).stream().findFirst().get().getBasePair() +"): (" + rekTiefe + "): " + nextSetasList.size()); writeStatistics(" Actual Number of elements( " + nextSetasList.get(0).stream().findFirst().get().getBasePair() +"): (" + rekTiefe + "): " + nextSetasList.size());
Set<UnifyPair> a_last = a; Set<UnifyPair> a_last = a;
/* Liste der Faelle für die parallele Verarbeitung /* Liste der Faelle für die parallele Verarbeitung
@ -824,6 +831,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
nextSetasListRest.remove(a_next); nextSetasListRest.remove(a_next);
} }
} }
writeStatistics("Rest:" + nextSetasListRest.toString());
//Alle maximale Elemente in nextSetasListRest bestimmen //Alle maximale Elemente in nextSetasListRest bestimmen
//nur für diese wird parallele Berechnung angestossen. //nur für diese wird parallele Berechnung angestossen.
@ -879,7 +887,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
} }
} }
} }
writeStatistics(a.toString());
if (oderConstraint) {//Methodconstraints werden abgespeichert für die Bytecodegenerierung von Methodenaufrufen if (oderConstraint) {//Methodconstraints werden abgespeichert für die Bytecodegenerierung von Methodenaufrufen
methodSignatureConstraint.addAll(((Constraint<UnifyPair>)a).getmethodSignatureConstraint()); methodSignatureConstraint.addAll(((Constraint<UnifyPair>)a).getmethodSignatureConstraint());
//System.out.println("ERSTELLUNG: " +methodSignatureConstraint); //System.out.println("ERSTELLUNG: " +methodSignatureConstraint);
@ -1318,7 +1326,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
//break; //break;
} }
/* auskommentiert um alle Max und min Betrachtung auszuschalten ANFANG */ /* auskommentiert um alle Max und min Betrachtung auszuschalten ANFANG
if (!result.isEmpty() && (!isUndefinedPairSetSet(res) || !aParDef.isEmpty())) { if (!result.isEmpty() && (!isUndefinedPairSetSet(res) || !aParDef.isEmpty())) {
if (nextSetasList.iterator().hasNext() && nextSetasList.iterator().next().stream().filter(x -> x.getLhsType().getName().equals("B")).findFirst().isPresent() && nextSetasList.size()>1) if (nextSetasList.iterator().hasNext() && nextSetasList.iterator().next().stream().filter(x -> x.getLhsType().getName().equals("B")).findFirst().isPresent() && nextSetasList.size()>1)
System.out.print(""); System.out.print("");
@ -1455,7 +1463,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
writeLog("a: " + rekTiefe + " variance: " + variance + a.toString()); writeLog("a: " + rekTiefe + " variance: " + variance + a.toString());
} }
} }
/* auskommentiert um alle Max und min Betrachtung auszuschalten ENDE */ auskommentiert um alle Max und min Betrachtung auszuschalten ENDE */
if (isUndefinedPairSetSet(res) && aParDef.isEmpty()) { if (isUndefinedPairSetSet(res) && aParDef.isEmpty()) {
int nofstred= 0; int nofstred= 0;
@ -1490,6 +1498,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
if (res.size() > 1) { if (res.size() > 1) {
System.out.println(); System.out.println();
} }
/* statistics no erase
writeLog("nextSetasList vor filter-Aufruf: " + nextSetasList); writeLog("nextSetasList vor filter-Aufruf: " + nextSetasList);
if (!oderConstraint) {//PL 2023-02-08 eingefuegt: Bei oderconstraints sind Subststitutionen nicht als Substitutionen in idesem Sinne zu sehen if (!oderConstraint) {//PL 2023-02-08 eingefuegt: Bei oderconstraints sind Subststitutionen nicht als Substitutionen in idesem Sinne zu sehen
nextSetasList = nextSetasList.stream().filter(x -> { nextSetasList = nextSetasList.stream().filter(x -> {
@ -1502,6 +1511,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
.collect(Collectors.toCollection(ArrayList::new)); .collect(Collectors.toCollection(ArrayList::new));
} }
writeLog("nextSetasList nach filter-Aufruf: " + nextSetasList); writeLog("nextSetasList nach filter-Aufruf: " + nextSetasList);
*/
nofstred = nextSetasList.size(); nofstred = nextSetasList.size();
//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))
@ -1519,6 +1529,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
writeLog("Number of all erased Elements (undef): " + noAllErasedElements.toString()); writeLog("Number of all erased Elements (undef): " + noAllErasedElements.toString());
noBacktracking++; noBacktracking++;
writeLog("Number of Backtracking: " + noBacktracking); writeLog("Number of Backtracking: " + noBacktracking);
writeStatistics("Number of erased elements: " + (len - nextSetasList.size()));
writeStatistics("Number of Backtracking: " + noBacktracking); writeStatistics("Number of Backtracking: " + noBacktracking);
System.out.println(""); System.out.println("");
} }
@ -1530,7 +1541,9 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
//} //}
//else result.stream().filter(y -> !isUndefinedPairSet(y)); //else result.stream().filter(y -> !isUndefinedPairSet(y));
writeLog("res: " + res.toString()); writeLog("res: " + res.toString());
writeStatistics("End Number of Elements (" + rekTiefe + "): " + nextSetasList.size()); writeStatistics(" End Number of Elements (" + rekTiefe + "): " + nextSetasList.size());
noLoop++;
writeStatistics("Number of Loops: " + noLoop);
} }
//2020-02-02: if (variance ==2) Hier Aufruf von filterOverriding einfuegen //2020-02-02: if (variance ==2) Hier Aufruf von filterOverriding einfuegen
writeLog("Return computeCR: " + result.toString()); writeLog("Return computeCR: " + result.toString());