Merge branch 'unify' into refactoring

This commit is contained in:
JanUlrich 2016-04-21 14:27:49 +02:00
commit 629d2dcc4d
3 changed files with 9 additions and 2 deletions

View File

@ -356,8 +356,13 @@ public class SourceFile
*/
typinferenzLog.debug("\nUnifiziere Constraints:\n"+constraints, Section.TYPEINFERENCE);
typinferenzLog.debug("\nFC:\n"+finiteClosure, Section.TYPEINFERENCE);
long start = System.currentTimeMillis();
Set<Set<UnifyPair>> unifyResult = new TypeUnify().unify(constraints, finiteClosure);
long time = System.currentTimeMillis()-start;
typinferenzLog.debug("\nErgebnis der Unifizierung:\n"+unifyResult, Section.TYPEINFERENCE);
typinferenzLog.debug("\nAnzahl Lösungen:\n"+unifyResult.size(), Section.TYPEINFERENCE);
typinferenzLog.debug("\nZeit für Unifizierung: "+time + "ms", Section.TYPEINFERENCE);
Menge<Menge<Pair>> convertedResult = unifyResult.parallelStream().<Menge<Pair>>map((Set<UnifyPair> resultSet)->{
Menge<Pair> innerConvert = resultSet.stream().map((UnifyPair mp)->UnifyTypeFactory.convert(mp))

View File

@ -194,7 +194,7 @@ public class UnifyTypeFactory {
public static Type convert(PlaceholderType t) {
TypePlaceholder ret = TypePlaceholder.getInstance(t.getName());
if(ret == null){ //Dieser TPH wurde vom Unifikationsalgorithmus erstellt
ret = TypePlaceholder.fresh(t.getName(), NULL_NODE);
ret = TypePlaceholder.fresh(NULL_NODE);
}
return ret;
}

View File

@ -49,7 +49,9 @@ public class TypeUnify {
*/
protected IRuleSet rules = new RuleSet();
protected boolean parallel = true;
// Scheint momentan eher zu verlangsamen, vermutlich zu viele threads,
// threadpool und task-queue einbauen und minimale problemgröße für neuen thread
protected boolean parallel = false;
/**
* Computes all principal type unifiers for a set of constraints.