annotate src/context.h @ 52:214d21c891c7

rename to cbc __ncode is not handled as interfaces
author kono
date Mon, 03 Jun 2019 18:12:44 +0900
parents fadfd62d6b14
children 435bfab09924
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
41
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
1 /* Context definition for llrb example */
52
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
2 // #ifdef CBC_CONTEXT_H does not work well
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
3 #define CBC_CONTEXT_H
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
4 // #include <stdlib.h>
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
5 // #include <pthread.h>
41
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
6 #ifdef USE_CUDAWorker
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
7 #include <cuda.h>
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
8 #include <driver_types.h>
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
9 #include <cuda_runtime.h>
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
10 #include "helper_cuda.h"
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
11 #endif
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
12
52
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
13 // #include "use_context_numbers.h"
51
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
14
41
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
15 #define ALLOCATE_SIZE 20000000
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
16 #define NEW(type) (type*)(calloc(1, sizeof(type)))
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
17 #define NEWN(n, type) (type*)(calloc(n, sizeof(type)))
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
18
52
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
19 #define ALLOC_DATA(cbc_context, dseg) ({\
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
20 Meta* meta = (Meta*)cbc_context->heap;\
41
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
21 meta->type = D_##dseg;\
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
22 meta->size = sizeof(dseg);\
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
23 meta->len = 1;\
52
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
24 cbc_context->heap += sizeof(Meta);\
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
25 cbc_context->data[D_##dseg] = cbc_context->heap; cbc_context->heap += sizeof(dseg); (dseg *)cbc_context->data[D_##dseg]; })
41
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
26
52
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
27 #define ALLOC_DATA_TYPE(cbc_context, dseg, t) ({\
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
28 Meta* meta = (Meta*)cbc_context->heap;\
41
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
29 meta->type = D_##t;\
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
30 meta->size = sizeof(t);\
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
31 meta->len = 1;\
52
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
32 cbc_context->heap += sizeof(Meta);\
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
33 cbc_context->data[D_##dseg] = cbc_context->heap; cbc_context->heap += sizeof(t); (t *)cbc_context->data[D_##dseg]; })
41
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
34
52
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
35 #define ALLOCATE(cbc_context, t) ({ \
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
36 Meta* meta = (Meta*)cbc_context->heap;\
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
37 cbc_context->heap += sizeof(Meta);\
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
38 union Data* data = cbc_context->heap; \
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
39 cbc_context->heap += sizeof(t); \
41
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
40 meta->type = D_##t; \
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
41 meta->size = sizeof(t); \
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
42 meta->len = 1;\
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
43 data; })
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
44
52
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
45 #define ALLOCATE_ARRAY(cbc_context, t, length) ({ \
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
46 Meta* meta = (Meta*)cbc_context->heap;\
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
47 cbc_context->heap += sizeof(Meta);\
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
48 union Data* data = cbc_context->heap; \
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
49 cbc_context->heap += sizeof(t)*length; \
41
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
50 meta->type = D_##t; \
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
51 meta->size = sizeof(t)*length; \
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
52 meta->len = length; \
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
53 data; })
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
54
52
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
55 #define ALLOCATE_PTR_ARRAY(cbc_context, dseg, length) ({\
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
56 Meta* meta = (Meta*)cbc_context->heap;\
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
57 cbc_context->heap += sizeof(Meta);\
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
58 union Data* data = cbc_context->heap; \
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
59 cbc_context->heap += sizeof(dseg *)*length; \
41
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
60 meta->type = D_##dseg; \
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
61 meta->size = sizeof(dseg *)*length; \
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
62 meta->len = length; \
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
63 data; })
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
64
52
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
65 #define ALLOCATE_DATA_GEAR(cbc_context, t) ({ \
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
66 union Data* data = ALLOCATE(cbc_context, t); \
41
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
67 Meta* meta = GET_META(data); \
52
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
68 meta->wait = createSynchronizedQueue(cbc_context); \
41
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
69 data; })
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
70
52
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
71 #define ALLOC(cbc_context, t) (&ALLOCATE(cbc_context, t)->t)
41
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
72
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
73 #define GET_META(dseg) ((Meta*)(((void*)dseg) - sizeof(Meta)))
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
74 #define GET_TYPE(dseg) (GET_META(dseg)->type)
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
75 #define GET_SIZE(dseg) (GET_META(dseg)->size)
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
76 #define GET_LEN(dseg) (GET_META(dseg)->len)
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
77 #define GET_WAIT_LIST(dseg) (GET_META(dseg)->wait)
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
78
52
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
79 #define Gearef(cbc_context, t) (&(cbc_context)->data[D_##t]->t)
41
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
80
52
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
81 // (SingleLinkedStack *)cbc_context->data[D_Stack]->Stack.stack->Stack.stack
41
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
82
52
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
83 #define GearImpl(cbc_context, intf, name) (Gearef(cbc_context, intf)->name->intf.name)
41
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
84
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
85 #include "c/enumCode.h"
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
86
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
87 enum Relational {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
88 EQ,
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
89 GT,
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
90 LT,
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
91 };
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
92
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
93 #include "c/enumData.h"
51
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
94 #define NDIRECT 12 //fs.h
41
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
95
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
96 struct Context {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
97 enum Code next;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
98 struct Worker* worker;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
99 struct TaskManager* taskManager;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
100 int codeNum;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
101 __code (**code) (struct Context*);
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
102 union Data **data;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
103 void* heapStart;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
104 void* heap;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
105 long heapLimit;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
106 int dataNum;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
107
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
108 // task parameter
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
109 int idgCount; //number of waiting dataGear
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
110 int idg;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
111 int maxIdg;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
112 int odg;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
113 int maxOdg;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
114 int gpu; // GPU task
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
115 struct Context* task;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
116 struct Element* taskList;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
117 #ifdef USE_CUDAWorker
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
118 int num_exec;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
119 CUmodule module;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
120 CUfunction function;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
121 #endif
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
122 /* multi dimension parameter */
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
123 int iterate;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
124 struct Iterator* iterator;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
125 enum Code before;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
126 };
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
127
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
128 typedef int Int;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
129 #ifndef USE_CUDAWorker
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
130 typedef unsigned long long CUdeviceptr;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
131 #endif
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
132 union Data {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
133 struct Meta {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
134 enum DataType type;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
135 long size;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
136 long len;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
137 struct Queue* wait; // tasks waiting this dataGear
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
138 } Meta;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
139 struct Context Context;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
140 struct Timer {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
141 union Data* timer;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
142 enum Code start;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
143 enum Code end;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
144 enum Code next;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
145 } Timer;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
146 struct TimerImpl {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
147 double time;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
148 } TimerImpl;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
149 struct LoopCounter {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
150 int i;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
151 } LoopCounter;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
152 struct TaskManager {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
153 union Data* taskManager;
52
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
154 enum Code spawn; // start NEW cbc_context on the worker
41
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
155 enum Code spawnTasks; // start NEW tasks on the worker
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
156 enum Code shutdown;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
157 enum Code incrementTaskCount;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
158 enum Code decrementTaskCount;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
159 enum Code next;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
160 enum Code next1;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
161 enum Code setWaitTask;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
162 struct Context* task;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
163 struct Element* taskList;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
164 union Data* data;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
165 } TaskManager;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
166 struct TaskManagerImpl {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
167 enum Code next;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
168 int numWorker;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
169 int sendCPUWorkerIndex;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
170 int sendGPUWorkerIndex;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
171 int taskCount;
52
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
172 // pthread_mutex_t mutex;
41
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
173 struct Queue* activeQueue;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
174 struct Worker** workers;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
175 struct Element* taskList;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
176 int loopCounter;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
177 int cpu;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
178 int gpu;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
179 int io;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
180 int maxCPU;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
181 } TaskManagerImpl;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
182 struct Worker {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
183 union Data* worker;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
184 enum Code taskReceive;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
185 enum Code shutdown;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
186 enum Code next;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
187 struct Queue* tasks;
52
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
188 // pthread_t thread;
41
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
189 struct TaskManager* taskManager;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
190 struct Context* task;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
191 } Worker;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
192 struct CPUWorker {
52
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
193 // pthread_mutex_t mutex;
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
194 // pthread_cond_t cond;
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
195 struct Context* cbc_context;
41
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
196 int id;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
197 int loopCounter;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
198 } CPUWorker;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
199 #ifdef USE_CUDAWorker
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
200 struct CUDAWorker {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
201 CUdevice device;
52
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
202 CUcbc_context cuCtx;
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
203 struct Context* cbc_context;
41
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
204 int id;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
205 int loopCounter;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
206 int deviceNum;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
207 struct Queue* tasks;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
208 int runFlag;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
209 enum Code next;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
210 int numStream;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
211 struct Executor* executor;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
212 CUstream *stream;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
213 } CUDAWorker;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
214 #else
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
215 struct CUDAWorker {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
216 } CUDAWorker;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
217 #endif
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
218 struct Main {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
219 enum Code code;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
220 enum Code next;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
221 struct Queue* args;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
222 } Main;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
223 // Queue Interface
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
224 struct Queue {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
225 union Data* queue;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
226 union Data* data;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
227 enum Code whenEmpty;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
228 enum Code clear;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
229 enum Code put;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
230 enum Code take;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
231 enum Code isEmpty;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
232 enum Code next;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
233 } Queue;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
234 struct SingleLinkedQueue {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
235 struct Element* top;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
236 struct Element* last;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
237 } SingleLinkedQueue;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
238 struct SynchronizedQueue {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
239 struct Element* top;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
240 struct Element* last;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
241 struct Atomic* atomic;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
242 } SynchronizedQueue;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
243 // Stack Interface
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
244 struct Stack {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
245 union Data* stack;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
246 union Data* data;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
247 union Data* data1;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
248 enum Code whenEmpty;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
249 enum Code clear;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
250 enum Code push;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
251 enum Code pop;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
252 enum Code pop2;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
253 enum Code isEmpty;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
254 enum Code get;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
255 enum Code get2;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
256 enum Code next;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
257 } Stack;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
258 // Stack implementations
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
259 struct SingleLinkedStack {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
260 struct Element* top;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
261 } SingleLinkedStack;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
262 struct ArrayStack {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
263 int size;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
264 int limit;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
265 struct Element* array;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
266 } ArrayStack;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
267 // Stack implementation end
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
268 struct Element {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
269 union Data* data;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
270 struct Element* next;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
271 } Element;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
272 struct Array {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
273 int prefix;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
274 Int* array;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
275 } Array;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
276 struct Tree {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
277 union Data* tree;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
278 struct Node* node;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
279 enum Code put;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
280 enum Code get;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
281 enum Code remove;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
282 enum Code clear;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
283 enum Code next;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
284 } Tree;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
285 struct RedBlackTree {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
286 struct Node* root;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
287 struct Node* current; // reading node of original tree
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
288 struct Node* previous; // parent of reading node of original tree
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
289 struct Node* newNode; // writing node of new tree
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
290 struct Node* parent;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
291 struct Node* grandparent;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
292 struct Stack* nodeStack;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
293 enum Code findNodeNext;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
294 int result;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
295 } RedBlackTree;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
296 struct RotateTree {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
297 enum Code next;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
298 struct RedBlackTree* traverse;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
299 struct Tree* tree;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
300 } RotateTree;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
301 struct Node {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
302 int key; // comparable data segment
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
303 union Data* value;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
304 struct Node* left;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
305 struct Node* right;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
306 // need to balancing
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
307 enum Color {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
308 Red,
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
309 Black,
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
310 // Red eq 0,Black eq 1. enum name convert intager.
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
311 } color;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
312 } Node;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
313 struct Atomic {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
314 union Data* atomic;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
315 union Data** ptr;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
316 union Data* oldData;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
317 union Data* newData;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
318 enum Code checkAndSet;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
319 enum Code next;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
320 enum Code fail;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
321 } Atomic;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
322 struct AtomicReference {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
323 } AtomicReference;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
324 struct Semaphore {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
325 union Data* semaphore;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
326 enum Code p;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
327 enum Code v;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
328 enum Code next;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
329 } Semaphore;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
330 struct SemaphoreImpl {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
331 int value;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
332 struct Lock* lock;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
333 struct Queue* waitThreadQueue;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
334 } SemaphoreImpl;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
335 struct Allocate {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
336 enum Code next;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
337 long size;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
338 } Allocate;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
339 struct Integer {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
340 int value;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
341 } Integer;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
342 struct SortArray {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
343 struct Integer *array; //Array arrayじゃできない?
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
344 int loopCounter;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
345 int block;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
346 int first;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
347 int prefix;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
348 } SortArray;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
349 struct Iterator {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
350 union Data* iterator;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
351 struct Context* task;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
352 int numGPU;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
353 enum Code exec;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
354 enum Code barrier;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
355 enum Code whenWait;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
356 enum Code next;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
357 } Iterator;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
358 struct MultiDimIterator {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
359 int x;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
360 int y;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
361 int z;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
362 int count;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
363 int counterX;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
364 int counterY;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
365 int counterZ;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
366 } MultiDimIterator;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
367 struct MultiDim {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
368 int x;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
369 int y;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
370 int z;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
371 } MultiDim;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
372 struct Executor {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
373 union Data* executor;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
374 struct Context* task;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
375 enum Code read;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
376 enum Code exec;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
377 enum Code write;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
378 enum Code next;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
379 } Executor;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
380 #ifdef USE_CUDAWorker
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
381 struct CUDAExecutor {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
382 CUdeviceptr** kernelParams;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
383 struct CUDABuffer* buffer;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
384 int maxThreadPerBlock;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
385 int maxThreadPerBlockX;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
386 int maxThreadPerBlockY;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
387 int maxThreadPerBlockZ;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
388 struct Timer* timer;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
389 } CUDAExecutor;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
390 struct CUDABuffer {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
391 int inputLen;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
392 int outputLen;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
393 union Data** inputData;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
394 union Data** outputData;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
395 } CUDABuffer;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
396 CUdeviceptr CUdeviceptr;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
397 #else
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
398 struct CUDAExecutor {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
399 } CUDAExecutor;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
400 struct CUDABuffer {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
401 } CUDABuffer;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
402 CUdeviceptr CUdeviceptr;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
403 #endif
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
404 Int Int;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
405 struct Memory {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
406 union Data* adr;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
407 int length;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
408 union Data* body;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
409 int hash;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
410 } Memory;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
411 struct Buffer {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
412 union Data* buffer;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
413 union Data* data;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
414 enum Code put;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
415 enum Code take;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
416 enum Code next;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
417 } Buffer;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
418 struct BoundedBuffer {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
419 struct Element* top;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
420 struct Element* last;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
421 struct Semaphore* fullCount;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
422 struct Semaphore* emptyCount;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
423 struct Semaphore* lock;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
424 } BoundedBuffer;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
425 struct Lock {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
426 union Data* lock;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
427 enum Code doLock;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
428 enum Code doUnlock;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
429 enum Code next;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
430 } Lock;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
431 struct LockImpl {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
432 Int* lock;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
433 struct Queue* waitThreadQueue;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
434 struct Atomic* atomic;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
435 struct Context* lockContext;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
436 } LockImpl;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
437 struct SpinLock {
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
438 volatile Int* lock;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
439 struct Atomic* atomic;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
440 struct Context* lockContext;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
441 } SpinLock;
52
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
442 /* CbCxv6 cbc_context*/
51
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
443 struct Inode {
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
444 uint dev; // Device number
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
445 uint inum; // Inode number
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
446 int ref; // Reference count
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
447 int flags; // I_BUSY, I_VALID
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
448
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
449 short type; // copy of disk inode
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
450 short major;
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
451 short minor;
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
452 short nlink;
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
453 uint size;
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
454 uint addrs[NDIRECT+1];
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
455 } Inode;
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
456 struct Uinteger {
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
457 uint value;
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
458 } Uinteger;
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
459 struct Short {
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
460 short value;
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
461 } Short;
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
462 struct String {
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
463 char* string;
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
464 } String;
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
465 // fs.h ---
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
466 struct SuperBlock {
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
467 uint size; // Size of file system image (blocks)
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
468 uint nblocks; // Number of data blocks
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
469 uint ninodes; // Number of inodes.
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
470 uint nlog; // Number of log blocks
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
471 } SuperBlock;
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
472 struct Dinode {
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
473 short type; // copy of disk inode
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
474 short major;
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
475 short minor;
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
476 short nlink;
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
477 uint size;
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
478 uint addrs[NDIRECT+1];
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
479 } Dinode;
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
480 struct Dirent {
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
481 ushort inum;
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
482 char name[DIRSIZ];
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
483 } Dirent;
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
484 // --- fs.h
52
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
485 }; // union Data end this is necessary for cbc_context generator
51
fadfd62d6b14 define filesystem DataGeas and ommit stdlib.h
anatofuz
parents: 47
diff changeset
486
41
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
487 typedef union Data Data;
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
488
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
489 #include "c/typedefData.h"
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
490
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
491 #include "c/extern.h"
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
492
52
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
493 extern __code start_code(struct Context* cbc_context);
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
494 extern __code exit_code(struct Context* cbc_context);
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
495 extern __code meta(struct Context* cbc_context, enum Code next);
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
496 //extern __code par_meta(struct Context* cbc_context, enum Code spawns, enum Code next);
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
497 extern __code parGotoMeta(struct Context* cbc_context, enum Code next);
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
498 extern void initContext(struct Context* cbc_context);
41
087d7b61c86b cbc cmake version
kono
parents:
diff changeset
499
52
214d21c891c7 rename to cbc
kono
parents: 51
diff changeset
500 // #endif