[PATCH 17/20] score: Optimize _Objects_Get_local()

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Apr 19 13:12:45 UTC 2016


Make the id the first parameter since usual callers get the object
identifier as the first parameter themself.
---
 cpukit/posix/include/rtems/posix/spinlockimpl.h | 2 +-
 cpukit/posix/include/rtems/posix/timerimpl.h    | 2 +-
 cpukit/rtems/include/rtems/rtems/ratemonimpl.h  | 2 +-
 cpukit/rtems/include/rtems/rtems/timerimpl.h    | 2 +-
 cpukit/score/include/rtems/score/objectimpl.h   | 7 ++++---
 cpukit/score/src/objectgetlocal.c               | 2 +-
 6 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/cpukit/posix/include/rtems/posix/spinlockimpl.h b/cpukit/posix/include/rtems/posix/spinlockimpl.h
index 0904050..c5aa343 100644
--- a/cpukit/posix/include/rtems/posix/spinlockimpl.h
+++ b/cpukit/posix/include/rtems/posix/spinlockimpl.h
@@ -85,8 +85,8 @@ RTEMS_INLINE_ROUTINE POSIX_Spinlock_Control *_POSIX_Spinlock_Get(
   }
 
   return (POSIX_Spinlock_Control *) _Objects_Get_local(
-    &_POSIX_Spinlock_Information,
     *spinlock,
+    &_POSIX_Spinlock_Information,
     lock_context
   );
 }
diff --git a/cpukit/posix/include/rtems/posix/timerimpl.h b/cpukit/posix/include/rtems/posix/timerimpl.h
index bf25629..95ccc4e 100644
--- a/cpukit/posix/include/rtems/posix/timerimpl.h
+++ b/cpukit/posix/include/rtems/posix/timerimpl.h
@@ -98,8 +98,8 @@ RTEMS_INLINE_ROUTINE POSIX_Timer_Control *_POSIX_Timer_Get (
 )
 {
   return (POSIX_Timer_Control *) _Objects_Get_local(
-    &_POSIX_Timer_Information,
     (Objects_Id) id,
+    &_POSIX_Timer_Information,
     lock_context
   );
 }
diff --git a/cpukit/rtems/include/rtems/rtems/ratemonimpl.h b/cpukit/rtems/include/rtems/rtems/ratemonimpl.h
index 28837a2..200ff80 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( &_Rate_monotonic_Information, id, lock_context );
+    _Objects_Get_local( id, &_Rate_monotonic_Information, lock_context );
 }
 
 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 40e2b5f..9a52762 100644
--- a/cpukit/rtems/include/rtems/rtems/timerimpl.h
+++ b/cpukit/rtems/include/rtems/rtems/timerimpl.h
@@ -88,8 +88,8 @@ RTEMS_INLINE_ROUTINE Timer_Control *_Timer_Get(
 )
 {
   return (Timer_Control *) _Objects_Get_local(
-    &_Timer_Information,
     id,
+    &_Timer_Information,
     lock_context
   );
 }
diff --git a/cpukit/score/include/rtems/score/objectimpl.h b/cpukit/score/include/rtems/score/objectimpl.h
index fb45977..776c871 100644
--- a/cpukit/score/include/rtems/score/objectimpl.h
+++ b/cpukit/score/include/rtems/score/objectimpl.h
@@ -629,9 +629,10 @@ Objects_Control *_Objects_Get_isr_disable(
  * an associated object exists, then interrupts remain disabled, otherwise the
  * previous interrupt state is restored.
  *
+ * @param id The object identifier.  This is the first parameter since usual
+ *   callers get the object identifier as the first parameter themself.
  * @param information The object class information block.
- * @param[in] id The object identifier.
- * @param[in] lock_context The interrupt lock context.
+ * @param lock_context The interrupt lock context.
  *
  * @retval NULL No associated object exists.
  * @retval other The pointer to the associated object control block.
@@ -639,8 +640,8 @@ Objects_Control *_Objects_Get_isr_disable(
  * context via _ISR_lock_ISR_enable() or _ISR_lock_Release_and_ISR_enable().
  */
 Objects_Control *_Objects_Get_local(
-  const Objects_Information *information,
   Objects_Id                 id,
+  const Objects_Information *information,
   ISR_lock_Context          *lock_context
 );
 
diff --git a/cpukit/score/src/objectgetlocal.c b/cpukit/score/src/objectgetlocal.c
index 8a93a76..1134095 100644
--- a/cpukit/score/src/objectgetlocal.c
+++ b/cpukit/score/src/objectgetlocal.c
@@ -26,8 +26,8 @@
 #include <rtems/score/objectimpl.h>
 
 Objects_Control *_Objects_Get_local(
-  const Objects_Information *information,
   Objects_Id                 id,
+  const Objects_Information *information,
   ISR_lock_Context          *lock_context
 )
 {
-- 
1.8.4.5




More information about the devel mailing list