* src/mm/dumpmemory.c: Moved to .cpp.
[cacao.git] / src / mm / memory.h
index 12ca651c2eecd3f1b4ac872fab8ae2b73cc09d4c..ec6393f19f8a4ac959748a64750ca26a7cae8c89 100644 (file)
 
 #include "config.h"
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <string.h>
+#include <stdint.h>
 
-#include "vm/types.h"
 
-#include "mm/codememory.h"
-#include "mm/dumpmemory.h"
+// Align the size of memory allocations to this size.
+#define ALIGNSIZE 8
+#define MEMORY_ALIGN(pos,size) ((((pos) + (size) - 1) / (size)) * (size))
 
 
-/* constants for ENABLE_MEMCHECK **********************************************/
+// Constants for ENABLE_MEMCHECK.
 
 #if defined(ENABLE_MEMCHECK)
 #define MEMORY_CANARY_SIZE          16
 #define MEMORY_CANARY_FIRST_BYTE    0xca
 #define MEMORY_CLEAR_BYTE           0xa5
-#endif /* defined(ENABLE_MEMCHECK) */
-
+#endif
 
-/* internal includes **********************************************************/
 
+// Includes.
+#include "mm/codememory.h"
+#include "mm/dumpmemory.hpp"
 #include "mm/gc.hpp"
 
 
@@ -91,7 +88,6 @@ Some more macros:
 
 */
 
-#define MEMORY_ALIGN(pos,size) ((((pos) + (size) - 1) / (size)) * (size))
 #define PADDING(pos,size)     (MEMORY_ALIGN((pos),(size)) - (pos))
 #define OFFSET(s,el)          ((int32_t) ((ptrint) &(((s*) 0)->el)))
 
@@ -130,6 +126,10 @@ Some more macros:
 
 /* function prototypes ********************************************************/
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 bool  memory_init(void);
 
 void  memory_mprotect(void *addr, size_t len, int prot);