liberty/support/specpriv-profile/api.cpp
// Consume and execute one message from the queue.
// Return false if program is over.
Consume and execute one message from the queue.
Return false if program is over.
Consume and execute one message from the queue . Return false if program is over .
static bool process_message()
{
  static const char *last_loop=0;
  Profiler &prof = Profiler::getInstance();
  uint32_t code,second;
  CONSUME_2(code, second);
  const char *name=0;
  void *ptr=0, *ptr2=0;
  uint64_t size=0;
  switch(code)
  {
    case 0:
      name = (const char*) CONSUME;
      ptr = (void*) CONSUME;
      size = second;
      prof.malloc(name,ptr,size);
      break;
    case 1:
      name = (const char*) CONSUME;
      ptr = (void*) CONSUME;
      prof.free(name,ptr, (second==1) );
      break;
    case 2:
      name = (const char*) CONSUME;
      ptr = (void*) CONSUME;
      size = second;
      prof.report_constant(name,ptr,size);
      break;
    case 3:
      name = (const char*) CONSUME;
      ptr = (void*) CONSUME;
      size = second;
      prof.report_global(name,ptr,size);
      break;
    case 4:
      name = (const char*) CONSUME;
      ptr = (void*) CONSUME;
      size = second;
      prof.report_stack(name,ptr,1,size);
      break;
    case 5:
      name = (const char*) CONSUME;
      prof.begin_function(name);
      break;
    case 6:
      prof.end_function(0);
      break;
    case 7:
      last_loop = (const char*) CONSUME;
      prof.begin_iter(last_loop);
      break;
    case 8:
      prof.end_iter(0);
      break;
    case 9:
      name = (const char*) CONSUME;
      ptr = (void*) CONSUME;
      prof.find_underlying_object(name,ptr);
      break;
    case 10:
      name = (const char*) CONSUME;
      size = CONSUME;
      prof.predict_int(name,size);
      break;
    case 11:
      name = (const char*) CONSUME;
      ptr = (void*) CONSUME;
      prof.predict_ptr(name,ptr);
      break;
    case 12:
      return true;
    case 13:
      name = (const char*) CONSUME;
      ptr = (void*) CONSUME;
      ptr2 = (void*) CONSUME;
      size = second;
      prof.realloc(name,ptr,ptr2,size);
      break;
    case 14:
      name = (const char*) CONSUME;
      ptr = (void*) CONSUME;
      ptr2 = (void*) CONSUME;
      prof.assert_in_bounds(name,ptr,ptr2);
      break;
    case 15:
      name = (const char *) CONSUME;
      prof.possible_allocation_leak(name);
      break;
    case 16:
      name = (const char *) CONSUME;
      ptr = (void *) (uint64_t) second;
      prof.pointer_residue(name,ptr);
      break;
    case 17:
      eger (with 32-bit value)
      name = (const char *) CONSUME;
      size = (uint64_t)second;
      prof.predict_int(name,size);
      break;
    case 18:
      ation (with same loop name)
      prof.begin_iter(last_loop);
      break;
    default:
      break;
  }
  return false;
}
static bool process_message ( ) { static const char * last_loop = 0 ; Profiler & prof = Profiler :: getInstance ( ) ; uint32_t code , second ; CONSUME_2 ( code , second ) ; const char * name = 0 ; void * ptr = 0 , * ptr2 = 0 ; uint64_t size = 0 ; switch ( code ) { case 0 : name = ( const char * ) CONSUME ; ptr = ( void * ) CONSUME ; size = second ; prof . malloc ( name , ptr , size ) ; break ; case 1 : name = ( const char * ) CONSUME ; ptr = ( void * ) CONSUME ; prof . free ( name , ptr , ( second == 1 ) ) ; break ; case 2 : name = ( const char * ) CONSUME ; ptr = ( void * ) CONSUME ; size = second ; prof . report_constant ( name , ptr , size ) ; break ; case 3 : name = ( const char * ) CONSUME ; ptr = ( void * ) CONSUME ; size = second ; prof . report_global ( name , ptr , size ) ; break ; case 4 : name = ( const char * ) CONSUME ; ptr = ( void * ) CONSUME ; size = second ; prof . report_stack ( name , ptr , 1 , size ) ; break ; case 5 : name = ( const char * ) CONSUME ; prof . begin_function ( name ) ; break ; case 6 : prof . end_function ( 0 ) ; break ; case 7 : last_loop = ( const char * ) CONSUME ; prof . begin_iter ( last_loop ) ; break ; case 8 : prof . end_iter ( 0 ) ; break ; case 9 : name = ( const char * ) CONSUME ; ptr = ( void * ) CONSUME ; prof . find_underlying_object ( name , ptr ) ; break ; case 10 : name = ( const char * ) CONSUME ; size = CONSUME ; prof . predict_int ( name , size ) ; break ; case 11 : name = ( const char * ) CONSUME ; ptr = ( void * ) CONSUME ; prof . predict_ptr ( name , ptr ) ; break ; case 12 : return true ; case 13 : name = ( const char * ) CONSUME ; ptr = ( void * ) CONSUME ; ptr2 = ( void * ) CONSUME ; size = second ; prof . realloc ( name , ptr , ptr2 , size ) ; break ; case 14 : name = ( const char * ) CONSUME ; ptr = ( void * ) CONSUME ; ptr2 = ( void * ) CONSUME ; prof . assert_in_bounds ( name , ptr , ptr2 ) ; break ; case 15 : name = ( const char * ) CONSUME ; prof . possible_allocation_leak ( name ) ; break ; case 16 : name = ( const char * ) CONSUME ; ptr = ( void * ) ( uint64_t ) second ; prof . pointer_residue ( name , ptr ) ; break ; case 17 : name = ( const char * ) CONSUME ; size = ( uint64_t ) second ; prof . predict_int ( name , size ) ; break ; case 18 : prof . begin_iter ( last_loop ) ; break ; default : break ; } return false ; }
Consume and execute one message from the queue.
Consume and execute one message from the queue .
// malloc // free // report constant // report global // report stack // begin function // end function // begin iter // end iter // find underlying object // predict int // predict ptr // end // realloc // assert in-bounds // possible object leak // pointer residues // predict integer (with 32-bit value) // begin iteration (with same loop name)