nus-yam/ex-repair huggingface dataset:
Program: 132962
Project: 132962
Buggy source:
/** 
 * @param newCV
 * @param replace for debugging purposes, set to true if we intend to replace
 */
public void addComputedValue(ComputedValue newCV,boolean replace){
  boolean outClosed=newCV.isOutClosed();
  if (isAvailable(newCV)) {
    if (!replace) {
      throw new STCRuntimeError("String_Node_Str" + getLocation(newCV) + "String_Node_Str"+ newCV);
    }
  }
 else   if (replace) {
    throw new STCRuntimeError("String_Node_Str" + "String_Node_Str" + newCV + "String_Node_Str");
  }
  Arg valLoc=newCV.getValLocation();
  Opcode op=newCV.getOp();
  availableVals.put(newCV,valLoc);
  if (valLoc.isVar()) {
    varContents.put(valLoc.getVar(),newCV);
  }
  if (valLoc.isVar() && outClosed) {
    close(valLoc.getVar(),false);
  }
  if (op == Opcode.LOAD_BOOL || op == Opcode.LOAD_FLOAT || op == Opcode.LOAD_INT || op == Opcode.LOAD_STRING || op == Opcode.LOAD_VOID || op == Opcode.LOAD_FILE) {
    close(newCV.getInput(0).getVar(),true);
  }
}

Fixed version (ground truth):
/** 
 * @param newCV
 * @param replace for debugging purposes, set to true if we intend to replace
 */
public void addComputedValue(ComputedValue newCV,boolean replace){
  boolean outClosed=newCV.isOutClosed();
  if (isAvailable(newCV)) {
    if (!replace) {
      throw new STCRuntimeError("String_Node_Str" + getLocation(newCV) + "String_Node_Str"+ newCV);
    }
  }
 else   if (replace) {
    throw new STCRuntimeError("String_Node_Str" + "String_Node_Str" + newCV + "String_Node_Str");
  }
  Arg valLoc=newCV.getValLocation();
  Opcode op=newCV.getOp();
  availableVals.put(newCV,valLoc);
  if (valLoc.isVar()) {
    varContents.put(valLoc.getVar(),newCV);
    if (outClosed) {
      close(valLoc.getVar(),false);
    }
  }
  if (op == Opcode.LOAD_BOOL || op == Opcode.LOAD_FLOAT || op == Opcode.LOAD_INT || op == Opcode.LOAD_STRING || op == Opcode.LOAD_VOID || op == Opcode.LOAD_FILE) {
    close(newCV.getInput(0).getVar(),true);
  }
}
Program: 132963
Project: 132963
Buggy source:
/** 
 * Do a kind of dataflow analysis where we try to identify which futures are closed at different points in the program. This allows us to switch to lower-overhead versions of many operations.
 * @param logger
 * @param program
 * @throws InvalidOptionException
 * @throws InvalidWriteException
 */
public void optimize(Logger logger,Program program) throws InvalidOptionException, InvalidWriteException {
  for (  Function f : program.getFunctions()) {
    boolean changes;
    int pass=1;
    do {
      logger.trace("String_Node_Str" + f.getName() + "String_Node_Str"+ pass);
      changes=forwardDataflow(logger,program,f,ExecContext.CONTROL,f.mainBlock(),null,null,null);
      liftWait(logger,program,f);
      pass++;
    }
 while (changes);
  }
}

Fixed version (ground truth):
/** 
 * Do a kind of dataflow analysis where we try to identify which futures are closed at different points in the program. This allows us to switch to lower-overhead versions of many operations.
 * @param logger
 * @param program
 * @throws InvalidOptionException
 * @throws InvalidWriteException
 */
public void optimize(Logger logger,Program program) throws InvalidOptionException, InvalidWriteException {
}
Program: 132964
Project: 132964
Buggy source:
@Override public Block tryInline(Set<Var> closedVars,Set<Var> recClosedVars,boolean keepExplicitDependencies){
  boolean varsLeft=false;
  ListIterator<WaitVar> it=waitVars.listIterator();
  while (it.hasNext()) {
    WaitVar wv=it.next();
    if (keepExplicitDependencies && wv.explicit) {
      varsLeft=true;
    }
 else     if ((closedVars.contains(wv) && !recursionRequired(wv.var)) || recClosedVars.contains(wv)) {
      it.remove();
    }
 else {
      varsLeft=true;
    }
  }
  if (varsLeft || mode == WaitMode.TASK_DISPATCH) {
    return null;
  }
 else {
    return block;
  }
}

Fixed version (ground truth):
@Override public Block tryInline(Set<Var> closedVars,Set<Var> recClosedVars,boolean keepExplicitDependencies){
  boolean varsLeft=false;
  ListIterator<WaitVar> it=waitVars.listIterator();
  while (it.hasNext()) {
    WaitVar wv=it.next();
    if (keepExplicitDependencies && wv.explicit) {
      varsLeft=true;
    }
 else     if ((closedVars.contains(wv.var) && !recursionRequired(wv.var)) || recClosedVars.contains(wv.var)) {
      it.remove();
    }
 else {
      varsLeft=true;
    }
  }
  if (varsLeft || mode == WaitMode.TASK_DISPATCH) {
    return null;
  }
 else {
    return block;
  }
}
Program: 132965
Project: 132965
Buggy source:
@Override public boolean equals(Object other){
  if (!(other instanceof WaitVar))   return false;
  WaitVar owv=(WaitVar)other;
  return owv.explicit == explicit && owv.var.equals(this.var);
}

Fixed version (ground truth):
@Override public boolean equals(Object other){
  if (!(other instanceof WaitVar))   throw new STCRuntimeError("String_Node_Str" + other + "String_Node_Str"+ other.getClass());
  WaitVar owv=(WaitVar)other;
  return owv.explicit == explicit && owv.var.equals(this.var);
}
Program: 132966
Project: 132966
Buggy source:
/** 
 * If we have something of the below form, can just block  on a as far of function call protocol (..) f (a, b, c) { wait (a) { } }
 * @param logger
 * @param program
 * @param f
 */
private static void liftWait(Logger logger,Program program,Function f){
  if (!f.isAsync()) {
    return;
  }
  Block main=f.mainBlock();
  List<WaitVar> blockingVariables=findBlockingVariables(main);
  if (blockingVariables != null) {
    List<Var> locals=f.getInputList();
    if (logger.isTraceEnabled()) {
      logger.trace("String_Node_Str" + f.getName() + "String_Node_Str"+ blockingVariables);
    }
    for (    WaitVar wv : blockingVariables) {
      boolean isConst=program.lookupGlobalConst(wv.var.name()) != null;
      if (!isConst && locals.contains(wv)) {
        f.addBlockingInput(wv);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * If we have something of the below form, can just block  on a as far of function call protocol (..) f (a, b, c) { wait (a) { } }
 * @param logger
 * @param program
 * @param f
 */
private static void liftWait(Logger logger,Program program,Function f){
  if (!f.isAsync()) {
    return;
  }
  Block main=f.mainBlock();
  List<WaitVar> blockingVariables=findBlockingVariables(main);
  if (blockingVariables != null) {
    List<Var> locals=f.getInputList();
    if (logger.isTraceEnabled()) {
      logger.trace("String_Node_Str" + f.getName() + "String_Node_Str"+ blockingVariables);
    }
    for (    WaitVar wv : blockingVariables) {
      boolean isConst=program.lookupGlobalConst(wv.var.name()) != null;
      if (!isConst && locals.contains(wv.var)) {
        f.addBlockingInput(wv);
      }
    }
  }
}
Program: 132967
Project: 132967
Buggy source:
public boolean varNameUsed(String name){
  Deque<Block> blocks=new ArrayDeque<Block>();
  blocks.add(this.mainBlock);
  while (!blocks.isEmpty()) {
    Block curr=blocks.pop();
    for (    Var v : curr.variables) {
      if (v.name().equals(name))       return true;
    }
    for (    Continuation c : curr.getContinuations()) {
      for (      Var cv : c.constructDefinedVars())       if (cv.name().equals(name))       return true;
      for (      Block inner : c.getBlocks()) {
        blocks.push(inner);
      }
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean varNameUsed(String name){
  if (Var.findByName(iList,name) != null || Var.findByName(oList,name) != null) {
    return true;
  }
  Deque<Block> blocks=new ArrayDeque<Block>();
  blocks.add(this.mainBlock);
  while (!blocks.isEmpty()) {
    Block curr=blocks.pop();
    if (Var.findByName(curr.variables,name) != null) {
      return true;
    }
    for (    Continuation c : curr.getContinuations()) {
      if (Var.findByName(c.constructDefinedVars(),name) != null) {
        return true;
      }
      for (      Block inner : c.getBlocks()) {
        blocks.push(inner);
      }
    }
  }
  return false;
}
Program: 132968
Project: 132968
Buggy source:
private void startForeachSplit(String procName,Var arrayVar,String contentsVar,int splitDegree,int leafDegree,boolean haveKeys,List<PassedVar> usedVars,List<RefCount> perIterIncrs,MultiMap<Var,RefCount> constIncrs){
  pointStack.peek().add(Turbine.containerSize(TCLTMP_CONTAINER_SIZE,varToExpr(arrayVar)));
  Value containerSize=new Value(TCLTMP_CONTAINER_SIZE);
  Expression lastIndex=Square.arithExpr(containerSize,new Token("String_Node_Str"),new LiteralInt(1));
  handleForeachContainerRefcounts(perIterIncrs,constIncrs,containerSize);
  ArrayList<PassedVar> splitUsedVars=new ArrayList<PassedVar>(usedVars);
  splitUsedVars.add(new PassedVar(arrayVar,false));
  startRangeSplit(procName,splitUsedVars,perIterIncrs,splitDegree,leafDegree,LiteralInt.ZERO,lastIndex,LiteralInt.ONE);
  pointStack.peek().add(new SetVariable(TCLTMP_SPLITLEN,Square.arithExpr(new Token(String.format("String_Node_Str",TCLTMP_RANGE_HI,TCLTMP_RANGE_LO)))));
  pointStack.peek().add(Turbine.containerContents(contentsVar,varToExpr(arrayVar),haveKeys,new Value(TCLTMP_SPLITLEN),TCLTMP_RANGE_LO_V));
}

Fixed version (ground truth):
private void startForeachSplit(String procName,Var arrayVar,String contentsVar,int splitDegree,int leafDegree,boolean haveKeys,List<PassedVar> usedVars,List<RefCount> perIterIncrs,MultiMap<Var,RefCount> constIncrs){
  pointStack.peek().add(Turbine.containerSize(TCLTMP_CONTAINER_SIZE,varToExpr(arrayVar)));
  Value containerSize=new Value(TCLTMP_CONTAINER_SIZE);
  Expression lastIndex=Square.arithExpr(containerSize,new Token("String_Node_Str"),new LiteralInt(1));
  handleForeachContainerRefcounts(perIterIncrs,constIncrs,containerSize);
  ArrayList<PassedVar> splitUsedVars=new ArrayList<PassedVar>(usedVars);
  if (!PassedVar.contains(splitUsedVars,arrayVar)) {
    splitUsedVars.add(new PassedVar(arrayVar,false));
  }
  startRangeSplit(procName,splitUsedVars,perIterIncrs,splitDegree,leafDegree,LiteralInt.ZERO,lastIndex,LiteralInt.ONE);
  pointStack.peek().add(new SetVariable(TCLTMP_SPLITLEN,Square.arithExpr(new Token(String.format("String_Node_Str",TCLTMP_RANGE_HI,TCLTMP_RANGE_LO)))));
  pointStack.peek().add(Turbine.containerContents(contentsVar,varToExpr(arrayVar),haveKeys,new Value(TCLTMP_SPLITLEN),TCLTMP_RANGE_LO_V));
}
Program: 132969
Project: 132969
Buggy source:
private void decrementReaders(List<Var> vars,Expression incr){
  incrementReaders(vars,incr);
}

Fixed version (ground truth):
private void decrementReaders(List<Var> vars,Expression decr){
  pointStack.peek().append(buildIncReaders(vars,decr,true));
}
Program: 132970
Project: 132970
Buggy source:
public static SetVariable integerDecrGet(String target,Value src,Expression decr){
  return new SetVariable(target,new Square(RETRIEVE_INTEGER,src,decr));
}

Fixed version (ground truth):
public static SetVariable integerDecrGet(String target,Value src,Expression decr){
  return new SetVariable(target,new Square(RETRIEVE_INTEGER,src,CACHED,decr));
}
Program: 132971
Project: 132971
Buggy source:
public static SetVariable floatDecrGet(String target,Value src,Expression decr){
  return new SetVariable(target,new Square(RETRIEVE_FLOAT,src,decr));
}

Fixed version (ground truth):
public static SetVariable floatDecrGet(String target,Value src,Expression decr){
  return new SetVariable(target,new Square(RETRIEVE_FLOAT,src,CACHED,decr));
}
Program: 132972
Project: 132972
Buggy source:
public static SetVariable stringDecrGet(String target,Value src,Expression decr){
  return new SetVariable(target,new Square(RETRIEVE_STRING,src,decr));
}

Fixed version (ground truth):
public static SetVariable stringDecrGet(String target,Value src,Expression decr){
  return new SetVariable(target,new Square(RETRIEVE_STRING,src,CACHED,decr));
}
Program: 132973
Project: 132973
Buggy source:
/** 
 * @param logger
 * @param fn
 * @param block
 * @param readIncrements pre-existing decrements
 * @param writeIncrements -existing decrements
 * @param parentAssignedAliasVars assign alias vars from parent blocks that we can immediately manipulate refcount of
 */
private void fixBlockRefCounting(Logger logger,Function fn,Block block,Counters<Var> readIncrements,Counters<Var> writeIncrements,Set<Var> parentAssignedAliasVars){
  boolean cancelEnabled=cancelEnabled();
  ListIterator<Instruction> instIt=block.instructionIterator();
  while (instIt.hasNext()) {
    Instruction inst=instIt.next();
    updateInstructionRefCount(inst,readIncrements,writeIncrements);
    if (!cancelEnabled) {
      dumpIncrements(instIt,readIncrements,writeIncrements);
    }
  }
  for (  Continuation cont : block.getContinuations()) {
    addIncrementsForCont(cont,readIncrements,writeIncrements);
    if (!cancelEnabled) {
      dumpIncrements(instIt,readIncrements,writeIncrements);
    }
  }
  updateDecrementCounts(block,fn,readIncrements,writeIncrements);
  dumpDecrements(block,readIncrements,writeIncrements);
  if (cancelEnabled()) {
    updateBlockRefcounting(logger,fn,block,readIncrements,writeIncrements,parentAssignedAliasVars);
  }
}

Fixed version (ground truth):
/** 
 * @param logger
 * @param fn
 * @param block
 * @param readIncrements pre-existing decrements
 * @param writeIncrements -existing decrements
 * @param parentAssignedAliasVars assign alias vars from parent blocks that we can immediately manipulate refcount of
 */
private void fixBlockRefCounting(Logger logger,Function fn,Block block,Counters<Var> readIncrements,Counters<Var> writeIncrements,Set<Var> parentAssignedAliasVars){
  boolean cancelEnabled=cancelEnabled();
  ListIterator<Instruction> instIt=block.instructionIterator();
  while (instIt.hasNext()) {
    Instruction inst=instIt.next();
    updateInstructionRefCount(inst,readIncrements,writeIncrements);
    if (!cancelEnabled) {
      dumpIncrements(instIt,readIncrements,writeIncrements);
    }
  }
  for (  Continuation cont : block.getContinuations()) {
    addIncrementsForCont(cont,readIncrements,writeIncrements);
    if (!cancelEnabled) {
      dumpIncrements(instIt,readIncrements,writeIncrements);
    }
  }
  updateDecrementCounts(block,fn,readIncrements,writeIncrements);
  if (!cancelEnabled()) {
    dumpDecrements(block,readIncrements,writeIncrements);
  }
  if (cancelEnabled()) {
    updateBlockRefcounting(logger,fn,block,readIncrements,writeIncrements,parentAssignedAliasVars);
  }
}
Program: 132974
Project: 132974
Buggy source:
private void dumpDecrements(Block block,Counters<Var> readIncrements,Counters<Var> writeIncrements){
  for (  Entry<Var,Long> e : readIncrements.entries()) {
    Var var=e.getKey();
    Arg amount=Arg.createIntLit(e.getValue() * -1);
    block.addCleanup(var,TurbineOp.decrRef(var,amount));
  }
  for (  Entry<Var,Long> e : writeIncrements.entries()) {
    Var var=e.getKey();
    Arg amount=Arg.createIntLit(e.getValue() * -1);
    block.addCleanup(var,TurbineOp.decrWriters(var,amount));
  }
}

Fixed version (ground truth):
private void dumpDecrements(Block block,Counters<Var> readIncrements,Counters<Var> writeIncrements){
  for (  Entry<Var,Long> e : readIncrements.entries()) {
    Var var=e.getKey();
    Arg amount=Arg.createIntLit(e.getValue() * -1);
    block.addCleanup(var,TurbineOp.decrRef(var,amount));
  }
  for (  Entry<Var,Long> e : writeIncrements.entries()) {
    Var var=e.getKey();
    Arg amount=Arg.createIntLit(e.getValue() * -1);
    block.addCleanup(var,TurbineOp.decrWriters(var,amount));
  }
  readIncrements.resetAll();
  writeIncrements.resetAll();
}
Program: 132976
Project: 132976
Buggy source:
private void checkUniqueVarNames(Logger logger,Program program,Function fn,Block block,Map<String,Var> declared){
  for (  Var v : block.getVariables()) {
    checkVarUnique(logger,fn,declared,v);
    if (v.isMapped()) {
      assert(declared.containsKey(v.mapping().name()));
    }
  }
  checkVarReferences(logger,block,declared);
  if (checkCleanups)   checkCleanups(fn,block);
  for (  Continuation c : block.getContinuations()) {
    for (    Var v : c.constructDefinedVars(true)) {
      checkVarUnique(logger,fn,declared,v);
    }
    for (    Block inner : c.getBlocks()) {
      checkUniqueVarNames(logger,program,fn,inner,declared);
    }
  }
}

Fixed version (ground truth):
private void checkUniqueVarNames(Logger logger,Program program,Function fn,Block block,Map<String,Var> declared){
  for (  Var v : block.getVariables()) {
    checkVarUnique(logger,fn,declared,v);
    if (v.isMapped()) {
      assert(declared.containsKey(v.mapping().name()));
    }
  }
  checkVarReferences(logger,block,declared);
  if (checkCleanups)   checkCleanups(fn,block);
  for (  Continuation c : block.getContinuations()) {
    for (    Var v : c.constructDefinedVars(ContVarDefType.NEW_DEF)) {
      checkVarUnique(logger,fn,declared,v);
    }
    for (    Block inner : c.getBlocks()) {
      checkUniqueVarNames(logger,program,fn,inner,declared);
    }
  }
}
Program: 132977
Project: 132977
Buggy source:
@Override public List<Var> constructDefinedVars(boolean includeRedefs){
  if (loopCounterVar != null) {
    return Arrays.asList(loopVar,loopCounterVar);
  }
 else {
    return Arrays.asList(loopVar);
  }
}

Fixed version (ground truth):
@Override public List<Var> constructDefinedVars(ContVarDefType type){
  if (type.includesNewDefs()) {
    if (loopCounterVar != null) {
      return Arrays.asList(loopVar,loopCounterVar);
    }
 else {
      return Arrays.asList(loopVar);
    }
  }
 else {
    return Collections.emptyList();
  }
}
Program: 132978
Project: 132978
Buggy source:
@Override public void removeRedef(Var oldV,Var newV){
  for (int i=0; i < loopVars.size(); i++) {
    Var loopVar=loopVars.get(i);
    if (loopVar.equals(oldV)) {
      assert(!this.definedHere.get(i));
      this.loopVars.set(i,newV);
      this.definedHere.set(i,true);
    }
  }
}

Fixed version (ground truth):
@Override public void removeRedef(Var oldV,Var newV){
}
Program: 132979
Project: 132979
Buggy source:
@Override public List<Var> constructDefinedVars(boolean includeRedefs){
  ArrayList<Var> defVars=new ArrayList<Var>();
  for (int i=0; i < this.loopVars.size(); i++) {
    if (includeRedefs || this.definedHere.get(i)) {
      defVars.add(this.loopVars.get(i));
    }
  }
  return defVars;
}

Fixed version (ground truth):
@Override public List<Var> constructDefinedVars(ContVarDefType type){
  ArrayList<Var> defVars=new ArrayList<Var>();
  for (int i=0; i < this.loopVars.size(); i++) {
    Boolean defHere=this.definedHere.get(i);
    Var loopVar=this.loopVars.get(i);
    if (type.includesNewDefs() && defHere) {
      defVars.add(loopVar);
    }
 else     if (type.includesRedefs() && !defHere) {
      defVars.add(loopVar);
    }
  }
  return defVars;
}
Program: 132981
Project: 132981
Buggy source:
private void updateInstructionRefCount(Instruction inst,Counters<Var> readIncrements,Counters<Var> writeIncrements){
  Pair<List<Var>,List<Var>> refIncrs=inst.getIncrVars(functionMap);
  List<Var> readIncrVars=refIncrs.val1;
  List<Var> writeIncrVars=refIncrs.val2;
  for (  Var v : readIncrVars) {
    if (RefCounting.hasReadRefCount(v)) {
      readIncrements.increment(v);
    }
  }
  for (  Var v : writeIncrVars) {
    if (RefCounting.hasWriteRefCount(v)) {
      writeIncrements.increment(v);
    }
  }
  if (inst.op == Opcode.LOOP_BREAK) {
    LoopBreak loopBreak=(LoopBreak)inst;
    for (    Var ko : loopBreak.getKeepOpenVars()) {
      assert(RefCounting.hasWriteRefCount(ko));
      writeIncrements.decrement(ko);
    }
    for (    PassedVar pass : loopBreak.getLoopUsedVars()) {
      if (!pass.writeOnly && RefCounting.hasReadRefCount(pass.var)) {
        readIncrements.decrement(pass.var);
      }
    }
  }
}

Fixed version (ground truth):
private void updateInstructionRefCount(Instruction inst,Counters<Var> readIncrements,Counters<Var> writeIncrements){
  Pair<List<Var>,List<Var>> refIncrs=inst.getIncrVars(functionMap);
  List<Var> readIncrVars=refIncrs.val1;
  List<Var> writeIncrVars=refIncrs.val2;
  for (  Var v : readIncrVars) {
    if (RefCounting.hasReadRefCount(v)) {
      readIncrements.increment(v);
    }
  }
  for (  Var v : writeIncrVars) {
    if (RefCounting.hasWriteRefCount(v)) {
      writeIncrements.increment(v);
    }
  }
  if (inst.op == Opcode.COPY_REF) {
    Var newAlias=inst.getOutput(0);
    if (RefCounting.hasReadRefCount(newAlias)) {
      readIncrements.decrement(newAlias);
    }
    if (RefCounting.hasWriteRefCount(newAlias)) {
      writeIncrements.decrement(newAlias);
    }
  }
  if (inst.op == Opcode.LOOP_BREAK) {
    LoopBreak loopBreak=(LoopBreak)inst;
    for (    Var ko : loopBreak.getKeepOpenVars()) {
      assert(RefCounting.hasWriteRefCount(ko));
      writeIncrements.decrement(ko);
    }
    for (    PassedVar pass : loopBreak.getLoopUsedVars()) {
      if (!pass.writeOnly && RefCounting.hasReadRefCount(pass.var)) {
        readIncrements.decrement(pass.var);
      }
    }
  }
}
Program: 132982
Project: 132982
Buggy source:
public Pair<Var,Var> getComponentAlias(){
switch (op) {
case ARRAY_CREATE_NESTED_IMM:
case ARRAY_CREATE_NESTED_FUTURE:
    return Pair.create(getOutput(0),getOutput(1));
case ARRAYREF_CREATE_NESTED_IMM:
case ARRAYREF_CREATE_NESTED_FUTURE:
  return Pair.create(getOutput(0),getOutput(2));
case LOAD_REF:
return Pair.create(getOutput(0),getInput(0).getVar());
case ADDRESS_OF:
return Pair.create(getOutput(0),getInput(0).getVar());
case STRUCT_LOOKUP:
case STRUCTREF_LOOKUP:
return Pair.create(getOutput(0),getInput(0).getVar());
default :
return null;
}
}

Fixed version (ground truth):
public Pair<Var,Var> getComponentAlias(){
switch (op) {
case ARRAY_CREATE_NESTED_IMM:
case ARRAY_CREATE_NESTED_FUTURE:
    return Pair.create(getOutput(0),getOutput(1));
case ARRAYREF_CREATE_NESTED_IMM:
case ARRAYREF_CREATE_NESTED_FUTURE:
  return Pair.create(getOutput(0),getOutput(2));
case LOAD_REF:
return Pair.create(getOutput(0),getInput(0).getVar());
case COPY_REF:
return Pair.create(getOutput(0),getInput(0).getVar());
case ADDRESS_OF:
return Pair.create(getOutput(0),getInput(0).getVar());
case STRUCT_LOOKUP:
case STRUCTREF_LOOKUP:
return Pair.create(getOutput(0),getInput(0).getVar());
default :
return null;
}
}
Program: 132983
Project: 132983
Buggy source:
private void checkUniqueVarNames(Logger logger,Program program,Function fn,Block block,Map<String,Var> declared){
  for (  Var v : block.getVariables()) {
    checkVarUnique(logger,fn,declared,v);
    if (v.isMapped()) {
      assert(declared.containsKey(v.mapping().name()));
    }
  }
  checkVarReferences(logger,block,declared);
  if (checkCleanups)   checkCleanups(fn,block);
  for (  Continuation c : block.getContinuations()) {
    for (    Var v : c.constructDefinedVars()) {
      checkVarUnique(logger,fn,declared,v);
    }
    for (    Block inner : c.getBlocks()) {
      checkUniqueVarNames(logger,program,fn,inner,declared);
    }
  }
}

Fixed version (ground truth):
private void checkUniqueVarNames(Logger logger,Program program,Function fn,Block block,Map<String,Var> declared){
  for (  Var v : block.getVariables()) {
    checkVarUnique(logger,fn,declared,v);
    if (v.isMapped()) {
      assert(declared.containsKey(v.mapping().name()));
    }
  }
  checkVarReferences(logger,block,declared);
  if (checkCleanups)   checkCleanups(fn,block);
  for (  Continuation c : block.getContinuations()) {
    for (    Var v : c.constructDefinedVars(true)) {
      checkVarUnique(logger,fn,declared,v);
    }
    for (    Block inner : c.getBlocks()) {
      checkUniqueVarNames(logger,program,fn,inner,declared);
    }
  }
}
Program: 132984
Project: 132984
Buggy source:
@Override public List<Var> constructDefinedVars(){
  if (loopCounterVar != null) {
    return Arrays.asList(loopVar,loopCounterVar);
  }
 else {
    return Arrays.asList(loopVar);
  }
}

Fixed version (ground truth):
@Override public List<Var> constructDefinedVars(boolean includeRedefs){
  if (loopCounterVar != null) {
    return Arrays.asList(loopVar,loopCounterVar);
  }
 else {
    return Arrays.asList(loopVar);
  }
}
Program: 132985
Project: 132985
Buggy source:
@Override public List<Var> constructDefinedVars(){
  return Var.NONE;
}

Fixed version (ground truth):
@Override public List<Var> constructDefinedVars(boolean includeRedefs){
  ArrayList<Var> defVars=new ArrayList<Var>();
  for (int i=0; i < this.loopVars.size(); i++) {
    if (includeRedefs || this.definedHere.get(i)) {
      defVars.add(this.loopVars.get(i));
    }
  }
  return defVars;
}
Program: 132986
Project: 132986
Buggy source:
/** 
 * Find the set of variables required to be closed (recursively or not) to make progress in block.   If function inlining is enabled, exclude explicit waits since blocking inputs to a function are treated as data_only upon inlining and this can cause problems if they were previously explicit waits.
 * @param block
 * @return
 */
private static Set<Var> findBlockingVariables(Block block){
  HashSet<Var> blockingVariables=null;
  for (  Instruction inst : block.getInstructions()) {
    if (!ProgressOpcodes.isNonProgressOpcode(inst.op)) {
      return null;
    }
  }
  for (  Continuation c : block.getContinuations()) {
    List<BlockingVar> waitOnVars=c.blockingVars();
    List<Var> waitOn;
    if (waitOnVars == null) {
      waitOn=Var.NONE;
    }
 else {
      waitOn=new ArrayList<Var>(waitOnVars.size());
      for (      BlockingVar bv : waitOnVars) {
        waitOn.add(bv.var);
      }
    }
    assert(waitOn != null);
    if (blockingVariables == null) {
      blockingVariables=new HashSet<Var>(waitOn);
    }
 else {
      blockingVariables.retainAll(waitOn);
    }
    try {
      if (Settings.getBoolean(Settings.OPT_FUNCTION_INLINE)) {
        if (c.getType() == ContinuationType.WAIT_STATEMENT && ((WaitStatement)c).getMode() == WaitMode.EXPLICIT) {
          blockingVariables.removeAll(waitOn);
        }
      }
    }
 catch (    InvalidOptionException e) {
      throw new STCRuntimeError(e.getMessage());
    }
  }
  return blockingVariables;
}

Fixed version (ground truth):
/** 
 * Find the set of variables required to be closed (recursively or not) to make progress in block.   If function inlining is enabled, exclude explicit waits since blocking inputs to a function are treated as data_only upon inlining and this can cause problems if they were previously explicit waits.
 * @param block
 * @return
 */
private static Set<Var> findBlockingVariables(Block block){
  HashSet<Var> blockingVariables=null;
  for (  Instruction inst : block.getInstructions()) {
    if (!ProgressOpcodes.isNonProgressOpcode(inst.op)) {
      return null;
    }
  }
  for (  Continuation c : block.getContinuations()) {
    List<BlockingVar> waitOnVars=c.blockingVars(false);
    List<Var> waitOn;
    if (waitOnVars == null) {
      waitOn=Var.NONE;
    }
 else {
      waitOn=new ArrayList<Var>(waitOnVars.size());
      for (      BlockingVar bv : waitOnVars) {
        waitOn.add(bv.var);
      }
    }
    assert(waitOn != null);
    if (blockingVariables == null) {
      blockingVariables=new HashSet<Var>(waitOn);
    }
 else {
      blockingVariables.retainAll(waitOn);
    }
    try {
      if (Settings.getBoolean(Settings.OPT_FUNCTION_INLINE)) {
        if (c.getType() == ContinuationType.WAIT_STATEMENT && ((WaitStatement)c).getMode() == WaitMode.EXPLICIT) {
          blockingVariables.removeAll(waitOn);
        }
      }
    }
 catch (    InvalidOptionException e) {
      throw new STCRuntimeError(e.getMessage());
    }
  }
  return blockingVariables;
}
Program: 132987
Project: 132987
Buggy source:
private void addIncrementsForCont(Continuation cont,Counters<Var> readIncrements,Counters<Var> writeIncrements){
  if (cont.isAsync() && isSingleSpawnCont(cont)) {
    long incr=1;
    for (    Var keepOpen : cont.getKeepOpenVars()) {
      if (RefCounting.hasWriteRefCount(keepOpen)) {
        writeIncrements.add(keepOpen,incr);
      }
    }
    Set<Var> readIncrTmp=new HashSet<Var>();
    for (    PassedVar passedIn : cont.getPassedVars()) {
      if (!passedIn.writeOnly && RefCounting.hasReadRefCount(passedIn.var)) {
        readIncrTmp.add(passedIn.var);
      }
    }
    for (    BlockingVar blockingVar : cont.blockingVars()) {
      if (RefCounting.hasReadRefCount(blockingVar.var)) {
        readIncrTmp.add(blockingVar.var);
      }
    }
    for (    Var v : readIncrTmp) {
      readIncrements.add(v,incr);
    }
  }
}

Fixed version (ground truth):
private void addIncrementsForCont(Continuation cont,Counters<Var> readIncrements,Counters<Var> writeIncrements){
  if (cont.isAsync() && isSingleSpawnCont(cont)) {
    long incr=1;
    for (    Var keepOpen : cont.getKeepOpenVars()) {
      if (RefCounting.hasWriteRefCount(keepOpen)) {
        writeIncrements.add(keepOpen,incr);
      }
    }
    Set<Var> readIncrTmp=new HashSet<Var>();
    for (    PassedVar passedIn : cont.getPassedVars()) {
      if (!passedIn.writeOnly && RefCounting.hasReadRefCount(passedIn.var)) {
        readIncrTmp.add(passedIn.var);
      }
    }
    for (    BlockingVar blockingVar : cont.blockingVars(false)) {
      if (RefCounting.hasReadRefCount(blockingVar.var)) {
        readIncrTmp.add(blockingVar.var);
      }
    }
    for (    Var v : readIncrTmp) {
      readIncrements.add(v,incr);
    }
  }
}
Program: 132988
Project: 132988
Buggy source:
/** 
 * Add decrements that have to happen for continuation inside block
 * @param cont
 * @param readIncrements
 * @param writeIncrements
 */
private void addDecrementsForCont(Continuation cont,Counters<Var> readIncrements,Counters<Var> writeIncrements){
  if ((isSingleSpawnCont(cont) || isAsyncForeachLoop(cont)) && cont.getType() != ContinuationType.LOOP) {
    long amount=1;
    for (    Var keepOpen : cont.getKeepOpenVars()) {
      if (RefCounting.hasWriteRefCount(keepOpen)) {
        writeIncrements.decrement(keepOpen,amount);
      }
    }
    Set<Var> readIncrTmp=new HashSet<Var>();
    for (    PassedVar passedIn : cont.getPassedVars()) {
      if (!passedIn.writeOnly && RefCounting.hasReadRefCount(passedIn.var)) {
        readIncrTmp.add(passedIn.var);
      }
    }
    for (    BlockingVar blockingVar : cont.blockingVars()) {
      if (RefCounting.hasReadRefCount(blockingVar.var)) {
        readIncrTmp.add(blockingVar.var);
      }
    }
    for (    Var v : readIncrTmp) {
      readIncrements.decrement(v,amount);
    }
  }
}

Fixed version (ground truth):
/** 
 * Add decrements that have to happen for continuation inside block
 * @param cont
 * @param readIncrements
 * @param writeIncrements
 */
private void addDecrementsForCont(Continuation cont,Counters<Var> readIncrements,Counters<Var> writeIncrements){
  if ((isSingleSpawnCont(cont) || isAsyncForeachLoop(cont)) && cont.getType() != ContinuationType.LOOP) {
    long amount=1;
    for (    Var keepOpen : cont.getKeepOpenVars()) {
      if (RefCounting.hasWriteRefCount(keepOpen)) {
        writeIncrements.decrement(keepOpen,amount);
      }
    }
    Set<Var> readIncrTmp=new HashSet<Var>();
    for (    PassedVar passedIn : cont.getPassedVars()) {
      if (!passedIn.writeOnly && RefCounting.hasReadRefCount(passedIn.var)) {
        readIncrTmp.add(passedIn.var);
      }
    }
    for (    BlockingVar blockingVar : cont.blockingVars(false)) {
      if (RefCounting.hasReadRefCount(blockingVar.var)) {
        readIncrTmp.add(blockingVar.var);
      }
    }
    for (    Var v : readIncrTmp) {
      readIncrements.decrement(v,amount);
    }
  }
}
Program: 132989
Project: 132989
Buggy source:
private static void findBlockingContinuations(Block block,MultiMap<Var,InstOrCont> waitMap){
  for (  Continuation c : block.getContinuations()) {
    List<BlockingVar> blockingVars=c.blockingVars();
    if (blockingVars != null) {
      for (      BlockingVar v : blockingVars) {
        waitMap.put(v.var,new InstOrCont(c));
      }
    }
  }
}

Fixed version (ground truth):
private static void findBlockingContinuations(Block block,MultiMap<Var,InstOrCont> waitMap){
  for (  Continuation c : block.getContinuations()) {
    List<BlockingVar> blockingVars=c.blockingVars(false);
    if (blockingVars != null) {
      for (      BlockingVar v : blockingVars) {
        waitMap.put(v.var,new InstOrCont(c));
      }
    }
  }
}
Program: 132990
Project: 132990
Buggy source:
@Override public List<BlockingVar> blockingVars(){
  return Collections.emptyList();
}

Fixed version (ground truth):
@Override public List<BlockingVar> blockingVars(boolean includeConstructDefined){
  return Collections.emptyList();
}
Program: 132991
Project: 132991
Buggy source:
/** 
 * Try to piggyback constant incrs/decrs from outside continuation. Reset counters in increments for any that are changed
 * @param increments
 * @param type
 * @param if true, try to piggyback decrements, if false, increments
 */
public void tryPiggyBack(Counters<Var> increments,RefCountType type,boolean decrement){
  for (  RefCount startIncr : startIncrements) {
    if (startIncr.type == type) {
      long incr=increments.getCount(startIncr.var);
      if ((decrement && incr < 0) || (!decrement && incr > 0)) {
        addConstantStartIncrement(startIncr.var,type,Arg.createIntLit(incr));
        increments.add(startIncr.var,-1 * incr);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Try to piggyback constant incrs/decrs from outside continuation. Reset counters in increments for any that are changed
 * @param increments
 * @param type
 * @param decrement if true, try to piggyback decrements, if false, increments
 */
public void tryPiggyBack(Counters<Var> increments,RefCountType type,boolean decrement){
  for (  RefCount startIncr : startIncrements) {
    if (startIncr.type == type) {
      long incr=increments.getCount(startIncr.var);
      if ((decrement && incr < 0) || (!decrement && incr > 0)) {
        addConstantStartIncrement(startIncr.var,type,Arg.createIntLit(incr));
        increments.add(startIncr.var,-1 * incr);
      }
    }
  }
}
Program: 132992
Project: 132992
Buggy source:
@Override public List<BlockingVar> blockingVars(){
  ArrayList<BlockingVar> res=new ArrayList<BlockingVar>(waitVars.size());
  for (  Var wv : waitVars) {
    res.add(new BlockingVar(wv,this.recursive));
  }
  return res;
}

Fixed version (ground truth):
@Override public List<BlockingVar> blockingVars(boolean includeConstructDefined){
  ArrayList<BlockingVar> res=new ArrayList<BlockingVar>(waitVars.size());
  for (  Var wv : waitVars) {
    res.add(new BlockingVar(wv,this.recursive));
  }
  return res;
}
Program: 132993
Project: 132993
Buggy source:
/** 
 * Rename variables in block (and nested blocks) according to map. If the map doesn't have an entry, we don't rename anything
 * @param renames OldName -> NewName
 * @param inputsOnly  if true, only change references which are readingthe var.  if false, completely remove the old variable and replace  with new
 * @param recursive if it should be done on child blocks
 */
public void renameVars(Map<Var,Arg> renames,RenameMode mode,boolean recursive){
  if (renames.isEmpty())   return;
  renameInDefs(renames,mode);
  renameInCode(renames,mode,recursive);
}

Fixed version (ground truth):
/** 
 * Rename variables in block (and nested blocks) according to map. If the map doesn't have an entry, we don't rename anything
 * @param renames OldName -> NewName
 * @param mode
 * @param recursive if it should be done on child blocks
 */
public void renameVars(Map<Var,Arg> renames,RenameMode mode,boolean recursive){
  if (renames.isEmpty())   return;
  renameInDefs(renames,mode);
  renameInCode(renames,mode,recursive);
}
Program: 132994
Project: 132994
Buggy source:
/** 
 * @param logger
 * @param f
 * @return true if changes made
 */
private static boolean eliminateIter(Logger logger,Function f){
  HashSet<Var> removeCandidates=new HashSet<Var>();
  HashSet<Var> needed=new HashSet<Var>();
  MultiMap<Var,Var> dependencyGraph=new MultiMap<Var,Var>();
  walkFunction(logger,f,removeCandidates,needed,dependencyGraph);
  if (logger.isTraceEnabled()) {
    logger.trace("String_Node_Str" + f.getName() + "String_Node_Str"+ "String_Node_Str"+ removeCandidates+ "String_Node_Str"+ "String_Node_Str"+ needed+ "String_Node_Str"+ "String_Node_Str"+ printDepGraph(dependencyGraph));
  }
  ArrayDeque<Var> workStack=new ArrayDeque<Var>();
  workStack.addAll(needed);
  while (!workStack.isEmpty()) {
    Var neededVar=workStack.pop();
    List<Var> deps=dependencyGraph.remove(neededVar);
    if (deps != null) {
      needed.addAll(deps);
      workStack.addAll(deps);
    }
  }
  removeCandidates.removeAll(needed);
  if (logger.isTraceEnabled()) {
    logger.trace("String_Node_Str" + removeCandidates);
  }
  if (removeCandidates.isEmpty()) {
    return false;
  }
 else {
    f.getMainblock().removeVars(removeCandidates);
    return true;
  }
}

Fixed version (ground truth):
/** 
 * @param logger
 * @param f
 * @return true if changes made
 */
private static boolean eliminateIter(Logger logger,Function f){
  HashSet<Var> removeCandidates=new HashSet<Var>();
  HashSet<Var> needed=new HashSet<Var>();
  MultiMap<Var,Var> dependencyGraph=new MultiMap<Var,Var>();
  walkFunction(logger,f,removeCandidates,needed,dependencyGraph);
  if (logger.isTraceEnabled()) {
    logger.trace("String_Node_Str" + f.getName() + "String_Node_Str"+ "String_Node_Str"+ removeCandidates+ "String_Node_Str"+ "String_Node_Str"+ needed+ "String_Node_Str"+ "String_Node_Str"+ printDepGraph(dependencyGraph));
  }
  ArrayDeque<Var> workStack=new ArrayDeque<Var>();
  workStack.addAll(needed);
  while (!workStack.isEmpty()) {
    Var neededVar=workStack.pop();
    List<Var> deps=dependencyGraph.remove(neededVar);
    if (deps != null) {
      needed.addAll(deps);
      workStack.addAll(deps);
    }
  }
  removeCandidates.removeAll(needed);
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str" + removeCandidates);
  }
  if (removeCandidates.isEmpty()) {
    return false;
  }
 else {
    f.getMainblock().removeVars(removeCandidates);
    return true;
  }
}
Program: 132995
Project: 132995
Buggy source:
/** 
 * @param logger
 * @param f
 * @return true if changes made
 */
private static boolean eliminateIter(Logger logger,Function f){
  HashSet<Var> removeCandidates=new HashSet<Var>();
  HashSet<Var> needed=new HashSet<Var>();
  MultiMap<Var,Var> dependencyGraph=new MultiMap<Var,Var>();
  Map<Var,Var> componentOf=new HashMap<Var,Var>();
  walkFunction(logger,f,removeCandidates,needed,dependencyGraph,componentOf);
  if (logger.isTraceEnabled()) {
    logger.trace("String_Node_Str" + f.getName() + "String_Node_Str"+ "String_Node_Str"+ removeCandidates+ "String_Node_Str"+ "String_Node_Str"+ needed+ "String_Node_Str"+ "String_Node_Str"+ printDepGraph(dependencyGraph,4)+ "String_Node_Str"+ ICUtil.prettyPrintMap(componentOf,4));
  }
  ArrayDeque<Var> workStack=new ArrayDeque<Var>();
  workStack.addAll(needed);
  while (!workStack.isEmpty()) {
    Var neededVar=workStack.pop();
    List<Var> deps=dependencyGraph.remove(neededVar);
    if (deps != null) {
      needed.addAll(deps);
      workStack.addAll(deps);
    }
  }
  removeCandidates.removeAll(needed);
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str" + removeCandidates);
  }
  if (removeCandidates.isEmpty()) {
    return false;
  }
 else {
    f.getMainblock().removeVars(removeCandidates);
    return true;
  }
}

Fixed version (ground truth):
/** 
 * @param logger
 * @param f
 * @return true if changes made
 */
private static boolean eliminateIter(Logger logger,Function f){
  HashSet<Var> removeCandidates=new HashSet<Var>();
  HashSet<Var> needed=new HashSet<Var>();
  List<Var> modified=new ArrayList<Var>();
  MultiMap<Var,Var> dependencyGraph=new MultiMap<Var,Var>();
  Map<Var,Var> componentOf=new HashMap<Var,Var>();
  walkFunction(logger,f,removeCandidates,needed,dependencyGraph,modified,componentOf);
  if (logger.isTraceEnabled()) {
    logger.trace("String_Node_Str" + f.getName() + "String_Node_Str"+ "String_Node_Str"+ removeCandidates+ "String_Node_Str"+ "String_Node_Str"+ needed+ "String_Node_Str"+ "String_Node_Str"+ printDepGraph(dependencyGraph,4)+ "String_Node_Str"+ ICUtil.prettyPrintMap(componentOf,4));
  }
  for (  Var written : modified) {
    Var whole=componentOf.get(written);
    while (whole != null) {
      if (logger.isTraceEnabled())       logger.trace("String_Node_Str" + whole + "String_Node_Str"+ written);
      dependencyGraph.put(whole,written);
      whole=componentOf.get(whole);
    }
  }
  ArrayDeque<Var> workStack=new ArrayDeque<Var>();
  workStack.addAll(needed);
  while (!workStack.isEmpty()) {
    Var neededVar=workStack.pop();
    List<Var> deps=dependencyGraph.remove(neededVar);
    if (deps != null) {
      needed.addAll(deps);
      workStack.addAll(deps);
    }
  }
  removeCandidates.removeAll(needed);
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str" + removeCandidates);
  }
  if (removeCandidates.isEmpty()) {
    return false;
  }
 else {
    f.getMainblock().removeVars(removeCandidates);
    return true;
  }
}
Program: 132996
Project: 132996
Buggy source:
private static void walkInstructions(Logger logger,Block block,HashSet<Var> needed,MultiMap<Var,Var> dependencyGraph,Map<Var,Var> componentOf){
}

Fixed version (ground truth):
private static void walkInstructions(Logger logger,Block block,HashSet<Var> needed,MultiMap<Var,Var> dependencyGraph,List<Var> modified,Map<Var,Var> componentOf){
}
Program: 132997
Project: 132997
Buggy source:
private static void addOutputDep(Logger logger,Instruction inst,MultiMap<Var,Var> dependencyGraph,Map<Var,Var> componentOf,Var out,Var in){
  if (logger.isTraceEnabled())   logger.trace("String_Node_Str" + out + "String_Node_Str"+ in+ "String_Node_Str"+ inst);
  dependencyGraph.put(out,in);
  Var whole=componentOf.get(out);
  while (whole != null) {
    if (logger.isTraceEnabled())     logger.trace("String_Node_Str" + whole + "String_Node_Str"+ out+ "String_Node_Str"+ inst);
    dependencyGraph.put(whole,out);
    whole=componentOf.get(whole);
  }
}

Fixed version (ground truth):
private static void addOutputDep(Logger logger,Instruction inst,MultiMap<Var,Var> dependencyGraph,Map<Var,Var> componentOf,Var out,Var in){
  if (logger.isTraceEnabled())   logger.trace("String_Node_Str" + out + "String_Node_Str"+ in+ "String_Node_Str"+ inst);
  dependencyGraph.put(out,in);
}
Program: 132998
Project: 132998
Buggy source:
/** 
 * Collect information for dead code elimination
 * @param logger
 * @param f
 * @param removeCandidates list of vars declared in function thatcould be removed
 * @param needed
 * @param dependencyGraph
 * @param componentOf
 */
private static void walkFunction(Logger logger,Function f,HashSet<Var> removeCandidates,HashSet<Var> needed,MultiMap<Var,Var> dependencyGraph,Map<Var,Var> componentOf){
  ArrayDeque<Block> workStack=new ArrayDeque<Block>();
  workStack.push(f.getMainblock());
  needed.addAll(f.getOutputList());
  while (!workStack.isEmpty()) {
    Block block=workStack.pop();
    walkBlockVars(block,removeCandidates,dependencyGraph);
    walkInstructions(logger,block,needed,dependencyGraph,componentOf);
    ListIterator<Continuation> it=block.continuationIterator();
    while (it.hasNext()) {
      Continuation c=it.next();
      if (c.isNoop()) {
        it.remove();
      }
 else {
        needed.addAll(c.requiredVars(true));
        for (        Block inner : c.getBlocks()) {
          workStack.push(inner);
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Collect information for dead code elimination
 * @param logger
 * @param f
 * @param removeCandidates list of vars declared in function thatcould be removed
 * @param needed
 * @param dependencyGraph
 * @param modified 
 * @param componentOf
 */
private static void walkFunction(Logger logger,Function f,HashSet<Var> removeCandidates,HashSet<Var> needed,MultiMap<Var,Var> dependencyGraph,List<Var> modified,Map<Var,Var> componentOf){
  ArrayDeque<Block> workStack=new ArrayDeque<Block>();
  workStack.push(f.getMainblock());
  needed.addAll(f.getOutputList());
  while (!workStack.isEmpty()) {
    Block block=workStack.pop();
    walkBlockVars(block,removeCandidates,dependencyGraph);
    walkInstructions(logger,block,needed,dependencyGraph,modified,componentOf);
    ListIterator<Continuation> it=block.continuationIterator();
    while (it.hasNext()) {
      Continuation c=it.next();
      if (c.isNoop()) {
        it.remove();
      }
 else {
        needed.addAll(c.requiredVars(true));
        for (        Block inner : c.getBlocks()) {
          workStack.push(inner);
        }
      }
    }
  }
}
Program: 132999
Project: 132999
Buggy source:
public ForwardDataflow(boolean eliminateExplicitWaits){
  this.eliminateExplicitWaits=eliminateExplicitWaits;
}

Fixed version (ground truth):
public ForwardDataflow(boolean keepExplicitWaits){
  this.keepExplicitWaits=keepExplicitWaits;
}
Program: 133002
Project: 133002
Buggy source:
private static PushDownResult pushDownWaitsRec(Logger logger,Function fn,Block top,ExecContext topContext,Deque<Continuation> ancestors,Block curr,ExecContext currContext,MultiMap<Var,InstOrCont> waitMap){
  boolean changed=false;
  ArrayList<Continuation> pushedDown=new ArrayList<Continuation>();
  ListIterator<Instruction> it=curr.instructionIterator();
  while (it.hasNext()) {
    Instruction i=it.next();
    if (logger.isTraceEnabled()) {
      logger.trace("String_Node_Str" + i.toString());
    }
    List<Var> writtenFutures=new ArrayList<Var>();
    for (    Var outv : i.getOutputs()) {
      if (Types.isFuture(outv.type())) {
        writtenFutures.add(outv);
      }
    }
    for (    Var v : writtenFutures) {
      if (waitMap.containsKey(v)) {
        Pair<Boolean,Set<Continuation>> pdRes=relocateDependentInstructions(logger,top,topContext,ancestors,curr,currContext,it,waitMap,v);
        changed=changed || pdRes.val1;
        pushedDown.addAll(pdRes.val2);
      }
    }
  }
  for (  Continuation c : curr.getContinuations()) {
    ExecContext newContext=canPushDownInto(c,currContext);
    if (newContext != null) {
      for (      Block innerBlock : c.getBlocks()) {
        ancestors.push(c);
        PushDownResult pdRes=pushDownWaitsRec(logger,fn,top,topContext,ancestors,innerBlock,newContext,waitMap);
        pushedDown.addAll(pdRes.relocated);
        changed=changed || pdRes.anyChanges;
        ancestors.pop();
      }
    }
  }
  return new PushDownResult(changed,pushedDown);
}

Fixed version (ground truth):
private PushDownResult pushDownWaitsRec(Logger logger,Function fn,Block top,ExecContext topContext,Deque<Continuation> ancestors,Block curr,ExecContext currContext,MultiMap<Var,InstOrCont> waitMap){
  boolean changed=false;
  ArrayList<Continuation> pushedDown=new ArrayList<Continuation>();
  ListIterator<Instruction> it=curr.instructionIterator();
  while (it.hasNext()) {
    Instruction i=it.next();
    if (logger.isTraceEnabled()) {
      logger.trace("String_Node_Str" + i.toString());
    }
    List<Var> writtenFutures=new ArrayList<Var>();
    for (    Var outv : i.getOutputs()) {
      if (Types.isFuture(outv.type())) {
        writtenFutures.add(outv);
      }
    }
    for (    Var v : writtenFutures) {
      if (waitMap.containsKey(v)) {
        Pair<Boolean,Set<Continuation>> pdRes=relocateDependentInstructions(logger,top,topContext,ancestors,curr,currContext,it,waitMap,v);
        changed=changed || pdRes.val1;
        pushedDown.addAll(pdRes.val2);
      }
    }
  }
  for (  Continuation c : curr.getContinuations()) {
    ExecContext newContext=canPushDownInto(c,currContext);
    if (newContext != null) {
      for (      Block innerBlock : c.getBlocks()) {
        ancestors.push(c);
        PushDownResult pdRes=pushDownWaitsRec(logger,fn,top,topContext,ancestors,innerBlock,newContext,waitMap);
        pushedDown.addAll(pdRes.relocated);
        changed=changed || pdRes.anyChanges;
        ancestors.pop();
      }
    }
  }
  return new PushDownResult(changed,pushedDown);
}