1 #ifndef __MLP_RUNTIME__
2 #define __MLP_RUNTIME__
7 #include "psemaphore.h"
18 // each allocation site nees the following
19 typedef struct AllocSite_t{
21 struct Queue* waitingQueue;
24 // forward declaration of pointer type
25 typedef struct SESEcommon_t* SESEcommon_p;
27 // these fields are common to any SESE, and casting the
28 // generated SESE record to this can be used, because
29 // the common structure is always the first item in a
30 // customized SESE record
31 typedef struct SESEcommon_t {
33 // the identifier for the class of sese's that
34 // are instances of one particular static code block
37 // a parent waits on this semaphore when stalling on
38 // this child, the child gives it at its SESE exit
42 // the lock guards the following data SESE's
43 // use to coordinate with one another
46 struct Queue* forwardList;
47 int unresolvedDependencies;
49 pthread_cond_t doneCond;
52 pthread_cond_t runningChildrenCond;
53 int numRunningChildren;
57 AllocSite* allocSiteArray;
58 int numRelatedAllocSites;
59 psemaphore memoryStallSiteSem;
64 // a thread-local stack of SESEs and function to
65 // ensure it is initialized once per thread
67 extern __thread struct Queue* seseCallStack;
68 extern __thread pthread_once_t mlpOnceObj;
69 void mlpInitOncePerThread();
71 extern __thread SESEcommon_p seseCaller;
74 // simple mechanical allocation and
75 // deallocation of SESE records
76 void* mlpCreateSESErecord( int size );
77 void mlpDestroySESErecord( void* seseRecord );
79 AllocSite* mlpCreateAllocSiteArray(int numAllocSites);
82 #endif /* __MLP_RUNTIME__ */