Browse Source

extra merge

Ioannis Koutras 12 years ago
parent
commit
f5a26aa13d

+ 0 - 3
CMakeLists.txt

@@ -38,9 +38,6 @@ endif (WITH_DOC)
 message(STATUS "********************************************")
 message(STATUS "********** ${PROJECT_NAME} build options : **********")
 message(STATUS "OS call for memory requests: " ${WITH_SYSTEM_CALLS})
-if(NOT WITH_SYSTEM_CALLS STREQUAL "none")
-  message(STATUS "Requesting blocks multiple of: " ${SYS_ALLOC_SIZE} " bytes")
-endif(NOT WITH_SYSTEM_CALLS STREQUAL "none")
 message(STATUS "POSIX locking mechanisms: " ${HAVE_LOCKS})
 
 message(STATUS "Raw blocks type: " ${RAW_BLOCKS_TYPE})

+ 6 - 3
DefineOptions.cmake

@@ -37,18 +37,21 @@ option(LEON3 "Build for Leon3" OFF)
 option(LINUXTEST "Build a case for Linux" ON) 
 
 if (P2012)
-  set(WITH_SINGLE_ALLOCATOR OFF)
+  set(WITH_SYSTEM_CALLS "none")
   set(HAVE_LOCKS OFF)
   set(WITH_STATIC_LIB ON)
-  set(NUM_POOLS 1)
+  set(SORT_POLICY "lifo")
   set(LINUXTEST OFF)
   set(WITH_COALESCING "never")
   set(WITH_SPLITTING "never")
   set(BLOCKS_ORGANIZATION "sll")
+  set(STATS "none")
+  set(TRACE_LEVEL 0)
+  set(WITH_DEBUG OFF)
 endif (P2012)
 
 if (LEON3)
-  set(WITH_SINGLE_ALLOCATOR OFF)
+  set(WITH_SYSTEM_CALLS "none")
   set(HAVE_LOCKS OFF)
   set(WITH_STATIC_LIB ON)
   set(NUM_POOLS 1)

+ 2 - 0
include/dmmlib/CMakeLists.txt

@@ -11,6 +11,8 @@ if(RAW_BLOCKS_TYPE STREQUAL "freelist")
   set(dmmlib_HDRS
     ${dmmlib_HDRS}
     freelist/initialize.h
+    freelist/freelist.h
+    freelist/freelist_rb.h
     )
 endif(RAW_BLOCKS_TYPE STREQUAL "freelist")
 

private-include/freelist/block_header.h → include/dmmlib/freelist/block_header.h


+ 1 - 1
private-include/freelist/freelist.h

@@ -25,7 +25,7 @@
 #define FREELIST_H
 #include "dmm_config.h"
 
-#include "freelist/freelist_rb.h"
+#include "dmmlib/freelist/freelist_rb.h"
 
 #ifdef FL_RB_ONLY
 

+ 1 - 1
private-include/freelist/freelist_rb.h

@@ -24,7 +24,7 @@
 
 #ifndef FREELIST_RB_H
 #define FREELIST_RB_H
-#include "freelist/block_header.h"
+#include "dmmlib/freelist/block_header.h"
 
 /** Data structure of the required elements for a free-list organized raw block.
  */

include/freelist/initialize.h → include/dmmlib/freelist/initialize.h


+ 2 - 0
include/dmmlib/raw_block.h

@@ -26,6 +26,8 @@
 #define RAW_BLOCK_H
 #include "dmm_config.h"
 
+#include <stddef.h>
+
 #ifdef WITH_RAWBLOCK_STATS
 #include <dmmlib/dmmstats.h>
 #endif /* WITH_RAWBLOCK_STATS */

+ 2 - 0
private-include/bitmap/bitmap_rb.h

@@ -47,7 +47,9 @@ typedef struct bitmap_rb_s {
 /** Chunk header data structure */
 typedef struct chunk_header_s {
     size_t num_of_cells; /**< The number of occupied cells. */
+#ifdef REQUEST_SIZE_INFO
     size_t requested_size; /**< The requested size. */
+#endif /* REQUEST_SIZE_INFO */
 } chunk_header_t;
 
 /** The size of the chunk header in bitmap-organised raw blocks */

+ 2 - 2
private-include/freelist/block_header_funcs.h

@@ -25,8 +25,8 @@
 #ifndef BLOCK_HEADER_FUNCS_H
 #define BLOCK_HEADER_FUNCS_H
 
-#include "freelist/block_header.h"
-#include "freelist/freelist_rb.h"
+#include "dmmlib/freelist/block_header.h"
+#include "dmmlib/freelist/freelist_rb.h"
 
 /**
  * \brief Get the address of the block header of a memory block.

+ 2 - 2
private-include/freelist/coalesce.h

@@ -19,8 +19,8 @@
 #define COALESCE_H
 #include "dmm_config.h"
 
-#include "freelist/freelist_rb.h"
-#include "freelist/block_header.h"
+#include "dmmlib/freelist/freelist_rb.h"
+#include "dmmlib/freelist/block_header.h"
 
 /**
  * Tries to merges a memory block with its previous one and/or the next one.

+ 1 - 1
private-include/freelist/freelist_debug.h

@@ -26,7 +26,7 @@
 #define FREELIST_DEBUG_H
 #include "dmm_config.h"
 
-#include "freelist/freelist_rb.h"
+#include "dmmlib/freelist/freelist_rb.h"
 
 void get_memory_blocks(freelist_rb_t *raw_block);
 

+ 2 - 2
private-include/freelist/linked_lists/lifo_order.h

@@ -26,8 +26,8 @@
 #ifndef LIFO_ORDER_H
 #define LIFO_ORDER_H
 #include "dmm_config.h"
-#include "freelist/freelist_rb.h"
-#include "freelist/block_header.h"
+#include "dmmlib/freelist/freelist_rb.h"
+#include "dmmlib/freelist/block_header.h"
 
 #ifdef LIFO_SORT_POLICY
 /** Adds a block in a linked list.

+ 2 - 2
private-include/freelist/linked_lists/linked_lists.h

@@ -33,8 +33,8 @@
 #include <sys/types.h>
 #endif /* LEON3 */
 
-#include "freelist/block_header.h"
-#include "freelist/freelist_rb.h"
+#include "dmmlib/freelist/block_header.h"
+#include "dmmlib/freelist/freelist_rb.h"
 
 #ifdef BLOCKS_IN_DLL
 

+ 1 - 1
private-include/freelist/linked_lists/search_algorithms.h

@@ -26,7 +26,7 @@
 #ifndef LINKED_LISTS_SEARCH_ALGORITHMS_H
 #define LINKED_LISTS_SEARCH_ALGORITHMS_H
 #include "dmm_config.h"
-#include "freelist/freelist_rb.h"
+#include "dmmlib/freelist/freelist_rb.h"
 
 /**
  * Perform a best-fit search on free lists for a block of a certain size

+ 2 - 2
private-include/freelist/split.h

@@ -19,8 +19,8 @@
 #define SPLIT_H
 #include "dmm_config.h"
 
-#include "freelist/freelist_rb.h"
-#include "freelist/block_header.h"
+#include "dmmlib/freelist/freelist_rb.h"
+#include "dmmlib/freelist/block_header.h"
 
 /**
  * Splits a memory block to two blocks: one with the requested size and the

+ 19 - 7
src/CMakeLists.txt

@@ -29,13 +29,19 @@ if (WITH_STATIC_LIB)
 endif (WITH_STATIC_LIB)
 
 set(dmmlib_SRCS
-  malloc.c
-  free.c
-  realloc.c
-  calloc.c
   raw_block.c
-  release_memory.c
-)
+  )
+
+if(NOT WITH_SYSTEM_CALLS STREQUAL "none")
+  set(dmmlib_SRCS
+    ${dmmlib_SRCS}
+    malloc.c
+    free.c
+    realloc.c
+    calloc.c
+    release_memory.c
+    )
+endif(NOT WITH_SYSTEM_CALLS STREQUAL "none")
 
 if(RAW_BLOCKS_TYPE STREQUAL "freelist")
 
@@ -46,7 +52,6 @@ if(RAW_BLOCKS_TYPE STREQUAL "freelist")
     freelist/linked_lists/search_algorithms.c
     freelist/freelist_malloc.c
     freelist/freelist_free.c
-    freelist/freelist_realloc.c
     freelist/initialize.c
     )
 
@@ -95,6 +100,13 @@ if(RAW_BLOCKS_TYPE STREQUAL "freelist")
       )
   endif(WITH_DEBUG)
 
+  if(WITH_REALLOC)
+    set(dmmlib_SRCS
+      ${dmmlib_SRCS}
+      freelist/freelist_realloc.c
+      )
+  endif(WITH_REALLOC)
+
 elseif(RAW_BLOCKS_TYPE STREQUAL "bitmap")
 
   set(dmmlib_SRCS

+ 2 - 2
src/free.c

@@ -33,8 +33,8 @@
 #endif /* BITMAP_RB_ONLY */
 
 #ifdef FL_RB_ONLY
-#include "freelist/freelist.h"
-#include "freelist/freelist_rb.h"
+#include "dmmlib/freelist/freelist.h"
+#include "dmmlib/freelist/freelist_rb.h"
 #endif /* FL_RB_ONLY */
 
 #ifdef WITH_ALLOCATOR_STATS

+ 1 - 1
src/freelist/freelist_debug.c

@@ -24,7 +24,7 @@
 
 #include "freelist/freelist_debug.h"
 
-#include "freelist/block_header.h"
+#include "dmmlib/freelist/block_header.h"
 #include "freelist/block_header_funcs.h"
 #include "freelist/linked_lists/search_algorithms.h"
 

+ 1 - 1
src/freelist/freelist_free.c

@@ -21,7 +21,7 @@
  * @brief  free() implementation for freelist-organised raw blocks
  */
 
-#include "freelist/freelist.h"
+#include "dmmlib/freelist/freelist.h"
 
 #include "freelist/block_header_funcs.h"
 #include "freelist/linked_lists/add_block.h"

+ 1 - 1
src/freelist/freelist_malloc.c

@@ -22,7 +22,7 @@
  * @brief  malloc() implementation for freelist-organised raw blocks
  */
 
-#include "freelist/freelist.h"
+#include "dmmlib/freelist/freelist.h"
 
 #include "freelist/block_header_funcs.h"
 #include "freelist/linked_lists/linked_lists.h"

+ 4 - 4
src/freelist/freelist_realloc.c

@@ -22,14 +22,14 @@
  * @brief  realloc() implementation for freelist-organized raw blocks
  */
 
-#include "freelist/freelist.h"
-#include "freelist/block_header.h"
-#include "dmmlib/dmmlib.h"
+#include "dmmlib/freelist/freelist.h"
+#include "dmmlib/freelist/block_header.h"
 
 #include <string.h>
 
 #ifdef HAVE_LOCKS
 #include <pthread.h>
+#include "dmmlib/dmmlib.h"
 #endif /* HAVE_LOCKS */
 
 /**
@@ -48,7 +48,7 @@ void * freelist_realloc(freelist_rb_t *raw_block, void * ptr,
 
     block = (block_header_t *)((char *) ptr - HEADER_SIZE);
 
-    ret = malloc(req_size);
+    ret = freelist_malloc(raw_block, req_size);
 
     if(ret == NULL) {
         return NULL;

+ 2 - 2
src/freelist/initialize.c

@@ -24,8 +24,8 @@
  */
 
 
-#include "freelist/initialize.h"
-#include "freelist/freelist_rb.h"
+#include "dmmlib/freelist/initialize.h"
+#include "dmmlib/freelist/freelist_rb.h"
 
 void initialize_freelist(void *address, size_t available_size) {
     freelist_rb_t *fl_rb = (freelist_rb_t *)address;

+ 2 - 2
src/malloc.c

@@ -31,8 +31,8 @@
 #endif /* BITMAP_RB_ONLY */
 
 #ifdef FL_RB_ONLY
-#include "freelist/freelist.h"
-#include "freelist/freelist_rb.h"
+#include "dmmlib/freelist/freelist.h"
+#include "dmmlib/freelist/freelist_rb.h"
 #endif /* FL_RB_ONLY */
 
 #ifdef WITH_ALLOCATOR_STATS

+ 2 - 2
src/raw_block.c

@@ -22,8 +22,8 @@
 #endif /* HAVE_LOCKS */
 #include "request_memory.h"
 #ifdef FL_RB_ONLY
-#include "freelist/freelist_rb.h"
-#include "freelist/initialize.h"
+#include "dmmlib/freelist/freelist_rb.h"
+#include "dmmlib/freelist/initialize.h"
 #endif /* FL_RB_ONLY */
 #ifdef BITMAP_RB_ONLY
 #include "bitmap/bitmap_rb.h"

+ 2 - 2
src/realloc.c

@@ -33,8 +33,8 @@
 #endif /* BITMAP_RB_ONLY */
 
 #ifdef FL_RB_ONLY
-#include "freelist/freelist.h"
-#include "freelist/freelist_rb.h"
+#include "dmmlib/freelist/freelist.h"
+#include "dmmlib/freelist/freelist_rb.h"
 #endif /* FL_RB_ONLY */
 
 #include "release_memory.h"