Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
annotate vmalloc.h @ 139:99798e4438a6
Merge of Malloc2 and inter master requests
| author | Merten Sach <msach@mailbox.tu-berlin.de> |
|---|---|
| date | Mon, 19 Sep 2011 16:12:01 +0200 |
| parents | 9b2b9bc2c362 0b49fd35afc1 |
| children | 98fc8f3761a2 |
| rev | line source |
|---|---|
| Me@50 | 1 /* |
| Me@50 | 2 * Copyright 2009 OpenSourceCodeStewardshipFoundation.org |
| Me@50 | 3 * Licensed under GNU General Public License version 2 |
| Me@50 | 4 * |
| Me@50 | 5 * Author: seanhalle@yahoo.com |
| Me@50 | 6 * |
| Me@50 | 7 * Created on November 14, 2009, 9:07 PM |
| Me@50 | 8 */ |
| Me@65 | 9 #ifndef _VMALLOC_H |
| Me@65 | 10 #define _VMALLOC_H |
| Me@65 | 11 |
| Me@50 | 12 #include <malloc.h> |
| msach@76 | 13 #include <inttypes.h> |
| Me@50 | 14 #include "VMS_primitive_data_types.h" |
| msach@132 | 15 #include "ProcrContext.h" |
| Me@50 | 16 |
| msach@101 | 17 #define SMALL_CHUNK_SIZE 32 |
| msach@101 | 18 #define SMALL_CHUNK_COUNT 4 |
| msach@125 | 19 #define LOWER_BOUND 128 //Biggest chunk size that is created for the small chunks |
| msach@125 | 20 #define BIG_LOWER_BOUND 160 //Smallest chunk size that is created for the big chunks |
| msach@101 | 21 |
| msach@118 | 22 #define LOG54 0.3219280948873623 |
| msach@118 | 23 #define LOG128 7 |
| msach@101 | 24 |
| Me@50 | 25 typedef struct _MallocProlog MallocProlog; |
| Me@50 | 26 |
| Me@50 | 27 struct _MallocProlog |
| Me@50 | 28 { |
| Me@50 | 29 MallocProlog *nextChunkInFreeList; |
| Me@50 | 30 MallocProlog *prevChunkInFreeList; |
| Me@50 | 31 MallocProlog *nextHigherInMem; |
| Me@50 | 32 MallocProlog *nextLowerInMem; |
| msach@132 | 33 }; |
| Me@50 | 34 //MallocProlog |
| msach@132 | 35 |
| msach@101 | 36 typedef struct MallocArrays MallocArrays; |
| msach@101 | 37 |
| msach@139 | 38 struct MallocArrays |
| msach@101 | 39 { |
| msach@101 | 40 MallocProlog **smallChunks; |
| msach@101 | 41 MallocProlog **bigChunks; |
| msach@116 | 42 uint64 bigChunksSearchVector[2]; |
| msach@102 | 43 void *memSpace; |
| msach@101 | 44 uint32 containerCount; |
| msach@101 | 45 }; |
| msach@139 | 46 //MallocArray |
| msach@139 | 47 |
| msach@139 | 48 |
| msach@132 | 49 typedef struct |
| msach@139 | 50 { |
| msach@132 | 51 uintptr_t procrID; |
| msach@132 | 52 MallocProlog *prevChunkInFreeList; |
| msach@132 | 53 MallocProlog *nextHigherInMem; |
| msach@132 | 54 MallocProlog *nextLowerInMem; |
| msach@132 | 55 } MallocPrologAllocated; |
| Me@50 | 56 |
| msach@78 | 57 |
| Me@50 | 58 typedef struct |
| Me@50 | 59 { |
| Me@50 | 60 MallocProlog *firstChunkInFreeList; |
| msach@76 | 61 int32 numInList; //TODO not used |
| msach@132 | 62 } FreeListHead; |
| Me@50 | 63 |
| Me@50 | 64 void * |
| msach@132 | 65 VMS__malloc_on_core(size_t sizeRequested, int procrID); |
| Me@50 | 66 |
| msach@78 | 67 void * |
| msach@132 | 68 VMS__malloc(size_t sizeRequested); |
| msach@132 | 69 |
| msach@132 | 70 void * |
| msach@132 | 71 VMS__malloc_in_lib(size_t sizeRequested, VirtProcr *VProc); |
| msach@78 | 72 |
| Me@50 | 73 void |
| Me@50 | 74 VMS__free( void *ptrToFree ); |
| Me@50 | 75 |
| msach@132 | 76 void |
| msach@132 | 77 VMS__free_in_lib(void *ptrToFree, VirtProcr *VProc); |
| msach@132 | 78 |
| msach@132 | 79 void |
| msach@132 | 80 VMS__free_on_core(void *ptrToFree, int procrID); |
| msach@132 | 81 |
| Me@53 | 82 /*Allocates memory from the external system -- higher overhead |
| Me@53 | 83 */ |
| Me@53 | 84 void * |
| msach@76 | 85 VMS__malloc_in_ext( size_t sizeRequested ); |
| Me@53 | 86 |
| Me@53 | 87 /*Frees memory that was allocated in the external system -- higher overhead |
| Me@53 | 88 */ |
| Me@53 | 89 void |
| Me@53 | 90 VMS__free_in_ext( void *ptrToFree ); |
| Me@53 | 91 |
| msach@101 | 92 MallocArrays * |
| Me@53 | 93 VMS_ext__create_free_list(); |
| Me@50 | 94 |
| Me@50 | 95 void |
| msach@102 | 96 VMS_ext__free_free_list(MallocArrays *freeLists ); |
| Me@65 | 97 |
| Me@65 | 98 #endif |
