diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-10-25 16:00:17 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-11-06 09:06:21 +0100 |
commit | 0c286e3d7c176a4fb7faf6ba9f809996d599ca10 (patch) | |
tree | bf30809e9a4f92d19254fa1acb1f833effa8dc40 /cpukit/score/include/rtems/score/schedulersimpleimpl.h | |
parent | score: Remove superfluous include (diff) | |
download | rtems-0c286e3d7c176a4fb7faf6ba9f809996d599ca10.tar.bz2 |
score: _Chain_Insert_ordered_unprotected()
Change the chain order relation to use a directly specified left hand
side value. This is similar to _RBTree_Insert_inline() and helps the
compiler to better optimize the code.
Diffstat (limited to 'cpukit/score/include/rtems/score/schedulersimpleimpl.h')
-rw-r--r-- | cpukit/score/include/rtems/score/schedulersimpleimpl.h | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/cpukit/score/include/rtems/score/schedulersimpleimpl.h b/cpukit/score/include/rtems/score/schedulersimpleimpl.h index c94f9b3bdb..ec74cdc586 100644 --- a/cpukit/score/include/rtems/score/schedulersimpleimpl.h +++ b/cpukit/score/include/rtems/score/schedulersimpleimpl.h @@ -39,49 +39,63 @@ RTEMS_INLINE_ROUTINE Scheduler_simple_Context * } RTEMS_INLINE_ROUTINE bool _Scheduler_simple_Insert_priority_lifo_order( - const Chain_Node *to_insert, + const void *to_insert, const Chain_Node *next ) { - const Thread_Control *thread_to_insert = (const Thread_Control *) to_insert; - const Thread_Control *thread_next = (const Thread_Control *) next; + const Priority_Control *priority_to_insert; + const Thread_Control *thread_next; - return _Thread_Get_priority( thread_to_insert ) - <= _Thread_Get_priority( thread_next ); + priority_to_insert = (const Priority_Control *) to_insert; + thread_next = (const Thread_Control *) next; + + return *priority_to_insert <= _Thread_Get_priority( thread_next ); } RTEMS_INLINE_ROUTINE bool _Scheduler_simple_Insert_priority_fifo_order( - const Chain_Node *to_insert, + const void *to_insert, const Chain_Node *next ) { - const Thread_Control *thread_to_insert = (const Thread_Control *) to_insert; - const Thread_Control *thread_next = (const Thread_Control *) next; + const Priority_Control *priority_to_insert; + const Thread_Control *thread_next; + + priority_to_insert = (const Priority_Control *) to_insert; + thread_next = (const Thread_Control *) next; - return _Thread_Get_priority( thread_to_insert ) - < _Thread_Get_priority( thread_next ); + return *priority_to_insert < _Thread_Get_priority( thread_next ); } RTEMS_INLINE_ROUTINE void _Scheduler_simple_Insert_priority_lifo( - Chain_Control *chain, + Chain_Control *chain, Thread_Control *to_insert ) { + Priority_Control priority_to_insert; + + priority_to_insert = _Thread_Get_priority( to_insert ); + _Chain_Insert_ordered_unprotected( chain, &to_insert->Object.Node, + &priority_to_insert, _Scheduler_simple_Insert_priority_lifo_order ); } RTEMS_INLINE_ROUTINE void _Scheduler_simple_Insert_priority_fifo( - Chain_Control *chain, + Chain_Control *chain, Thread_Control *to_insert ) { + Priority_Control priority_to_insert; + + priority_to_insert = _Thread_Get_priority( to_insert ); + _Chain_Insert_ordered_unprotected( chain, &to_insert->Object.Node, + &priority_to_insert, _Scheduler_simple_Insert_priority_fifo_order ); } |