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.
This commit is contained in:
Sebastian Huber
2014-06-12 10:00:39 +02:00
parent 82df6f347b
commit 46390027c7
2 changed files with 115 additions and 156 deletions
@@ -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(
Scheduler_Context *context,
Thread_Control *thread
);
static Scheduler_priority_SMP_Node *_Scheduler_priority_SMP_Node_downcast(
Scheduler_Node *node
)
{
return (Scheduler_priority_SMP_Node *) node;
}
void _Scheduler_priority_SMP_Insert_ready_lifo(
Scheduler_Context *context,
Thread_Control *thread
);
void _Scheduler_priority_SMP_Move_from_scheduled_to_ready(
static inline 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 );
void _Scheduler_priority_SMP_Move_from_ready_to_scheduled(
_Chain_Extract_unprotected( &scheduled_to_ready->Object.Node );
_Scheduler_priority_Ready_queue_enqueue_first(
scheduled_to_ready,
&node->Ready_queue,
&self->Bit_map
);
}
static inline 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 );
void _Scheduler_priority_SMP_Extract_from_ready(
_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
);
}
static inline 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 );
void _Scheduler_priority_SMP_Do_update(
_Scheduler_priority_Ready_queue_enqueue(
thread,
&node->Ready_queue,
&self->Bit_map
);
}
static inline 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
);
}
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
);
}
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 ]
);
}
/** @} */
-132
View File
@@ -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