// to apply to the reachability graph
switch( fn.kind() ) {
+ case FKind.FlatGenReachNode: {
+ System.out.println( "Generating a reach graph!" );
+ rg.writeGraph( "genReach"+d,
+ true, // write labels (variables)
+ true, // selectively hide intermediate temp vars
+ true, // prune unreachable heap regions
+ false, // hide reachability altogether
+ true, // hide subset reachability states
+ true, // hide predicates
+ true ); // hide edge taints
+ } break;
+
+
case FKind.FlatMethod: {
// construct this method's initial heap model (IHM)
// since we're working on the FlatMethod, we know
FlatCall fc = (FlatCall) fn;
MethodDescriptor mdCallee = fc.getMethod();
FlatMethod fmCallee = state.getMethodFlat( mdCallee );
+
+
+ if( mdCallee.getSymbol().equals( "genReach" ) ) {
+ rg.writeGraph( "genReach"+d,
+ true, // write labels (variables)
+ true, // selectively hide intermediate temp vars
+ true, // prune unreachable heap regions
+ false, // hide reachability altogether
+ true, // hide subset reachability states
+ true, // hide predicates
+ true ); // hide edge taints
+ break;
+ }
+
+
boolean debugCallSite =
mdCaller.getSymbol().equals( state.DISJOINTDEBUGCALLER ) &&
Descriptor d = (Descriptor) me.getKey();
ReachGraph rg = (ReachGraph) me.getValue();
- rg.writeGraph( "COMPLETE"+d,
+ String graphName;
+ if( d instanceof TaskDescriptor ) {
+ graphName = "COMPLETEtask"+d;
+ } else {
+ graphName = "COMPLETE"+d;
+ }
+
+ rg.writeGraph( graphName,
true, // write labels (variables)
true, // selectively hide intermediate temp vars
true, // prune unreachable heap regions
}
Integer n = mapDescriptorToNumUpdates.get( d );
- rg.writeGraph( d+"COMPLETE"+String.format( "%05d", n ),
+ String graphName;
+ if( d instanceof TaskDescriptor ) {
+ graphName = d+"COMPLETEtask"+String.format( "%05d", n );
+ } else {
+ graphName = d+"COMPLETE"+String.format( "%05d", n );
+ }
+
+ rg.writeGraph( graphName,
true, // write labels (variables)
true, // selectively hide intermediate temp vars
true, // prune unreachable heap regions
true, // selectively hide intermediate temp vars
true, // prune unreachable heap regions
false, // hide reachability
- true, // hide subset reachability states
+ false, // hide subset reachability states
true, // hide predicates
false );// hide edge taints
}
case FKind.FlatBackEdge:
case FKind.FlatSESEEnterNode:
case FKind.FlatSESEExitNode:
+ case FKind.FlatGenReachNode:
return true;
case FKind.FlatCastNode:
FlatCastNode fcn=(FlatCastNode)fn;
/* Only used for microbenchmark testing of SingleTM version */
public static native void arraycopy(Object src, int srcPos, Object dst, int destPos, int length);
+
+ // for disjoint reachability analysis
+ public static void genReach();
}
while( dynSrcItr.hasNext() ) {
TempDescriptor dynSrcVar = dynSrcItr.next();
output.println(" SESEcommon* "+dynSrcVar+"_srcSESE = NULL;");
- output.println(" INTPTR "+dynSrcVar+"_srcOffset;");
+ output.println(" INTPTR "+dynSrcVar+"_srcOffset = 0x1;");
}
}
}
while( dynSrcItr.hasNext() ) {
TempDescriptor dynSrcVar = dynSrcItr.next();
output.println(" SESEcommon* "+dynSrcVar+"_srcSESE = NULL;");
- output.println(" INTPTR "+dynSrcVar+"_srcOffset;");
+ output.println(" INTPTR "+dynSrcVar+"_srcOffset = 0x1;");
}
// declare local temps for in-set primitives, and if it is
}
output.println(" "+generateTemp( fsen.getfmBogus(), temp, null )+
- " = *(("+typeStr+"*) ("+
+ " = *(("+typeStr+"*) ((void*)"+
paramsprefix+"->"+temp+"_srcSESE + "+
paramsprefix+"->"+temp+"_srcOffset));");
}
output.println(" "+generateTemp( fmContext, dynVar, null )+
- " = *(("+typeStr+"*) ("+
+ " = *(("+typeStr+"*) ((void*)"+
dynVar+"_srcSESE + "+dynVar+"_srcOffset));");
if( state.COREPROF ) {
output.println("#ifdef CP_EVENTID_TASKSTALLVAR");
output.println("/* nop */");
break;
+ case FKind.FlatGenReachNode:
+ // this node is just for generating a reach graph
+ // in disjointness analysis at a particular program point
+ break;
+
case FKind.FlatExit:
output.println("/* exit */");
break;
return new NodePair(faen, faexn);
}
+ private NodePair flattenGenReachNode( GenReachNode grn ) {
+ FlatGenReachNode fgrn = new FlatGenReachNode( grn.getGraphName() );
+ return new NodePair( fgrn, fgrn );
+ }
+
private NodePair flattenSESENode(SESENode sn) {
if( sn.isStart() ) {
FlatSESEEnterNode fsen=new FlatSESEEnterNode(sn);
case Kind.SESENode:
return flattenSESENode((SESENode)bsn);
+ case Kind.GenReachNode:
+ return flattenGenReachNode((GenReachNode)bsn);
+
case Kind.ContinueBreakNode:
return flattenContinueBreakNode((ContinueBreakNode)bsn);
}
public static final int FlatWriteDynamicVarNode=25;
public static final int FlatInstanceOfNode=26;
public static final int FlatExit=27;
+ public static final int FlatGenReachNode=28;
}
--- /dev/null
+package IR.Flat;
+import IR.TypeDescriptor;
+
+public class FlatGenReachNode extends FlatNode {
+ String graphName;
+
+ public FlatGenReachNode( String graphName ) {
+ this.graphName = graphName;
+ }
+
+ public String getGraphName() {
+ return graphName;
+ }
+
+ public FlatNode clone(TempMap t){ return new FlatGenReachNode( graphName ); }
+ public void rewriteUse(TempMap t){}
+ public void rewriteDst(TempMap t) {}
+
+
+ public String toString() {
+ return "FlatGenReachNode_"+graphName;
+ }
+
+ public int kind() {
+ return FKind.FlatGenReachNode;
+ }
+
+ public TempDescriptor [] writesTemps() {
+ return new TempDescriptor[0];
+ }
+}
blockstatements.addAll(parseSESEBlock(blockstatements,pn.getChild("body").getFirstChild()));
blockstatements.add(end);
} else if (isNode(pn,"continue")) {
- blockstatements.add(new ContinueBreakNode(false));
+ blockstatements.add(new ContinueBreakNode(false));
} else if (isNode(pn,"break")) {
- blockstatements.add(new ContinueBreakNode(true));
+ blockstatements.add(new ContinueBreakNode(true));
+
+ } else if (isNode(pn,"genreach")) {
+ String graphName = pn.getChild("graphName").getTerminal();
+ blockstatements.add( new GenReachNode( graphName ) );
} else {
System.out.println("---------------");
--- /dev/null
+package IR.Tree;
+
+public class GenReachNode extends BlockStatementNode {
+ String graphName;
+
+ public GenReachNode( String graphName ) {
+ assert graphName != null;
+ this.graphName = graphName;
+ }
+
+ public String printNode(int indent) {
+ return "genReach "+graphName;
+ }
+
+ public String getGraphName() {
+ return graphName;
+ }
+
+ public int kind() {
+ return Kind.GenReachNode;
+ }
+}
public final static int InstanceOfNode=26;
public final static int ArrayInitializerNode=27;
public final static int SynchronizedNode=28;
+ public final static int GenReachNode=29;
}
return;
case Kind.SESENode:
+ case Kind.GenReachNode:
// do nothing, no semantic check for SESEs
return;
}
key_table.put("finally", new Integer(Sym.FINALLY));
key_table.put("float", new Integer(Sym.FLOAT));
key_table.put("for", new Integer(Sym.FOR));
+ key_table.put("genreach", new Integer(Sym.GENREACH));
key_table.put("goto", new Integer(Sym.GOTO));
key_table.put("if", new Integer(Sym.IF));
key_table.put("import", new Integer(Sym.IMPORT));
"else", "enum",
"extends", "external", "final", "finally",
"flag", //keyword for failure aware computation
- "float", "for","getoffset", "global", "goto", "if",
+ "float", "for", "genreach", "getoffset", "global", "goto", "if",
//"implements",
"import", "instanceof", "int",
//"interface",
terminal ELLIPSIS;
terminal ENUM;
+// added for disjoint reachability analysis
+terminal GENREACH;
+
// 19.2) The Syntactic Grammar
non terminal ParseNode goal;
//non terminal ParseNode catches, catch_clause;
//non terminal ParseNode finally;
//non terminal ParseNode assert_statement;
+non terminal ParseNode genreach_statement;
// 19.12) Expressions
non terminal ParseNode primary, primary_no_new_array;
non terminal ParseNode class_instance_creation_expression;
| atomic_statement:st {: RESULT=st; :}
| sese_statement:st {: RESULT=st; :}
| synchronized_statement:st {: RESULT=st; :}
+ | genreach_statement:st {: RESULT=st; :}
// | throw_statement
// | try_statement
// | assert_statement
//constant_expression ::=
// expression
// ;
+
+
+genreach_statement ::=
+ GENREACH IDENTIFIER:graphName SEMICOLON {:
+ ParseNode pn=new ParseNode("genreach");
+ pn.addChild("graphName").addChild(graphName);
+ RESULT=pn; :}
+ ;