From: jjenista Date: Thu, 20 Aug 2009 17:39:47 +0000 (+0000) Subject: lots of bug fixes, partial solution towards allowing method calls, stable version... X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=9896de5ac8d59fc0e7b1a58a1238cf357dbe4202;p=IRC.git lots of bug fixes, partial solution towards allowing method calls, stable version that runs many primitive-only programs --- diff --git a/Robust/src/Analysis/MLP/MLPAnalysis.java b/Robust/src/Analysis/MLP/MLPAnalysis.java index 4fa42601..8b26318b 100644 --- a/Robust/src/Analysis/MLP/MLPAnalysis.java +++ b/Robust/src/Analysis/MLP/MLPAnalysis.java @@ -17,10 +17,31 @@ public class MLPAnalysis { private CallGraph callGraph; private OwnershipAnalysis ownAnalysis; - private FlatSESEEnterNode rootSESE; + + + // an implicit SESE is automatically spliced into + // the IR graph around the C main before this analysis--it + // is nothing special except that we can make assumptions + // about it, such as the whole program ends when it ends + private FlatSESEEnterNode mainSESE; + + // SESEs that are the root of an SESE tree belong to this + // set--the main SESE is always a root, statically SESEs + // inside methods are a root because we don't know how they + // will fit into the runtime tree of SESEs + private Set rootSESEs; + + // simply a set of every reachable SESE in the program private Set allSESEs; + + // A mapping of flat nodes to the stack of SESEs for that node, where + // an SESE is the child of the SESE directly below it on the stack. + // These stacks do not reflect the heirarchy over methods calls--whenever + // there is an empty stack it means all variables are available. private Hashtable< FlatNode, Stack > seseStacks; + + private Hashtable< FlatNode, Set > livenessRootView; private Hashtable< FlatNode, Set > livenessVirtualReads; private Hashtable< FlatNode, VarSrcTokTable > variableResults; @@ -33,8 +54,12 @@ public class MLPAnalysis { // use these methods in BuildCode to have access to analysis results - public FlatSESEEnterNode getRootSESE() { - return rootSESE; + public FlatSESEEnterNode getMainSESE() { + return mainSESE; + } + + public Set getRootSESEs() { + return rootSESEs; } public Set getAllSESEs() { @@ -66,24 +91,25 @@ public class MLPAnalysis { this.ownAnalysis = ownAnalysis; this.maxSESEage = state.MLP_MAXSESEAGE; - // initialize analysis data structures - allSESEs = new HashSet(); + rootSESEs = new HashSet(); + allSESEs = new HashSet(); - seseStacks = new Hashtable< FlatNode, Stack >(); + seseStacks = new Hashtable< FlatNode, Stack >(); + livenessRootView = new Hashtable< FlatNode, Set >(); livenessVirtualReads = new Hashtable< FlatNode, Set >(); variableResults = new Hashtable< FlatNode, VarSrcTokTable >(); notAvailableResults = new Hashtable< FlatNode, Set >(); codePlans = new Hashtable< FlatNode, CodePlan >(); - - wdvNodesToSpliceIn = new Hashtable(); + wdvNodesToSpliceIn = new Hashtable< FlatEdge, FlatWriteDynamicVarNode >(); FlatMethod fmMain = state.getMethodFlat( tu.getMain() ); - rootSESE = (FlatSESEEnterNode) fmMain.getNext(0); - rootSESE.setfmEnclosing( fmMain ); - rootSESE.setmdEnclosing( fmMain.getMethod() ); - rootSESE.setcdEnclosing( fmMain.getMethod().getClassDesc() ); + mainSESE = (FlatSESEEnterNode) fmMain.getNext(0); + mainSESE.setfmEnclosing( fmMain ); + mainSESE.setmdEnclosing( fmMain.getMethod() ); + mainSESE.setcdEnclosing( fmMain.getMethod().getClassDesc() ); + if( state.MLPDEBUG ) { System.out.println( "" ); @@ -102,13 +128,20 @@ public class MLPAnalysis { buildForestForward( fm ); } if( state.MLPDEBUG ) { - //System.out.println( "\nSESE Hierarchy\n--------------\n" ); printSESEHierarchy(); + System.out.println( "\nSESE Hierarchy\n--------------\n" ); printSESEHierarchy(); } // 2nd pass, results are saved in FlatSESEEnterNode, so // intermediate results, for safety, are discarded - livenessAnalysisBackward( rootSESE, true, null, fmMain.getFlatExit() ); + Iterator rootItr = rootSESEs.iterator(); + while( rootItr.hasNext() ) { + FlatSESEEnterNode root = rootItr.next(); + livenessAnalysisBackward( root, + true, + null, + root.getfmEnclosing().getFlatExit() ); + } // 3rd pass @@ -125,7 +158,14 @@ public class MLPAnalysis { // 4th pass, compute liveness contribution from // virtual reads discovered in variable pass - livenessAnalysisBackward( rootSESE, true, null, fmMain.getFlatExit() ); + rootItr = rootSESEs.iterator(); + while( rootItr.hasNext() ) { + FlatSESEEnterNode root = rootItr.next(); + livenessAnalysisBackward( root, + true, + null, + root.getfmEnclosing().getFlatExit() ); + } if( state.MLPDEBUG ) { //System.out.println( "\nLive-In, SESE View\n-------------\n" ); printSESELiveness(); //System.out.println( "\nLive-In, Root View\n------------------\n"+fmMain.printMethod( livenessRootView ) ); @@ -143,7 +183,7 @@ public class MLPAnalysis { pruneVariableResultsWithLiveness( fm ); } if( state.MLPDEBUG ) { - //System.out.println( "\nVariable Results-Out\n----------------\n"+fmMain.printMethod( variableResults ) ); + System.out.println( "\nVariable Results-Out\n----------------\n"+fmMain.printMethod( variableResults ) ); } @@ -169,10 +209,10 @@ public class MLPAnalysis { FlatMethod fm = state.getMethodFlat( d ); // compute a plan for code injections - computeStallsForward( fm ); + codePlansForward( fm ); } if( state.MLPDEBUG ) { - //System.out.println( "\nCode Plans\n----------\n"+fmMain.printMethod( codePlans ) ); + System.out.println( "\nCode Plans\n----------\n"+fmMain.printMethod( codePlans ) ); } // splice new IR nodes into graph after all @@ -247,7 +287,10 @@ public class MLPAnalysis { fsen.setmdEnclosing( fm.getMethod() ); fsen.setcdEnclosing( fm.getMethod().getClassDesc() ); - if( !seseStack.empty() ) { + if( seseStack.empty() ) { + rootSESEs.add( fsen ); + fsen.setParent( null ); + } else { seseStack.peek().addChild( fsen ); fsen.setParent( seseStack.peek() ); } @@ -273,9 +316,11 @@ public class MLPAnalysis { } private void printSESEHierarchy() { - // our forest is actually a tree now that - // there is an implicit root SESE - printSESEHierarchyTree( rootSESE, 0 ); + Iterator rootItr = rootSESEs.iterator(); + while( rootItr.hasNext() ) { + FlatSESEEnterNode root = rootItr.next(); + printSESEHierarchyTree( root, 0 ); + } System.out.println( "" ); } @@ -355,7 +400,7 @@ public class MLPAnalysis { // remember liveness per node from the root view as the // global liveness of variables for later passes to use if( toplevel == true ) { - livenessRootView = livenessResults; + livenessRootView.putAll( livenessResults ); } // post-order traversal, so do children first @@ -422,9 +467,11 @@ public class MLPAnalysis { } private void printSESELiveness() { - // our forest is actually a tree now that - // there is an implicit root SESE - printSESELivenessTree( rootSESE ); + Iterator rootItr = rootSESEs.iterator(); + while( rootItr.hasNext() ) { + FlatSESEEnterNode root = rootItr.next(); + printSESELivenessTree( root ); + } System.out.println( "" ); } @@ -449,9 +496,13 @@ public class MLPAnalysis { printSESELivenessTree( fsenChild ); } } - + private void printSESEInfo() { - printSESEInfoTree( rootSESE ); + Iterator rootItr = rootSESEs.iterator(); + while( rootItr.hasNext() ) { + FlatSESEEnterNode root = rootItr.next(); + printSESEInfoTree( root ); + } System.out.println( "" ); } @@ -544,24 +595,30 @@ public class MLPAnalysis { vstTable.age( currentSESE ); vstTable.assertConsistency(); - vstTable.ownInSet( currentSESE ); - vstTable.assertConsistency(); + //vstTable.ownInSet( currentSESE ); + //vstTable.assertConsistency(); } break; case FKind.FlatSESEExitNode: { FlatSESEExitNode fsexn = (FlatSESEExitNode) fn; FlatSESEEnterNode fsen = fsexn.getFlatEnter(); assert currentSESE.getChildren().contains( fsen ); - vstTable.remapChildTokens( fsen ); + vstTable.remapChildTokens( fsen ); + + // liveness virtual reads are things written by an SESE + // that, if not already, should be added to the in-set Set liveIn = currentSESE.getInVarSet(); Set virLiveIn = vstTable.removeParentAndSiblingTokens( fsen, liveIn ); + virLiveIn.addAll( fsen.getOutVarSet() ); Set virLiveInOld = livenessVirtualReads.get( fn ); if( virLiveInOld != null ) { virLiveIn.addAll( virLiveInOld ); } livenessVirtualReads.put( fn, virLiveIn ); - vstTable.assertConsistency(); + + vstTable.assertConsistency(); + // then all child out-set tokens are guaranteed // to be filled in, so clobber those entries with @@ -571,11 +628,12 @@ public class MLPAnalysis { TempDescriptor outVar = outVarItr.next(); HashSet ts = new HashSet(); ts.add( outVar ); - VariableSourceToken vst = new VariableSourceToken( ts, - fsen, - new Integer( 0 ), - outVar - ); + VariableSourceToken vst = + new VariableSourceToken( ts, + fsen, + new Integer( 0 ), + outVar + ); vstTable.remove( outVar ); vstTable.add( vst ); } @@ -676,7 +734,7 @@ public class MLPAnalysis { VarSrcTokTable vstTable = variableResults.get( fn ); // fix later, not working, only wanted it to make tables easier to read - //vstTable.pruneByLiveness( rootLiveSet ); + vstTable.pruneByLiveness( rootLiveSet ); for( int i = 0; i < fn.numNext(); i++ ) { FlatNode nn = fn.getNext( i ); @@ -832,7 +890,7 @@ public class MLPAnalysis { } - private void computeStallsForward( FlatMethod fm ) { + private void codePlansForward( FlatMethod fm ) { // start from flat method top, visit every node in // method exactly once @@ -872,12 +930,12 @@ public class MLPAnalysis { Set dotSTlive = livenessRootView.get( fn ); if( !seseStack.empty() ) { - computeStalls_nodeActions( fn, - dotSTlive, - dotSTtable, - dotSTnotAvailSet, - seseStack.peek() - ); + codePlans_nodeActions( fn, + dotSTlive, + dotSTtable, + dotSTnotAvailSet, + seseStack.peek() + ); } for( int i = 0; i < fn.numNext(); i++ ) { @@ -890,12 +948,12 @@ public class MLPAnalysis { } } - private void computeStalls_nodeActions( FlatNode fn, - Set liveSetIn, - VarSrcTokTable vstTableIn, - Set notAvailSetIn, - FlatSESEEnterNode currentSESE ) { - + private void codePlans_nodeActions( FlatNode fn, + Set liveSetIn, + VarSrcTokTable vstTableIn, + Set notAvailSetIn, + FlatSESEEnterNode currentSESE ) { + CodePlan plan = new CodePlan( currentSESE); switch( fn.kind() ) { @@ -1054,14 +1112,22 @@ public class MLPAnalysis { // identify sese-age pairs that are statically useful // and should have an associated SESE variable in code - Set staticSet = vstTableIn.getStaticSet(); + // JUST GET ALL SESE/AGE NAMES FOR NOW, PRUNE LATER, + // AND ALWAYS GIVE NAMES TO PARENTS + Set staticSet = vstTableIn.get(); Iterator vstItr = staticSet.iterator(); while( vstItr.hasNext() ) { VariableSourceToken vst = vstItr.next(); - currentSESE.addNeededStaticName( - new SESEandAgePair( vst.getSESE(), vst.getAge() ) - ); - currentSESE.mustTrackAtLeastAge( vst.getAge() ); + + FlatSESEEnterNode sese = currentSESE; + while( sese != null ) { + sese.addNeededStaticName( + new SESEandAgePair( vst.getSESE(), vst.getAge() ) + ); + sese.mustTrackAtLeastAge( vst.getAge() ); + + sese = sese.getParent(); + } } diff --git a/Robust/src/Analysis/MLP/VarSrcTokTable.java b/Robust/src/Analysis/MLP/VarSrcTokTable.java index 0f15ea5a..95265618 100644 --- a/Robust/src/Analysis/MLP/VarSrcTokTable.java +++ b/Robust/src/Analysis/MLP/VarSrcTokTable.java @@ -219,10 +219,20 @@ public class VarSrcTokTable { TempDescriptor refVar = refVarItr.next(); s = get( refVar ); - if( s != null ) { s.remove( vst ); } + if( s != null ) { + s.remove( vst ); + if( s.isEmpty() ) { + var2vst.remove( refVar ); + } + } s = get( vst.getSESE(), refVar ); - if( s != null ) { s.remove( vst ); } + if( s != null ) { + s.remove( vst ); + if( s.isEmpty() ) { + sv2vst.remove( new SVKey( vst.getSESE(), refVar ) ); + } + } } } @@ -285,10 +295,12 @@ public class VarSrcTokTable { removePrivate( vst ); } - refVars.remove( refVar ); + sv2vst.remove( new SVKey( vst.getSESE(), refVar ) ); + + refVars.remove( refVar ); } - var2vst.remove( refVar ); + var2vst.remove( refVar ); } @@ -559,8 +571,13 @@ public class VarSrcTokTable { return SrcType_READY; } + // if there appear to be no sources, it means this variable + // comes from outside of any statically-known SESE scope, + // which means the system guarantees its READY Set srcs = get( refVar ); - assert !srcs.isEmpty(); + if( srcs.isEmpty() ) { + return SrcType_READY; + } // if the variable may have more than one source, or that // source is at the summary age, it must be tracked dynamically @@ -583,7 +600,7 @@ public class VarSrcTokTable { // any reference variables that are not live can be pruned // from the table, and if any VSTs are then no longer // referenced, they can be dropped as well - /* THIS CAUSES INCONSISTENCY, FIX LATER, NOT REQUIRED + // THIS CAUSES INCONSISTENCY, FIX LATER, NOT REQUIRED public void pruneByLiveness( Set rootLiveSet ) { // the set of reference variables in the table minus the @@ -604,7 +621,7 @@ public class VarSrcTokTable { assertConsistency(); } - */ + // use as an aid for debugging, where true-set is checked diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java index d0db3db7..0471d35f 100644 --- a/Robust/src/IR/Flat/BuildCode.java +++ b/Robust/src/IR/Flat/BuildCode.java @@ -1951,7 +1951,8 @@ public class BuildCode { tempItr = fsen.getDynamicInVarSet().iterator(); while( tempItr.hasNext() ) { TempDescriptor temp = tempItr.next(); - + TypeDescriptor type = temp.getType(); + // go grab it from the SESE source output.println(" if( "+paramsprefix+"->"+temp+"_srcSESE != NULL ) {"); @@ -1963,10 +1964,19 @@ public class BuildCode { output.println(" }"); output.println(" pthread_mutex_unlock( &(com->lock) );"); + String typeStr; + if( type.isNull() ) { + typeStr = "void*"; + } else if( type.isClass() || type.isArray() ) { + typeStr = "struct "+type.getSafeSymbol()+"*"; + } else { + typeStr = type.getSafeSymbol(); + } + output.println(" "+generateTemp( fsen.getfmBogus(), temp, null )+ - " = *(("+temp.getType().toPrettyString()+"*) ("+ - paramsprefix+"->"+temp+"_srcSESE + "+ - paramsprefix+"->"+temp+"_srcOffset));"); + " = *(("+typeStr+"*) ("+ + paramsprefix+"->"+temp+"_srcSESE + "+ + paramsprefix+"->"+temp+"_srcOffset));"); // or if the source was our parent, its in the record to grab output.println(" } else {"); @@ -2022,8 +2032,8 @@ public class BuildCode { outmethod.println( " /* "+fsen.getPrettyIdentifier()+" */"); outmethod.println( " case "+fsen.getIdentifier()+":"); outmethod.println( " "+fsen.getSESEmethodName()+"( seseRecord );"); - - if( fsen.equals( mlpa.getRootSESE() ) ) { + + if( fsen.equals( mlpa.getMainSESE() ) ) { outmethod.println( " /* work scheduler works forever, explicitly exit */"); outmethod.println( " exit( 0 );"); } @@ -2833,7 +2843,7 @@ public class BuildCode { output.println(" {"); // before doing anything, lock your own record and increment the running children - if( fsen != mlpa.getRootSESE() ) { + if( fsen != mlpa.getMainSESE() ) { output.println(" pthread_mutex_lock( &("+paramsprefix+"->common.lock) );"); output.println(" ++("+paramsprefix+"->common.numRunningChildren);"); output.println(" pthread_mutex_unlock( &("+paramsprefix+"->common.lock) );"); @@ -2855,7 +2865,7 @@ public class BuildCode { output.println(" pthread_cond_init( &(seseToIssue->common.runningChildrenCond), NULL );"); output.println(" seseToIssue->common.numRunningChildren = 0;"); - if( fsen != mlpa.getRootSESE() ) { + if( fsen != mlpa.getMainSESE() ) { output.println(" seseToIssue->common.parent = (SESEcommon*) "+paramsprefix+";"); } else { output.println(" seseToIssue->common.parent = NULL;"); @@ -2865,12 +2875,12 @@ public class BuildCode { Iterator tempItr = fsen.getReadyInVarSet().iterator(); while( tempItr.hasNext() ) { TempDescriptor temp = tempItr.next(); - if( fsen != mlpa.getRootSESE() ) { + if( fsen != mlpa.getMainSESE() ) { output.println(" seseToIssue->"+temp+" = "+ generateTemp( fsen.getParent().getfmBogus(), temp, null )+";"); } else { output.println(" seseToIssue->"+temp+" = "+ - paramsprefix+"->"+temp+";"); + generateTemp( state.getMethodFlat( typeutil.getMain() ), temp, null )+";"); } } @@ -2879,7 +2889,7 @@ public class BuildCode { output.println(" pthread_mutex_init( &(seseToIssue->common.lock), NULL );"); output.println(" pthread_mutex_lock( &(seseToIssue->common.lock) );"); - if( fsen != mlpa.getRootSESE() ) { + if( fsen != mlpa.getMainSESE() ) { // count up outstanding dependencies, static first, then dynamic Iterator staticSrcsItr = fsen.getStaticInVarSrcs().iterator(); while( staticSrcsItr.hasNext() ) { @@ -2927,7 +2937,8 @@ public class BuildCode { output.println(" pthread_mutex_unlock( &(src->lock) );"); output.println(" seseToIssue->"+dynInVar+"_srcOffset = "+dynInVar+"_srcOffset;"); output.println(" } else {"); - output.println(" seseToIssue->"+dynInVar+" = "+dynInVar+";"); + output.println(" seseToIssue->"+dynInVar+" = "+ + generateTemp( fsen.getParent().getfmBogus(), dynInVar, null )+";"); output.println(" }"); output.println(" }"); @@ -2938,13 +2949,15 @@ public class BuildCode { // maintain pointers for for finding dynamic SESE // instances from static names - for( int i = fsen.getOldestAgeToTrack(); i > 0; --i ) { - SESEandAgePair p1 = new SESEandAgePair( fsen, i ); - SESEandAgePair p2 = new SESEandAgePair( fsen, i-1 ); - output.println(" "+p1+" = "+p2+";"); - } SESEandAgePair p = new SESEandAgePair( fsen, 0 ); - output.println(" "+p+" = seseToIssue;"); + if( fsen.getParent().getNeededStaticNames().contains( p ) ) { + for( int i = fsen.getOldestAgeToTrack(); i > 0; --i ) { + SESEandAgePair p1 = new SESEandAgePair( fsen, i ); + SESEandAgePair p2 = new SESEandAgePair( fsen, i-1 ); + output.println(" "+p1+" = "+p2+";"); + } + output.println(" "+p+" = seseToIssue;"); + } } // if there were no outstanding dependencies, issue here @@ -3007,7 +3020,7 @@ public class BuildCode { output.println(" }"); // if parent is stalling on you, let them know you're done - if( fsexn.getFlatEnter() != mlpa.getRootSESE() ) { + if( fsexn.getFlatEnter() != mlpa.getMainSESE() ) { output.println(" psem_give( &("+paramsprefix+"->common.stallSem) );"); } diff --git a/Robust/src/IR/Flat/BuildFlat.java b/Robust/src/IR/Flat/BuildFlat.java index f6d7797b..8c5a4d12 100644 --- a/Robust/src/IR/Flat/BuildFlat.java +++ b/Robust/src/IR/Flat/BuildFlat.java @@ -118,15 +118,15 @@ public class BuildFlat { Iterator methodit=cn.getMethods(); while(methodit.hasNext()) { currmd=(MethodDescriptor)methodit.next(); - - FlatSESEEnterNode rootSESE = null; - FlatSESEExitNode rootExit = null; + + FlatSESEEnterNode mainSESE = null; + FlatSESEExitNode mainExit = null; if (state.MLP && currmd.equals(typeutil.getMain())) { - SESENode rootTree = new SESENode( "root" ); - rootSESE = new FlatSESEEnterNode( rootTree ); - rootExit = new FlatSESEExitNode ( rootTree ); - rootSESE.setFlatExit ( rootExit ); - rootExit.setFlatEnter( rootSESE ); + SESENode mainTree = new SESENode( "main" ); + mainSESE = new FlatSESEEnterNode( mainTree ); + mainExit = new FlatSESEExitNode ( mainTree ); + mainSESE.setFlatExit ( mainExit ); + mainExit.setFlatEnter( mainSESE ); } fe=new FlatExit(); @@ -162,14 +162,15 @@ public class BuildFlat { FlatReturnNode rnflat=new FlatReturnNode(null); aen.addNext(rnflat); rnflat.addNext(fe); - } - } else if (state.MLP && rootSESE != null) { - rootSESE.addNext(fn); - fn=rootSESE; + } + + } else if (state.MLP && mainSESE != null) { + mainSESE.addNext(fn); + fn=mainSESE; FlatReturnNode rnflat=new FlatReturnNode(null); - np.getEnd().addNext(rootExit); - rootExit.addNext(rnflat); - rnflat.addNext(fe); + np.getEnd().addNext(mainExit); + mainExit.addNext(rnflat); + rnflat.addNext(fe); } else if (np.getEnd()!=null&&np.getEnd().kind()!=FKind.FlatReturnNode) { FlatReturnNode rnflat=new FlatReturnNode(null); diff --git a/Robust/src/IR/Flat/FlatSESEEnterNode.java b/Robust/src/IR/Flat/FlatSESEEnterNode.java index b9b00e38..a1f0e564 100644 --- a/Robust/src/IR/Flat/FlatSESEEnterNode.java +++ b/Robust/src/IR/Flat/FlatSESEEnterNode.java @@ -66,6 +66,10 @@ public class FlatSESEEnterNode extends FlatNode { dynamicVars = new HashSet(); staticInVar2src = new Hashtable(); + + fmEnclosing = null; + mdEnclosing = null; + cdEnclosing = null; } public void rewriteUse() { diff --git a/Robust/src/Runtime/mlp_runtime.c b/Robust/src/Runtime/mlp_runtime.c index 26551d0b..bd3455e7 100644 --- a/Robust/src/Runtime/mlp_runtime.c +++ b/Robust/src/Runtime/mlp_runtime.c @@ -10,6 +10,9 @@ #include "workschedule.h" +__thread struct Queue* seseCallStack; + + void* mlpAllocSESErecord( int size ) { void* newrec = RUNMALLOC( size ); return newrec; diff --git a/Robust/src/Runtime/mlp_runtime.h b/Robust/src/Runtime/mlp_runtime.h index 859a430b..a4f26d35 100644 --- a/Robust/src/Runtime/mlp_runtime.h +++ b/Robust/src/Runtime/mlp_runtime.h @@ -51,6 +51,11 @@ typedef struct SESEcommon_t { } SESEcommon; +// a thread-local stack of SESE's that have called a +// new method context +extern __thread struct Queue* seseCallStack; + + // simple mechanical allocation and // deallocation of SESE records void* mlpCreateSESErecord( int size ); diff --git a/Robust/src/Tests/mlp/tinyTest/makefile b/Robust/src/Tests/mlp/tinyTest/makefile index 67e822cc..83e2c3c9 100644 --- a/Robust/src/Tests/mlp/tinyTest/makefile +++ b/Robust/src/Tests/mlp/tinyTest/makefile @@ -4,7 +4,7 @@ SOURCE_FILES=$(PROGRAM).java BUILDSCRIPT=~/research/Robust/src/buildscript -USEMLP= -mlp 1 2 -mlpdebug # use to turn mlp on and off and make sure rest of build not broken +USEMLP= -mlp 8 2 -mlpdebug # use to turn mlp on and off and make sure rest of build not broken BSFLAGS= -nooptimize -debug -garbagestats -mainclass Test -ownership -ownallocdepth 1 -ownwritedots final -enable-assertions -flatirusermethods -ownaliasfile aliases.txt all: $(PROGRAM).bin diff --git a/Robust/src/Tests/mlp/tinyTest/test.java b/Robust/src/Tests/mlp/tinyTest/test.java index 1969cb84..2e3cea0e 100644 --- a/Robust/src/Tests/mlp/tinyTest/test.java +++ b/Robust/src/Tests/mlp/tinyTest/test.java @@ -10,51 +10,22 @@ public class Test { int x = Integer.parseInt( args[0] ); //int y = Integer.parseInt( args[1] ); - //System.out.println( "root: x="+x+", y="+y ); - /* - Foo foo = new Foo(); - foo.f = x; - */ - - /* - int[] a = new int[x]; - for( int i = 0; i < x; ++i ) { - sese fill { - a[i] = i; - } - } - */ - - - int total = 0; for( int i = 0; i < x; ++i ) { - System.out.println( "i="+i ); - - sese sum { - total = total + i; + sese calc { + int sum = 0; + for( int j = 0; j <= i; ++j ) { + sum = sum + j; + } } - System.out.println( "pi="+i ); - } - - - //setTo3( foo ); - - - - /* - int total = 0; - sese kemper { - for( int i = 0; i < 5; ++i ) { - total = total + i; + sese prnt { + mightPrint( x, i, sum ); } - } - */ + } - System.out.println( "total="+total ); // just for testing root's ability to // realize a single exit after all returns @@ -62,6 +33,17 @@ public class Test { //if( false ) { // return; //} + + + //Foo foo = new Foo(); + //foo.f = x; + //setTo3( foo ); + } + + public static void mightPrint( int x, int i, int sum ) { + if( i == x - 1 ) { + System.out.println( "sum of integers 0-"+i+" is "+sum ); + } } /*