Changeset 359a3a3 in rtems


Ignore:
Timestamp:
Nov 22, 2018, 5:38:42 AM (6 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
3899bc1a
Parents:
0da9d80
git-author:
Sebastian Huber <sebastian.huber@…> (11/22/18 05:38:42)
git-committer:
Sebastian Huber <sebastian.huber@…> (12/07/18 13:22:01)
Message:

score: Rename Objects_Information::allocation_size

Rename Objects_Information::allocation_size in
Objects_Information::objects_per_block. Adjust integer types in
_Objects_Shrink_information() and _Objects_Free().

Update #3621.

Location:
cpukit
Files:
6 edited

Legend:

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

    r0da9d80 r359a3a3  
    132132  Objects_Maximum   inactive;
    133133  /** This is the number of objects in a block. */
    134   Objects_Maximum   allocation_size;
     134  Objects_Maximum   objects_per_block;
    135135  /** This is the size in bytes of each object instance. */
    136136  uint16_t          object_size;
     
    751751)
    752752{
    753   return information->auto_extend ? information->allocation_size : 0;
     753  return information->auto_extend ? information->objects_per_block : 0;
    754754}
    755755
  • cpukit/score/src/objectallocate.c

    r0da9d80 r359a3a3  
    7373      block = (uint32_t) _Objects_Get_index( the_object->id ) -
    7474              _Objects_Get_index( information->minimum_id );
    75       block /= information->allocation_size;
     75      block /= information->objects_per_block;
    7676
    7777      information->inactive_per_block[ block ]--;
  • cpukit/score/src/objectextendinformation.c

    r0da9d80 r359a3a3  
    7474    block_count = 0;
    7575  else {
    76     block_count = information->maximum / information->allocation_size;
     76    block_count = information->maximum / information->objects_per_block;
    7777
    7878    for ( ; block < block_count; block++ ) {
     
    8181        break;
    8282      } else
    83         index_base += information->allocation_size;
    84     }
    85   }
    86   index_end = index_base + information->allocation_size;
    87 
    88   maximum = (uint32_t) information->maximum + information->allocation_size;
     83        index_base += information->objects_per_block;
     84    }
     85  }
     86  index_end = index_base + information->objects_per_block;
     87
     88  maximum = (uint32_t) information->maximum + information->objects_per_block;
    8989
    9090  /*
     
    101101   * generate a fatal error depending on auto-extending being active.
    102102   */
    103   object_block_size = information->allocation_size * information->object_size;
     103  object_block_size = information->objects_per_block
     104    * information->object_size;
    104105  if ( information->auto_extend ) {
    105106    new_object_block = _Workspace_Allocate( object_block_size );
     
    244245   */
    245246  information->object_blocks[ block ] = new_object_block;
    246   information->inactive_per_block[ block ] = information->allocation_size;
    247   information->inactive += information->allocation_size;
     247  information->inactive_per_block[ block ] = information->objects_per_block;
     248  information->inactive += information->objects_per_block;
    248249
    249250  /*
  • cpukit/score/src/objectfree.c

    r0da9d80 r359a3a3  
    2828)
    2929{
    30   uint32_t    allocation_size = information->allocation_size;
    31 
    3230  _Assert( _Objects_Allocator_is_owner() );
    3331
     
    3533
    3634  if ( information->auto_extend ) {
    37     uint32_t    block;
     35    Objects_Maximum objects_per_block;
     36    Objects_Maximum block;
     37    Objects_Maximum inactive;
    3838
    39     block = (uint32_t) (_Objects_Get_index( the_object->id ) -
    40                         _Objects_Get_index( information->minimum_id ));
    41     block /= information->allocation_size;
     39    objects_per_block = information->objects_per_block;
     40    block = _Objects_Get_index( the_object->id );
     41    block -= _Objects_Get_index( information->minimum_id );
     42    block /= objects_per_block;
    4243
    43     information->inactive_per_block[ block ]++;
    44     information->inactive++;
     44    ++information->inactive_per_block[ block ];
     45
     46    inactive = information->inactive;
     47    ++inactive;
     48    information->inactive = inactive;
    4549
    4650    /*
    4751     *  Check if the threshold level has been met of
    48      *  1.5 x allocation_size are free.
     52     *  1.5 x objects_per_block are free.
    4953     */
    5054
    51     if ( information->inactive > ( allocation_size + ( allocation_size >> 1 ) ) ) {
     55    if ( inactive > ( objects_per_block + ( objects_per_block >> 1 ) ) ) {
    5256      _Objects_Shrink_information( information );
    5357    }
  • cpukit/score/src/objectinitializeinformation.c

    r0da9d80 r359a3a3  
    7777   *  The allocation unit is the maximum value
    7878   */
    79   information->allocation_size = maximum_per_allocation;
     79  information->objects_per_block = maximum_per_allocation;
    8080
    8181  /*
  • cpukit/score/src/objectshrinkinformation.c

    r0da9d80 r359a3a3  
    2828)
    2929{
    30   uint32_t          block_count;
    31   uint32_t          block;
    32   uint32_t          index_base;
     30  Objects_Maximum objects_per_block;
     31  Objects_Maximum index_base;
     32  Objects_Maximum block_count;
     33  Objects_Maximum block;
    3334
    3435  _Assert( _Objects_Allocator_is_owner() );
     
    3839   */
    3940
     41  objects_per_block = information->objects_per_block;
    4042  index_base = _Objects_Get_index( information->minimum_id );
    41   block_count = (information->maximum - index_base) /
    42                  information->allocation_size;
     43  block_count = ( information->maximum - index_base ) / objects_per_block;
    4344
    4445  for ( block = 0; block < block_count; block++ ) {
    45     if ( information->inactive_per_block[ block ] ==
    46          information->allocation_size ) {
    47       Chain_Node       *node = _Chain_First( &information->Inactive );
    48       const Chain_Node *tail = _Chain_Immutable_tail( &information->Inactive );
    49       uint32_t          index_end = index_base + information->allocation_size;
     46    if ( information->inactive_per_block[ block ] == objects_per_block ) {
     47      Chain_Node       *node;
     48      const Chain_Node *tail;
     49      uint32_t          index_end;
     50
     51      node = _Chain_First( &information->Inactive );
     52      tail = _Chain_Immutable_tail( &information->Inactive );
     53      index_end = index_base + objects_per_block;
    5054
    5155      while ( node != tail ) {
    52         Objects_Control *object = (Objects_Control *) node;
    53         uint32_t         index = _Objects_Get_index( object->id );
     56        Objects_Control *object;
     57        uint32_t         index;
     58
     59        object = (Objects_Control *) node;
     60        index = _Objects_Get_index( object->id );
    5461
    5562        /*
     
    7178      information->inactive_per_block[ block ] = 0;
    7279
    73       information->inactive -= information->allocation_size;
     80      information->inactive -= objects_per_block;
    7481
    7582      return;
    7683    }
    7784
    78     index_base += information->allocation_size;
     85    index_base += objects_per_block;
    7986  }
    8087}
Note: See TracChangeset for help on using the changeset viewer.