Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
view vmalloc.h @ 222:c88ce1db91ef
Compiles, but does not run properly -- and changed MasterLoop to SchedulingMaster
| author | Some Random Person <seanhalle@yahoo.com> |
|---|---|
| date | Tue, 13 Mar 2012 10:02:06 -0700 |
| parents | eaf7e4c58c9e |
| 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 */
10 #ifndef _VMALLOC_H
11 #define _VMALLOC_H
13 #include <malloc.h>
14 #include <inttypes.h>
15 #include "VMS_primitive_data_types.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
36 typedef struct MallocArrays MallocArrays;
38 struct MallocArrays
39 {
40 MallocProlog **smallChunks;
41 MallocProlog **bigChunks;
42 uint64 bigChunksSearchVector[2];
43 void *memSpace;
44 uint32 containerCount;
45 };
46 //MallocArrays
48 typedef struct
49 {
50 MallocProlog *firstChunkInFreeList;
51 int32 numInList; //TODO not used
52 }
53 FreeListHead;
55 void *
56 VMS_int__malloc( size_t sizeRequested );
57 #define VMS_PI__malloc VMS_int__malloc
58 #define VMS_WL__malloc VMS_int__malloc /*TODO: Bug -- Not protected!! */
59 #define VMS_App__malloc VMS_int__malloc /*TODO: Bug -- Not protected!! */
61 void *
62 VMS_int__malloc_aligned( size_t sizeRequested );
63 #define VMS_PI__malloc_aligned VMS_int__malloc_aligned
64 #define VMS_WL__malloc_aligned VMS_int__malloc_aligned
66 void
67 VMS_int__free( void *ptrToFree );
68 #define VMS_PI__free VMS_int__free
69 #define VMS_WL__free VMS_int__free /*TODO: Bug -- Not protected!! */
70 #define VMS_App__free VMS_int__free /*TODO: Bug -- Not protected!! */
74 /*Allocates memory from the external system -- higher overhead
75 */
76 void *
77 VMS_ext__malloc_in_ext( size_t sizeRequested );
79 /*Frees memory that was allocated in the external system -- higher overhead
80 */
81 void
82 VMS_ext__free_in_ext( void *ptrToFree );
85 MallocArrays *
86 VMS_ext__create_free_list();
88 void
89 VMS_ext__free_free_list(MallocArrays *freeLists );
91 #endif
