Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
annotate vmalloc.h @ 158:68449b64c3df
smaller Hists for malloc, free and plugin
| author | Merten Sach <msach@mailbox.tu-berlin.de> |
|---|---|
| date | Thu, 06 Oct 2011 15:59:19 +0200 |
| parents | 99798e4438a6 |
| children |
| 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@147 | 35 typedef struct MallocArrays MallocArrays; |
| msach@147 | 36 |
| msach@147 | 37 typedef struct |
| msach@147 | 38 { |
| msach@147 | 39 uintptr_t procrID; |
| msach@147 | 40 MallocProlog *prevChunkInFreeList; |
| msach@147 | 41 MallocProlog *nextHigherInMem; |
| msach@147 | 42 MallocProlog *nextLowerInMem; |
| msach@147 | 43 } MallocPrologAllocated; |
| msach@101 | 44 |
| msach@139 | 45 struct MallocArrays |
| msach@101 | 46 { |
| msach@101 | 47 MallocProlog **smallChunks; |
| msach@101 | 48 MallocProlog **bigChunks; |
| msach@116 | 49 uint64 bigChunksSearchVector[2]; |
| msach@102 | 50 void *memSpace; |
| msach@101 | 51 uint32 containerCount; |
| msach@101 | 52 }; |
| msach@139 | 53 //MallocArray |
| msach@139 | 54 |
| Me@50 | 55 typedef struct |
| Me@50 | 56 { |
| Me@50 | 57 MallocProlog *firstChunkInFreeList; |
| msach@76 | 58 int32 numInList; //TODO not used |
| msach@132 | 59 } FreeListHead; |
| Me@50 | 60 |
| Me@50 | 61 void * |
| msach@132 | 62 VMS__malloc_on_core(size_t sizeRequested, int procrID); |
| Me@50 | 63 |
| msach@78 | 64 void * |
| msach@132 | 65 VMS__malloc(size_t sizeRequested); |
| msach@132 | 66 |
| msach@132 | 67 void * |
| msach@132 | 68 VMS__malloc_in_lib(size_t sizeRequested, VirtProcr *VProc); |
| msach@78 | 69 |
| Me@50 | 70 void |
| Me@50 | 71 VMS__free( void *ptrToFree ); |
| Me@50 | 72 |
| msach@132 | 73 void |
| msach@132 | 74 VMS__free_in_lib(void *ptrToFree, VirtProcr *VProc); |
| msach@132 | 75 |
| msach@132 | 76 void |
| msach@132 | 77 VMS__free_on_core(void *ptrToFree, int procrID); |
| msach@132 | 78 |
| Me@53 | 79 /*Allocates memory from the external system -- higher overhead |
| Me@53 | 80 */ |
| Me@53 | 81 void * |
| msach@76 | 82 VMS__malloc_in_ext( size_t sizeRequested ); |
| Me@53 | 83 |
| Me@53 | 84 /*Frees memory that was allocated in the external system -- higher overhead |
| Me@53 | 85 */ |
| Me@53 | 86 void |
| Me@53 | 87 VMS__free_in_ext( void *ptrToFree ); |
| Me@53 | 88 |
| msach@101 | 89 MallocArrays * |
| Me@53 | 90 VMS_ext__create_free_list(); |
| Me@50 | 91 |
| Me@50 | 92 void |
| msach@102 | 93 VMS_ext__free_free_list(MallocArrays *freeLists ); |
| Me@65 | 94 |
| Me@65 | 95 #endif |
