[PATCH 1/2] score: Do not inline _RBTree_Find_unprotected()
Sebastian Huber
sebastian.huber at embedded-brains.de
Sat Dec 22 17:00:58 UTC 2012
This function is too big to inline. It leads also to test case
explosion.
---
cpukit/score/include/rtems/score/rbtree.h | 14 ++++++++++++
cpukit/score/inline/rtems/score/rbtree.inl | 33 ----------------------------
cpukit/score/src/rbtreefind.c | 24 ++++++++++++++++++++
3 files changed, 38 insertions(+), 33 deletions(-)
diff --git a/cpukit/score/include/rtems/score/rbtree.h b/cpukit/score/include/rtems/score/rbtree.h
index 5a03d7c..dedc182 100644
--- a/cpukit/score/include/rtems/score/rbtree.h
+++ b/cpukit/score/include/rtems/score/rbtree.h
@@ -222,6 +222,20 @@ RBTree_Node *_RBTree_Get(
RBTree_Direction dir
);
+/** @brief Find the node with given key in the tree
+ *
+ * This function returns a pointer to the node in @a the_rbtree
+ * having key equal to key of @a the_node if it exists,
+ * and NULL if not. @a the_node has to be made up before a search.
+ *
+ * @note If the tree is not unique and contains duplicate keys, the set
+ * of duplicate keys acts as FIFO.
+ */
+RBTree_Node *_RBTree_Find_unprotected(
+ RBTree_Control *the_rbtree,
+ RBTree_Node *the_node
+);
+
/**
* @brief Find the node with given key in the tree
*
diff --git a/cpukit/score/inline/rtems/score/rbtree.inl b/cpukit/score/inline/rtems/score/rbtree.inl
index 439b40a..e25e3df 100644
--- a/cpukit/score/inline/rtems/score/rbtree.inl
+++ b/cpukit/score/inline/rtems/score/rbtree.inl
@@ -341,39 +341,6 @@ RTEMS_INLINE_ROUTINE bool _RBTree_Is_lesser(
return compare_result < 0;
}
-/** @brief Find the node with given key in the tree
- *
- * This function returns a pointer to the node in @a the_rbtree
- * having key equal to key of @a the_node if it exists,
- * and NULL if not. @a the_node has to be made up before a search.
- *
- * @note If the tree is not unique and contains duplicate keys, the set
- * of duplicate keys acts as FIFO.
- */
-RTEMS_INLINE_ROUTINE RBTree_Node *_RBTree_Find_unprotected(
- RBTree_Control *the_rbtree,
- RBTree_Node *the_node
- )
-{
- RBTree_Node* iter_node = the_rbtree->root;
- RBTree_Node* found = NULL;
- int compare_result;
- while (iter_node) {
- compare_result = the_rbtree->compare_function(the_node, iter_node);
- if ( _RBTree_Is_equal( compare_result ) ) {
- found = iter_node;
- if ( the_rbtree->is_unique )
- break;
- }
-
- RBTree_Direction dir =
- (RBTree_Direction) _RBTree_Is_greater( compare_result );
- iter_node = iter_node->child[dir];
- } /* while(iter_node) */
-
- return found;
-}
-
/**
* @brief Returns the predecessor of a node.
*
diff --git a/cpukit/score/src/rbtreefind.c b/cpukit/score/src/rbtreefind.c
index 2e8cdc3..3f205ab 100644
--- a/cpukit/score/src/rbtreefind.c
+++ b/cpukit/score/src/rbtreefind.c
@@ -36,3 +36,27 @@ RBTree_Node *_RBTree_Find(
_ISR_Enable( level );
return return_node;
}
+
+RBTree_Node *_RBTree_Find_unprotected(
+ RBTree_Control *the_rbtree,
+ RBTree_Node *the_node
+)
+{
+ RBTree_Node* iter_node = the_rbtree->root;
+ RBTree_Node* found = NULL;
+ int compare_result;
+ while (iter_node) {
+ compare_result = the_rbtree->compare_function(the_node, iter_node);
+ if ( _RBTree_Is_equal( compare_result ) ) {
+ found = iter_node;
+ if ( the_rbtree->is_unique )
+ break;
+ }
+
+ RBTree_Direction dir =
+ (RBTree_Direction) _RBTree_Is_greater( compare_result );
+ iter_node = iter_node->child[dir];
+ } /* while(iter_node) */
+
+ return found;
+}
--
1.7.10.4
More information about the devel
mailing list