1 #ifndef __MLP_RUNTIME__
2 #define __MLP_RUNTIME__
7 #include "psemaphore.h"
18 // each allocation site needs the following
19 typedef struct AllocSite_t{
21 struct Queue* waitingQueue;
24 typedef struct ConflictNode_t{
29 // forward declaration of pointer type
30 typedef struct SESEcommon_t* SESEcommon_p;
32 // these fields are common to any SESE, and casting the
33 // generated SESE record to this can be used, because
34 // the common structure is always the first item in a
35 // customized SESE record
36 typedef struct SESEcommon_t {
38 // the identifier for the class of sese's that
39 // are instances of one particular static code block
42 // a parent waits on this semaphore when stalling on
43 // this child, the child gives it at its SESE exit
47 // the lock guards the following data SESE's
48 // use to coordinate with one another
51 struct Queue* forwardList;
52 int unresolvedDependencies;
54 pthread_cond_t doneCond;
57 pthread_cond_t runningChildrenCond;
58 int numRunningChildren;
62 AllocSite* allocSiteArray;
63 int numRelatedAllocSites;
64 psemaphore memoryStallSiteSem;
65 struct Queue* connectedList;
66 int numRelatedWaitingQueue;
67 int waitingQueueItemID;
72 typedef struct WaitingElement_t{
79 // a thread-local stack of SESEs and function to
80 // ensure it is initialized once per thread
82 extern __thread struct Queue* seseCallStack;
83 extern __thread pthread_once_t mlpOnceObj;
84 void mlpInitOncePerThread();
86 extern __thread SESEcommon_p seseCaller;
89 // simple mechanical allocation and
90 // deallocation of SESE records
91 void* mlpCreateSESErecord( int size );
92 void mlpDestroySESErecord( void* seseRecord );
94 AllocSite* mlpCreateAllocSiteArray(int numAllocSites);
95 ConflictNode* mlpCreateConflictNode(int id);
96 struct QueueItem* addWaitingQueueElement(AllocSite* allocSiteArray, int numAllocSites, long allocID, void *seseRec);
97 WaitingElement* mlpCreateWaitingElement(int status, void* seseToIssue, struct Queue* queue, int id);
100 #endif /* __MLP_RUNTIME__ */