[rtems commit] score: Inline _API_extensions_Run_postswitch()

Sebastian Huber sebh at rtems.org
Thu Nov 22 15:31:31 UTC 2012


Module:    rtems
Branch:    master
Commit:    74d22fd1a9633efe12a7a9c6b7662d80c0185f87
Changeset: http://git.rtems.org/rtems/commit/?id=74d22fd1a9633efe12a7a9c6b7662d80c0185f87

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Nov 22 13:03:09 2012 +0100

score: Inline _API_extensions_Run_postswitch()

The _API_extensions_Run_postswitch() function is only used in
_Thread_Dispatch().   Avoid superfluous load of _Thread_Executing.

---

 cpukit/score/include/rtems/score/apiext.h |   16 +++++++++++++++-
 cpukit/score/src/apiext.c                 |   19 -------------------
 cpukit/score/src/threaddispatch.c         |    2 +-
 3 files changed, 16 insertions(+), 21 deletions(-)

diff --git a/cpukit/score/include/rtems/score/apiext.h b/cpukit/score/include/rtems/score/apiext.h
index 514e4ba..afd828c 100644
--- a/cpukit/score/include/rtems/score/apiext.h
+++ b/cpukit/score/include/rtems/score/apiext.h
@@ -130,7 +130,21 @@ void _API_extensions_Run_postdriver( void );
  *
  *  This routine executes all of the post context switch callouts.
  */
-void _API_extensions_Run_postswitch( void );
+static inline void _API_extensions_Run_postswitch( Thread_Control *executing )
+{
+  const Chain_Control *chain = &_API_extensions_List;
+  const Chain_Node    *tail = _Chain_Immutable_tail( chain );
+  const Chain_Node    *node = _Chain_Immutable_first( chain );
+
+  while ( node != tail ) {
+    const API_extensions_Control *extension =
+      (const API_extensions_Control *) node;
+
+    (*extension->postswitch_hook)( executing );
+
+    node = _Chain_Immutable_next( node );
+  }
+}
 
 /**@}*/
 
diff --git a/cpukit/score/src/apiext.c b/cpukit/score/src/apiext.c
index 51b9451..b2ca87c 100644
--- a/cpukit/score/src/apiext.c
+++ b/cpukit/score/src/apiext.c
@@ -84,23 +84,4 @@ void _API_extensions_Run_postdriver( void )
   }
 }
 
-/*
- *  _API_extensions_Run_postswitch
- */
-
-void _API_extensions_Run_postswitch( void )
-{
-  Chain_Node             *the_node;
-  API_extensions_Control *the_extension;
-
-  for ( the_node = _Chain_First( &_API_extensions_List );
-        !_Chain_Is_tail( &_API_extensions_List, the_node ) ;
-        the_node = the_node->next ) {
-
-    the_extension = (API_extensions_Control *) the_node;
-
-    (*the_extension->postswitch_hook)( _Thread_Executing );
-  }
-}
-
 /* end of file */
diff --git a/cpukit/score/src/threaddispatch.c b/cpukit/score/src/threaddispatch.c
index db1f104..f3d67b4 100644
--- a/cpukit/score/src/threaddispatch.c
+++ b/cpukit/score/src/threaddispatch.c
@@ -211,5 +211,5 @@ post_switch:
     _Thread_Unnest_dispatch();
   #endif
 
-  _API_extensions_Run_postswitch();
+  _API_extensions_Run_postswitch( executing );
 }




More information about the vc mailing list