annotate Idea @ 291:7b6df595b205

ia32 code_bool.
author kono
date Fri, 04 Jun 2004 03:32:19 +0900
parents 8cd8d72286ae
children e5d40f8c4cce
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
d35df41eac69 Initial revision
kono
parents:
diff changeset
1
d35df41eac69 Initial revision
kono
parents:
diff changeset
2 Thu Nov 25 17:27:12 JST 1999
d35df41eac69 Initial revision
kono
parents:
diff changeset
3
d35df41eac69 Initial revision
kono
parents:
diff changeset
4 subroutine call がない
d35df41eac69 Initial revision
kono
parents:
diff changeset
5 局所変数もない
d35df41eac69 Initial revision
kono
parents:
diff changeset
6 その代わり、大域変数を多用する
d35df41eac69 Initial revision
kono
parents:
diff changeset
7 大域変数のスコープは局所的
d35df41eac69 Initial revision
kono
parents:
diff changeset
8 Fortran の用に局所変数は静的に取る
d35df41eac69 Initial revision
kono
parents:
diff changeset
9 recursion する時には、自分で保存する
d35df41eac69 Initial revision
kono
parents:
diff changeset
10 subroutine call時のレジスタのセーブも局所的に行う
d35df41eac69 Initial revision
kono
parents:
diff changeset
11 それは、ちょっと変じゃない?
d35df41eac69 Initial revision
kono
parents:
diff changeset
12 やっぱりデフォルトのフレームは持ち歩くか?
d35df41eac69 Initial revision
kono
parents:
diff changeset
13
d35df41eac69 Initial revision
kono
parents:
diff changeset
14 recursive call とそうでないのを区別するか?
d35df41eac69 Initial revision
kono
parents:
diff changeset
15
d35df41eac69 Initial revision
kono
parents:
diff changeset
16 fp は用意する方が良い
d35df41eac69 Initial revision
kono
parents:
diff changeset
17
d35df41eac69 Initial revision
kono
parents:
diff changeset
18 関数定義と同時に、それ専用のfpの構造体を用意する
d35df41eac69 Initial revision
kono
parents:
diff changeset
19
d35df41eac69 Initial revision
kono
parents:
diff changeset
20 C をcompileする時には、stackを持ち歩く
d35df41eac69 Initial revision
kono
parents:
diff changeset
21 fp = (struct func_state *)stack
d35df41eac69 Initial revision
kono
parents:
diff changeset
22 えっと、どこに代入するの? そういう問題もあるわけね。
d35df41eac69 Initial revision
kono
parents:
diff changeset
23 じゃあ、fpは特別? それは気に入らないな。static
d35df41eac69 Initial revision
kono
parents:
diff changeset
24 なfpにすれば良いわけね。
d35df41eac69 Initial revision
kono
parents:
diff changeset
25
d35df41eac69 Initial revision
kono
parents:
diff changeset
26 func(void *stack) {
d35df41eac69 Initial revision
kono
parents:
diff changeset
27 static struct func_state {
d35df41eac69 Initial revision
kono
parents:
diff changeset
28 static struct func_state *fp;
d35df41eac69 Initial revision
kono
parents:
diff changeset
29 int local1;
d35df41eac69 Initial revision
kono
parents:
diff changeset
30 brahbrah...
d35df41eac69 Initial revision
kono
parents:
diff changeset
31 } func_state; // ここまで hidden
d35df41eac69 Initial revision
kono
parents:
diff changeset
32 func_state.fp = (stack -= sizeof(struct func_state));
d35df41eac69 Initial revision
kono
parents:
diff changeset
33 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
34
d35df41eac69 Initial revision
kono
parents:
diff changeset
35 func_state をとってくる演算子があった方が良い? そうね。
d35df41eac69 Initial revision
kono
parents:
diff changeset
36 func.state
d35df41eac69 Initial revision
kono
parents:
diff changeset
37 ぐらい?
d35df41eac69 Initial revision
kono
parents:
diff changeset
38
d35df41eac69 Initial revision
kono
parents:
diff changeset
39 fp->local1 みたいなことだけするなら、C と同じになる。
d35df41eac69 Initial revision
kono
parents:
diff changeset
40
d35df41eac69 Initial revision
kono
parents:
diff changeset
41 call する時のarguemnt も、
d35df41eac69 Initial revision
kono
parents:
diff changeset
42 static な func_state に置く
d35df41eac69 Initial revision
kono
parents:
diff changeset
43 stack 上の func_state に置く
d35df41eac69 Initial revision
kono
parents:
diff changeset
44 という二通りの選択肢がある。Cと互換なら、当然、後者。
d35df41eac69 Initial revision
kono
parents:
diff changeset
45
d35df41eac69 Initial revision
kono
parents:
diff changeset
46 Recursive なら後者だが、この言語は状態遷移を記述するから、static
d35df41eac69 Initial revision
kono
parents:
diff changeset
47 なものでも良いはず。
d35df41eac69 Initial revision
kono
parents:
diff changeset
48
d35df41eac69 Initial revision
kono
parents:
diff changeset
49 Internal function は? あってもいいんだけど...
d35df41eac69 Initial revision
kono
parents:
diff changeset
50
d35df41eac69 Initial revision
kono
parents:
diff changeset
51 Recursive call する時には、 fp をsaveする必要があるね。
d35df41eac69 Initial revision
kono
parents:
diff changeset
52 (--(struct func_state *)stack) = fp;
d35df41eac69 Initial revision
kono
parents:
diff changeset
53 call callee(&fp->arg,continuation,stack);
d35df41eac69 Initial revision
kono
parents:
diff changeset
54 call しても、戻って来ないから... continuation は一般的にはcode
d35df41eac69 Initial revision
kono
parents:
diff changeset
55 だから... それは Internal function にするか。
d35df41eac69 Initial revision
kono
parents:
diff changeset
56
d35df41eac69 Initial revision
kono
parents:
diff changeset
57 continuation に一般的にcompileする方法を考えないといけないか。
d35df41eac69 Initial revision
kono
parents:
diff changeset
58 self は必要なわけね?
d35df41eac69 Initial revision
kono
parents:
diff changeset
59
d35df41eac69 Initial revision
kono
parents:
diff changeset
60 言語の名前も考えないといかんなぁ。
d35df41eac69 Initial revision
kono
parents:
diff changeset
61
d35df41eac69 Initial revision
kono
parents:
diff changeset
62 C からのコンパイラも書かないといけないのか...
d35df41eac69 Initial revision
kono
parents:
diff changeset
63
d35df41eac69 Initial revision
kono
parents:
diff changeset
64 Mon Dec 13 18:53:04 JST 1999
d35df41eac69 Initial revision
kono
parents:
diff changeset
65
d35df41eac69 Initial revision
kono
parents:
diff changeset
66 compiler based で、内部で partial evaluation できる?
d35df41eac69 Initial revision
kono
parents:
diff changeset
67
d35df41eac69 Initial revision
kono
parents:
diff changeset
68 func をdatabaseとして扱えないなら、それはできない。
d35df41eac69 Initial revision
kono
parents:
diff changeset
69
d35df41eac69 Initial revision
kono
parents:
diff changeset
70 しかし、状態遷移としては取り扱える。
d35df41eac69 Initial revision
kono
parents:
diff changeset
71
d35df41eac69 Initial revision
kono
parents:
diff changeset
72 func.state
d35df41eac69 Initial revision
kono
parents:
diff changeset
73 func.code
d35df41eac69 Initial revision
kono
parents:
diff changeset
74
d35df41eac69 Initial revision
kono
parents:
diff changeset
75 みたいな形にしてpartial evaluationすれば良い
d35df41eac69 Initial revision
kono
parents:
diff changeset
76
d35df41eac69 Initial revision
kono
parents:
diff changeset
77 でも止まるのか?
d35df41eac69 Initial revision
kono
parents:
diff changeset
78
d35df41eac69 Initial revision
kono
parents:
diff changeset
79 textual でない、中間的なコード表現があった方が良い? <-> interpreter?
d35df41eac69 Initial revision
kono
parents:
diff changeset
80
d35df41eac69 Initial revision
kono
parents:
diff changeset
81 Prolog ではなんでいけないの? --> Unification が重いから
d35df41eac69 Initial revision
kono
parents:
diff changeset
82
d35df41eac69 Initial revision
kono
parents:
diff changeset
83 Sat Nov 27 13:50:41 JST 1999
d35df41eac69 Initial revision
kono
parents:
diff changeset
84
d35df41eac69 Initial revision
kono
parents:
diff changeset
85 func.state とか作るのだったら、
d35df41eac69 Initial revision
kono
parents:
diff changeset
86 struct {
d35df41eac69 Initial revision
kono
parents:
diff changeset
87 struct {
d35df41eac69 Initial revision
kono
parents:
diff changeset
88 int i;
d35df41eac69 Initial revision
kono
parents:
diff changeset
89 } state;
d35df41eac69 Initial revision
kono
parents:
diff changeset
90 state *code = {
d35df41eac69 Initial revision
kono
parents:
diff changeset
91 i = i+1;
d35df41eac69 Initial revision
kono
parents:
diff changeset
92 };
d35df41eac69 Initial revision
kono
parents:
diff changeset
93 } name;
d35df41eac69 Initial revision
kono
parents:
diff changeset
94 みたいな形で、それ自体を構造化すれば? で、代入すると部分評価される。
d35df41eac69 Initial revision
kono
parents:
diff changeset
95 代入も可能。なるほど。
d35df41eac69 Initial revision
kono
parents:
diff changeset
96 *name.code;
d35df41eac69 Initial revision
kono
parents:
diff changeset
97 値はあるわけ? 値は &state でしょうね。
d35df41eac69 Initial revision
kono
parents:
diff changeset
98 self があれば、
d35df41eac69 Initial revision
kono
parents:
diff changeset
99 struct {
d35df41eac69 Initial revision
kono
parents:
diff changeset
100 struct {
d35df41eac69 Initial revision
kono
parents:
diff changeset
101 int i;
d35df41eac69 Initial revision
kono
parents:
diff changeset
102 } state,
d35df41eac69 Initial revision
kono
parents:
diff changeset
103 *code = {
d35df41eac69 Initial revision
kono
parents:
diff changeset
104 self->i = self->i+1;
d35df41eac69 Initial revision
kono
parents:
diff changeset
105 };
d35df41eac69 Initial revision
kono
parents:
diff changeset
106 } name;
d35df41eac69 Initial revision
kono
parents:
diff changeset
107 かな。self = state だよね。
d35df41eac69 Initial revision
kono
parents:
diff changeset
108
d35df41eac69 Initial revision
kono
parents:
diff changeset
109 union の拡張もあわせて議論すると...
d35df41eac69 Initial revision
kono
parents:
diff changeset
110
d35df41eac69 Initial revision
kono
parents:
diff changeset
111 Partial evalutator をセマンティクスや実行系にいれておくことは可能か?
d35df41eac69 Initial revision
kono
parents:
diff changeset
112
d35df41eac69 Initial revision
kono
parents:
diff changeset
113 byte code とか仮想マシンだったら可能。そうでない場合は?
d35df41eac69 Initial revision
kono
parents:
diff changeset
114
d35df41eac69 Initial revision
kono
parents:
diff changeset
115 いずれにせよ、構造体のタグのunique性を修正しないとだめだな。
d35df41eac69 Initial revision
kono
parents:
diff changeset
116
d35df41eac69 Initial revision
kono
parents:
diff changeset
117 ヘッダファイルはどうするの?
d35df41eac69 Initial revision
kono
parents:
diff changeset
118
d35df41eac69 Initial revision
kono
parents:
diff changeset
119 Mon Dec 13 18:53:18 JST 1999
d35df41eac69 Initial revision
kono
parents:
diff changeset
120
d35df41eac69 Initial revision
kono
parents:
diff changeset
121 library との整合性は?
d35df41eac69 Initial revision
kono
parents:
diff changeset
122
d35df41eac69 Initial revision
kono
parents:
diff changeset
123 exec sequence では、
d35df41eac69 Initial revision
kono
parents:
diff changeset
124 (--(struct func_state *)stack) = fp;
d35df41eac69 Initial revision
kono
parents:
diff changeset
125 call callee(&fp->arg);
d35df41eac69 Initial revision
kono
parents:
diff changeset
126 という形でpointerだけ渡すの? それは変だよね。
d35df41eac69 Initial revision
kono
parents:
diff changeset
127
d35df41eac69 Initial revision
kono
parents:
diff changeset
128 値渡しにするとすれば、複数の値を渡せたほうが良い。
d35df41eac69 Initial revision
kono
parents:
diff changeset
129
d35df41eac69 Initial revision
kono
parents:
diff changeset
130 func(void *stack) {
d35df41eac69 Initial revision
kono
parents:
diff changeset
131 static struct func_state {
d35df41eac69 Initial revision
kono
parents:
diff changeset
132 static struct func_state *fp;
d35df41eac69 Initial revision
kono
parents:
diff changeset
133 int local1;
d35df41eac69 Initial revision
kono
parents:
diff changeset
134 brahbrah...
d35df41eac69 Initial revision
kono
parents:
diff changeset
135 } func_state; // ここまで hidden
d35df41eac69 Initial revision
kono
parents:
diff changeset
136 func_state.fp = (stack -= sizeof(struct func_state));
d35df41eac69 Initial revision
kono
parents:
diff changeset
137 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
138
d35df41eac69 Initial revision
kono
parents:
diff changeset
139 の引数自体が、構造体であるべき。
d35df41eac69 Initial revision
kono
parents:
diff changeset
140
d35df41eac69 Initial revision
kono
parents:
diff changeset
141 func(
d35df41eac69 Initial revision
kono
parents:
diff changeset
142 struct void *stack
d35df41eac69 Initial revision
kono
parents:
diff changeset
143 ) {
d35df41eac69 Initial revision
kono
parents:
diff changeset
144 static struct func_state {
d35df41eac69 Initial revision
kono
parents:
diff changeset
145 static struct func_state *fp;
d35df41eac69 Initial revision
kono
parents:
diff changeset
146 int local1;
d35df41eac69 Initial revision
kono
parents:
diff changeset
147 brahbrah...
d35df41eac69 Initial revision
kono
parents:
diff changeset
148 } func_state; // ここまで hidden
d35df41eac69 Initial revision
kono
parents:
diff changeset
149 func_state.fp = (stack -= sizeof(struct func_state));
d35df41eac69 Initial revision
kono
parents:
diff changeset
150 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
151
d35df41eac69 Initial revision
kono
parents:
diff changeset
152 で、構造体に register storage を許す。
d35df41eac69 Initial revision
kono
parents:
diff changeset
153
d35df41eac69 Initial revision
kono
parents:
diff changeset
154 func(
d35df41eac69 Initial revision
kono
parents:
diff changeset
155 static struct argment {
d35df41eac69 Initial revision
kono
parents:
diff changeset
156 register void *stack;
d35df41eac69 Initial revision
kono
parents:
diff changeset
157 register void *continuation;
d35df41eac69 Initial revision
kono
parents:
diff changeset
158 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
159 ) {
d35df41eac69 Initial revision
kono
parents:
diff changeset
160 static struct func_state {
d35df41eac69 Initial revision
kono
parents:
diff changeset
161 static struct func_state *fp;
d35df41eac69 Initial revision
kono
parents:
diff changeset
162 int local1;
d35df41eac69 Initial revision
kono
parents:
diff changeset
163 brahbrah...
d35df41eac69 Initial revision
kono
parents:
diff changeset
164 } func_state; // ここまで hidden
d35df41eac69 Initial revision
kono
parents:
diff changeset
165 func_state.fp = (stack -= sizeof(struct func_state));
d35df41eac69 Initial revision
kono
parents:
diff changeset
166 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
167
d35df41eac69 Initial revision
kono
parents:
diff changeset
168 すると、caller の方も、構造体を引数とするのが自然。
d35df41eac69 Initial revision
kono
parents:
diff changeset
169
d35df41eac69 Initial revision
kono
parents:
diff changeset
170 call caller(
d35df41eac69 Initial revision
kono
parents:
diff changeset
171 static struct argment {
d35df41eac69 Initial revision
kono
parents:
diff changeset
172 register void *stack;
d35df41eac69 Initial revision
kono
parents:
diff changeset
173 register void *continuation;
d35df41eac69 Initial revision
kono
parents:
diff changeset
174 } arg = {a,b};
d35df41eac69 Initial revision
kono
parents:
diff changeset
175 )
d35df41eac69 Initial revision
kono
parents:
diff changeset
176
d35df41eac69 Initial revision
kono
parents:
diff changeset
177 みたいな。もちろん、この構造体はインタフェースと呼ばれる。
d35df41eac69 Initial revision
kono
parents:
diff changeset
178
d35df41eac69 Initial revision
kono
parents:
diff changeset
179 argument は、callee にあった方が良いけど、caller 側にあっても
d35df41eac69 Initial revision
kono
parents:
diff changeset
180 良い。register なんかは、そう。
d35df41eac69 Initial revision
kono
parents:
diff changeset
181
d35df41eac69 Initial revision
kono
parents:
diff changeset
182 caller(interface caller_arg = {a,b,c})
d35df41eac69 Initial revision
kono
parents:
diff changeset
183 みたいなsyntax かな。
d35df41eac69 Initial revision
kono
parents:
diff changeset
184 caller->interface = {a,b,c};
d35df41eac69 Initial revision
kono
parents:
diff changeset
185 *caller->code;
d35df41eac69 Initial revision
kono
parents:
diff changeset
186 を、
d35df41eac69 Initial revision
kono
parents:
diff changeset
187 caller(a,b,c);
d35df41eac69 Initial revision
kono
parents:
diff changeset
188 と称する。
d35df41eac69 Initial revision
kono
parents:
diff changeset
189
d35df41eac69 Initial revision
kono
parents:
diff changeset
190 function には、interface と code と state があることになる。
d35df41eac69 Initial revision
kono
parents:
diff changeset
191
d35df41eac69 Initial revision
kono
parents:
diff changeset
192 state にアクセスする時のlockは? protected state? synchonized state かな?
d35df41eac69 Initial revision
kono
parents:
diff changeset
193 もちろん、sequential implementatoinでは、そんなものはいらない。
d35df41eac69 Initial revision
kono
parents:
diff changeset
194
d35df41eac69 Initial revision
kono
parents:
diff changeset
195 function {
d35df41eac69 Initial revision
kono
parents:
diff changeset
196 interface:
d35df41eac69 Initial revision
kono
parents:
diff changeset
197 register int a;
d35df41eac69 Initial revision
kono
parents:
diff changeset
198 register struct self self;
d35df41eac69 Initial revision
kono
parents:
diff changeset
199 state:
d35df41eac69 Initial revision
kono
parents:
diff changeset
200 int b;
d35df41eac69 Initial revision
kono
parents:
diff changeset
201 serialized int c;
d35df41eac69 Initial revision
kono
parents:
diff changeset
202 code:
d35df41eac69 Initial revision
kono
parents:
diff changeset
203 b = a;
d35df41eac69 Initial revision
kono
parents:
diff changeset
204 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
205
d35df41eac69 Initial revision
kono
parents:
diff changeset
206 int にvoid value を定義する。実装は重くなるけど...
d35df41eac69 Initial revision
kono
parents:
diff changeset
207
d35df41eac69 Initial revision
kono
parents:
diff changeset
208 serialzed の semantics は?
d35df41eac69 Initial revision
kono
parents:
diff changeset
209
d35df41eac69 Initial revision
kono
parents:
diff changeset
210 もう少しmicro-Cに近く!
d35df41eac69 Initial revision
kono
parents:
diff changeset
211
d35df41eac69 Initial revision
kono
parents:
diff changeset
212 carring state と static state。
d35df41eac69 Initial revision
kono
parents:
diff changeset
213
d35df41eac69 Initial revision
kono
parents:
diff changeset
214 Mon Dec 13 19:42:41 JST 1999
d35df41eac69 Initial revision
kono
parents:
diff changeset
215
d35df41eac69 Initial revision
kono
parents:
diff changeset
216 interface に regsiter keyword を使うのは、あまりに
d35df41eac69 Initial revision
kono
parents:
diff changeset
217 実装よりすぎる。でも、でないと状態にできない?
d35df41eac69 Initial revision
kono
parents:
diff changeset
218 そんなことはないか。やっぱりcaller側のstatic 領域に
d35df41eac69 Initial revision
kono
parents:
diff changeset
219 直接書き込む?
d35df41eac69 Initial revision
kono
parents:
diff changeset
220
d35df41eac69 Initial revision
kono
parents:
diff changeset
221 だとCより遅そう。でも、引数に40個とかかかれたら...
d35df41eac69 Initial revision
kono
parents:
diff changeset
222
d35df41eac69 Initial revision
kono
parents:
diff changeset
223 Wed Dec 15 14:09:49 JST 1999
d35df41eac69 Initial revision
kono
parents:
diff changeset
224
d35df41eac69 Initial revision
kono
parents:
diff changeset
225 C と互換にする?
d35df41eac69 Initial revision
kono
parents:
diff changeset
226 goto function(argments);
d35df41eac69 Initial revision
kono
parents:
diff changeset
227 goto *continuation(argments);
d35df41eac69 Initial revision
kono
parents:
diff changeset
228 みたいな感じで。
d35df41eac69 Initial revision
kono
parents:
diff changeset
229
d35df41eac69 Initial revision
kono
parents:
diff changeset
230 stackの管理は? どうせ、library との互換はとらないと
d35df41eac69 Initial revision
kono
parents:
diff changeset
231 いけないんだから...
d35df41eac69 Initial revision
kono
parents:
diff changeset
232
d35df41eac69 Initial revision
kono
parents:
diff changeset
233 local 変数がある場合は stack を動かす。でも、戻す奴がいない。
d35df41eac69 Initial revision
kono
parents:
diff changeset
234 closure 化するか?
d35df41eac69 Initial revision
kono
parents:
diff changeset
235
d35df41eac69 Initial revision
kono
parents:
diff changeset
236 return した時の挙動が複雑になる。大域returnするわけだら。
d35df41eac69 Initial revision
kono
parents:
diff changeset
237
d35df41eac69 Initial revision
kono
parents:
diff changeset
238 argments をstatic 領域にかきこむ方式だと互換性がとれない。
d35df41eac69 Initial revision
kono
parents:
diff changeset
239 stack 上の frmae pointer 上にないとダメだから。
d35df41eac69 Initial revision
kono
parents:
diff changeset
240
d35df41eac69 Initial revision
kono
parents:
diff changeset
241 両立させるのは無理か? つまり、これだと、呼び出された方の
d35df41eac69 Initial revision
kono
parents:
diff changeset
242 frame semantics は、C と互換になる。だから、stackの直後に
d35df41eac69 Initial revision
kono
parents:
diff changeset
243 frame pointer があると思っている (そうか? ) frame pointer
d35df41eac69 Initial revision
kono
parents:
diff changeset
244 stack pointer に沿って移動した直後に、そこからのoffset
d35df41eac69 Initial revision
kono
parents:
diff changeset
245 で引数を操作することになる。
d35df41eac69 Initial revision
kono
parents:
diff changeset
246
d35df41eac69 Initial revision
kono
parents:
diff changeset
247 つまり、それはだめだったことじゃない? つまり、goto だと、
d35df41eac69 Initial revision
kono
parents:
diff changeset
248 frame pointer は、stack の直後とは限らないから。前の
d35df41eac69 Initial revision
kono
parents:
diff changeset
249 frmae pointer 相対に引数にアクセスしてくれれば別だけどね。
d35df41eac69 Initial revision
kono
parents:
diff changeset
250
d35df41eac69 Initial revision
kono
parents:
diff changeset
251 stack に引数を積むのは容認して、goto の場合は、向こう側で
d35df41eac69 Initial revision
kono
parents:
diff changeset
252 stack を畳むってのは? ということは、普通の関数と定義の
d35df41eac69 Initial revision
kono
parents:
diff changeset
253 方法を変えるってことか。ま、悪くはないか。
d35df41eac69 Initial revision
kono
parents:
diff changeset
254
d35df41eac69 Initial revision
kono
parents:
diff changeset
255 すると、goto のsemantics は、C と互換になる。それを受ける
d35df41eac69 Initial revision
kono
parents:
diff changeset
256 方が異なることをする。それは、なんかおかしいな。それに、
d35df41eac69 Initial revision
kono
parents:
diff changeset
257 それだと関数呼び出しが軽くならない...
d35df41eac69 Initial revision
kono
parents:
diff changeset
258
d35df41eac69 Initial revision
kono
parents:
diff changeset
259 ということは、やはり、C のcall は、call funciton で
d35df41eac69 Initial revision
kono
parents:
diff changeset
260 実現して、その他の呼び出しは、すべて、goto 扱いに
d35df41eac69 Initial revision
kono
parents:
diff changeset
261 する方が正しいだろう。
d35df41eac69 Initial revision
kono
parents:
diff changeset
262
d35df41eac69 Initial revision
kono
parents:
diff changeset
263 問題は、この言語の関数をcallされた時だな。dual entry にして、
d35df41eac69 Initial revision
kono
parents:
diff changeset
264 call の時と、goto の時を区別するか。
d35df41eac69 Initial revision
kono
parents:
diff changeset
265 func: stack processing
d35df41eac69 Initial revision
kono
parents:
diff changeset
266 func_goto: normal processing
d35df41eac69 Initial revision
kono
parents:
diff changeset
267 ...
d35df41eac69 Initial revision
kono
parents:
diff changeset
268 みたいな感じ。でも、return はないから...
d35df41eac69 Initial revision
kono
parents:
diff changeset
269
d35df41eac69 Initial revision
kono
parents:
diff changeset
270 このあたりも自分で記述できる言語であるべきだよね。その通り。
d35df41eac69 Initial revision
kono
parents:
diff changeset
271 つまり、C とのstub も自分で記述すると言うことか。
d35df41eac69 Initial revision
kono
parents:
diff changeset
272
d35df41eac69 Initial revision
kono
parents:
diff changeset
273 protocol function {
d35df41eac69 Initial revision
kono
parents:
diff changeset
274 interface c {
d35df41eac69 Initial revision
kono
parents:
diff changeset
275 register "%esp" struct {
d35df41eac69 Initial revision
kono
parents:
diff changeset
276 entry code ret(int);
d35df41eac69 Initial revision
kono
parents:
diff changeset
277 void *fp;
d35df41eac69 Initial revision
kono
parents:
diff changeset
278 } *sp;
d35df41eac69 Initial revision
kono
parents:
diff changeset
279 register "%ebp" void *fp;
d35df41eac69 Initial revision
kono
parents:
diff changeset
280 };
d35df41eac69 Initial revision
kono
parents:
diff changeset
281 code function_code {
d35df41eac69 Initial revision
kono
parents:
diff changeset
282 fp = sp;
d35df41eac69 Initial revision
kono
parents:
diff changeset
283 sp += sizeof(struct local);
d35df41eac69 Initial revision
kono
parents:
diff changeset
284 struct local *local = sp;
d35df41eac69 Initial revision
kono
parents:
diff changeset
285
d35df41eac69 Initial revision
kono
parents:
diff changeset
286 local->i = 1;
d35df41eac69 Initial revision
kono
parents:
diff changeset
287 goto *fp->ret(local->i),sp=fp; // return(local->i);
d35df41eac69 Initial revision
kono
parents:
diff changeset
288 };
d35df41eac69 Initial revision
kono
parents:
diff changeset
289 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
290
d35df41eac69 Initial revision
kono
parents:
diff changeset
291 みたいな感じでさ。さっすが、アセンブラ。いまいちreturnが汚いけど。
d35df41eac69 Initial revision
kono
parents:
diff changeset
292 まぁ、return はそのままreturnでもいいけどさ。
d35df41eac69 Initial revision
kono
parents:
diff changeset
293
d35df41eac69 Initial revision
kono
parents:
diff changeset
294 あ、これは良いかも知れない。code が複数かけるから。
d35df41eac69 Initial revision
kono
parents:
diff changeset
295
d35df41eac69 Initial revision
kono
parents:
diff changeset
296 state 以外は、consitent state であることを保証しない。ってのは?
d35df41eac69 Initial revision
kono
parents:
diff changeset
297 local 変数は使っても良いけど、call/goto の前後で、値を保証しないか...
d35df41eac69 Initial revision
kono
parents:
diff changeset
298
d35df41eac69 Initial revision
kono
parents:
diff changeset
299 うーん、だんだん炸裂してるなぁ。
d35df41eac69 Initial revision
kono
parents:
diff changeset
300
d35df41eac69 Initial revision
kono
parents:
diff changeset
301 だから、レジスタに対するマッピングの記述と、そうでない部分の
d35df41eac69 Initial revision
kono
parents:
diff changeset
302 記述は分離するべきでしょうね。
d35df41eac69 Initial revision
kono
parents:
diff changeset
303
d35df41eac69 Initial revision
kono
parents:
diff changeset
304
d35df41eac69 Initial revision
kono
parents:
diff changeset
305 全部一辺に実装するわけにはいかないからぁ...
d35df41eac69 Initial revision
kono
parents:
diff changeset
306
d35df41eac69 Initial revision
kono
parents:
diff changeset
307 Thu Dec 16 13:44:21 JST 1999
d35df41eac69 Initial revision
kono
parents:
diff changeset
308
d35df41eac69 Initial revision
kono
parents:
diff changeset
309 lock は状態遷移レベルで実現するのだから、self などを
d35df41eac69 Initial revision
kono
parents:
diff changeset
310 使ってlockする必要はないはず。
d35df41eac69 Initial revision
kono
parents:
diff changeset
311
d35df41eac69 Initial revision
kono
parents:
diff changeset
312 全体の直列化は、状態遷移レベルで、
d35df41eac69 Initial revision
kono
parents:
diff changeset
313 lock(storage) -> transition
d35df41eac69 Initial revision
kono
parents:
diff changeset
314 みたいな形で記述すれば良い。この当たりを、どのように記述するかは
d35df41eac69 Initial revision
kono
parents:
diff changeset
315 もう少し先送りしよう。
d35df41eac69 Initial revision
kono
parents:
diff changeset
316
d35df41eac69 Initial revision
kono
parents:
diff changeset
317
d35df41eac69 Initial revision
kono
parents:
diff changeset
318 引数はレジスタ渡しにしよう。長い引数は、呼び出し側の領域への
d35df41eac69 Initial revision
kono
parents:
diff changeset
319 ポインタとする。実装を規定しても良い。そうすれば、varargs
d35df41eac69 Initial revision
kono
parents:
diff changeset
320 みたいなものはなくなる。だいたい、なんで、そんなものがいるんだろう?
d35df41eac69 Initial revision
kono
parents:
diff changeset
321 配列を渡せばいいじゃん。
d35df41eac69 Initial revision
kono
parents:
diff changeset
322
d35df41eac69 Initial revision
kono
parents:
diff changeset
323 なので、引数は一つ(or 二つ)に限るという方法もある。
d35df41eac69 Initial revision
kono
parents:
diff changeset
324
d35df41eac69 Initial revision
kono
parents:
diff changeset
325 とすると、やはり、前もって静的領域や動的領域を確保することは
d35df41eac69 Initial revision
kono
parents:
diff changeset
326 できない。
d35df41eac69 Initial revision
kono
parents:
diff changeset
327
d35df41eac69 Initial revision
kono
parents:
diff changeset
328 この言語では動的領域は自分で確保するわけだから、その点は問題ない。
d35df41eac69 Initial revision
kono
parents:
diff changeset
329
d35df41eac69 Initial revision
kono
parents:
diff changeset
330 Thu Dec 16 20:24:55 JST 1999
d35df41eac69 Initial revision
kono
parents:
diff changeset
331
d35df41eac69 Initial revision
kono
parents:
diff changeset
332 とすると関数呼び出しは、
d35df41eac69 Initial revision
kono
parents:
diff changeset
333 # register save
d35df41eac69 Initial revision
kono
parents:
diff changeset
334 # set 1st argument in register %eax
d35df41eac69 Initial revision
kono
parents:
diff changeset
335 # set 2nd argument in register %ecx
d35df41eac69 Initial revision
kono
parents:
diff changeset
336 # set extra aguments in save area
d35df41eac69 Initial revision
kono
parents:
diff changeset
337 # set extra argument pointer in %edx
d35df41eac69 Initial revision
kono
parents:
diff changeset
338 jmp function
d35df41eac69 Initial revision
kono
parents:
diff changeset
339 という形式になるわけね。second を処理するのはめんどくさいから一つ
d35df41eac69 Initial revision
kono
parents:
diff changeset
340 にしよう。
d35df41eac69 Initial revision
kono
parents:
diff changeset
341
d35df41eac69 Initial revision
kono
parents:
diff changeset
342 えーと、frame pointer はないけど、コンパイルの手順からすると
d35df41eac69 Initial revision
kono
parents:
diff changeset
343 あった方が良い。しかし、frame pointer そのものをstatic
d35df41eac69 Initial revision
kono
parents:
diff changeset
344 にとるのはまずい。だから、frame pointer がfirst argment
d35df41eac69 Initial revision
kono
parents:
diff changeset
345 ということにする方が正しい。とすると引数は、さらに、その
d35df41eac69 Initial revision
kono
parents:
diff changeset
346 後と言うわけか。
d35df41eac69 Initial revision
kono
parents:
diff changeset
347 f(fp,argment)
d35df41eac69 Initial revision
kono
parents:
diff changeset
348 fp を渡すのにさらにargment をレジスタで渡すのはおかしい。おかしいけど、
d35df41eac69 Initial revision
kono
parents:
diff changeset
349 ま、良いか。
d35df41eac69 Initial revision
kono
parents:
diff changeset
350
d35df41eac69 Initial revision
kono
parents:
diff changeset
351 return しないなら、return type の定義をとるのは変だな。
d35df41eac69 Initial revision
kono
parents:
diff changeset
352
d35df41eac69 Initial revision
kono
parents:
diff changeset
353 f(fp,arg1,arg2,arg3) とすると、それぞれが決まったレジスタに入って、
d35df41eac69 Initial revision
kono
parents:
diff changeset
354 多い分は配列にあると思われる。ふむふむ...
d35df41eac69 Initial revision
kono
parents:
diff changeset
355 fp->xx
d35df41eac69 Initial revision
kono
parents:
diff changeset
356 でアクセスすれば、そのまま局所変数になる。全部、配列で
d35df41eac69 Initial revision
kono
parents:
diff changeset
357 送っても良い。
d35df41eac69 Initial revision
kono
parents:
diff changeset
358
d35df41eac69 Initial revision
kono
parents:
diff changeset
359 .set label,value
d35df41eac69 Initial revision
kono
parents:
diff changeset
360
d35df41eac69 Initial revision
kono
parents:
diff changeset
361 で as は値をセットするようですね。
d35df41eac69 Initial revision
kono
parents:
diff changeset
362
d35df41eac69 Initial revision
kono
parents:
diff changeset
363 関数コールの後は戻って来ないから後始末の心配はしなくてよい。
d35df41eac69 Initial revision
kono
parents:
diff changeset
364 frame pointer を使ったら自分で面倒を見ること。
d35df41eac69 Initial revision
kono
parents:
diff changeset
365
d35df41eac69 Initial revision
kono
parents:
diff changeset
366 だと
d35df41eac69 Initial revision
kono
parents:
diff changeset
367 a = atoi(s);
d35df41eac69 Initial revision
kono
parents:
diff changeset
368 みたいなことはできない...
d35df41eac69 Initial revision
kono
parents:
diff changeset
369
d35df41eac69 Initial revision
kono
parents:
diff changeset
370 普通のCの定義と交じると間違いやすい。
d35df41eac69 Initial revision
kono
parents:
diff changeset
371
d35df41eac69 Initial revision
kono
parents:
diff changeset
372 とすると、struct と同様に、
d35df41eac69 Initial revision
kono
parents:
diff changeset
373 protocol
d35df41eac69 Initial revision
kono
parents:
diff changeset
374 code
d35df41eac69 Initial revision
kono
parents:
diff changeset
375 interface
d35df41eac69 Initial revision
kono
parents:
diff changeset
376 state
d35df41eac69 Initial revision
kono
parents:
diff changeset
377 を用意するわけね。時間あるのかぁ?
d35df41eac69 Initial revision
kono
parents:
diff changeset
378
d35df41eac69 Initial revision
kono
parents:
diff changeset
379 とりあえず、register 渡しのfunction 定義とgoto文を実装する。
d35df41eac69 Initial revision
kono
parents:
diff changeset
380
d35df41eac69 Initial revision
kono
parents:
diff changeset
381 code name(register "%ebp" void *arg) {
d35df41eac69 Initial revision
kono
parents:
diff changeset
382 goto name(arg);
d35df41eac69 Initial revision
kono
parents:
diff changeset
383 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
384
d35df41eac69 Initial revision
kono
parents:
diff changeset
385 ぐらいかな? で、first argment が必ずregisterにのるようにしないと
d35df41eac69 Initial revision
kono
parents:
diff changeset
386 いけない。register storage class を入れて、
d35df41eac69 Initial revision
kono
parents:
diff changeset
387 register "%ebp" void *arg
d35df41eac69 Initial revision
kono
parents:
diff changeset
388 とかするわけね。
d35df41eac69 Initial revision
kono
parents:
diff changeset
389
d35df41eac69 Initial revision
kono
parents:
diff changeset
390 ってことは、まず、レジスタを実装しないといけないわけね。
d35df41eac69 Initial revision
kono
parents:
diff changeset
391
d35df41eac69 Initial revision
kono
parents:
diff changeset
392 で、stack を使った演算は、一応、そのままにする? それでも動くはず。
d35df41eac69 Initial revision
kono
parents:
diff changeset
393 式の途中でgotoは使えないんだから、それでいいはず。
d35df41eac69 Initial revision
kono
parents:
diff changeset
394
d35df41eac69 Initial revision
kono
parents:
diff changeset
395 で、それから、これを拡張していく。
d35df41eac69 Initial revision
kono
parents:
diff changeset
396
d35df41eac69 Initial revision
kono
parents:
diff changeset
397 interface c {
d35df41eac69 Initial revision
kono
parents:
diff changeset
398 register "%ebp" void *arg;
d35df41eac69 Initial revision
kono
parents:
diff changeset
399 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
400 code name(interface c) {
d35df41eac69 Initial revision
kono
parents:
diff changeset
401 goto name(c.arg); // c. は省略可能
d35df41eac69 Initial revision
kono
parents:
diff changeset
402 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
403
d35df41eac69 Initial revision
kono
parents:
diff changeset
404 とかね。さらに、
d35df41eac69 Initial revision
kono
parents:
diff changeset
405
d35df41eac69 Initial revision
kono
parents:
diff changeset
406 protocol name {
d35df41eac69 Initial revision
kono
parents:
diff changeset
407 interface c {
d35df41eac69 Initial revision
kono
parents:
diff changeset
408 register "%ebp" void *arg;
d35df41eac69 Initial revision
kono
parents:
diff changeset
409 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
410 code name(interface c) {
d35df41eac69 Initial revision
kono
parents:
diff changeset
411 goto name(arg);
d35df41eac69 Initial revision
kono
parents:
diff changeset
412 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
413 code name1(interface c) {
d35df41eac69 Initial revision
kono
parents:
diff changeset
414 goto name(arg);
d35df41eac69 Initial revision
kono
parents:
diff changeset
415 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
416 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
417
d35df41eac69 Initial revision
kono
parents:
diff changeset
418 などとするわけか。なんと、これが C と共存するわけね。うーん。
d35df41eac69 Initial revision
kono
parents:
diff changeset
419
d35df41eac69 Initial revision
kono
parents:
diff changeset
420 Fri Dec 31 11:44:03 JST 1999
d35df41eac69 Initial revision
kono
parents:
diff changeset
421
d35df41eac69 Initial revision
kono
parents:
diff changeset
422 code でなくて、別な名前のほうが良くない? segment? action?
d35df41eac69 Initial revision
kono
parents:
diff changeset
423
d35df41eac69 Initial revision
kono
parents:
diff changeset
424 レジスタ名が入るのは、やっぱりいや。optionalには許す。
d35df41eac69 Initial revision
kono
parents:
diff changeset
425
d35df41eac69 Initial revision
kono
parents:
diff changeset
426 interface は構造体のようなものだから... 構造体でいいんじゃない?
d35df41eac69 Initial revision
kono
parents:
diff changeset
427 構造体の場合は... malloc する? う、うーん。malloc するとして、
d35df41eac69 Initial revision
kono
parents:
diff changeset
428 いつfree するの?
d35df41eac69 Initial revision
kono
parents:
diff changeset
429
d35df41eac69 Initial revision
kono
parents:
diff changeset
430 再入するときには、壊れてていいんじゃない? multi-thread でなければね。
d35df41eac69 Initial revision
kono
parents:
diff changeset
431 multi thread では、状態は、レジスタ経由または、thread local に持つ
d35df41eac69 Initial revision
kono
parents:
diff changeset
432 必要がある。static は、だから thread local に持たなくてはならない。
d35df41eac69 Initial revision
kono
parents:
diff changeset
433 大域変数に割り振っちゃだめ。でも、いまは、やめて
d35df41eac69 Initial revision
kono
parents:
diff changeset
434
d35df41eac69 Initial revision
kono
parents:
diff changeset
435 interface は、とりあえず、二つまでの値渡しにしよう。
d35df41eac69 Initial revision
kono
parents:
diff changeset
436 self と arg
d35df41eac69 Initial revision
kono
parents:
diff changeset
437 ですね。
d35df41eac69 Initial revision
kono
parents:
diff changeset
438
d35df41eac69 Initial revision
kono
parents:
diff changeset
439 もう少し拡張しやすいコンパイラがいいなぁ。
d35df41eac69 Initial revision
kono
parents:
diff changeset
440
d35df41eac69 Initial revision
kono
parents:
diff changeset
441 code name (c,a)
d35df41eac69 Initial revision
kono
parents:
diff changeset
442 struct state *c; struct arg *a;
d35df41eac69 Initial revision
kono
parents:
diff changeset
443 {
d35df41eac69 Initial revision
kono
parents:
diff changeset
444 goto name(arg);
d35df41eac69 Initial revision
kono
parents:
diff changeset
445 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
446
d35df41eac69 Initial revision
kono
parents:
diff changeset
447 local 変数は? この互換性の問題かぁ。
d35df41eac69 Initial revision
kono
parents:
diff changeset
448
d35df41eac69 Initial revision
kono
parents:
diff changeset
449 KL/1 を意識して、interface は heap に置くことにしても良い。
d35df41eac69 Initial revision
kono
parents:
diff changeset
450 GC は言語に入れておくべきだが、interfaceは machine independent
d35df41eac69 Initial revision
kono
parents:
diff changeset
451 であるべき。だとすれば use/forget みたいものはいるだろう。
d35df41eac69 Initial revision
kono
parents:
diff changeset
452 でも今のところは考える必要はない。
d35df41eac69 Initial revision
kono
parents:
diff changeset
453
d35df41eac69 Initial revision
kono
parents:
diff changeset
454 えーと、
d35df41eac69 Initial revision
kono
parents:
diff changeset
455 code name (c,a)
d35df41eac69 Initial revision
kono
parents:
diff changeset
456 struct state *c; struct arg *a;
d35df41eac69 Initial revision
kono
parents:
diff changeset
457 {
d35df41eac69 Initial revision
kono
parents:
diff changeset
458 int i;
d35df41eac69 Initial revision
kono
parents:
diff changeset
459 goto name(arg);
d35df41eac69 Initial revision
kono
parents:
diff changeset
460 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
461 の時の一時変数iはどうするの? 基本的にはレジスタ割り当てだけど...
d35df41eac69 Initial revision
kono
parents:
diff changeset
462 使用させない? んー、大胆な御意見。まぁ、やっぱりheapに割り当てちゃう
d35df41eac69 Initial revision
kono
parents:
diff changeset
463 のが簡単か。でも、どうせ抜ける時にはいらなくなるわけだから...
d35df41eac69 Initial revision
kono
parents:
diff changeset
464
d35df41eac69 Initial revision
kono
parents:
diff changeset
465 ほんらい、この変数は、次のcallでは必要無くなるのが普通。
d35df41eac69 Initial revision
kono
parents:
diff changeset
466
d35df41eac69 Initial revision
kono
parents:
diff changeset
467 とにかく、レジスタ変数は必要なんでしょう?
d35df41eac69 Initial revision
kono
parents:
diff changeset
468
d35df41eac69 Initial revision
kono
parents:
diff changeset
469 だから、GC と合わせて言語を設計すべきだよね。API を規定して、
d35df41eac69 Initial revision
kono
parents:
diff changeset
470 異なるGCを選択できるようにする。
d35df41eac69 Initial revision
kono
parents:
diff changeset
471
d35df41eac69 Initial revision
kono
parents:
diff changeset
472 Sat Jan 1 22:40:22 JST 2000
d35df41eac69 Initial revision
kono
parents:
diff changeset
473
d35df41eac69 Initial revision
kono
parents:
diff changeset
474 とーにかく、 storage class regisgter を実装しよう。
d35df41eac69 Initial revision
kono
parents:
diff changeset
475
d35df41eac69 Initial revision
kono
parents:
diff changeset
476 stmode=REGISTER
d35df41eac69 Initial revision
kono
parents:
diff changeset
477
d35df41eac69 Initial revision
kono
parents:
diff changeset
478 で、local storage とおなじ扱いとする
d35df41eac69 Initial revision
kono
parents:
diff changeset
479 static register? は、ない。
d35df41eac69 Initial revision
kono
parents:
diff changeset
480
d35df41eac69 Initial revision
kono
parents:
diff changeset
481 symbol table に storage class をたせば? dsp==EXTRN で判定しているから、
d35df41eac69 Initial revision
kono
parents:
diff changeset
482 local 変数が36以上あるとおかしくなるぞ?
d35df41eac69 Initial revision
kono
parents:
diff changeset
483
d35df41eac69 Initial revision
kono
parents:
diff changeset
484 sc は GVAR/LVAR だけど、regsiter は LVAR の特殊な奴だから、
d35df41eac69 Initial revision
kono
parents:
diff changeset
485 sc に入れるほうが正しいか...
d35df41eac69 Initial revision
kono
parents:
diff changeset
486
d35df41eac69 Initial revision
kono
parents:
diff changeset
487 Sun Jan 2 01:47:17 JST 2000
d35df41eac69 Initial revision
kono
parents:
diff changeset
488
d35df41eac69 Initial revision
kono
parents:
diff changeset
489 register 変数はできました。けど、regsiter を二つ使うと、
d35df41eac69 Initial revision
kono
parents:
diff changeset
490 一杯になってしまうので、REGISTER6 でコンパイルしないと
d35df41eac69 Initial revision
kono
parents:
diff changeset
491 結構ひどい。が、register 変数を%esi,%edi に割り当てれば
d35df41eac69 Initial revision
kono
parents:
diff changeset
492 いいか。
d35df41eac69 Initial revision
kono
parents:
diff changeset
493
d35df41eac69 Initial revision
kono
parents:
diff changeset
494 Sun Jan 2 04:43:04 JST 2000
d35df41eac69 Initial revision
kono
parents:
diff changeset
495
d35df41eac69 Initial revision
kono
parents:
diff changeset
496 で、
d35df41eac69 Initial revision
kono
parents:
diff changeset
497 code name (c,a)
d35df41eac69 Initial revision
kono
parents:
diff changeset
498 struct state *c; struct arg *a;
d35df41eac69 Initial revision
kono
parents:
diff changeset
499 {
d35df41eac69 Initial revision
kono
parents:
diff changeset
500 goto name(c);
d35df41eac69 Initial revision
kono
parents:
diff changeset
501 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
502 の一時変数無しは実装できます。引数は二つまでね。
d35df41eac69 Initial revision
kono
parents:
diff changeset
503
d35df41eac69 Initial revision
kono
parents:
diff changeset
504 .file "tmp.c"
d35df41eac69 Initial revision
kono
parents:
diff changeset
505 .version "01.01"
d35df41eac69 Initial revision
kono
parents:
diff changeset
506 gcc2_compiled.:
d35df41eac69 Initial revision
kono
parents:
diff changeset
507 .text
d35df41eac69 Initial revision
kono
parents:
diff changeset
508 #
d35df41eac69 Initial revision
kono
parents:
diff changeset
509 # code name(c,a)
d35df41eac69 Initial revision
kono
parents:
diff changeset
510 .align 2
d35df41eac69 Initial revision
kono
parents:
diff changeset
511 .globl code
d35df41eac69 Initial revision
kono
parents:
diff changeset
512 code:
d35df41eac69 Initial revision
kono
parents:
diff changeset
513 .type code,@function
d35df41eac69 Initial revision
kono
parents:
diff changeset
514 # struct state *c; struct arg *a;
d35df41eac69 Initial revision
kono
parents:
diff changeset
515 # {
d35df41eac69 Initial revision
kono
parents:
diff changeset
516 # goto name(c);
d35df41eac69 Initial revision
kono
parents:
diff changeset
517 movl %esi,%esi
d35df41eac69 Initial revision
kono
parents:
diff changeset
518 jmp name
d35df41eac69 Initial revision
kono
parents:
diff changeset
519 _5:
d35df41eac69 Initial revision
kono
parents:
diff changeset
520 .size code,_5-code
d35df41eac69 Initial revision
kono
parents:
diff changeset
521 .ident "Micro-C compiled"
d35df41eac69 Initial revision
kono
parents:
diff changeset
522
d35df41eac69 Initial revision
kono
parents:
diff changeset
523 う、すごい。
d35df41eac69 Initial revision
kono
parents:
diff changeset
524
d35df41eac69 Initial revision
kono
parents:
diff changeset
525 goto 文がめんどくさい。stack をたたんで、jmp すれば
d35df41eac69 Initial revision
kono
parents:
diff changeset
526 よいだけだが..
d35df41eac69 Initial revision
kono
parents:
diff changeset
527
d35df41eac69 Initial revision
kono
parents:
diff changeset
528 Sun Jan 2 11:17:50 JST 2000
d35df41eac69 Initial revision
kono
parents:
diff changeset
529
d35df41eac69 Initial revision
kono
parents:
diff changeset
530 普通のcallをcontinuation baseにすることができる?
d35df41eac69 Initial revision
kono
parents:
diff changeset
531
d35df41eac69 Initial revision
kono
parents:
diff changeset
532 Sun Jan 2 20:28:45 JST 2000
d35df41eac69 Initial revision
kono
parents:
diff changeset
533
d35df41eac69 Initial revision
kono
parents:
diff changeset
534 goto 文だけど、やはり、一度、expr で生成してから、top level
d35df41eac69 Initial revision
kono
parents:
diff changeset
535 で jump code を生成しよう。
d35df41eac69 Initial revision
kono
parents:
diff changeset
536
d35df41eac69 Initial revision
kono
parents:
diff changeset
537 Tue Jan 4 03:32:55 JST 2000
d35df41eac69 Initial revision
kono
parents:
diff changeset
538
d35df41eac69 Initial revision
kono
parents:
diff changeset
539 code をtypeにしないと、
d35df41eac69 Initial revision
kono
parents:
diff changeset
540 code *p;
d35df41eac69 Initial revision
kono
parents:
diff changeset
541 とか書けないね。
d35df41eac69 Initial revision
kono
parents:
diff changeset
542 int *p();
d35df41eac69 Initial revision
kono
parents:
diff changeset
543 と同じだけどさ。
d35df41eac69 Initial revision
kono
parents:
diff changeset
544
d35df41eac69 Initial revision
kono
parents:
diff changeset
545
d35df41eac69 Initial revision
kono
parents:
diff changeset
546 main(ac,av)
d35df41eac69 Initial revision
kono
parents:
diff changeset
547 int ac;
d35df41eac69 Initial revision
kono
parents:
diff changeset
548 char *av[];
d35df41eac69 Initial revision
kono
parents:
diff changeset
549 {
d35df41eac69 Initial revision
kono
parents:
diff changeset
550 goto code1(ac,av);
d35df41eac69 Initial revision
kono
parents:
diff changeset
551 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
552
d35df41eac69 Initial revision
kono
parents:
diff changeset
553 code code1(ac,av)
d35df41eac69 Initial revision
kono
parents:
diff changeset
554 int ac;
d35df41eac69 Initial revision
kono
parents:
diff changeset
555 char *av[];
d35df41eac69 Initial revision
kono
parents:
diff changeset
556 {
d35df41eac69 Initial revision
kono
parents:
diff changeset
557 if (ac)
d35df41eac69 Initial revision
kono
parents:
diff changeset
558 goto code1(ac,av);
d35df41eac69 Initial revision
kono
parents:
diff changeset
559 else
d35df41eac69 Initial revision
kono
parents:
diff changeset
560 goto ac(ac,av);
d35df41eac69 Initial revision
kono
parents:
diff changeset
561 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
562
d35df41eac69 Initial revision
kono
parents:
diff changeset
563 Tue Jan 4 04:56:56 JST 2000
d35df41eac69 Initial revision
kono
parents:
diff changeset
564
d35df41eac69 Initial revision
kono
parents:
diff changeset
565 うーん、なんかレジスタにつむ順序が違う
d35df41eac69 Initial revision
kono
parents:
diff changeset
566 これは、adecl がreverseにつむから。
d35df41eac69 Initial revision
kono
parents:
diff changeset
567
d35df41eac69 Initial revision
kono
parents:
diff changeset
568 code のretrun
d35df41eac69 Initial revision
kono
parents:
diff changeset
569
d35df41eac69 Initial revision
kono
parents:
diff changeset
570 やはりcodeはtypeにしないとだめ。
d35df41eac69 Initial revision
kono
parents:
diff changeset
571
d35df41eac69 Initial revision
kono
parents:
diff changeset
572 main()
d35df41eac69 Initial revision
kono
parents:
diff changeset
573 {
d35df41eac69 Initial revision
kono
parents:
diff changeset
574 goto code1();
d35df41eac69 Initial revision
kono
parents:
diff changeset
575 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
576
d35df41eac69 Initial revision
kono
parents:
diff changeset
577 とかだと、main に戻って来れない。もちろん、code1() 以降で、
d35df41eac69 Initial revision
kono
parents:
diff changeset
578 return するわけにはいかない。(main の disp をcode1 は知り得ない)
d35df41eac69 Initial revision
kono
parents:
diff changeset
579 goto label をcode1の引数に送れば?
d35df41eac69 Initial revision
kono
parents:
diff changeset
580
d35df41eac69 Initial revision
kono
parents:
diff changeset
581 main()
d35df41eac69 Initial revision
kono
parents:
diff changeset
582 {
d35df41eac69 Initial revision
kono
parents:
diff changeset
583 goto code1(ret);
d35df41eac69 Initial revision
kono
parents:
diff changeset
584 ret:
d35df41eac69 Initial revision
kono
parents:
diff changeset
585 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
586
d35df41eac69 Initial revision
kono
parents:
diff changeset
587 これだと、ret がforward labelかどうか分からないけど?
d35df41eac69 Initial revision
kono
parents:
diff changeset
588
d35df41eac69 Initial revision
kono
parents:
diff changeset
589 code1 中で使う中間変数を stack 上にとるのは悪くない。しかし、それを
d35df41eac69 Initial revision
kono
parents:
diff changeset
590 %ebp 経由でアクセスするということは、main の中間変数を壊すということ。
d35df41eac69 Initial revision
kono
parents:
diff changeset
591 それを防ぐには、main 中のgoto codeで、%ebp を修正してやれば良い。
d35df41eac69 Initial revision
kono
parents:
diff changeset
592 (今は戻って来ないので問題ない)
d35df41eac69 Initial revision
kono
parents:
diff changeset
593
d35df41eac69 Initial revision
kono
parents:
diff changeset
594 code1 のgoto では、戻って来ないから、その必要はない。しかし、
d35df41eac69 Initial revision
kono
parents:
diff changeset
595 label をcode1 中で渡されると、ちょっと気まずい。
d35df41eac69 Initial revision
kono
parents:
diff changeset
596
d35df41eac69 Initial revision
kono
parents:
diff changeset
597 とすると、それは禁止して、main() 中でstackをたたんでからgotoするか?
d35df41eac69 Initial revision
kono
parents:
diff changeset
598 そうすると、無限後退して、結局、帰れないことになる... うーん。
d35df41eac69 Initial revision
kono
parents:
diff changeset
599
d35df41eac69 Initial revision
kono
parents:
diff changeset
600 main() 中のlocal code を許せば、それは解決するが..
d35df41eac69 Initial revision
kono
parents:
diff changeset
601
d35df41eac69 Initial revision
kono
parents:
diff changeset
602 main()
d35df41eac69 Initial revision
kono
parents:
diff changeset
603 {
d35df41eac69 Initial revision
kono
parents:
diff changeset
604 goto code1(code2);
d35df41eac69 Initial revision
kono
parents:
diff changeset
605 code code2() {
d35df41eac69 Initial revision
kono
parents:
diff changeset
606 return;
d35df41eac69 Initial revision
kono
parents:
diff changeset
607 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
608 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
609
d35df41eac69 Initial revision
kono
parents:
diff changeset
610 みたいな感じ。でも、そうするとscope rule を変える必要があるので厳しい。
d35df41eac69 Initial revision
kono
parents:
diff changeset
611 ま、悪くはないけどね。
d35df41eac69 Initial revision
kono
parents:
diff changeset
612
d35df41eac69 Initial revision
kono
parents:
diff changeset
613 continuation を明示する方法もある。
d35df41eac69 Initial revision
kono
parents:
diff changeset
614
d35df41eac69 Initial revision
kono
parents:
diff changeset
615 main()
d35df41eac69 Initial revision
kono
parents:
diff changeset
616 {
d35df41eac69 Initial revision
kono
parents:
diff changeset
617 goto code1(continuation);
d35df41eac69 Initial revision
kono
parents:
diff changeset
618 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
619 code code1(ret)
d35df41eac69 Initial revision
kono
parents:
diff changeset
620 code (*ret)();
d35df41eac69 Initial revision
kono
parents:
diff changeset
621 {
d35df41eac69 Initial revision
kono
parents:
diff changeset
622 goto *ret;
d35df41eac69 Initial revision
kono
parents:
diff changeset
623 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
624
d35df41eac69 Initial revision
kono
parents:
diff changeset
625 かな? call/cc ?
d35df41eac69 Initial revision
kono
parents:
diff changeset
626
d35df41eac69 Initial revision
kono
parents:
diff changeset
627 label へのgotoを許すのもいいけど、
d35df41eac69 Initial revision
kono
parents:
diff changeset
628 でも、label を許すと、すごくspagettyにならない?
d35df41eac69 Initial revision
kono
parents:
diff changeset
629
d35df41eac69 Initial revision
kono
parents:
diff changeset
630
d35df41eac69 Initial revision
kono
parents:
diff changeset
631 Tue Jan 4 11:47:24 JST 2000
d35df41eac69 Initial revision
kono
parents:
diff changeset
632
d35df41eac69 Initial revision
kono
parents:
diff changeset
633 contiunation じゃなくて、return keyword を使おう。
d35df41eac69 Initial revision
kono
parents:
diff changeset
634 (実際、continuation と少し違うし)
d35df41eac69 Initial revision
kono
parents:
diff changeset
635 type が少し変になるけど、まあ良い。
d35df41eac69 Initial revision
kono
parents:
diff changeset
636
d35df41eac69 Initial revision
kono
parents:
diff changeset
637 int
d35df41eac69 Initial revision
kono
parents:
diff changeset
638 main()
d35df41eac69 Initial revision
kono
parents:
diff changeset
639 {
d35df41eac69 Initial revision
kono
parents:
diff changeset
640 goto code1(return);
d35df41eac69 Initial revision
kono
parents:
diff changeset
641 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
642 code code1(ret)
d35df41eac69 Initial revision
kono
parents:
diff changeset
643 code (*ret)(int);
d35df41eac69 Initial revision
kono
parents:
diff changeset
644 {
d35df41eac69 Initial revision
kono
parents:
diff changeset
645 goto *ret(3);
d35df41eac69 Initial revision
kono
parents:
diff changeset
646 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
647
d35df41eac69 Initial revision
kono
parents:
diff changeset
648 だな。prototype も付けないといけないか。
d35df41eac69 Initial revision
kono
parents:
diff changeset
649
d35df41eac69 Initial revision
kono
parents:
diff changeset
650 Tue Jan 4 12:21:44 JST 2000
d35df41eac69 Initial revision
kono
parents:
diff changeset
651
d35df41eac69 Initial revision
kono
parents:
diff changeset
652 これだとmethodがすべてstatic になってしまう。dynamic なmethod
d35df41eac69 Initial revision
kono
parents:
diff changeset
653 呼び出しにするには? dipatcher を自分で作ることになる。かなり
d35df41eac69 Initial revision
kono
parents:
diff changeset
654 めんどくさいが...
d35df41eac69 Initial revision
kono
parents:
diff changeset
655
d35df41eac69 Initial revision
kono
parents:
diff changeset
656 code method(obj,arg)
d35df41eac69 Initial revision
kono
parents:
diff changeset
657 {
d35df41eac69 Initial revision
kono
parents:
diff changeset
658 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
659
d35df41eac69 Initial revision
kono
parents:
diff changeset
660 か、あるいは、inline にするか... #define のかわりに inline ねぇ。
d35df41eac69 Initial revision
kono
parents:
diff changeset
661 これはあとで考えて良い。
d35df41eac69 Initial revision
kono
parents:
diff changeset
662
d35df41eac69 Initial revision
kono
parents:
diff changeset
663 Tue Jan 4 14:22:19 JST 2000
d35df41eac69 Initial revision
kono
parents:
diff changeset
664
d35df41eac69 Initial revision
kono
parents:
diff changeset
665 main の変数を書き潰すのと、gotgo (*reg)(123) での値は、
d35df41eac69 Initial revision
kono
parents:
diff changeset
666 register 渡しで、current register にのらないので、
d35df41eac69 Initial revision
kono
parents:
diff changeset
667 結局、return label は専用に作る必要がある。
d35df41eac69 Initial revision
kono
parents:
diff changeset
668
d35df41eac69 Initial revision
kono
parents:
diff changeset
669 Tue Jan 4 18:14:07 JST 2000
d35df41eac69 Initial revision
kono
parents:
diff changeset
670
d35df41eac69 Initial revision
kono
parents:
diff changeset
671 stack を継ぎ足して、呼び出す方式を取れば、call by value
d35df41eac69 Initial revision
kono
parents:
diff changeset
672 のregister 渡しを制限する必要は無くなる。
d35df41eac69 Initial revision
kono
parents:
diff changeset
673
d35df41eac69 Initial revision
kono
parents:
diff changeset
674 複数の値を返すことも容易だ。
d35df41eac69 Initial revision
kono
parents:
diff changeset
675
d35df41eac69 Initial revision
kono
parents:
diff changeset
676 .file "tmp.c"
d35df41eac69 Initial revision
kono
parents:
diff changeset
677 .version "01.01"
d35df41eac69 Initial revision
kono
parents:
diff changeset
678 gcc2_compiled.:
d35df41eac69 Initial revision
kono
parents:
diff changeset
679 .text
d35df41eac69 Initial revision
kono
parents:
diff changeset
680 #
d35df41eac69 Initial revision
kono
parents:
diff changeset
681 # code name(a,b,c,d,e,f)
d35df41eac69 Initial revision
kono
parents:
diff changeset
682 .align 2
d35df41eac69 Initial revision
kono
parents:
diff changeset
683 .globl code
d35df41eac69 Initial revision
kono
parents:
diff changeset
684 code:
d35df41eac69 Initial revision
kono
parents:
diff changeset
685 .type code,@function
d35df41eac69 Initial revision
kono
parents:
diff changeset
686 # struct arg *a,*b,*c,*d,*e,*f;
d35df41eac69 Initial revision
kono
parents:
diff changeset
687 # {
d35df41eac69 Initial revision
kono
parents:
diff changeset
688 # int g;
d35df41eac69 Initial revision
kono
parents:
diff changeset
689 # goto name(a,b,d,e,f);
d35df41eac69 Initial revision
kono
parents:
diff changeset
690 jmp name
d35df41eac69 Initial revision
kono
parents:
diff changeset
691 _5:
d35df41eac69 Initial revision
kono
parents:
diff changeset
692 .size code,_5-code
d35df41eac69 Initial revision
kono
parents:
diff changeset
693 .ident "Micro-C compiled"
d35df41eac69 Initial revision
kono
parents:
diff changeset
694
d35df41eac69 Initial revision
kono
parents:
diff changeset
695 おお?!
d35df41eac69 Initial revision
kono
parents:
diff changeset
696 %esp new %esp = old %esp - 12 -4
d35df41eac69 Initial revision
kono
parents:
diff changeset
697 %ebp-4 = g
d35df41eac69 Initial revision
kono
parents:
diff changeset
698 %esi = a
d35df41eac69 Initial revision
kono
parents:
diff changeset
699 %edi = b
d35df41eac69 Initial revision
kono
parents:
diff changeset
700 %ebp = old %esp 0
d35df41eac69 Initial revision
kono
parents:
diff changeset
701 %ebp+4 = c code_arg_offset=0
d35df41eac69 Initial revision
kono
parents:
diff changeset
702 %ebp+8 = d
d35df41eac69 Initial revision
kono
parents:
diff changeset
703 %ebp+12 = e
d35df41eac69 Initial revision
kono
parents:
diff changeset
704 %ebp+16 = f
d35df41eac69 Initial revision
kono
parents:
diff changeset
705
d35df41eac69 Initial revision
kono
parents:
diff changeset
706 interface は付けよう! というか、
d35df41eac69 Initial revision
kono
parents:
diff changeset
707 goto name(struct {xxxx})
d35df41eac69 Initial revision
kono
parents:
diff changeset
708 みたいな感じで良いわけね。どれをregisterにいれるかと言う問題はあるが。
d35df41eac69 Initial revision
kono
parents:
diff changeset
709
d35df41eac69 Initial revision
kono
parents:
diff changeset
710 で、どうやってcallすればいいわけ? emit_pushするかわりにpush
d35df41eac69 Initial revision
kono
parents:
diff changeset
711 する?
d35df41eac69 Initial revision
kono
parents:
diff changeset
712
d35df41eac69 Initial revision
kono
parents:
diff changeset
713 うう、これでは、だめか。code argument の数が変わると、
d35df41eac69 Initial revision
kono
parents:
diff changeset
714 ebp をいちいち動かすことになる。そこにはold sp があるから
d35df41eac69 Initial revision
kono
parents:
diff changeset
715 そいつもコピーする必要がある。
d35df41eac69 Initial revision
kono
parents:
diff changeset
716
d35df41eac69 Initial revision
kono
parents:
diff changeset
717 %esp new %esp = old %esp - 20
d35df41eac69 Initial revision
kono
parents:
diff changeset
718 %ebp-20 = g
d35df41eac69 Initial revision
kono
parents:
diff changeset
719 %esi = a
d35df41eac69 Initial revision
kono
parents:
diff changeset
720 %edi = b
d35df41eac69 Initial revision
kono
parents:
diff changeset
721 %ebp-16 = c code_arg_offset= -16 ((nargs-max_reg)*int_size)
d35df41eac69 Initial revision
kono
parents:
diff changeset
722 %ebp-12 = d
d35df41eac69 Initial revision
kono
parents:
diff changeset
723 %ebp-8 = e
d35df41eac69 Initial revision
kono
parents:
diff changeset
724 %ebp-4 = f
d35df41eac69 Initial revision
kono
parents:
diff changeset
725 %ebp = old %esp 0
d35df41eac69 Initial revision
kono
parents:
diff changeset
726
d35df41eac69 Initial revision
kono
parents:
diff changeset
727 そうか、function からcallする時には、local 変数を書き潰して良い。
d35df41eac69 Initial revision
kono
parents:
diff changeset
728
d35df41eac69 Initial revision
kono
parents:
diff changeset
729 # goto name(a,b,d,e,f);
d35df41eac69 Initial revision
kono
parents:
diff changeset
730
d35df41eac69 Initial revision
kono
parents:
diff changeset
731 %esp new %esp = old %esp - 20
d35df41eac69 Initial revision
kono
parents:
diff changeset
732 %ebp-20 = g
d35df41eac69 Initial revision
kono
parents:
diff changeset
733 %esi = a
d35df41eac69 Initial revision
kono
parents:
diff changeset
734 %edi = b
d35df41eac69 Initial revision
kono
parents:
diff changeset
735 %ebp-16 = c code_arg_offset= -16 ((nargs-max_reg)*int_size)
d35df41eac69 Initial revision
kono
parents:
diff changeset
736 %ebp-12 = d
d35df41eac69 Initial revision
kono
parents:
diff changeset
737 %ebp-8 = e
d35df41eac69 Initial revision
kono
parents:
diff changeset
738 %ebp-4 = f
d35df41eac69 Initial revision
kono
parents:
diff changeset
739 %ebp = old %esp 0 disp=0 (*)
d35df41eac69 Initial revision
kono
parents:
diff changeset
740 local1 <----16 local variable
d35df41eac69 Initial revision
kono
parents:
diff changeset
741 %edx -12 <- disp_offset
d35df41eac69 Initial revision
kono
parents:
diff changeset
742 %ecx -8
d35df41eac69 Initial revision
kono
parents:
diff changeset
743 %ebx -4
d35df41eac69 Initial revision
kono
parents:
diff changeset
744 %ebp = %esp 0
d35df41eac69 Initial revision
kono
parents:
diff changeset
745 %eip 4 <- arg_offset
d35df41eac69 Initial revision
kono
parents:
diff changeset
746
d35df41eac69 Initial revision
kono
parents:
diff changeset
747 となる。ということは、pushl %ebp は、間違い。
d35df41eac69 Initial revision
kono
parents:
diff changeset
748
d35df41eac69 Initial revision
kono
parents:
diff changeset
749 だけど、%ebp をそのまま使うのは良くない。disp_offset がかかっているから。
d35df41eac69 Initial revision
kono
parents:
diff changeset
750 だから、もう一度 pushl %ebp したほうがよい。しかし、push する先は、
d35df41eac69 Initial revision
kono
parents:
diff changeset
751 上の、(*)。
d35df41eac69 Initial revision
kono
parents:
diff changeset
752 leave movl %ebp,%esp
d35df41eac69 Initial revision
kono
parents:
diff changeset
753 popl %ebp
d35df41eac69 Initial revision
kono
parents:
diff changeset
754 じゃなかったか?
d35df41eac69 Initial revision
kono
parents:
diff changeset
755
d35df41eac69 Initial revision
kono
parents:
diff changeset
756 Thu Jan 6 13:00:33 JST 2000
d35df41eac69 Initial revision
kono
parents:
diff changeset
757
d35df41eac69 Initial revision
kono
parents:
diff changeset
758 できたね。これでとりあえず動くはず。速度は問題だが...
d35df41eac69 Initial revision
kono
parents:
diff changeset
759 あとは、
d35df41eac69 Initial revision
kono
parents:
diff changeset
760 ANSI-C prototype
d35df41eac69 Initial revision
kono
parents:
diff changeset
761 ANSI-C prototype check
d35df41eac69 Initial revision
kono
parents:
diff changeset
762 Interface Definietion
d35df41eac69 Initial revision
kono
parents:
diff changeset
763 GC support
d35df41eac69 Initial revision
kono
parents:
diff changeset
764 Direct handling of Frame
d35df41eac69 Initial revision
kono
parents:
diff changeset
765 だね。簡単に出来そう? たぶん...
d35df41eac69 Initial revision
kono
parents:
diff changeset
766
d35df41eac69 Initial revision
kono
parents:
diff changeset
767 Fri Jan 7 09:42:53 JST 2000
d35df41eac69 Initial revision
kono
parents:
diff changeset
768
d35df41eac69 Initial revision
kono
parents:
diff changeset
769 goto 文が動いてなかった。あと peep hole optimization version も
d35df41eac69 Initial revision
kono
parents:
diff changeset
770 作るか?
d35df41eac69 Initial revision
kono
parents:
diff changeset
771
d35df41eac69 Initial revision
kono
parents:
diff changeset
772 continuation として label を送れるようにするべきか?
d35df41eac69 Initial revision
kono
parents:
diff changeset
773 そうすると便利なんだけど、ちょっと、汚いプログラムが
d35df41eac69 Initial revision
kono
parents:
diff changeset
774 出来るようになる。あと、送り側の環境(frame)を維持する
d35df41eac69 Initial revision
kono
parents:
diff changeset
775 必要がある。ま、できなくはないか...
d35df41eac69 Initial revision
kono
parents:
diff changeset
776
d35df41eac69 Initial revision
kono
parents:
diff changeset
777 そうすると、label が値を持つようになる。
d35df41eac69 Initial revision
kono
parents:
diff changeset
778 a = label:;
d35df41eac69 Initial revision
kono
parents:
diff changeset
779 とか。うーん。label:(a,b,c) {}; みたいな形で、parallel 代入を許すと言う
d35df41eac69 Initial revision
kono
parents:
diff changeset
780 手もあるね。
d35df41eac69 Initial revision
kono
parents:
diff changeset
781
d35df41eac69 Initial revision
kono
parents:
diff changeset
782 こちらの方がCとの相性は良いが... main() { label:(){ ... } }
d35df41eac69 Initial revision
kono
parents:
diff changeset
783 みたいなnestを許すかどうかと言う問題がある。
d35df41eac69 Initial revision
kono
parents:
diff changeset
784 変数の参照を許さなければ、特に問題はない。
d35df41eac69 Initial revision
kono
parents:
diff changeset
785
d35df41eac69 Initial revision
kono
parents:
diff changeset
786 a = label: は、二重の意味があるなぁ。
d35df41eac69 Initial revision
kono
parents:
diff changeset
787
d35df41eac69 Initial revision
kono
parents:
diff changeset
788 言語の名前。DinnerBell II とか? join も入れる?
d35df41eac69 Initial revision
kono
parents:
diff changeset
789 code entry_a().entry_b() {}
d35df41eac69 Initial revision
kono
parents:
diff changeset
790 ですか? parallel call も?
d35df41eac69 Initial revision
kono
parents:
diff changeset
791
d35df41eac69 Initial revision
kono
parents:
diff changeset
792 Fri Jan 7 19:53:53 JST 2000
d35df41eac69 Initial revision
kono
parents:
diff changeset
793
d35df41eac69 Initial revision
kono
parents:
diff changeset
794 いまのままだと return が環境を持ってないから、大域脱出できない。
d35df41eac69 Initial revision
kono
parents:
diff changeset
795 まぁ、環境を入れてもいいんだけど、どこに置くかと言う問題が
d35df41eac69 Initial revision
kono
parents:
diff changeset
796 あるね。
d35df41eac69 Initial revision
kono
parents:
diff changeset
797
d35df41eac69 Initial revision
kono
parents:
diff changeset
798 そうじゃなくて、return 側で判断するか?
d35df41eac69 Initial revision
kono
parents:
diff changeset
799 retrun(ID)
d35df41eac69 Initial revision
kono
parents:
diff changeset
800 みたいな形でIDで判断する。そうすれば、return 側でID
d35df41eac69 Initial revision
kono
parents:
diff changeset
801 を見て判断できる。けど...
d35df41eac69 Initial revision
kono
parents:
diff changeset
802
d35df41eac69 Initial revision
kono
parents:
diff changeset
803 まぁ、はやり、環境を持って歩く方がいいかなぁ。でも、
d35df41eac69 Initial revision
kono
parents:
diff changeset
804 引き渡しているから、二つ引き渡して、片方を使われたときに、
d35df41eac69 Initial revision
kono
parents:
diff changeset
805 反対側が消えてしまうのはいたいよね。今のままならば、
d35df41eac69 Initial revision
kono
parents:
diff changeset
806 そういうことは起こらない。
d35df41eac69 Initial revision
kono
parents:
diff changeset
807
d35df41eac69 Initial revision
kono
parents:
diff changeset
808 continuation 特有の問題を避けるなら、このままでもいいんだが...
d35df41eac69 Initial revision
kono
parents:
diff changeset
809 contrinuation や環境は、このシステムでは自分で作ることが
d35df41eac69 Initial revision
kono
parents:
diff changeset
810 できるからね。
d35df41eac69 Initial revision
kono
parents:
diff changeset
811
d35df41eac69 Initial revision
kono
parents:
diff changeset
812 そうなんだけど.... retlabel や retcont は実はオブジェクト
d35df41eac69 Initial revision
kono
parents:
diff changeset
813 全体に一つあれば良い。
d35df41eac69 Initial revision
kono
parents:
diff changeset
814
d35df41eac69 Initial revision
kono
parents:
diff changeset
815 引数を渡すときに、そこに環境へのポインタをいれてやれば良いので、
d35df41eac69 Initial revision
kono
parents:
diff changeset
816 解決は割と簡単だが、そうすると、例の構造体を引数で渡すと言う
d35df41eac69 Initial revision
kono
parents:
diff changeset
817 問題を解決する必要がある。
d35df41eac69 Initial revision
kono
parents:
diff changeset
818
d35df41eac69 Initial revision
kono
parents:
diff changeset
819 でも、今の実装ならば、まったく同じ変数の構成ならばコピーは
d35df41eac69 Initial revision
kono
parents:
diff changeset
820 実際には起こらないわけだから問題ないはず。特に、それを保証するために、
d35df41eac69 Initial revision
kono
parents:
diff changeset
821 interface を実装する必要がある。
d35df41eac69 Initial revision
kono
parents:
diff changeset
822
d35df41eac69 Initial revision
kono
parents:
diff changeset
823 return ->
d35df41eac69 Initial revision
kono
parents:
diff changeset
824 (void *)old bp
d35df41eac69 Initial revision
kono
parents:
diff changeset
825 return address
d35df41eac69 Initial revision
kono
parents:
diff changeset
826
d35df41eac69 Initial revision
kono
parents:
diff changeset
827 bp を直接操作できるようにするといいんだけど....
d35df41eac69 Initial revision
kono
parents:
diff changeset
828
d35df41eac69 Initial revision
kono
parents:
diff changeset
829 Sat Jan 8 08:49:59 JST 2000
d35df41eac69 Initial revision
kono
parents:
diff changeset
830
d35df41eac69 Initial revision
kono
parents:
diff changeset
831 今は、code 内ではreturnできないわけだけど。実は、return って、
d35df41eac69 Initial revision
kono
parents:
diff changeset
832 code return0(i) int i; { return(i); }
d35df41eac69 Initial revision
kono
parents:
diff changeset
833 か? 今は禁止してないから書けちゃうよね。どういうcodeが出るんだろう?
d35df41eac69 Initial revision
kono
parents:
diff changeset
834
d35df41eac69 Initial revision
kono
parents:
diff changeset
835 doreturn() では retpending をセットしているだけだから、control=1
d35df41eac69 Initial revision
kono
parents:
diff changeset
836 のまま。で、code の終りにくるのでエラーになる。checkret は、
d35df41eac69 Initial revision
kono
parents:
diff changeset
837 statement の引数で判断するようにしたほうが合理的だろう。
d35df41eac69 Initial revision
kono
parents:
diff changeset
838
d35df41eac69 Initial revision
kono
parents:
diff changeset
839 大域脱出は結構根が深いよね。途中をスキップされてうれしいか?
d35df41eac69 Initial revision
kono
parents:
diff changeset
840 destructor と同じで、途中のcodeは全部呼びたいのが普通だろう。
d35df41eac69 Initial revision
kono
parents:
diff changeset
841
d35df41eac69 Initial revision
kono
parents:
diff changeset
842 bp が同じになるまで return すれば良いわけだよね。
d35df41eac69 Initial revision
kono
parents:
diff changeset
843 return と同じで、明示的に環境を引き渡すようにするか。
d35df41eac69 Initial revision
kono
parents:
diff changeset
844 type は void * で良い?
d35df41eac69 Initial revision
kono
parents:
diff changeset
845
d35df41eac69 Initial revision
kono
parents:
diff changeset
846 return する時にstackの上限を越えているかどうかを自分でチェックする
d35df41eac69 Initial revision
kono
parents:
diff changeset
847 必要があるね。誰にreturnするかをcodeで明示すれば良いわけだけど。
d35df41eac69 Initial revision
kono
parents:
diff changeset
848
d35df41eac69 Initial revision
kono
parents:
diff changeset
849 code return0(i) int i; { return(i); }
d35df41eac69 Initial revision
kono
parents:
diff changeset
850
d35df41eac69 Initial revision
kono
parents:
diff changeset
851 を許して、そこで、frame pointer を大域あるいは渡した引数と
d35df41eac69 Initial revision
kono
parents:
diff changeset
852 比較して処理する?
d35df41eac69 Initial revision
kono
parents:
diff changeset
853 code return0(i,env) int i; env *env; {
d35df41eac69 Initial revision
kono
parents:
diff changeset
854 if (env==self) return(i);
d35df41eac69 Initial revision
kono
parents:
diff changeset
855 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
856 あれ? これはおかしいよね。
d35df41eac69 Initial revision
kono
parents:
diff changeset
857 code return0(i,env) int i; env *env; {
d35df41eac69 Initial revision
kono
parents:
diff changeset
858 if (env!=self) {
d35df41eac69 Initial revision
kono
parents:
diff changeset
859 env->return();
d35df41eac69 Initial revision
kono
parents:
diff changeset
860 return(i);
d35df41eac69 Initial revision
kono
parents:
diff changeset
861 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
862 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
863 も、なんか変だよなぁ。呼び出しと逆順に帰りたいわけだが...
d35df41eac69 Initial revision
kono
parents:
diff changeset
864 実際、逆順には帰っているわけだよね。
d35df41eac69 Initial revision
kono
parents:
diff changeset
865
d35df41eac69 Initial revision
kono
parents:
diff changeset
866 return の中でこそこそ比較するという技もあるけど。
d35df41eac69 Initial revision
kono
parents:
diff changeset
867
d35df41eac69 Initial revision
kono
parents:
diff changeset
868 問題は、destructor に渡す情報だよね。もちろん、self で良いわけだが、
d35df41eac69 Initial revision
kono
parents:
diff changeset
869 このあたりは、言語外の問題で、それを明示的にしたいから、この言語を
d35df41eac69 Initial revision
kono
parents:
diff changeset
870 作っているわけなのだから、これを内部で処理するのはおかしい。
d35df41eac69 Initial revision
kono
parents:
diff changeset
871
d35df41eac69 Initial revision
kono
parents:
diff changeset
872 code return0(i) int i; { return(i); }
d35df41eac69 Initial revision
kono
parents:
diff changeset
873
d35df41eac69 Initial revision
kono
parents:
diff changeset
874 これだと、return の型が合わないと言う問題が生じるな。簡単には
d35df41eac69 Initial revision
kono
parents:
diff changeset
875 チェックできない。
d35df41eac69 Initial revision
kono
parents:
diff changeset
876 int
d35df41eac69 Initial revision
kono
parents:
diff changeset
877 main() {
d35df41eac69 Initial revision
kono
parents:
diff changeset
878 code a() {
d35df41eac69 Initial revision
kono
parents:
diff changeset
879 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
880 code b() {
d35df41eac69 Initial revision
kono
parents:
diff changeset
881 return(i);
d35df41eac69 Initial revision
kono
parents:
diff changeset
882 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
883 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
884 にすれば、check はできるようになる。でも、これだと、
d35df41eac69 Initial revision
kono
parents:
diff changeset
885 int
d35df41eac69 Initial revision
kono
parents:
diff changeset
886 main() {
d35df41eac69 Initial revision
kono
parents:
diff changeset
887 a: {
d35df41eac69 Initial revision
kono
parents:
diff changeset
888 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
889 b: {
d35df41eac69 Initial revision
kono
parents:
diff changeset
890 return(i);
d35df41eac69 Initial revision
kono
parents:
diff changeset
891 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
892 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
893 と差がない。module 化を言語外でやるというのが主旨なのだから、これでは
d35df41eac69 Initial revision
kono
parents:
diff changeset
894 まずい。これは高級アセンブラなのだから。
d35df41eac69 Initial revision
kono
parents:
diff changeset
895
d35df41eac69 Initial revision
kono
parents:
diff changeset
896 あそうか、return と、大域脱出時のabortとは、状況が違う。だから、
d35df41eac69 Initial revision
kono
parents:
diff changeset
897 別なcode を呼び出さないとだめ。あるいは、値で区別するか。これは、
d35df41eac69 Initial revision
kono
parents:
diff changeset
898 logic programming のfail/success と似ている。
d35df41eac69 Initial revision
kono
parents:
diff changeset
899 main() { } abort { ... }
d35df41eac69 Initial revision
kono
parents:
diff changeset
900 でもいいけど?
d35df41eac69 Initial revision
kono
parents:
diff changeset
901 main() { code abort { ... }; code return { ... }}
d35df41eac69 Initial revision
kono
parents:
diff changeset
902 かな?
d35df41eac69 Initial revision
kono
parents:
diff changeset
903
d35df41eac69 Initial revision
kono
parents:
diff changeset
904 本来、subroutine call自体が、かなりの省略形なわけだから、これは
d35df41eac69 Initial revision
kono
parents:
diff changeset
905 仕方がない。今のままで通常のsubroutine callをシミュレートできるのか?
d35df41eac69 Initial revision
kono
parents:
diff changeset
906 code (struct arg {...},void *sp) {
d35df41eac69 Initial revision
kono
parents:
diff changeset
907 struct env;
d35df41eac69 Initial revision
kono
parents:
diff changeset
908 push(sp,arg);
d35df41eac69 Initial revision
kono
parents:
diff changeset
909 push(env,arg);
d35df41eac69 Initial revision
kono
parents:
diff changeset
910 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
911 できるけど、ちょっと重い。やはり、frame pointer を直接操作しないと
d35df41eac69 Initial revision
kono
parents:
diff changeset
912 だめ。
d35df41eac69 Initial revision
kono
parents:
diff changeset
913
d35df41eac69 Initial revision
kono
parents:
diff changeset
914 goto 文のほうに、env を一緒に送るものを作ったほうがいいのかも。
d35df41eac69 Initial revision
kono
parents:
diff changeset
915 goto (*ret)(),environment;
d35df41eac69 Initial revision
kono
parents:
diff changeset
916 かな。type は? (void *)?
d35df41eac69 Initial revision
kono
parents:
diff changeset
917 goto ret(),environment;
d35df41eac69 Initial revision
kono
parents:
diff changeset
918 にはならないの? そうすれば、自分でthreadを制御できる。environment
d35df41eac69 Initial revision
kono
parents:
diff changeset
919 の正当性を評価しなくて良いの? まぁ、ねぇ。
d35df41eac69 Initial revision
kono
parents:
diff changeset
920
d35df41eac69 Initial revision
kono
parents:
diff changeset
921 これは実装は容易だが... goto といちいち書くのが本当にいいのか?
d35df41eac69 Initial revision
kono
parents:
diff changeset
922 env に対するoperationがあった方がいいなぁ。push とか?
d35df41eac69 Initial revision
kono
parents:
diff changeset
923
d35df41eac69 Initial revision
kono
parents:
diff changeset
924 code return0(i) int i; { return(i); }
d35df41eac69 Initial revision
kono
parents:
diff changeset
925
d35df41eac69 Initial revision
kono
parents:
diff changeset
926 を認めれば、return 擬変数はいらなくなる。
d35df41eac69 Initial revision
kono
parents:
diff changeset
927
d35df41eac69 Initial revision
kono
parents:
diff changeset
928 でも、実は、return は、caller の引数の数と一致してないといけない
d35df41eac69 Initial revision
kono
parents:
diff changeset
929 わけだから、 code return0(i) int i; { return(i); } はだめ。env
d35df41eac69 Initial revision
kono
parents:
diff changeset
930 と一致してないといけない。ということは分離するとまずいんじゃない?
d35df41eac69 Initial revision
kono
parents:
diff changeset
931 あれ? そんなはずないな。
d35df41eac69 Initial revision
kono
parents:
diff changeset
932
d35df41eac69 Initial revision
kono
parents:
diff changeset
933 Sun Jan 9 01:15:56 JST 2000
d35df41eac69 Initial revision
kono
parents:
diff changeset
934
d35df41eac69 Initial revision
kono
parents:
diff changeset
935 やはり、分離してはまずい。もともと、
d35df41eac69 Initial revision
kono
parents:
diff changeset
936 goto func(arg);
d35df41eac69 Initial revision
kono
parents:
diff changeset
937 自体が、
d35df41eac69 Initial revision
kono
parents:
diff changeset
938 goto func(arg) with current.env
d35df41eac69 Initial revision
kono
parents:
diff changeset
939 みたいなものだ。つまり、これは、DinnerBell の、
d35df41eac69 Initial revision
kono
parents:
diff changeset
940 self message: arg
d35df41eac69 Initial revision
kono
parents:
diff changeset
941 と同じ。self->func(arg); でも良い。が、function callと区別が付かないのは
d35df41eac69 Initial revision
kono
parents:
diff changeset
942 良くない。
d35df41eac69 Initial revision
kono
parents:
diff changeset
943
d35df41eac69 Initial revision
kono
parents:
diff changeset
944 そうすると、type code はsize int でなくなる。
d35df41eac69 Initial revision
kono
parents:
diff changeset
945 code *p = func;
d35df41eac69 Initial revision
kono
parents:
diff changeset
946 ではいけなくて、
d35df41eac69 Initial revision
kono
parents:
diff changeset
947 code p = {func,env};
d35df41eac69 Initial revision
kono
parents:
diff changeset
948 でないといけない。実際、
d35df41eac69 Initial revision
kono
parents:
diff changeset
949 goto func(arg)
d35df41eac69 Initial revision
kono
parents:
diff changeset
950 では、current environment を pushl %ebp でstack = current env
d35df41eac69 Initial revision
kono
parents:
diff changeset
951 に積んでいるわけだから。
d35df41eac69 Initial revision
kono
parents:
diff changeset
952
d35df41eac69 Initial revision
kono
parents:
diff changeset
953 いずれにせよ、
d35df41eac69 Initial revision
kono
parents:
diff changeset
954 struct p = q;
d35df41eac69 Initial revision
kono
parents:
diff changeset
955 は実装する必要がある。localな、
d35df41eac69 Initial revision
kono
parents:
diff changeset
956 code p = {func,env};
d35df41eac69 Initial revision
kono
parents:
diff changeset
957 も動くはずだが...
d35df41eac69 Initial revision
kono
parents:
diff changeset
958
d35df41eac69 Initial revision
kono
parents:
diff changeset
959 code (*p)();
d35df41eac69 Initial revision
kono
parents:
diff changeset
960 goto (*p)(arg);
d35df41eac69 Initial revision
kono
parents:
diff changeset
961
d35df41eac69 Initial revision
kono
parents:
diff changeset
962 はだから少しおかしい。これは、goto がenv を補っていると考えるべき。
d35df41eac69 Initial revision
kono
parents:
diff changeset
963
d35df41eac69 Initial revision
kono
parents:
diff changeset
964 このようにすると、常に、
d35df41eac69 Initial revision
kono
parents:
diff changeset
965 func,env
d35df41eac69 Initial revision
kono
parents:
diff changeset
966 の組をcodeとみなすことになる。これは、object と呼ぶべきだ。
d35df41eac69 Initial revision
kono
parents:
diff changeset
967 ただ、既存のobjectとは別だよな。actor の方が良い?
d35df41eac69 Initial revision
kono
parents:
diff changeset
968
d35df41eac69 Initial revision
kono
parents:
diff changeset
969 うーん、これでjoinを入れれば、完璧なDinnerBellだな。並列送信はないけど。
d35df41eac69 Initial revision
kono
parents:
diff changeset
970
d35df41eac69 Initial revision
kono
parents:
diff changeset
971 Sun Jan 9 01:40:05 JST 2000
d35df41eac69 Initial revision
kono
parents:
diff changeset
972
d35df41eac69 Initial revision
kono
parents:
diff changeset
973 local 変数の初期化はallocation の後に遅らせる必要がある。
d35df41eac69 Initial revision
kono
parents:
diff changeset
974 nptr に入れられるはずだよね? nptr に初期化フラグを足すか?
d35df41eac69 Initial revision
kono
parents:
diff changeset
975
d35df41eac69 Initial revision
kono
parents:
diff changeset
976 文途中で出現するlocal変数の初期化。ちゃんと動いているの?
d35df41eac69 Initial revision
kono
parents:
diff changeset
977
d35df41eac69 Initial revision
kono
parents:
diff changeset
978 構造体のcopyは、lcheck を修正すべきでない。
d35df41eac69 Initial revision
kono
parents:
diff changeset
979
d35df41eac69 Initial revision
kono
parents:
diff changeset
980 Sun Jan 9 08:49:43 JST 2000
d35df41eac69 Initial revision
kono
parents:
diff changeset
981
d35df41eac69 Initial revision
kono
parents:
diff changeset
982 うーん、なんか修正が多いなぁ。あと、関数呼び出し、goto 文の
d35df41eac69 Initial revision
kono
parents:
diff changeset
983 構造体への対応か。
d35df41eac69 Initial revision
kono
parents:
diff changeset
984
d35df41eac69 Initial revision
kono
parents:
diff changeset
985 goto (*code)();
d35df41eac69 Initial revision
kono
parents:
diff changeset
986
d35df41eac69 Initial revision
kono
parents:
diff changeset
987 が、self env を使うのか、code の先の値を使うのかを区別する
d35df41eac69 Initial revision
kono
parents:
diff changeset
988 必要がある。もし*を使わないとするとlabel(FNAME)との区別が
d35df41eac69 Initial revision
kono
parents:
diff changeset
989 つかないぞ。あ、でも、環境を持ち歩くことにしたから、label
d35df41eac69 Initial revision
kono
parents:
diff changeset
990 へもjumpしようと思えばできるね。
d35df41eac69 Initial revision
kono
parents:
diff changeset
991
d35df41eac69 Initial revision
kono
parents:
diff changeset
992 並列送信はなくても、この構成ならばstatement単位の並列性を検出するのは
d35df41eac69 Initial revision
kono
parents:
diff changeset
993 容易だろう。
d35df41eac69 Initial revision
kono
parents:
diff changeset
994
d35df41eac69 Initial revision
kono
parents:
diff changeset
995 やればできるけど、この修正の量だと1日じゃ終らないかなぁ。
d35df41eac69 Initial revision
kono
parents:
diff changeset
996 不動小数点も入れるのでしょう?
d35df41eac69 Initial revision
kono
parents:
diff changeset
997
d35df41eac69 Initial revision
kono
parents:
diff changeset
998 Mon Jan 10 09:00:12 JST 2000
d35df41eac69 Initial revision
kono
parents:
diff changeset
999
d35df41eac69 Initial revision
kono
parents:
diff changeset
1000 引数に構造体を許すには、必ずANSI-Cにする必要がある。難しくは
d35df41eac69 Initial revision
kono
parents:
diff changeset
1001 ないが...
d35df41eac69 Initial revision
kono
parents:
diff changeset
1002
d35df41eac69 Initial revision
kono
parents:
diff changeset
1003 goto 文には label, code, continuation の3つが来る。
d35df41eac69 Initial revision
kono
parents:
diff changeset
1004 continuation = code + env
d35df41eac69 Initial revision
kono
parents:
diff changeset
1005 | label +env
d35df41eac69 Initial revision
kono
parents:
diff changeset
1006 なのだが、code/label では、env の内容が異なる。できれば面白いが、
d35df41eac69 Initial revision
kono
parents:
diff changeset
1007 その価値はあるのか?
d35df41eac69 Initial revision
kono
parents:
diff changeset
1008
d35df41eac69 Initial revision
kono
parents:
diff changeset
1009 しかし、code , env を分離するとあまりに危険すぎる。どうせgoto
d35df41eac69 Initial revision
kono
parents:
diff changeset
1010 が危険なんだからいいか? その方が簡単。簡単なら、そっちの方法を
d35df41eac69 Initial revision
kono
parents:
diff changeset
1011 とるべきじゃない? うーん。
d35df41eac69 Initial revision
kono
parents:
diff changeset
1012
d35df41eac69 Initial revision
kono
parents:
diff changeset
1013 return の関数依存性はなくした方が良い。
d35df41eac69 Initial revision
kono
parents:
diff changeset
1014 一つにするのは、pop の問題があるので良くないが...
d35df41eac69 Initial revision
kono
parents:
diff changeset
1015
d35df41eac69 Initial revision
kono
parents:
diff changeset
1016 そうか、ret をenvを指定して戻るようにしたから、leave する必要は
d35df41eac69 Initial revision
kono
parents:
diff changeset
1017 なくなった。そして、push %ebp に相当する部分は、lea -disp(%ebp),%sp
d35df41eac69 Initial revision
kono
parents:
diff changeset
1018 で消去されている。ということは、jump のfunction依存部分はいらない
d35df41eac69 Initial revision
kono
parents:
diff changeset
1019 ということだね。
d35df41eac69 Initial revision
kono
parents:
diff changeset
1020
d35df41eac69 Initial revision
kono
parents:
diff changeset
1021 でも、汚いなぁ。read only属性をhardware supportできればなあ。
d35df41eac69 Initial revision
kono
parents:
diff changeset
1022
d35df41eac69 Initial revision
kono
parents:
diff changeset
1023 sched_yeilds() 相当を書けるかな? lock は?
d35df41eac69 Initial revision
kono
parents:
diff changeset
1024
d35df41eac69 Initial revision
kono
parents:
diff changeset
1025 一応、できたけど、やっぱり汚い。
d35df41eac69 Initial revision
kono
parents:
diff changeset
1026
d35df41eac69 Initial revision
kono
parents:
diff changeset
1027 Wed Jan 12 16:12:27 JST 2000
d35df41eac69 Initial revision
kono
parents:
diff changeset
1028
d35df41eac69 Initial revision
kono
parents:
diff changeset
1029 あは。ANSI prototype はめんどい。
d35df41eac69 Initial revision
kono
parents:
diff changeset
1030 bexpr()
d35df41eac69 Initial revision
kono
parents:
diff changeset
1031 で、関数での引数の順序と、そのあとの宣言の順序が変わることがある。
d35df41eac69 Initial revision
kono
parents:
diff changeset
1032 そうすると、うしろの方が優先されてしまう。これは、こまる。
d35df41eac69 Initial revision
kono
parents:
diff changeset
1033
d35df41eac69 Initial revision
kono
parents:
diff changeset
1034 そうか、code_arg_offset のような方法だと、ANSI style では、
d35df41eac69 Initial revision
kono
parents:
diff changeset
1035 困ってしまう。
6
bf602558130d continuation
kono
parents: 0
diff changeset
1036
bf602558130d continuation
kono
parents: 0
diff changeset
1037 Thu Jan 13 04:46:12 JST 2000
bf602558130d continuation
kono
parents: 0
diff changeset
1038
bf602558130d continuation
kono
parents: 0
diff changeset
1039 # goto name(a,b,d,e,f);
bf602558130d continuation
kono
parents: 0
diff changeset
1040 code name { int g; ...
bf602558130d continuation
kono
parents: 0
diff changeset
1041
bf602558130d continuation
kono
parents: 0
diff changeset
1042 %esp new %esp = old %esp - 20
bf602558130d continuation
kono
parents: 0
diff changeset
1043 %ebp-20 = g code's local variable
bf602558130d continuation
kono
parents: 0
diff changeset
1044 %ebp-12 = f <- new_disp
bf602558130d continuation
kono
parents: 0
diff changeset
1045 %ebp-8 = d
bf602558130d continuation
kono
parents: 0
diff changeset
1046 %ebp-4 = d
bf602558130d continuation
kono
parents: 0
diff changeset
1047 %ebp-0 = c
bf602558130d continuation
kono
parents: 0
diff changeset
1048 %edi = b
bf602558130d continuation
kono
parents: 0
diff changeset
1049 %esi = a
bf602558130d continuation
kono
parents: 0
diff changeset
1050 %ebp = old %esp 0 disp=0 new env
bf602558130d continuation
kono
parents: 0
diff changeset
1051 local1 <----16 old local variable ( to be erased )
bf602558130d continuation
kono
parents: 0
diff changeset
1052 %edx -12 <- disp_offset
bf602558130d continuation
kono
parents: 0
diff changeset
1053 %ecx -8
bf602558130d continuation
kono
parents: 0
diff changeset
1054 %ebx -4
bf602558130d continuation
kono
parents: 0
diff changeset
1055 %ebp = %esp 0 <- old env
bf602558130d continuation
kono
parents: 0
diff changeset
1056 %eip 4 <- arg_offset
bf602558130d continuation
kono
parents: 0
diff changeset
1057
bf602558130d continuation
kono
parents: 0
diff changeset
1058
bf602558130d continuation
kono
parents: 0
diff changeset
1059 Thu Jan 13 13:38:24 JST 2000
bf602558130d continuation
kono
parents: 0
diff changeset
1060
bf602558130d continuation
kono
parents: 0
diff changeset
1061 だいたいできたけど、test/tmp7.c のprintf のtype mismatch は
bf602558130d continuation
kono
parents: 0
diff changeset
1062 なんなんだろう? ASNI の副作用だろうなぁ。
7
e2c2c0fe0785 function type definition should be in global heap
kono
parents: 6
diff changeset
1063
e2c2c0fe0785 function type definition should be in global heap
kono
parents: 6
diff changeset
1064 これだと、プロセスの切替えのときには、結構な量のデータを
e2c2c0fe0785 function type definition should be in global heap
kono
parents: 6
diff changeset
1065 コピーすることになる。それでもいいんだけど...
e2c2c0fe0785 function type definition should be in global heap
kono
parents: 6
diff changeset
1066
e2c2c0fe0785 function type definition should be in global heap
kono
parents: 6
diff changeset
1067 それごと、どっかにとって置く。continuationへの参照みたいなもの
e2c2c0fe0785 function type definition should be in global heap
kono
parents: 6
diff changeset
1068 ができないかな。
e2c2c0fe0785 function type definition should be in global heap
kono
parents: 6
diff changeset
1069
e2c2c0fe0785 function type definition should be in global heap
kono
parents: 6
diff changeset
1070 コピーができれば、environment/return の組は動くわけだから、
e2c2c0fe0785 function type definition should be in global heap
kono
parents: 6
diff changeset
1071 それへの参照と切替えがあっても良いよね。
e2c2c0fe0785 function type definition should be in global heap
kono
parents: 6
diff changeset
1072
8
e714bcee688b *** empty log message ***
kono
parents: 7
diff changeset
1073 Fri Jan 14 12:03:35 JST 2000
e714bcee688b *** empty log message ***
kono
parents: 7
diff changeset
1074
e714bcee688b *** empty log message ***
kono
parents: 7
diff changeset
1075 Libretto のkeyboardが壊れた... control key が効かない...
e714bcee688b *** empty log message ***
kono
parents: 7
diff changeset
1076
e714bcee688b *** empty log message ***
kono
parents: 7
diff changeset
1077 printf の参照の問題は解決しました。list2 がlocalなheap
e714bcee688b *** empty log message ***
kono
parents: 7
diff changeset
1078 に割り当てているのがいけなかったね。
e714bcee688b *** empty log message ***
kono
parents: 7
diff changeset
1079
e714bcee688b *** empty log message ***
kono
parents: 7
diff changeset
1080 return の処理は、goto 文で処理するより、environment に
e714bcee688b *** empty log message ***
kono
parents: 7
diff changeset
1081 returnto する方が良くはないか?
e714bcee688b *** empty log message ***
kono
parents: 7
diff changeset
1082
e714bcee688b *** empty log message ***
kono
parents: 7
diff changeset
1083 environment は実は送り先でそれなりの準備が必要。
e714bcee688b *** empty log message ***
kono
parents: 7
diff changeset
1084 new-environment() みたいなlibrary があれば、thread にできる。
e714bcee688b *** empty log message ***
kono
parents: 7
diff changeset
1085
e714bcee688b *** empty log message ***
kono
parents: 7
diff changeset
1086 join は?
11
595a24e0b90e *** empty log message ***
kono
parents: 8
diff changeset
1087
595a24e0b90e *** empty log message ***
kono
parents: 8
diff changeset
1088 funcall を用意すると良いね。
16
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1089
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1090 Mon Jan 17 15:23:34 JST 2000
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1091
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1092 struct aa f1() {
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1093 return bb;
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1094 }
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1095
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1096 みたいなのは? 関数の型か代入の型を見て、crn にpointerを渡して、
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1097 あとでcopyしてから stack を畳む。
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1098
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1099 # bb=f1(aaa);
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1100 movl $bb,%eax
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1101 pushl %eax
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1102 movl $aaa,%eax
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1103 pushl %eax
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1104 call main2
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1105 popl %edx
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1106 copy %eax,%edx,$400
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1107 addl $400,%esp
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1108 # return a1;
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1109
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1110 あ、でも、それだと、local変数を返したときに困るね。leave; ret;
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1111 してはいけなくて...
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1112
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1113 あ、やっぱり、こういう場合はコピー先をmain2に引き渡しているみたいね。
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1114 void f1(struct aa *ret) {
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1115 *ret = bb ;
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1116 return;
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1117 }
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1118 と同じか。これは簡単。
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1119 f1().a[55]
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1120 みたいな場合は、局所変数に強制的に取ってしまうみたいね。それはそうだ...
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1121 が、うちの実装だとちょっと厳しいか。
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1122 leal $-sizeof(struct),%esp
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1123 pushl %esp
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1124 なんだけど、関数呼び出しの途中ではできないから....
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1125
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1126 # main(ac,av)
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1127 # int ac;
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1128 .align 2
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1129 .globl main
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1130 main:
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1131 .type main,@function
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1132 pushl %ebp
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1133 movl %esp,%ebp
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1134 pushl %ebx
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1135 pushl %ecx
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1136 pushl %edx
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1137 # char *av[];
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1138 # {
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1139 # register int i;
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1140 # register char *p;
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1141 # int j = 3;
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1142 # struct { int b; void (*c)(struct aa); } q = {3,main1},r;
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1143 #
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1144 # j = 3;
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1145 subl $20,%esp
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1146
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1147 このsublを後から指定してやればOk。
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1148
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1149 でも、それだと jump の時にずれない? ずれるか? ずれるね。うーん。
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1150 実行時にチェックしてやるのも変だし。
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1151
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1152 まぁ、それほど必要な機能ではないんだけど。
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1153
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1154 これもcontinuationを渡してやると言う手法が使えないことはないんだが...
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1155
ca0bce3b4810 struct copy
kono
parents: 11
diff changeset
1156 関数呼び出しの最初にやってやればいいか。それでできるかな?
18
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1157
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1158
51
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1159 Sun Feb 20 23:59:16 JST 2000
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1160
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1161 MIPS のcall frame
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1162
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1163 $sp = $fp
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1164 local variables
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1165 saved register (including $31 = return address)
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1166
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1167 mask は使用したレジスタのbit pattern
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1168 -4 は何?
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1169
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1170 18 .mask 0xc0000000,-4
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1171 19 .fmask 0x00000000,0
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1172 20 0000 D0FFBD27 subu $sp,$sp,48
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1173 21 0004 2C00BFAF sw $31,44($sp)
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1174 22 0008 2800BEAF sw $fp,40($sp)
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1175 23 000c 0000000C move $fp,$sp
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1176 24 0010 21F0A003 jal __main
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1177 25 0014 03000224 li $2,0x00000003 # 3
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1178 26 0018 000082AF sw $2,a
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1179 27 001c 04000224 li $2,0x00000004 # 4
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1180 28 0020 00C082AF sw $2,b
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1181 29 0024 05000224 li $2,0x00000005 # 5
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1182 30 0028 000082A3 sb $2,c
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1183 31 002c 06000224 li $2,0x00000006 # 6
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1184 32 0030 08C082A3 sb $2,d
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1185 33 $L1:
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1186 34 0034 21E8C003 move $sp,$fp # sp not trusted
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1187 here
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1188 35 0038 2C00BF8F lw $31,44($sp)
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1189 36 003c 2800BE8F lw $fp,40($sp)
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1190 37 0040 0800E003 addu $sp,$sp,48
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1191 38 0044 3000BD27 j $31
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1192 39 .end main
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1193
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1194 これと同じようにするならば、regiterの使用数を最初に調べる必要が
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1195 あるのだけど、one path compiler である micro-C では、それは
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1196 できない。したがって、enter は後ろでする方が良い。
18
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1197 Mon Jan 20 18:25:27 JST 2003
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1198
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1199 3年間さわってないのかよ。何やってんだ?
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1200
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1201 goto 文のバグをとらないといけない。
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1202
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1203 まず、関数引数の構造体の展開。これは、どうってことないはず。
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1204
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1205 goto (*code)(i+1,j,...)
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1206
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1207 まず、いじらなくてすむ変数を摘出する。
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1208
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1209 foreach arg
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1210 compare
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1211
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1212 単純演算 ( op+const , pointer , const assign ) などは、ここで検出する。
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1213 大半は、そのようになるはず。
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1214 レジスタに乗せる分があるから... それには触らないとして...
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1215
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1216 複雑なものは、前もって計算しておく。(get_register する)
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1217 スタック上かレジスタ上に作る。
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1218
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1219 残りは並列代入となる。再帰的に計算する。
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1220
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1221 えーと、大きな順にやるんだっけ? 小さな順にやるんだっけ?
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1222 code f( int a, int b, int c ) {
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1223 goto g(b,c,a);
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1224 }
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1225 みたいなやつだよね。
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1226
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1227 移動するものを一つ検出する。
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1228 そのために移動が必要なものを移動しておく(再帰)
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1229 代入する
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1230
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1231 こんなんでいいのか? ループしない? するよね。ループしたら
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1232 get_register する。
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1233
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1234 前の例だと、
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1235
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1236 g(b,c,a) のbに着目する。
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1237 bに代入するコードを出すと、a が壊れる。
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1238 a が必要かどうかを調べる。それは、引数のリストを見ればわかる。
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1239 その前に、a を移動する。a の移動先を見て、
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1240 空いていれば、移動してOk。しかし、c
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1241 なので、 c を見る。と b になるので、ループするのがわかるので、
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1242 b を get_register する。
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1243 で、c が移動できる。で、aを移動して、とっておいたbを代入。
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1244
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1245 Tue Jan 21 22:45:09 JST 2003
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1246
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1247 とりあえず、jump は複雑すぎる。もっと簡単にすることを考える。
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1248 parser 側である程度処理できない?
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1249
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1250 goto f(a+3,b(),c);
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1251
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1252 などを、
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1253
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1254 a = a+3;
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1255 b = b();
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1256 goto f(a,b,c);
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1257
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1258 程度に簡略化する。この時、f(a,b,c) は(できるだけ)、元の
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1259 関数の引数リストに近付ける。のは無理なので、単純変数
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1260 まで落す。
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1261
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1262 あまり関係ないか。一時変数はどうせいるわけだし。ってこと
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1263 みたいね。
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1264
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1265 だとすると、元のコードと、そう変わらんね。前のも、そんなに
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1266 悪くないってことか。
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1267
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1268 Wed Jan 22 14:33:12 JST 2003
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1269
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1270 やっぱり、途中で局所変数を増やしたいよね。
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1271
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1272 Fri Jan 31 20:30:36 JST 2003
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1273
df7fa8cee67b pass -Wall
kono
parents: 16
diff changeset
1274 なんか #ifdef / #if がないとだめだな。実装する?
25
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1275 しました。
23
e605560e6146 Fix breaking edx,ecx on function call
kono
parents: 18
diff changeset
1276
e605560e6146 Fix breaking edx,ecx on function call
kono
parents: 18
diff changeset
1277 Tue Feb 4 01:04:12 JST 2003
e605560e6146 Fix breaking edx,ecx on function call
kono
parents: 18
diff changeset
1278
e605560e6146 Fix breaking edx,ecx on function call
kono
parents: 18
diff changeset
1279 ## while ((*chptr++ = c = getc(filep->fcb)) != '\n') {
e605560e6146 Fix breaking edx,ecx on function call
kono
parents: 18
diff changeset
1280 _1120:
e605560e6146 Fix breaking edx,ecx on function call
kono
parents: 18
diff changeset
1281 movl $10,%eax
e605560e6146 Fix breaking edx,ecx on function call
kono
parents: 18
diff changeset
1282 movl $8,%ecx
e605560e6146 Fix breaking edx,ecx on function call
kono
parents: 18
diff changeset
1283 movl filep,%edx
e605560e6146 Fix breaking edx,ecx on function call
kono
parents: 18
diff changeset
1284 addl %ecx,%edx
e605560e6146 Fix breaking edx,ecx on function call
kono
parents: 18
diff changeset
1285 movl (%edx),%edx
e605560e6146 Fix breaking edx,ecx on function call
kono
parents: 18
diff changeset
1286 pushl %edx
e605560e6146 Fix breaking edx,ecx on function call
kono
parents: 18
diff changeset
1287 xchg %edx,%eax .... edx に$10が入る (なんでxchg?)
e605560e6146 Fix breaking edx,ecx on function call
kono
parents: 18
diff changeset
1288 call getc
e605560e6146 Fix breaking edx,ecx on function call
kono
parents: 18
diff changeset
1289 addl $4,%esp
e605560e6146 Fix breaking edx,ecx on function call
kono
parents: 18
diff changeset
1290 movl %eax,-20(%ebp) c に代入
e605560e6146 Fix breaking edx,ecx on function call
kono
parents: 18
diff changeset
1291 movl $chptr,%ecx
e605560e6146 Fix breaking edx,ecx on function call
kono
parents: 18
diff changeset
1292 pushl %ecx
e605560e6146 Fix breaking edx,ecx on function call
kono
parents: 18
diff changeset
1293 popl %ebx
e605560e6146 Fix breaking edx,ecx on function call
kono
parents: 18
diff changeset
1294 movl (%ebx),%ecx ecx にchptrの中身
e605560e6146 Fix breaking edx,ecx on function call
kono
parents: 18
diff changeset
1295 addl $1,(%ebx)
e605560e6146 Fix breaking edx,ecx on function call
kono
parents: 18
diff changeset
1296 movb %al,(%ecx)
e605560e6146 Fix breaking edx,ecx on function call
kono
parents: 18
diff changeset
1297 subl %edx,%eax eax-edx ($10)
e605560e6146 Fix breaking edx,ecx on function call
kono
parents: 18
diff changeset
1298 je _1119
e605560e6146 Fix breaking edx,ecx on function call
kono
parents: 18
diff changeset
1299
e605560e6146 Fix breaking edx,ecx on function call
kono
parents: 18
diff changeset
1300 が壊れる理由なんだけど...
e605560e6146 Fix breaking edx,ecx on function call
kono
parents: 18
diff changeset
1301
e605560e6146 Fix breaking edx,ecx on function call
kono
parents: 18
diff changeset
1302 edx,ecx が破壊されちゃうみたいね。
e605560e6146 Fix breaking edx,ecx on function call
kono
parents: 18
diff changeset
1303
e605560e6146 Fix breaking edx,ecx on function call
kono
parents: 18
diff changeset
1304 Tue Feb 4 12:17:07 JST 2003
e605560e6146 Fix breaking edx,ecx on function call
kono
parents: 18
diff changeset
1305
e605560e6146 Fix breaking edx,ecx on function call
kono
parents: 18
diff changeset
1306 ようやっと直したよ...
24
1df0bf7eb5da add esi/edi register. fix virtual register bug.
kono
parents: 23
diff changeset
1307
1df0bf7eb5da add esi/edi register. fix virtual register bug.
kono
parents: 23
diff changeset
1308 use_pointer って、なにもしなくていいんだよね? eax,ebx を避ける
1df0bf7eb5da add esi/edi register. fix virtual register bug.
kono
parents: 23
diff changeset
1309 ってことらしいけど。
25
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1310
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1311 inline/引数付き #define 欲しくない? 置き換えは、local name stack に積んじゃう。
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1312 展開は function で行う。
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1313
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1314 getch を工夫する必要はあるが。置き換えスタックが必要。
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1315
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1316
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1317 Wed Feb 5 01:16:00 JST 2003
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1318
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1319 大域で定義された struct field が大域変数と重なっていると落ちる。
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1320 そりゃそうだけど。どうするの? (直した記憶があるんだけどなぁ...)
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1321 struct 毎に field 名とoffset/type の組を持てばい良いんだよね。
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1322
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1323 なんだけど、タグ無しの構造体もあるから、型名の方に付ける必要
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1324 もある。というのは、型名のない構造体もあるから。タグ名には、
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1325 一応、リストがついている。なんかに使う必要があったんでしょう
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1326 ね。あ、めんどう。無条件にやっても大域変数名を汚すのを直すの
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1327 が難しい。
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1328
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1329 ちょっと、あれだけど、「型名.フィールド名」で登録してしまうのはどう?
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1330 型名が後で出て来るところが気まずいが...
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1331
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1332 def で登録するときに、nptrにdispを代入せずに、struct field list
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1333 (大域変数) に入れて、type の方に、field list (list3(nptr,offset,
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1334 type)) を入れれば良い。
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1335
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1336 あとは、strop の方でtypeのlistを見るようにすれば良いわけだ。
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1337
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1338 これなら、簡単に直せるはず。LUSTR/GUSTRなどの区別もなくなるし。
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1339
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1340 Wed Feb 5 02:10:14 JST 2003
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1341
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1342 浮動小数点ねぇ。完全なANSI Cにするのは大変。でも、
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1343 浮動小数点ぐらいないと。
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1344
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1345 code generation part を、さらに分割して、
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1346 複数のコード対応にしやすいようにする。
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1347 おそらく、それほど共有する部分はないけどね。
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1348
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1349 Sample C code をコンパイルして、その結果から(半分手動で)
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1350 Micro CbC code generation part を生成する方法を用意する。
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1351
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1352
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1353
26
85b8648de04f *** empty log message ***
kono
parents: 25
diff changeset
1354 Thu Feb 6 11:47:03 JST 2003
25
b7a94557bf92 *** empty log message ***
kono
parents: 24
diff changeset
1355
26
85b8648de04f *** empty log message ***
kono
parents: 25
diff changeset
1356 Code Segement を単位として使うときに、大域変数はどういう
85b8648de04f *** empty log message ***
kono
parents: 25
diff changeset
1357 ように分けるの? static なんかは意味ないよね。
85b8648de04f *** empty log message ***
kono
parents: 25
diff changeset
1358
85b8648de04f *** empty log message ***
kono
parents: 25
diff changeset
1359 もちろん、自然にグループ分けされるわけだけど。
85b8648de04f *** empty log message ***
kono
parents: 25
diff changeset
1360
85b8648de04f *** empty log message ***
kono
parents: 25
diff changeset
1361 あとデータフローだよね。データフローに関しては、
85b8648de04f *** empty log message ***
kono
parents: 25
diff changeset
1362 あんまりやってないなぁ
85b8648de04f *** empty log message ***
kono
parents: 25
diff changeset
1363
28
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1364 Fri Feb 7 14:36:15 JST 2003
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1365
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1366 inline では、必らず、局所変数の増加がある。また、inline
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1367 は普通の関数として展開しておく必要もあるらしい。(何故?)
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1368
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1369 #define ねぇ。
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1370
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1371 #define c(a,b) g(a+1,b+1)
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1372 #define g(a,b) printf("%d %d\n",a+1,b+1);
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1373
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1374 main() {
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1375 int a,b;
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1376 a =1; b = 3;
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1377 c(a,b);
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1378 }
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1379
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1380 local #define がいるんだよね。g の中で a が出て来た時には、
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1381 c のa の置き換えは起こってはいけない。ということは、c
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1382 の置き換えはg が始まる前に終っている必要がある。dynamic
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1383 scope なんだから、assoc の上乗せで良いはず。
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1384 macro のlevelを定義して、あるレベルでは、それ以前の展開
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1385 を行わないという手法が良いかな。
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1386
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1387 c(a,b) => a=>"a+1", b=>"b+1"
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1388 g(a,b) => (a=>"a+1+1",a=>"a+1"), (b=>"b+1+1",a=>"a+1")
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1389
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1390 みたいな感じ?
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1391
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1392 やっぱり関数解析でマクロ処理をやらせるのは無理かな? 先読みされちゃうし。
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1393
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1394 Sat Feb 8 00:53:52 JST 2003
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1395
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1396 macro は途中まで書きました。置き換えをマクロが呼び出された
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1397 時点で cheap に置くと、それを解消するタイミングがない。
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1398 ここだけmallocしても良いが..
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1399
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1400 chptrsave はlistにする必要がある。list で良い。
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1401
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1402 やっぱりmacro levelを見て、自分と一致したassoc valueまで
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1403 手繰って置換するんでしょう。そうすれば、置き換える必要は無い。
c6994794f084 functional macro (imcomplete)
kono
parents: 26
diff changeset
1404 ということは、local_define にmflagsを格納する必要がある。
29
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1405
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1406 c(a,b) => a=>"a", b=>"b"
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1407 a=>"a" .. mflag == 1
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1408 g(a,b) => (a=>"a+1+1",a=>"a+1"), (b=>"b+1+1",a=>"a+1")
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1409 a=>"a+1" .. mflag == 2
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1410
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1411 macro のもとのnptr が残ってないと、オリジナルを返せない。オ
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1412 リジナルは、sc などが破壊されてしまう。ってことは、local macro
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1413 は、local table を汚してはいけないってことだよね。ってことは、
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1414 macro table は、もとのとは別に用意する必要がある。
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1415
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1416 #define c(a,b) g(a+1,b+1)
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1417 #define g(a,b) printf("%d %d\n",a+2,b+2);
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1418
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1419 main() {
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1420 int a,b; a ... local
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1421 a =1; b = 3;
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1422 #ifndef a
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1423 c(a, a = "a".. macro mflag==1
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1424 g(a,
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1425 a="a+1" mflag==2
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1426 ^ a = "a" mflag==1
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1427 While replacing a in g's body, a should not
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1428 be replaced to (original) "a", should be c's a.
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1429 b);
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1430 /* 3,5 expected */
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1431 #endif
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1432 }
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1433
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1434 うーむ。ややこしい。
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1435
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1436 main()
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1437 c(a,b) mflag++
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1438 a=>"a" mflag ==1
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1439 g(a,b) mflag++;
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1440 a=>"a+1" mflag ==2
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1441 ^ is replaced by c's "a" not g's a;
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1442 いったん mflag level n で展開したら、それは mflag level n-1 となる。
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1443
30
20ed2786a276 still macro
kono
parents: 29
diff changeset
1444 Sat Feb 8 18:13:43 JST 2003
29
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1445
30
20ed2786a276 still macro
kono
parents: 29
diff changeset
1446 いちおう、mflag まではデバッグしたが.... mflag を戻してないんじゃないの?
29
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1447
31
8b87de87eb54 *** empty log message ***
kono
parents: 30
diff changeset
1448 ---c(a,b)----------------------- mflag ==1
8b87de87eb54 *** empty log message ***
kono
parents: 30
diff changeset
1449 a=>hoge, b=>hoga (mflag==1)
8b87de87eb54 *** empty log message ***
kono
parents: 30
diff changeset
1450 ----g(ac,bc)----------------- mflag ==2
8b87de87eb54 *** empty log message ***
kono
parents: 30
diff changeset
1451 ac=>goge, bc=>goga(mflag==2)
8b87de87eb54 *** empty log message ***
kono
parents: 30
diff changeset
1452 ----printf(a,b)---------- mflag ==3
8b87de87eb54 *** empty log message ***
kono
parents: 30
diff changeset
1453 a=>poge, b=>poga(mflag==3)
29
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1454
30
20ed2786a276 still macro
kono
parents: 29
diff changeset
1455 g が呼び出されると、ac,bc は mflag==1 でのみ置換される。
29
160e20394f80 macro function (imcomplete)
kono
parents: 28
diff changeset
1456
31
8b87de87eb54 *** empty log message ***
kono
parents: 30
diff changeset
1457 あるテキストを置き換えると、それは置き換えたマクロのmflag level
8b87de87eb54 *** empty log message ***
kono
parents: 30
diff changeset
1458 (つまり一つ少ないレベル)になる。
8b87de87eb54 *** empty log message ***
kono
parents: 30
diff changeset
1459 置き換え終ったら、元のlevelに戻す。
8b87de87eb54 *** empty log message ***
kono
parents: 30
diff changeset
1460
8b87de87eb54 *** empty log message ***
kono
parents: 30
diff changeset
1461 mflag==2のlevel では、mflag==2のlocal macroの展開しかしない。
8b87de87eb54 *** empty log message ***
kono
parents: 30
diff changeset
1462
8b87de87eb54 *** empty log message ***
kono
parents: 30
diff changeset
1463 置き換えると、mflag level 1 になるので、そこで mflag==1 のlocal
8b87de87eb54 *** empty log message ***
kono
parents: 30
diff changeset
1464 macro を展開する。mflag==0 は常に展開を行う。
8b87de87eb54 *** empty log message ***
kono
parents: 30
diff changeset
1465
32
b35787d8a442 macro initialization
kono
parents: 31
diff changeset
1466 Sun Feb 9 11:35:23 JST 2003
31
8b87de87eb54 *** empty log message ***
kono
parents: 30
diff changeset
1467
32
b35787d8a442 macro initialization
kono
parents: 31
diff changeset
1468 うーん、なんかtypeが、list とCHARなどと入混じっているじゃん。
b35787d8a442 macro initialization
kono
parents: 31
diff changeset
1469 int save = chptrsave;
b35787d8a442 macro initialization
kono
parents: 31
diff changeset
1470 で、chptrsave が、$chptrsave になってしまう。
33
8500dbb69dd9 bad macro processing. give up this method.
kono
parents: 32
diff changeset
1471
8500dbb69dd9 bad macro processing. give up this method.
kono
parents: 32
diff changeset
1472 Sun Feb 9 22:33:36 JST 2003
8500dbb69dd9 bad macro processing. give up this method.
kono
parents: 32
diff changeset
1473
8500dbb69dd9 bad macro processing. give up this method.
kono
parents: 32
diff changeset
1474
8500dbb69dd9 bad macro processing. give up this method.
kono
parents: 32
diff changeset
1475 #define car(e) (heap[(int)(e)])
8500dbb69dd9 bad macro processing. give up this method.
kono
parents: 32
diff changeset
1476 #define cadr(e) (heap[((int)(e))+1])
8500dbb69dd9 bad macro processing. give up this method.
kono
parents: 32
diff changeset
1477 car(cadr(e))
8500dbb69dd9 bad macro processing. give up this method.
kono
parents: 32
diff changeset
1478
8500dbb69dd9 bad macro processing. give up this method.
kono
parents: 32
diff changeset
1479 だろ。
8500dbb69dd9 bad macro processing. give up this method.
kono
parents: 32
diff changeset
1480 car ->
8500dbb69dd9 bad macro processing. give up this method.
kono
parents: 32
diff changeset
1481 #define e cadr(e) (mleve=1)
8500dbb69dd9 bad macro processing. give up this method.
kono
parents: 32
diff changeset
1482 cadr ->
8500dbb69dd9 bad macro processing. give up this method.
kono
parents: 32
diff changeset
1483 #define e e (mleve=2)
8500dbb69dd9 bad macro processing. give up this method.
kono
parents: 32
diff changeset
1484
8500dbb69dd9 bad macro processing. give up this method.
kono
parents: 32
diff changeset
1485 むぅ。これ、うまくいかないんじゃん。こまったなぁ。
8500dbb69dd9 bad macro processing. give up this method.
kono
parents: 32
diff changeset
1486
8500dbb69dd9 bad macro processing. give up this method.
kono
parents: 32
diff changeset
1487 #define c(a,b) g(a+1,b+1)
8500dbb69dd9 bad macro processing. give up this method.
kono
parents: 32
diff changeset
1488 #define g(a,b) printf("%d %d\n",a+1,b+1);
8500dbb69dd9 bad macro processing. give up this method.
kono
parents: 32
diff changeset
1489 c(a, b);
8500dbb69dd9 bad macro processing. give up this method.
kono
parents: 32
diff changeset
1490
8500dbb69dd9 bad macro processing. give up this method.
kono
parents: 32
diff changeset
1491 こっちもだめじゃん。ふーむ。lisp interpreter のように
8500dbb69dd9 bad macro processing. give up this method.
kono
parents: 32
diff changeset
1492 作ればいいはずなんだけど。
36
9f89cef85b41 *** empty log message ***
kono
parents: 33
diff changeset
1493
9f89cef85b41 *** empty log message ***
kono
parents: 33
diff changeset
1494 Mon Feb 10 08:10:25 JST 2003
9f89cef85b41 *** empty log message ***
kono
parents: 33
diff changeset
1495
9f89cef85b41 *** empty log message ***
kono
parents: 33
diff changeset
1496 結局、list base のinterpreter を実装しました。きちゃないが。
9f89cef85b41 *** empty log message ***
kono
parents: 33
diff changeset
1497 前の方法でも、頑張ればできるんでしょうけどね。
9f89cef85b41 *** empty log message ***
kono
parents: 33
diff changeset
1498
39
c63c4fdeb9a7 struct done.
kono
parents: 36
diff changeset
1499 Tue Feb 11 13:50:03 JST 2003
c63c4fdeb9a7 struct done.
kono
parents: 36
diff changeset
1500
c63c4fdeb9a7 struct done.
kono
parents: 36
diff changeset
1501 struct copy だけど... 関数がstructを返すときに、引数に前もって
c63c4fdeb9a7 struct done.
kono
parents: 36
diff changeset
1502 積んでおくのでは、そこに値がコピーされてしまうし、あとで、
c63c4fdeb9a7 struct done.
kono
parents: 36
diff changeset
1503 スタックをたたんで置くときにきまずい。
c63c4fdeb9a7 struct done.
kono
parents: 36
diff changeset
1504
c63c4fdeb9a7 struct done.
kono
parents: 36
diff changeset
1505 function call の時に、引数の型のチェックをしてない
c63c4fdeb9a7 struct done.
kono
parents: 36
diff changeset
1506
c63c4fdeb9a7 struct done.
kono
parents: 36
diff changeset
1507 type に -1 とheapの引数が混在しているやつだけど..
c63c4fdeb9a7 struct done.
kono
parents: 36
diff changeset
1508 やっぱまずいんじゃないか?
c63c4fdeb9a7 struct done.
kono
parents: 36
diff changeset
1509
c63c4fdeb9a7 struct done.
kono
parents: 36
diff changeset
1510 temproal struct は再利用できるんだけど、dispの変更ができないので
c63c4fdeb9a7 struct done.
kono
parents: 36
diff changeset
1511 新しく作るしかない。大きいときだけ新しく作るなんていうセコイ
45
b9266c88495c *** empty log message ***
kono
parents: 42
diff changeset
1512 技はあるけど。(そうすると、帰って来た値へのポインタを使えなく
b9266c88495c *** empty log message ***
kono
parents: 42
diff changeset
1513 なるが.... 別にいいよね。戻り値それ自身を直接 return する
b9266c88495c *** empty log message ***
kono
parents: 42
diff changeset
1514 時もだいじょうぶなはず)
b9266c88495c *** empty log message ***
kono
parents: 42
diff changeset
1515
b9266c88495c *** empty log message ***
kono
parents: 42
diff changeset
1516 結局、呼出側で、領域を確保して引き渡すことにしました。この方法だと、
b9266c88495c *** empty log message ***
kono
parents: 42
diff changeset
1517 代入のときに二度コピーする必要もない。
39
c63c4fdeb9a7 struct done.
kono
parents: 36
diff changeset
1518
c63c4fdeb9a7 struct done.
kono
parents: 36
diff changeset
1519 register を使用しているかだけじゃなくて、実際にcreg/dregに
c63c4fdeb9a7 struct done.
kono
parents: 36
diff changeset
1520 値があるかどうかを記憶する必要がある。
42
a89cf0d6904f regv assop
kono
parents: 39
diff changeset
1521
a89cf0d6904f regv assop
kono
parents: 39
diff changeset
1522 Wed Feb 12 11:09:22 JST 2003
a89cf0d6904f regv assop
kono
parents: 39
diff changeset
1523
a89cf0d6904f regv assop
kono
parents: 39
diff changeset
1524 それだけどさ... やっぱりアドホックに実現するのは難しいんじゃないの?
a89cf0d6904f regv assop
kono
parents: 39
diff changeset
1525
a89cf0d6904f regv assop
kono
parents: 39
diff changeset
1526 まぁねぇ。register の場所の確保と、寿命は別だから、それで
a89cf0d6904f regv assop
kono
parents: 39
diff changeset
1527 いいんだけど、regs flag だけでなんとかならないのかな。
a89cf0d6904f regv assop
kono
parents: 39
diff changeset
1528 こういう変更ははまるが虚しい。
45
b9266c88495c *** empty log message ***
kono
parents: 42
diff changeset
1529
b9266c88495c *** empty log message ***
kono
parents: 42
diff changeset
1530 Thu Feb 13 18:37:36 JST 2003
b9266c88495c *** empty log message ***
kono
parents: 42
diff changeset
1531
b9266c88495c *** empty log message ***
kono
parents: 42
diff changeset
1532 さて、そろそろ jump にとりかかりますか。
b9266c88495c *** empty log message ***
kono
parents: 42
diff changeset
1533
b9266c88495c *** empty log message ***
kono
parents: 42
diff changeset
1534 構造体の引き渡しのシークエンスに使う局所変数の位置がgccと違う...
b9266c88495c *** empty log message ***
kono
parents: 42
diff changeset
1535
b9266c88495c *** empty log message ***
kono
parents: 42
diff changeset
1536 そろそろ register は構造体にすべきだね。
b9266c88495c *** empty log message ***
kono
parents: 42
diff changeset
1537 struct register {
b9266c88495c *** empty log message ***
kono
parents: 42
diff changeset
1538 int used;
b9266c88495c *** empty log message ***
kono
parents: 42
diff changeset
1539 int valued;
b9266c88495c *** empty log message ***
kono
parents: 42
diff changeset
1540 char *name;
b9266c88495c *** empty log message ***
kono
parents: 42
diff changeset
1541 char *wname;
b9266c88495c *** empty log message ***
kono
parents: 42
diff changeset
1542 char *bname;
b9266c88495c *** empty log message ***
kono
parents: 42
diff changeset
1543 int type; /* register variable or not */
b9266c88495c *** empty log message ***
kono
parents: 42
diff changeset
1544 int number;
b9266c88495c *** empty log message ***
kono
parents: 42
diff changeset
1545 }
b9266c88495c *** empty log message ***
kono
parents: 42
diff changeset
1546 virtual/real は、どうする。
46
b1c8ac8c308d fix cascading struct retrun. Now it should be compatible with gcc
kono
parents: 45
diff changeset
1547
b1c8ac8c308d fix cascading struct retrun. Now it should be compatible with gcc
kono
parents: 45
diff changeset
1548 Sat Feb 15 14:00:03 JST 2003
b1c8ac8c308d fix cascading struct retrun. Now it should be compatible with gcc
kono
parents: 45
diff changeset
1549
b1c8ac8c308d fix cascading struct retrun. Now it should be compatible with gcc
kono
parents: 45
diff changeset
1550 fdecl_struct を構文的に引数が出現するときに行うと、int *f(int
b1c8ac8c308d fix cascading struct retrun. Now it should be compatible with gcc
kono
parents: 45
diff changeset
1551 a) などで、* の評価が終る前に、int aが評価されしまう。*obj
b1c8ac8c308d fix cascading struct retrun. Now it should be compatible with gcc
kono
parents: 45
diff changeset
1552 のobj を評価し終らないとfのタイプが確定しない。int*f()[] み
b1c8ac8c308d fix cascading struct retrun. Now it should be compatible with gcc
kono
parents: 45
diff changeset
1553 たいな場合があるから。(?) なので、gcc と、そろえるためには、
b1c8ac8c308d fix cascading struct retrun. Now it should be compatible with gcc
kono
parents: 45
diff changeset
1554 arg の先頭で fdecl_struct を行う方法ではだめで、fdecl 中であ
b1c8ac8c308d fix cascading struct retrun. Now it should be compatible with gcc
kono
parents: 45
diff changeset
1555 とから修正する方が良い。
b1c8ac8c308d fix cascading struct retrun. Now it should be compatible with gcc
kono
parents: 45
diff changeset
1556
b1c8ac8c308d fix cascading struct retrun. Now it should be compatible with gcc
kono
parents: 45
diff changeset
1557 fix しようにも引数リストなんて、存在しないじゃん!
b1c8ac8c308d fix cascading struct retrun. Now it should be compatible with gcc
kono
parents: 45
diff changeset
1558
b1c8ac8c308d fix cascading struct retrun. Now it should be compatible with gcc
kono
parents: 45
diff changeset
1559 varargs を実装するのはめんどくさかろう...
b1c8ac8c308d fix cascading struct retrun. Now it should be compatible with gcc
kono
parents: 45
diff changeset
1560
b1c8ac8c308d fix cascading struct retrun. Now it should be compatible with gcc
kono
parents: 45
diff changeset
1561 rvalue(expr(),type) では、expr() のtypeをrvalueに引き渡せな
b1c8ac8c308d fix cascading struct retrun. Now it should be compatible with gcc
kono
parents: 45
diff changeset
1562 い。でも、type を大域変数にすると、rvalueを異なるタイプで呼
b1c8ac8c308d fix cascading struct retrun. Now it should be compatible with gcc
kono
parents: 45
diff changeset
1563 び出すときにtypeを変更する必要がある。このrvalueのtype の扱
b1c8ac8c308d fix cascading struct retrun. Now it should be compatible with gcc
kono
parents: 45
diff changeset
1564 いは、かなりはまったことがあるので、rvalue(int e,int type)の
b1c8ac8c308d fix cascading struct retrun. Now it should be compatible with gcc
kono
parents: 45
diff changeset
1565 方が良いことは確かなんだが...
47
f6b5e4f1a962 *** empty log message ***
kono
parents: 46
diff changeset
1566
f6b5e4f1a962 *** empty log message ***
kono
parents: 46
diff changeset
1567 struct_push のregisterの扱いが複雑すぎ。なんか、もっと
f6b5e4f1a962 *** empty log message ***
kono
parents: 46
diff changeset
1568 簡単にならないの?
51
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1569
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1570 Sun Feb 16 07:58:23 JST 2003
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1571
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1572 代入しなくて良いからと言って、ソース
c2ef3a2fbe88 *** empty log message ***
kono
parents: 47
diff changeset
1573 のリストから除いては、上書きを防げない。
52
ddaa1aa5b49b parallel assignment done (not circular dependency)
kono
parents: 51
diff changeset
1574
ddaa1aa5b49b parallel assignment done (not circular dependency)
kono
parents: 51
diff changeset
1575 Sun Feb 16 22:55:58 JST 2003
ddaa1aa5b49b parallel assignment done (not circular dependency)
kono
parents: 51
diff changeset
1576
ddaa1aa5b49b parallel assignment done (not circular dependency)
kono
parents: 51
diff changeset
1577 vdisp ってなんだったんだ?
ddaa1aa5b49b parallel assignment done (not circular dependency)
kono
parents: 51
diff changeset
1578
ddaa1aa5b49b parallel assignment done (not circular dependency)
kono
parents: 51
diff changeset
1579 Mon Feb 17 12:35:39 JST 2003
ddaa1aa5b49b parallel assignment done (not circular dependency)
kono
parents: 51
diff changeset
1580
ddaa1aa5b49b parallel assignment done (not circular dependency)
kono
parents: 51
diff changeset
1581 並列代入は出来たみたい。代入は小さいものを先にすべきなのか?
ddaa1aa5b49b parallel assignment done (not circular dependency)
kono
parents: 51
diff changeset
1582 まぁ、できりゃいいんだけど、横に避けるものが大きいのはいや
ddaa1aa5b49b parallel assignment done (not circular dependency)
kono
parents: 51
diff changeset
1583 だよね。
53
64a4e3789fd2 parallel assign works.
kono
parents: 52
diff changeset
1584
64a4e3789fd2 parallel assign works.
kono
parents: 52
diff changeset
1585 Tue Feb 18 11:56:10 JST 2003
64a4e3789fd2 parallel assign works.
kono
parents: 52
diff changeset
1586
64a4e3789fd2 parallel assign works.
kono
parents: 52
diff changeset
1587 overraped 用の emit_copy
64a4e3789fd2 parallel assign works.
kono
parents: 52
diff changeset
1588 float/double
64a4e3789fd2 parallel assign works.
kono
parents: 52
diff changeset
1589 long long
64a4e3789fd2 parallel assign works.
kono
parents: 52
diff changeset
1590
64a4e3789fd2 parallel assign works.
kono
parents: 52
diff changeset
1591 Tue Feb 18 19:34:31 JST 2003
64a4e3789fd2 parallel assign works.
kono
parents: 52
diff changeset
1592
64a4e3789fd2 parallel assign works.
kono
parents: 52
diff changeset
1593 code argument の符号を反転させると、list2(LVAR,offset)
64a4e3789fd2 parallel assign works.
kono
parents: 52
diff changeset
1594 のoffsetがアドレスの方向と一致しているという前提が
64a4e3789fd2 parallel assign works.
kono
parents: 52
diff changeset
1595 崩れる。それで、構造体の格納順序がずれてしまう...
64a4e3789fd2 parallel assign works.
kono
parents: 52
diff changeset
1596
64a4e3789fd2 parallel assign works.
kono
parents: 52
diff changeset
1597 ということは... def(n) でcodeの時はargumentは、局所変数と同じ
64a4e3789fd2 parallel assign works.
kono
parents: 52
diff changeset
1598 扱いでマイナス符号で処理した方が良い。
64a4e3789fd2 parallel assign works.
kono
parents: 52
diff changeset
1599
64a4e3789fd2 parallel assign works.
kono
parents: 52
diff changeset
1600 できたみたい。でもさ、
64a4e3789fd2 parallel assign works.
kono
parents: 52
diff changeset
1601
64a4e3789fd2 parallel assign works.
kono
parents: 52
diff changeset
1602 int main( int ac, char *av[])
64a4e3789fd2 parallel assign works.
kono
parents: 52
diff changeset
1603 {
64a4e3789fd2 parallel assign works.
kono
parents: 52
diff changeset
1604 int n;
64a4e3789fd2 parallel assign works.
kono
parents: 52
diff changeset
1605 goto arg1(0,1,2,3,4,return,environment);
64a4e3789fd2 parallel assign works.
kono
parents: 52
diff changeset
1606 }
64a4e3789fd2 parallel assign works.
kono
parents: 52
diff changeset
1607
64a4e3789fd2 parallel assign works.
kono
parents: 52
diff changeset
1608 って、きっと return 文がないと、文句を
64a4e3789fd2 parallel assign works.
kono
parents: 52
diff changeset
1609 言われるよね。むむむ。
64a4e3789fd2 parallel assign works.
kono
parents: 52
diff changeset
1610
55
94564b45c4f3 all save implementation of parallel assignment
kono
parents: 53
diff changeset
1611 post processing する時にoverrapしてないという保証がない。
94564b45c4f3 all save implementation of parallel assignment
kono
parents: 53
diff changeset
1612
57
3d7f199e99d0 struct handling
kono
parents: 55
diff changeset
1613 Wed Feb 19 15:38:55 JST 2003
3d7f199e99d0 struct handling
kono
parents: 55
diff changeset
1614
3d7f199e99d0 struct handling
kono
parents: 55
diff changeset
1615 自分自身とのoverrrapを見てないので、
3d7f199e99d0 struct handling
kono
parents: 55
diff changeset
1616 struct a a,int i
3d7f199e99d0 struct handling
kono
parents: 55
diff changeset
1617 int i,struct a a
3d7f199e99d0 struct handling
kono
parents: 55
diff changeset
1618 みたいな時に自分自身を壊してしまう。なので、emit_copy
3d7f199e99d0 struct handling
kono
parents: 55
diff changeset
1619 が、ちゃんと方向を見て壊さないように処理する必要がある。
3d7f199e99d0 struct handling
kono
parents: 55
diff changeset
1620
59
eeca07d1b1c2 *** empty log message ***
kono
parents: 57
diff changeset
1621 call bcopy でいいじゃん。まね。
eeca07d1b1c2 *** empty log message ***
kono
parents: 57
diff changeset
1622
eeca07d1b1c2 *** empty log message ***
kono
parents: 57
diff changeset
1623 Wed Feb 19 20:42:07 JST 2003
eeca07d1b1c2 *** empty log message ***
kono
parents: 57
diff changeset
1624
eeca07d1b1c2 *** empty log message ***
kono
parents: 57
diff changeset
1625 楊さんの C2CbC と CbC2C を、micro C に取り込む。各所に、
eeca07d1b1c2 *** empty log message ***
kono
parents: 57
diff changeset
1626 conv->func(); を埋め込む。conv は、構造体。
eeca07d1b1c2 *** empty log message ***
kono
parents: 57
diff changeset
1627
eeca07d1b1c2 *** empty log message ***
kono
parents: 57
diff changeset
1628 conv: original
eeca07d1b1c2 *** empty log message ***
kono
parents: 57
diff changeset
1629 c2cbc
eeca07d1b1c2 *** empty log message ***
kono
parents: 57
diff changeset
1630 cbc2c
eeca07d1b1c2 *** empty log message ***
kono
parents: 57
diff changeset
1631
eeca07d1b1c2 *** empty log message ***
kono
parents: 57
diff changeset
1632 とする。なるほど。
245
8a72b0afccfc *** empty log message ***
kono
parents: 59
diff changeset
1633
8a72b0afccfc *** empty log message ***
kono
parents: 59
diff changeset
1634 Thu May 6 08:32:05 JST 2004
8a72b0afccfc *** empty log message ***
kono
parents: 59
diff changeset
1635
8a72b0afccfc *** empty log message ***
kono
parents: 59
diff changeset
1636 やっぱり library も自分で作らないとね。そうすれば、
8a72b0afccfc *** empty log message ***
kono
parents: 59
diff changeset
1637 CbC only で作れるから。
8a72b0afccfc *** empty log message ***
kono
parents: 59
diff changeset
1638
8a72b0afccfc *** empty log message ***
kono
parents: 59
diff changeset
1639 conv は、あんまり良いアイデアではないみたい。取るか。。。
255
8cd8d72286ae PowerPC long long complex function call fix.
kono
parents: 245
diff changeset
1640
8cd8d72286ae PowerPC long long complex function call fix.
kono
parents: 245
diff changeset
1641 Thu May 13 12:59:16 JST 2004
8cd8d72286ae PowerPC long long complex function call fix.
kono
parents: 245
diff changeset
1642
8cd8d72286ae PowerPC long long complex function call fix.
kono
parents: 245
diff changeset
1643 byte code interpreter を CbC 自身で書いたら?
8cd8d72286ae PowerPC long long complex function call fix.
kono
parents: 245
diff changeset
1644
8cd8d72286ae PowerPC long long complex function call fix.
kono
parents: 245
diff changeset
1645 それでもやっぱり動かないから、あんまり意味はないんだけど...
8cd8d72286ae PowerPC long long complex function call fix.
kono
parents: 245
diff changeset
1646
8cd8d72286ae PowerPC long long complex function call fix.
kono
parents: 245
diff changeset
1647 C で書いてもいいか。