Mercurial > repos > rhope
comparison nworker.rhope @ 20:b715532225c0
Differentiate between method and normal calls in dataflow graph compiler
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 27 May 2009 21:42:37 -0400 |
parents | 90c20dc3f4e5 |
children | e9272f7ebd26 |
comparison
equal
deleted
inserted
replaced
19:90c20dc3f4e5 | 20:b715532225c0 |
---|---|
1 Import extendlib.rhope | 1 Import extendlib.rhope |
2 Import cbackend.rhope | |
2 | 3 |
3 Set@Range[range,index,val:out] | 4 Set@Range[range,index,val:out] |
4 { | 5 { |
5 out <- [[()]Concatenate[range] | 6 out <- [[()]Concatenate[range] |
6 ]Set[index,val] | 7 ]Set[index,val] |
247 out <- [worker]_Dependency Groups[no deps, no deps, [()]Append[no deps]] | 248 out <- [worker]_Dependency Groups[no deps, no deps, [()]Append[no deps]] |
248 } | 249 } |
249 | 250 |
250 Compile Node@NWorker[worker,program,func,nodes,current:out] | 251 Compile Node@NWorker[worker,program,func,nodes,current:out] |
251 { | 252 { |
253 Print[[node]Type >>] | |
252 node <- [[worker]Nodes >>]Index[[nodes]Index[current]] | 254 node <- [[worker]Nodes >>]Index[[nodes]Index[current]] |
253 If[[[node]Type >>] = [""]] | 255 If[[[node]Type >>] = ["call"]] |
254 { | 256 { |
255 nfunc <- [func]Call[[[node]Data >>]Name >>, ()] | 257 [program]Method?[[[node]Data >>]Name >>] |
258 { | |
259 nfunc <- [func]Method Call[[[node]Data >>]Name >>, ()] | |
260 }{ | |
261 nfunc <- [func]Call[[[node]Data >>]Name >>, ()] | |
262 } | |
256 }{ | 263 }{ |
257 nfunc <- Val[func] | 264 nfunc <- Val[func] |
258 } | 265 } |
259 [nodes]Next[current] | 266 [nodes]Next[current] |
260 { | 267 { |
261 out <- [worker]Compile Node[program,func,nodes,~] | 268 out <- [worker]Compile Node[program,nfunc,nodes,~] |
262 }{ | 269 }{ |
263 out <- Val[nfunc] | 270 out <- Val[nfunc] |
264 } | 271 } |
265 } | 272 } |
266 | 273 |
273 }{ | 280 }{ |
274 nfunc <- Val[func] | 281 nfunc <- Val[func] |
275 } | 282 } |
276 [groups]Next[current] | 283 [groups]Next[current] |
277 { | 284 { |
278 out <- [worker]Compile Group[program,func,groups,~] | 285 out <- [worker]Compile Group[program,nfunc,groups,~] |
279 }{ | 286 }{ |
280 out <- Val[nfunc] | 287 out <- Val[nfunc] |
281 } | 288 } |
282 } | 289 } |
283 | 290 |
289 { | 296 { |
290 final func <- [worker]Compile Group[program,func,groups, ~] | 297 final func <- [worker]Compile Group[program,func,groups, ~] |
291 }{ | 298 }{ |
292 final func <- Val[func] | 299 final func <- Val[func] |
293 } | 300 } |
294 out <- [program]Store Function[func] | 301 out <- [program]Store Function[final func] |
295 } | 302 } |
296 | 303 |
297 Test[:out] | 304 Test[:out] |
298 { | 305 { |
299 ref+ <- Worker Ref["+","cdecl",2,1] | 306 ref+ <- Worker Ref["+","cdecl",2,1] |
310 ]Add Wire[call+,0,call*,0] | 317 ]Add Wire[call+,0,call*,0] |
311 ]Add Wire[c,0,call*,1] | 318 ]Add Wire[c,0,call*,1] |
312 ]Add Wire[call*,0,outref,0] | 319 ]Add Wire[call*,0,outref,0] |
313 }}}}}} | 320 }}}}}} |
314 } | 321 } |
322 | |
323 Test Compile[:out] | |
324 { | |
325 out <- [Test[]]Compile Worker[C Program[] "Test"] | |
326 } | |
327 | |
328 Main[] | |
329 { | |
330 Pretty Print[Test Compile[], ""] | |
331 } |