Small optimizations.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6147 35acf78f-673a-0410-8e92-d51de3d6d3f4
master
gdisirio 2013-08-14 15:25:23 +00:00
parent 782415628b
commit 38e0ede2ba
4 changed files with 23 additions and 15 deletions

View File

@ -357,7 +357,7 @@
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_STATISTICS) || defined(__DOXYGEN__) #if !defined(CH_DBG_STATISTICS) || defined(__DOXYGEN__)
#define CH_DBG_STATISTICS TRUE #define CH_DBG_STATISTICS FALSE
#endif #endif
/** /**
@ -368,7 +368,7 @@
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_SYSTEM_STATE_CHECK) || defined(__DOXYGEN__) #if !defined(CH_DBG_SYSTEM_STATE_CHECK) || defined(__DOXYGEN__)
#define CH_DBG_SYSTEM_STATE_CHECK TRUE #define CH_DBG_SYSTEM_STATE_CHECK FALSE
#endif #endif
/** /**
@ -379,7 +379,7 @@
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_CHECKS) || defined(__DOXYGEN__) #if !defined(CH_DBG_ENABLE_CHECKS) || defined(__DOXYGEN__)
#define CH_DBG_ENABLE_CHECKS TRUE #define CH_DBG_ENABLE_CHECKS FALSE
#endif #endif
/** /**
@ -391,7 +391,7 @@
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_ASSERTS) || defined(__DOXYGEN__) #if !defined(CH_DBG_ENABLE_ASSERTS) || defined(__DOXYGEN__)
#define CH_DBG_ENABLE_ASSERTS TRUE #define CH_DBG_ENABLE_ASSERTS FALSE
#endif #endif
/** /**
@ -402,7 +402,7 @@
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_TRACE) || defined(__DOXYGEN__) #if !defined(CH_DBG_ENABLE_TRACE) || defined(__DOXYGEN__)
#define CH_DBG_ENABLE_TRACE TRUE #define CH_DBG_ENABLE_TRACE FALSE
#endif #endif
/** /**
@ -416,7 +416,7 @@
* @p panic_msg variable set to @p NULL. * @p panic_msg variable set to @p NULL.
*/ */
#if !defined(CH_DBG_ENABLE_STACK_CHECK) || defined(__DOXYGEN__) #if !defined(CH_DBG_ENABLE_STACK_CHECK) || defined(__DOXYGEN__)
#define CH_DBG_ENABLE_STACK_CHECK TRUE #define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif #endif
/** /**
@ -428,7 +428,7 @@
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_FILL_THREADS) || defined(__DOXYGEN__) #if !defined(CH_DBG_FILL_THREADS) || defined(__DOXYGEN__)
#define CH_DBG_FILL_THREADS TRUE #define CH_DBG_FILL_THREADS FALSE
#endif #endif
/** /**

View File

@ -113,8 +113,11 @@ void chCondSignalI(condition_variable_t *cp) {
chDbgCheckClassI(); chDbgCheckClassI();
chDbgCheck(cp != NULL); chDbgCheck(cp != NULL);
if (queue_notempty(&cp->c_queue)) if (queue_notempty(&cp->c_queue)) {
chSchReadyI(queue_fifo_remove(&cp->c_queue))->p_u.rdymsg = RDY_OK; thread_t *tp = queue_fifo_remove(&cp->c_queue);
tp->p_u.rdymsg = RDY_OK;
chSchReadyI(tp);
}
} }
/** /**

View File

@ -278,8 +278,10 @@ void chEvtSignalI(thread_t *tp, eventmask_t mask) {
if (((tp->p_state == CH_STATE_WTOREVT) && if (((tp->p_state == CH_STATE_WTOREVT) &&
((tp->p_epending & tp->p_u.ewmask) != 0)) || ((tp->p_epending & tp->p_u.ewmask) != 0)) ||
((tp->p_state == CH_STATE_WTANDEVT) && ((tp->p_state == CH_STATE_WTANDEVT) &&
((tp->p_epending & tp->p_u.ewmask) == tp->p_u.ewmask))) ((tp->p_epending & tp->p_u.ewmask) == tp->p_u.ewmask))) {
chSchReadyI(tp)->p_u.rdymsg = RDY_OK; tp->p_u.rdymsg = RDY_OK;
chSchReadyI(tp);
}
} }
/** /**

View File

@ -87,8 +87,7 @@ thread_t *chSchReadyI(thread_t *tp) {
thread_t *cp; thread_t *cp;
chDbgCheckClassI(); chDbgCheckClassI();
chDbgCheck(tp != NULL);
/* Integrity checks.*/
chDbgAssert((tp->p_state != CH_STATE_READY) && chDbgAssert((tp->p_state != CH_STATE_READY) &&
(tp->p_state != CH_STATE_FINAL), (tp->p_state != CH_STATE_FINAL),
"invalid state"); "invalid state");
@ -216,7 +215,7 @@ msg_t chSchGoSleepTimeoutS(tstate_t newstate, systime_t time) {
* priority. * priority.
* *
* @param[in] ntp the thread to be made ready * @param[in] ntp the thread to be made ready
* @param[in] msg message to the awakened thread * @param[in] msg the wakeup message
* *
* @sclass * @sclass
*/ */
@ -224,13 +223,17 @@ void chSchWakeupS(thread_t *ntp, msg_t msg) {
chDbgCheckClassS(); chDbgCheckClassS();
/* Storing the message to be retrieved by the target thread when it will
restart execution.*/
ntp->p_u.rdymsg = msg; ntp->p_u.rdymsg = msg;
/* If the waken thread has a not-greater priority than the current /* If the waken thread has a not-greater priority than the current
one then it is just inserted in the ready list else it made one then it is just inserted in the ready list else it made
running immediately and the invoking thread goes in the ready running immediately and the invoking thread goes in the ready
list instead.*/ list instead.*/
if (ntp->p_prio <= currp->p_prio) if (ntp->p_prio <= currp->p_prio) {
chSchReadyI(ntp); chSchReadyI(ntp);
}
else { else {
thread_t *otp = chSchReadyI(currp); thread_t *otp = chSchReadyI(currp);
setcurrp(ntp); setcurrp(ntp);