Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

At-Opt configuration #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package x10.optimizations.atOptimzer;

import x10.optimizations.atOptimzer.PlaceNode;

public class AbstractPlaceTree
{
public PlaceNode absPlTree;

public AbstractPlaceTree(PlaceNode plNode) {
this.absPlTree = plNode;
}

public AbstractPlaceTree() {
this.absPlTree = null;
}

public void addPlaceNode(PlaceNode plNode) {
this.absPlTree = plNode;
}
}
34 changes: 34 additions & 0 deletions x10.compiler/src/x10/optimizations/atOptimzer/ClassInfo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package x10.optimizations.atOptimzer;

import java.util.*;

public class ClassInfo {

public String classifier;
public String type;
public String name;
/* x10Type also using it for parameter optimization as well.
* for field X10Type is used for storing the type.
* for parameter x10Type is used to maintain the count
*/
public String x10Type = "";
public int classNo = 0;
public int methodNo = 0;
public int methodNoIn = 0;
public LinkedList<ClassInfo> methodPara = null;
/* field to store the unique id for identifying function-overloading - for method only*/
public String uniqueId;

public ClassInfo() {
this.classifier = null;
this.type = null;
this.name = null;
}

public ClassInfo(String f_classifier, String f_type, String f_name) {
this.classifier = f_classifier;
this.type = f_type;
this.name = f_name;
}

}
23 changes: 23 additions & 0 deletions x10.compiler/src/x10/optimizations/atOptimzer/ClosureDetails.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package x10.optimizations.atOptimzer;

import java.util.*;

public class ClosureDetails {
public String name;
public int fromClass = 0;
public int fromMethod = 0;
public int fromplace = 0;
public int toClass = 0;
public int toMethod = 0;
public int toplace = 0;
public int countCRSWS = -1;

public ClosureDetails(String closureName, int fromClass, int fromMethod, int fromplace ) {
this.name = closureName;
this.fromClass = fromClass;
this.fromMethod = fromMethod;
this.fromplace = fromplace;
}

}

42 changes: 42 additions & 0 deletions x10.compiler/src/x10/optimizations/atOptimzer/EdgeRep.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package x10.optimizations.atOptimzer;

import java.util.*;

public class EdgeRep {

public String edgeType;
public String desName;
public String fieldName = "";
public String edgeName = "";
public boolean copyFlag = false;

public EdgeRep(String edgeType, String desName) {
this.edgeType = edgeType;
this.desName = desName;
}

public EdgeRep(String edgeType, String desName, boolean copyFlag) {
this.edgeType = edgeType;
this.desName = desName;
this.copyFlag = copyFlag;
}

public EdgeRep(String edgeType, String desName, String fieldName) {
this.edgeType = edgeType;
this.desName = desName;
this.fieldName = fieldName;
}

public EdgeRep(String edgeType, String desName, String fieldName, boolean copyFlag) {
this.edgeType = edgeType;
this.desName = desName;
this.fieldName = fieldName;
this.copyFlag = copyFlag;
}

public EdgeRep() {
this.edgeType = "";
this.desName = "";
this.fieldName = "";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package x10.optimizations.atOptimzer;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.Stack;

import x10.optimizations.atOptimzer.ForClosureObjectField;

public class ForClosureObject {
public String varName = "";
public boolean ambiguity = false;
public LinkedList<ForClosureObjectField> fieldDetails = null;

public ForClosureObject () {
}

public ForClosureObject(String varName, boolean ambiguity) {
this.varName = varName;
this.ambiguity = ambiguity;
this.fieldDetails = new LinkedList<ForClosureObjectField>();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package x10.optimizations.atOptimzer;

import java.util.*;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Stack;

public class ForClosureObjectField {
public String fieldName = "";
public String tempStoredName = "";
public String fieldType = "";
public boolean ambiguity = false;
public String fieldObjName = "";

public ForClosureObjectField () {

}

public ForClosureObjectField(String fieldName, String tempStoredName, String fieldType) {
this.fieldName = fieldName;
this.tempStoredName = tempStoredName;
this.fieldType = fieldType;
}

public ForClosureObjectField(String fieldName, String tempStoredName, String fieldType, boolean ambiguity, String fieldObjName) {
this.fieldName = fieldName;
this.tempStoredName = tempStoredName;
this.fieldType = fieldType;
this.ambiguity = ambiguity;
this.fieldObjName = fieldObjName;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package x10.optimizations.atOptimzer;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.Stack;

import x10.optimizations.atOptimzer.ForClosureObjectField;

public class ForClosureObjectcpp {
public String fldName = "";
public String zzName = "";
public String type = "";

public ForClosureObjectcpp () {
}

}
21 changes: 21 additions & 0 deletions x10.compiler/src/x10/optimizations/atOptimzer/ObjNode.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package x10.optimizations.atOptimzer;

import java.util.*;

public class ObjNode {
public String name;
public String objType;
public boolean copyFlag = false;
public int counter = 0;

public ObjNode(String objName, String objType) {
this.name = objName;
this.objType = objType;
}

public ObjNode(String objName, String objType, boolean copyFlag) {
this.name = objName;
this.objType = objType;
this.copyFlag = copyFlag;
}
}
40 changes: 40 additions & 0 deletions x10.compiler/src/x10/optimizations/atOptimzer/PlaceNode.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package x10.optimizations.atOptimzer;

public class PlaceNode
{
public String toName;
public PlaceNode child;
public PlaceNode sibling;

public PlaceNode(String placeName) {
this.toName = placeName;
this.child = null;
this.sibling = null;
}

public PlaceNode() {
this.toName = null;
this.child = null;
this.sibling = null;
}

public void addChild(PlaceNode plNode) {
PlaceNode temp = this;

if(temp.child == null) {
temp.child = plNode;
}
else {
PlaceNode temp1 = temp.child;

while(temp1.sibling != null) {
temp1 = temp1.sibling;
}
temp1.sibling = plNode;

}
}

public void addSibling() {
}
}
14 changes: 14 additions & 0 deletions x10.compiler/src/x10/optimizations/atOptimzer/VarWithLineNo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package x10.optimizations.atOptimzer;

import java.util.*;

public class VarWithLineNo {
public String name;
public int lineNo;

public VarWithLineNo(String varName, int lineNo) {
this.name = varName;
this.lineNo = lineNo;
}

}
14 changes: 14 additions & 0 deletions x10.compiler/src/x10/optimizations/atOptimzer/processInfo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package x10.optimizations.atOptimzer;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.Stack;

import x10.optimizations.atOptimzer.processInfo;

public class processInfo
{
public Stack<String> currClass = new Stack<String>();
public HashMap<String, LinkedList<ClassInfo>> classDetails = new HashMap<String, LinkedList<ClassInfo>>();

}
36 changes: 36 additions & 0 deletions x10.compiler/src/x10cpp/visit/Emitter.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
Expand Down Expand Up @@ -108,10 +109,24 @@
import x10cpp.debug.LineNumberMap;
import x10cpp.types.X10CPPContext_c;

//Nobita code
import static x10cpp.visit.MessagePassingCodeGenerator.currClass;
import static x10cpp.visit.MessagePassingCodeGenerator.currMethod;
import static x10cpp.visit.MessagePassingCodeGenerator.iterationCount;
import static x10cpp.visit.MessagePassingCodeGenerator.classDetails;
import x10.optimizations.atOptimzer.VarWithLineNo;
import x10.optimizations.atOptimzer.ClassInfo;



public class Emitter {

private final Translator tr;
private ASTQuery query;
//nobita code
public static String fieldDec = "";
public static boolean field = false;

public Emitter(Translator tr) {
this.tr = tr;
query = new ASTQuery(tr);
Expand Down Expand Up @@ -240,7 +255,14 @@ void printType(Type type, CodeWriter w) {
printType(type,w,null);
}
void printType(Type type, CodeWriter w, Context ctx) {
if (field) {
String str = translateType(type, true, true, ctx);
fieldDec = str;
w.write(str);
}
else {
w.write(translateType(type, true, true, ctx));
}
}

/**
Expand Down Expand Up @@ -915,7 +937,21 @@ void printHeader(FieldDecl_c n, CodeWriter h, Translator tr, boolean qualify) {
h.write("volatile ");
}

//Nobita code
if (iterationCount == 0) { field = true; fieldDec = "";}
printType(n.type().type(), h);
if (field) {
field = false;
VarWithLineNo temp1 = currClass.peek();

ClassInfo fieldDetails = new ClassInfo("field", n.type().nameString(), n.name().toString());
fieldDetails.x10Type = fieldDec;

LinkedList<ClassInfo> fi = classDetails.get(temp1.name);
fi.add(fieldDetails);
fieldDec = "";
}

h.allowBreak(2, 2, " ", 1);
if (qualify) {
X10ClassType declClass = (X10ClassType)n.fieldDef().asInstance().container().toClass();
Expand Down
Loading