summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/objectshrinkinformation.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-11-24 11:51:28 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-12-07 14:22:01 +0100
commit3899bc1a4b3294306ae2fd3f8ff0ee10365d9f4b (patch)
tree3912fc89bbde8a64a20111e02c618e85eb7bb000 /cpukit/score/src/objectshrinkinformation.c
parentscore: Rename Objects_Information::allocation_size (diff)
downloadrtems-3899bc1a4b3294306ae2fd3f8ff0ee10365d9f4b.tar.bz2
score: Optimize object lookup
Use the maximum ID for the ID to object translation. Using the maximum ID gets rid of an additional load from the object information in _Objects_Get(). In addition, object lookups fail for every ID in case the object information is cleared to zero. This makes it a bit more robust during system startup (see new tests in spconfig02). The local table no longer needs a NULL pointer entry at array index zero. Adjust all the object iteration loops accordingly. Remove Objects_Information::minimum_id since it contains only redundant information. Add _Objects_Get_minimum_id() to get the minimum ID. Update #3621.
Diffstat (limited to 'cpukit/score/src/objectshrinkinformation.c')
-rw-r--r--cpukit/score/src/objectshrinkinformation.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/cpukit/score/src/objectshrinkinformation.c b/cpukit/score/src/objectshrinkinformation.c
index cf3618f8fa..3b1841a16b 100644
--- a/cpukit/score/src/objectshrinkinformation.c
+++ b/cpukit/score/src/objectshrinkinformation.c
@@ -28,9 +28,9 @@ void _Objects_Shrink_information(
)
{
Objects_Maximum objects_per_block;
- Objects_Maximum index_base;
Objects_Maximum block_count;
Objects_Maximum block;
+ Objects_Maximum index_base;
_Assert( _Objects_Allocator_is_owner() );
@@ -39,14 +39,14 @@ void _Objects_Shrink_information(
*/
objects_per_block = information->objects_per_block;
- index_base = _Objects_Get_index( information->minimum_id );
- block_count = ( information->maximum - index_base ) / objects_per_block;
+ block_count = information->maximum / objects_per_block;
+ index_base = 0;
for ( block = 0; block < block_count; block++ ) {
if ( information->inactive_per_block[ block ] == objects_per_block ) {
Chain_Node *node;
const Chain_Node *tail;
- uint32_t index_end;
+ Objects_Maximum index_end;
node = _Chain_First( &information->Inactive );
tail = _Chain_Immutable_tail( &information->Inactive );
@@ -57,7 +57,7 @@ void _Objects_Shrink_information(
uint32_t index;
object = (Objects_Control *) node;
- index = _Objects_Get_index( object->id );
+ index = _Objects_Get_index( object->id ) - OBJECTS_INDEX_MINIMUM;
/*
* Get the next node before the node is extracted