From: jjenista Date: Mon, 17 Aug 2009 20:30:04 +0000 (+0000) Subject: bug fixes X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=ac4f5d472990ad1e45877570b9757b1107a5d13e;p=IRC.git bug fixes --- diff --git a/Robust/src/Analysis/MLP/VarSrcTokTable.java b/Robust/src/Analysis/MLP/VarSrcTokTable.java index bb48bc5b..0f15ea5a 100644 --- a/Robust/src/Analysis/MLP/VarSrcTokTable.java +++ b/Robust/src/Analysis/MLP/VarSrcTokTable.java @@ -305,28 +305,45 @@ public class VarSrcTokTable { // any curr tokens increase age by 1 public void age( FlatSESEEnterNode curr ) { + Set forRemoval = + new HashSet(); + + Set forAddition = + new HashSet(); + Iterator itr = trueSet.iterator(); while( itr.hasNext() ) { VariableSourceToken vst = itr.next(); if( vst.getSESE().equals( curr ) ) { - Integer newAge = vst.getAge()+1; - if( newAge > MAX_AGE ) { - newAge = MAX_AGE; - } + // only age if the token isn't already the maximum age + if( vst.getAge() < MAX_AGE ) { - remove( vst ); - - add( new VariableSourceToken( vst.getRefVars(), - curr, - newAge, - vst.getAddrVar() - ) - ); + forRemoval.add( vst ); + + forAddition.add( new VariableSourceToken( vst.getRefVars(), + curr, + vst.getAge() + 1, + vst.getAddrVar() + ) + ); + } } } + itr = forRemoval.iterator(); + while( itr.hasNext() ) { + VariableSourceToken vst = itr.next(); + remove( vst ); + } + + itr = forRemoval.iterator(); + while( itr.hasNext() ) { + VariableSourceToken vst = itr.next(); + add( vst ); + } + assertConsistency(); } diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java index 5e55f09f..cff00ce7 100644 --- a/Robust/src/IR/Flat/BuildCode.java +++ b/Robust/src/IR/Flat/BuildCode.java @@ -1863,6 +1863,7 @@ public class BuildCode { output.println("};"); } + output.println(" /* regular local primitives */"); for(int i=0; i pItr = fsen.getNeededStaticNames().iterator(); while( pItr.hasNext() ) { SESEandAgePair p = pItr.next(); @@ -1883,6 +1885,7 @@ public class BuildCode { } // declare variables for tracking dynamic sources + output.println(" /* dynamic variable sources */"); Iterator dynSrcItr = fsen.getDynamicVarSet().iterator(); while( dynSrcItr.hasNext() ) { TempDescriptor dynSrcVar = dynSrcItr.next(); @@ -1892,6 +1895,7 @@ public class BuildCode { // declare local temps for in-set primitives, and if it is // a ready-source variable, get the value from the record + output.println(" /* local temps for in-set primitives */"); Iterator itrInSet = fsen.getInVarSet().iterator(); while( itrInSet.hasNext() ) { TempDescriptor temp = itrInSet.next(); @@ -1907,11 +1911,12 @@ public class BuildCode { // declare local temps for out-set primitives if its not already // in the in-set, and it's value will get written so no problem + output.println(" /* local temp for out-set prim, not already in the in-set */"); Iterator itrOutSet = fsen.getOutVarSet().iterator(); while( itrOutSet.hasNext() ) { TempDescriptor temp = itrOutSet.next(); TypeDescriptor type = temp.getType(); - if( !type.isPtr() && !fsen.getReadyInVarSet().contains( temp ) ) { + if( !type.isPtr() && !fsen.getInVarSet().contains( temp ) ) { output.println(" "+type+" "+temp+";"); } } @@ -1936,17 +1941,17 @@ public class BuildCode { TempDescriptor temp = tempItr.next(); // go grab it from the SESE source - output.println(" if( "+paramsprefix+"->"+temp+"_srcSESE != NULL ) {"); - output.println(" "+generateTemp( fsen.getfmBogus(), temp, null )+ - " = *(("+temp.getType()+"*) ("+ + output.println(" if( "+paramsprefix+"->"+temp+"_srcSESE != NULL ) {"); + output.println(" "+generateTemp( fsen.getfmBogus(), temp, null )+ + " = *(("+temp.getType().toPrettyString()+"*) ("+ paramsprefix+"->"+temp+"_srcSESE + "+ paramsprefix+"->"+temp+"_srcOffset));"); // or if the source was our parent, its in the record to grab - output.println(" } else {"); - output.println(" "+generateTemp( fsen.getfmBogus(), temp, null )+ - " = "+paramsprefix+"->"+temp+";"); - output.println(" }"); + output.println(" } else {"); + output.println(" "+generateTemp( fsen.getfmBogus(), temp, null )+ + " = "+paramsprefix+"->"+temp+";"); + output.println(" }"); } // Check to see if we need to do a GC if this is a @@ -2963,16 +2968,16 @@ public class BuildCode { // if parent is stalling on you, let them know you're done if( fsexn.getFlatEnter() != mlpa.getRootSESE() ) { - output.println(" psem_give( &("+paramsprefix+"->common.stallSem) );"); + output.println(" psem_give( &("+paramsprefix+"->common.stallSem) );"); } // last of all, decrement your parent's number of running children - output.println(" if( "+paramsprefix+"->common.parent != NULL ) {"); - output.println(" pthread_mutex_lock( &("+paramsprefix+"->common.parent->lock) );"); - output.println(" --("+paramsprefix+"->common.parent->numRunningChildren);"); - output.println(" pthread_cond_signal( &("+paramsprefix+"->common.parent->runningChildrenCond) );"); - output.println(" pthread_mutex_unlock( &("+paramsprefix+"->common.parent->lock) );"); - output.println(" }"); + output.println(" if( "+paramsprefix+"->common.parent != NULL ) {"); + output.println(" pthread_mutex_lock( &("+paramsprefix+"->common.parent->lock) );"); + output.println(" --("+paramsprefix+"->common.parent->numRunningChildren);"); + output.println(" pthread_cond_signal( &("+paramsprefix+"->common.parent->runningChildrenCond) );"); + output.println(" pthread_mutex_unlock( &("+paramsprefix+"->common.parent->lock) );"); + output.println(" }"); } public void generateFlatWriteDynamicVarNode( FlatMethod fm, @@ -2999,13 +3004,14 @@ public class BuildCode { SESEandAgePair instance = new SESEandAgePair( vst.getSESE(), vst.getAge() ); + FlatSESEEnterNode current = fwdvn.getEnclosingSESE(); + output.println(" {"); - if( fwdvn.getEnclosingSESE().equals( vst.getSESE() ) ) { + if( current.equals( vst.getSESE() ) ) { // if the src comes from this SESE, it's a method local variable, // mark src pointer NULL to signify that the var is up-to-date output.println(" "+vst.getAddrVar()+"_srcSESE = NULL;"); - output.println(" "+refVar+" = "+vst.getAddrVar()+";"); } else { // otherwise we track where it will come from diff --git a/Robust/src/Tests/mlp/tinyTest/test.java b/Robust/src/Tests/mlp/tinyTest/test.java index 5fb47435..17e45e0b 100644 --- a/Robust/src/Tests/mlp/tinyTest/test.java +++ b/Robust/src/Tests/mlp/tinyTest/test.java @@ -12,46 +12,31 @@ public class Test { int y = Integer.parseInt( args[1] ); //System.out.println( "root: x="+x+", y="+y ); - + /* Foo foo = new Foo(); foo.f = x; - - sese jumbo { - foo.f = y; - } - - System.out.println( "f="+foo.f ); - + */ /* - if( x > 3 ) { - sese fee { - y = y + 10; - //System.out.println( "fee: y="+y ); + int[] a = new int[x]; + for( int i = 0; i < x; ++i ) { + sese fill { + a[i] = i; } } + */ - System.out.println( "yo" ); - - sese fie { - double xyz = -2.0; + int total = 0; + for( int i = 0; i < x; ++i ) { + sese sum { + total = total + i; + } } - System.out.println( "go" ); - - double jjj = Math.abs( xyz ); - - - // see that values from sese fi are - // forwarded to this sibling - sese foe { - //System.out.println( "fo: x="+x+", y="+y ); - System.out.println( "foe: y="+y+" jjj="+jjj ); - //System.out.println( "foe: y="+y ); - } - */ + //setTo3( foo ); + System.out.println( "total="+total ); // just for testing root's ability to // realize a single exit after all returns @@ -60,4 +45,12 @@ public class Test { // return; //} } + + /* + public static void setTo3( Foo foo ) { + sese func { + foo.f = 3; + } + } + */ }