mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-26 14:18:20 +00:00
2009-08-01 Joel Sherrill <joel.sherrill@OARcorp.com>
* score/inline/rtems/score/heap.inl, score/src/heapresizeblock.c: Simplify routine.
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
2009-08-01 Joel Sherrill <joel.sherrill@OARcorp.com>
|
||||
|
||||
* score/inline/rtems/score/heap.inl, score/src/heapresizeblock.c:
|
||||
Simplify routine.
|
||||
|
||||
2009-08-01 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||
|
||||
* score/inline/rtems/score/heap.inl, score/src/heapwalk.c: Do not
|
||||
|
||||
@@ -238,10 +238,13 @@ RTEMS_INLINE_ROUTINE void _Heap_Align_up_uptr (
|
||||
uint32_t alignment
|
||||
)
|
||||
{
|
||||
_H_uptr_t remainder;
|
||||
_H_uptr_t v = *value;
|
||||
uint32_t a = alignment;
|
||||
_H_uptr_t r = v % a;
|
||||
*value = r ? v - r + a : v;
|
||||
|
||||
remainder = v % alignment;
|
||||
|
||||
if ( remainder )
|
||||
*value = v - remainder + alignment;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -117,6 +117,7 @@ Heap_Resize_status _Heap_Resize_block(
|
||||
uint32_t free_block_size = old_user_size - size;
|
||||
_Heap_Align_down(&free_block_size, page_size);
|
||||
|
||||
printk( "free=%d\n", free_block_size );
|
||||
if (free_block_size > 0) {
|
||||
|
||||
/* To free some memory the block should be shortened so that it can
|
||||
@@ -125,6 +126,8 @@ Heap_Resize_status _Heap_Resize_block(
|
||||
|
||||
uint32_t new_block_size = old_block_size - free_block_size;
|
||||
|
||||
printk( "new=%d min=%d hit=%s\n", new_block_size, min_block_size,
|
||||
((new_block_size < min_block_size) ? "yes" : "no") );
|
||||
if (new_block_size < min_block_size) {
|
||||
uint32_t delta = min_block_size - new_block_size;
|
||||
_HAssert(free_block_size >= delta);
|
||||
@@ -141,6 +144,8 @@ Heap_Resize_status _Heap_Resize_block(
|
||||
_HAssert(_Heap_Is_aligned(new_block_size, page_size));
|
||||
_HAssert(_Heap_Is_aligned(free_block_size, page_size));
|
||||
|
||||
printk( "next_is_used=%d free=%d min=%d hit=%s\n", next_is_used, free_block_size, min_block_size,
|
||||
((next_is_used) && (free_block_size <= min_block_size) ? "yes" : "no") );
|
||||
if (!next_is_used) {
|
||||
/* Extend the next block to the low addresses by 'free_block_size' */
|
||||
Heap_Block *const new_next_block =
|
||||
|
||||
Reference in New Issue
Block a user