import IR.Tree.TertiaryNode;
import IR.Tree.TreeNode;
import Util.Lattice;
+import Util.Pair;
public class FlowDownCheck {
destLocation =
srcLocation = checkLocationFromExpressionNode(md, nametable, an.getDest(), srcLocation);
- if (!((Set<String>) state.getCd2LocationPropertyMap().get(cd)).contains(destLocation
- .getLocation(cd).getLocIdentifier())) {
+ if (!((Set<String>) state.getCd2LocationPropertyMap().get(new Pair(cd, "spin")))
+ .contains(destLocation.getLocation(cd).getLocIdentifier())) {
throw new Error("Location " + destLocation + " is not allowed to have spinning values at "
+ cd.getSourceFileName() + ":" + an.getNumLine());
}
if (priorityLoc1.getLocIdentifier().equals(priorityLoc2.getLocIdentifier())) {
// have the same level of local hierarchy
- Set<String> spinSet = (Set<String>) state.getCd2LocationPropertyMap().get(cd);
+ Set<String> spinSet =
+ (Set<String>) state.getCd2LocationPropertyMap().get(new Pair(cd, "spin"));
if (spinSet != null && spinSet.contains(priorityLoc1.getLocIdentifier())) {
// this location can be spinning
return ComparisonResult.GREATER;
import IR.Flat.*;
import IR.*;
import Util.Lattice;
+import Util.Pair;
import java.util.*;
import Analysis.TaskStateAnalysis.*;
return cd2locationOrderMap;
}
- public void addLocationPropertySet(ClassDescriptor cd, Set<String> set) {
- cd2locationPropertyMap.put(cd,set);
+ public void addLocationProperty(Pair key, Object value) {
+ cd2locationPropertyMap.put(key,value);
}
public Hashtable getCd2LocationPropertyMap() {
package IR.Tree;
import IR.*;
import Util.Lattice;
+import Util.Pair;
import java.io.File;
import java.util.*;
Lattice<String> locOrder =
new Lattice<String>("_top_","_bottom_");
Set<String> spinLocSet=new HashSet<String>();
+ String thisLoc=null;
for (int i = 0; i < pnv.size(); i++) {
ParseNode loc = pnv.elementAt(i);
if(isNode(loc,"location_property")) {
- String spinLoc=loc.getChildren().elementAt(0).getLabel();
- spinLocSet.add(spinLoc);
+ if(loc.getFirstChild().getLabel().equals("location_multi")){
+ String spinLoc=loc.getFirstChild().getFirstChild().getLabel();
+ spinLocSet.add(spinLoc);
+ }else{
+ thisLoc=loc.getFirstChild().getFirstChild().getLabel();
+ }
} else {
if(loc.getChildren().size()==1){
String locIentifier=loc.getChildren().elementAt(0).getLabel();
locID + "' is not defined in the hierarchy of the class '"+cd +"'.");
}
}
- state.addLocationPropertySet(cd, spinLocSet);
+ state.addLocationProperty(new Pair(cd,"spin"), spinLocSet);
+ }
+ if(thisLoc!=null){
+ state.addLocationProperty(new Pair(cd,"this"), thisLoc);
}
state.addLocationOrder(cd, locOrder);
}
non terminal ParseNode location_order_declaration, location_order_list, location_order;
// 19.9.1) Interface Declarations
non terminal ParseNode interface_declaration;
-non terminal ParseNode normal_interface_declaration, annotation_type_declaration;
+//non terminal ParseNode normal_interface_declaration
+non terminal ParseNode annotation_type_declaration;
non terminal ParseNode extends_interfaces_opt, extends_interfaces;
non terminal ParseNode interface_body;
non terminal ParseNode interface_member_declarations_opt, interface_member_declarations;
//non terminal ParseNode enum_arguments_opt, enum_body_declarations_opt;
// annotation expressions
-non terminal ParseNode annotations_opt, annotations, annotations_at, annotation, annotation_body;
+// non terminal ParseNode annotations_opt,
+non terminal ParseNode annotations, annotations_at, annotation, annotation_body;
non terminal ParseNode normal_annotation_body, marker_annotation_body;
non terminal ParseNode single_element_annotation_body;
non terminal ParseNode annotation_type_body, annotation_type_element_declarations;
:}
| IDENTIFIER:loc MULT{:
ParseNode pn=new ParseNode("location_property",parser.lexer.line_num);
- pn.addChild(loc);
+ pn.addChild("location_multi").addChild(loc);
RESULT=pn;
:}
| IDENTIFIER:loc {:
pn.addChild(loc);
RESULT=pn;
:}
+ | THIS COLON IDENTIFIER:loc {:
+ ParseNode pn=new ParseNode("location_property",parser.lexer.line_num);
+ pn.addChild("location_this").addChild(loc);
+ RESULT=pn;
+ :}
;
// 19.9) Interfaces