Changeset 1c2d178 in rtems for cpukit


Ignore:
Timestamp:
Nov 25, 2018, 7:15:26 PM (12 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
f70079c
Parents:
3899bc1a
git-author:
Sebastian Huber <sebastian.huber@…> (11/25/18 19:15:26)
git-committer:
Sebastian Huber <sebastian.huber@…> (12/07/18 13:22:02)
Message:

score: Remove Objects_Information::maximum

This information is already present in Objects_Information::maximum_id.
Add and use _Objects_Get_maximum_index().

Update #3621.

Location:
cpukit
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • cpukit/include/rtems/score/objectimpl.h

    r3899bc1a r1c2d178  
    125125  /** This points to the table of local objects. */
    126126  Objects_Control **local_table;
    127   /** This is the maximum number of objects in this class. */
    128   Objects_Maximum   maximum;
    129127  /** This is the number of objects on the Inactive list. */
    130128  Objects_Maximum   inactive;
     
    852850
    853851/**
     852 * Returns the maximum index of the specified object class.
     853 *
     854 * @param[in] information The object information.
     855 *
     856 * @return The maximum index of the specified object class.
     857 */
     858RTEMS_INLINE_ROUTINE Objects_Maximum _Objects_Get_maximum_index(
     859  const Objects_Information *information
     860)
     861{
     862  return _Objects_Get_index( information->maximum_id );
     863}
     864
     865/**
    854866 * This function sets the pointer to the local_table object
    855867 * referenced by the index.
     
    877889   */
    878890  _Assert( index >= OBJECTS_INDEX_MINIMUM );
    879   _Assert( index <= information->maximum );
     891  _Assert( index <= _Objects_Get_maximum_index( information ) );
    880892
    881893  information->local_table[ index - OBJECTS_INDEX_MINIMUM ] = the_object;
  • cpukit/posix/src/killinfo.c

    r3899bc1a r1c2d178  
    208208      continue;
    209209
    210     maximum = the_info->maximum;
     210    maximum = _Objects_Get_maximum_index( the_info );
    211211    object_table = the_info->local_table;
    212212
  • cpukit/rtems/src/rtemsobjectgetclassinfo.c

    r3899bc1a r1c2d178  
    4848  info->maximum_id  = obj_info->maximum_id;
    4949  info->auto_extend = obj_info->auto_extend;
    50   info->maximum     = obj_info->maximum;
     50  info->maximum     = _Objects_Get_maximum_index( obj_info );
    5151
    5252  for ( unallocated=0, i=1 ; i <= info->maximum ; i++ )
  • cpukit/score/src/objectactivecount.c

    r3899bc1a r1c2d178  
    2525)
    2626{
    27   size_t inactive;
    28   size_t maximum;
     27  Objects_Maximum inactive;
     28  Objects_Maximum maximum;
    2929
    3030  _Assert( _Objects_Allocator_is_owner() );
    3131
    32   inactive = _Chain_Node_count_unprotected( &information->Inactive );
    33   maximum  = information->maximum;
     32  inactive = (Objects_Maximum)
     33    _Chain_Node_count_unprotected( &information->Inactive );
     34  maximum  = _Objects_Get_maximum_index( information );
    3435
    35   return (Objects_Maximum) ( maximum - inactive );
     36  return maximum - inactive;
    3637}
  • cpukit/score/src/objectextendinformation.c

    r3899bc1a r1c2d178  
    5050  uint32_t          index_end;
    5151  uint32_t          index;
    52   uint32_t          maximum;
     52  Objects_Maximum   old_maximum;
     53  uint32_t          new_maximum;
    5354  size_t            object_block_size;
    5455  Objects_Control  *new_object_block;
     
    6061  );
    6162
     63  old_maximum = _Objects_Get_maximum_index( information );
     64
    6265  /*
    6366   *  Search for a free block of indexes. If we do NOT need to allocate or
     
    7174    block_count = 0;
    7275  else {
    73     block_count = information->maximum / information->objects_per_block;
     76    block_count = old_maximum / information->objects_per_block;
    7477
    7578    for ( ; block < block_count; block++ ) {
     
    8386  index_end = index_base + information->objects_per_block;
    8487
    85   maximum = (uint32_t) information->maximum + information->objects_per_block;
     88  new_maximum = (uint32_t) old_maximum + information->objects_per_block;
    8689
    8790  /*
     
    9093   *  case of 16-bit Ids, this is only 256 object instances.
    9194   */
    92   if ( maximum > OBJECTS_ID_FINAL_INDEX ) {
     95  if ( new_maximum > OBJECTS_ID_FINAL_INDEX ) {
    9396    return;
    9497  }
     
    147150     */
    148151    object_blocks_size = block_count * sizeof( *object_blocks );
    149     local_table_size =  maximum * sizeof( *local_table );
     152    local_table_size =  new_maximum * sizeof( *local_table );
    150153    table_size = object_blocks_size
    151154      + local_table_size
     
    179182    block_count--;
    180183
    181     if ( information->maximum > 0 ) {
     184    if ( old_maximum > 0 ) {
    182185      /*
    183186       *  Copy each section of the table over. This has to be performed as
     
    197200        local_table,
    198201        information->local_table,
    199         information->maximum * sizeof( *local_table )
     202        old_maximum * sizeof( *local_table )
    200203      );
    201204    }
     
    216219    information->inactive_per_block = inactive_per_block;
    217220    information->local_table = local_table;
    218     information->maximum = (Objects_Maximum) maximum;
    219221    information->maximum_id = _Objects_Build_id(
    220222      information->the_api,
    221223      information->the_class,
    222224      _Objects_Local_node,
    223       information->maximum
     225      new_maximum
    224226    );
    225227
  • cpukit/score/src/objectgetinfo.c

    r3899bc1a r1c2d178  
    5656   */
    5757  #if !defined(RTEMS_MULTIPROCESSING)
    58     if ( info->maximum == 0 )
     58    if ( _Objects_Get_maximum_index( info ) == 0 )
    5959      return NULL;
    6060  #endif
  • cpukit/score/src/objectgetnext.c

    r3899bc1a r1c2d178  
    2929    Objects_Control *the_object;
    3030    Objects_Id       next_id;
     31    Objects_Maximum  maximum;
    3132
    3233    if ( !information )
     
    4243
    4344    _Objects_Allocator_lock();
     45    maximum = _Objects_Get_maximum_index( information );
    4446
    4547    do {
    46         /* walked off end of list? */
    47         if (_Objects_Get_index(next_id) > information->maximum)
    48         {
    49             _Objects_Allocator_unlock();
    50             *next_id_p = OBJECTS_ID_FINAL;
    51             return NULL;
    52         }
     48      /* walked off end of list? */
     49      if (_Objects_Get_index( next_id ) > maximum) {
     50        _Objects_Allocator_unlock();
     51        *next_id_p = OBJECTS_ID_FINAL;
     52        return NULL;
     53      }
    5354
    54         /* try to grab one */
    55         the_object = _Objects_Get_no_protection( next_id, information );
     55      /* try to grab one */
     56      the_object = _Objects_Get_no_protection( next_id, information );
    5657
    57         next_id++;
    58 
     58      next_id++;
    5959    } while ( the_object == NULL );
    6060
  • cpukit/score/src/objectinitializeinformation.c

    r3899bc1a r1c2d178  
    4040  Objects_Maximum maximum_per_allocation;
    4141
    42   information->the_api            = the_api;
    43   information->the_class          = the_class;
    44   information->object_size        = object_size;
    45   information->local_table        = 0;
    46   information->inactive_per_block = 0;
    47   information->object_blocks      = 0;
    48   information->inactive           = 0;
    49   information->local_table        = NULL;
    50 
    51   /*
    52    *  Set the maximum value to 0. It will be updated when objects are
    53    *  added to the inactive set from _Objects_Extend_information()
    54    */
    55   information->maximum = 0;
     42  information->the_api     = the_api;
     43  information->the_class   = the_class;
     44  information->object_size = object_size;
    5645
    5746  /*
  • cpukit/score/src/objectnametoid.c

    r3899bc1a r1c2d178  
    3030  bool                       search_local_node;
    3131  Objects_Control           *the_object;
     32  Objects_Maximum            maximum;
    3233  Objects_Maximum            index;
    3334#if defined(RTEMS_MULTIPROCESSING)
     
    4344    return OBJECTS_INVALID_NAME;
    4445
     46  maximum = _Objects_Get_maximum_index( information );
    4547  search_local_node = false;
    4648
    47   if ( information->maximum != 0 &&
     49  if ( maximum > 0 &&
    4850      (node == OBJECTS_SEARCH_ALL_NODES ||
    4951       node == OBJECTS_SEARCH_LOCAL_NODE ||
     
    5355
    5456  if ( search_local_node ) {
    55     for ( index = 0; index < information->maximum; ++index ) {
     57    for ( index = 0; index < maximum; ++index ) {
    5658      the_object = information->local_table[ index ];
    5759      if ( !the_object )
  • cpukit/score/src/objectnametoidstring.c

    r3899bc1a r1c2d178  
    3030)
    3131{
    32   size_t   name_length;
    33   size_t   max_name_length;
    34   uint32_t index;
     32  size_t          name_length;
     33  size_t          max_name_length;
     34  Objects_Maximum maximum;
     35  Objects_Maximum index;
    3536
    3637  _Assert( _Objects_Has_string_name( information ) );
     
    5354  }
    5455
    55   for ( index = 0; index < information->maximum; ++index ) {
     56  maximum = _Objects_Get_maximum_index( information );
     57
     58  for ( index = 0; index < maximum; ++index ) {
    5659    Objects_Control *the_object;
    5760
  • cpukit/score/src/objectshrinkinformation.c

    r3899bc1a r1c2d178  
    4040
    4141  objects_per_block = information->objects_per_block;
    42   block_count = information->maximum / objects_per_block;
     42  block_count = _Objects_Get_maximum_index( information ) / objects_per_block;
    4343  index_base = 0;
    4444
  • cpukit/score/src/threaditerate.c

    r3899bc1a r1c2d178  
    2828  for ( api_index = 1 ; api_index <= OBJECTS_APIS_LAST ; ++api_index ) {
    2929    const Objects_Information *information;
    30     Objects_Maximum            i;
     30    Objects_Maximum            maximum;
     31    Objects_Maximum            index;
    3132
    3233    if ( _Objects_Information_table[ api_index ] == NULL ) {
     
    4041    }
    4142
    42     for ( i = 0 ; i < information->maximum ; ++i ) {
     43    maximum = _Objects_Get_maximum_index( information );
     44
     45    for ( index = 0 ; index < maximum ; ++index ) {
    4346      Thread_Control *the_thread;
    4447
    45       the_thread = (Thread_Control *) information->local_table[ i ];
     48      the_thread = (Thread_Control *) information->local_table[ index ];
    4649
    4750      if ( the_thread != NULL ) {
Note: See TracChangeset for help on using the changeset viewer.