about to make lots of changes to system, just committing this stable compilation...
[IRC.git] / Robust / src / Runtime / mlp_runtime.c
1 #include <stdlib.h>
2 #include <stdio.h>
3 #include <assert.h>
4 #include "mlp_runtime.h"
5 #include "Queue.h"
6
7
8 // the root sese is accessible globally so
9 // buildcode can generate references to it
10 struct SESErecord* rootsese;
11
12
13 // the issuedQ, in this simple version, spits
14 // out SESErecord's in the order they were issued
15 static struct Queue* issuedQ;
16
17
18 // the class_age2instance maps an SESE class id and
19 // age value to a particular SESErecord instance
20 static struct SESErecord** class_age2instance;
21
22
23 // each core should have a current SESE
24 static struct SESErecord* current;
25
26
27 void mlpInit( int totalNumSESEs, int maxSESEage ) {  
28   rootsese = (struct SESErecord*) malloc( sizeof( struct SESErecord ) );
29
30   issuedQ = createQueue();
31
32   class_age2instance = (struct SESErecord**) malloc( sizeof( struct SESErecord* ) *
33                                                      maxSESEage *
34                                                      totalNumSESEs
35                                                    );
36    
37   current = rootsese;
38 }
39
40
41 struct SESErecord* mlpGetCurrent() {
42   return current;
43 }
44
45
46 void mlpIssue( struct SESErecord* sese ) {
47   addNewItem( issuedQ, (void*) sese );
48 }
49
50
51 struct SESErecord* mlpSchedule() {
52   assert( !isEmpty( issuedQ ) );
53   return (struct SESErecord*) getItem( issuedQ );  
54 }
55
56
57 void mlpStall( struct SESErecord* sese ) {
58   
59 }
60
61
62 void mlpNotifyExit( struct SESErecord* sese ) {
63   
64 }