Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
view vmalloc.h @ 154:c4d8060229ef
removed NUM_CORES to move it to Makefile
| author | Merten Sach <msach@mailbox.tu-berlin.de> |
|---|---|
| date | Thu, 06 Oct 2011 14:40:12 +0200 |
| parents | 99798e4438a6 |
| children |
line source
1 /*
2 * Copyright 2009 OpenSourceCodeStewardshipFoundation.org
3 * Licensed under GNU General Public License version 2
4 *
5 * Author: seanhalle@yahoo.com
6 *
7 * Created on November 14, 2009, 9:07 PM
8 */
9 #ifndef _VMALLOC_H
10 #define _VMALLOC_H
12 #include <malloc.h>
13 #include <inttypes.h>
14 #include "VMS_primitive_data_types.h"
15 #include "ProcrContext.h"
17 #define SMALL_CHUNK_SIZE 32
18 #define SMALL_CHUNK_COUNT 4
19 #define LOWER_BOUND 128 //Biggest chunk size that is created for the small chunks
20 #define BIG_LOWER_BOUND 160 //Smallest chunk size that is created for the big chunks
22 #define LOG54 0.3219280948873623
23 #define LOG128 7
25 typedef struct _MallocProlog MallocProlog;
27 struct _MallocProlog
28 {
29 MallocProlog *nextChunkInFreeList;
30 MallocProlog *prevChunkInFreeList;
31 MallocProlog *nextHigherInMem;
32 MallocProlog *nextLowerInMem;
33 };
34 //MallocProlog
35 typedef struct MallocArrays MallocArrays;
37 typedef struct
38 {
39 uintptr_t procrID;
40 MallocProlog *prevChunkInFreeList;
41 MallocProlog *nextHigherInMem;
42 MallocProlog *nextLowerInMem;
43 } MallocPrologAllocated;
45 struct MallocArrays
46 {
47 MallocProlog **smallChunks;
48 MallocProlog **bigChunks;
49 uint64 bigChunksSearchVector[2];
50 void *memSpace;
51 uint32 containerCount;
52 };
53 //MallocArray
55 typedef struct
56 {
57 MallocProlog *firstChunkInFreeList;
58 int32 numInList; //TODO not used
59 } FreeListHead;
61 void *
62 VMS__malloc_on_core(size_t sizeRequested, int procrID);
64 void *
65 VMS__malloc(size_t sizeRequested);
67 void *
68 VMS__malloc_in_lib(size_t sizeRequested, VirtProcr *VProc);
70 void
71 VMS__free( void *ptrToFree );
73 void
74 VMS__free_in_lib(void *ptrToFree, VirtProcr *VProc);
76 void
77 VMS__free_on_core(void *ptrToFree, int procrID);
79 /*Allocates memory from the external system -- higher overhead
80 */
81 void *
82 VMS__malloc_in_ext( size_t sizeRequested );
84 /*Frees memory that was allocated in the external system -- higher overhead
85 */
86 void
87 VMS__free_in_ext( void *ptrToFree );
89 MallocArrays *
90 VMS_ext__create_free_list();
92 void
93 VMS_ext__free_free_list(MallocArrays *freeLists );
95 #endif
