Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
merge conflicts resolved
authorMarion Guthmuller <marion.guthmuller@loria.fr>
Wed, 11 Jan 2012 15:26:44 +0000 (16:26 +0100)
committerMarion Guthmuller <marion.guthmuller@loria.fr>
Wed, 11 Jan 2012 15:26:44 +0000 (16:26 +0100)
1  2 
src/mc/mc_liveness.c
src/xbt/mmalloc/mm_legacy.c

diff --combined src/mc/mc_liveness.c
@@@ -30,139 -30,80 +30,139 @@@ int snapshot_compare(mc_snapshot_t s1, 
  
    
    if(s1->num_reg != s2->num_reg){
 -    //XBT_DEBUG("Different num_reg (s1 = %d, s2 = %d)", s1->num_reg, s2->num_reg);
 +    XBT_DEBUG("Different num_reg (s1 = %d, s2 = %d)", s1->num_reg, s2->num_reg);
      return 1;
    }
  
    int i;
 +  int errors = 0;
  
    for(i=0 ; i< s1->num_reg ; i++){
  
      if(s1->regions[i]->type != s2->regions[i]->type){
 -      //XBT_DEBUG("Different type of region");
 -      return 1;
 +      if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
 +      XBT_DEBUG("Different type of region");
 +      errors++;
 +      }else{
 +      return 1;
 +      }
      }
  
      switch(s1->regions[i]->type){
      case 0:
        if(s1->regions[i]->size != s2->regions[i]->size){
 -      //XBT_DEBUG("Different size of heap (s1 = %zu, s2 = %zu)", s1->regions[i]->size, s2->regions[i]->size);
 -      return 1;
 +      if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
 +        XBT_DEBUG("Different size of heap (s1 = %Zu, s2 = %Zu)", s1->regions[i]->size, s2->regions[i]->size);
 +        errors++;
 +      }else{
 +        return 1;
 +      }
        }
        if(s1->regions[i]->start_addr != s2->regions[i]->start_addr){
 -      //XBT_DEBUG("Different start addr of heap (s1 = %p, s2 = %p)", s1->regions[i]->start_addr, s2->regions[i]->start_addr);
 -      return 1;
 +      if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
 +        XBT_DEBUG("Different start addr of heap (s1 = %p, s2 = %p)", s1->regions[i]->start_addr, s2->regions[i]->start_addr);
 +        errors++;
 +      }else{
 +        return 1;
 +      }
        }
        if(mmalloc_compare_heap(s1->regions[i]->data, s2->regions[i]->data)){
 -      //XBT_DEBUG("Different heap (mmalloc_compare)");
 -      return 1; 
 +      if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
 +        XBT_DEBUG("Different heap (mmalloc_compare)");
 +        errors++; 
 +      }else{
 +        return 1;
 +      }
        }
        break;
      case 1 :
        if(s1->regions[i]->size != s2->regions[i]->size){
 -      //XBT_DEBUG("Different size of libsimgrid (s1 = %zu, s2 = %zu)", s1->regions[i]->size, s2->regions[i]->size);
 -      return 1;
 +      if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
 +        XBT_DEBUG("Different size of libsimgrid (s1 = %Zu, s2 = %Zu)", s1->regions[i]->size, s2->regions[i]->size);
 +        errors++;
 +      }else{
 +        return 1;
 +      }
        }
        if(s1->regions[i]->start_addr != s2->regions[i]->start_addr){
 -      //XBT_DEBUG("Different start addr of libsimgrid (s1 = %p, s2 = %p)", s1->regions[i]->start_addr, s2->regions[i]->start_addr);
 -      return 1;
 +      if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
 +        XBT_DEBUG("Different start addr of libsimgrid (s1 = %p, s2 = %p)", s1->regions[i]->start_addr, s2->regions[i]->start_addr);
 +        errors++;
 +      }else{
 +        return 1;
 +      }
        }
        if(memcmp(s1->regions[i]->data, s2->regions[i]->data, s1->regions[i]->size) != 0){
 -      //XBT_DEBUG("Different memcmp for data in libsimgrid");
 -      return 1;
 +      if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
 +        XBT_DEBUG("Different memcmp for data in libsimgrid");
 +        errors++;
 +      }else{
 +        return 1;
 +      }
        }
        break;
 -    case 2:
 +      /*case 2:
        if(s1->regions[i]->size != s2->regions[i]->size){
 -      //XBT_DEBUG("Different size of program (s1 = %zu, s2 = %zu)", s1->regions[i]->size, s2->regions[i]->size);
 -      return 1;
 -      }
 +      if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
 +        XBT_DEBUG("Different size of program (s1 = %Zu, s2 = %Zu)", s1->regions[i]->size, s2->regions[i]->size);
 +        errors++;
 +      }else{
 +        return 1;
 +      }
-       }      
++      } 
        if(s1->regions[i]->start_addr != s2->regions[i]->start_addr){
 -      //XBT_DEBUG("Different start addr of program (s1 = %p, s2 = %p)", s1->regions[i]->start_addr, s2->regions[i]->start_addr);
 -      return 1;
 +      if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
 +        XBT_DEBUG("Different start addr of program (s1 = %p, s2 = %p)", s1->regions[i]->start_addr, s2->regions[i]->start_addr);
 +        errors++;
 +      }else{
 +        return 1;
 +      }
        }
        if(memcmp(s1->regions[i]->data, s2->regions[i]->data, s1->regions[i]->size) != 0){
 -      //XBT_DEBUG("Different memcmp for data in program");
 -      return 1;
 +      if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
 +        XBT_DEBUG("Different memcmp for data in program");
 +        errors++;
 +      }else{
 +        return 1;
 +      }
        }
 -      break;
 +      break;*/
      case 3:
        if(s1->regions[i]->size != s2->regions[i]->size){
 -      //XBT_DEBUG("Different size of stack (s1 = %zu, s2 = %zu)", s1->regions[i]->size, s2->regions[i]->size);
 -      return 1;
 +      if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
 +        XBT_DEBUG("Different size of stack (s1 = %Zu, s2 = %Zu)", s1->regions[i]->size, s2->regions[i]->size);
 +        errors++;
 +      }else{
 +        return 1;
 +      }
        }
        if(s1->regions[i]->start_addr != s2->regions[i]->start_addr){
 -      //XBT_DEBUG("Different start addr of stack (s1 = %p, s2 = %p)", s1->regions[i]->start_addr, s2->regions[i]->start_addr);
 -      return 1;
 +      if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
 +        XBT_DEBUG("Different start addr of stack (s1 = %p, s2 = %p)", s1->regions[i]->start_addr, s2->regions[i]->start_addr);
 +        errors++;
 +      }else{
 +        return 1;
 +      }
        }
        if(memcmp(s1->regions[i]->data, s2->regions[i]->data, s1->regions[i]->size) != 0){
 -      //XBT_DEBUG("Different memcmp for data in stack");
 -      return 1;
 +      if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
 +        XBT_DEBUG("Different memcmp for data in stack");
 +        errors++;
 +      }else{
 +        return 1;
 +      }
        }
        break;
 +    default:
 +      break;
      }
    }
  
 -  return 0;
 +  if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
 +    return (errors>0);
 +  }else{
 +    return 0;
 +  }
    
  }
  
@@@ -200,7 -141,6 +200,7 @@@ int reached(xbt_state_t st)
      xbt_dynar_foreach(reached_pairs, cursor, pair_test){
        if(automaton_state_compare(pair_test->automaton_state, st) == 0){
        if(propositional_symbols_compare_value(pair_test->prop_ato, prop_ato) == 0){
 +        XBT_DEBUG("Pair reached %d", cursor+1);
          if(snapshot_compare(pair_test->system_state, sn) == 0){
            MC_free_snapshot(sn);
            xbt_dynar_reset(prop_ato);
@@@ -641,7 -581,7 +641,7 @@@ mc_pair_stateless_t new_pair_stateless(
    return p;
  }
  
- void MC_ddfs_init(){
+ void MC_ddfs_init(void){
  
    XBT_DEBUG("**************************************************");
    XBT_DEBUG("Double-DFS init");
      }
    }
  
 -  //reached_pairs = xbt_dynar_new(sizeof(mc_pair_reached_t), NULL);
 -  reached_pairs_hash = xbt_dynar_new(sizeof(mc_pair_reached_hash_t), NULL);
 +  reached_pairs = xbt_dynar_new(sizeof(mc_pair_reached_t), NULL);
 +  //reached_pairs_hash = xbt_dynar_new(sizeof(mc_pair_reached_hash_t), NULL);
    //visited_pairs = xbt_dynar_new(sizeof(mc_pair_visited_t), NULL);
    visited_pairs_hash = xbt_dynar_new(sizeof(mc_pair_visited_hash_t), NULL);
    successors = xbt_dynar_new(sizeof(mc_pair_stateless_t), NULL);
        xbt_fifo_unshift(mc_stack_liveness, mc_initial_pair);
        MC_UNSET_RAW_MEM;
  
 -      //set_pair_reached(state);
 -      set_pair_reached_hash(state);
 +      set_pair_reached(state);
 +      //set_pair_reached_hash(state);
  
        if(cursor != 0){
          MC_restore_snapshot(initial_snapshot_liveness);
@@@ -738,7 -678,7 +738,7 @@@ void MC_ddfs(int search_cycle)
   
    mc_stats_pair->visited_pairs++;
  
 -  //sleep(1);
 +  sleep(1);
  
    int value;
    mc_state_t next_graph_state = NULL;
  
            if((pair_succ->automaton_state->type == 1) || (pair_succ->automaton_state->type == 2)){ 
                      
 -            //if(reached(pair_succ->automaton_state)){
 -            if(reached_hash(pair_succ->automaton_state)){
 +            if(reached(pair_succ->automaton_state)){
 +              //if(reached_hash(pair_succ->automaton_state)){
              
                XBT_DEBUG("Next pair (depth = %d, %d interleave) already reached !", xbt_fifo_size(mc_stack_liveness) + 1, MC_state_interleave_size(pair_succ->graph_state));
  
  
                XBT_DEBUG("Next pair (depth =%d) -> Acceptance pair : graph=%p, automaton=%p(%s)", xbt_fifo_size(mc_stack_liveness) + 1, pair_succ->graph_state, pair_succ->automaton_state, pair_succ->automaton_state->id);
              
 -              //set_pair_reached(pair_succ->automaton_state);
 -              set_pair_reached_hash(pair_succ->automaton_state);
 +              set_pair_reached(pair_succ->automaton_state);
 +              //set_pair_reached_hash(pair_succ->automaton_state);
  
 -              //XBT_DEBUG("Reached pairs : %lu", xbt_dynar_length(reached_pairs));
 -              XBT_DEBUG("Reached pairs : %lu", xbt_dynar_length(reached_pairs_hash));
 +              XBT_DEBUG("Reached pairs : %lu", xbt_dynar_length(reached_pairs));
 +              //XBT_DEBUG("Reached pairs : %lu", xbt_dynar_length(reached_pairs_hash));
  
                MC_SET_RAW_MEM;
                xbt_fifo_unshift(mc_stack_liveness, pair_succ);
  
              XBT_DEBUG("Next pair (depth =%d) -> Acceptance pair : graph=%p, automaton=%p(%s)", xbt_fifo_size(mc_stack_liveness) + 1, pair_succ->graph_state, pair_succ->automaton_state, pair_succ->automaton_state->id);
            
 -            //set_pair_reached(pair_succ->automaton_state); 
 -            set_pair_reached_hash(pair_succ->automaton_state);
 +            set_pair_reached(pair_succ->automaton_state); 
 +            //set_pair_reached_hash(pair_succ->automaton_state);
  
              search_cycle = 1;
  
 -            //XBT_DEBUG("Reached pairs : %lu", xbt_dynar_length(reached_pairs));
 -            XBT_DEBUG("Reached pairs : %lu", xbt_dynar_length(reached_pairs_hash));
 +            XBT_DEBUG("Reached pairs : %lu", xbt_dynar_length(reached_pairs));
 +            //XBT_DEBUG("Reached pairs : %lu", xbt_dynar_length(reached_pairs_hash));
  
            }
  
  
          if((pair_succ->automaton_state->type == 1) || (pair_succ->automaton_state->type == 2)){ 
  
 -          //if(reached(pair_succ->automaton_state)){
 -          if(reached_hash(pair_succ->automaton_state)){
 +          if(reached(pair_succ->automaton_state)){
 +            //if(reached_hash(pair_succ->automaton_state)){
  
              XBT_DEBUG("Next pair (depth = %d) already reached !", xbt_fifo_size(mc_stack_liveness) + 1);
  
  
              XBT_DEBUG("Next pair (depth = %d) -> Acceptance pair : graph=%p, automaton=%p(%s)", xbt_fifo_size(mc_stack_liveness) + 1, pair_succ->graph_state, pair_succ->automaton_state, pair_succ->automaton_state->id);
              
 -            //set_pair_reached(pair_succ->automaton_state);
 -            set_pair_reached_hash(pair_succ->automaton_state);
 +            set_pair_reached(pair_succ->automaton_state);
 +            //set_pair_reached_hash(pair_succ->automaton_state);
                
 -            //XBT_DEBUG("Reached pairs : %lu", xbt_dynar_length(reached_pairs));
 -            XBT_DEBUG("Reached pairs : %lu", xbt_dynar_length(reached_pairs_hash));
 +            XBT_DEBUG("Reached pairs : %lu", xbt_dynar_length(reached_pairs));
 +            //XBT_DEBUG("Reached pairs : %lu", xbt_dynar_length(reached_pairs_hash));
  
              MC_SET_RAW_MEM;
              xbt_fifo_unshift(mc_stack_liveness, pair_succ);
            
          if(((pair_succ->automaton_state->type == 1) || (pair_succ->automaton_state->type == 2))){
  
 -          //set_pair_reached(pair_succ->automaton_state);
 -          set_pair_reached_hash(pair_succ->automaton_state);
 +          set_pair_reached(pair_succ->automaton_state);
 +          //set_pair_reached_hash(pair_succ->automaton_state);
                    
            search_cycle = 1;
  
 -          //XBT_DEBUG("Reached pairs : %lu", xbt_dynar_length(reached_pairs));
 -          XBT_DEBUG("Reached pairs : %lu", xbt_dynar_length(reached_pairs_hash));
 +          XBT_DEBUG("Reached pairs : %lu", xbt_dynar_length(reached_pairs));
 +          //XBT_DEBUG("Reached pairs : %lu", xbt_dynar_length(reached_pairs_hash));
  
          }
  
 -        //if(!visited_hash(pair_succ->automaton_state, search_cycle)){
 -        if(!visited(pair_succ->automaton_state, search_cycle)){
 +        if(!visited_hash(pair_succ->automaton_state, search_cycle)){
 +          //if(!visited(pair_succ->automaton_state, search_cycle)){
  
            MC_SET_RAW_MEM;
            xbt_fifo_unshift(mc_stack_liveness, pair_succ);
    MC_SET_RAW_MEM;
    xbt_fifo_shift(mc_stack_liveness);
    if((current_pair->automaton_state->type == 1) || (current_pair->automaton_state->type == 2)){
 -    //xbt_dynar_pop(reached_pairs, NULL);
 -    xbt_dynar_pop(reached_pairs_hash, NULL);
 +    xbt_dynar_pop(reached_pairs, NULL);
 +    //xbt_dynar_pop(reached_pairs_hash, NULL);
    }
    MC_UNSET_RAW_MEM;
    
@@@ -181,22 -181,22 +181,22 @@@ int mmalloc_compare_heap(void *h1, voi
    struct mstats ms2 = mmstats(h2);
  
    if(ms1.chunks_used !=  ms2.chunks_used){
-     XBT_DEBUG("Different chunks allocated by the user : %Zu - %Zu", ms1.chunks_used, ms2.chunks_used);
+     XBT_DEBUG("Different chunks allocated by the user : %zu - %zu", ms1.chunks_used, ms2.chunks_used);
      return 1;
    }
  
    if(ms1.bytes_used !=  ms2.bytes_used){
-     XBT_DEBUG("Different byte total of user-allocated chunks : %Zu - %Zu", ms1.bytes_used, ms2.bytes_used);
+     XBT_DEBUG("Different byte total of user-allocated chunks : %zu - %zu", ms1.bytes_used, ms2.bytes_used);
      return 1;
    }
  
    if(ms1.bytes_free !=  ms2.bytes_free){
-     XBT_DEBUG("Different byte total of chunks in the free list : %Zu - %Zu", ms1.bytes_free, ms2.bytes_free);
+     XBT_DEBUG("Different byte total of chunks in the free list : %zu - %zu", ms1.bytes_free, ms2.bytes_free);
      return 1;
    }
  
    if(ms1.chunks_free !=  ms2.chunks_free){
-     XBT_DEBUG("Different chunks in the free list : %Zu - %Zu", ms1.chunks_free, ms2.chunks_free);
+     XBT_DEBUG("Different chunks in the free list : %zu - %zu", ms1.chunks_free, ms2.chunks_free);
      return 1;
    }
  
@@@ -235,7 -235,7 +235,7 @@@ int mmalloc_compare_mdesc(struct mdesc 
      return 1;
    }
  
-   //XBT_DEBUG("Heap size : %Zu", mdp1->heapsize);
+   //XBT_DEBUG("Heap size : %zu", mdp1->heapsize);
  
    if(mdp1->heapbase != mdp2->heapbase){
      XBT_DEBUG("Different first block of the heap");
  
  
    if(mdp1->heapindex != mdp2->heapindex){
-     XBT_DEBUG("Different index for the heap table : %Zu - %Zu", mdp1->heapindex, mdp2->heapindex);
+     XBT_DEBUG("Different index for the heap table : %zu - %zu", mdp1->heapindex, mdp2->heapindex);
      return 1;
    }
  
-   //XBT_DEBUG("Heap index : %Zu", mdp1->heapindex);
+   //XBT_DEBUG("Heap index : %zu", mdp1->heapindex);
  
    if(mdp1->base != mdp2->base){
      XBT_DEBUG("Different base address of the memory region");
      return 1;
    }
  
-   //XBT_DEBUG("Heap limit : %Zu", mdp1->heaplimit);
+   //XBT_DEBUG("Heap limit : %zu", mdp1->heaplimit);
  
  
    if(mdp1->fd != mdp2->fd){
    block_free = first_block_free;
    next_block_free = mdp1->heapinfo[first_block_free].free.next;
  
-   //XBT_DEBUG("First block free : %Zu (size=%Zu), Next block free : %Zu", first_block_free, mdp1->heapinfo[block_free1].free.size, next_block_free);
+   //XBT_DEBUG("First block free : %zu (size=%zu), Next block free : %zu", first_block_free, mdp1->heapinfo[block_free1].free.size, next_block_free);
  
    if(next_block_free == 0)
      next_block_free = mdp1->heaplimit;
            return 1;
          }else{
            if(memcmp(addr_block1, addr_block2, (mdp1->heapinfo[i].busy.info.size * BLOCKSIZE)) != 0){
-             XBT_DEBUG("Different data in block %Zu", i);
+             XBT_DEBUG("Different data in block %zu", i);
              return 1;
            } 
          }
          break;
        default :         
          if(mdp1->heapinfo[i].busy.info.frag.nfree != mdp2->heapinfo[i].busy.info.frag.nfree){
-           XBT_DEBUG("Different free fragments in the fragmented block %Zu", i);
+           XBT_DEBUG("Different free fragments in the fragmented block %zu", i);
            return 1;
          }else{
            if(mdp1->heapinfo[i].busy.info.frag.first != mdp2->heapinfo[i].busy.info.frag.first){
-             XBT_DEBUG("Different first free fragments in the block %Zu", i);
+             XBT_DEBUG("Different first free fragments in the block %zu", i);
              return 1; 
            }else{
              frag_size = pow(2,mdp1->heapinfo[i].busy.type);
              for(j=0 ; j< (BLOCKSIZE/frag_size); j++){
                if(memcmp((char *)addr_block1 + (j * frag_size), (char *)addr_block2 + (j * frag_size), frag_size) != 0){
 -                XBT_DEBUG("Different data in fragment %zu of block %zu", j + 1, i);
 +                XBT_DEBUG("Different data in fragment %Zu of block %Zu", j + 1, i);
                  return 1;
                } 
              }