changeset 215:10a72bcedbf0 Common_Ancestor

fixed include paths, and various minor fixes, while updating SSR to use this brch
author Some Random Person <seanhalle@yahoo.com>
date Fri, 09 Mar 2012 22:30:26 -0800
parents 64737d3deeb4
children 712218cdc4ba
files CoreLoop.c Defines/VMS_defs__MEAS.h Probes/probes.c README_Code_Overview.txt VMS.h VMS__HW_dependent.c VMS__WL.c VMS__int.c VMS__startup_and_shutdown.c VMS_primitive_data_types.h __README__Code_Overview.txt
diffstat 11 files changed, 125 insertions(+), 61 deletions(-) [+]
line diff
     1.1 --- a/CoreLoop.c	Fri Mar 09 10:46:36 2012 -0800
     1.2 +++ b/CoreLoop.c	Fri Mar 09 22:30:26 2012 -0800
     1.3 @@ -57,7 +57,7 @@
     1.4     pthread_mutex_lock(   &suspendLock );
     1.5     while( !(_VMSMasterEnv->setupComplete) )
     1.6      {
     1.7 -      pthread_cond_wait( &suspend_cond,
     1.8 +      pthread_cond_wait( &suspendCond,
     1.9                           &suspendLock );
    1.10      }
    1.11     pthread_mutex_unlock( &suspendLock );
    1.12 @@ -130,7 +130,7 @@
    1.13     switchToSlv(currVP); //Slave suspend makes core "return" from this call
    1.14     flushRegisters();
    1.15     
    1.16 -          MEAS__endCoreLoop_for_Sys;
    1.17 +          MEAS__capture_end_susp_in_CoreLoop_forSys;
    1.18            
    1.19     }//CoreLoop      
    1.20   }
     2.1 --- a/Defines/VMS_defs__MEAS.h	Fri Mar 09 10:46:36 2012 -0800
     2.2 +++ b/Defines/VMS_defs__MEAS.h	Fri Mar 09 22:30:26 2012 -0800
     2.3 @@ -278,7 +278,7 @@
     2.4             { currVP->totalSuspCycles += numCycles; \
     2.5               currVP->numGoodSusp++; \
     2.6             } \
     2.7 -             /*recorded every time, but only read if currVP == MasterVP*/ \ 
     2.8 +             /*recorded every time, but only read if currVP == MasterVP*/ \
     2.9            _VMSMasterEnv->startMaster.longVal = endSusp.longVal;
    2.10  
    2.11  #else
     3.1 --- a/Probes/probes.c	Fri Mar 09 10:46:36 2012 -0800
     3.2 +++ b/Probes/probes.c	Fri Mar 09 22:30:26 2012 -0800
     3.3 @@ -8,7 +8,7 @@
     3.4  #include <malloc.h>
     3.5  #include <sys/time.h>
     3.6  
     3.7 -#include "VMS.h"
     3.8 +#include "../VMS.h"
     3.9  
    3.10  
    3.11  
    3.12 @@ -37,7 +37,15 @@
    3.13   {
    3.14   }
    3.15  
    3.16 -
    3.17 +float64 inline
    3.18 +giveInterval( struct timeval _start, struct timeval _end )
    3.19 + { float64 start, end;
    3.20 +   start = _start.tv_sec + _start.tv_usec / 1000000.0;
    3.21 +   end   = _end.tv_sec   + _end.tv_usec   / 1000000.0;
    3.22 +   return end - start;
    3.23 + }
    3.24 +          
    3.25 +//=================================================================
    3.26  IntervalProbe *
    3.27  create_generic_probe( char *nameStr, SlaveVP *animSlv )
    3.28   {
    3.29 @@ -170,7 +178,7 @@
    3.30   }
    3.31  
    3.32  
    3.33 -/*Everything is local to the animating procr, so no need for request, do
    3.34 +/*Everything is local to the animating slaveVP, so no need for request, do
    3.35   * work locally, in the anim Slv
    3.36   */
    3.37  void
    3.38 @@ -180,11 +188,11 @@
    3.39     probe = _VMSMasterEnv->intervalProbes[ probeID ];
    3.40     probe->schedChoiceWasRecorded = TRUE;
    3.41     probe->coreNum = animatingSlv->coreAnimatedBy;
    3.42 -   probe->slaveID = animatingSlv->procrID;
    3.43 +   probe->slaveID = animatingSlv->slaveID;
    3.44     probe->slaveCreateSecs = animatingSlv->createPtInSecs;
    3.45   }
    3.46  
    3.47 -/*Everything is local to the animating procr, so no need for request, do
    3.48 +/*Everything is local to the animating slaveVP, so no need for request, do
    3.49   * work locally, in the anim Slv
    3.50   */
    3.51  void
    3.52 @@ -197,13 +205,14 @@
    3.53        //record *start* point as last thing, after lookup
    3.54  #ifdef PROBES__USE_TIME_OF_DAY_PROBES
    3.55     gettimeofday( &(probe->startStamp), NULL);
    3.56 -#else #ifdef PROBES__USE_TSC_PROBES
    3.57 +#endif
    3.58 +#ifdef PROBES__USE_TSC_PROBES
    3.59     probe->startStamp = getTSCount();
    3.60  #endif
    3.61   }
    3.62  
    3.63  
    3.64 -/*Everything is local to the animating procr, except the histogram, so do
    3.65 +/*Everything is local to the animating slaveVP, except the histogram, so do
    3.66   * work locally, in the anim Slv -- may lose a few histogram counts
    3.67   * 
    3.68   *This should be safe to run inside SlaveVP
    3.69 @@ -214,7 +223,7 @@
    3.70  
    3.71     //Record first thing -- before looking up the probe to store it into
    3.72  #ifdef PROBES__USE_TIME_OF_DAY_PROBES
    3.73 -   struct timeval  endStamp, interval;
    3.74 +   struct timeval  endStamp;
    3.75     gettimeofday( &(endStamp), NULL);
    3.76  #endif
    3.77  #ifdef PROBES__USE_TSC_PROBES
    3.78 @@ -229,8 +238,7 @@
    3.79  
    3.80  #ifdef PROBES__USE_TIME_OF_DAY_PROBES
    3.81     if( probe->hist != NULL )
    3.82 -    { interval = probe->endStamp - probe->startStamp;
    3.83 -      addToDblHist( interval.tv_sec + interval.tv_usec/1000000.0, probe->hist );
    3.84 +    { addToDblHist( giveInterval( probe->startStamp, endStamp), probe->hist );
    3.85      }
    3.86  #endif
    3.87  #ifdef PROBES__USE_TSC_PROBES
    3.88 @@ -256,7 +264,7 @@
    3.89     
    3.90     
    3.91     if( probe->schedChoiceWasRecorded )
    3.92 -    { printf( "coreNum: %d, procrID: %d, procrCreated: %0.6f | ",
    3.93 +    { printf( "coreNum: %d, slaveID: %d, slaveVPCreated: %0.6f | ",
    3.94                probe->coreNum, probe->slaveID, probe->slaveCreateSecs );
    3.95      }
    3.96  
     4.1 --- a/README_Code_Overview.txt	Fri Mar 09 10:46:36 2012 -0800
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,18 +0,0 @@
     4.4 -
     4.5 -This file is intended to help those new to VMS to find their way around the code.
     4.6 -
     4.7 -Some observations:
     4.8 --] VMS.h is the top header file, and is the root of a tree of #includes that pulls in all the other headers
     4.9 -
    4.10 --] Defines directory contains all the header files that hold #define statements
    4.11 -
    4.12 --] VMS has several kinds of function, grouped according to what kind of code should call them: VMS_App_.. for applications to call, VMS_WL_.. for wrapper-library code to call, VMS_PI_.. for plugin code to call, and VMS_int_.. for VMS to use internally.  Sometimes VMS_int_ functions are called from the wrapper library or plugin, but this should only be done by programmers who have gained an in-depth knowledge of VMS's implementation and understand that VMS_int_ functions are not protected for concurrent use..
    4.13 -
    4.14 --] VMS has its own version of malloc, unfortunately, which is due to the system malloc breaking when the stack-pointer register is manipulated, which VMS must.  The VMS form of malloc must be used in code that runs inside the VMS system, especially all application code that uses a VMS-based language.  However, mallocs performed in the main thread, outside the VMS-language program, cannot use VMS malloc..  this presents some issues crossing the boundary..
    4.15 -
    4.16 --] VMS has many macros used in the code..  either for measurements or debug..  all measurement, debug, and statistics gathering statements can be turned on or off with a compiler switch.  All compiler switches for doing this are found in Defines/VMS_defs__turn_on_and_off.h.  The rest of the files in Defines directory contain the macro definitions, hardware constants, and any other #define statements.
    4.17 -
    4.18 --] The best way to learn VMS is to turn on  DEBUG__TURN_ON_SEQUENTIAL_MODE, which allows using a normal debugger while sequentially going through both application code and VMS internals.  Setting breakpoints at various spots in the code is a good way to see the VMS system in operation.
    4.19 -
    4.20 --] VMS has several "VMS primitives" implemented with assembly code.  The net effect of these assembly functions is to perform the switching between application code and the VMS system.
    4.21 -
     5.1 --- a/VMS.h	Fri Mar 09 10:46:36 2012 -0800
     5.2 +++ b/VMS.h	Fri Mar 09 22:30:26 2012 -0800
     5.3 @@ -11,10 +11,10 @@
     5.4  #define _GNU_SOURCE
     5.5  
     5.6  #include "VMS_primitive_data_types.h"
     5.7 -#include "C_Libraries/DynArray/DynArray.h"
     5.8 -#include "C_Libraries/Hash_impl/PrivateHash.h"
     5.9 -#include "C_Libraries/Histogram/Histogram.h"
    5.10 -#include "C_Libraries/Queue_impl/PrivateQueue.h"
    5.11 +#include "DynArray/DynArray.h"
    5.12 +#include "Hash_impl/PrivateHash.h"
    5.13 +#include "Histogram/Histogram.h"
    5.14 +#include "Queue_impl/PrivateQueue.h"
    5.15  #include "vmalloc.h"
    5.16  
    5.17  #include <pthread.h>
    5.18 @@ -107,7 +107,7 @@
    5.19   *         assembly code to fail -- hard-codes offsets of fields
    5.20   */
    5.21  struct _SlaveVP
    5.22 - { int         procrID;  //each slave given a unique ID
    5.23 + { int         slaveID;  //each slave given a unique ID
    5.24     int         coreAnimatedBy;
    5.25     void       *startOfStack;
    5.26     void       *stackPtr;
    5.27 @@ -212,15 +212,12 @@
    5.28  
    5.29  //=============================  Global Vars ================================
    5.30  
    5.31 +volatile MasterEnv      *_VMSMasterEnv __align_to_cacheline__;
    5.32 +
    5.33  pthread_t       coreLoopThdHandles[ NUM_CORES ];  //pthread's virt-procr state
    5.34  ThdParams      *coreLoopThdParams [ NUM_CORES ];
    5.35 -pthread_mutex_t suspendLock;
    5.36 -pthread_cond_t  suspend_cond;
    5.37 -
    5.38 -volatile MasterEnv      *_VMSMasterEnv __align_to_cacheline__;
    5.39 -
    5.40 -pthread_mutex_t suspendLock = PTHREAD_MUTEX_INITIALIZER;
    5.41 -pthread_cond_t  suspend_cond  = PTHREAD_COND_INITIALIZER;
    5.42 +pthread_mutex_t suspendLock   = PTHREAD_MUTEX_INITIALIZER;
    5.43 +pthread_cond_t  suspendCond  = PTHREAD_COND_INITIALIZER;
    5.44  
    5.45  //=========================  Function Prototypes  ===========================
    5.46  
    5.47 @@ -237,7 +234,7 @@
    5.48  VMS_SS__init();
    5.49  
    5.50  //Fix; 
    5.51 -/*seed-procr creation -- put box around language, have lang register stuff
    5.52 +/*seed-slaveVP creation -- put box around language, have lang register stuff
    5.53          with VMS.
    5.54          have main program explicitly INIT Lang! -- makes more sense to
    5.55          C programmers -- makes it clear that there's a transition.
     6.1 --- a/VMS__HW_dependent.c	Fri Mar 09 10:46:36 2012 -0800
     6.2 +++ b/VMS__HW_dependent.c	Fri Mar 09 22:30:26 2012 -0800
     6.3 @@ -26,7 +26,7 @@
     6.4      //Set slave's instr pointer to a helper Fn that copies params from stack
     6.5     slaveVP->resumeInstrPtr  = (TopLevelFnPtr)&startUpTopLevelFn;
     6.6     
     6.7 -    //fnPtr takes two params -- void *dataParam & void *animProcr
     6.8 +    //fnPtr takes two params -- void *dataParam & void *animSlv
     6.9      // Stack grows *down*, so start it at highest stack addr, minus room
    6.10      // for 2 params + return addr. 
    6.11     stackPtr = 
     7.1 --- a/VMS__WL.c	Fri Mar 09 10:46:36 2012 -0800
     7.2 +++ b/VMS__WL.c	Fri Mar 09 22:30:26 2012 -0800
     7.3 @@ -83,7 +83,7 @@
     7.4   * be malloc'd if this is called inside the same call chain before the
     7.5   * send of the last request is called.
     7.6   *
     7.7 - *The request handler has to call VMS__free_VMSReq for any of these
     7.8 + *The request handler has to call VMS_int__free_VMSReq for any of these
     7.9   */
    7.10  inline void
    7.11  VMS_WL__add_sem_request_in_mallocd_VMSReqst( void *semReqData,
     8.1 --- a/VMS__int.c	Fri Mar 09 10:46:36 2012 -0800
     8.2 +++ b/VMS__int.c	Fri Mar 09 22:30:26 2012 -0800
     8.3 @@ -22,7 +22,7 @@
     8.4     newSlv      = VMS_int__malloc( sizeof(SlaveVP) );
     8.5     stackLocs  = VMS_int__malloc( VIRT_PROCR_STACK_SIZE );
     8.6     if( stackLocs == 0 )
     8.7 -    { perror("VMS__malloc stack"); exit(1); }
     8.8 +    { perror("VMS_int__malloc stack"); exit(1); }
     8.9  
    8.10     _VMSMasterEnv->numSlavesAlive += 1;
    8.11  
    8.12 @@ -91,7 +91,7 @@
    8.13  VMS_ext__dissipate_slaveVP( SlaveVP *slaveToDissipate )
    8.14   {
    8.15        //NOTE: dataParam was given to the processor, so should either have
    8.16 -      // been alloc'd with VMS__malloc, or freed by the level above animSlv.
    8.17 +      // been alloc'd with VMS_int__malloc, or freed by the level above animSlv.
    8.18        //So, all that's left to free here is the stack and the SlaveVP struc
    8.19        // itself
    8.20        //Note, should not stack-allocate the data param -- no guarantee, in
    8.21 @@ -115,7 +115,7 @@
    8.22   * VMS_malloc mechanism.  Then it calls this, which first asks the malloc
    8.23   * system to disown any state that did use VMS_malloc, and then frees the
    8.24   * statck and the processor-struct itself.
    8.25 - *If the dissipated processor is the sole (remaining) owner of VMS__malloc'd
    8.26 + *If the dissipated processor is the sole (remaining) owner of VMS_int__malloc'd
    8.27   * state, then that state gets freed (or sent to recycling) as a side-effect
    8.28   * of dis-owning it.
    8.29   */
    8.30 @@ -132,7 +132,7 @@
    8.31      }
    8.32  
    8.33        //NOTE: dataParam was given to the processor, so should either have
    8.34 -      // been alloc'd with VMS__malloc, or freed by the level above animSlv.
    8.35 +      // been alloc'd with VMS_int__malloc, or freed by the level above animSlv.
    8.36        //So, all that's left to free here is the stack and the SlaveVP struc
    8.37        // itself
    8.38        //Note, should not stack-allocate initial data -- no guarantee, in
    8.39 @@ -157,7 +157,7 @@
    8.40                       void    *dataParam, void          *stackLocs )
    8.41   {
    8.42     newSlv->startOfStack = stackLocs;
    8.43 -   newSlv->procrID      = _VMSMasterEnv->numSlavesCreated++;
    8.44 +   newSlv->slaveID      = _VMSMasterEnv->numSlavesCreated++;
    8.45     newSlv->requests     = NULL;
    8.46     newSlv->schedSlot    = NULL;
    8.47  
     9.1 --- a/VMS__startup_and_shutdown.c	Fri Mar 09 10:46:36 2012 -0800
     9.2 +++ b/VMS__startup_and_shutdown.c	Fri Mar 09 22:30:26 2012 -0800
     9.3 @@ -78,10 +78,57 @@
     9.4     #endif
     9.5   }
     9.6  
     9.7 +
     9.8 +/*TODO: finish implementing
     9.9 + *This function returns information about the version of VMS, the language
    9.10 + * the program is being run in, its version, and information on the 
    9.11 + * hardware.
    9.12 + */
    9.13 +/*
    9.14 +char *
    9.15 +VMS_App__give_environment_string()
    9.16 + {
    9.17 +   //--------------------------
    9.18 +    fprintf(output, "#\n# >> Build information <<\n");
    9.19 +    fprintf(output, "# GCC VERSION: %d.%d.%d\n",__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__);
    9.20 +    fprintf(output, "# Build Date: %s %s\n", __DATE__, __TIME__);
    9.21 +    
    9.22 +    fprintf(output, "#\n# >> Hardware information <<\n");
    9.23 +    fprintf(output, "# Hardware Architecture: ");
    9.24 +   #ifdef __x86_64
    9.25 +    fprintf(output, "x86_64");
    9.26 +   #endif //__x86_64
    9.27 +   #ifdef __i386
    9.28 +    fprintf(output, "x86");
    9.29 +   #endif //__i386
    9.30 +    fprintf(output, "\n");
    9.31 +    fprintf(output, "# Number of Cores: %d\n", NUM_CORES);
    9.32 +   //--------------------------
    9.33 +    
    9.34 +   //VMS Plugins
    9.35 +    fprintf(output, "#\n# >> VMS Plugins <<\n");
    9.36 +    fprintf(output, "# Language : ");
    9.37 +    fprintf(output, _LANG_NAME_);
    9.38 +    fprintf(output, "\n");
    9.39 +       //Meta info gets set by calls from the language during its init,
    9.40 +       // and info registered by calls from inside the application
    9.41 +    fprintf(output, "# Scheduler: %s\n", _VMSMasterEnv->metaInfo->schedulerInfo);
    9.42 +
    9.43 +   //--------------------------
    9.44 +   //Application
    9.45 +    fprintf(output, "#\n# >> Application <<\n");
    9.46 +    fprintf(output, "# Name: %s\n", _VMSMasterEnv->metaInfo->appInfo);
    9.47 +    fprintf(output, "# Data Set:\n%s\n",_VMSMasterEnv->metaInfo->inputSet);
    9.48 +    
    9.49 +   //--------------------------
    9.50 + }
    9.51 + */
    9.52 + 
    9.53  /*This structure holds all the information VMS needs to manage a program.  VMS
    9.54   * stores information about what percent of CPU time the program is getting, what
    9.55   * language it uses, the request handlers to call for its slaves, and so on.
    9.56   */
    9.57 +/*
    9.58  typedef struct
    9.59   { void               *semEnv;
    9.60     RequestHdlrFnPtr    requestHandler;
    9.61 @@ -96,25 +143,29 @@
    9.62     pthread_cond_t  doneCond;
    9.63   }
    9.64  VMSProcess;
    9.65 +*/
    9.66  
    9.67           
    9.68 +/*
    9.69  void
    9.70  VMS__start_VMS_running()
    9.71   {
    9.72     create_masterEnv();
    9.73     
    9.74     #ifdef DEBUG__TURN_ON_SEQUENTIAL_MODE
    9.75 -      /*Nothing else to create for sequential mode*/
    9.76 +      //Nothing else to create for sequential mode
    9.77     #else
    9.78        create_the_coreLoop_OS_threads();
    9.79     #endif    
    9.80   }
    9.81 +*/
    9.82  
    9.83  /*A pointer to the startup-function for the language is given as the last
    9.84   * argument to the call.  Use this to initialize a program in the language.
    9.85   * This creates a data structure that encapsulates the bookkeeping info
    9.86   * VMS uses to track and schedule a program run.
    9.87   */
    9.88 +/*
    9.89  VMSProcess *
    9.90  VMS__spawn_program_on_data_in_Lang( TopLevelFnPtr prog_seed_fn, void *data,
    9.91                                      LangInitFnPtr langInitFnPtr )
    9.92 @@ -128,15 +179,16 @@
    9.93     newProcess->dataForSeed = data;
    9.94     newProcess->seedFnPtr   = prog_seed_fn;
    9.95     
    9.96 -   /*The language's spawn-process function fills in the plugin function-ptrs in
    9.97 -    * the VMSProcess struct, gives the struct to VMS, which then makes and
    9.98 -    * queues the seed SlaveVP, which starts processors made from the code being
    9.99 -    * animated.
   9.100 -    */
   9.101 +      //The language's spawn-process function fills in the plugin function-ptrs in
   9.102 +      // the VMSProcess struct, gives the struct to VMS, which then makes and
   9.103 +      // queues the seed SlaveVP, which starts processors made from the code being
   9.104 +      // animated.
   9.105 +    
   9.106     (*langInitFnPtr)( newProcess );  
   9.107     
   9.108     return newProcess;
   9.109   }
   9.110 +*/
   9.111  
   9.112  /*When all SlaveVPs owned by the program-run associated to the process have
   9.113   * dissipated, then return from this call.  There is no language to cleanup,
   9.114 @@ -154,6 +206,7 @@
   9.115   * the process ending (last SlaveVP owned by it dissipates), then VMS signals
   9.116   * this to wakeup.  This then calls the cleanup fn and returns the result.
   9.117   */
   9.118 +/*
   9.119  void *
   9.120  VMS__give_results_when_done_for( VMSProcess *process )
   9.121   { void *result;
   9.122 @@ -173,20 +226,23 @@
   9.123     
   9.124     return result;
   9.125   }
   9.126 +*/
   9.127  
   9.128  /*Turns off the VMS system, and frees all data associated with it.  Does this
   9.129   * by creating shutdown SlaveVPs and inserting them into scheduling slots.
   9.130   * Will probably have to wake up sleeping cores as part of this -- the fn that
   9.131   * inserts the new SlaveVPs should handle the wakeup..
   9.132   */
   9.133 +/*
   9.134  void
   9.135  VMS__shutdown()
   9.136   {
   9.137     for( cores )
   9.138 -    { slave = VMS_int__create_new_SlaveVP( shutdownFN, NULL );
   9.139 +    { slave = VMS_int__create_new_SlaveVP( shutdownFn, NULL );
   9.140        VMS_int__insert_slave_onto_core( SlaveVP *slave, coreNum );
   9.141      }
   9.142   }
   9.143 +*/
   9.144  
   9.145  /* VMS__start_VMS_running();
   9.146  
   9.147 @@ -373,7 +429,7 @@
   9.148     pthread_mutex_lock(     &suspendLock );
   9.149     _VMSMasterEnv->setupComplete = 1;
   9.150     pthread_mutex_unlock(   &suspendLock );
   9.151 -   pthread_cond_broadcast( &suspend_cond );
   9.152 +   pthread_cond_broadcast( &suspendCond );
   9.153     
   9.154     
   9.155        //wait for all to complete
   9.156 @@ -437,7 +493,7 @@
   9.157  
   9.158  
   9.159  /*Am trying to be cute, avoiding IF statement in coreLoop that checks for
   9.160 - * a special shutdown procr.  Ended up with extra-complex shutdown sequence.
   9.161 + * a special shutdown slaveVP.  Ended up with extra-complex shutdown sequence.
   9.162   *This function has the sole purpose of setting the stack and framePtr
   9.163   * to the coreLoop's stack and framePtr.. it does that then jumps to the
   9.164   * core loop's shutdown point -- might be able to just call Pthread_exit
    10.1 --- a/VMS_primitive_data_types.h	Fri Mar 09 10:46:36 2012 -0800
    10.2 +++ b/VMS_primitive_data_types.h	Fri Mar 09 22:30:26 2012 -0800
    10.3 @@ -39,6 +39,7 @@
    10.4  typedef unsigned short     uint16;
    10.5  typedef int                int32;
    10.6  typedef unsigned int       uint32;
    10.7 +typedef unsigned int       bool32;
    10.8  typedef long long          int64;
    10.9  typedef unsigned long long uint64;
   10.10  typedef float              float32;
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/__README__Code_Overview.txt	Fri Mar 09 22:30:26 2012 -0800
    11.3 @@ -0,0 +1,20 @@
    11.4 +
    11.5 +This file is intended to help those new to VMS to find their way around the code.
    11.6 +
    11.7 +Some observations:
    11.8 +-] VMS.h is the top header file, and is the root of a tree of #includes that pulls in all the other headers
    11.9 +
   11.10 +-] Defines directory contains all the header files that hold #define statements
   11.11 +
   11.12 +-] VMS has several kinds of function, grouped according to what kind of code should call them: VMS_App_.. for applications to call, VMS_WL_.. for wrapper-library code to call, VMS_PI_.. for plugin code to call, and VMS_int_.. for VMS to use internally.  Sometimes VMS_int_ functions are called from the wrapper library or plugin, but this should only be done by programmers who have gained an in-depth knowledge of VMS's implementation and understand that VMS_int_ functions are not protected for concurrent use..
   11.13 +
   11.14 +-] VMS has its own version of malloc, unfortunately, which is due to the system malloc breaking when the stack-pointer register is manipulated, which VMS must do.  The VMS form of malloc must be used in code that runs inside the VMS system, especially all application code that uses a VMS-based language.  However, a complication is that the malloc implementation is not protected with a lock.  However, mallocs performed in the main thread, outside the VMS-language program, cannot use VMS malloc..  this presents some issues crossing the boundary..
   11.15 +
   11.16 +-] Things in the code are turned on and off by using #define in combination with #ifdef.  All defines for doing this are found in Defines/VMS_defs__turn_on_and_off.h.  The rest of the files in Defines directory contain macro definitions, hardware constants, and any other #define statements.
   11.17 +
   11.18 +-] VMS has many macros used in the code..  such as for measurements and debug..  all measurement, debug, and statistics gathering statements can be turned on or off by commenting-out or uncommenting the appropriate #define.  
   11.19 +
   11.20 +-] The best way to learn VMS is to uncomment  DEBUG__TURN_ON_SEQUENTIAL_MODE, which allows using a normal debugger while sequentially executing through both application code and VMS internals.  Setting breakpoints at various spots in the code is a good way to see the VMS system in operation.
   11.21 +
   11.22 +-] VMS has several "VMS primitives" implemented with assembly code.  The net effect of these assembly functions is to perform the switching between application code and the VMS system.
   11.23 +