From 317f8b1aaddc1b4bf3a8151d11f1594223657b0f Mon Sep 17 00:00:00 2001 From: "pl@gohorb.ba-horb.de" Date: Fri, 31 Mar 2023 15:54:17 +0200 Subject: [PATCH] new file: Makefile deleted: Test.java modified: src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java --- Makefile | 11 +++++++ Test.java | 7 ----- .../typeinference/unify/TypeUnifyTask.java | 29 ++++++++++++++----- 3 files changed, 32 insertions(+), 15 deletions(-) create mode 100644 Makefile delete mode 100644 Test.java diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..e60e4b4a --- /dev/null +++ b/Makefile @@ -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 diff --git a/Test.java b/Test.java deleted file mode 100644 index b0e1ed48..00000000 --- a/Test.java +++ /dev/null @@ -1,7 +0,0 @@ -public interface Test extends Base { - -} - -interface Base { - -} diff --git a/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java b/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java index f014e812..27731c24 100644 --- a/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java +++ b/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java @@ -127,6 +127,8 @@ public class TypeUnifyTask extends RecursiveTask>> { static int noBacktracking; + static int noLoop; + static Integer noShortendElements = 0; Boolean myIsCanceled = false; @@ -655,6 +657,10 @@ public class TypeUnifyTask extends RecursiveTask>> { //oneElems: Alle 1-elementigen Mengen, die nur ein Paar //a <. theta, theta <. a oder a =. theta enthalten + + //statistics + if (finalresult) writeStatistics("\nNumber of Constraints (" + rekTiefe + "): " + topLevelSets.size()); + Set> oneElems = new HashSet<>(); oneElems.addAll(topLevelSets.stream() .filter(x -> x.size()==1) @@ -672,6 +678,9 @@ public class TypeUnifyTask extends RecursiveTask>> { Set> nextSet = optNextSet.get(); //writeLog("nextSet: " + nextSet.toString()); List> nextSetasList =new ArrayList<>(nextSet); + + writeStatistics(" Start Number of elements( " + nextSetasList.get(0).stream().findFirst().get().getBasePair() +"): (" + rekTiefe + "): " + nextSetasList.size()); + /* try { //List> @@ -741,7 +750,6 @@ public class TypeUnifyTask extends RecursiveTask>> { variance = optVariance.isPresent() ? optVariance.get() : 2; } /* Varianzbestimmung Ende */ - //variance = 2;//statistics //writeLog("nextSetasList: " + nextSetasList.toString()); Set nextSetElem = nextSetasList.get(0); @@ -784,12 +792,11 @@ public class TypeUnifyTask extends RecursiveTask>> { } /* sameEqSet-Bestimmung Ende */ - //statistics - writeStatistics("\nNumber of Constraints (" + rekTiefe + "): " + topLevelSets.size()); + Set a = null; while (nextSetasList.size() > 0) { //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 a_last = a; /* Liste der Faelle für die parallele Verarbeitung @@ -824,6 +831,7 @@ public class TypeUnifyTask extends RecursiveTask>> { nextSetasListRest.remove(a_next); } } + writeStatistics("Rest:" + nextSetasListRest.toString()); //Alle maximale Elemente in nextSetasListRest bestimmen //nur für diese wird parallele Berechnung angestossen. @@ -879,7 +887,7 @@ public class TypeUnifyTask extends RecursiveTask>> { } } } - + writeStatistics(a.toString()); if (oderConstraint) {//Methodconstraints werden abgespeichert für die Bytecodegenerierung von Methodenaufrufen methodSignatureConstraint.addAll(((Constraint)a).getmethodSignatureConstraint()); //System.out.println("ERSTELLUNG: " +methodSignatureConstraint); @@ -1318,7 +1326,7 @@ public class TypeUnifyTask extends RecursiveTask>> { //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 (nextSetasList.iterator().hasNext() && nextSetasList.iterator().next().stream().filter(x -> x.getLhsType().getName().equals("B")).findFirst().isPresent() && nextSetasList.size()>1) System.out.print(""); @@ -1455,7 +1463,7 @@ public class TypeUnifyTask extends RecursiveTask>> { 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()) { int nofstred= 0; @@ -1490,6 +1498,7 @@ public class TypeUnifyTask extends RecursiveTask>> { if (res.size() > 1) { System.out.println(); } + /* statistics no erase 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 nextSetasList = nextSetasList.stream().filter(x -> { @@ -1502,6 +1511,7 @@ public class TypeUnifyTask extends RecursiveTask>> { .collect(Collectors.toCollection(ArrayList::new)); } writeLog("nextSetasList nach filter-Aufruf: " + nextSetasList); + */ nofstred = nextSetasList.size(); //NOCH NICHT korrekt PL 2018-10-12 //nextSetasList = nextSetasList.stream().filter(y -> couldBecorrect(reducedUndefResSubstGroundedBasePair, y)) @@ -1519,6 +1529,7 @@ public class TypeUnifyTask extends RecursiveTask>> { writeLog("Number of all erased Elements (undef): " + noAllErasedElements.toString()); noBacktracking++; writeLog("Number of Backtracking: " + noBacktracking); + writeStatistics("Number of erased elements: " + (len - nextSetasList.size())); writeStatistics("Number of Backtracking: " + noBacktracking); System.out.println(""); } @@ -1530,7 +1541,9 @@ public class TypeUnifyTask extends RecursiveTask>> { //} //else result.stream().filter(y -> !isUndefinedPairSet(y)); 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 writeLog("Return computeCR: " + result.toString());