added option to reject updates that change the layout of objects.
if (intindex != null) {
v.addAll(intindex.getRequiredDescriptors());
}
+ v.add(fd);
return v;
}
foundrepair=true;
}
}
- if (!foundrepair)
+ if (!foundrepair) {
return ERR_NOREPAIR;
+ }
}
import java.util.*;
import java.math.BigInteger;
import MCC.State;
+import MCC.Compiler;
public class SemanticChecker {
public IRErrorReporter getErrorReporter() { return er; }
public SymbolTable getSymbolTable() { return stGlobals; }
});
+ if (Compiler.REJECTLENGTH) {
+ analyze_length(indexbound);
+ }
+
if (indextype == null) {
ok = false;
return ok;
}
+ private void analyze_length(Expr indexbound) {
+ Set descriptors=indexbound.getRequiredDescriptors();
+ for(Iterator it=descriptors.iterator();it.hasNext();) {
+ Descriptor d=(Descriptor)it.next();
+ if (d instanceof FieldDescriptor) {
+ state.noupdate.add(d);
+ } else if (d instanceof ArrayDescriptor) {
+ state.noupdate.add(d);
+ } else if (d instanceof VarDescriptor) {
+ state.noupdate.add(d);
+ }
+ }
+ }
+
private boolean parse_global(ParseNode pn) {
if (!precheck(pn, "global")) {
return false;
continue;
}
}
- if (!un.checkupdates()) /* Make sure we have a good update */
+ if (!un.checkupdates(state)) /* Make sure we have a good update */
continue;
mun.addUpdate(un);
goodflag=false;break;
}
}
- if (!un.checkupdates()) {
+ if (!un.checkupdates(state)) {
goodflag=false;
break;
}
goodflag=false;
}
- if (!un.checkupdates()) {
+ if (!un.checkupdates(state)) {
goodflag=false;
break;
}
continue endloop;
e=ce.getExpr();
}
-
if (!(e instanceof VarExpr)) {
if (e.isValue(si.getSet().getType())) {
Updates up=new Updates(e,0,si.getSet().getType());
debugmsg("Finished processing quantifiers")&&
processconjunction(un,ruleconj,setmapping)&&
debugmsg("Finished processing conjunction")&&
- un.checkupdates()&&
+ un.checkupdates(state)&&
debugmsg("Updates checked")) {
mun.addUpdate(un);
GraphNode.Edge e=new GraphNode.Edge("abstract5"+addtocount,gn2);
}
}
- public boolean checkupdates() {
+ public boolean checkupdates(State state) {
if (!checkconflicts()) /* Do we have conflicting concrete updates */
return false;
+ if (!checknoupdates(state))
+ return false;
if (computeordering()) /* Ordering exists */
return true;
return false;
}
+ private boolean checknoupdates(State state) {
+ Set noupdate=state.noupdate;
+ for(int i=0;i<updates.size();i++) {
+ Updates u=(Updates)updates.get(i);
+ if (u.isAbstract())
+ continue; /* Abstract updates don't change fields */
+ Descriptor d=u.getDescriptor();
+ if (noupdate.contains(d))
+ return false;
+ }
+ return true;
+ }
+
private boolean computeordering() {
/* Build dependency graph between updates */
HashSet graph=new HashSet();
}
public Set getRequiredDescriptors() {
- return new HashSet();
+ Set s=new HashSet();
+ s.add(vd);
+ return s;
+
}
public VarDescriptor getVar() {