summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-08-01 15:58:59 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-08-01 15:58:59 +0000
commit894bbbc4f2da0b2157756ba6cdd9063b1c826c80 (patch)
tree9fb38035e2aeb526872e9c4ffa43a1aad886d83e
parent2009-08-01 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-894bbbc4f2da0b2157756ba6cdd9063b1c826c80.tar.bz2
2009-08-01 Joel Sherrill <joel.sherrill@oarcorp.com>
* score/inline/rtems/score/heap.inl, score/src/heapwalk.c: Do not inline code to check if newline should be printed. It leads to branch path explosion which is really hard to get coverage on.
-rw-r--r--cpukit/ChangeLog6
-rw-r--r--cpukit/score/inline/rtems/score/heap.inl12
-rw-r--r--cpukit/score/src/heapwalk.c34
3 files changed, 47 insertions, 5 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog
index 9ee4f273ec..e280454167 100644
--- a/cpukit/ChangeLog
+++ b/cpukit/ChangeLog
@@ -1,3 +1,9 @@
+2009-08-01 Joel Sherrill <joel.sherrill@oarcorp.com>
+
+ * score/inline/rtems/score/heap.inl, score/src/heapwalk.c: Do not
+ inline code to check if newline should be printed. It leads to branch
+ path explosion which is really hard to get coverage on.
+
2009-07-31 Joel Sherrill <joel.sherrill@OARcorp.com>
* score/src/heapgetinfo.c: Simplify implementation.
diff --git a/cpukit/score/inline/rtems/score/heap.inl b/cpukit/score/inline/rtems/score/heap.inl
index b8bb124423..24be426926 100644
--- a/cpukit/score/inline/rtems/score/heap.inl
+++ b/cpukit/score/inline/rtems/score/heap.inl
@@ -240,8 +240,16 @@ RTEMS_INLINE_ROUTINE void _Heap_Align_up_uptr (
{
_H_uptr_t v = *value;
uint32_t a = alignment;
- _H_uptr_t r = v % a;
- *value = r ? v - r + a : v;
+
+ if ( v % alignment )
+ *value = v - r + a;
+
+/*
+ else
+ *value = v;
+*/
+
+ /* *value = r ? v - r + a : v; */
}
/**
diff --git a/cpukit/score/src/heapwalk.c b/cpukit/score/src/heapwalk.c
index cdf6a54670..69782bf4e8 100644
--- a/cpukit/score/src/heapwalk.c
+++ b/cpukit/score/src/heapwalk.c
@@ -22,6 +22,22 @@
#include <rtems/score/interr.h>
#include <rtems/bspIo.h>
+#if defined(__GNUC__)
+ #define DO_NOT_INLINE __attribute__((__noinline__))
+#else
+ #define DO_NOT_INLINE
+#endif
+/*
+ * Helper to avoid introducing even more branches and paths in this
+ * code to do coverage analysis on.
+ *
+ * We do not want this inlined.
+ */
+static void hw_nl(
+ int error,
+ bool do_dump
+) DO_NOT_INLINE;
+
/*PAGE
*
* _Heap_Walk
@@ -113,7 +129,8 @@ bool _Heap_Walk(
error = 1;
}
if (!prev_used) {
- if (do_dump || error) printk("\n");
+
+ hw_nl(do_dump, error);
printk("PASS: %d !two consecutive blocks are free", source);
error = 1;
}
@@ -141,14 +158,14 @@ bool _Heap_Walk(
block = block->next;
}
if (block != the_block) {
- if (do_dump || error) printk("\n");
+ hw_nl(do_dump, error);
printk("PASS: %d !the_block not in the free list", source);
error = 1;
}
}
}
- if (do_dump || error) printk("\n");
+ hw_nl(do_dump, error);
if (the_size < the_heap->min_block_size) {
printk("PASS: %d !block size is too small\n", source);
@@ -184,3 +201,14 @@ bool _Heap_Walk(
return error;
}
+
+/*
+ * This method exists to simplify branch paths in the generated code above.
+ */
+static void hw_nl(
+ int error,
+ bool do_dump
+)
+{
+ if (do_dump || error) printk("\n");
+}