summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/objectfree.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/objectfree.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 '')
-rw-r--r--cpukit/score/src/objectfree.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/cpukit/score/src/objectfree.c b/cpukit/score/src/objectfree.c
index 3e7c8e409c..cf31a5b24e 100644
--- a/cpukit/score/src/objectfree.c
+++ b/cpukit/score/src/objectfree.c
@@ -37,8 +37,7 @@ void _Objects_Free(
Objects_Maximum inactive;
objects_per_block = information->objects_per_block;
- block = _Objects_Get_index( the_object->id );
- block -= _Objects_Get_index( information->minimum_id );
+ block = _Objects_Get_index( the_object->id ) - OBJECTS_INDEX_MINIMUM;
block /= objects_per_block;
++information->inactive_per_block[ block ];