score: Use non-inline thread queue lock ops

This reduces the code size and helps to reduce the amount of testing.
Hot paths can use the _Thread_queue_Queue_acquire_critical() and
_Thread_queue_Queue_release_critical() functions which are still inline.
This commit is contained in:
Sebastian Huber
2016-11-04 10:04:27 +01:00
parent 347ef92898
commit e7ab43d46f
2 changed files with 99 additions and 19 deletions

View File

@@ -358,20 +358,21 @@ RTEMS_INLINE_ROUTINE void _Thread_queue_Queue_release(
_ISR_lock_ISR_enable( lock_context ); _ISR_lock_ISR_enable( lock_context );
} }
#if defined(RTEMS_SMP)
void _Thread_queue_Do_acquire_critical(
Thread_queue_Control *the_thread_queue,
ISR_lock_Context *lock_context
);
#else
RTEMS_INLINE_ROUTINE void _Thread_queue_Do_acquire_critical( RTEMS_INLINE_ROUTINE void _Thread_queue_Do_acquire_critical(
Thread_queue_Control *the_thread_queue, Thread_queue_Control *the_thread_queue,
ISR_lock_Context *lock_context ISR_lock_Context *lock_context
) )
{ {
_Thread_queue_Queue_acquire_critical( (void) the_thread_queue;
&the_thread_queue->Queue, (void) lock_context;
&the_thread_queue->Lock_stats,
lock_context
);
#if defined(RTEMS_DEBUG) && defined(RTEMS_SMP)
the_thread_queue->owner = _SMP_Get_current_processor();
#endif
} }
#endif
RTEMS_INLINE_ROUTINE void _Thread_queue_Acquire_critical( RTEMS_INLINE_ROUTINE void _Thread_queue_Acquire_critical(
Thread_queue_Control *the_thread_queue, Thread_queue_Control *the_thread_queue,
@@ -384,14 +385,21 @@ RTEMS_INLINE_ROUTINE void _Thread_queue_Acquire_critical(
); );
} }
#if defined(RTEMS_SMP)
void _Thread_queue_Acquire(
Thread_queue_Control *the_thread_queue,
Thread_queue_Context *queue_context
);
#else
RTEMS_INLINE_ROUTINE void _Thread_queue_Acquire( RTEMS_INLINE_ROUTINE void _Thread_queue_Acquire(
Thread_queue_Control *the_thread_queue, Thread_queue_Control *the_thread_queue,
Thread_queue_Context *queue_context Thread_queue_Context *queue_context
) )
{ {
(void) the_thread_queue;
_ISR_lock_ISR_disable( &queue_context->Lock_context.Lock_context ); _ISR_lock_ISR_disable( &queue_context->Lock_context.Lock_context );
_Thread_queue_Acquire_critical( the_thread_queue, queue_context );
} }
#endif
#if defined(RTEMS_DEBUG) #if defined(RTEMS_DEBUG)
RTEMS_INLINE_ROUTINE bool _Thread_queue_Is_lock_owner( RTEMS_INLINE_ROUTINE bool _Thread_queue_Is_lock_owner(
@@ -406,22 +414,22 @@ RTEMS_INLINE_ROUTINE bool _Thread_queue_Is_lock_owner(
} }
#endif #endif
#if defined(RTEMS_SMP)
void _Thread_queue_Do_release_critical(
Thread_queue_Control *the_thread_queue,
ISR_lock_Context *lock_context
);
#else
RTEMS_INLINE_ROUTINE void _Thread_queue_Do_release_critical( RTEMS_INLINE_ROUTINE void _Thread_queue_Do_release_critical(
Thread_queue_Control *the_thread_queue, Thread_queue_Control *the_thread_queue,
ISR_lock_Context *lock_context ISR_lock_Context *lock_context
) )
{ {
#if defined(RTEMS_DEBUG) (void) the_thread_queue;
(void) lock_context;
_Assert( _Thread_queue_Is_lock_owner( the_thread_queue ) ); _Assert( _Thread_queue_Is_lock_owner( the_thread_queue ) );
#if defined(RTEMS_SMP)
the_thread_queue->owner = SMP_LOCK_NO_OWNER;
#endif
#endif
_Thread_queue_Queue_release_critical(
&the_thread_queue->Queue,
lock_context
);
} }
#endif
RTEMS_INLINE_ROUTINE void _Thread_queue_Release_critical( RTEMS_INLINE_ROUTINE void _Thread_queue_Release_critical(
Thread_queue_Control *the_thread_queue, Thread_queue_Control *the_thread_queue,
@@ -434,14 +442,22 @@ RTEMS_INLINE_ROUTINE void _Thread_queue_Release_critical(
); );
} }
#if defined(RTEMS_SMP)
void _Thread_queue_Release(
Thread_queue_Control *the_thread_queue,
Thread_queue_Context *queue_context
);
#else
RTEMS_INLINE_ROUTINE void _Thread_queue_Release( RTEMS_INLINE_ROUTINE void _Thread_queue_Release(
Thread_queue_Control *the_thread_queue, Thread_queue_Control *the_thread_queue,
Thread_queue_Context *queue_context Thread_queue_Context *queue_context
) )
{ {
_Thread_queue_Release_critical( the_thread_queue, queue_context ); (void) the_thread_queue;
_Assert( _Thread_queue_Is_lock_owner( the_thread_queue ) );
_ISR_lock_ISR_enable( &queue_context->Lock_context.Lock_context ); _ISR_lock_ISR_enable( &queue_context->Lock_context.Lock_context );
} }
#endif
Thread_Control *_Thread_queue_Do_dequeue( Thread_Control *_Thread_queue_Do_dequeue(
Thread_queue_Control *the_thread_queue, Thread_queue_Control *the_thread_queue,

View File

@@ -64,6 +64,70 @@ RTEMS_STATIC_ASSERT(
#endif /* HAVE_STRUCT__THREAD_QUEUE_QUEUE */ #endif /* HAVE_STRUCT__THREAD_QUEUE_QUEUE */
#if defined(RTEMS_SMP)
void _Thread_queue_Do_acquire_critical(
Thread_queue_Control *the_thread_queue,
ISR_lock_Context *lock_context
)
{
_Thread_queue_Queue_acquire_critical(
&the_thread_queue->Queue,
&the_thread_queue->Lock_stats,
lock_context
);
#if defined(RTEMS_DEBUG)
the_thread_queue->owner = _SMP_Get_current_processor();
#endif
}
void _Thread_queue_Acquire(
Thread_queue_Control *the_thread_queue,
Thread_queue_Context *queue_context
)
{
_ISR_lock_ISR_disable( &queue_context->Lock_context.Lock_context );
_Thread_queue_Queue_acquire_critical(
&the_thread_queue->Queue,
&the_thread_queue->Lock_stats,
&queue_context->Lock_context.Lock_context
);
#if defined(RTEMS_DEBUG)
the_thread_queue->owner = _SMP_Get_current_processor();
#endif
}
void _Thread_queue_Do_release_critical(
Thread_queue_Control *the_thread_queue,
ISR_lock_Context *lock_context
)
{
#if defined(RTEMS_DEBUG)
_Assert( _Thread_queue_Is_lock_owner( the_thread_queue ) );
the_thread_queue->owner = SMP_LOCK_NO_OWNER;
#endif
_Thread_queue_Queue_release_critical(
&the_thread_queue->Queue,
lock_context
);
}
void _Thread_queue_Release(
Thread_queue_Control *the_thread_queue,
Thread_queue_Context *queue_context
)
{
#if defined(RTEMS_DEBUG)
_Assert( _Thread_queue_Is_lock_owner( the_thread_queue ) );
the_thread_queue->owner = SMP_LOCK_NO_OWNER;
#endif
_Thread_queue_Queue_release_critical(
&the_thread_queue->Queue,
&queue_context->Lock_context.Lock_context
);
_ISR_lock_ISR_enable( &queue_context->Lock_context.Lock_context );
}
#endif
void _Thread_queue_Initialize( Thread_queue_Control *the_thread_queue ) void _Thread_queue_Initialize( Thread_queue_Control *the_thread_queue )
{ {
_Thread_queue_Queue_initialize( &the_thread_queue->Queue ); _Thread_queue_Queue_initialize( &the_thread_queue->Queue );