Changeset 8b0e752 in rtems for cpukit


Ignore:
Timestamp:
Dec 10, 2018, 12:44:53 PM (10 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
0f5b2c09
Parents:
877048c
git-author:
Sebastian Huber <sebastian.huber@…> (12/10/18 12:44:53)
git-committer:
Sebastian Huber <sebastian.huber@…> (12/14/18 05:57:55)
Message:

score: Remove Objects_Information::auto_extend

Use Objects_Information::objects_per_block to provide this information.
Add and use _Objects_Is_auto_extend().

Update #3621.

Location:
cpukit
Files:
6 edited

Legend:

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

    r877048c r8b0e752  
    127127  /** This is the number of objects on the Inactive list. */
    128128  Objects_Maximum   inactive;
    129   /** This is the number of objects in a block. */
     129  /**
     130   * @brief This is the number of objects in a block if the automatic extension
     131   * is enabled.
     132   *
     133   * This member is zero if the automatic extension is disabled.
     134   */
    130135  Objects_Maximum   objects_per_block;
    131136  /** This is the size in bytes of each object instance. */
     
    138143   */
    139144  uint16_t          name_length;
    140   /** This is the true if unlimited objects in this class. */
    141   bool              auto_extend;
    142145  /** This is the chain of inactive control blocks. */
    143146  Chain_Control     Inactive;
     
    748751)
    749752{
    750   return information->auto_extend ? information->objects_per_block : 0;
     753  return information->objects_per_block;
    751754}
    752755
     
    857860{
    858861  return _Objects_Get_index( information->maximum_id );
     862}
     863
     864/**
     865 * @brief Returns true if the automatic object extension (unlimited objects) is
     866 * enabled, otherwise false.
     867 *
     868 * @param[in] information The object information.
     869 *
     870 * @retval true The automatic object extension (unlimited objects) is enabled.
     871 * @retval false Otherwise.
     872 */
     873RTEMS_INLINE_ROUTINE Objects_Maximum _Objects_Is_auto_extend(
     874  const Objects_Information *information
     875)
     876{
     877  return information->objects_per_block != 0;
    859878}
    860879
  • cpukit/rtems/src/rtemsobjectgetclassinfo.c

    r877048c r8b0e752  
    4747  info->minimum_id  = _Objects_Get_minimum_id( obj_info->maximum_id );
    4848  info->maximum_id  = obj_info->maximum_id;
    49   info->auto_extend = obj_info->auto_extend;
     49  info->auto_extend = _Objects_Is_auto_extend( obj_info );
    5050  info->maximum     = _Objects_Get_maximum_index( obj_info );
    5151
  • cpukit/score/src/objectallocate.c

    r877048c r8b0e752  
    5757  the_object = _Objects_Get_inactive( information );
    5858
    59   if ( information->auto_extend ) {
     59  if ( _Objects_Is_auto_extend( information ) ) {
    6060    /*
    6161     *  If the list is empty then we are out of objects and need to
  • cpukit/score/src/objectextendinformation.c

    r877048c r8b0e752  
    5050  uint32_t          index_end;
    5151  uint32_t          index;
     52  Objects_Maximum   extend_count;
    5253  Objects_Maximum   old_maximum;
    5354  uint32_t          new_maximum;
     
    6364
    6465  api_class_and_node = information->maximum_id & ~OBJECTS_INDEX_MASK;
    65   old_maximum = _Objects_Get_maximum_index( information );
    6666
    6767  /*
     
    7373  block         = 0;
    7474
    75   if ( information->object_blocks == NULL )
     75  if ( information->object_blocks == NULL ) {
     76    extend_count = _Objects_Get_maximum_index( information );
     77    old_maximum = 0;
    7678    block_count = 0;
    77   else {
    78     block_count = old_maximum / information->objects_per_block;
     79  } else {
     80    extend_count = information->objects_per_block;
     81    old_maximum = _Objects_Get_maximum_index( information );
     82    block_count = old_maximum / extend_count;
    7983
    8084    for ( ; block < block_count; block++ ) {
     
    8387        break;
    8488      } else
    85         index_base += information->objects_per_block;
    86     }
    87   }
    88   index_end = index_base + information->objects_per_block;
    89 
    90   new_maximum = (uint32_t) old_maximum + information->objects_per_block;
     89        index_base += extend_count;
     90    }
     91  }
     92
     93  new_maximum = (uint32_t) old_maximum + extend_count;
     94  index_end = index_base + extend_count;
    9195
    9296  /*
     
    103107   * generate a fatal error depending on auto-extending being active.
    104108   */
    105   object_block_size = information->objects_per_block
    106     * information->object_size;
    107   if ( information->auto_extend ) {
     109  object_block_size = extend_count * information->object_size;
     110  if ( _Objects_Is_auto_extend( information ) ) {
    108111    new_object_block = _Workspace_Allocate( object_block_size );
    109112    if ( !new_object_block )
     
    156159      + local_table_size
    157160      + block_count * sizeof( *inactive_per_block );
    158     if ( information->auto_extend ) {
     161    if ( _Objects_Is_auto_extend( information ) ) {
    159162      object_blocks = _Workspace_Allocate( table_size );
    160163      if ( !object_blocks ) {
  • cpukit/score/src/objectfree.c

    r877048c r8b0e752  
    3232  _Chain_Append_unprotected( &information->Inactive, &the_object->Node );
    3333
    34   if ( information->auto_extend ) {
     34  if ( _Objects_Is_auto_extend( information ) ) {
    3535    Objects_Maximum objects_per_block;
    3636    Objects_Maximum block;
  • cpukit/score/src/objectinitializeinformation.c

    r877048c r8b0e752  
    4040  Objects_Maximum maximum_per_allocation;
    4141
     42  maximum_per_allocation = _Objects_Maximum_per_allocation( maximum );
    4243  information->maximum_id = _Objects_Build_id(
    4344    the_api,
    4445    the_class,
    4546    _Objects_Local_node,
    46     0
     47    maximum_per_allocation
    4748  );
    4849  information->object_size = object_size;
     
    5657   *  Are we operating in limited or unlimited (e.g. auto-extend) mode.
    5758   */
    58   information->auto_extend = _Objects_Is_unlimited( maximum );
    59   maximum_per_allocation = _Objects_Maximum_per_allocation( maximum );
     59  if ( _Objects_Is_unlimited( maximum ) ) {
     60    /*
     61     *  Unlimited and maximum of zero is illogical.
     62     */
     63    if ( maximum_per_allocation == 0) {
     64      _Internal_error( INTERNAL_ERROR_UNLIMITED_AND_MAXIMUM_IS_0 );
     65    }
    6066
    61   /*
    62    *  Unlimited and maximum of zero is illogical.
    63    */
    64   if ( information->auto_extend && maximum_per_allocation == 0) {
    65     _Internal_error( INTERNAL_ERROR_UNLIMITED_AND_MAXIMUM_IS_0 );
     67    /*
     68     *  The allocation unit is the maximum value
     69     */
     70    information->objects_per_block = maximum_per_allocation;
    6671  }
    6772
    68   /*
    69    *  The allocation unit is the maximum value
    70    */
    71   information->objects_per_block = maximum_per_allocation;
    7273
    7374  /*
Note: See TracChangeset for help on using the changeset viewer.