Refactoring der Bytecodegenerierung und Anpassung von Kommentaren.
This commit is contained in:
parent
0e363cfae3
commit
d8bdcf854c
@ -592,28 +592,7 @@ public class BytecodeGenMethod implements StatementVisitor {
|
|||||||
this.lamCounter++;
|
this.lamCounter++;
|
||||||
|
|
||||||
String typeErasure = createDescriptorWithTypeErasure(lambdaExpression);
|
String typeErasure = createDescriptorWithTypeErasure(lambdaExpression);
|
||||||
//ByteCodeForFunNGenerator.generateBCForFunN(lambdaExpression, typeErasure,path); //old
|
//ToDo Etienne: Double Check
|
||||||
//ToDo Etienne: umbauen
|
|
||||||
//ToDo Refactor
|
|
||||||
/*
|
|
||||||
FunN f;
|
|
||||||
ASTToIntermediate converter = new ASTToIntermediate();
|
|
||||||
//Fehler in return Typ
|
|
||||||
IntermediateInnerType returnType = (IntermediateInnerType) converter.convert(resolver.resolve(lambdaExpression.getReturnType()));
|
|
||||||
List<IntermediateInnerType> arguments = lambdaExpression.params
|
|
||||||
.getFormalparalist()
|
|
||||||
.stream()
|
|
||||||
.map(FormalParameter::getType)
|
|
||||||
.map(resolver::resolve)
|
|
||||||
.map(converter::convert)
|
|
||||||
.filter(t -> t instanceof IntermediateInnerType)
|
|
||||||
.map(t -> (IntermediateInnerType) t)
|
|
||||||
.collect(Collectors.toList());//ToDo
|
|
||||||
f = new FunN(arguments, returnType);
|
|
||||||
FunN.writeClassFile(f.getSuperClassName(), f.getSuperBytecode(), path);
|
|
||||||
FunN.writeClassFile(f.getClassName(), f.getBytecode(), path);
|
|
||||||
*/
|
|
||||||
///*
|
|
||||||
RefTypeOrTPHOrWildcardOrGeneric returnType = resolver.resolve(lambdaExpression.getReturnType());
|
RefTypeOrTPHOrWildcardOrGeneric returnType = resolver.resolve(lambdaExpression.getReturnType());
|
||||||
List<RefTypeOrTPHOrWildcardOrGeneric> argumentTypes = lambdaExpression
|
List<RefTypeOrTPHOrWildcardOrGeneric> argumentTypes = lambdaExpression
|
||||||
.params
|
.params
|
||||||
@ -623,12 +602,11 @@ public class BytecodeGenMethod implements StatementVisitor {
|
|||||||
.map(resolver::resolve)
|
.map(resolver::resolve)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
FunNUtilities funNUtilities = FunNGenerator.getInstance();
|
FunNUtilities funNUtilities = FunNGenerator.getInstance();
|
||||||
byte[] superBytecode = funNUtilities.generateSuperBytecode(argumentTypes.size());
|
FunNUtilities.writeClassFile(funNUtilities.getSuperClassName(argumentTypes.size()),
|
||||||
byte[] specializedBytecode = funNUtilities.generateSpecializedBytecode(argumentTypes, returnType);
|
funNUtilities.generateSuperBytecode(argumentTypes.size()), path);
|
||||||
FunNUtilities.writeClassFile(funNUtilities.getSuperClassName(argumentTypes.size()), superBytecode, path);
|
FunNUtilities.writeClassFile(funNUtilities.getSpecializedClassName(argumentTypes, returnType),
|
||||||
FunNUtilities.writeClassFile(funNUtilities.getSpecializedClassName(argumentTypes, returnType), specializedBytecode, path);
|
funNUtilities.generateSpecializedBytecode(argumentTypes, returnType), path);
|
||||||
//*/
|
|
||||||
//ToDo Etienne: umbauen end
|
|
||||||
Lambda lam = new Lambda(lambdaExpression);
|
Lambda lam = new Lambda(lambdaExpression);
|
||||||
String lamDesc = lam.accept(new DescriptorToString(resultSet));
|
String lamDesc = lam.accept(new DescriptorToString(resultSet));
|
||||||
// Call site, which, when invoked, returns an instance of the functional
|
// Call site, which, when invoked, returns an instance of the functional
|
||||||
@ -850,26 +828,7 @@ public class BytecodeGenMethod implements StatementVisitor {
|
|||||||
} else if(!helper.isInCurrPkg(clazz)){
|
} else if(!helper.isInCurrPkg(clazz)){
|
||||||
if(clazz.contains(CONSTANTS.$$)) {
|
if(clazz.contains(CONSTANTS.$$)) {
|
||||||
mDesc = helper.getDescriptorOfApplyMethod(methCallType);
|
mDesc = helper.getDescriptorOfApplyMethod(methCallType);
|
||||||
//helper.generateBCForFunN(mDesc); //old
|
//ToDo Etienne: Double Check
|
||||||
//ToDo Etienne: Refactor
|
|
||||||
/*
|
|
||||||
FunN f;
|
|
||||||
ASTToIntermediate converter = new ASTToIntermediate();
|
|
||||||
IntermediateInnerType returnType = (IntermediateInnerType) converter.convert(resolver.resolve(methodCall.getType()));
|
|
||||||
List<IntermediateInnerType> arguments = methodCall
|
|
||||||
.argTypes
|
|
||||||
.stream()
|
|
||||||
.map(resolver::resolve)
|
|
||||||
.map(converter::convert)
|
|
||||||
.filter(t -> t instanceof IntermediateInnerType)
|
|
||||||
.map(t -> (IntermediateInnerType) t)
|
|
||||||
.collect(Collectors.toList());//ToDo
|
|
||||||
f = new FunN(arguments, returnType);
|
|
||||||
|
|
||||||
FunN.writeClassFile(f.getSuperClassName(), f.getSuperBytecode(), path);
|
|
||||||
FunN.writeClassFile(f.getClassName(), f.getBytecode(), path);
|
|
||||||
*/
|
|
||||||
///*
|
|
||||||
RefTypeOrTPHOrWildcardOrGeneric returnType = resolver.resolve(methodCall.getType());
|
RefTypeOrTPHOrWildcardOrGeneric returnType = resolver.resolve(methodCall.getType());
|
||||||
List<RefTypeOrTPHOrWildcardOrGeneric> argumentTypes = methodCall
|
List<RefTypeOrTPHOrWildcardOrGeneric> argumentTypes = methodCall
|
||||||
.argTypes
|
.argTypes
|
||||||
@ -877,13 +836,10 @@ public class BytecodeGenMethod implements StatementVisitor {
|
|||||||
.map(resolver::resolve)
|
.map(resolver::resolve)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
FunNUtilities funNUtilities = FunNGenerator.getInstance();
|
FunNUtilities funNUtilities = FunNGenerator.getInstance();
|
||||||
byte[] superBytecode = funNUtilities.generateSuperBytecode(argumentTypes.size());
|
FunNUtilities.writeClassFile(funNUtilities.getSuperClassName(argumentTypes.size()),
|
||||||
byte[] specializedBytecode = funNUtilities.generateSpecializedBytecode(argumentTypes, returnType);
|
funNUtilities.generateSuperBytecode(argumentTypes.size()), path);
|
||||||
FunNUtilities.writeClassFile(funNUtilities.getSuperClassName(argumentTypes.size()), superBytecode, path);
|
FunNUtilities.writeClassFile(funNUtilities.getSpecializedClassName(argumentTypes, returnType),
|
||||||
FunNUtilities.writeClassFile(funNUtilities.getSpecializedClassName(argumentTypes, returnType), specializedBytecode, path);
|
funNUtilities.generateSpecializedBytecode(argumentTypes, returnType), path);
|
||||||
//*/
|
|
||||||
//ToDo Etienne End
|
|
||||||
// mDesc = helper.generateBCForFunN(methCallType,typesOfParams);
|
|
||||||
}else {
|
}else {
|
||||||
try {
|
try {
|
||||||
cLoader2 = new DirectoryClassLoader(path, classLoader);
|
cLoader2 = new DirectoryClassLoader(path, classLoader);
|
||||||
|
@ -8,7 +8,6 @@ public class TypeToDescriptor implements TypeVisitor<String>{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String visit(RefType refType) {
|
public String visit(RefType refType) {
|
||||||
//ToDo Etienne: check if it works
|
|
||||||
if (refType.getName().toString().matches("Fun\\d+\\$\\$") && refType.getParaList().size() > 0) {
|
if (refType.getName().toString().matches("Fun\\d+\\$\\$") && refType.getParaList().size() > 0) {
|
||||||
FunNUtilities funNUtilities = FunNGenerator.getInstance();
|
FunNUtilities funNUtilities = FunNGenerator.getInstance();
|
||||||
return funNUtilities.getSpecializedDescriptor(funNUtilities.getArguments(refType.getParaList()), funNUtilities.getReturnType(refType.getParaList()));
|
return funNUtilities.getSpecializedDescriptor(funNUtilities.getArguments(refType.getParaList()), funNUtilities.getReturnType(refType.getParaList()));
|
||||||
|
@ -31,4 +31,6 @@ public interface FunNUtilities {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,6 @@ public class TypeToSignature implements TypeVisitor<String> {
|
|||||||
public String visit(RefType refType) {
|
public String visit(RefType refType) {
|
||||||
if(refType.getName().toString().equals("void"))
|
if(refType.getName().toString().equals("void"))
|
||||||
return "V";
|
return "V";
|
||||||
//ToDo Etienne: check if it works
|
|
||||||
if (refType.getName().toString().matches("Fun\\d+\\$\\$") && refType.getParaList().size() > 0){
|
if (refType.getName().toString().matches("Fun\\d+\\$\\$") && refType.getParaList().size() > 0){
|
||||||
FunNUtilities funNUtilities = FunNGenerator.getInstance();
|
FunNUtilities funNUtilities = FunNGenerator.getInstance();
|
||||||
return funNUtilities.getSpecializedSignature(funNUtilities.getArguments(refType.getParaList()), funNUtilities.getReturnType(refType.getParaList()));
|
return funNUtilities.getSpecializedSignature(funNUtilities.getArguments(refType.getParaList()), funNUtilities.getReturnType(refType.getParaList()));
|
||||||
|
Loading…
Reference in New Issue
Block a user