[rtems commit] score: Optimize _Objects_Get_local()

Sebastian Huber sebh at rtems.org
Mon May 2 11:47:36 UTC 2016


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Sun May  1 16:11:30 2016 +0200

score: Optimize _Objects_Get_local()

Make the interrupt lock context the second parameter to avoid register
moves.

---

 cpukit/posix/include/rtems/posix/barrierimpl.h   |  4 ++--
 cpukit/posix/include/rtems/posix/mqueueimpl.h    | 15 +--------------
 cpukit/posix/include/rtems/posix/semaphoreimpl.h |  4 ++--
 cpukit/posix/include/rtems/posix/spinlockimpl.h  |  4 ++--
 cpukit/posix/include/rtems/posix/timerimpl.h     |  4 ++--
 cpukit/posix/src/condget.c                       |  4 ++--
 cpukit/posix/src/prwlockinit.c                   |  4 ++--
 cpukit/rtems/include/rtems/rtems/barrierimpl.h   |  2 +-
 cpukit/rtems/include/rtems/rtems/dpmemimpl.h     |  2 +-
 cpukit/rtems/include/rtems/rtems/ratemonimpl.h   |  2 +-
 cpukit/rtems/include/rtems/rtems/timerimpl.h     |  4 ++--
 cpukit/score/include/rtems/score/objectimpl.h    |  8 +++++---
 cpukit/score/src/objectgetlocal.c                |  4 ++--
 cpukit/score/src/objectgetnameasstring.c         |  2 +-
 14 files changed, 26 insertions(+), 37 deletions(-)

diff --git a/cpukit/posix/include/rtems/posix/barrierimpl.h b/cpukit/posix/include/rtems/posix/barrierimpl.h
index 16ccdc5..f4c350e 100644
--- a/cpukit/posix/include/rtems/posix/barrierimpl.h
+++ b/cpukit/posix/include/rtems/posix/barrierimpl.h
@@ -84,8 +84,8 @@ RTEMS_INLINE_ROUTINE POSIX_Barrier_Control *_POSIX_Barrier_Get (
 {
   return (POSIX_Barrier_Control *) _Objects_Get_local(
     (Objects_Id) *barrier,
-    &_POSIX_Barrier_Information,
-    lock_context
+    lock_context,
+    &_POSIX_Barrier_Information
   );
 }
 
diff --git a/cpukit/posix/include/rtems/posix/mqueueimpl.h b/cpukit/posix/include/rtems/posix/mqueueimpl.h
index 491f716..9d13226 100644
--- a/cpukit/posix/include/rtems/posix/mqueueimpl.h
+++ b/cpukit/posix/include/rtems/posix/mqueueimpl.h
@@ -112,7 +112,7 @@ RTEMS_INLINE_ROUTINE POSIX_Message_queue_Control *_POSIX_Message_queue_Get(
 )
 {
   return (POSIX_Message_queue_Control *)
-    _Objects_Get_local( id, &_POSIX_Message_queue_Information, lock_context );
+    _Objects_Get_local( id, lock_context, &_POSIX_Message_queue_Information );
 }
 
 /*
@@ -164,19 +164,6 @@ RTEMS_INLINE_ROUTINE void _POSIX_Message_queue_Namespace_remove (
 }
 
 RTEMS_INLINE_ROUTINE POSIX_Message_queue_Control *
-_POSIX_Message_queue_Get_interrupt_disable(
-  mqd_t              id,
-  ISR_lock_Context  *lock_context
-)
-{
-  return (POSIX_Message_queue_Control *) _Objects_Get_local(
-    (Objects_Id) id,
-    &_POSIX_Message_queue_Information,
-    lock_context
-  );
-}
-
-RTEMS_INLINE_ROUTINE POSIX_Message_queue_Control *
 _POSIX_Message_queue_Get_by_name(
   const char                *name,
   size_t                    *name_length_p,
diff --git a/cpukit/posix/include/rtems/posix/semaphoreimpl.h b/cpukit/posix/include/rtems/posix/semaphoreimpl.h
index 6ec8480..a409044 100644
--- a/cpukit/posix/include/rtems/posix/semaphoreimpl.h
+++ b/cpukit/posix/include/rtems/posix/semaphoreimpl.h
@@ -67,8 +67,8 @@ RTEMS_INLINE_ROUTINE POSIX_Semaphore_Control *_POSIX_Semaphore_Get(
 {
   return (POSIX_Semaphore_Control *) _Objects_Get_local(
     (Objects_Id) *id,
-    &_POSIX_Semaphore_Information,
-    lock_context
+    lock_context,
+    &_POSIX_Semaphore_Information
   );
 }
 
diff --git a/cpukit/posix/include/rtems/posix/spinlockimpl.h b/cpukit/posix/include/rtems/posix/spinlockimpl.h
index c5aa343..80de3d1 100644
--- a/cpukit/posix/include/rtems/posix/spinlockimpl.h
+++ b/cpukit/posix/include/rtems/posix/spinlockimpl.h
@@ -86,8 +86,8 @@ RTEMS_INLINE_ROUTINE POSIX_Spinlock_Control *_POSIX_Spinlock_Get(
 
   return (POSIX_Spinlock_Control *) _Objects_Get_local(
     *spinlock,
-    &_POSIX_Spinlock_Information,
-    lock_context
+    lock_context,
+    &_POSIX_Spinlock_Information
   );
 }
 
diff --git a/cpukit/posix/include/rtems/posix/timerimpl.h b/cpukit/posix/include/rtems/posix/timerimpl.h
index 95ccc4e..5a6cf28 100644
--- a/cpukit/posix/include/rtems/posix/timerimpl.h
+++ b/cpukit/posix/include/rtems/posix/timerimpl.h
@@ -99,8 +99,8 @@ RTEMS_INLINE_ROUTINE POSIX_Timer_Control *_POSIX_Timer_Get (
 {
   return (POSIX_Timer_Control *) _Objects_Get_local(
     (Objects_Id) id,
-    &_POSIX_Timer_Information,
-    lock_context
+    lock_context,
+    &_POSIX_Timer_Information
   );
 }
 
diff --git a/cpukit/posix/src/condget.c b/cpukit/posix/src/condget.c
index e3cf59c..b89566a 100644
--- a/cpukit/posix/src/condget.c
+++ b/cpukit/posix/src/condget.c
@@ -53,7 +53,7 @@ POSIX_Condition_variables_Control *_POSIX_Condition_variables_Get(
 
   return (POSIX_Condition_variables_Control *) _Objects_Get_local(
     (Objects_Id) *cond,
-    &_POSIX_Condition_variables_Information,
-    lock_context
+    lock_context,
+    &_POSIX_Condition_variables_Information
   );
 }
diff --git a/cpukit/posix/src/prwlockinit.c b/cpukit/posix/src/prwlockinit.c
index 8bbb2fd..8847c17 100644
--- a/cpukit/posix/src/prwlockinit.c
+++ b/cpukit/posix/src/prwlockinit.c
@@ -63,8 +63,8 @@ POSIX_RWLock_Control *_POSIX_RWLock_Get(
 
   return (POSIX_RWLock_Control *) _Objects_Get_local(
     *rwlock,
-    &_POSIX_RWLock_Information,
-    lock_context
+    lock_context,
+    &_POSIX_RWLock_Information
   );
 }
 
diff --git a/cpukit/rtems/include/rtems/rtems/barrierimpl.h b/cpukit/rtems/include/rtems/rtems/barrierimpl.h
index 1598ce2..99ce276 100644
--- a/cpukit/rtems/include/rtems/rtems/barrierimpl.h
+++ b/cpukit/rtems/include/rtems/rtems/barrierimpl.h
@@ -75,7 +75,7 @@ RTEMS_INLINE_ROUTINE Barrier_Control *_Barrier_Get(
 )
 {
   return (Barrier_Control *)
-    _Objects_Get_local( id, &_Barrier_Information, lock_context );
+    _Objects_Get_local( id, lock_context, &_Barrier_Information );
 }
 
 /**
diff --git a/cpukit/rtems/include/rtems/rtems/dpmemimpl.h b/cpukit/rtems/include/rtems/rtems/dpmemimpl.h
index 1e96722..df51378 100644
--- a/cpukit/rtems/include/rtems/rtems/dpmemimpl.h
+++ b/cpukit/rtems/include/rtems/rtems/dpmemimpl.h
@@ -72,7 +72,7 @@ RTEMS_INLINE_ROUTINE Dual_ported_memory_Control *_Dual_ported_memory_Get(
 )
 {
   return (Dual_ported_memory_Control *)
-    _Objects_Get_local( id, &_Dual_ported_memory_Information, lock_context );
+    _Objects_Get_local( id, lock_context, &_Dual_ported_memory_Information );
 }
 
 /**@}*/
diff --git a/cpukit/rtems/include/rtems/rtems/ratemonimpl.h b/cpukit/rtems/include/rtems/rtems/ratemonimpl.h
index 200ff80..ac0c2c5 100644
--- a/cpukit/rtems/include/rtems/rtems/ratemonimpl.h
+++ b/cpukit/rtems/include/rtems/rtems/ratemonimpl.h
@@ -90,7 +90,7 @@ RTEMS_INLINE_ROUTINE Rate_monotonic_Control *_Rate_monotonic_Get(
 )
 {
   return (Rate_monotonic_Control *)
-    _Objects_Get_local( id, &_Rate_monotonic_Information, lock_context );
+    _Objects_Get_local( id, lock_context, &_Rate_monotonic_Information );
 }
 
 void _Rate_monotonic_Timeout( Watchdog_Control *watchdog );
diff --git a/cpukit/rtems/include/rtems/rtems/timerimpl.h b/cpukit/rtems/include/rtems/rtems/timerimpl.h
index 9a52762..5605be7 100644
--- a/cpukit/rtems/include/rtems/rtems/timerimpl.h
+++ b/cpukit/rtems/include/rtems/rtems/timerimpl.h
@@ -89,8 +89,8 @@ RTEMS_INLINE_ROUTINE Timer_Control *_Timer_Get(
 {
   return (Timer_Control *) _Objects_Get_local(
     id,
-    &_Timer_Information,
-    lock_context
+    lock_context,
+    &_Timer_Information
   );
 }
 
diff --git a/cpukit/score/include/rtems/score/objectimpl.h b/cpukit/score/include/rtems/score/objectimpl.h
index 2d9c374..1129daf 100644
--- a/cpukit/score/include/rtems/score/objectimpl.h
+++ b/cpukit/score/include/rtems/score/objectimpl.h
@@ -630,8 +630,10 @@ Objects_Control *_Objects_Get_isr_disable(
  *
  * @param id The object identifier.  This is the first parameter since usual
  *   callers get the object identifier as the first parameter themself.
+ * @param lock_context The interrupt lock context.  This is the second
+ *   parameter since usual callers get the interrupt lock context as the second
+ *   parameter themself.
  * @param information The object class information block.
- * @param lock_context The interrupt lock context.
  *
  * @retval NULL No associated object exists.
  * @retval other The pointer to the associated object control block.
@@ -640,8 +642,8 @@ Objects_Control *_Objects_Get_isr_disable(
  */
 Objects_Control *_Objects_Get_local(
   Objects_Id                 id,
-  const Objects_Information *information,
-  ISR_lock_Context          *lock_context
+  ISR_lock_Context          *lock_context,
+  const Objects_Information *information
 );
 
 /**
diff --git a/cpukit/score/src/objectgetlocal.c b/cpukit/score/src/objectgetlocal.c
index 1134095..2024b59 100644
--- a/cpukit/score/src/objectgetlocal.c
+++ b/cpukit/score/src/objectgetlocal.c
@@ -27,8 +27,8 @@
 
 Objects_Control *_Objects_Get_local(
   Objects_Id                 id,
-  const Objects_Information *information,
-  ISR_lock_Context          *lock_context
+  ISR_lock_Context          *lock_context,
+  const Objects_Information *information
 )
 {
   uint32_t index;
diff --git a/cpukit/score/src/objectgetnameasstring.c b/cpukit/score/src/objectgetnameasstring.c
index d73d8aa..f513774 100644
--- a/cpukit/score/src/objectgetnameasstring.c
+++ b/cpukit/score/src/objectgetnameasstring.c
@@ -56,7 +56,7 @@ char *_Objects_Get_name_as_string(
   if ( !information )
     return NULL;
 
-  the_object = _Objects_Get_local( tmpId, information, &lock_context );
+  the_object = _Objects_Get_local( tmpId, &lock_context, information );
   if ( the_object == NULL ) {
     return NULL;
   }



More information about the vc mailing list