annotate SSR.h @ 22:fef69b887df4

Working version of singleton! Woohoo. Messes with return addr on stack.
author Me
date Sat, 13 Nov 2010 15:19:18 -0800
parents ad29ff7a0209
children a8e41e0bfa61
rev   line source
Me@6 1 /*
Me@6 2 * Copyright 2009 OpenSourceStewardshipFoundation.org
Me@6 3 * Licensed under GNU General Public License version 2
Me@6 4 *
Me@6 5 * Author: seanhalle@yahoo.com
Me@6 6 *
Me@6 7 */
Me@6 8
Me@6 9 #ifndef _SSR_H
Me@6 10 #define _SSR_H
Me@6 11
Me@6 12 #include "VMS/Queue_impl/PrivateQueue.h"
Me@6 13 #include "VMS/Hash_impl/PrivateHash.h"
Me@6 14 #include "VMS/VMS.h"
Me@6 15
Me@17 16
Me@17 17 //===========================================================================
Me@17 18 #define NUM_STRUCS_IN_SEM_ENV 1000
Me@17 19
Me@17 20 //===========================================================================
Me@6 21 /*This header defines everything specific to the SSR semantic plug-in
Me@6 22 */
Me@6 23 typedef struct _SSRSemReq SSRSemReq;
Me@17 24 typedef void (*PtrToAtomicFn ) ( void * ); //executed atomically in master
Me@17 25 //===========================================================================
Me@6 26
Me@6 27 /*Semantic layer-specific data sent inside a request from lib called in app
Me@6 28 * to request handler called in MasterLoop
Me@6 29 */
Me@21 30
Me@21 31 typedef struct
Me@21 32 {
Me@21 33 VirtProcr *VPCurrentlyExecuting;
Me@21 34 PrivQueueStruc *waitingVPQ;
Me@21 35 }
Me@21 36 SSRTrans;
Me@21 37
Me@21 38 typedef struct
Me@21 39 {
Me@22 40 void *endInstrAddr;
Me@21 41 int32 hasBeenStarted;
Me@21 42 int32 hasFinished;
Me@21 43 PrivQueueStruc *waitQ;
Me@21 44 }
Me@21 45 SSRSingleton;
Me@21 46
Me@6 47 enum SSRReqType
Me@6 48 {
Me@6 49 send_type = 1,
Me@6 50 send_from_to,
Me@6 51 receive_any, //order and grouping matter -- send before receive
Me@6 52 receive_type, // and receive_any first of the receives -- Handlers
Me@6 53 receive_from_to,// rely upon this ordering of enum
Me@6 54 transfer_to,
Me@17 55 transfer_out,
Me@17 56 malloc_req,
Me@17 57 free_req,
Me@21 58 singleton_fn_start,
Me@21 59 singleton_fn_end,
Me@21 60 singleton_data_start,
Me@21 61 singleton_data_end,
Me@17 62 atomic,
Me@17 63 trans_start,
Me@17 64 trans_end
Me@6 65 };
Me@6 66
Me@6 67 struct _SSRSemReq
Me@6 68 { enum SSRReqType reqType;
Me@17 69 VirtProcr *sendPr;
Me@17 70 VirtProcr *receivePr;
Me@17 71 int32 msgType;
Me@17 72 void *msg;
Me@6 73 SSRSemReq *nextReqInHashEntry;
Me@17 74
Me@17 75 void *initData;
Me@17 76 VirtProcrFnPtr fnPtr;
Me@17 77 int32 coreToScheduleOnto;
Me@17 78
Me@17 79 int32 sizeToMalloc;
Me@17 80 void *ptrToFree;
Me@17 81
Me@17 82 int32 singletonID;
Me@22 83 SSRSingleton **singletonPtrAddr;
Me@17 84
Me@17 85 PtrToAtomicFn fnToExecInMaster;
Me@17 86 void *dataForFn;
Me@17 87
Me@17 88 int32 transID;
Me@6 89 }
Me@6 90 /* SSRSemReq */;
Me@6 91
Me@17 92
Me@17 93 typedef struct
Me@17 94 {
Me@6 95 PrivQueueStruc **readyVPQs;
Me@14 96 HashTable *commHashTbl;
Me@14 97 int32 numVirtPr;
Me@14 98 int32 nextCoreToGetNewPr;
Me@14 99 int32 primitiveStartTime;
Me@17 100
Me@17 101 //fix limit on num with dynArray
Me@21 102 SSRSingleton fnSingletons[NUM_STRUCS_IN_SEM_ENV];
Me@17 103 SSRTrans transactionStrucs[NUM_STRUCS_IN_SEM_ENV];
Me@6 104 }
Me@6 105 SSRSemEnv;
Me@6 106
Me@6 107
Me@17 108 typedef struct _TransListElem TransListElem;
Me@17 109 struct _TransListElem
Me@17 110 {
Me@17 111 int32 transID;
Me@17 112 TransListElem *nextTrans;
Me@17 113 };
Me@18 114 //TransListElem
Me@18 115
Me@17 116 typedef struct
Me@17 117 {
Me@17 118 int32 highestTransEntered;
Me@17 119 TransListElem *lastTransEntered;
Me@17 120 }
Me@17 121 SSRSemData;
Me@17 122
Me@6 123 //===========================================================================
Me@6 124
Me@6 125 void
Me@6 126 SSR__create_seed_procr_and_do_work( VirtProcrFnPtr fn, void *initData );
Me@6 127
Me@14 128 int32
Me@14 129 SSR__giveMinWorkUnitCycles( float32 percentOverhead );
Me@14 130
Me@20 131 void
Me@14 132 SSR__start_primitive();
Me@14 133
Me@20 134 int32
Me@14 135 SSR__end_primitive_and_give_cycles();
Me@14 136
Me@16 137 int32
Me@16 138 SSR__giveIdealNumWorkUnits();
Me@14 139
Me@17 140 int32
Me@17 141 SSR__give_number_of_cores_to_schedule_onto();
Me@17 142
Me@6 143 //=======================
Me@6 144
Me@6 145 void
Me@6 146 SSR__init();
Me@6 147
Me@6 148 void
Me@6 149 SSR__cleanup_after_shutdown();
Me@6 150
Me@6 151 //=======================
Me@6 152
Me@20 153 VirtProcr *
Me@6 154 SSR__create_procr_with( VirtProcrFnPtr fnPtr, void *initData,
Me@6 155 VirtProcr *creatingPr );
Me@6 156
Me@20 157 VirtProcr *
Me@17 158 SSR__create_procr_with_affinity( VirtProcrFnPtr fnPtr, void *initData,
Me@17 159 VirtProcr *creatingPr, int32 coreToScheduleOnto);
Me@17 160
Me@6 161 void
Me@6 162 SSR__dissipate_procr( VirtProcr *procrToDissipate );
Me@6 163
Me@6 164 //=======================
Me@6 165 void *
Me@17 166 SSR__malloc_to( int numBytes, VirtProcr *ownerPr );
Me@17 167
Me@17 168 void
Me@17 169 SSR__free( void *ptrToFree, VirtProcr *owningPr );
Me@6 170
Me@6 171 void
Me@6 172 SSR__transfer_ownership_of_from_to( void *data, VirtProcr *oldOwnerPr,
Me@6 173 VirtProcr *newOwnerPr );
Me@6 174
Me@6 175 void
Me@6 176 SSR__add_ownership_by_to( VirtProcr *newOwnerPr, void *data );
Me@6 177
Me@6 178 void
Me@6 179 SSR__remove_ownership_by_from( VirtProcr *loserPr, void *dataLosing );
Me@6 180
Me@6 181 void
Me@6 182 SSR__transfer_ownership_to_outside( void *dataToTransferOwnershipOf );
Me@6 183
Me@6 184
Me@6 185
Me@6 186 //=======================
Me@6 187 void
Me@6 188 SSR__send_of_type_to( VirtProcr *sendPr, void *msg, const int type,
Me@6 189 VirtProcr *receivePr);
Me@6 190
Me@6 191 void
Me@6 192 SSR__send_from_to( void *msg, VirtProcr *sendPr, VirtProcr *receivePr);
Me@6 193
Me@6 194 void *
Me@6 195 SSR__receive_type_to( const int type, VirtProcr *receivePr );
Me@6 196
Me@6 197 void *
Me@6 198 SSR__receive_from_to( VirtProcr *sendPr, VirtProcr *receivePr );
Me@6 199
Me@6 200
Me@17 201 //======================= Concurrency Stuff ======================
Me@17 202 void
Me@21 203 SSR__start_fn_singleton( int32 singletonID, VirtProcr *animPr );
Me@21 204
Me@21 205 void
Me@21 206 SSR__end_fn_singleton( int32 singletonID, VirtProcr *animPr );
Me@21 207
Me@21 208 void
Me@21 209 SSR__start_data_singleton( SSRSingleton **singeltonAddr, VirtProcr *animPr );
Me@21 210
Me@21 211 void
Me@21 212 SSR__end_data_singleton( SSRSingleton **singletonAddr, VirtProcr *animPr );
Me@6 213
Me@6 214 void
Me@17 215 SSR__animate_short_fn_in_isolation( PtrToAtomicFn ptrToFnToExecInMaster,
Me@17 216 void *data, VirtProcr *animPr );
Me@17 217
Me@17 218 void
Me@17 219 SSR__start_transaction( int32 transactionID, VirtProcr *animPr );
Me@17 220
Me@17 221 void
Me@17 222 SSR__end_transaction( int32 transactionID, VirtProcr *animPr );
Me@6 223
Me@6 224
Me@6 225 //========================= Internal use only =============================
Me@6 226 void
Me@6 227 SSR__Request_Handler( VirtProcr *requestingPr, void *_semEnv );
Me@6 228
Me@6 229 VirtProcr *
Me@6 230 SSR__schedule_virt_procr( void *_semEnv, int coreNum );
Me@6 231
Me@6 232
Me@6 233 #endif /* _SSR_H */
Me@6 234