diff MasterLoop.c @ 127:24466227d8bb

bugs fixed, code is now compiling
author Merten Sach <msach@mailbox.tu-berlin.de>
date Wed, 07 Sep 2011 17:45:05 +0200
parents d4c881c7f03a
children dbfc8382d546
line diff
     1.1 --- a/MasterLoop.c	Wed Sep 07 13:07:23 2011 +0200
     1.2 +++ b/MasterLoop.c	Wed Sep 07 17:45:05 2011 +0200
     1.3 @@ -11,12 +11,19 @@
     1.4  
     1.5  #include "VMS.h"
     1.6  #include "ProcrContext.h"
     1.7 -#include "Master_Request_Handlers.h"
     1.8 +#include "inter_VMS_request_handlers.h"
     1.9  
    1.10  //===========================================================================
    1.11  void inline
    1.12  stealWorkInto( SchedSlot *currSlot, VMSQueueStruc *readyToAnimateQ,
    1.13 -               VirtProcr *masterPr );
    1.14 +               VirtProcr *masterPr);
    1.15 +
    1.16 +void inline
    1.17 +handleInterMasterReq( InterMasterReqst *currReq, void *_semEnv,
    1.18 +                                                    VirtProcr *masterPr);
    1.19 +
    1.20 +void inline
    1.21 +handleInterVMSCoreReq( InterVMSCoreReqst *currReq, VirtProcr *masterPr);
    1.22  
    1.23  //===========================================================================
    1.24  
    1.25 @@ -91,8 +98,6 @@
    1.26        //First animation of each MasterVP will in turn animate this part
    1.27        // of setup code.. (VP creator sets up the stack as if this function
    1.28        // was called normally, but actually get here by jmp)
    1.29 -      //So, setup values about stack ptr, jmp pt and all that
    1.30 -   //masterPr->nextInstrPt = &&masterLoopStartPt;
    1.31  
    1.32        //Sept 2011
    1.33        //Old code jumped directly to this point, but doesn't work on x64
    1.34 @@ -123,12 +128,13 @@
    1.35     semanticEnv      = masterEnv->semanticEnv;
    1.36  
    1.37        //First, check for requests from other MasterVPs, and handle them
    1.38 -   if( currReq = masterEnv->interMasterRequestsFor[thisCoresIdx] )
    1.39 -    { do
    1.40 -       { handleInterMasterReq( currReq, semanticEnv, masterPr );
    1.41 -       }
    1.42 -      while( currReq = currReq->nextReqst );
    1.43 -    }
    1.44 +   InterMasterReqst* currReq = masterEnv->interMasterRequestsFor[thisCoresIdx];
    1.45 +   while(currReq)
    1.46 +   {
    1.47 +       handleInterMasterReq( currReq, semanticEnv, masterPr );
    1.48 +       currReq = currReq->nextReqst;
    1.49 +   }
    1.50 +   
    1.51        //Now, take care of the SlaveVPs
    1.52        //Go through the slots -- if Slave there newly suspended, handle its request
    1.53        // then, either way, ask assigner to fill each slot
    1.54 @@ -201,30 +207,33 @@
    1.55  void inline
    1.56  handleInterMasterReq( InterMasterReqst *currReq, void *_semEnv,
    1.57                                                      VirtProcr *masterPr )
    1.58 - { switch( currReq->reqType )
    1.59 -    { case destVMSCore:
    1.60 -            handleInterVMSCoreReq( (InterVMSCoreReqst *)currReq, masterPr);
    1.61 + { 
    1.62 +    
    1.63 +    switch( currReq->reqType )
    1.64 +    {  
    1.65 +      case destVMSCore:
    1.66 +         handleInterVMSCoreReq( (InterVMSCoreReqst *)currReq, masterPr);
    1.67           break;
    1.68        case destPlugin:
    1.69 -	       (*interPluginReqHdlr)( ((InterPluginReqst  *)currReq)->pluginReq,
    1.70 -                                                                _semEnv );
    1.71 -         break;
    1.72 +         _VMSMasterEnv->interPluginReqHdlr( ((InterPluginReqst  *)currReq)->pluginReq,
    1.73 +                                                                    _semEnv );
    1.74 +          break;
    1.75        default:
    1.76           break;
    1.77      }
    1.78   }
    1.79  
    1.80  void inline
    1.81 -handleInterVMSReq( InterVMSCoreReqst *currReq, VirtProcr *masterPr )
    1.82 +handleInterVMSCoreReq( InterVMSCoreReqst *currReq, VirtProcr *masterPr )
    1.83   { 
    1.84     switch( currReq->reqType )
    1.85      {
    1.86        case transfer_free_ptr:    handleTransferFree( currReq, masterPr );
    1.87           break;
    1.88 +      default:
    1.89 +          break;
    1.90      }
    1.91 - }
    1.92 - 
    1.93 - 
    1.94 +}
    1.95  
    1.96  /*Work Stealing Alg -- racy one
    1.97   *This algorithm has a race condition -- the coreloops are accessing their