forked from JavaTX/JavaCompilerCore
removed old UnifyTaskModel from TypeUnify and TypeUnifyTask
This commit is contained in:
parent
45fa0ff0b9
commit
b13f2b357b
@ -25,7 +25,7 @@ public class TypeUnify {
|
|||||||
*/
|
*/
|
||||||
public Set<Set<UnifyPair>> unify(Set<UnifyPair> undConstrains, List<Set<Constraint<UnifyPair>>> oderConstraints, IFiniteClosure fc, Writer logFile, Boolean log, UnifyResultModel ret, UnifyTaskModel usedTasks) {
|
public Set<Set<UnifyPair>> unify(Set<UnifyPair> undConstrains, List<Set<Constraint<UnifyPair>>> oderConstraints, IFiniteClosure fc, Writer logFile, Boolean log, UnifyResultModel ret, UnifyTaskModel usedTasks) {
|
||||||
ForkJoinPool pool = new ForkJoinPool(Runtime.getRuntime().availableProcessors(), ForkJoinPool.defaultForkJoinWorkerThreadFactory, null, true);
|
ForkJoinPool pool = new ForkJoinPool(Runtime.getRuntime().availableProcessors(), ForkJoinPool.defaultForkJoinWorkerThreadFactory, null, true);
|
||||||
TypeUnifyTask unifyTask = new TypeUnifyTask(undConstrains, oderConstraints, fc, true, new WriterActiveObject(logFile, pool), log, 0, ret, usedTasks, pool);
|
TypeUnifyTask unifyTask = new TypeUnifyTask(undConstrains, oderConstraints, fc, true, new WriterActiveObject(logFile, pool), log, 0, ret, pool);
|
||||||
pool.invoke(unifyTask);
|
pool.invoke(unifyTask);
|
||||||
Set<Set<UnifyPair>> res = unifyTask.join();
|
Set<Set<UnifyPair>> res = unifyTask.join();
|
||||||
try {
|
try {
|
||||||
@ -51,7 +51,7 @@ public class TypeUnify {
|
|||||||
*/
|
*/
|
||||||
public UnifyResultModel unifyAsync(Set<UnifyPair> undConstrains, List<Set<Constraint<UnifyPair>>> oderConstraints, IFiniteClosure fc, Writer logFile, Boolean log, UnifyResultModel ret, UnifyTaskModel usedTasks) {
|
public UnifyResultModel unifyAsync(Set<UnifyPair> undConstrains, List<Set<Constraint<UnifyPair>>> oderConstraints, IFiniteClosure fc, Writer logFile, Boolean log, UnifyResultModel ret, UnifyTaskModel usedTasks) {
|
||||||
ForkJoinPool pool = new ForkJoinPool(Runtime.getRuntime().availableProcessors(), ForkJoinPool.defaultForkJoinWorkerThreadFactory, null, true);
|
ForkJoinPool pool = new ForkJoinPool(Runtime.getRuntime().availableProcessors(), ForkJoinPool.defaultForkJoinWorkerThreadFactory, null, true);
|
||||||
TypeUnifyTask unifyTask = new TypeUnifyTask(undConstrains, oderConstraints, fc, true, new WriterActiveObject(logFile, pool), log, 0, ret, usedTasks, pool);
|
TypeUnifyTask unifyTask = new TypeUnifyTask(undConstrains, oderConstraints, fc, true, new WriterActiveObject(logFile, pool), log, 0, ret, pool);
|
||||||
pool.invoke(unifyTask);
|
pool.invoke(unifyTask);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -70,7 +70,7 @@ public class TypeUnify {
|
|||||||
public UnifyResultModel unifyParallel(Set<UnifyPair> undConstrains, List<Set<Constraint<UnifyPair>>> oderConstraints, IFiniteClosure fc, Writer logFile, Boolean log, UnifyResultModel ret, UnifyTaskModel usedTasks) {
|
public UnifyResultModel unifyParallel(Set<UnifyPair> undConstrains, List<Set<Constraint<UnifyPair>>> oderConstraints, IFiniteClosure fc, Writer logFile, Boolean log, UnifyResultModel ret, UnifyTaskModel usedTasks) {
|
||||||
ForkJoinPool pool = new ForkJoinPool(Runtime.getRuntime().availableProcessors(), ForkJoinPool.defaultForkJoinWorkerThreadFactory, null, true);
|
ForkJoinPool pool = new ForkJoinPool(Runtime.getRuntime().availableProcessors(), ForkJoinPool.defaultForkJoinWorkerThreadFactory, null, true);
|
||||||
TypeUnifyTask unifyTask = //new TypeUnifyTask(undConstrains, oderConstraints, fc, true, logFile, log, 0, ret, usedTasks);
|
TypeUnifyTask unifyTask = //new TypeUnifyTask(undConstrains, oderConstraints, fc, true, logFile, log, 0, ret, usedTasks);
|
||||||
new TypeUnifyTask(undConstrains, oderConstraints, fc, true, new WriterActiveObject(logFile, pool), log, 0, ret, usedTasks, pool, statistics);
|
new TypeUnifyTask(undConstrains, oderConstraints, fc, true, new WriterActiveObject(logFile, pool), log, 0, ret, pool, statistics);
|
||||||
|
|
||||||
pool.invoke(unifyTask);
|
pool.invoke(unifyTask);
|
||||||
Set<Set<UnifyPair>> res = unifyTask.join();
|
Set<Set<UnifyPair>> res = unifyTask.join();
|
||||||
@ -105,7 +105,7 @@ public class TypeUnify {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Set<Set<UnifyPair>> unifyOderConstraints(Set<UnifyPair> undConstrains, List<Set<Constraint<UnifyPair>>> oderConstraints, IFiniteClosure fc, Writer logFile, Boolean log, UnifyResultModel ret, UnifyTaskModel usedTasks) {
|
public Set<Set<UnifyPair>> unifyOderConstraints(Set<UnifyPair> undConstrains, List<Set<Constraint<UnifyPair>>> oderConstraints, IFiniteClosure fc, Writer logFile, Boolean log, UnifyResultModel ret, UnifyTaskModel usedTasks) {
|
||||||
TypeUnifyTask unifyTask = new TypeUnifyTask(undConstrains, oderConstraints, fc, false, new WriterActiveObject(logFile, ForkJoinPool.commonPool()), log, 0, ret, usedTasks, ForkJoinPool.commonPool());
|
TypeUnifyTask unifyTask = new TypeUnifyTask(undConstrains, oderConstraints, fc, false, new WriterActiveObject(logFile, ForkJoinPool.commonPool()), log, 0, ret, ForkJoinPool.commonPool());
|
||||||
unifyTask.statisticsFile = statistics;
|
unifyTask.statisticsFile = statistics;
|
||||||
Set<Set<UnifyPair>> res = unifyTask.compute();
|
Set<Set<UnifyPair>> res = unifyTask.compute();
|
||||||
try {
|
try {
|
||||||
|
@ -24,14 +24,14 @@ public class TypeUnify2Task extends TypeUnifyTask {
|
|||||||
TypeUnify2Task(Set<Set<UnifyPair>> setToFlatten, Set<UnifyPair> eq,
|
TypeUnify2Task(Set<Set<UnifyPair>> setToFlatten, Set<UnifyPair> eq,
|
||||||
List<Set<Constraint<UnifyPair>>> oderConstraints,
|
List<Set<Constraint<UnifyPair>>> oderConstraints,
|
||||||
Set<UnifyPair> nextSetElement,
|
Set<UnifyPair> nextSetElement,
|
||||||
IFiniteClosure fc, boolean parallel, WriterActiveObject logFile, Boolean log, int rekTiefe, UnifyResultModel urm, UnifyTaskModel usedTasks,
|
IFiniteClosure fc, boolean parallel, WriterActiveObject logFile, Boolean log, int rekTiefe, UnifyResultModel urm,
|
||||||
Set<UnifyPair> methodSignatureConstraintUebergabe, ForkJoinPool pool, Writer statistics) {
|
Set<UnifyPair> methodSignatureConstraintUebergabe, ForkJoinPool pool, Writer statistics) {
|
||||||
this(setToFlatten, eq, oderConstraints, nextSetElement, fc, parallel, logFile, log, rekTiefe, urm, usedTasks, methodSignatureConstraintUebergabe, pool );
|
this(setToFlatten, eq, oderConstraints, nextSetElement, fc, parallel, logFile, log, rekTiefe, urm, methodSignatureConstraintUebergabe, pool );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public TypeUnify2Task(Set<Set<UnifyPair>> setToFlatten, Set<UnifyPair> eq, List<Set<Constraint<UnifyPair>>> oderConstraints, Set<UnifyPair> nextSetElement, IFiniteClosure fc, boolean parallel, WriterActiveObject logFile, Boolean log, int rekTiefe, UnifyResultModel urm, UnifyTaskModel usedTasks, Set<UnifyPair> methodSignatureConstraintUebergabe, ForkJoinPool pool) {
|
public TypeUnify2Task(Set<Set<UnifyPair>> setToFlatten, Set<UnifyPair> eq, List<Set<Constraint<UnifyPair>>> oderConstraints, Set<UnifyPair> nextSetElement, IFiniteClosure fc, boolean parallel, WriterActiveObject logFile, Boolean log, int rekTiefe, UnifyResultModel urm, Set<UnifyPair> methodSignatureConstraintUebergabe, ForkJoinPool pool) {
|
||||||
super(eq, oderConstraints, fc, parallel, logFile, log, rekTiefe, urm, usedTasks, pool);
|
super(eq, oderConstraints, fc, parallel, logFile, log, rekTiefe, urm, pool);
|
||||||
this.setToFlatten = setToFlatten;
|
this.setToFlatten = setToFlatten;
|
||||||
this.nextSetElement = nextSetElement;
|
this.nextSetElement = nextSetElement;
|
||||||
this.methodSignatureConstraintUebergabe = methodSignatureConstraintUebergabe;
|
this.methodSignatureConstraintUebergabe = methodSignatureConstraintUebergabe;
|
||||||
@ -54,15 +54,8 @@ public class TypeUnify2Task extends TypeUnifyTask {
|
|||||||
*/
|
*/
|
||||||
//writeLog("xxx");
|
//writeLog("xxx");
|
||||||
//noOfThread--;
|
//noOfThread--;
|
||||||
synchronized (usedTasks) {
|
|
||||||
if (this.myIsCancelled()) {
|
|
||||||
return new HashSet<>();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void closeLogFile() {
|
public void closeLogFile() {
|
||||||
if(parallel){
|
if(parallel){
|
||||||
|
@ -125,10 +125,6 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
|
|
||||||
static Integer noShortendElements = 0;
|
static Integer noShortendElements = 0;
|
||||||
|
|
||||||
Boolean myIsCanceled = false;
|
|
||||||
|
|
||||||
volatile UnifyTaskModel usedTasks;
|
|
||||||
|
|
||||||
static Writer statisticsFile = new NullWriter();
|
static Writer statisticsFile = new NullWriter();
|
||||||
|
|
||||||
public TypeUnifyTask() {
|
public TypeUnifyTask() {
|
||||||
@ -150,11 +146,11 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
//statistics
|
//statistics
|
||||||
public TypeUnifyTask(Set<UnifyPair> eq, List<Set<Constraint<UnifyPair>>> oderConstraints, IFiniteClosure fc, boolean parallel, WriterActiveObject logFile, Boolean log, int rekTiefe, UnifyResultModel urm, UnifyTaskModel usedTasks, ForkJoinPool pool, Writer statisticsFile) {
|
public TypeUnifyTask(Set<UnifyPair> eq, List<Set<Constraint<UnifyPair>>> oderConstraints, IFiniteClosure fc, boolean parallel, WriterActiveObject logFile, Boolean log, int rekTiefe, UnifyResultModel urm, ForkJoinPool pool, Writer statisticsFile) {
|
||||||
this(eq,oderConstraints, fc, parallel, logFile, log, rekTiefe, urm, usedTasks, pool);
|
this(eq,oderConstraints, fc, parallel, logFile, log, rekTiefe, urm, pool);
|
||||||
this.statisticsFile = statisticsFile;
|
this.statisticsFile = statisticsFile;
|
||||||
}
|
}
|
||||||
public TypeUnifyTask(Set<UnifyPair> eq, List<Set<Constraint<UnifyPair>>> oderConstraints, IFiniteClosure fc, boolean parallel, WriterActiveObject logFile, Boolean log, int rekTiefe, UnifyResultModel urm, UnifyTaskModel usedTasks, ForkJoinPool pool) {
|
public TypeUnifyTask(Set<UnifyPair> eq, List<Set<Constraint<UnifyPair>>> oderConstraints, IFiniteClosure fc, boolean parallel, WriterActiveObject logFile, Boolean log, int rekTiefe, UnifyResultModel urm, ForkJoinPool pool) {
|
||||||
this.eq = eq;
|
this.eq = eq;
|
||||||
//this.oderConstraints = oderConstraints.stream().map(x -> x.stream().map(y -> new HashSet<>(y)).collect(Collectors.toSet(HashSet::new))).collect(Collectors.toList(ArrayList::new));
|
//this.oderConstraints = oderConstraints.stream().map(x -> x.stream().map(y -> new HashSet<>(y)).collect(Collectors.toSet(HashSet::new))).collect(Collectors.toList(ArrayList::new));
|
||||||
this.oderConstraintsField = oderConstraints; /*.stream().map(x -> {
|
this.oderConstraintsField = oderConstraints; /*.stream().map(x -> {
|
||||||
@ -207,8 +203,6 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
rules = new RuleSet(logFile);
|
rules = new RuleSet(logFile);
|
||||||
this.rekTiefeField = rekTiefe;
|
this.rekTiefeField = rekTiefe;
|
||||||
this.urm = urm;
|
this.urm = urm;
|
||||||
this.usedTasks = usedTasks;
|
|
||||||
this.usedTasks.add(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -243,13 +237,6 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
void myCancel(Boolean b) {
|
|
||||||
myIsCanceled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean myIsCancelled() {
|
|
||||||
return myIsCanceled;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Set<Set<UnifyPair>> compute() {
|
protected Set<Set<UnifyPair>> compute() {
|
||||||
if (one) {
|
if (one) {
|
||||||
@ -279,17 +266,10 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
.collect(Collectors.toCollection(ArrayList::new));
|
.collect(Collectors.toCollection(ArrayList::new));
|
||||||
throw new TypeinferenceException("Unresolved constraints: " + res.toString(), new NullToken()); //return new HashSet<>();
|
throw new TypeinferenceException("Unresolved constraints: " + res.toString(), new NullToken()); //return new HashSet<>();
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
synchronized (usedTasks) {
|
|
||||||
if (this.myIsCancelled()) {
|
|
||||||
return new HashSet<>();
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
@Override
|
@Override
|
||||||
protected Set<Set<UnifyPair>> compute() {
|
protected Set<Set<UnifyPair>> compute() {
|
||||||
@ -320,12 +300,6 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
|
|
||||||
//.collect(Collectors.toCollection(HashSet::new)));
|
//.collect(Collectors.toCollection(HashSet::new)));
|
||||||
|
|
||||||
synchronized (usedTasks) {
|
|
||||||
if (this.myIsCancelled()) {
|
|
||||||
return new HashSet<>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
rekTiefe++;
|
rekTiefe++;
|
||||||
nOfUnify++;
|
nOfUnify++;
|
||||||
writeLog(nOfUnify.toString() + " Unifikation: " + eq.toString());
|
writeLog(nOfUnify.toString() + " Unifikation: " + eq.toString());
|
||||||
@ -507,12 +481,6 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
// .collect(Collectors.toCollection(HashSet::new));
|
// .collect(Collectors.toCollection(HashSet::new));
|
||||||
//Muss auskommentiert werden, wenn computeCartesianRecursive ENDE
|
//Muss auskommentiert werden, wenn computeCartesianRecursive ENDE
|
||||||
|
|
||||||
synchronized (usedTasks) {
|
|
||||||
if (this.myIsCancelled()) {
|
|
||||||
return new HashSet<>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Set<Set<UnifyPair>> eqPrimePrimeSet = new HashSet<>();
|
Set<Set<UnifyPair>> eqPrimePrimeSet = new HashSet<>();
|
||||||
|
|
||||||
Set<TypeUnifyTask> forks = new HashSet<>();
|
Set<TypeUnifyTask> forks = new HashSet<>();
|
||||||
@ -929,14 +897,10 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
newElemsOrig.add(a);
|
newElemsOrig.add(a);
|
||||||
|
|
||||||
/* FORK ANFANG */
|
/* FORK ANFANG */
|
||||||
TypeUnify2Task forkOrig = new TypeUnify2Task(newElemsOrig, newEqOrig, newOderConstraintsOrig, a, fc, parallel, logFile, log, rekTiefe, urm, usedTasks, methodSignatureConstraint, this.pool);
|
TypeUnify2Task forkOrig = new TypeUnify2Task(newElemsOrig, newEqOrig, newOderConstraintsOrig, a, fc, parallel, logFile, log, rekTiefe, urm, methodSignatureConstraint, this.pool);
|
||||||
//forks.add(forkOrig);
|
//forks.add(forkOrig);
|
||||||
synchronized(usedTasks) {
|
|
||||||
if (this.myIsCancelled()) {
|
|
||||||
return new HashSet<>();
|
|
||||||
}
|
|
||||||
forkOrig.fork();
|
forkOrig.fork();
|
||||||
}
|
|
||||||
/* FORK ENDE */
|
/* FORK ENDE */
|
||||||
|
|
||||||
writeLog("a in " + variance + " "+ a + "\n" +
|
writeLog("a in " + variance + " "+ a + "\n" +
|
||||||
@ -966,15 +930,10 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
Set<Set<UnifyPair>> newElems = new HashSet<>(elems);
|
Set<Set<UnifyPair>> newElems = new HashSet<>(elems);
|
||||||
List<Set<Constraint<UnifyPair>>> newOderConstraints = new ArrayList<>(oderConstraints);
|
List<Set<Constraint<UnifyPair>>> newOderConstraints = new ArrayList<>(oderConstraints);
|
||||||
newElems.add(nSaL);
|
newElems.add(nSaL);
|
||||||
TypeUnify2Task fork = new TypeUnify2Task(newElems, newEq, newOderConstraints, nSaL, fc, parallel, logFile, log, rekTiefe, urm, usedTasks, new HashSet<>(methodSignatureConstraint), this.pool);
|
TypeUnify2Task fork = new TypeUnify2Task(newElems, newEq, newOderConstraints, nSaL, fc, parallel, logFile, log, rekTiefe, urm, new HashSet<>(methodSignatureConstraint), this.pool);
|
||||||
forks.add(fork);
|
forks.add(fork);
|
||||||
synchronized(usedTasks) {
|
|
||||||
if (this.myIsCancelled()) {
|
|
||||||
return new HashSet<>();
|
|
||||||
}
|
|
||||||
fork.fork();
|
fork.fork();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
//res = unify2(newElemsOrig, newEqOrig, newOderConstraintsOrig, fc, parallel, rekTiefe);
|
//res = unify2(newElemsOrig, newEqOrig, newOderConstraintsOrig, fc, parallel, rekTiefe);
|
||||||
|
|
||||||
/* FORK ANFANG */
|
/* FORK ANFANG */
|
||||||
@ -982,11 +941,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
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++;
|
//noOfThread++;
|
||||||
forkOrig.writeLog("final Orig 1");
|
forkOrig.writeLog("final Orig 1");
|
||||||
forkOrig.closeLogFile();
|
forkOrig.closeLogFile();
|
||||||
@ -1000,11 +955,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
for(TypeUnify2Task fork : forks) {
|
for(TypeUnify2Task fork : forks) {
|
||||||
noOfThread--;
|
noOfThread--;
|
||||||
Set<Set<UnifyPair>> fork_res = fork.join();
|
Set<Set<UnifyPair>> fork_res = fork.join();
|
||||||
synchronized (usedTasks) {
|
|
||||||
if (this.myIsCancelled()) {
|
|
||||||
return new HashSet<>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//noOfThread++;
|
//noOfThread++;
|
||||||
//noOfThread--; an das Ende von compute verschoben
|
//noOfThread--; an das Ende von compute verschoben
|
||||||
writeLog("Join " + new Integer(fork.thNo).toString() + "\n" +
|
writeLog("Join " + new Integer(fork.thNo).toString() + "\n" +
|
||||||
@ -1027,14 +978,10 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
newElemsOrig.add(a);
|
newElemsOrig.add(a);
|
||||||
|
|
||||||
/* FORK ANFANG */
|
/* FORK ANFANG */
|
||||||
TypeUnify2Task forkOrig = new TypeUnify2Task(newElemsOrig, newEqOrig, newOderConstraintsOrig, a, fc, parallel, logFile, log, rekTiefe, urm, usedTasks, new HashSet<>(methodSignatureConstraint), this.pool);
|
TypeUnify2Task forkOrig = new TypeUnify2Task(newElemsOrig, newEqOrig, newOderConstraintsOrig, a, fc, parallel, logFile, log, rekTiefe, urm, new HashSet<>(methodSignatureConstraint), this.pool);
|
||||||
//forks.add(forkOrig);
|
//forks.add(forkOrig);
|
||||||
synchronized(usedTasks) {
|
|
||||||
if (this.myIsCancelled()) {
|
|
||||||
return new HashSet<>();
|
|
||||||
}
|
|
||||||
forkOrig.fork();
|
forkOrig.fork();
|
||||||
}
|
|
||||||
/* FORK ENDE */
|
/* FORK ENDE */
|
||||||
|
|
||||||
|
|
||||||
@ -1063,26 +1010,17 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
Set<Set<UnifyPair>> newElems = new HashSet<>(elems);
|
Set<Set<UnifyPair>> newElems = new HashSet<>(elems);
|
||||||
List<Set<Constraint<UnifyPair>>> newOderConstraints = new ArrayList<>(oderConstraints);
|
List<Set<Constraint<UnifyPair>>> newOderConstraints = new ArrayList<>(oderConstraints);
|
||||||
newElems.add(nSaL);
|
newElems.add(nSaL);
|
||||||
TypeUnify2Task fork = new TypeUnify2Task(newElems, newEq, newOderConstraints, nSaL, fc, parallel, logFile, log, rekTiefe, urm, usedTasks, new HashSet<>(methodSignatureConstraint), this.pool);
|
TypeUnify2Task fork = new TypeUnify2Task(newElems, newEq, newOderConstraints, nSaL, fc, parallel, logFile, log, rekTiefe, urm, new HashSet<>(methodSignatureConstraint), this.pool);
|
||||||
forks.add(fork);
|
forks.add(fork);
|
||||||
synchronized(usedTasks) {
|
|
||||||
if (this.myIsCancelled()) {
|
|
||||||
return new HashSet<>();
|
|
||||||
}
|
|
||||||
fork.fork();
|
fork.fork();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
//res = unify2(newElemsOrig, newEqOrig, newOderConstraintsOrig, fc, parallel, rekTiefe);
|
//res = unify2(newElemsOrig, newEqOrig, newOderConstraintsOrig, fc, parallel, rekTiefe);
|
||||||
|
|
||||||
/* FORK ANFANG */
|
/* FORK ANFANG */
|
||||||
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++;
|
//noOfThread++;
|
||||||
forkOrig.writeLog("final Orig -1");
|
forkOrig.writeLog("final Orig -1");
|
||||||
forkOrig.closeLogFile();
|
forkOrig.closeLogFile();
|
||||||
@ -1096,11 +1034,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
for(TypeUnify2Task fork : forks) {
|
for(TypeUnify2Task fork : forks) {
|
||||||
noOfThread--;
|
noOfThread--;
|
||||||
Set<Set<UnifyPair>> fork_res = fork.join();
|
Set<Set<UnifyPair>> fork_res = fork.join();
|
||||||
synchronized (usedTasks) {
|
|
||||||
if (this.myIsCancelled()) {
|
|
||||||
return new HashSet<>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//noOfThread++;
|
//noOfThread++;
|
||||||
writeLog("Join " + new Integer(fork.thNo).toString());
|
writeLog("Join " + new Integer(fork.thNo).toString());
|
||||||
//noOfThread--; an das Ende von compute verschoben
|
//noOfThread--; an das Ende von compute verschoben
|
||||||
@ -1125,14 +1059,9 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
newElemsOrig.add(a);
|
newElemsOrig.add(a);
|
||||||
|
|
||||||
/* FORK ANFANG */
|
/* FORK ANFANG */
|
||||||
TypeUnify2Task forkOrig = new TypeUnify2Task(newElemsOrig, newEqOrig, newOderConstraintsOrig, a, fc, parallel, logFile, log, rekTiefe, urm, usedTasks, new HashSet<>(methodSignatureConstraint), this.pool);
|
TypeUnify2Task forkOrig = new TypeUnify2Task(newElemsOrig, newEqOrig, newOderConstraintsOrig, a, fc, parallel, logFile, log, rekTiefe, urm, new HashSet<>(methodSignatureConstraint), this.pool);
|
||||||
//forks.add(forkOrig);
|
//forks.add(forkOrig);
|
||||||
synchronized(usedTasks) {
|
|
||||||
if (this.myIsCancelled()) {
|
|
||||||
return new HashSet<>();
|
|
||||||
}
|
|
||||||
forkOrig.fork();
|
forkOrig.fork();
|
||||||
}
|
|
||||||
/* FORK ENDE */
|
/* FORK ENDE */
|
||||||
|
|
||||||
writeLog("a in " + variance + " "+ a + "\n" +
|
writeLog("a in " + variance + " "+ a + "\n" +
|
||||||
@ -1145,15 +1074,10 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
Set<Set<UnifyPair>> newElems = new HashSet<>(elems);
|
Set<Set<UnifyPair>> newElems = new HashSet<>(elems);
|
||||||
List<Set<Constraint<UnifyPair>>> newOderConstraints = new ArrayList<>(oderConstraints);
|
List<Set<Constraint<UnifyPair>>> newOderConstraints = new ArrayList<>(oderConstraints);
|
||||||
newElems.add(nSaL);
|
newElems.add(nSaL);
|
||||||
TypeUnify2Task fork = new TypeUnify2Task(newElems, newEq, newOderConstraints, nSaL, fc, parallel, logFile, log, rekTiefe, urm, usedTasks, methodSignatureConstraint, this.pool);
|
TypeUnify2Task fork = new TypeUnify2Task(newElems, newEq, newOderConstraints, nSaL, fc, parallel, logFile, log, rekTiefe, urm, methodSignatureConstraint, this.pool);
|
||||||
forks.add(fork);
|
forks.add(fork);
|
||||||
synchronized(usedTasks) {
|
|
||||||
if (this.myIsCancelled()) {
|
|
||||||
return new HashSet<>();
|
|
||||||
}
|
|
||||||
fork.fork();
|
fork.fork();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
//res = unify2(newElemsOrig, newEqOrig, newOderConstraintsOrig, fc, parallel, rekTiefe);
|
//res = unify2(newElemsOrig, newEqOrig, newOderConstraintsOrig, fc, parallel, rekTiefe);
|
||||||
|
|
||||||
/* FORK ANFANG */
|
/* FORK ANFANG */
|
||||||
@ -1161,11 +1085,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
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++;
|
//noOfThread++;
|
||||||
forkOrig.writeLog("final Orig 2");
|
forkOrig.writeLog("final Orig 2");
|
||||||
forkOrig.closeLogFile();
|
forkOrig.closeLogFile();
|
||||||
@ -1179,11 +1099,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
for(TypeUnify2Task fork : forks) {
|
for(TypeUnify2Task fork : forks) {
|
||||||
noOfThread--;
|
noOfThread--;
|
||||||
Set<Set<UnifyPair>> fork_res = fork.join();
|
Set<Set<UnifyPair>> fork_res = fork.join();
|
||||||
synchronized (usedTasks) {
|
|
||||||
if (this.myIsCancelled()) {
|
|
||||||
return new HashSet<>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//noOfThread++;
|
//noOfThread++;
|
||||||
writeLog("Join " + new Integer(fork.thNo).toString());
|
writeLog("Join " + new Integer(fork.thNo).toString());
|
||||||
//noOfThread--; an das Ende von compute verschoben
|
//noOfThread--; an das Ende von compute verschoben
|
||||||
|
Loading…
Reference in New Issue
Block a user