summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/objectfree.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-11-22 19:14:51 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-12-14 07:03:29 +0100
commit21275b58a5a69c3c838082ffc8a7a3641f32ea9a (patch)
treed331e17c15d71f107d0f14581a93ddf768b05813 /cpukit/score/src/objectfree.c
parentrtems: Use object information to get config max (diff)
downloadrtems-21275b58a5a69c3c838082ffc8a7a3641f32ea9a.tar.bz2
score: Static Objects_Information initialization
Statically allocate the objects information together with the initial set of objects either via <rtems/confdefs.h>. Provide default object informations with zero objects via librtemscpu.a. This greatly simplifies the workspace size estimate. RTEMS applications which do not use the unlimited objects option are easier to debug since all objects reside now in statically allocated objects of the right types. Close #3621.
Diffstat (limited to 'cpukit/score/src/objectfree.c')
-rw-r--r--cpukit/score/src/objectfree.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/cpukit/score/src/objectfree.c b/cpukit/score/src/objectfree.c
index 38ae17d739..c9af8ba7cf 100644
--- a/cpukit/score/src/objectfree.c
+++ b/cpukit/score/src/objectfree.c
@@ -38,21 +38,24 @@ void _Objects_Free(
objects_per_block = information->objects_per_block;
block = _Objects_Get_index( the_object->id ) - OBJECTS_INDEX_MINIMUM;
- block /= objects_per_block;
- ++information->inactive_per_block[ block ];
+ if ( block > objects_per_block ) {
+ block /= objects_per_block;
- inactive = information->inactive;
- ++inactive;
- information->inactive = inactive;
+ ++information->inactive_per_block[ block ];
- /*
- * Check if the threshold level has been met of
- * 1.5 x objects_per_block are free.
- */
+ inactive = information->inactive;
+ ++inactive;
+ information->inactive = inactive;
- if ( inactive > ( objects_per_block + ( objects_per_block >> 1 ) ) ) {
- _Objects_Shrink_information( information );
+ /*
+ * Check if the threshold level has been met of
+ * 1.5 x objects_per_block are free.
+ */
+
+ if ( inactive > ( objects_per_block + ( objects_per_block >> 1 ) ) ) {
+ _Objects_Shrink_information( information );
+ }
}
}
}