# HG changeset patch # User Nina Engelhardt # Date 1362576743 -3600 # Node ID a6005210f581d6bbbd428e1db63549c6ae0e06d8 # Parent 68212347d1d801528aab3e046bccac3d2d36752c VSs working diff -r 68212347d1d8 -r a6005210f581 HW_Dependent_Primitives/VMS__primitives.c --- a/HW_Dependent_Primitives/VMS__primitives.c Fri Feb 01 17:16:39 2013 +0100 +++ b/HW_Dependent_Primitives/VMS__primitives.c Wed Mar 06 14:32:23 2013 +0100 @@ -31,7 +31,7 @@ // Stack grows *down*, so start it at highest stack addr, minus room // for 2 params + return addr. Do ptr arith in terms of bytes.. stackPtr = - (uint8 *)slaveVP->startOfStack + VIRT_PROCR_STACK_SIZE - 4*sizeof(void*); + (uint8 *)slaveVP->startOfStack + VIRT_PROCR_STACK_SIZE - 5*sizeof(void*); //setup __cdecl on stack //Normally, return Addr is in loc pointed to by stackPtr, but doing a diff -r 68212347d1d8 -r a6005210f581 Services_Offered_by_VMS/Debugging/DEBUG__macros.h --- a/Services_Offered_by_VMS/Debugging/DEBUG__macros.h Fri Feb 01 17:16:39 2013 +0100 +++ b/Services_Offered_by_VMS/Debugging/DEBUG__macros.h Wed Mar 06 14:32:23 2013 +0100 @@ -57,7 +57,7 @@ { printf("Task ");\ if(taskStub->taskID) {\ int i;\ - for(i=1;itaskID[0];i++)\ + for(i=1;itaskID[0] && i < 10;i++)\ {\ printf("%d,",taskStub->taskID[i]);\ }\ diff -r 68212347d1d8 -r a6005210f581 Services_Offered_by_VMS/Measurement_and_Stats/MEAS__macros.h --- a/Services_Offered_by_VMS/Measurement_and_Stats/MEAS__macros.h Fri Feb 01 17:16:39 2013 +0100 +++ b/Services_Offered_by_VMS/Measurement_and_Stats/MEAS__macros.h Wed Mar 06 14:32:23 2013 +0100 @@ -369,7 +369,8 @@ #define HOLISTIC__Insert_Master_Global_Vars \ - int vpid,task; \ + int vpid = 0; \ + int task = 0; \ CounterHandler counterHandler = masterEnv->counterHandler; #define HOLISTIC__Record_last_work lastVPBeforeMaster = currVP; diff -r 68212347d1d8 -r a6005210f581 Services_Offered_by_VMS/Memory_Handling/vmalloc.c --- a/Services_Offered_by_VMS/Memory_Handling/vmalloc.c Fri Feb 01 17:16:39 2013 +0100 +++ b/Services_Offered_by_VMS/Memory_Handling/vmalloc.c Wed Mar 06 14:32:23 2013 +0100 @@ -19,6 +19,11 @@ #include "vmalloc.h" +#define USE_SYS_MALLOC + +#ifdef USE_SYS_MALLOC +#include "../malloc.h" +#endif #define MAX_UINT64 0xFFFFFFFFFFFFFFFF @@ -253,6 +258,9 @@ void * VMS_int__malloc( size_t sizeRequested ) { + #ifdef USE_SYS_MALLOC + return malloc(sizeRequested); +#endif MEAS__Capture_Pre_Malloc_Point MallocArrays* freeLists = _VMSMasterEnv->freeLists; @@ -318,7 +326,10 @@ void VMS_int__free( void *ptrToFree ) { - + #ifdef USE_SYS_MALLOC + free(ptrToFree); + return; +#endif MEAS__Capture_Pre_Free_Point; MallocArrays* freeLists = _VMSMasterEnv->freeLists; @@ -383,7 +394,9 @@ */ void* VMS_int__realloc(void *oldPtr, size_t sizeRequested) { - + #ifdef USE_SYS_MALLOC + return realloc(oldPtr,sizeRequested); +#endif void* newPtr = VMS_int__malloc(sizeRequested); @@ -415,6 +428,9 @@ MallocArrays * VMS_ext__create_free_list() { + #ifdef USE_SYS_MALLOC + return NULL; +#endif //Initialize containers for small chunks and fill with zeros _VMSMasterEnv->freeLists = (MallocArrays*)malloc( sizeof(MallocArrays) ); MallocArrays *freeLists = _VMSMasterEnv->freeLists; @@ -485,6 +501,9 @@ void VMS_ext__free_free_list( MallocArrays *freeLists ) { +#ifdef USE_SYS_MALLOC + return; +#endif free(freeLists->memSpace); free(freeLists->bigChunks); free(freeLists->smallChunks); diff -r 68212347d1d8 -r a6005210f581 VMS.h --- a/VMS.h Fri Feb 01 17:16:39 2013 +0100 +++ b/VMS.h Wed Mar 06 14:32:23 2013 +0100 @@ -185,6 +185,7 @@ //Initialization related int32 setupComplete; //use while starting up coreCtlr + int32 shutdownInitiated; //Memory management related MallocArrays *freeLists; diff -r 68212347d1d8 -r a6005210f581 VMS__int.c --- a/VMS__int.c Fri Feb 01 17:16:39 2013 +0100 +++ b/VMS__int.c Wed Mar 06 14:32:23 2013 +0100 @@ -33,7 +33,7 @@ void *stackLocs; newSlv = VMS_int__malloc( sizeof(SlaveVP) ); - stackLocs = VMS_int__malloc( VIRT_PROCR_STACK_SIZE ); + stackLocs = memalign(16, VIRT_PROCR_STACK_SIZE ); if( stackLocs == 0 ) { perror("VMS_int__malloc stack"); exit(1); } @@ -151,10 +151,12 @@ //dis-own all locations owned by this processor, causing to be freed // any locations that it is (was) sole owner of _VMSMasterEnv->numSlavesAlive -= 1; - if( _VMSMasterEnv->numSlavesAlive == 0 ) +/* + if( _VMSMasterEnv->numSlavesAlive == 0 && !_VMSMasterEnv->shutdownInitiated) { //no more work, so shutdown VMS_SS__shutdown(); //note, creates shut-down processor on each core } +*/ //NOTE: dataParam was given to the processor, so should either have // been alloc'd with VMS_int__malloc, or freed by the level above animSlv. diff -r 68212347d1d8 -r a6005210f581 VMS__startup_and_shutdown.c --- a/VMS__startup_and_shutdown.c Fri Feb 01 17:16:39 2013 +0100 +++ b/VMS__startup_and_shutdown.c Wed Mar 06 14:32:23 2013 +0100 @@ -294,6 +294,8 @@ allAnimSlots = VMS_int__malloc( NUM_CORES * sizeof(AnimSlot *) ); _VMSMasterEnv->numSlavesAlive = 0; //used to detect shut-down condition + _VMSMasterEnv->numAnimatedSlaves = 0; + _VMSMasterEnv->shutdownInitiated = FALSE; _VMSMasterEnv->numSlavesCreated = 0; //used by create slave to set ID for( coreIdx = 0; coreIdx < NUM_CORES; coreIdx++ ) @@ -343,6 +345,8 @@ animSlots[i]->needsSlaveAssigned = TRUE; animSlots[i]->slotIdx = i; //quick retrieval of slot pos animSlots[i]->coreSlotIsOn = coreSlotsAreOn; + animSlots[i]->slaveAssignedToSlot = NULL; + animSlots[i]->perfInfo = NULL; } return animSlots; } @@ -499,6 +503,7 @@ AnimSlot **animSlots; //create the shutdown processors, one for each core controller -- put them // directly into the Q -- each core will die when gets one + _VMSMasterEnv->shutdownInitiated = TRUE; for( coreIdx = 0; coreIdx < NUM_CORES; coreIdx++ ) { //Note, this is running in the master shutDownSlv = VMS_SS__create_shutdown_slave(); @@ -562,7 +567,7 @@ //All the environment data has been allocated with VMS__malloc, so just // free its internal big-chunk and all inside it disappear. -/* + masterVPs = _VMSMasterEnv->masterVPs; allAnimSlots = _VMSMasterEnv->allAnimSlots; @@ -582,7 +587,7 @@ freeDynArrayDeep( _VMSMasterEnv->dynIntervalProbesInfo, &VMS_WL__free_probe); #endif //======================================================================== -*/ + //These are the only two that use system free VMS_ext__free_free_list( _VMSMasterEnv->freeLists ); free( (void *)_VMSMasterEnv );