annotate nworker_c.rhope @ 170:ac5c2d78663f

Inline calls to If@Boolean when static type info is present
author Mike Pavone <pavone@retrodev.com>
date Sun, 08 May 2011 18:21:19 -0700
parents fd06fb07762a
children a32afde77abb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1 Import number_c.rhope
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
2 Import boolean.rhope
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
3
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
4 Blueprint Condition Set
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
5 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
6 Variables
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
7 Subsets
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
8 Condition Type
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
9 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
10
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
11 AndSet[:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
12 {
120
cd25171e1bb2 Use List for Subsets instead of a Dictionary for performance reasons. Fix issue with List literals. Compiled compiler is now self-hosting.
Mike Pavone <pavone@retrodev.com>
parents: 118
diff changeset
13 out <- [[[Build[Condition Set()]]Variables <<[Dictionary[]]]Subsets <<[()]]Condition Type <<["And"]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
14 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
15
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
16 OrSet[:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
17 {
120
cd25171e1bb2 Use List for Subsets instead of a Dictionary for performance reasons. Fix issue with List literals. Compiled compiler is now self-hosting.
Mike Pavone <pavone@retrodev.com>
parents: 118
diff changeset
18 out <- [[[Build[Condition Set()]]Variables <<[Dictionary[]]]Subsets <<[()]]Condition Type <<["Or"]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
19 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
20
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
21 To String@Condition Set[set:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
22 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
23 out <- [[[[[set]Condition Type >>
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
24 ]Append["Set:\n\tVariables:\n\t\t"]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
25 ]Append[ Join[Keys[[set]Variables >>], "\n\t\t"] ]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
26 ]Append["\n\tSubsets:\n\t\t"]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
27 ]Append[ Join[Keys[[set]Subsets >>], "\n\t\t"] ]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
28 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
29
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
30 Add Condition@Condition Set[set,cond:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
31 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
32 If[[Blueprint Of[cond]] = [Condition Set()]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
33 {
114
25a205094f9b More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents: 102
diff changeset
34 If[[[set]Condition Type >>]=[[cond]Condition Type >>]]
25a205094f9b More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents: 102
diff changeset
35 {
25a205094f9b More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents: 102
diff changeset
36 out <- [[set]Variables <<[ Combine[[set]Variables >>, [cond]Variables >>] ]
120
cd25171e1bb2 Use List for Subsets instead of a Dictionary for performance reasons. Fix issue with List literals. Compiled compiler is now self-hosting.
Mike Pavone <pavone@retrodev.com>
parents: 118
diff changeset
37 ]Subsets <<[ Concatenate[[set]Subsets >>, [cond]Subsets >>] ]
114
25a205094f9b More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents: 102
diff changeset
38 }{
25a205094f9b More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents: 102
diff changeset
39 [cond]Empty?
25a205094f9b More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents: 102
diff changeset
40 {
117
4d089503fb51 Performance optimization
Mike Pavone <pavone@retrodev.com>
parents: 115
diff changeset
41 [cond]Simple?
4d089503fb51 Performance optimization
Mike Pavone <pavone@retrodev.com>
parents: 115
diff changeset
42 { out <- [set]Variables <<[ Combine[[set]Variables >>, [cond]Variables >>] ] }
120
cd25171e1bb2 Use List for Subsets instead of a Dictionary for performance reasons. Fix issue with List literals. Compiled compiler is now self-hosting.
Mike Pavone <pavone@retrodev.com>
parents: 118
diff changeset
43 { out <- [set]Subsets <<[ [[set]Subsets>>]Append[cond] ] }
114
25a205094f9b More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents: 102
diff changeset
44 }{
25a205094f9b More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents: 102
diff changeset
45 out <- set
25a205094f9b More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents: 102
diff changeset
46 }
25a205094f9b More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents: 102
diff changeset
47 }
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
48 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
49 out <- [set]Variables <<[ [[set]Variables >>]Set[cond, Yes] ]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
50 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
51 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
52
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
53 =@Condition Set[set1,set2:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
54 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
55 ,out <- If[[[set1]Condition Type >>] = [[set2]Condition Type >>]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
56 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
57 ,out <- If[[[set1]Variables >>] = [[set2]Variables >>]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
58 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
59 out,out <- If[[[set1]Subsets >>] = [[set2]Subsets >>]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
60 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
61 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
62 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
63
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
64 _For Backend Var[current,junk,variable,type:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
65 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
66 If[[type]=["And"]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
67 { cond <- Val[AndCond[?]] }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
68 { cond <- Val[OrCond[?]] }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
69 out <- [cond]Call[current, variable]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
70 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
71
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
72 _For Backend Subset[current,subset,type:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
73 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
74 [subset]For Backend
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
75 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
76 If[[type]=["And"]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
77 { cond <- Val[AndCond[?]] }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
78 { cond <- Val[OrCond[?]] }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
79 out <- out <- [cond]Call[current, ~]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
80 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
81 out <- current
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
82 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
83 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
84
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
85 Empty?@Condition Set[set:not empty,empty]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
86 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
87 [[set]Variables >>]First
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
88 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
89 not empty <- Yes
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
90 }{
114
25a205094f9b More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents: 102
diff changeset
91 ,empty <- [[set]Subsets >>]First
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
92 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
93 not empty <- Yes
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
94 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
95 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
96 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
97
117
4d089503fb51 Performance optimization
Mike Pavone <pavone@retrodev.com>
parents: 115
diff changeset
98 Simple?@Condition Set[set:simple,not simple]
4d089503fb51 Performance optimization
Mike Pavone <pavone@retrodev.com>
parents: 115
diff changeset
99 {
4d089503fb51 Performance optimization
Mike Pavone <pavone@retrodev.com>
parents: 115
diff changeset
100 ,not simple <- If[[Length[[set]Variables >>]]=[1]]
4d089503fb51 Performance optimization
Mike Pavone <pavone@retrodev.com>
parents: 115
diff changeset
101 {
4d089503fb51 Performance optimization
Mike Pavone <pavone@retrodev.com>
parents: 115
diff changeset
102 simple,not simple <- If[[Blueprint Of[[set]Subsets >>]]=[Empty Dictionary()]]
4d089503fb51 Performance optimization
Mike Pavone <pavone@retrodev.com>
parents: 115
diff changeset
103 }
4d089503fb51 Performance optimization
Mike Pavone <pavone@retrodev.com>
parents: 115
diff changeset
104 }
4d089503fb51 Performance optimization
Mike Pavone <pavone@retrodev.com>
parents: 115
diff changeset
105
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
106 For Backend@Condition Set[set:out,none]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
107 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
108 firstvar <- [[set]Variables >>]First
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
109 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
110 [[set]Variables >>]Next[~]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
111 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
112 vars <- _Fold[[set]Variables >>, ~, firstvar, _For Backend Var[?, ?, ?, [set]Condition Type >>]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
113 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
114 vars <- Val[firstvar]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
115 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
116 out <- Fold[_For Backend Subset[?, ?, [set]Condition Type >>], vars, [set]Subsets >>]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
117 }{
114
25a205094f9b More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents: 102
diff changeset
118 [[set]Subsets >>]First
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
119 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
120 firstsub <- [[[set]Subsets >>]Index[~]]For Backend
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
121 [[set]Subsets >>]Next[~]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
122 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
123 out <- _Fold[[set]Subsets >>, ~, firstsub, _For Backend Subset[?, ?, [set]Condition Type >>]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
124 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
125 out <- Val[firstsub]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
126 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
127 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
128 none <- Yes
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
129 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
130 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
131 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
132
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
133 List of Lists[num:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
134 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
135 out <- Fold[Append[?, ()],(), Range[0,num]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
136 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
137
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
138 Blueprint Worker Ref
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
139 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
140 Name
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
141 Convention
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
142 Inputs
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
143 Min Inputs
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
144 Outputs
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
145 Min Outputs
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
146 Is Method?
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
147 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
148
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
149 Worker Ref[name,convention,inputs,outputs,ismethod?:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
150 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
151 out <- [[[[[[[Build[Worker Ref()]]Name <<[name]]Convention <<[convention]]Inputs <<[inputs]]Outputs <<[outputs]]Is Method? <<[ismethod?]]Min Inputs <<[inputs]]Min Outputs <<[outputs]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
152 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
153
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
154 String@Worker Ref[ref:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
155 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
156 out <- [[[[[[[["Worker Ref["
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
157 ]Append[[ref]Name >>]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
158 ]Append[", "]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
159 ]Append[[ref]Convention >>]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
160 ]Append[", "]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
161 ]Append[String[[ref]Inputs >>]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
162 ]Append[", "]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
163 ]Append[String[[ref]Outputs >>]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
164 ]Append["]"]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
165 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
166
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
167 Blueprint Node Ref
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
168 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
169 Index
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
170 IO Num
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
171 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
172
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
173 Node Ref[index,ionum:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
174 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
175 out <- [[Build[Node Ref()]]Index <<[index]]IO Num <<[ionum]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
176 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
177
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
178 =@Node Ref[left,right:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
179 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
180 ,out <- If[[[left]Index >>] = [[right]Index >>]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
181 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
182 out <- [[left]IO Num>>] = [[right]IO Num >>]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
183 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
184 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
185
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
186 Blueprint NWorker Node
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
187 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
188 Type
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
189 Data
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
190 Inputs
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
191 Min Inputs
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
192 Input Types
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
193 Outputs
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
194 Min Outputs
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
195 Output Types
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
196 Wires From
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
197 Wires To
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
198 Conditions
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
199 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
200
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
201 Wire To@NWorker Node[node,from,output,pre input:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
202 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
203 existing cons <- [[node]Wires To >>]Index[input] {}
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
204 { existing cons <- () }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
205 input <- [pre input]+[1]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
206 out <- [node]Wires To <<[
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
207 [[node]Wires To >>]Set[input,
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
208 [existing cons]Append[Node Ref[from,output]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
209 ]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
210 ]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
211 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
212
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
213 Wire From@NWorker Node[node,to,input,output:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
214 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
215 existing cons <- [[node]Wires From >>]Index[output] {}
159
d1e206ff75f9 Fix some bugs involving calling a worker object
Mike Pavone <pavone@retrodev.com>
parents: 142
diff changeset
216 { existing cons <- () }
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
217 out <- [node]Wires From <<[
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
218 [[node]Wires From >>]Set[output,
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
219 [existing cons]Append[Node Ref[to,input]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
220 ]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
221 ]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
222 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
223
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
224 _Has Input Types@NWorker Node[node,input num:does,does not]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
225 {
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
226 does <- If[[input num] >= [[node]Inputs >>]] {}
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
227 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
228 ,does not <- [[node]Input Types >>]Index[input num]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
229 {
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
230 Print[[[[[["Input: "]Append[String[input num]]]Append[", count: "]]Append[String[count]]]Append[", wires: "]]Append[String[[[[node]Wires To >>]Index[ [input num]+[1] ]]Length]]]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
231 count <- [~]Index[1]
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
232 ,does not <- If[[count] = [[[[node]Wires To >>]Index[[input num]+[1]]]Length]]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
233 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
234 does,does not <- [node]_Has Input Types[[input num]+[1]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
235 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
236 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
237 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
238 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
239
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
240 Has Input Types?@NWorker Node[node:does,does not]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
241 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
242 If[[[node]Inputs >>] > [0]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
243 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
244 does,does not <- _Has Input Types[node,0]
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
245 { Print["does have input types"] }
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
246 { Print["does not have input types"] }
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
247 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
248 does <- Yes
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
249 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
250 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
251
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
252 _Dependency[dlist,ref:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
253 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
254 [dlist]Find[=[ref, ?]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
255 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
256 out <- dlist
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
257 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
258 out <- [dlist]Append[ref]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
259 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
260 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
261
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
262 Dependencies@NWorker Node[node:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
263 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
264 out <- Fold[Fold[_Dependency[?], ?], (), [node]Wires To >>]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
265 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
266
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
267
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
268 NWorker Node[type,data,inputs,outputs:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
269 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
270 out <- [[[[[[[[[[[Build[NWorker Node()]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
271 ]Type <<[type]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
272 ]Data <<[data]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
273 ]Inputs <<[inputs]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
274 ]Min Inputs <<[inputs]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
275 ]Outputs <<[outputs]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
276 ]Min Outputs <<[outputs]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
277 ]Wires From <<[List of Lists[outputs]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
278 ]Wires To <<[List of Lists[[inputs]+[1]]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
279 ]Conditions <<[AndSet[]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
280 ]Input Types <<[()]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
281 ]Output Types <<[()]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
282 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
283
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
284 Blueprint NWorker
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
285 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
286 Convention
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
287 Nodes
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
288 Inputs
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
289 Input Types
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
290 Outputs
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
291 Output Types
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
292 Uses
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
293 NodeResults
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
294 Free Temps
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
295 Name
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
296 Builtin?
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
297 Library
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
298 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
299
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
300 NWorker[convention:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
301 {
139
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
302 out <- [[[[[[[[[[Build[NWorker()]]Convention <<[convention]]Nodes <<[()]]Inputs <<[()]]Outputs <<[()]]Input Types <<[()]]Output Types <<[()]]Name <<["Anonymous"]]Builtin? <<[No]]Library << [""]]Uses <<[()]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
303 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
304
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
305 String@NWorker[worker:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
306 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
307 out <- ["NWorker"]Append[[worker]Name >>]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
308 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
309
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
310 Add Node@NWorker[worker,type,data,inputs,outputs:out,node index]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
311 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
312 out <- [worker]Nodes <<[[[worker]Nodes >>]Append[NWorker Node[type,data,inputs,outputs]]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
313 node index <- [[worker]Nodes >>]Length
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
314 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
315
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
316 Add Full Node@NWorker[worker,type,data,inputs,min inputs,outputs,min outputs:out,node index]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
317 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
318 out <- [worker]Nodes <<[[[worker]Nodes >>]Append[
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
319 [[[NWorker Node[type,data,inputs,outputs]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
320 ]Min Inputs <<[min inputs]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
321 ]Min Outputs <<[min outputs]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
322 ]Wires To <<[List of Lists[[min inputs]+[1]]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
323 ]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
324 node index <- [[worker]Nodes >>]Length
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
325 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
326
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
327 Propagate Type[nodelist,dest,prog,worker,type:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
328 {
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
329 If[[[dest]IO Num >>] >= [0]]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
330 {
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
331 Print[[[["Propagate Type, Index: "]Append[String[[dest]Index >>]]]Append[" io num: "]]Append[String[[dest]IO Num >>]]]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
332 node <- [nodelist]Index[[dest]Index >>]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
333
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
334 [[node]Input Types >>]Index[[dest]IO Num >>]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
335 {
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
336 Print[["Existing type: "]Append[[existing type]Name >>]]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
337 existing type <- [~]Index[0]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
338 new count <- [[~]Index[1]]+[1]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
339 If[[[existing type]Name >>] = [[type]Name >>]]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
340 {
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
341 If[[[existing type]Variant >>] = [[type]Variant >>]]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
342 {
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
343 If[[[existing type]Params >>] = [[type]Params >>]]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
344 {
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
345 new type <- Val[existing type]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
346 }{
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
347 new variant <- [existing type]Variant >>
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
348 new params <- ()
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
349 }
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
350 }{
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
351 new variant <- "Boxed"
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
352 If[[[existing type]Params >>] = [[type]Params >>]]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
353 {
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
354 new params <- [existing type]Params >>
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
355 }{
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
356 new params <- ()
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
357 }
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
358 }
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
359 new type <- [[existing type]Set Variant[new variant]]Params <<[new params]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
360 }{
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
361 new type <- Type Instance["Any Type"]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
362 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
363 }{
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
364 Print["No existing type info for this input"]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
365 new type <- Val[type]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
366 new count <- 1
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
367 }
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
368 Print[[[["new type: "]Append[[new type]Name >>]]Append[", new count: "]]Append[String[new count]]]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
369 new node <- [node]Input Types <<[
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
370 [ [node]Input Types >> ]Set[ [dest]IO Num >>, [[()]Append[new type]]Append[new count] ]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
371 ]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
372 { Print["got new node"] }
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
373 out <- Infer Types Node[[nodelist]Set[[dest]Index >>, new node], new node, [dest]Index >>, prog, worker]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
374 }{
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
375 out <- nodelist
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
376 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
377 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
378
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
379 Propagate Types[nodelist,dests,output num,prog,worker,source node:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
380 {
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
381 [[source node]Output Types >>]Index[output num]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
382 {
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
383 out <- Fold[Propagate Type[?, ?, prog, worker, ~], nodelist, dests]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
384 }{
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
385 Print[["Output type is missing for output #"]Append[String[output num]]]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
386 out <- nodelist
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
387 }
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
388 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
389
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
390 Infer Types Node[nodelist,node,index,prog,worker:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
391 {
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
392 If[[[node]Type >>]=["call"]]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
393 {
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
394 extra <- [", worker: "]Append[[[node]Data >>]Name >>]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
395 }{
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
396 extra <- ""
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
397 }
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
398 Print[[[[["Infer Types Node: "]Append[String[index]]]Append[", type: "]]Append[[node]Type >>]]Append[extra]]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
399 If[[[node]Type >>] = ["const"]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
400 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
401 const type <- Blueprint Of[[node]Data >>]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
402 [(Int8(),UInt8(),Int16(),UInt16(),Int32(),UInt32(),Int64(),UInt64(),
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
403 Type Instance(),Worker Literal(),List(),List Leaf(),String(),String Slice(),String Cat())]Find[=[const type, ?]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
404 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
405 outtype <- [("Int8","UInt8","Int16","UInt16","Int32","UInt32","Int64","UInt64",
168
d2b941f82d74 Fix type of list constants in inference pass and return type of some Array related workers
Mike Pavone <pavone@retrodev.com>
parents: 167
diff changeset
406 "Blueprint","Worker","List","List Leaf","String","String","String")]Index[~]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
407 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
408 outtype <- "Any Type"
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
409 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
410 nextnode <- [node]Output Types <<[ [()]Append[Type Instance[outtype]] ]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
411
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
412 }{
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
413 If[[[node]Type >>] = ["setglobal"]]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
414 {
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
415 out <- nodelist
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
416 }{
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
417 If[[[node]Type >>] = ["input"]]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
418 {
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
419 nextnode <- [node]Output Types <<[ [()]Append[ [[worker]Input Types >>]Index[[node]Data >>] ] ]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
420 }{
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
421 If[[[node]Type >>] = ["output"]]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
422 {
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
423 out <- nodelist
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
424
139
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
425 }{
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
426 If[[[node]Type >>] = ["getglobal"]]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
427 {
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
428 nextnode <- [node]Output Types <<[ [()]Append[Type Instance["Any Type"]] ]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
429 }{
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
430 [node]Has Input Types?
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
431 {
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
432 If[[[node]Type >>] = ["setfield"]]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
433 {
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
434 nextnode <- [node]Output Types <<[ [()]Append[ [[[node]Input Types >>]Index[0]]Index[0] ] ]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
435 }{
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
436 If[[[node]Type >>] = ["getfield"]]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
437 {
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
438 type <- [[[node]Input Types >>]Index[0]]Index[0]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
439 If[[[type]Name >>] = ["Any Type"]]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
440 {
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
441 outtype <- Val[type]
139
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
442 }{
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
443 outtype <- [prog]Find Field[[node]Data >>, type] {}
139
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
444 {
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
445 //TODO: Return errors rather than printing them
139
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
446 Print[
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
447 [[[[["Type "
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
448 ]Append[[type]Name >>]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
449 ]Append[" does not have a field named "]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
450 ]Append[[node]Data >>]
139
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
451 ]Append[" in worker "]
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
452 ]Append[worker name]]
139
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
453 }
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
454 }
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
455 nextnode <- [node]Output Types <<[ [()]Append[outtype] ]
139
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
456 }{
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
457 worker name <- [[node]Data >>]Name >>
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
458 [prog]Is Method?[worker name]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
459 {
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
460 Print[[["Infer Types: "]Append[worker name]]Append[" is a method"]]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
461 first arg type <- [[[node]Input Types >>]Index[0]]Index[0]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
462 If[[[first arg type]Name >>] = ["Any Type"]]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
463 {
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
464 Print["No type info for first arg"]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
465 outtypes <- Fold[Append[?, Type Instance["Any Type"]], (), Range[0, [node]Inputs >>]]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
466 Print[["outtypes length: "]Append[String[Length[outtypes]]]]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
467 nextnode <- [node]Output Types <<[ outtypes ]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
468 }{
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
469 worker def <- [prog]Find Method[worker name, first arg type]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
470 {
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
471 new worker name <- [[worker name]Append["@"]]Append[[first arg type]Name >>]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
472 new ref <- [prog]Find Worker[new worker name] {} {
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
473 Print[["Could not find worker ref for "]Append[new worker name]]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
474 }
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
475 nextnode <- [[node]Output Types <<[outtypes]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
476 ]Data <<[new ref]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
477 Print[["New worker name:"]Append[new worker name]]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
478 }{
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
479 //TODO: Return errors instead of printing them
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
480 Print[
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
481 [[[[["Type "
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
482 ]Append[[first arg type]Name >>]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
483 ]Append[" does not support method "]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
484 ]Append[worker name]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
485 ]Append[" in worker "]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
486 ]Append[ [worker]Name >> ]]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
487 }
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
488 }
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
489 }{
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
490 Print[[["Infer Types: "]Append[worker name]]Append[" is not a method"]]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
491 worker def <- [prog]Find Worker Def[worker name] {}
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
492 { Print["Error, could not find worker def"] }
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
493 nextnode <- [node]Output Types <<[ outtypes ]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
494 }
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
495 outtypes <- [worker def]Output Types >>
139
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
496 }
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
497 }
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
498 }{
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
499 Print["Skipping node because input type info not present"]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
500 out <- nodelist
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
501 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
502 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
503 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
504 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
505 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
506 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
507
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
508 Val[nextnode]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
509 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
510 nextlist <- [nodelist]Set[index, nextnode]
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
511 { Print["Calling Propagate types on descdendants of this node"] }
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
512 out <- Fold[Propagate Types[?, ?, ?, prog, worker, nextnode], nextlist, [nextnode]Wires From >>]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
513 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
514 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
515
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
516 Infer Types@NWorker[worker,prog:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
517 {
141
f2cb85c53ced Fix Pause/Resume and rewrite Call Async in Rhope rather than C
Mike Pavone <pavone@retrodev.com>
parents: 140
diff changeset
518 Print[["Infer Types: "]Append[[worker]Name >>]]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
519 out <- [worker]Nodes <<[Fold[Infer Types Node[?, ?, ?, prog, worker], [worker]Nodes >>, [worker]Nodes >>]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
520 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
521
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
522 Add Worker Call@NWorker[worker,tocall:out,node index]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
523 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
524 out, node index <- [worker]Add Full Node["call",tocall,[tocall]Inputs >>, [tocall]Min Inputs >>,[tocall]Outputs >>, [tocall]Min Outputs >>]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
525 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
526
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
527 Add Constant@NWorker[worker,constant:out,node index]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
528 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
529 out, node index <- [worker]Add Node["const",constant,0,1]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
530 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
531
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
532 Add Input@NWorker[worker,name,number:out,node index]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
533 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
534 out,node index <- [worker]Add Typed Input[name,number,Type Instance["Any Type"]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
535 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
536
118
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
537 Add Anon Input@NWorker[worker,number:out]
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
538 {
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
539 If[[number]>[Length[[worker]Inputs >>]]]
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
540 {
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
541 prepped <- [worker]Add Anon Input[[number]-[1]]
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
542 }{
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
543 prepped <- Val[worker]
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
544 }
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
545 out <- out <- [[prepped]Inputs <<[[[prepped]Inputs >>]Set[number,[" unnamed"]Append[String[number]]]]
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
546 ]Input Types <<[[[prepped]Input Types >>]Set[number,Type Instance["Any Type"]]]
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
547 }
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
548
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
549 Add Typed Input@NWorker[worker,name,number,type:out,node index]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
550 {
118
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
551 If[[number]>[Length[[worker]Inputs >>]]]
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
552 {
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
553 prepped <- [worker]Add Anon Input[[number]-[1]]
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
554 }{
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
555 prepped <- Val[worker]
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
556 }
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
557 ,node index <- [prepped]Add Node["input",number,0,1]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
558 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
559 out <- [[~]Inputs <<[[[~]Inputs >>]Set[number,name]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
560 ]Input Types <<[[[~]Input Types >>]Set[number,type]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
561 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
562 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
563
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
564 Add Output@NWorker[worker,name,number:out,node index]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
565 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
566 out,node index <- [worker]Add Typed Output[name,number,Type Instance["Any Type"]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
567 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
568
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
569 Add Typed Output@NWorker[worker,name,number,type:out,node index]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
570 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
571 ,node index <- [worker]Add Node["output",number,1,0]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
572 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
573 out <- [[~]Outputs <<[[[~]Outputs >>]Set[number,name]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
574 ]Output Types <<[[[~]Output Types >>]Set[number,type]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
575 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
576 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
577
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
578 Add Object Get@NWorker[worker,fieldname:out,node index]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
579 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
580 out, node index <- [worker]Add Node["getfield",fieldname,1,1]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
581 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
582
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
583 Add Object Set@NWorker[worker,fieldname:out,node index]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
584 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
585 out, node index <- [worker]Add Node["setfield",fieldname,2,1]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
586 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
587
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
588 Add Global Get@NWorker[worker,store,var:out,node index]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
589 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
590 out, node index <- [worker]Add Node["getglobal",[[()]Append[store]]Append[var],0,1]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
591 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
592
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
593 Add Global Set@NWorker[worker,store,var:out,node index]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
594 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
595 out, node index <- [worker]Add Node["setglobal",[[()]Append[store]]Append[var],1,1]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
596 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
597
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
598 Add Wire@NWorker[worker,from,output,to,input:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
599 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
600 fromw <- [[[worker]Nodes >>]Index[from]]Wire From[to,input,output]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
601 tow <- [[[worker]Nodes >>]Index[to]]Wire To[from,output,input]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
602 nodes <- [[[worker]Nodes >>]Set[from, fromw]]Set[to, tow]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
603 out <- [worker]Nodes <<[nodes]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
604 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
605
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
606 Uses@NWorker[worker,uses:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
607 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
608 out <- [worker]Uses <<[uses]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
609 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
610
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
611 _No Dependencies[list,node,index:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
612 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
613 [[node]Wires To>>]Index[1]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
614 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
615 out <- Val[list]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
616 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
617 [[[node]Wires To>>]Index[0]]First
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
618 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
619 out <- Val[list]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
620 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
621 out <- [list]Append[index]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
622 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
623 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
624 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
625
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
626 No Dependencies@NWorker[worker:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
627 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
628 out <- Fold[_No Dependencies[?], (), [worker]Nodes >>]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
629 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
630
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
631 _Collect Dests[candidates,wire:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
632 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
633 out <- [candidates]Set[[wire]Index >>, Yes]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
634 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
635
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
636 Collect Dests@NWorker[worker,candidates,node index:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
637 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
638 out <- Fold[Fold[_Collect Dests[?], ?], candidates, [[[worker]Nodes >>]Index[node index]]Wires From >>]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
639 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
640
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
641 Check Dependency@NWorker[worker,nodes,wires,wire index:met?]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
642 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
643 ref <- [wires]Index[wire index]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
644 [nodes]Find[=[[ref]Index >>, ?]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
645 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
646 [wires]Next[wire index]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
647 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
648 met? <- [worker]Check Dependency[nodes,wires,~]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
649 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
650 met? <- Yes
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
651 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
652 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
653 met? <- No
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
654 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
655 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
656 _Check Dependencies@NWorker[worker,nodes,inputs,input index:met?]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
657 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
658 wires <- [inputs]Index[input index]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
659 [wires]First
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
660 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
661 current met? <- [worker]Check Dependency[nodes, wires, ~]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
662 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
663 current met? <- Yes
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
664 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
665 If[current met?]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
666 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
667 [inputs]Next[input index]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
668 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
669 met? <- [worker]_Check Dependencies[nodes,inputs,~]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
670 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
671 met? <- Yes
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
672 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
673 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
674 met? <- No
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
675 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
676 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
677
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
678 Check Dependencies@NWorker[worker,nodes,candidate:met?]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
679 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
680 inputs <- [[[worker]Nodes >>]Index[candidate]]Wires To >>
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
681 [inputs]First
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
682 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
683 met? <- [worker]_Check Dependencies[nodes, inputs, ~]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
684 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
685 met? <- Yes
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
686 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
687 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
688
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
689 Dependants@NWorker[worker,direct nodes,nodes:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
690 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
691 candidates <- Keys[Fold[Collect Dests[worker, ?], (), direct nodes]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
692 out <- Filter[candidates, Check Dependencies[worker, nodes, ?]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
693 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
694
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
695 _Dependency Groups@NWorker[worker,last,all,grouped:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
696 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
697 current <- [worker]Dependants[last,all]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
698 [current]First
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
699 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
700 out <- [worker]_Dependency Groups[current, [all]Concatenate[current], [grouped]Append[current]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
701 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
702 out <- grouped
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
703 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
704 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
705 Dependency Groups@NWorker[worker:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
706 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
707 no deps <- [worker]No Dependencies
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
708 out <- [worker]_Dependency Groups[no deps, no deps, [()]Append[no deps]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
709 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
710
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
711 Const Name[val,node index,worker name:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
712 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
713 valtype <- Blueprint Of[val]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
714 If[[valtype] = [Type Instance()]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
715 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
716 //TODO: Support parametric types
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
717 datstring <- [val]Name >>
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
718 typename <- "Blueprint"
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
719 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
720 [(Int8(),UInt8(),Int16(),UInt16(),Int32(),UInt32(),Int64(),UInt64())]Find[=[valtype,?]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
721 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
722 size <- [("8","16","32","64")]Index[[~]/[2]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
723 typename <- [("Int8","UInt8","Int16","UInt16","Int32","UInt32","Int64","UInt64")]Index[~]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
724 If[[~]Mod[2]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
725 { s <- "UI" }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
726 { s <- "I" }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
727 datstring <- [[String[val]]Append[s]]Append[size]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
728 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
729 If[[valtype] = [Worker Literal()]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
730 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
731 typename <- "Worker"
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
732 If[[[[val]Args >>]Length] > [0]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
733 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
734 datstring <- [[["Arg "]Append[String[node index]]]Append[" "]]Append[worker name]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
735 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
736 datstring <- [val]Name >>
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
737 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
738 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
739 [(List(),List Leaf())]Find[=[valtype,?]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
740 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
741 typename <- "List"
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
742 If[[[val]Length] > [0]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
743 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
744 datstring <- [[["Arg "]Append[String[node index]]]Append[" "]]Append[worker name]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
745 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
746 datstring <- "Empty"
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
747 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
748 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
749 [(String(),String Cat(),String Slice())]Find[=[valtype, ?]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
750 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
751 typename <- "String"
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
752 datstring <- val
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
753 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
754 typename <- "Unknown"
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
755 datstring <- String[val]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
756 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
757
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
758 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
759 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
760 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
761 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
762 out <- [[typename]Append["_"]]Append[datstring]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
763 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
764
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
765 Format Input@NWorker[worker,noderef:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
766 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
767 node <- [[worker]Nodes >>]Index[[noderef]Index >>]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
768
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
769 [("call","getfield","setfield")]Find[=[[node]Type >>, ?]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
770 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
771 maybe addref <- Result Var Name[[noderef]IO Num >>, [noderef]Index >>]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
772 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
773 conditions <- [node]Conditions >>
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
774
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
775 If[[[node]Type >>] = ["input"]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
776 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
777 input name <- [[worker]Inputs >>]Index[ [node]Data >> ]
114
25a205094f9b More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents: 102
diff changeset
778 [conditions]Empty?
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
779 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
780 out <- AddRef[Result Var Name[[noderef]IO Num >>, [noderef]Index >>]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
781 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
782 out <- AddRef[input name]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
783 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
784 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
785 If[[[node]Type >>] = ["const"]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
786 {
114
25a205094f9b More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents: 102
diff changeset
787 [conditions]Empty?
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
788 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
789 out <- AddRef[Result Var Name[[noderef]IO Num >>, [noderef]Index >>]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
790 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
791 out <- Constant[Const Name[[node]Data >>, [noderef]Index >>, [worker]Name >>]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
792 }
139
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
793 }{
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
794 If[[[node]Type >>]=["getglobal"]]
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
795 {
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
796 [conditions]Empty?
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
797 {
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
798 out <- AddRef[Result Var Name[[noderef]IO Num >>, [noderef]Index >>]]
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
799 }{
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
800 out <- AddRef[Global Get[[[node]Data >>]Index[0], [[node]Data >>]Index[1]]]
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
801 }
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
802 }
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
803 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
804 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
805 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
806
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
807 Val[maybe addref]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
808 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
809 If[[Length[[[node]Wires From >>]Index[[noderef]IO Num >>]]] > [1]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
810 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
811 out <- AddRef[maybe addref]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
812 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
813 out <- Val[maybe addref]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
814 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
815 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
816 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
817
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
818 Collect Input@NWorker[worker,nodeinput:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
819 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
820 inputchoices <- Map[nodeinput, Format Input[worker, ?]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
821
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
822 [inputchoices]First
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
823 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
824 first <- [inputchoices]Index[~]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
825 [inputchoices]Next[~]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
826 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
827 out <- _Fold[inputchoices, ~, first, OrValue[?]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
828 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
829 out <- Val[first]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
830 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
831 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
832 out <- "Missing"
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
833 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
834 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
835
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
836 Collect Inputs@NWorker[worker,node:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
837 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
838 out <- Map[Tail[[node]Wires To>>, 1], Collect Input[worker, ?]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
839 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
840
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
841 Collect Input Condition@NWorker[worker,set,noderef:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
842 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
843 node <- [[worker]Nodes >>]Index[ [noderef]Index >> ]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
844 If[[[node]Outputs >>] > [1]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
845 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
846 out <- [set]Add Condition[ Result Var Name[[noderef]IO Num >>, [noderef]Index >>] ]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
847 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
848 out <- [set]Add Condition[[node]Conditions >>]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
849 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
850 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
851
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
852 Collect Condition@NWorker[worker,set,nodeinput:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
853 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
854 out <- [set]Add Condition[Fold[Collect Input Condition[worker, ?], OrSet[], nodeinput]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
855 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
856
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
857 Collect Conditions@NWorker[worker,node:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
858 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
859 out <- Fold[Collect Condition[worker, ?], AndSet[], [node]Wires To>>]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
860 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
861
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
862 Save Result[func,num,node index:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
863 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
864 out <- [func]Move[Result[num], Result Var Name[num, node index]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
865 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
866
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
867 Save Maybe Result[func,num,node index:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
868 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
869 out <- [func]Move[Check Result[num], Result Var Name[num, node index]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
870 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
871
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
872 Max Used Output[node,cur:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
873 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
874 If[[cur] < [0]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
875 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
876 out <- cur
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
877 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
878 [[[node]Wires From >>]Index[cur]]Index[0]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
879 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
880 out <- cur
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
881 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
882 out <- Max Used Output[node, [cur]-[1]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
883 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
884 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
885 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
886
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
887 Compile Call Node[node,program,func,inputs,node index:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
888 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
889 If[[[node]Type >>] = ["getfield"]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
890 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
891 with call <- [func]Get Field Call[[node]Data >>, [inputs]Index[0]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
892 save outs <- [node]Outputs >>
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
893 out <- Val[after save]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
894 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
895 If[[[node]Type >>] = ["setfield"]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
896 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
897 with call <- [func]Set Field Call[[node]Data >>, [inputs]Index[0], [inputs]Index[1]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
898 save outs <- [node]Outputs >>
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
899 out <- Val[after save]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
900 }{
169
fd06fb07762a Basic inlining of arithmetic and comparison operations on integer types
Mike Pavone <pavone@retrodev.com>
parents: 168
diff changeset
901 fname <- [[node]Data >>]Name >>
fd06fb07762a Basic inlining of arithmetic and comparison operations on integer types
Mike Pavone <pavone@retrodev.com>
parents: 168
diff changeset
902 [program]Method?[fname]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
903 {
169
fd06fb07762a Basic inlining of arithmetic and comparison operations on integer types
Mike Pavone <pavone@retrodev.com>
parents: 168
diff changeset
904 with call <- [func]Method Call[fname, inputs]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
905 }{
170
ac5c2d78663f Inline calls to If@Boolean when static type info is present
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
906 justfunc,,,normal call <- [fname]Partition["@"]
169
fd06fb07762a Basic inlining of arithmetic and comparison operations on integer types
Mike Pavone <pavone@retrodev.com>
parents: 168
diff changeset
907 {
fd06fb07762a Basic inlining of arithmetic and comparison operations on integer types
Mike Pavone <pavone@retrodev.com>
parents: 168
diff changeset
908 //Check for inline on static method calls
fd06fb07762a Basic inlining of arithmetic and comparison operations on integer types
Mike Pavone <pavone@retrodev.com>
parents: 168
diff changeset
909 //TODO: Deal with unused output
170
ac5c2d78663f Inline calls to If@Boolean when static type info is present
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
910 If[[[inputs]Length]=[2]]
ac5c2d78663f Inline calls to If@Boolean when static type info is present
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
911 {
ac5c2d78663f Inline calls to If@Boolean when static type info is present
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
912 out,normal call <- Compile Number Inline Check[func, justfunc, [[[node]Input Types >>]Index[0]]Index[0], [[[node]Input Types >>]Index[1]]Index[0], [inputs]Index[0], [inputs]Index[1], Result Var Name[0, node index]]
ac5c2d78663f Inline calls to If@Boolean when static type info is present
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
913 }{
ac5c2d78663f Inline calls to If@Boolean when static type info is present
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
914 ,normal call <- If[[[inputs]Length]=[1]]
ac5c2d78663f Inline calls to If@Boolean when static type info is present
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
915 {
ac5c2d78663f Inline calls to If@Boolean when static type info is present
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
916 out,normal call <- Compile Boolean Inline Check[func, justfunc, [[[node]Input Types >>]Index[0]]Index[0], [inputs]Index[0], Result Var Name[0, node index], Result Var Name[1, node index]]
ac5c2d78663f Inline calls to If@Boolean when static type info is present
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
917 }
ac5c2d78663f Inline calls to If@Boolean when static type info is present
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
918 }
169
fd06fb07762a Basic inlining of arithmetic and comparison operations on integer types
Mike Pavone <pavone@retrodev.com>
parents: 168
diff changeset
919 }
fd06fb07762a Basic inlining of arithmetic and comparison operations on integer types
Mike Pavone <pavone@retrodev.com>
parents: 168
diff changeset
920
fd06fb07762a Basic inlining of arithmetic and comparison operations on integer types
Mike Pavone <pavone@retrodev.com>
parents: 168
diff changeset
921 Val[normal call]
fd06fb07762a Basic inlining of arithmetic and comparison operations on integer types
Mike Pavone <pavone@retrodev.com>
parents: 168
diff changeset
922 {
fd06fb07762a Basic inlining of arithmetic and comparison operations on integer types
Mike Pavone <pavone@retrodev.com>
parents: 168
diff changeset
923 with call <- [func]Call[fname, inputs]
fd06fb07762a Basic inlining of arithmetic and comparison operations on integer types
Mike Pavone <pavone@retrodev.com>
parents: 168
diff changeset
924 }
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
925 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
926 first unused <- [Max Used Output[node, [[node]Outputs >>]-[1]]]+[1]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
927 If[[first unused] > [[node]Min Outputs >>]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
928 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
929 save outs <- [node]Min Outputs >>
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
930 after maybe <- Fold[Save Maybe Result[?, ?, node index], after save, Range[save outs, first unused]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
931 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
932 save outs <- Val[first unused]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
933 after maybe <- Val[after save]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
934 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
935 If[[first unused] < [[node]Outputs >>]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
936 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
937 out <- [after maybe]Discard Outputs[first unused]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
938 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
939 out <- Val[after maybe]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
940 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
941 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
942 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
943 after save <- Fold[Save Result[?, ?, node index], with call, Range[0, save outs]]
170
ac5c2d78663f Inline calls to If@Boolean when static type info is present
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
944 Print[["Last NumParams is now "]Append[String[[after save]Last NumParams >>]]]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
945 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
946
112
fd23ab2c1a73 Small changes to make profile data a little cleaner
Mike Pavone <pavone@retrodev.com>
parents: 102
diff changeset
947 Compile Node[worker,program,func,nodes,current:out,out worker]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
948 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
949 node index <- [nodes]Index[current]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
950 node <- [[worker]Nodes >>]Index[node index]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
951 conditions <- [node]Conditions >>
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
952 [("call","getfield","setfield")]Find[=[[node]Type >>, ?]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
953 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
954 inputs <- [worker]Collect Inputs[node]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
955 [conditions]For Backend
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
956 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
957 stream <- [func]Instruction Stream
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
958 nfunc <- [func]Do If[~, nstream]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
959 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
960 stream <- Val[func]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
961 nfunc <- Val[nstream]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
962 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
963 nstream <- Compile Call Node[node, program, stream, inputs, node index]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
964 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
965 If[[[node]Type >>] = ["output"]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
966 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
967 inputs <- [worker]Collect Inputs[node]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
968 [conditions]For Backend
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
969 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
970 stream <- [func]Instruction Stream
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
971 nfunc <- [func]Do If[~, nstream]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
972 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
973 stream <- Val[func]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
974 nfunc <- Val[nstream]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
975 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
976 nstream <- [stream]Move[[inputs]Index[0], [[worker]Outputs >>]Index[ [node]Data >> ] ]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
977 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
978 If[[[node]Type >>] = ["const"]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
979 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
980 constname <- Const Name[[node]Data >>, node index, [worker]Name >>]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
981 withconst <- [func]Register Constant[constname, [node]Data >>]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
982 [conditions]For Backend
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
983 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
984 stream <- [[withconst]Instruction Stream
118
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
985 ]Move[Strip Addref[Constant[constname]], Result Var Name[0, node index]]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
986 nfunc <- [withconst]Do If[~, stream]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
987 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
988 nfunc <- Val[withconst]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
989 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
990 }{
139
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
991 If[[[node]Type >>]=["getglobal"]]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
992 {
139
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
993 [conditions]For Backend
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
994 {
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
995 stream <- [[func]Instruction Stream
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
996 ]Move[Global Get[[[node]Data >>]Index[0], [[node]Data >>]Index[1]], Result Var Name[0, node index]]
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
997 nfunc <- [func]Do If[~, stream]
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
998 }{
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
999 nfunc <- Val[func]
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
1000 }
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1001 }{
139
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
1002 If[[[node]Type >>]=["setglobal"]]
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
1003 {
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
1004 inputs <- [worker]Collect Inputs[node]
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
1005 [conditions]For Backend
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
1006 {
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
1007 stream <- [func]Instruction Stream
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
1008 nfunc <- [func]Do If[~, nstream]
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
1009 }{
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
1010 stream <- Val[func]
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
1011 nfunc <- Val[nstream]
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
1012 }
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
1013 nstream <- [stream]Set Global[[[node]Data >>]Index[0], [[node]Data >>]Index[1], [inputs]Index[0]]
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
1014 }{
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
1015 [conditions]For Backend
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
1016 {
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
1017 input name <- [[worker]Inputs >>]Index[ [node]Data >> ]
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
1018 stream <- [[func]Instruction Stream
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
1019 ]Move[input name, Result Var Name[0, node index]]
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
1020 nfunc <- [func]Do If[~, stream]
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
1021 }{
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
1022 nfunc <- Val[func]
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
1023 }
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
1024 }
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1025 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1026 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1027
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1028 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1029 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1030 [nodes]Next[current]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1031 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1032 out,out worker <- [worker]Compile Node[program,nfunc,nodes,~]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1033 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1034 out <- Val[nfunc]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1035 out worker <- Val[worker]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1036 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1037 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1038
112
fd23ab2c1a73 Small changes to make profile data a little cleaner
Mike Pavone <pavone@retrodev.com>
parents: 102
diff changeset
1039 Save Node Conditions[worker,node index:out]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1040 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1041 node <- [[worker]Nodes >>]Index[node index]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1042 conditions <- [worker]Collect Conditions[node]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1043 out <- [worker]Nodes <<[ [[worker]Nodes >>]Set[node index, [node]Conditions <<[conditions]] ]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1044
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1045 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1046
112
fd23ab2c1a73 Small changes to make profile data a little cleaner
Mike Pavone <pavone@retrodev.com>
parents: 102
diff changeset
1047 Save Group Conditions[worker, groups,current:out]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1048 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1049 nodes <- [groups]Index[current]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1050 nworker <- Fold[Save Node Conditions[?], worker, nodes]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1051
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1052 [groups]Next[current]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1053 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1054 out <- [nworker]Save Group Conditions[groups,~]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1055 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1056 out <- Val[nworker]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1057 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1058 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1059
112
fd23ab2c1a73 Small changes to make profile data a little cleaner
Mike Pavone <pavone@retrodev.com>
parents: 102
diff changeset
1060 Compile Group[worker,program,func,groups,current:out,out worker]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1061 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1062 nodes <- [groups]Index[current]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1063 [nodes]First
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1064 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1065 nfunc,nworker <- [worker]Compile Node[program,func,nodes,~]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1066 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1067 nfunc <- Val[func]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1068 nworker <- Val[worker]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1069 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1070 [groups]Next[current]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1071 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1072 out,out worker <- [nworker]Compile Group[program,nfunc,groups,~]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1073 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1074 out <- Val[nfunc]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1075 out worker <- Val[nworker]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1076 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1077 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1078
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1079 Release Var@NWorker[worker,func,name:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1080 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1081 //__result_index_ionum
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1082 parts <- [name]Split["_"]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1083 index <- Int32[ [parts]Index[3] ]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1084 io num <- Int32[ [parts]Index[4] ]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1085 node <- [[worker]Nodes >>]Index[index]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1086 dests <- [[node]Wires From >>]Index[io num] {}
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1087
121
1af91ceaaf49 Fixed memory leak when an output is only attached to a single null input
Mike Pavone <pavone@retrodev.com>
parents: 120
diff changeset
1088 ,normal <- If[[[dests]Length] = [1]]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1089 {
121
1af91ceaaf49 Fixed memory leak when an output is only attached to a single null input
Mike Pavone <pavone@retrodev.com>
parents: 120
diff changeset
1090 [dests]Index[0]
1af91ceaaf49 Fixed memory leak when an output is only attached to a single null input
Mike Pavone <pavone@retrodev.com>
parents: 120
diff changeset
1091 {
1af91ceaaf49 Fixed memory leak when an output is only attached to a single null input
Mike Pavone <pavone@retrodev.com>
parents: 120
diff changeset
1092 dest index <- [~]Index >>
1af91ceaaf49 Fixed memory leak when an output is only attached to a single null input
Mike Pavone <pavone@retrodev.com>
parents: 120
diff changeset
1093 dest IO <- [~]IO Num >>
1af91ceaaf49 Fixed memory leak when an output is only attached to a single null input
Mike Pavone <pavone@retrodev.com>
parents: 120
diff changeset
1094 }
1af91ceaaf49 Fixed memory leak when an output is only attached to a single null input
Mike Pavone <pavone@retrodev.com>
parents: 120
diff changeset
1095 normal <- If[[dest IO] = [-1]] {}
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1096 {
121
1af91ceaaf49 Fixed memory leak when an output is only attached to a single null input
Mike Pavone <pavone@retrodev.com>
parents: 120
diff changeset
1097 dest node <- [[worker]Nodes >>]Index[dest index]
1af91ceaaf49 Fixed memory leak when an output is only attached to a single null input
Mike Pavone <pavone@retrodev.com>
parents: 120
diff changeset
1098
1af91ceaaf49 Fixed memory leak when an output is only attached to a single null input
Mike Pavone <pavone@retrodev.com>
parents: 120
diff changeset
1099 [[dest node]Conditions >>]For Backend
1af91ceaaf49 Fixed memory leak when an output is only attached to a single null input
Mike Pavone <pavone@retrodev.com>
parents: 120
diff changeset
1100 {
1af91ceaaf49 Fixed memory leak when an output is only attached to a single null input
Mike Pavone <pavone@retrodev.com>
parents: 120
diff changeset
1101 out <- [func]Do If[AndCond[NotCond[~], name], [[func]Instruction Stream]Release[name]]
1af91ceaaf49 Fixed memory leak when an output is only attached to a single null input
Mike Pavone <pavone@retrodev.com>
parents: 120
diff changeset
1102 }{
1af91ceaaf49 Fixed memory leak when an output is only attached to a single null input
Mike Pavone <pavone@retrodev.com>
parents: 120
diff changeset
1103 out <- func
1af91ceaaf49 Fixed memory leak when an output is only attached to a single null input
Mike Pavone <pavone@retrodev.com>
parents: 120
diff changeset
1104 }
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1105 }
121
1af91ceaaf49 Fixed memory leak when an output is only attached to a single null input
Mike Pavone <pavone@retrodev.com>
parents: 120
diff changeset
1106 }
1af91ceaaf49 Fixed memory leak when an output is only attached to a single null input
Mike Pavone <pavone@retrodev.com>
parents: 120
diff changeset
1107
1af91ceaaf49 Fixed memory leak when an output is only attached to a single null input
Mike Pavone <pavone@retrodev.com>
parents: 120
diff changeset
1108 Val[normal]
1af91ceaaf49 Fixed memory leak when an output is only attached to a single null input
Mike Pavone <pavone@retrodev.com>
parents: 120
diff changeset
1109 {
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1110 do if <- If[[[node]Outputs >>] > [1]] {}
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1111 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1112 do if <- [[node]Conditions >>]Empty? {}
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1113 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1114 out <- [func]Release[name]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1115 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1116 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1117
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1118 Val[do if]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1119 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1120 stream <- [[func]Instruction Stream]Release[name]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1121 out <- [func]Do If[name, stream]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1122 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1123 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1124 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1125
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1126 Result Var Name[io num, index:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1127 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1128 out <- [[["__result_"]Append[String[index]]]Append["_"]]Append[String[io num]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1129 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1130
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1131 Result Var[vars,io num,index:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1132 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1133 out <- [vars]Append[Result Var Name[io num, index]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1134 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1135
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1136 Node Result Vars[vars,node,index:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1137 {
142
7bbdc034e347 Fix some bugs. Get basic network code working (epoll listener + accept connections). Start porting webserver.
Mike Pavone <pavone@retrodev.com>
parents: 141
diff changeset
1138 [("call","getfield","setfield","getglobal")]Find[=[[node]Type >>, ?]]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1139 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1140 If[[[node]Type >>]=["call"]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1141 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1142 save outs <- [Max Used Output[node, [[node]Outputs >>]-[1]]]+[1]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1143 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1144 save outs <- [node]Outputs >>
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1145 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1146 out <- Fold[Result Var[?, ?, index], vars, Range[0, save outs]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1147 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1148 out <- vars
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1149 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1150 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1151
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1152 Result Vars@NWorker[worker:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1153 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1154 out <- Fold[Node Result Vars[?], (), [worker]Nodes >>]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1155 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1156
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1157 _No Release[vars,node,index,worker:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1158 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1159 [("const","input")]Find[=[[node]Type >>, ?]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1160 {
114
25a205094f9b More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents: 102
diff changeset
1161 [[node]Conditions >>]Empty?
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1162 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1163 out <- Result Var[vars, 0, index]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1164 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1165 out <- vars
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1166 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1167 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1168 out <- vars
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1169 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1170 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1171
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1172 No Release Results@NWorker[worker:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1173 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1174 out <- Fold[_No Release[?, ?, ?, worker], (), [worker]Nodes >>]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1175 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1176
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1177 Make Basic Type[type:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1178 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1179 out <- [Type Instance[[type]Name >>]]Params <<[ [type]Params >> ]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1180 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1181
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1182 FInputs[ifunc, input type, index, inputs:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1183 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1184 func <- [ifunc]Set Input Type[Make Basic Type[input type], index]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1185 name <- [inputs]Index[index]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1186 If[[[input type]Variant >>] = ["Naked"]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1187 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1188
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1189 naked <- [" naked"]Append[name]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1190
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1191 out <- [[[func]Allocate Var[naked, input type]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1192 ]Unbox[name, naked]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1193 ]Release[name]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1194 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1195 If[[input type]Mutable? >>]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1196 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1197 name <- [inputs]Index[index]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1198 copied <- [func]Copy[name, name]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1199
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1200 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1201 copied <- Val[func]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1202 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1203 If[[[input type]Variant >>] = ["Raw Pointer"]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1204 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1205 raw <- [" raw"]Append[name]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1206 If[[[input type]Name >>]=["Array"]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1207 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1208
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1209 out <- [[copied]Allocate Var[raw, input type]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1210 ]Array Raw Pointer[name, raw]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1211 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1212 out <- [[copied]Allocate Var[raw, input type]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1213 ]Get Raw Pointer[name, raw]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1214 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1215 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1216 out <- Val[copied]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1217 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1218 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1219 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1220
118
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
1221 Release Raw Inputs[func,input type,index,inputs,outputs:out]
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
1222 {
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
1223 If[[[input type]Variant >>] = ["Raw Pointer"]]
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
1224 {
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
1225 name <- [inputs]Index[index]
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
1226 If[[input type]Mutable? >>]
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
1227 {
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
1228 [outputs]Find[=[?,[inputs]Index[index]]]
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
1229 {
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
1230 out <- func
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
1231 }{
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
1232 out <- [func]Release[name]
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
1233 }
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
1234 }{
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
1235 out <- [func]Release[name]
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
1236 }
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
1237 }{
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
1238 out <- func
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
1239 }
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
1240 }
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
1241
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1242 FParams[input:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1243 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1244 iname <- [input]Index[0]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1245 type <- [input]Index[1]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1246 If[[[type]Variant >>] = ["Naked"]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1247 { out <- [" naked"]Append[iname] }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1248 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1249 If[[[type]Variant >>] = ["Raw Pointer"]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1250 { out <- [" raw"]Append[iname] }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1251 { out <- Val[iname] }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1252 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1253 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1254 _Return Param[outputs, inputs, input types, index:out,none]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1255 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1256 output <- [outputs]Index[index]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1257 [inputs]Find[=[output, ?]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1258 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1259 If[[[input types]Index[~]]Mutable? >>]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1260 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1261 ,none <- [outputs]Next[index]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1262 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1263 out,none <- _Return Param[outputs, inputs, input types, ~]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1264 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1265 } {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1266 out <- index
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1267 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1268 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1269 out <- index
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1270 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1271 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1272
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1273 Return Param[outputs, inputs, input types:out,none]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1274 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1275 ,none <- [outputs]First
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1276 { out,none <- _Return Param[outputs, inputs, input types, ~] }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1277
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1278 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1279
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1280 Save Foreign Result[func, output, index, output types, inputs, input types:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1281 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1282 type <- [output types]Index[index]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1283 If[[[type]Variant >>] = ["Naked"]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1284 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1285 out <- [func]Box[[" naked"]Append[output], output, type]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1286 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1287 [inputs]Find[=[output, ?]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1288 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1289 If[[[input types]Index[~]]Mutable? >>]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1290 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1291 out <- [func]Move[output, Output[output]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1292 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1293 out <- func
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1294 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1295 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1296 out <- func
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1297 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1298 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1299 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1300
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1301 Compile Foreign Stub[worker,program,name:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1302 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1303 ifunc <- [[program]Create Function[name, [worker]Inputs >>, [worker]Outputs >>, "rhope"]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1304 ]Output Types <<[Map[[worker]Output Types >>, Make Basic Type[?]]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1305
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1306 rp num <- Return Param[[worker]Outputs >>, [worker]Inputs >>, [worker]Input Types >>]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1307 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1308 rbase <- [[worker]Outputs >>]Index[rp num]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1309 If[[[[[worker]Output Types >>]Index[rp num]]Variant >>] = ["Naked"]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1310 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1311 rparam <- [" naked"]Append[rbase]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1312 rfunc <- [ifunc]Allocate Var[rparam, [[worker]Output Types >>]Index[rp num]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1313 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1314 rparam <- Val[rbase]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1315 rfunc <- Val[ifunc]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1316 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1317 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1318 rparam <- ""
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1319 rfunc <- Val[ifunc]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1320 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1321
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1322 Fold[FInputs[?, ?, ?, [worker]Inputs >>], rfunc, [worker]Input Types >>]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1323 { [~]Call Foreign[name, [worker]Convention >>, Map[Zip[[worker]Inputs >>, [worker]Input Types >>], FParams[?]], rparam]
118
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
1324 { Fold[Release Raw Inputs[?, ?, ?, [worker]Inputs >>, [worker]Outputs >>], ~, [worker]Input Types >>]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1325 { Fold[Save Foreign Result[?, ?, ?, [worker]Output Types >>, [worker]Inputs >>, [worker]Input Types >>], ~, [worker]Outputs >>]
118
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
1326 { out <- [program]Store Function[~] }}}}
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1327 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1328
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1329 Compile Worker@NWorker[worker,program,name:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1330 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1331 If[[worker]Builtin? >>]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1332 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1333 out <- program
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1334 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1335 If[[[worker]Library >>] = [""]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1336 {
139
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
1337 ifunc <- Fold[Set Output Type[?], Fold[Set Input Type[?], [[program]Create Function[name,[worker]Inputs >>, [worker]Outputs >>, [worker]Convention >>]]Uses <<[[worker]Uses >>], [worker]Input Types >>], [worker]Output Types >>]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1338
120
cd25171e1bb2 Use List for Subsets instead of a Dictionary for performance reasons. Fix issue with List literals. Compiled compiler is now self-hosting.
Mike Pavone <pavone@retrodev.com>
parents: 118
diff changeset
1339 groups <- [worker]Dependency Groups
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1340
120
cd25171e1bb2 Use List for Subsets instead of a Dictionary for performance reasons. Fix issue with List literals. Compiled compiler is now self-hosting.
Mike Pavone <pavone@retrodev.com>
parents: 118
diff changeset
1341 fgroup <- [groups]First
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1342 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1343 with conds <- [worker]Save Group Conditions[groups, ~]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1344 final func <- [with conds]Compile Group[program,func,groups, ~]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1345 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1346 final func <- Val[func]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1347 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1348 res vars <- [worker]Result Vars
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1349 init vars <- Concatenate[res vars, [with conds]No Release Results]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1350
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1351 func <- Fold[Set Null[?], Fold[Set Null[?], Fold[Allocate Var[?, ?, "Any Type"], ifunc, init vars], init vars], [worker]Outputs >>]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1352 out <- [program]Store Function[Fold[Release[?], Fold[Release Var[with conds, ?], final func, res vars], [worker]Inputs >>]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1353 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1354 out <- Compile Foreign Stub[worker,[program]Link[[worker]Convention >>, [worker]Library >> ],name]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1355 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1356 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1357 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1358
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1359 Blueprint NBlueprint
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1360 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1361 Fields
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1362 Methods
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1363 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1364
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1365 String@NBlueprint[nbp:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1366 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1367 out <- [[[["NBlueprint: Fields("
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1368 ]Append[Join[Map[[nbp]Fields >>, [?]Index[0]], ", "]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1369 ]Append["), Methods("]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1370 ]Append[Join[Keys[[nbp]Methods >>], ", "]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1371 ]Append[")"]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1372 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1373
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1374 NBlueprint[:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1375 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1376 out <- [[Build[NBlueprint()]]Fields <<[()]]Methods <<[Dictionary[]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1377 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1378
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1379 Add Field@NBlueprint[bp,name,type:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1380 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1381 out <- [bp]Fields <<[ [[bp]Fields >>]Append[ [[()]Append[name]]Append[type] ] ]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1382 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1383
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1384 Add Method@NBlueprint[bp,name:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1385 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1386 out <- [bp]Methods <<[ [[bp]Methods >>]Set[name, Yes] ]
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
1387
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1388 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1389
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1390 Understands Method@NBlueprint[bp,name:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1391 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1392 out <- [[bp]Methods >>]Index[name] {}
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1393 { out <- No }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1394 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1395
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
1396 Eq Field Name[field,name:out]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
1397 {
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
1398 out <- [[field]Index[0]]=[name]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
1399 }
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
1400
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1401 Get Field Type@NBlueprint[bp,name:out,notfound]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1402 {
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
1403 ,not found <- [[bp]Fields >>]Find[Eq Field Name[?, name]]
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
1404 { out <- [[[bp]Fields >>]Index[~]]Index[1] }
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1405 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1406
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1407 _Compile Blueprint Fields[type,field:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1408 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1409 name <- [field]Index[0]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1410 ftype <- [field]Index[1]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1411 out <- [type]Add Field[name,ftype]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1412 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1413
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1414 _Compile Blueprint Methods[type,junk,name:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1415 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1416 If[[[name]=["Call"]] And [[[type]Name >>] = ["Worker"]]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1417 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1418 out <- type
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1419 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1420 out <- [type]Add Method[name]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1421 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1422 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1423
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1424 Make Init[func,field:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1425 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1426 name <- [field]Index[0]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1427 variant <- [[field]Index[1]]Variant >>
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1428 If[[variant] = ["Boxed"]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1429 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1430 out <- [func]Set Field Null["obj", name]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1431 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1432 out <- func
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1433 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1434 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1435
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1436 Make Copy[func,field:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1437 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1438 name <- [field]Index[0]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1439 variant <- [[field]Index[1]]Variant >>
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1440 If[[variant] = ["Boxed"]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1441 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1442 got <- [func]Read Field["obj", name] {}
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1443 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1444 stream <- [[got]Instruction Stream
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1445 ]AddRef No Dest[~]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1446 out <- [got]Do If[~, stream]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1447 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1448 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1449 out <- func
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1450 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1451 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1452
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1453 Make Cleanup[func,field:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1454 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1455 name <- [field]Index[0]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1456 variant <- [[field]Index[1]]Variant >>
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1457 If[[variant] = ["Boxed"]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1458 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1459 got <- [func]Read Field["obj", name] {}
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1460 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1461 stream <- [[got]Instruction Stream
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1462 ]Release[~]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1463 out <- [got]Do If[~, stream]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1464 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1465 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1466 out <- func
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1467 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1468 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1469
135
18a4403fe576 Javascript backend can now produce broken output. Needs fixes plus port of standard lib
Mike Pavone <pavone@retrodev.com>
parents: 121
diff changeset
1470 Make Special@NBlueprint[bp,backend,info,bp name:out]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1471 {
135
18a4403fe576 Javascript backend can now produce broken output. Needs fixes plus port of standard lib
Mike Pavone <pavone@retrodev.com>
parents: 121
diff changeset
1472 func name <- [info]Index[0]
18a4403fe576 Javascript backend can now produce broken output. Needs fixes plus port of standard lib
Mike Pavone <pavone@retrodev.com>
parents: 121
diff changeset
1473 pop worker <- [info]Index[1]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1474 func <- [[backend]Create Function[func name,("obj"),(),"cdecl"]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1475 ]Set Input Type[Type Instance[bp name], 0]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1476 out <- [backend]Store Function[Fold[pop worker, func, [bp]Fields >>]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1477 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1478
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1479 Getters Setters[backend,field,type name:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1480 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1481 //TODO: Throw an exception or something if we read a field that is empty
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1482 name <- [field]Index[0]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1483 type <- [field]Index[1]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1484 mytype <- Type Instance[type name]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1485 start getter,getref <- [[[[backend]Create Function[ [[[name]Append[" >>"]]Append["@"]]Append[type name], ("obj"), ("out"), "rhope"]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1486 ]Set Input Type[mytype, 0]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1487 ]Set Output Type[[type]Set Variant["Boxed"], 0]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1488 ]Read Field["obj", name]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1489 If[[[type]Variant >>] = ["Boxed"]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1490 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1491 getter <- [[start getter]Do AddRef[getref, "out"]]Release["obj"]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1492 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1493 getter <- [[start getter]Box[getref, "out", type]]Release["obj"]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1494 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1495
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1496 begin setter <- [[[[[backend]Create Function[ [[[name]Append[" <<"]]Append["@"]]Append[type name], ("obj","newval"), ("out"), "rhope"]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1497 ]Set Input Type[mytype, 0]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1498 ]Set Input Type[[type]Set Variant["Boxed"], 1]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1499 ]Set Output Type[mytype, 0]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1500 ]Copy["obj"]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1501
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1502 If[[[type]Variant >>] = ["Boxed"]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1503 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1504 ,origref <- [begin setter]Read Field["obj", name]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1505 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1506 stream <- [[~]Instruction Stream
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1507 ]Release[origref]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1508 ,setref <- [[~]Do If[origref, stream]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1509 ]Write Field["obj", name]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1510 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1511 setter <- [[~]Move["newval", setref]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1512 ]Move["obj", "out"]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1513 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1514 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1515 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1516 ,setref <- [begin setter]Write Field["obj", name]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1517 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1518 setter <- [[[~]Unbox["newval", setref]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1519 ]Release["newval"]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1520 ]Move["obj", "out"]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1521 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1522 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1523
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1524 out <- [[backend]Store Function[getter]]Store Function[setter]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1525
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1526 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1527
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1528 Compile Blueprint@NBlueprint[bp,backend,name:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1529 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1530 //Rhope identifiers can't start with spaces, so we can use identifiers that start with spaces for special functions
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1531 init name <- [" init "]Append[name]
118
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
1532 [("Array","Boxed Array","Worker")]Find[=[?,name]]
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
1533 {
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
1534 [("internalarraynaked","internalarrayboxed","internalworker")]Index[~]
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
1535 {
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
1536 copy name <- [~]Append["copy"]
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
1537 cleanup name <- [~]Append["cleanup"]
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
1538 }
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
1539 }{
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
1540 copy name <- [" copy "]Append[name]
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
1541 cleanup name <- [" cleanup "]Append[name]
b3f56e1d54a0 Merged changes from interpreted version of compiler to compiled version
Mike Pavone <pavone@retrodev.com>
parents: 117
diff changeset
1542 }
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1543 type <- [[[Fold[_Compile Blueprint Methods[?], Fold[_Compile Blueprint Fields[?], [backend]Create Type[name], [bp]Fields >>], [bp]Methods >>]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1544 ]Init <<[init name]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1545 ]Copy <<[copy name]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1546 ]Cleanup <<[cleanup name]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1547
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1548 out <- [backend]Register Type[type]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1549 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1550
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1551 Compile Special@NBlueprint[bp,backend,name:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1552 {
135
18a4403fe576 Javascript backend can now produce broken output. Needs fixes plus port of standard lib
Mike Pavone <pavone@retrodev.com>
parents: 121
diff changeset
1553 makespecial <- [[[Dictionary[]
18a4403fe576 Javascript backend can now produce broken output. Needs fixes plus port of standard lib
Mike Pavone <pavone@retrodev.com>
parents: 121
diff changeset
1554 ]Set["init", Make Init[?]]
18a4403fe576 Javascript backend can now produce broken output. Needs fixes plus port of standard lib
Mike Pavone <pavone@retrodev.com>
parents: 121
diff changeset
1555 ]Set["copy", Make Copy[?]]
18a4403fe576 Javascript backend can now produce broken output. Needs fixes plus port of standard lib
Mike Pavone <pavone@retrodev.com>
parents: 121
diff changeset
1556 ]Set["cleanup", Make Cleanup[?]]
18a4403fe576 Javascript backend can now produce broken output. Needs fixes plus port of standard lib
Mike Pavone <pavone@retrodev.com>
parents: 121
diff changeset
1557
18a4403fe576 Javascript backend can now produce broken output. Needs fixes plus port of standard lib
Mike Pavone <pavone@retrodev.com>
parents: 121
diff changeset
1558 after specials <- Fold[[bp]Make Special[?, ?, name], backend, [backend]Needed Specials[name,makespecial]]
18a4403fe576 Javascript backend can now produce broken output. Needs fixes plus port of standard lib
Mike Pavone <pavone@retrodev.com>
parents: 121
diff changeset
1559 out <- Fold[Getters Setters[?, ?, name], after specials, [bp]Fields >>]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1560 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1561
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1562 Blueprint NProgram
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1563 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1564 Blueprints
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1565 Workers
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1566 Worker Refs
136
fc3815b7462f Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents: 135
diff changeset
1567 Numtypes
139
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
1568 Global Stores
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1569 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1570
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1571 NProgram[:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1572 {
139
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
1573 out <- [[[[[Build[NProgram()]
136
fc3815b7462f Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents: 135
diff changeset
1574 ]Blueprints <<[Dictionary[]]
fc3815b7462f Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents: 135
diff changeset
1575 ]Workers <<[Dictionary[]]
fc3815b7462f Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents: 135
diff changeset
1576 ]Worker Refs <<[Dictionary[]]
fc3815b7462f Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents: 135
diff changeset
1577 ]Numtypes << [("Int8","Int16","Int32","Int64","UInt8","UInt16","UInt32","UInt64")]
139
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
1578 ]Global Stores <<[Dictionary[]]
136
fc3815b7462f Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents: 135
diff changeset
1579 }
fc3815b7462f Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents: 135
diff changeset
1580
fc3815b7462f Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents: 135
diff changeset
1581 Supported Number Types@NProgram[program:out]
fc3815b7462f Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents: 135
diff changeset
1582 {
fc3815b7462f Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents: 135
diff changeset
1583 out <- [program]Numtypes >>
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1584 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1585
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1586 Bind Worker@NProgram[prog,name,worker:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1587 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1588 after bind <- [prog]Workers << [ [[prog]Workers >>]Set[name, [worker]Name <<[name]] ]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1589 parts <- [name]Split["@"]
136
fc3815b7462f Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents: 135
diff changeset
1590 bpname <- [parts]Index[1]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1591 {
136
fc3815b7462f Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents: 135
diff changeset
1592 If[[~]=[""]]
fc3815b7462f Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents: 135
diff changeset
1593 {
fc3815b7462f Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents: 135
diff changeset
1594 out <- Val[after bind]
fc3815b7462f Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents: 135
diff changeset
1595 }{
fc3815b7462f Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents: 135
diff changeset
1596 orig bp <- [[after bind]Blueprints >>]Index[bpname] {}
fc3815b7462f Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents: 135
diff changeset
1597 { orig bp <- NBlueprint[] }
fc3815b7462f Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents: 135
diff changeset
1598 out <- [after bind]Blueprints <<[ [[after bind]Blueprints >>]Set[bpname, [orig bp]Add Method[[parts]Index[0]] ] ]
fc3815b7462f Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents: 135
diff changeset
1599 }
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1600 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1601 out <- Val[after bind]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1602 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1603 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1604
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1605 Bind Blueprint@NProgram[prog,name,blueprint:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1606 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1607 out <- [prog]Blueprints << [ [[prog]Blueprints >>]Set[name, blueprint] ]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1608 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1609
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1610 _Compile Program BP[backend, blueprint, name:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1611 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1612 out <- [blueprint]Compile Blueprint[backend, name]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1613 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1614
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1615 _Compile Program BP Special[backend, blueprint, name:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1616 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1617 out <- [blueprint]Compile Special[backend, name]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1618 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1619
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1620 _Compile Program[backend, worker, name:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1621 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1622 out <- [worker]Compile Worker[backend, name]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1623 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1624
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1625 Compile Program@NProgram[prog, backend:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1626 {
139
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
1627 backend with bps <- Generate Boolean Methods[Generate Number Methods[Fold[_Compile Program BP Special[?], Fold[_Compile Program BP[?], [backend]Global Stores <<[[prog]Global Stores >>], [prog]Blueprints >>], [prog]Blueprints >>]]]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1628 workers with infer <- Map[[prog]Workers >>, Infer Types[?, prog]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1629 out <- Fold[_Compile Program[?], backend with bps, workers with infer]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1630 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1631
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1632 Register Method@NProgram[prog, name, convention, inputs, outputs: out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1633 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1634 [[prog]Worker Refs >>]Index[name]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1635 {
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
1636 ref <- [[[[[~]Inputs <<[ Max[[~]Inputs >>, inputs] ]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1637 ]Min Inputs <<[ Min[[~]Min Inputs >>, inputs] ]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1638 ]Outputs <<[ Max[[~]Outputs >>, outputs] ]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1639 ]Min Outputs <<[ Min[[~]Min Outputs >>, outputs] ]
167
690ed78ead8a Some type inference fixes and make method calls into regular calls when first arg type is known at compile time
Mike Pavone <pavone@retrodev.com>
parents: 159
diff changeset
1640 ]Is Method? <<[Yes]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1641 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1642 ref <- Worker Ref[name, convention, inputs, outputs, Yes]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1643 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1644 out <- [prog]Worker Refs <<[ [[prog]Worker Refs >>]Set[name, ref]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1645 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1646
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1647 Register Worker@NProgram[prog, name, convention, inputs, outputs: out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1648 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1649 [[prog]Worker Refs >>]Index[name]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1650 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1651 ref <- [[[[~]Inputs <<[ Max[[~]Inputs >>, inputs] ]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1652 ]Min Inputs <<[ Min[[~]Min Inputs >>, inputs] ]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1653 ]Outputs <<[ Max[[~]Outputs >>, outputs] ]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1654 ]Min Outputs <<[ Min[[~]Min Outputs >>, outputs] ]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1655 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1656 ref <- Worker Ref[name, convention, inputs, outputs, No]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1657 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1658 after reg <- [prog]Worker Refs <<[
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1659 [ [prog]Worker Refs >> ]Set[name, ref]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1660 ]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1661
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1662 parts <- [name]Split["@"]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1663 [parts]Index[1]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1664 {
136
fc3815b7462f Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents: 135
diff changeset
1665 If[[~]=[""]]
fc3815b7462f Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents: 135
diff changeset
1666 {
fc3815b7462f Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents: 135
diff changeset
1667 out <- [after reg]Register Worker[[parts]Index[0], convention, inputs, outputs]
fc3815b7462f Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents: 135
diff changeset
1668 }{
fc3815b7462f Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents: 135
diff changeset
1669 out <- [after reg]Register Method@NProgram[[parts]Index[0], convention, inputs, outputs]
fc3815b7462f Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents: 135
diff changeset
1670 }
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1671 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1672 out <- Val[after reg]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1673 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1674 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1675
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1676 Register Builtins@NProgram[prog:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1677 {
159
d1e206ff75f9 Fix some bugs involving calling a worker object
Mike Pavone <pavone@retrodev.com>
parents: 142
diff changeset
1678 registered <- [[[[[[[[[[[prog]Register Worker["Print", "rhope", 1, 1]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1679 ]Register Worker["If@Boolean", "rhope", 1, 2]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1680 ]Register Worker["Build", "rhope", 1, 1]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1681 ]Register Worker["Blueprint Of", "rhope", 1, 1]
159
d1e206ff75f9 Fix some bugs involving calling a worker object
Mike Pavone <pavone@retrodev.com>
parents: 142
diff changeset
1682 ]Register Worker["Call", "rhope", 1, 1]//This will ensure that min outputs is 1
d1e206ff75f9 Fix some bugs involving calling a worker object
Mike Pavone <pavone@retrodev.com>
parents: 142
diff changeset
1683 ]Register Worker["Call@Worker", "rhope", 1, 10]//10 is a quick workaround for the lack of proper varargs
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1684 ]Register Worker["ID", "rhope", 1, 1]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1685 ]Register Worker["Blueprint From ID", "rhope", 1, 2]
140
c14698c512f1 Untested addition of Pause/Resume
Mike Pavone <pavone@retrodev.com>
parents: 139
diff changeset
1686 ]Register Worker["Pause", "rhope", 1, 1]
c14698c512f1 Untested addition of Pause/Resume
Mike Pavone <pavone@retrodev.com>
parents: 139
diff changeset
1687 ]Register Worker["Resume", "rhope", 2, 2]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1688 ]Register Number Methods
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1689
141
f2cb85c53ced Fix Pause/Resume and rewrite Call Async in Rhope rather than C
Mike Pavone <pavone@retrodev.com>
parents: 140
diff changeset
1690 out <- [[[[[[[[[registered]Bind Worker["If@Boolean",
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1691 [[[[[NWorker["rhope"]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1692 ]Inputs <<[("condition")]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1693 ]Input Types <<[ [()]Append[Type Instance["Boolean"]] ]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1694 ]Outputs <<[("isyes","isno")]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1695 ]Output Types <<[ [[()]Append[Type Instance["Boolean"]]]Append[Type Instance["Boolean"]] ]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1696 ]Builtin? <<[Yes]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1697 ]Bind Worker["Print",
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1698 [[[[[NWorker["rhope"]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1699 ]Inputs <<[("value")]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1700 ]Input Types <<[ [()]Append[Type Instance["Any Type"]] ]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1701 ]Outputs <<[("out")]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1702 ]Output Types <<[ [()]Append[Type Instance["Int32"]] ]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1703 ]Builtin? <<[Yes]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1704 ]Bind Worker["Build",
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1705 [[[[[NWorker["rhope"]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1706 ]Inputs <<[("type")]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1707 ]Input Types <<[ [()]Append[Type Instance["Blueprint"]] ]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1708 ]Outputs <<[("out")]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1709 ]Output Types <<[ [()]Append[Type Instance["Any Type"]] ]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1710 ]Builtin? <<[Yes]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1711 ]Bind Worker["Blueprint Of",
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1712 [[[[[NWorker["rhope"]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1713 ]Inputs <<[("object")]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1714 ]Input Types <<[ [()]Append[Type Instance["Any Type"]]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1715 ]Outputs <<[("type")]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1716 ]Output Types <<[ [()]Append[Type Instance["Blueprint"]]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1717 ]Builtin? <<[Yes]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1718 ]Bind Worker["Call@Worker",
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1719 [[[[[NWorker["rhope"]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1720 ]Inputs <<[("worker")]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1721 ]Input Types <<[ [()]Append[Type Instance["Worker"]] ]
159
d1e206ff75f9 Fix some bugs involving calling a worker object
Mike Pavone <pavone@retrodev.com>
parents: 142
diff changeset
1722 ]Outputs <<[("ret1","ret2","ret3","ret4","ret5","ret6","ret7","ret8","ret9","ret10")]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1723 ]Output Types <<[ [[()]Append[Type Instance["Any Type"]]]Append[Type Instance["Any Type"]] ]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1724 ]Builtin? << [Yes]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1725 ]Bind Worker["ID",
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1726 [[[[[NWorker["rhope"]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1727 ]Inputs <<[("bp")]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1728 ]Input Types <<[ [()]Append[Type Instance["Blueprint"]]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1729 ]Outputs <<[("id")]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1730 ]Output Types <<[ [()]Append[Type Instance["UInt32"]]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1731 ]Builtin? << [Yes]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1732 ]Bind Worker["Blueprint From ID",
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1733 [[[[[NWorker["rhope"]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1734 ]Inputs <<[("id")]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1735 ]Input Types <<[ [()]Append[Type Instance["UInt32"]]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1736 ]Outputs <<[("bp","none")]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1737 ]Output Types <<[ [[()]Append[Type Instance["Blueprint"]]]Append[Type Instance["Any Type"]]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1738 ]Builtin? << [Yes]]
141
f2cb85c53ced Fix Pause/Resume and rewrite Call Async in Rhope rather than C
Mike Pavone <pavone@retrodev.com>
parents: 140
diff changeset
1739 ]Bind Worker["Pause",
f2cb85c53ced Fix Pause/Resume and rewrite Call Async in Rhope rather than C
Mike Pavone <pavone@retrodev.com>
parents: 140
diff changeset
1740 [[[[[NWorker["rhope"]
f2cb85c53ced Fix Pause/Resume and rewrite Call Async in Rhope rather than C
Mike Pavone <pavone@retrodev.com>
parents: 140
diff changeset
1741 ]Inputs <<[("tocall")]
f2cb85c53ced Fix Pause/Resume and rewrite Call Async in Rhope rather than C
Mike Pavone <pavone@retrodev.com>
parents: 140
diff changeset
1742 ]Input Types <<[ [()]Append[Type Instance["Worker"]]]
f2cb85c53ced Fix Pause/Resume and rewrite Call Async in Rhope rather than C
Mike Pavone <pavone@retrodev.com>
parents: 140
diff changeset
1743 ]Outputs <<[("resumeval")]
f2cb85c53ced Fix Pause/Resume and rewrite Call Async in Rhope rather than C
Mike Pavone <pavone@retrodev.com>
parents: 140
diff changeset
1744 ]Output Types <<[ [()]Append[Type Instance["Any Type"]] ]
f2cb85c53ced Fix Pause/Resume and rewrite Call Async in Rhope rather than C
Mike Pavone <pavone@retrodev.com>
parents: 140
diff changeset
1745 ]Builtin? <<[Yes]]
f2cb85c53ced Fix Pause/Resume and rewrite Call Async in Rhope rather than C
Mike Pavone <pavone@retrodev.com>
parents: 140
diff changeset
1746 ]Bind Worker["Resume",
f2cb85c53ced Fix Pause/Resume and rewrite Call Async in Rhope rather than C
Mike Pavone <pavone@retrodev.com>
parents: 140
diff changeset
1747 [[[[[NWorker["rhope"]
f2cb85c53ced Fix Pause/Resume and rewrite Call Async in Rhope rather than C
Mike Pavone <pavone@retrodev.com>
parents: 140
diff changeset
1748 ]Inputs <<[("toresume","resumeval")]
f2cb85c53ced Fix Pause/Resume and rewrite Call Async in Rhope rather than C
Mike Pavone <pavone@retrodev.com>
parents: 140
diff changeset
1749 ]Input Types <<[ [[()]Append[Type Instance["Contest"]]]Append[Type Instance["Any Type"]] ]
f2cb85c53ced Fix Pause/Resume and rewrite Call Async in Rhope rather than C
Mike Pavone <pavone@retrodev.com>
parents: 140
diff changeset
1750 ]Outputs <<[("success","cantresume")]
f2cb85c53ced Fix Pause/Resume and rewrite Call Async in Rhope rather than C
Mike Pavone <pavone@retrodev.com>
parents: 140
diff changeset
1751 ]Output Types <<[ [[()]Append[Type Instance["Any Type"]]]Append[Type Instance["Any Type"]] ]
f2cb85c53ced Fix Pause/Resume and rewrite Call Async in Rhope rather than C
Mike Pavone <pavone@retrodev.com>
parents: 140
diff changeset
1752 ]Builtin? <<[Yes]]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1753 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1754
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1755 Find Worker@NProgram[prog, name:out,notfound]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1756 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1757 out,notfound <- [[prog]Worker Refs >>]Index[name]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1758 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1759
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1760 Find Worker Def@NProgram[prog,name:out,notfound]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1761 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1762 out,notfound <- [[prog]Workers >>]Index[name]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1763 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1764
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1765 Find Method@NProgram[prog, name, type:out,notfound]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1766 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1767 bp,notfound <- [[prog]Blueprints >>]Index[[type]Name >>]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1768 ,notfound <- If[[bp]Understands Method[name]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1769 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1770 out <- [[prog]Workers >>]Index[[[name]Append["@"]]Append[[type]Name >>]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1771 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1772 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1773
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1774 Find Field@NProgram[prog, name, type:fieldtype,notfound]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1775 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1776 bp,notfound <- [[prog]Blueprints >>]Index[[type]Name >>]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1777 fieldtype,notfound <- [bp]Get Field Type[name]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1778 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1779
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1780 Implicit Conversion@NProgram[prog, fromtype, totype:func,notfound]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1781 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1782 notfound <- No
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1783 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1784
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1785 Is Method?@NProgram[prog,name:is,is not]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1786 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1787 ,is not <- [[prog]Worker Refs>>]Index[name]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1788 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1789 is,is not <- If[[~]Is Method? >>]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1790 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1791 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1792