Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
diff VMS.c @ 71:5ff1631c26ed
working O3 version
| author | Merten Sach <msach@mailbox.tu-berlin.de> |
|---|---|
| date | Mon, 30 May 2011 18:28:41 +0200 |
| parents | 11bfe9d136ed |
| children | f6990e1ba998 |
line diff
1.1 --- a/VMS.c Wed May 11 16:13:24 2011 +0200 1.2 +++ b/VMS.c Mon May 30 18:28:41 2011 +0200 1.3 @@ -11,6 +11,7 @@ 1.4 #include <sys/time.h> 1.5 1.6 #include "VMS.h" 1.7 +#include "SwitchAnimators.h" 1.8 #include "Queue_impl/BlockingQueue.h" 1.9 #include "Histogram/Histogram.h" 1.10 1.11 @@ -76,6 +77,8 @@ 1.12 create_the_coreLoop_OS_threads(); 1.13 } 1.14 1.15 +#ifdef SEQUENTIAL 1.16 + 1.17 /*To initialize the sequential version, just don't create the threads 1.18 */ 1.19 void 1.20 @@ -84,6 +87,8 @@ 1.21 create_masterEnv(); 1.22 } 1.23 1.24 +#endif 1.25 + 1.26 void 1.27 create_masterEnv() 1.28 { MasterEnv *masterEnv; 1.29 @@ -261,6 +266,7 @@ 1.30 // the Master env and rest of VMS locations 1.31 } 1.32 1.33 +#ifdef SEQUENTIAL 1.34 /*Only difference between version with an OS thread pinned to each core and 1.35 * the sequential version of VMS is VMS__init_Seq, this, and coreLoop_Seq. 1.36 */ 1.37 @@ -272,8 +278,7 @@ 1.38 coreLoop_Seq( NULL ); 1.39 1.40 } 1.41 - 1.42 - 1.43 +#endif 1.44 1.45 /*Create stack, then create __cdecl structure on it and put initialData and 1.46 * pointer to the new structure instance into the parameter positions on 1.47 @@ -378,7 +383,7 @@ 1.48 // scheduled again at some future point -- to resume, core loop jumps 1.49 // to the resume point (below), which causes restore of saved regs and 1.50 // "return" from this call. 1.51 - animatingPr->nextInstrPt = &&ResumePt; 1.52 + //animatingPr->nextInstrPt = &&ResumePt; 1.53 1.54 //return ownership of the virt procr and sched slot to Master virt pr 1.55 animatingPr->schedSlot->workIsDone = TRUE; 1.56 @@ -390,51 +395,11 @@ 1.57 #endif 1.58 //======================================================================= 1.59 1.60 -/* VirtProcr offsets: 1.61 - * 0xc stackPtr 1.62 - * 0x10 framePtr 1.63 - * 0x14 nextInstrPt 1.64 - * 0x1c coreLoopFramePtr 1.65 - * 0x20 coreLoopStackPtr 1.66 - * 1.67 - * _VMSMasterEnv offsets: 1.68 - * 0x24 coreLoopStartPt 1.69 - * 0x28 coreLoopEndPt 1.70 - * 0x30 masterLock 1.71 - */ 1.72 -// SwitchToCoreLoop( animatingPr ) 1.73 - asm volatile("movl %0, %%ebx; \ 1.74 - movl %1, %%ecx; \ 1.75 - movl %%esp, 0x0c(%%ecx); \ 1.76 - movl %%ebp, 0x10(%%ecx); \ 1.77 - movl 0x24(%%ebx), %%eax; \ 1.78 - movl 0x20(%%ecx), %%esp; \ 1.79 - movl 0x1c(%%ecx), %%ebp; \ 1.80 - jmp %%eax" \ 1.81 - /* outputs */ : \ 1.82 - /* inputs */ : "g"(_VMSMasterEnv), "g"(animatingPr) \ 1.83 - /* clobber */ : "memory", "%eax", "%ebx", "%ecx", "%edx", "%edi", "%esi" \ 1.84 - ); 1.85 - 1.86 -// asm volatile("mov %0,%%ebx; \ 1.87 - mov %%ebx, %%eax; \ 1.88 - add $0xc, %%eax; \ 1.89 - movl %%esp, (%%eax); \ 1.90 - mov %%ebx, %%eax; \ 1.91 - add $0x10, %%eax; \ 1.92 - movl %%ebp, (%%eax); \ 1.93 - movl %1, %%eax; \ 1.94 - movl %2, %%esp; \ 1.95 - movl %3, %%ebp; \ 1.96 - jmp %%eax" \ 1.97 - /* outputs */ : \ 1.98 - /* inputs */ : "g"(animatingPr), "g" (jmpPt), "g" (coreLoopStackPtr), \ 1.99 - "g" (coreLoopFramePtr) \ 1.100 - /* clobber */ : "memory", "%eax", "%ebx", "%ecx", "%edx", "%edi", "%esi" \ 1.101 - ); 1.102 + switchToCoreLoop(animatingPr); 1.103 + flushRegisters(); 1.104 1.105 //======================================================================= 1.106 -ResumePt: 1.107 + 1.108 #ifdef MEAS__TIME_STAMP_SUSP 1.109 //NOTE: only take low part of count -- do sanity check when take diff 1.110 saveLowTimeStampCountInto( animatingPr->postSuspTSCLow ); 1.111 @@ -738,21 +703,8 @@ 1.112 */ 1.113 void 1.114 endOSThreadFn( void *initData, VirtProcr *animatingPr ) 1.115 - { void *jmpPt, *coreLoopStackPtr, *coreLoopFramePtr; 1.116 - 1.117 - jmpPt = _VMSMasterEnv->coreLoopEndPt; 1.118 - coreLoopStackPtr = animatingPr->coreLoopStackPtr; 1.119 - coreLoopFramePtr = animatingPr->coreLoopFramePtr; 1.120 - 1.121 - 1.122 - asm volatile("movl %0, %%eax; \ 1.123 - movl %1, %%esp; \ 1.124 - movl %2, %%ebp; \ 1.125 - jmp %%eax " \ 1.126 - /* outputs */ : \ 1.127 - /* inputs */ : "m" (jmpPt), "m"(coreLoopStackPtr), "m"(coreLoopFramePtr)\ 1.128 - /* clobber */ : "memory", "%eax", "%ebx", "%ecx", "%edx", "%edi","%esi" \ 1.129 - ); 1.130 + { 1.131 + asmTerminateCoreLoop(animatingPr); 1.132 } 1.133 1.134
