To cut down on the code duplication let's add 

    defMark(i: Instr, bb: BasicBlock, idx: Int) = {
      debuglog("marking " + i)
      worklist += ((bb, idx))
    }