diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2007-10-26 19:44:10 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2007-10-26 19:44:10 +0000 |
commit | 78dabb697cef81e6b77826c940d559fa49026a6d (patch) | |
tree | cabd3e3ee30209b1e48cb788ecb4f05441477c26 | |
parent | 2007-10-26 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-78dabb697cef81e6b77826c940d559fa49026a6d.tar.bz2 |
2007-10-26 Joel Sherrill <joel.sherrill@OARcorp.com>
* score/Makefile.am, score/include/rtems/score/thread.h,
score/inline/rtems/score/thread.inl: No longer inline _Thread_Get. It
resulted in unnessary code explosion, many uncovered paths when
looking at binary executable coverage, and only optimized getting
self. Id translations were still getting pushed to a subroutine call
to _Objects_Get. Later the non-inlined version can be further
optimized to get Ids in range for the current API, then self, then
look at other APIs.
* score/src/threadget.c: New file.
-rw-r--r-- | cpukit/ChangeLog | 12 | ||||
-rw-r--r-- | cpukit/score/Makefile.am | 2 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/thread.h | 21 | ||||
-rw-r--r-- | cpukit/score/inline/rtems/score/thread.inl | 60 | ||||
-rw-r--r-- | cpukit/score/src/threadget.c | 90 |
5 files changed, 124 insertions, 61 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index 89a22b3b1e..3869aa4d83 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,15 @@ +2007-10-26 Joel Sherrill <joel.sherrill@OARcorp.com> + + * score/Makefile.am, score/include/rtems/score/thread.h, + score/inline/rtems/score/thread.inl: No longer inline _Thread_Get. It + resulted in unnessary code explosion, many uncovered paths when + looking at binary executable coverage, and only optimized getting + self. Id translations were still getting pushed to a subroutine call + to _Objects_Get. Later the non-inlined version can be further + optimized to get Ids in range for the current API, then self, then + look at other APIs. + * score/src/threadget.c: New file. + 2007-10-26 Thomas Doerfler <Thomas.Doerfler@embedded-brains.de> * libi2c/README-libi2c diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am index ad3c68e87e..cdf975ea5c 100644 --- a/cpukit/score/Makefile.am +++ b/cpukit/score/Makefile.am @@ -126,7 +126,7 @@ libscore_a_SOURCES += src/pheapallocatealigned.c src/pheapallocate.c \ libscore_a_SOURCES += src/thread.c src/threadchangepriority.c \ src/threadclearstate.c src/threadclose.c src/threadcreateidle.c \ src/threaddelayended.c src/threaddispatch.c src/threadevaluatemode.c \ - src/threadhandler.c src/threadidlebody.c \ + src/threadget.c src/threadhandler.c src/threadidlebody.c \ src/threadinitialize.c src/threadloadenv.c src/threadready.c \ src/threadresettimeslice.c src/threadreset.c src/threadrestart.c \ src/threadresume.c src/threadrotatequeue.c src/threadsetpriority.c \ diff --git a/cpukit/score/include/rtems/score/thread.h b/cpukit/score/include/rtems/score/thread.h index 1d8ba50705..53d3f54a4a 100644 --- a/cpukit/score/include/rtems/score/thread.h +++ b/cpukit/score/include/rtems/score/thread.h @@ -756,6 +756,27 @@ void rtems_iterate_over_all_threads( rtems_per_thread_routine routine ); +/** + * This function maps thread IDs to thread control + * blocks. If ID corresponds to a local thread, then it + * returns the_thread control pointer which maps to ID + * and location is set to OBJECTS_LOCAL. If the thread ID is + * global and resides on a remote node, then location is set + * to OBJECTS_REMOTE, and the_thread is undefined. + * Otherwise, location is set to OBJECTS_ERROR and + * the_thread is undefined. + * + * @note The performance of many RTEMS services depends upon + * the quick execution of the "good object" path in this + * routine. If there is a possibility of saving a few + * cycles off the execution time, this routine is worth + * further optimization attention. + */ +Thread_Control *_Thread_Get ( + Objects_Id id, + Objects_Locations *location +); + #ifndef __RTEMS_APPLICATION__ #include <rtems/score/thread.inl> #endif diff --git a/cpukit/score/inline/rtems/score/thread.inl b/cpukit/score/inline/rtems/score/thread.inl index dbd95c6ca3..dad95990d4 100644 --- a/cpukit/score/inline/rtems/score/thread.inl +++ b/cpukit/score/inline/rtems/score/thread.inl @@ -254,66 +254,6 @@ RTEMS_INLINE_ROUTINE boolean _Thread_Is_null ( return ( the_thread == NULL ); } -/** - * This function maps thread IDs to thread control - * blocks. If ID corresponds to a local thread, then it - * returns the_thread control pointer which maps to ID - * and location is set to OBJECTS_LOCAL. If the thread ID is - * global and resides on a remote node, then location is set - * to OBJECTS_REMOTE, and the_thread is undefined. - * Otherwise, location is set to OBJECTS_ERROR and - * the_thread is undefined. - * - * @note The performance of many RTEMS services depends upon - * the quick execution of the "good object" path in this - * routine. If there is a possibility of saving a few - * cycles off the execution time, this routine is worth - * further optimization attention. - */ - -RTEMS_INLINE_ROUTINE Thread_Control *_Thread_Get ( - Objects_Id id, - Objects_Locations *location -) -{ - uint32_t the_api; - uint32_t the_class; - Objects_Information *information; - Thread_Control *tp = (Thread_Control *) 0; - - if ( _Objects_Are_ids_equal( id, OBJECTS_ID_OF_SELF ) ) { - _Thread_Disable_dispatch(); - *location = OBJECTS_LOCAL; - tp = _Thread_Executing; - goto done; - } - - the_api = _Objects_Get_API( id ); - if ( the_api && the_api > OBJECTS_APIS_LAST ) { - *location = OBJECTS_ERROR; - goto done; - } - - the_class = _Objects_Get_class( id ); - if ( the_class != 1 ) { /* threads are always first class :) */ - *location = OBJECTS_ERROR; - goto done; - } - - information = _Objects_Information_table[ the_api ][ the_class ]; - - if ( !information ) { - *location = OBJECTS_ERROR; - goto done; - } - - tp = (Thread_Control *) _Objects_Get( information, id, location ); - -done: - return tp; -} - - /** @brief _Thread_Is_proxy_blocking * * status which indicates that a proxy is blocking, and FALSE otherwise. diff --git a/cpukit/score/src/threadget.c b/cpukit/score/src/threadget.c new file mode 100644 index 0000000000..76ccf74091 --- /dev/null +++ b/cpukit/score/src/threadget.c @@ -0,0 +1,90 @@ +/* + * Thread Handler + * + * + * COPYRIGHT (c) 1989-1999. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#if HAVE_CONFIG_H +#include "config.h" +#endif + +#include <rtems/system.h> +#include <rtems/score/apiext.h> +#include <rtems/score/context.h> +#include <rtems/score/interr.h> +#include <rtems/score/isr.h> +#include <rtems/score/object.h> +#include <rtems/score/priority.h> +#include <rtems/score/states.h> +#include <rtems/score/sysstate.h> +#include <rtems/score/thread.h> +#include <rtems/score/threadq.h> + + +/** + * This function maps thread IDs to thread control + * blocks. If ID corresponds to a local thread, then it + * returns the_thread control pointer which maps to ID + * and location is set to OBJECTS_LOCAL. If the thread ID is + * global and resides on a remote node, then location is set + * to OBJECTS_REMOTE, and the_thread is undefined. + * Otherwise, location is set to OBJECTS_ERROR and + * the_thread is undefined. + * + * @note The performance of many RTEMS services depends upon + * the quick execution of the "good object" path in this + * routine. If there is a possibility of saving a few + * cycles off the execution time, this routine is worth + * further optimization attention. + */ + +Thread_Control *_Thread_Get ( + Objects_Id id, + Objects_Locations *location +) +{ + uint32_t the_api; + uint32_t the_class; + Objects_Information *information; + Thread_Control *tp = (Thread_Control *) 0; + + if ( _Objects_Are_ids_equal( id, OBJECTS_ID_OF_SELF ) ) { + _Thread_Disable_dispatch(); + *location = OBJECTS_LOCAL; + tp = _Thread_Executing; + goto done; + } + + the_api = _Objects_Get_API( id ); + if ( the_api && the_api > OBJECTS_APIS_LAST ) { + *location = OBJECTS_ERROR; + goto done; + } + + the_class = _Objects_Get_class( id ); + if ( the_class != 1 ) { /* threads are always first class :) */ + *location = OBJECTS_ERROR; + goto done; + } + + information = _Objects_Information_table[ the_api ][ the_class ]; + + if ( !information ) { + *location = OBJECTS_ERROR; + goto done; + } + + tp = (Thread_Control *) _Objects_Get( information, id, location ); + +done: + return tp; +} + |