Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
comparison vmalloc.c @ 63:a6c442d52590
removed all inline, to see if -O3 works -- now -O0 broken too! will go back
| author | Me |
|---|---|
| date | Fri, 12 Nov 2010 08:42:25 -0800 |
| parents | 7b799a46cc87 |
| children |
comparison
equal
deleted
inserted
replaced
| 3:de4afbd8fc90 | 4:deef8b9a84fe |
|---|---|
| 22 *The list head is a normal MallocProlog struct -- identified by its | 22 *The list head is a normal MallocProlog struct -- identified by its |
| 23 * prevChunkInFreeList being NULL -- the only one. | 23 * prevChunkInFreeList being NULL -- the only one. |
| 24 * | 24 * |
| 25 *The end of the list is identified by next chunk being NULL, as usual. | 25 *The end of the list is identified by next chunk being NULL, as usual. |
| 26 */ | 26 */ |
| 27 void inline | 27 void |
| 28 add_chunk_to_free_list( MallocProlog *chunk, MallocProlog *listHead ) | 28 add_chunk_to_free_list( MallocProlog *chunk, MallocProlog *listHead ) |
| 29 { | 29 { |
| 30 chunk->nextChunkInFreeList = listHead->nextChunkInFreeList; | 30 chunk->nextChunkInFreeList = listHead->nextChunkInFreeList; |
| 31 if( chunk->nextChunkInFreeList != NULL ) //if not last in free list | 31 if( chunk->nextChunkInFreeList != NULL ) //if not last in free list |
| 32 chunk->nextChunkInFreeList->prevChunkInFreeList = chunk; | 32 chunk->nextChunkInFreeList->prevChunkInFreeList = chunk; |
| 48 VMS__malloc( int32 sizeRequested ) | 48 VMS__malloc( int32 sizeRequested ) |
| 49 { MallocProlog *foundElem = NULL, *currElem, *newElem; | 49 { MallocProlog *foundElem = NULL, *currElem, *newElem; |
| 50 int32 amountExtra, foundElemIsTopOfHeap, sizeConsumed,sizeOfFound; | 50 int32 amountExtra, foundElemIsTopOfHeap, sizeConsumed,sizeOfFound; |
| 51 | 51 |
| 52 //step up the size to be aligned at 16-byte boundary, prob better ways | 52 //step up the size to be aligned at 16-byte boundary, prob better ways |
| 53 sizeRequested = ((sizeRequested + 16) >> 4) << 4; | 53 sizeRequested = ((sizeRequested + 15) >> 4) << 4; |
| 54 currElem = (_VMSMasterEnv->freeListHead)->nextChunkInFreeList; | 54 currElem = (_VMSMasterEnv->freeListHead)->nextChunkInFreeList; |
| 55 | 55 |
| 56 while( currElem != NULL ) | 56 while( currElem != NULL ) |
| 57 { //check if size of currElem is big enough | 57 { //check if size of currElem is big enough |
| 58 sizeOfFound=(int32)((char*)currElem->nextHigherInMem -(char*)currElem); | 58 sizeOfFound=(int32)((char*)currElem->nextHigherInMem -(char*)currElem); |
