Compare commits

...

28 Commits

Author SHA1 Message Date
NoName11234
890f64c813 added resource files for testing 2023-12-26 17:47:18 +01:00
NoName11234
5aadb7545e added resources for tests 2023-12-26 17:28:08 +01:00
NoName11234
0c0ac61a02 changed outputstream for debugging to NullOutputStream 2023-12-26 16:59:37 +01:00
NoName11234
46192e3fd3 changed java version from 19 to 21 2023-12-26 16:45:35 +01:00
pl@gohorb.ba-horb.de
61653c5d88 modified: src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java 2023-05-25 10:05:10 +02:00
pl@gohorb.ba-horb.de
3cd608a4ac modified: src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnify.java
modified:   src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java
2023-05-15 16:56:04 +02:00
pl@gohorb.ba-horb.de
deec0ae706 Start branch unif23NoOptParallel
modified:   Makefile
	modified:   src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java
	modified:   src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java
2023-04-24 17:18:45 +02:00
pl@gohorb.ba-horb.de
d6a79ea3a1 modified: src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java 2023-04-11 22:45:15 +02:00
pl@gohorb.ba-horb.de
1f909f13ee modified: src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java 2023-04-11 18:01:44 +02:00
pl@gohorb.ba-horb.de
be6f4bd578 Merge remote-tracking branch 'origin/targetBytecode' into unif23 2023-04-11 15:52:26 +02:00
pl@gohorb.ba-horb.de
478efd5649 Merge branch 'unif23' of ssh://gohorb.ba-horb.de/bahome/projekt/git/JavaCompilerCore into unif23 2023-04-11 15:40:27 +02:00
pl@gohorb.ba-horb.de
c73e57cf2b new file: resources/bytecode/javFiles/Scalar.jav 2023-04-11 15:35:15 +02:00
pl@gohorb.ba-horb.de
ce29f4bcf1 Merge branch 'unif23' of ssh://gohorb.ba-horb.de/bahome/projekt/git/JavaCompilerCore into Unif23
Conflicts:
	src/test/java/targetast/TestComplete.java
2023-04-10 22:14:46 +02:00
pl@gohorb.ba-horb.de
42821f3215 modified: src/main/java/de/dhbwstuttgart/typeinference/unify/RuleSet.java
modified:   src/test/java/targetast/TestComplete.java
2023-04-10 22:07:47 +02:00
pl@gohorb.ba-horb.de
f68afc88a6 modified: src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java 2023-04-06 17:58:32 +02:00
pl@gohorb.ba-horb.de
82061474b2 modified: resources/bytecode/javFiles/Scalar.jav
modified:   src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java
2023-04-04 17:26:13 +02:00
pl@gohorb.ba-horb.de
d849bc127f Merge remote-tracking branch 'origin/targetBytecode' into unif23 2023-04-04 16:47:19 +02:00
pl@gohorb.ba-horb.de
6815d8fc0a modified: Makefile
modified:   src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java
2023-03-31 17:58:02 +02:00
pl@gohorb.ba-horb.de
317f8b1aad new file: Makefile
deleted:    Test.java
	modified:   src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java
2023-03-31 15:54:17 +02:00
pl@gohorb.ba-horb.de
79335449d0 modified: src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java
Statistics fertig (Version 1)
2023-03-23 12:00:04 +01:00
pl@gohorb.ba-horb.de
14606a846e modified: src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java
modified:   src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnify.java
	modified:   src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnify2Task.java
	modified:   src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java
2023-03-22 19:01:36 +01:00
Andreas Stadelmeier
2b67230a15 Consider public and standard constructors ones 2023-03-21 16:31:45 +01:00
pl@gohorb.ba-horb.de
29b05b56cc Merge branch 'targetBytecode' into unif23 2023-03-21 16:29:14 +01:00
pl@gohorb.ba-horb.de
08b9fc0ea3 modified: src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java
statistics eingefuegt
2023-03-21 16:23:18 +01:00
pl@gohorb.ba-horb.de
070dd16999 modified: src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java 2023-03-21 10:30:13 +01:00
pl@gohorb.ba-horb.de
9d7e46925d modified: src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java 2023-03-21 10:26:55 +01:00
pl@gohorb.ba-horb.de
d780d322f0 modified: src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java
modified:   src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java
2023-03-20 18:33:58 +01:00
pl@gohorb.ba-horb.de
867f3d39e8 modified: src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java
modified:   src/test/java/targetast/TestComplete.java
2023-03-20 16:05:28 +01:00
39 changed files with 186 additions and 59 deletions

3
.gitignore vendored
View File

@ -1,6 +1,5 @@
CVS CVS
bin bin
*.class
*.log *.log
# Mobile Tools for Java (J2ME) # Mobile Tools for Java (J2ME)
@ -15,11 +14,9 @@ bin
.classpath .classpath
*.iml *.iml
.idea/ .idea/
/target/
.DS_Store .DS_Store
.project .project
.settings/ .settings/
/target/
# #
manually/ manually/

3
Makefile Normal file
View File

@ -0,0 +1,3 @@
NoOptParallel:
mvn -DskipTests package
cp target/JavaTXcompiler-0.1-jar-with-dependencies.jar target/JavaTXcompiler-0.1-jar-with-dependencies_NoOptParallel.jar

View File

@ -54,8 +54,8 @@ http://maven.apache.org/maven-v4_0_0.xsd">
<version>3.8.0</version> <version>3.8.0</version>
<configuration> <configuration>
<compilerArgs>--enable-preview</compilerArgs> <compilerArgs>--enable-preview</compilerArgs>
<source>19</source> <source>21</source>
<target>19</target> <target>21</target>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>

View File

@ -1,4 +1,4 @@
import java.util.Vector; //import java.util.Vector;
import java.lang.Integer; import java.lang.Integer;
import java.lang.Float; import java.lang.Float;
//import java.lang.Byte; //import java.lang.Byte;
@ -6,21 +6,11 @@ import java.lang.Float;
public class Scalar extends Vector<Integer> { public class Scalar extends Vector<Integer> {
Scalar(v) {
Integer i;
i = 0;
while(i < v.size()) {
this.add(v.elementAt(i));
i=i+1;
}
}
mul(v) { mul(v) {
var ret = 0; var ret = 0;
var i = 0; var i = 0;
while(i < size()) { while(i < size()) {
ret = ret + this.elementAt(i) * v.elementAt(i); ret = ret + this.elementAt(i) * v.elementAt(i);
i = i+1;
} }
return ret; return ret;
} }

View File

@ -58,6 +58,7 @@ import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStreamWriter; import java.io.OutputStreamWriter;
import java.io.Writer; import java.io.Writer;
import java.sql.Timestamp;
import java.util.*; import java.util.*;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -69,11 +70,12 @@ public class JavaTXCompiler {
//public static JavaTXCompiler INSTANCE; //public static JavaTXCompiler INSTANCE;
final CompilationEnvironment environment; final CompilationEnvironment environment;
Boolean resultmodel = false; Boolean resultmodel = true;
public final Map<File, SourceFile> sourceFiles = new HashMap<>(); public final Map<File, SourceFile> sourceFiles = new HashMap<>();
Boolean log = false; //gibt an ob ein Log-File nach System.getProperty("user.dir")+""/logFiles/"" geschrieben werden soll? Boolean log = false; //gibt an ob ein Log-File nach System.getProperty("user.dir")+""/logFiles/"" geschrieben werden soll?
public volatile UnifyTaskModel usedTasks = new UnifyTaskModel(); public volatile UnifyTaskModel usedTasks = new UnifyTaskModel();
private final DirectoryClassLoader classLoader; private final DirectoryClassLoader classLoader;
static Writer statistics;
public JavaTXCompiler(File sourceFile) throws IOException, ClassNotFoundException { public JavaTXCompiler(File sourceFile) throws IOException, ClassNotFoundException {
this(Arrays.asList(sourceFile), null); this(Arrays.asList(sourceFile), null);
@ -86,6 +88,9 @@ public class JavaTXCompiler {
this(sourceFiles, null); this(sourceFiles, null);
} }
public JavaTXCompiler(List<File> sources, List<File> contextPath) throws IOException, ClassNotFoundException { public JavaTXCompiler(List<File> sources, List<File> contextPath) throws IOException, ClassNotFoundException {
//statistics = new FileWriter(new File(System.getProperty("user.dir") + "/" + sources.get(0).getName() + "_"+ new Timestamp(System.currentTimeMillis())));
statistics = new OutputStreamWriter(new NullOutputStream());
statistics.write("test");
if(contextPath == null || contextPath.isEmpty()){ if(contextPath == null || contextPath.isEmpty()){
//When no contextPaths are given, the working directory is the sources root //When no contextPaths are given, the working directory is the sources root
contextPath = Lists.newArrayList(new File(System.getProperty("user.dir"))); contextPath = Lists.newArrayList(new File(System.getProperty("user.dir")));
@ -578,6 +583,7 @@ public class JavaTXCompiler {
unifyCons = unifyCons.map(distributeInnerVars); unifyCons = unifyCons.map(distributeInnerVars);
logFile.write("\nUnify_distributeInnerVars: " + unifyCons.toString()); logFile.write("\nUnify_distributeInnerVars: " + unifyCons.toString());
TypeUnify unify = new TypeUnify(); TypeUnify unify = new TypeUnify();
unify.statistics = statistics;
// Set<Set<UnifyPair>> results = new HashSet<>(); Nach vorne gezogen // Set<Set<UnifyPair>> results = new HashSet<>(); Nach vorne gezogen
logFile.write("FC:\\" + finiteClosure.toString() + "\n"); logFile.write("FC:\\" + finiteClosure.toString() + "\n");
for (SourceFile sf : this.sourceFiles.values()) { for (SourceFile sf : this.sourceFiles.values()) {
@ -730,6 +736,7 @@ public class JavaTXCompiler {
System.out.println("Constraints for Generated Generics: " + " ???"); System.out.println("Constraints for Generated Generics: " + " ???");
logFile.write("RES_FINAL: " + li.getResults().toString() + "\n"); logFile.write("RES_FINAL: " + li.getResults().toString() + "\n");
logFile.flush(); logFile.flush();
statistics.close();
return li.getResults(); return li.getResults();
} }
/* UnifyResultModel End */ /* UnifyResultModel End */
@ -765,6 +772,7 @@ public class JavaTXCompiler {
} catch (IOException e) { } catch (IOException e) {
System.err.println("kein LogFile"); System.err.println("kein LogFile");
} }
statistics.close();
return results.stream() return results.stream()
.map((unifyPairs -> new ResultSet(UnifyTypeFactory.convert(unifyPairs, Pair.generateTPHMap(cons))))) .map((unifyPairs -> new ResultSet(UnifyTypeFactory.convert(unifyPairs, Pair.generateTPHMap(cons)))))
.collect(Collectors.toList()); .collect(Collectors.toList());

View File

@ -35,8 +35,8 @@ public class ASTFactory {
JavaClassName name = new JavaClassName(jreClass.getName()); JavaClassName name = new JavaClassName(jreClass.getName());
List<Method> methoden = new ArrayList<>(); List<Method> methoden = new ArrayList<>();
List<de.dhbwstuttgart.syntaxtree.Constructor> konstruktoren = new ArrayList<>(); List<de.dhbwstuttgart.syntaxtree.Constructor> konstruktoren = new ArrayList<>();
for(java.lang.reflect.Constructor constructor : jreClass.getConstructors()){ for(java.lang.reflect.Constructor constructor : jreClass.getDeclaredConstructors()){
createConstructor(constructor, jreClass).map(c -> konstruktoren.add(c)); createConstructor(constructor, jreClass).map(c -> konstruktoren.add(c));
} }
Set<java.lang.reflect.Method> allMethods = new HashSet<>(Arrays.asList(jreClass.getMethods())); Set<java.lang.reflect.Method> allMethods = new HashSet<>(Arrays.asList(jreClass.getMethods()));
Set<java.lang.reflect.Method> allDeclaredMethods = new HashSet<>(Arrays.asList(jreClass.getDeclaredMethods())); Set<java.lang.reflect.Method> allDeclaredMethods = new HashSet<>(Arrays.asList(jreClass.getDeclaredMethods()));

View File

@ -495,7 +495,7 @@ public class TYPEStmt implements StatementVisitor{
@Override @Override
public void visit(Return returnExpr) { public void visit(Return returnExpr) {
returnExpr.retexpr.accept(this); returnExpr.retexpr.accept(this);
constraintsSet.addUndConstraint(new Pair(returnExpr.getType(),info.getCurrentTypeScope().getReturnType(), PairOperator.SMALLERDOT)); constraintsSet.addUndConstraint(new Pair(returnExpr.getType(),info.getCurrentTypeScope().getReturnType(), PairOperator.EQUALSDOT));
} }
@Override @Override
@ -610,8 +610,8 @@ public class TYPEStmt implements StatementVisitor{
//Fuer Bytecodegenerierung PL 2020-03-09 wird derzeit nicht benutzt ENDE //Fuer Bytecodegenerierung PL 2020-03-09 wird derzeit nicht benutzt ENDE
methodConstraint.add(new Pair(assumption.getReturnType(resolver), forMethod.getType(), PairOperator.SMALLERDOT)); methodConstraint.add(new Pair(assumption.getReturnType(resolver), forMethod.getType(), PairOperator.EQUALSDOT));
extendsMethodConstraint.add(new Pair(assumption.getReturnType(resolver), forMethod.getType(), PairOperator.SMALLERDOT)); extendsMethodConstraint.add(new Pair(assumption.getReturnType(resolver), forMethod.getType(), PairOperator.EQUALSDOT));
//methodConstraint.add(new Pair(assumption.getReturnType(resolver), forMethod.getType(), PairOperator.EQUALSDOT)); //methodConstraint.add(new Pair(assumption.getReturnType(resolver), forMethod.getType(), PairOperator.EQUALSDOT));
//extendsMethodConstraint.add(new Pair(assumption.getReturnType(resolver), forMethod.getType(), PairOperator.EQUALSDOT)); //extendsMethodConstraint.add(new Pair(assumption.getReturnType(resolver), forMethod.getType(), PairOperator.EQUALSDOT));

View File

@ -13,6 +13,7 @@ import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import de.dhbwstuttgart.exceptions.DebugException; import de.dhbwstuttgart.exceptions.DebugException;
import de.dhbwstuttgart.syntaxtree.type.ExtendsWildcardType;
import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure; import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure;
import de.dhbwstuttgart.typeinference.unify.interfaces.IRuleSet; import de.dhbwstuttgart.typeinference.unify.interfaces.IRuleSet;
import de.dhbwstuttgart.typeinference.unify.model.ExtendsType; import de.dhbwstuttgart.typeinference.unify.model.ExtendsType;
@ -390,26 +391,51 @@ public class RuleSet implements IRuleSet{
if((pair.getPairOp() != PairOperator.SMALLERDOT) && (pair.getPairOp() != PairOperator.SMALLERNEQDOT)) if((pair.getPairOp() != PairOperator.SMALLERDOT) && (pair.getPairOp() != PairOperator.SMALLERNEQDOT))
return false; return false;
if (pair.getPairOp() == PairOperator.SMALLERNEQDOT) { UnifyType lhsType = pair.getLhsType();
UnifyType lhs = pair.getLhsType(); UnifyType rhsType = pair.getRhsType();
UnifyType rhs = pair.getRhsType();
if (lhs instanceof WildcardType) {
lhs = ((WildcardType)lhs).getWildcardedType();
}
if (rhs instanceof WildcardType) {
rhs = ((WildcardType)rhs).getWildcardedType();
}
if (lhs.equals(rhs)){ /*
return false; * ty <. ? extends ty' is wrong
} */
if (rhsType instanceof ExtendsType) {
return false;
}
/*
* ? super ty <. ty' is wrong
* except Ty' = Object or ty' = ? super Object
*/
if ((lhsType instanceof SuperType) &&
(!(rhsType.equals(new ReferenceType("java.lang.Object", false)))) &&
!(rhsType.equals(new SuperType (new ReferenceType("java.lang.Object", false))))) {
return false;
}
/*
* ? extends ty <. ty' is equivalent to ty < ty'
*/
if (lhsType instanceof ExtendsType) {
lhsType = ((WildcardType)lhsType).getWildcardedType();
}
/*
* ty <. ? super ty' ist equivalent to ty <. ty'
*/
if (rhsType instanceof SuperType) {
rhsType = ((WildcardType)rhsType).getWildcardedType();
}
/*
* SMALLERNEQDOT => type must not be equal
*/
if (pair.getPairOp() == PairOperator.SMALLERNEQDOT && lhsType.equals(rhsType)){
return false;
} }
UnifyType lhsType = pair.getLhsType();
if(!(lhsType instanceof ReferenceType) && !(lhsType instanceof PlaceholderType)) if(!(lhsType instanceof ReferenceType) && !(lhsType instanceof PlaceholderType))
return false; return false;
UnifyType rhsType = pair.getRhsType();
if(!(rhsType instanceof ReferenceType) && !(rhsType instanceof PlaceholderType)) if(!(rhsType instanceof ReferenceType) && !(rhsType instanceof PlaceholderType))
return false; return false;

View File

@ -18,6 +18,7 @@ import de.dhbwstuttgart.typeinference.unify.model.UnifyPair;
public class TypeUnify { public class TypeUnify {
public static Writer statistics;
/** /**
* unify parallel ohne result modell * unify parallel ohne result modell
* @param undConstrains * @param undConstrains
@ -73,13 +74,16 @@ public class TypeUnify {
* @return * @return
*/ */
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) {
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, logFile, log, 0, ret, usedTasks, statistics);
ForkJoinPool pool = new ForkJoinPool(); ForkJoinPool pool = new ForkJoinPool();
pool.invoke(unifyTask); pool.invoke(unifyTask);
Set<Set<UnifyPair>> res = unifyTask.join(); Set<Set<UnifyPair>> res = unifyTask.join();
try { try {
logFile.write("\nnoShortendElements: " + unifyTask.noShortendElements +"\n"); logFile.write("\nnoShortendElements: " + unifyTask.noShortendElements +"\n");
logFile.flush(); logFile.flush();
unifyTask.statistics.write("Backtracking: " + unifyTask.noBacktracking);
unifyTask.statistics.write("\nLoops: " + unifyTask.noLoop);
} }
catch (IOException e) { catch (IOException e) {
System.err.println("no log-File"); System.err.println("no log-File");
@ -107,6 +111,7 @@ public class TypeUnify {
*/ */
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, logFile, log, 0, ret, usedTasks); TypeUnifyTask unifyTask = new TypeUnifyTask(undConstrains, oderConstraints, fc, false, logFile, log, 0, ret, usedTasks);
unifyTask.statistics = statistics;
Set<Set<UnifyPair>> res = unifyTask.compute(); Set<Set<UnifyPair>> res = unifyTask.compute();
try { try {
logFile.write("\nnoShortendElements: " + unifyTask.noShortendElements +"\n"); logFile.write("\nnoShortendElements: " + unifyTask.noShortendElements +"\n");

View File

@ -19,6 +19,16 @@ public class TypeUnify2Task extends TypeUnifyTask {
Set<Set<UnifyPair>> setToFlatten; Set<Set<UnifyPair>> setToFlatten;
Set<UnifyPair> methodSignatureConstraintUebergabe; Set<UnifyPair> methodSignatureConstraintUebergabe;
//statistics
TypeUnify2Task(Set<Set<UnifyPair>> setToFlatten, Set<UnifyPair> eq,
List<Set<Constraint<UnifyPair>>> oderConstraints,
Set<UnifyPair> nextSetElement,
IFiniteClosure fc, boolean parallel, Writer logFile, Boolean log, int rekTiefe, UnifyResultModel urm, UnifyTaskModel usedTasks,
Set<UnifyPair> methodSignatureConstraintUebergabe, Writer statistics) {
this(setToFlatten, eq, oderConstraints, nextSetElement, fc, parallel, logFile, log, rekTiefe, urm, usedTasks, methodSignatureConstraintUebergabe );
}
public TypeUnify2Task(Set<Set<UnifyPair>> setToFlatten, Set<UnifyPair> eq, List<Set<Constraint<UnifyPair>>> oderConstraints, Set<UnifyPair> nextSetElement, IFiniteClosure fc, boolean parallel, Writer logFile, Boolean log, int rekTiefe, UnifyResultModel urm, UnifyTaskModel usedTasks, Set<UnifyPair> methodSignatureConstraintUebergabe) { public TypeUnify2Task(Set<Set<UnifyPair>> setToFlatten, Set<UnifyPair> eq, List<Set<Constraint<UnifyPair>>> oderConstraints, Set<UnifyPair> nextSetElement, IFiniteClosure fc, boolean parallel, Writer logFile, Boolean log, int rekTiefe, UnifyResultModel urm, UnifyTaskModel usedTasks, Set<UnifyPair> methodSignatureConstraintUebergabe) {
super(eq, oderConstraints, fc, parallel, logFile, log, rekTiefe, urm, usedTasks); super(eq, oderConstraints, fc, parallel, logFile, log, rekTiefe, urm, usedTasks);
this.setToFlatten = setToFlatten; this.setToFlatten = setToFlatten;

View File

@ -21,6 +21,7 @@ import java.util.stream.Stream;
import org.apache.commons.io.output.NullOutputStream; import org.apache.commons.io.output.NullOutputStream;
import de.dhbwstuttgart.core.JavaTXCompiler;
import de.dhbwstuttgart.exceptions.TypeinferenceException; import de.dhbwstuttgart.exceptions.TypeinferenceException;
import de.dhbwstuttgart.parser.NullToken; import de.dhbwstuttgart.parser.NullToken;
import de.dhbwstuttgart.syntaxtree.factory.UnifyTypeFactory; import de.dhbwstuttgart.syntaxtree.factory.UnifyTypeFactory;
@ -46,6 +47,7 @@ import de.dhbwstuttgart.typeinference.unify.model.UnifyType;
import de.dhbwstuttgart.typeinference.unify.model.WildcardType; import de.dhbwstuttgart.typeinference.unify.model.WildcardType;
import de.dhbwstuttgart.util.Pair; import de.dhbwstuttgart.util.Pair;
import de.dhbwstuttgart.typeinference.unify.model.OrderingUnifyPair; import de.dhbwstuttgart.typeinference.unify.model.OrderingUnifyPair;
import de.dhbwstuttgart.core.JavaTXCompiler;
import java.io.File; import java.io.File;
import java.io.FileWriter; import java.io.FileWriter;
@ -80,7 +82,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
private static int totalnoOfThread = 0; private static int totalnoOfThread = 0;
int thNo; int thNo;
protected boolean one = false; protected boolean one = false;
Integer MaxNoOfThreads = 8; Integer MaxNoOfThreads = 128;
public static final String rootDirectory = System.getProperty("user.dir")+"/test/logFiles/"; public static final String rootDirectory = System.getProperty("user.dir")+"/test/logFiles/";
Writer logFile; Writer logFile;
@ -125,12 +127,16 @@ 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;
volatile UnifyTaskModel usedTasks; volatile UnifyTaskModel usedTasks;
static Writer statistics;
public TypeUnifyTask() { public TypeUnifyTask() {
rules = new RuleSet(); rules = new RuleSet();
} }
@ -149,7 +155,11 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
} }
*/ */
//statistics
public TypeUnifyTask(Set<UnifyPair> eq, List<Set<Constraint<UnifyPair>>> oderConstraints, IFiniteClosure fc, boolean parallel, Writer logFile, Boolean log, int rekTiefe, UnifyResultModel urm, UnifyTaskModel usedTasks, Writer statistics) {
this(eq,oderConstraints, fc, parallel, logFile, log, rekTiefe, urm, usedTasks);
this.statistics = statistics;
}
public TypeUnifyTask(Set<UnifyPair> eq, List<Set<Constraint<UnifyPair>>> oderConstraints, IFiniteClosure fc, boolean parallel, Writer logFile, Boolean log, int rekTiefe, UnifyResultModel urm, UnifyTaskModel usedTasks) { public TypeUnifyTask(Set<UnifyPair> eq, List<Set<Constraint<UnifyPair>>> oderConstraints, IFiniteClosure fc, boolean parallel, Writer logFile, Boolean log, int rekTiefe, UnifyResultModel urm, UnifyTaskModel usedTasks) {
synchronized (this) { synchronized (this) {
this.eq = eq; this.eq = eq;
@ -248,7 +258,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
protected Set<Set<UnifyPair>> compute() { protected Set<Set<UnifyPair>> compute() {
if (one) { if (one) {
System.out.println("two"); //System.out.println("two");
} }
one = true; one = true;
Set<UnifyPair> neweq = new HashSet<>(eq); Set<UnifyPair> neweq = new HashSet<>(eq);
@ -592,6 +602,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
urm.notify(eqPrimePrimeSet); urm.notify(eqPrimePrimeSet);
writeStatistics("Result: " + eqPrimePrimeSet.toString());
} }
} }
else if(eqPrimePrime.isPresent()) { else if(eqPrimePrime.isPresent()) {
@ -646,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
//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)
@ -663,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>>
@ -774,8 +792,12 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
} }
/* sameEqSet-Bestimmung Ende */ /* sameEqSet-Bestimmung Ende */
int hilf = 0;
Set<UnifyPair> a = null; Set<UnifyPair> a = null;
while (nextSetasList.size() > 0) { while (nextSetasList.size() > 0) {
//statistics
//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
@ -794,6 +816,8 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
writeLog("nextSet: " + nextSet.toString()); writeLog("nextSet: " + nextSet.toString());
writeLog("nextSetasList: " + nextSetasList.toString()); writeLog("nextSetasList: " + nextSetasList.toString());
/* staistics Nextvar an Hand Varianzbestimmung auskommentieren Anfang
if (variance == 1) { if (variance == 1) {
a = oup.max(nextSetasList.iterator()); a = oup.max(nextSetasList.iterator());
nextSetasList.remove(a); nextSetasList.remove(a);
@ -865,7 +889,10 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
} }
} }
} }
Nextvar an Hand Varianzbestimmung auskommentieren Ende */
a = nextSetasList.remove(0); //statisticsList
//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);
@ -887,11 +914,13 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
/* Wenn bei (a \in theta) \in a zu Widerspruch in oneElems wird /* Wenn bei (a \in theta) \in a zu Widerspruch in oneElems wird
* a verworfen und zu nächstem Element von nextSetasList gegangen * a verworfen und zu nächstem Element von nextSetasList gegangen
*/ */
/* statistics sameEq wird nicht betrachtet ANGFANG
if (!oderConstraint && !sameEqSet.isEmpty() && !checkNoContradiction(a, sameEqSet, result)) { if (!oderConstraint && !sameEqSet.isEmpty() && !checkNoContradiction(a, sameEqSet, result)) {
a = null; a = null;
noShortendElements++; noShortendElements++;
continue; continue;
} }
statistics sameEq wird nicht betrachtet ENDE */
/* Wenn parallel gearbeitet wird, wird je nach Varianz ein neuer Thread /* Wenn parallel gearbeitet wird, wird je nach Varianz ein neuer Thread
* gestartet, der parallel weiterarbeitet. * gestartet, der parallel weiterarbeitet.
@ -918,19 +947,22 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
writeLog("a in " + variance + " "+ a); writeLog("a in " + variance + " "+ a);
writeLog("nextSetasListRest: " + nextSetasListRest.toString()); writeLog("nextSetasListRest: " + nextSetasListRest.toString());
} }
while (!nextSetasListRest.isEmpty()) { while (!nextSetasList.isEmpty()) {
Set<UnifyPair> nSaL = nextSetasListRest.remove(0); Set<UnifyPair> nSaL = nextSetasList.remove(0);
synchronized (this) { nextSetasList.remove(nSaL); synchronized (this) { //nextSetasList.remove(nSaL);
writeLog("1 RM" + nSaL.toString()); writeLog("1 RM" + nSaL.toString());
} }
if (!oderConstraint) { if (!oderConstraint) {
/* statistics sameEq wird nicht betrachtet ANGFANG
//ueberpruefung ob zu a =. ty \in nSaL in sameEqSet ein Widerspruch besteht //ueberpruefung ob zu a =. ty \in nSaL in sameEqSet ein Widerspruch besteht
if (!sameEqSet.isEmpty() && !checkNoContradiction(nSaL, sameEqSet, result)) { if (!sameEqSet.isEmpty() && !checkNoContradiction(nSaL, sameEqSet, result)) {
nSaL = null; nSaL = null;
noShortendElements++; noShortendElements++;
continue; continue;
} }
statistics sameEq wird nicht betrachtet ENDE */
} }
else { else {
nextSetasListOderConstraints.add(((Constraint<UnifyPair>)nSaL).getExtendConstraint()); nextSetasListOderConstraints.add(((Constraint<UnifyPair>)nSaL).getExtendConstraint());
@ -1017,19 +1049,21 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
writeLog("a in " + variance + " "+ a); writeLog("a in " + variance + " "+ a);
writeLog("nextSetasListRest: " + nextSetasListRest.toString()); writeLog("nextSetasListRest: " + nextSetasListRest.toString());
} }
while (!nextSetasListRest.isEmpty()) { while (!nextSetasList.isEmpty()) {
Set<UnifyPair> nSaL = nextSetasListRest.remove(0); Set<UnifyPair> nSaL = nextSetasList.remove(0);
synchronized (this) { nextSetasList.remove(nSaL); synchronized (this) { //nextSetasList.remove(nSaL);
writeLog("-1 RM" + nSaL.toString()); writeLog("-1 RM" + nSaL.toString());
} }
if (!oderConstraint) { if (!oderConstraint) {
/* statistics sameEq wird nicht betrachtet ANGFANG
//ueberpruefung ob zu a =. ty \in nSaL in sameEqSet ein Widerspruch besteht //ueberpruefung ob zu a =. ty \in nSaL in sameEqSet ein Widerspruch besteht
if (!sameEqSet.isEmpty() && !checkNoContradiction(nSaL, sameEqSet, result)) { if (!sameEqSet.isEmpty() && !checkNoContradiction(nSaL, sameEqSet, result)) {
nSaL = null; nSaL = null;
noShortendElements++; noShortendElements++;
continue; continue;
} }
statistics sameEq wird nicht betrachtet ENDE */
} }
else { else {
nextSetasListOderConstraints.add(((Constraint<UnifyPair>)nSaL).getExtendConstraint()); nextSetasListOderConstraints.add(((Constraint<UnifyPair>)nSaL).getExtendConstraint());
@ -1117,9 +1151,9 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
writeLog("a in " + variance + " "+ a); writeLog("a in " + variance + " "+ a);
writeLog("nextSetasListRest: " + nextSetasListRest.toString()); writeLog("nextSetasListRest: " + nextSetasListRest.toString());
} }
while (!nextSetasListRest.isEmpty()) { while (!nextSetasList.isEmpty()) {
Set<UnifyPair> nSaL = nextSetasListRest.remove(0); Set<UnifyPair> nSaL = nextSetasList.remove(0);
nextSetasList.remove(nSaL); //PL einkommentiert 20-02-03 //nextSetasList.remove(nSaL); //PL einkommentiert 20-02-03
Set<UnifyPair> newEq = new HashSet<>(eq); Set<UnifyPair> newEq = new HashSet<>(eq);
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);
@ -1179,6 +1213,9 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
}}} }}}
//Ab hier alle parallele Berechnungen wieder zusammengeführt. //Ab hier alle parallele Berechnungen wieder zusammengeführt.
//if (hilf == 1)
//System.out.println();
//writeStatistics("Zusammengeführt(" + rekTiefe + "): " + nextSetasList.size());
if (oderConstraint) {//Wenn weiteres Element nextSetasList genommen wird, muss die vorherige methodsignatur geloescht werden if (oderConstraint) {//Wenn weiteres Element nextSetasList genommen wird, muss die vorherige methodsignatur geloescht werden
methodSignatureConstraint.removeAll(((Constraint<UnifyPair>)a).getmethodSignatureConstraint()); methodSignatureConstraint.removeAll(((Constraint<UnifyPair>)a).getmethodSignatureConstraint());
//System.out.println("REMOVE: " +methodSignatureConstraint); //System.out.println("REMOVE: " +methodSignatureConstraint);
@ -1192,6 +1229,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|| (!isUndefinedPairSetSet(res) && !isUndefinedPairSetSet(result)) || (!isUndefinedPairSetSet(res) && !isUndefinedPairSetSet(result))
|| result.isEmpty()) { || result.isEmpty()) {
/* auskommentiert damit alle Lösungen reinkommen ANFANG
if ((!result.isEmpty() && !res.isEmpty() && !isUndefinedPairSetSet(res) && !isUndefinedPairSetSet(result)) //korrekte Loesungen aus und-constraints if ((!result.isEmpty() && !res.isEmpty() && !isUndefinedPairSetSet(res) && !isUndefinedPairSetSet(result)) //korrekte Loesungen aus und-constraints
&& (a.stream().map(x-> (x.getBasePair() != null)).reduce(true, (x, y) -> (x && y)))) //bei oder-Constraints nicht ausfuehren && (a.stream().map(x-> (x.getBasePair() != null)).reduce(true, (x, y) -> (x && y)))) //bei oder-Constraints nicht ausfuehren
{ {
@ -1213,7 +1251,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
//Alle Variablen bestimmen die nicht hinzugefügt wurden in a_last //Alle Variablen bestimmen die nicht hinzugefügt wurden in a_last
//System.out.println(a_last); //System.out.println(a_last);
if (a_last != null) {
try {//PL eingefuegt 2019-03-06 da bei map mmer wieder Nullpointer kamen try {//PL eingefuegt 2019-03-06 da bei map mmer wieder Nullpointer kamen
a_last.forEach(x -> {writeLog("a_last_elem:" + x + " basepair: " + x.getBasePair());});//PL 2019-05-13 ins try hinzugefuegt Nullpointer-Exception ist in der Zeile aufgetaucht. a_last.forEach(x -> {writeLog("a_last_elem:" + x + " basepair: " + x.getBasePair());});//PL 2019-05-13 ins try hinzugefuegt Nullpointer-Exception ist in der Zeile aufgetaucht.
List<PlaceholderType> varsLast_a = List<PlaceholderType> varsLast_a =
@ -1265,9 +1303,11 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
} }
catch (NullPointerException e) { catch (NullPointerException e) {
writeLog("NullPointerException: " + a_last.toString()); writeLog("NullPointerException: " + a_last.toString());
} }}
} }
else { else
auskommentiert damit alle Lösungen reinkommen ANFANG */
{
//alle Fehlerfaelle und alle korrekten Ergebnis jeweils adden //alle Fehlerfaelle und alle korrekten Ergebnis jeweils adden
writeLog("RES Fst: result: " + result.toString() + " res: " + res.toString()); writeLog("RES Fst: result: " + result.toString() + " res: " + res.toString());
result.addAll(res); result.addAll(res);
@ -1287,7 +1327,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
//wenn korrektes Ergebnis gefunden alle Fehlerfaelle loeschen //wenn korrektes Ergebnis gefunden alle Fehlerfaelle loeschen
result = par_res; result = par_res;
if (!par_res.isEmpty() && par_res.iterator().next() instanceof WildcardType) { if (!par_res.isEmpty() && par_res.iterator().next() instanceof WildcardType) {
System.out.println(""); //System.out.println("");
} }
} }
else { else {
@ -1303,7 +1343,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("");
@ -1411,6 +1451,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
else { if (variance == 0) { else { if (variance == 0) {
writeLog("a: " + rekTiefe + " variance: " + variance + a.toString()); writeLog("a: " + rekTiefe + " variance: " + variance + a.toString());
if (!oderConstraint) { if (!oderConstraint) {
writeStatistics("break");
break; break;
} }
else { else {
@ -1439,7 +1480,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;
@ -1472,8 +1513,9 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
return new Pair<>(su, x.getGroundBasePair());}) return new Pair<>(su, x.getGroundBasePair());})
.collect(Collectors.toCollection(HashSet::new)); .collect(Collectors.toCollection(HashSet::new));
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 -> {
@ -1486,6 +1528,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))
@ -1503,8 +1546,11 @@ 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);
System.out.println(""); //writeStatistics("Number of erased elements: " + (len - nextSetasList.size()));
//writeStatistics("Number of Backtracking: " + noBacktracking);
//System.out.println("");
} }
else //writeStatistics("res: " + res.toString());
//if (nextSetasList.size() == 0 && isUndefinedPairSetSet(result) && nextSet.size() > 1) { //if (nextSetasList.size() == 0 && isUndefinedPairSetSet(result) && nextSet.size() > 1) {
// return result; // return result;
//} //}
@ -1513,6 +1559,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());
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());
@ -2008,7 +2057,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
//System.out.println(pair); //System.out.println(pair);
if (first) { //writeLog(pair.toString()+"\n"); if (first) { //writeLog(pair.toString()+"\n");
if (((PlaceholderType)(pair.getLhsType())).getName().equals("AR")) { if (((PlaceholderType)(pair.getLhsType())).getName().equals("AR")) {
System.out.println("AR"); //System.out.println("AR");
} }
Set<Set<UnifyPair>> x1 = unifyCase1(pair, fc); Set<Set<UnifyPair>> x1 = unifyCase1(pair, fc);
if (pairOp == PairOperator.SMALLERNEQDOT) { if (pairOp == PairOperator.SMALLERNEQDOT) {
@ -2576,4 +2625,18 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
} }
} }
} }
void writeStatistics(String str) {
if (finalresult) {
synchronized ( this ) {
try {
statistics.write("Thread No. " + thNo + ": " + str + "\n");
statistics.flush();
}
catch (IOException e) {
System.err.println("kein StatisticsFile");
}
}}
}
} }

View File

@ -281,6 +281,7 @@ public class TestComplete {
@Test @Test
public void scalarTest() throws Exception { public void scalarTest() throws Exception {
var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Scalar.jav"); var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Scalar.jav");
var scalar = classFiles.get("Scalar"); var scalar = classFiles.get("Scalar");

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
<appender name="CONSOLE" class="de.dhbwstuttgart.logger.ConsoleAppender">
<param name="Target" value="System.out"/>
<layout class="de.dhbwstuttgart.logger.PatternLayout">
<param name="ConversionPattern" value="%-15C{1} %-5p [%-9c] %m%n"/>
</layout>
</appender>
<logger name="trtest">
<level value="DEBUG"/>
<appender-ref ref="CONSOLE"/>
</logger>
<logger name="funcTest">
<level value="DEBUG"/>
<appender-ref ref="CONSOLE"/>
</logger>
</log4j:configuration>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.