summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-06-12 09:17:39 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-06-12 10:00:39 +0200
commit46390027c7e2e351de1a1627e5898d3bf902369a (patch)
tree2476f0650a5732f6367813456b66d8a40092ef39
parent82df6f347b9c6705684300248ff74784d58b2b86 (diff)
score: Make functions inline
These functions are used only via the function pointers in the generic SMP scheduler implementation. Provide them as static inline so that the compiler can optimize more easily.
-rw-r--r--cpukit/score/include/rtems/score/schedulerprioritysmpimpl.h137
-rw-r--r--cpukit/score/src/schedulerprioritysmp.c132
2 files changed, 114 insertions, 155 deletions
diff --git a/cpukit/score/include/rtems/score/schedulerprioritysmpimpl.h b/cpukit/score/include/rtems/score/schedulerprioritysmpimpl.h
index 2d8d1a5aed..a8196218c1 100644
--- a/cpukit/score/include/rtems/score/schedulerprioritysmpimpl.h
+++ b/cpukit/score/include/rtems/score/schedulerprioritysmpimpl.h
@@ -23,9 +23,9 @@
#ifndef _RTEMS_SCORE_SCHEDULERPRIORITYSMPIMPL_H
#define _RTEMS_SCORE_SCHEDULERPRIORITYSMPIMPL_H
-#include <rtems/score/scheduler.h>
-#include <rtems/score/schedulerpriority.h>
-#include <rtems/score/schedulersmp.h>
+#include <rtems/score/schedulerprioritysmp.h>
+#include <rtems/score/schedulerpriorityimpl.h>
+#include <rtems/score/schedulersimpleimpl.h>
#ifdef __cplusplus
extern "C" {
@@ -36,44 +36,135 @@ extern "C" {
* @{
*/
-Scheduler_priority_SMP_Context *_Scheduler_priority_SMP_Get_self(
+static inline Scheduler_priority_SMP_Context *_Scheduler_priority_SMP_Get_self(
Scheduler_Context *context
-);
+)
+{
+ return (Scheduler_priority_SMP_Context *) context;
+}
-Scheduler_priority_SMP_Node *_Scheduler_priority_SMP_Node_get(
+static inline Scheduler_priority_SMP_Node *_Scheduler_priority_SMP_Node_get(
Thread_Control *thread
-);
+)
+{
+ return (Scheduler_priority_SMP_Node *) _Scheduler_Node_get( thread );
+}
-void _Scheduler_priority_SMP_Insert_ready_fifo(
+static Scheduler_priority_SMP_Node *_Scheduler_priority_SMP_Node_downcast(
+ Scheduler_Node *node
+)
+{
+ return (Scheduler_priority_SMP_Node *) node;
+}
+
+static inline void _Scheduler_priority_SMP_Move_from_scheduled_to_ready(
Scheduler_Context *context,
- Thread_Control *thread
-);
+ Thread_Control *scheduled_to_ready
+)
+{
+ Scheduler_priority_SMP_Context *self =
+ _Scheduler_priority_SMP_Get_self( context );
+ Scheduler_priority_SMP_Node *node =
+ _Scheduler_priority_SMP_Node_get( scheduled_to_ready );
+
+ _Chain_Extract_unprotected( &scheduled_to_ready->Object.Node );
+ _Scheduler_priority_Ready_queue_enqueue_first(
+ scheduled_to_ready,
+ &node->Ready_queue,
+ &self->Bit_map
+ );
+}
-void _Scheduler_priority_SMP_Insert_ready_lifo(
+static inline void _Scheduler_priority_SMP_Move_from_ready_to_scheduled(
Scheduler_Context *context,
- Thread_Control *thread
-);
+ Thread_Control *ready_to_scheduled
+)
+{
+ Scheduler_priority_SMP_Context *self =
+ _Scheduler_priority_SMP_Get_self( context );
+ Scheduler_priority_SMP_Node *node =
+ _Scheduler_priority_SMP_Node_get( ready_to_scheduled );
+
+ _Scheduler_priority_Ready_queue_extract(
+ ready_to_scheduled,
+ &node->Ready_queue,
+ &self->Bit_map
+ );
+ _Scheduler_simple_Insert_priority_fifo(
+ &self->Base.Scheduled,
+ ready_to_scheduled
+ );
+}
-void _Scheduler_priority_SMP_Move_from_scheduled_to_ready(
+static inline void _Scheduler_priority_SMP_Insert_ready_lifo(
Scheduler_Context *context,
- Thread_Control *scheduled_to_ready
-);
+ Thread_Control *thread
+)
+{
+ Scheduler_priority_SMP_Context *self =
+ _Scheduler_priority_SMP_Get_self( context );
+ Scheduler_priority_SMP_Node *node =
+ _Scheduler_priority_SMP_Node_get( thread );
+
+ _Scheduler_priority_Ready_queue_enqueue(
+ thread,
+ &node->Ready_queue,
+ &self->Bit_map
+ );
+}
-void _Scheduler_priority_SMP_Move_from_ready_to_scheduled(
+static inline void _Scheduler_priority_SMP_Insert_ready_fifo(
Scheduler_Context *context,
- Thread_Control *ready_to_scheduled
-);
+ Thread_Control *thread
+)
+{
+ Scheduler_priority_SMP_Context *self =
+ _Scheduler_priority_SMP_Get_self( context );
+ Scheduler_priority_SMP_Node *node =
+ _Scheduler_priority_SMP_Node_get( thread );
+
+ _Scheduler_priority_Ready_queue_enqueue_first(
+ thread,
+ &node->Ready_queue,
+ &self->Bit_map
+ );
+}
-void _Scheduler_priority_SMP_Extract_from_ready(
+static inline void _Scheduler_priority_SMP_Extract_from_ready(
Scheduler_Context *context,
Thread_Control *thread
-);
+)
+{
+ Scheduler_priority_SMP_Context *self =
+ _Scheduler_priority_SMP_Get_self( context );
+ Scheduler_priority_SMP_Node *node =
+ _Scheduler_priority_SMP_Node_get( thread );
+
+ _Scheduler_priority_Ready_queue_extract(
+ thread,
+ &node->Ready_queue,
+ &self->Bit_map
+ );
+}
-void _Scheduler_priority_SMP_Do_update(
+static inline void _Scheduler_priority_SMP_Do_update(
Scheduler_Context *context,
Scheduler_Node *base_node,
Priority_Control new_priority
-);
+)
+{
+ Scheduler_priority_SMP_Context *self =
+ _Scheduler_priority_SMP_Get_self( context );
+ Scheduler_priority_SMP_Node *node =
+ _Scheduler_priority_SMP_Node_downcast( base_node );
+
+ _Scheduler_priority_Ready_queue_update(
+ &node->Ready_queue,
+ new_priority,
+ &self->Bit_map,
+ &self->Ready[ 0 ]
+ );
+}
/** @} */
diff --git a/cpukit/score/src/schedulerprioritysmp.c b/cpukit/score/src/schedulerprioritysmp.c
index 48da162fe1..96b1689f37 100644
--- a/cpukit/score/src/schedulerprioritysmp.c
+++ b/cpukit/score/src/schedulerprioritysmp.c
@@ -24,8 +24,6 @@
#include "config.h"
#endif
-#include <rtems/score/schedulerprioritysmp.h>
-#include <rtems/score/schedulerpriorityimpl.h>
#include <rtems/score/schedulerprioritysmpimpl.h>
#include <rtems/score/schedulersmpimpl.h>
@@ -35,27 +33,6 @@ _Scheduler_priority_SMP_Get_context( const Scheduler_Control *scheduler )
return (Scheduler_priority_SMP_Context *) _Scheduler_Get_context( scheduler );
}
-Scheduler_priority_SMP_Context *_Scheduler_priority_SMP_Get_self(
- Scheduler_Context *context
-)
-{
- return (Scheduler_priority_SMP_Context *) context;
-}
-
-Scheduler_priority_SMP_Node *_Scheduler_priority_SMP_Node_get(
- Thread_Control *thread
-)
-{
- return (Scheduler_priority_SMP_Node *) _Scheduler_Node_get( thread );
-}
-
-static Scheduler_priority_SMP_Node *_Scheduler_priority_SMP_Node_downcast(
- Scheduler_Node *node
-)
-{
- return (Scheduler_priority_SMP_Node *) node;
-}
-
void _Scheduler_priority_SMP_Initialize( const Scheduler_Control *scheduler )
{
Scheduler_priority_SMP_Context *self =
@@ -76,25 +53,6 @@ void _Scheduler_priority_SMP_Node_initialize(
_Scheduler_SMP_Node_initialize( node );
}
-void _Scheduler_priority_SMP_Do_update(
- Scheduler_Context *context,
- Scheduler_Node *base_node,
- Priority_Control new_priority
-)
-{
- Scheduler_priority_SMP_Context *self =
- _Scheduler_priority_SMP_Get_self( context );
- Scheduler_priority_SMP_Node *node =
- _Scheduler_priority_SMP_Node_downcast( base_node );
-
- _Scheduler_priority_Ready_queue_update(
- &node->Ready_queue,
- new_priority,
- &self->Bit_map,
- &self->Ready[ 0 ]
- );
-}
-
void _Scheduler_priority_SMP_Update_priority(
const Scheduler_Control *scheduler,
Thread_Control *thread,
@@ -123,96 +81,6 @@ static Thread_Control *_Scheduler_priority_SMP_Get_highest_ready(
);
}
-void _Scheduler_priority_SMP_Move_from_scheduled_to_ready(
- Scheduler_Context *context,
- Thread_Control *scheduled_to_ready
-)
-{
- Scheduler_priority_SMP_Context *self =
- _Scheduler_priority_SMP_Get_self( context );
- Scheduler_priority_SMP_Node *node =
- _Scheduler_priority_SMP_Node_get( scheduled_to_ready );
-
- _Chain_Extract_unprotected( &scheduled_to_ready->Object.Node );
- _Scheduler_priority_Ready_queue_enqueue_first(
- scheduled_to_ready,
- &node->Ready_queue,
- &self->Bit_map
- );
-}
-
-void _Scheduler_priority_SMP_Move_from_ready_to_scheduled(
- Scheduler_Context *context,
- Thread_Control *ready_to_scheduled
-)
-{
- Scheduler_priority_SMP_Context *self =
- _Scheduler_priority_SMP_Get_self( context );
- Scheduler_priority_SMP_Node *node =
- _Scheduler_priority_SMP_Node_get( ready_to_scheduled );
-
- _Scheduler_priority_Ready_queue_extract(
- ready_to_scheduled,
- &node->Ready_queue,
- &self->Bit_map
- );
- _Scheduler_simple_Insert_priority_fifo(
- &self->Base.Scheduled,
- ready_to_scheduled
- );
-}
-
-void _Scheduler_priority_SMP_Insert_ready_lifo(
- Scheduler_Context *context,
- Thread_Control *thread
-)
-{
- Scheduler_priority_SMP_Context *self =
- _Scheduler_priority_SMP_Get_self( context );
- Scheduler_priority_SMP_Node *node =
- _Scheduler_priority_SMP_Node_get( thread );
-
- _Scheduler_priority_Ready_queue_enqueue(
- thread,
- &node->Ready_queue,
- &self->Bit_map
- );
-}
-
-void _Scheduler_priority_SMP_Insert_ready_fifo(
- Scheduler_Context *context,
- Thread_Control *thread
-)
-{
- Scheduler_priority_SMP_Context *self =
- _Scheduler_priority_SMP_Get_self( context );
- Scheduler_priority_SMP_Node *node =
- _Scheduler_priority_SMP_Node_get( thread );
-
- _Scheduler_priority_Ready_queue_enqueue_first(
- thread,
- &node->Ready_queue,
- &self->Bit_map
- );
-}
-
-void _Scheduler_priority_SMP_Extract_from_ready(
- Scheduler_Context *context,
- Thread_Control *thread
-)
-{
- Scheduler_priority_SMP_Context *self =
- _Scheduler_priority_SMP_Get_self( context );
- Scheduler_priority_SMP_Node *node =
- _Scheduler_priority_SMP_Node_get( thread );
-
- _Scheduler_priority_Ready_queue_extract(
- thread,
- &node->Ready_queue,
- &self->Bit_map
- );
-}
-
void _Scheduler_priority_SMP_Block(
const Scheduler_Control *scheduler,
Thread_Control *thread