author | Claus Gittinger <cg@exept.de> |
Fri, 27 Jun 1997 14:08:18 +0200 | |
changeset 565 | 00673e9d6edc |
parent 559 | 42cf4afd99b3 |
child 566 | 90969df02c85 |
permissions | -rw-r--r-- |
14 | 1 |
" |
2 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
53 | 3 |
All Rights Reserved |
14 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
13 |
PrimaryNode subclass:#VariableNode |
|
218
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
14 |
instanceVariableNames:'name token selfValue selfClass index block' |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
15 |
classVariableNames:'' |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
16 |
poolDictionaries:'' |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
17 |
category:'System-Compiler-Support' |
14 | 18 |
! |
19 |
||
360 | 20 |
!VariableNode class methodsFor:'documentation'! |
20 | 21 |
|
22 |
copyright |
|
23 |
" |
|
24 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
53 | 25 |
All Rights Reserved |
20 | 26 |
|
27 |
This software is furnished under a license and may be used |
|
28 |
only in accordance with the terms of that license and with the |
|
29 |
inclusion of the above copyright notice. This software may not |
|
30 |
be provided or otherwise made available to, or used by, any |
|
31 |
other person. No title to or ownership of the software is |
|
32 |
hereby transferred. |
|
33 |
" |
|
34 |
! |
|
35 |
||
36 |
documentation |
|
37 |
" |
|
38 |
node for parse-trees, representing variables |
|
261 | 39 |
This is a helper class for the compiler. |
263 | 40 |
|
41 |
[author:] |
|
42 |
Claus Gittinger |
|
20 | 43 |
" |
44 |
! ! |
|
14 | 45 |
|
360 | 46 |
!VariableNode class methodsFor:'instance creation'! |
14 | 47 |
|
98 | 48 |
type:t class:class name:n |
49 |
^ (self basicNew) type:t class:class name:n |
|
50 |
! |
|
51 |
||
14 | 52 |
type:t index:i selfValue:s |
53 |
^ (self basicNew) type:t index:i selfValue:s |
|
54 |
! |
|
55 |
||
140 | 56 |
type:t name:n |
57 |
^ (self basicNew) type:t name:n |
|
58 |
! |
|
59 |
||
60 |
type:t name:n index:i selfClass:s |
|
61 |
^ (self basicNew) type:t name:n index:i selfClass:s |
|
62 |
! |
|
63 |
||
64 |
type:t name:n index:i selfValue:s |
|
65 |
^ (self basicNew) type:t name:n index:i selfValue:s |
|
14 | 66 |
! |
67 |
||
68 |
type:t name:n token:tok index:i |
|
69 |
^ (self basicNew) type:t name:n token:tok index:i |
|
70 |
! |
|
71 |
||
140 | 72 |
type:t name:n token:tok index:i block:b |
73 |
^ (self basicNew) type:t name:n token:tok index:i block:b |
|
14 | 74 |
! |
75 |
||
140 | 76 |
type:t name:n value:val |
77 |
^ (self basicNew) type:t name:n value:val |
|
14 | 78 |
! |
79 |
||
140 | 80 |
type:t token:tok |
81 |
^ (self basicNew) type:t token:tok |
|
14 | 82 |
! |
83 |
||
84 |
type:t token:tok index:i |
|
85 |
^ (self basicNew) type:t token:tok index:i |
|
86 |
! |
|
87 |
||
88 |
type:t token:tok index:i block:b |
|
89 |
^ (self basicNew) type:t token:tok index:i block:b |
|
90 |
! ! |
|
91 |
||
92 |
!VariableNode methodsFor:'accessing'! |
|
93 |
||
140 | 94 |
index |
95 |
^ index |
|
14 | 96 |
! |
97 |
||
140 | 98 |
name |
99 |
^ name |
|
14 | 100 |
! |
101 |
||
140 | 102 |
type:t class:class name:n |
14 | 103 |
type := t. |
104 |
value := nil. |
|
140 | 105 |
name := n. |
106 |
selfClass := class |
|
14 | 107 |
! |
108 |
||
109 |
type:t index:i selfValue:s |
|
110 |
type := t. |
|
111 |
value := nil. |
|
112 |
index := i. |
|
113 |
selfValue := s |
|
114 |
! |
|
115 |
||
140 | 116 |
type:t name:n |
98 | 117 |
type := t. |
118 |
value := nil. |
|
14 | 119 |
name := n |
120 |
! |
|
121 |
||
122 |
type:t name:n index:i selfClass:s |
|
123 |
type := t. |
|
124 |
value := nil. |
|
125 |
index := i. |
|
126 |
selfClass := s. |
|
127 |
name := n |
|
128 |
! |
|
129 |
||
140 | 130 |
type:t name:n index:i selfValue:s |
131 |
type := t. |
|
132 |
value := nil. |
|
133 |
index := i. |
|
134 |
selfValue := s. |
|
135 |
name := n |
|
136 |
! |
|
137 |
||
14 | 138 |
type:t name:n token:tok index:i |
139 |
type := t. |
|
140 |
index := i. |
|
141 |
token := tok. |
|
142 |
name := n |
|
143 |
! |
|
144 |
||
145 |
type:t name:n token:tok index:i block:b |
|
146 |
type := t. |
|
147 |
index := i. |
|
148 |
block := b. |
|
149 |
token := tok. |
|
535 | 150 |
name := n. |
151 |
(type == #BlockArg) ifTrue:[ |
|
152 |
b blockArgAccessed:true. |
|
153 |
]. |
|
154 |
||
155 |
"Modified: 18.6.1997 / 11:41:01 / cg" |
|
14 | 156 |
! |
157 |
||
140 | 158 |
type:t name:n value:val |
159 |
type := t. |
|
160 |
name := n. |
|
161 |
value := val |
|
162 |
! |
|
163 |
||
164 |
type:t token:tok |
|
165 |
type := t. |
|
166 |
token := tok |
|
14 | 167 |
! |
168 |
||
140 | 169 |
type:t token:tok index:i |
170 |
type := t. |
|
171 |
index := i. |
|
172 |
token := tok |
|
14 | 173 |
! |
174 |
||
140 | 175 |
type:t token:tok index:i block:b |
176 |
type := t. |
|
177 |
index := i. |
|
178 |
block := b. |
|
535 | 179 |
token := tok. |
180 |
||
181 |
(type == #BlockArg) ifTrue:[ |
|
182 |
b blockArgAccessed:true. |
|
183 |
]. |
|
184 |
||
185 |
"Modified: 18.6.1997 / 11:41:05 / cg" |
|
14 | 186 |
! ! |
187 |
||
188 |
!VariableNode methodsFor:'code generation'! |
|
189 |
||
104 | 190 |
codeForSideEffectOn:aStream inBlock:b for:aCompiler |
14 | 191 |
"no code at all" |
192 |
^ self |
|
193 |
! |
|
194 |
||
559 | 195 |
codeLoadOn:aStream type:type index:index inBlock:codeBlock for:aCompiler |
196 |
|theCode b deltaLevel litIndex specialGlobalIndex |
|
197 |
bvIdx bvTyp blocksCode| |
|
14 | 198 |
|
199 |
(type == #MethodArg) ifTrue:[ |
|
218
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
200 |
(index <= 4) ifTrue:[ |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
201 |
aStream nextPut:(#(pushMethodArg1 |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
202 |
pushMethodArg2 |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
203 |
pushMethodArg3 |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
204 |
pushMethodArg4) at:index). |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
205 |
^ self |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
206 |
]. |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
207 |
aStream nextPut:#pushMethodArg; nextPut:index. |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
208 |
^ self |
14 | 209 |
]. |
554 | 210 |
|
14 | 211 |
(type == #MethodVariable) ifTrue:[ |
218
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
212 |
(index <= 6) ifTrue:[ |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
213 |
aStream nextPut:(#(pushMethodVar1 |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
214 |
pushMethodVar2 |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
215 |
pushMethodVar3 |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
216 |
pushMethodVar4 |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
217 |
pushMethodVar5 |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
218 |
pushMethodVar6) at:index). |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
219 |
^ self |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
220 |
]. |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
221 |
aStream nextPut:#pushMethodVar; nextPut:index. |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
222 |
^ self |
14 | 223 |
]. |
554 | 224 |
|
14 | 225 |
(type == #InstanceVariable) ifTrue:[ |
218
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
226 |
(index <= 10) ifTrue:[ |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
227 |
theCode := #(pushInstVar1 pushInstVar2 pushInstVar3 |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
228 |
pushInstVar4 pushInstVar5 pushInstVar6 |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
229 |
pushInstVar7 pushInstVar8 pushInstVar9 |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
230 |
pushInstVar10) at:index. |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
231 |
aStream nextPut:theCode. |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
232 |
^ self |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
233 |
]. |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
234 |
aStream nextPut:#pushInstVar; nextPut:index. |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
235 |
^ self |
14 | 236 |
]. |
554 | 237 |
|
238 |
((type == #BlockArg) |
|
239 |
or:[type == #BlockVariable]) ifTrue:[ |
|
559 | 240 |
"/ compiling for codeBlock; accessing variable in block. |
241 |
||
242 |
bvIdx := index. |
|
243 |
bvTyp := type. |
|
244 |
||
245 |
"/ find the context where that variable is contained physically |
|
246 |
blocksCode := block. |
|
247 |
[blocksCode notNil and:[blocksCode isInlineBlock]] whileTrue:[ |
|
248 |
blocksCode := blocksCode home |
|
249 |
]. |
|
250 |
||
251 |
"/ find deltaLevel from code-context to the containing block |
|
218
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
252 |
b := codeBlock. |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
253 |
deltaLevel := 0. |
559 | 254 |
[b notNil and:[b ~~ blocksCode]] whileTrue:[ |
554 | 255 |
b isInlineBlock ifFalse:[ |
218
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
256 |
deltaLevel := deltaLevel + 1 |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
257 |
]. |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
258 |
b := b home |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
259 |
]. |
535 | 260 |
|
559 | 261 |
b isNil ifTrue:[ |
262 |
codeBlock isNil ifTrue:[ |
|
263 |
"/ a var of a block which is inlined in the method. |
|
264 |
"/ Generate a pushMVAR |
|
265 |
||
266 |
bvIdx := block indexOfFirstTemp + index - 1. |
|
267 |
type == #BlockVariable ifTrue:[ |
|
268 |
bvIdx := bvIdx + block numArgs |
|
269 |
]. |
|
270 |
^ self |
|
271 |
codeLoadOn:aStream |
|
272 |
type:#MethodVariable |
|
273 |
index:bvIdx |
|
274 |
inBlock:codeBlock |
|
275 |
for:aCompiler |
|
276 |
]. |
|
277 |
||
278 |
"/ a var of a block which is inlined in the outer block. |
|
279 |
"/ Generate a pushBVAR |
|
280 |
||
281 |
bvIdx := block indexOfFirstTemp + index - 1. |
|
282 |
type == #BlockVariable ifTrue:[ |
|
283 |
bvIdx := bvIdx + block numArgs |
|
284 |
]. |
|
285 |
bvTyp := #BlockVariable. |
|
286 |
] ifFalse:[ |
|
287 |
block isInlineBlock ifTrue:[ |
|
288 |
"/ a var of a block which is inlined in another block. |
|
289 |
"/ Generate a pushBVAR / pushOuterBVAR |
|
290 |
bvIdx := block indexOfFirstTemp + index - 1. |
|
291 |
type == #BlockVariable ifTrue:[ |
|
292 |
bvIdx := bvIdx + block numArgs |
|
293 |
]. |
|
294 |
bvTyp := #BlockVariable. |
|
295 |
] |
|
554 | 296 |
]. |
297 |
||
559 | 298 |
(bvTyp == #BlockVariable) ifTrue:[ |
554 | 299 |
(deltaLevel == 0) ifTrue:[ |
559 | 300 |
bvIdx <= 3 ifTrue:[ |
301 |
aStream nextPut:(#(pushBlockVar1 pushBlockVar2 pushBlockVar3) at:bvIdx). |
|
554 | 302 |
^ self |
303 |
]. |
|
304 |
aStream nextPut:#pushBlockVar. |
|
305 |
] ifFalse:[ |
|
306 |
aStream nextPut:#pushOuterBlockVar; nextPut:deltaLevel. |
|
218
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
307 |
]. |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
308 |
] ifFalse:[ |
554 | 309 |
(deltaLevel == 0) ifTrue:[ |
559 | 310 |
(bvIdx <= 4) ifTrue:[ |
311 |
aStream nextPut:(#(pushBlockArg1 pushBlockArg2 pushBlockArg3 |
|
312 |
pushBlockArg4) at:bvIdx). |
|
554 | 313 |
^ self |
314 |
]. |
|
315 |
aStream nextPut:#pushBlockArg. |
|
218
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
316 |
] ifFalse:[ |
554 | 317 |
(deltaLevel == 1) ifTrue:[ |
318 |
aStream nextPut:#pushOuter1BlockArg |
|
218
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
319 |
] ifFalse:[ |
554 | 320 |
(deltaLevel == 2) ifTrue:[ |
321 |
aStream nextPut:#pushOuter2BlockArg |
|
322 |
] ifFalse:[ |
|
323 |
aStream nextPut:#pushOuterBlockArg; nextPut:deltaLevel |
|
324 |
] |
|
325 |
]. |
|
218
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
326 |
]. |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
327 |
]. |
559 | 328 |
aStream nextPut:bvIdx. |
218
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
329 |
^ self |
14 | 330 |
]. |
554 | 331 |
|
14 | 332 |
(type == #GlobalVariable) ifTrue:[ |
218
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
333 |
litIndex := aCompiler addLiteral:name asSymbol. |
531 | 334 |
specialGlobalIndex := aCompiler specialGlobalCodeFor:name. |
335 |
specialGlobalIndex notNil ifTrue:[ |
|
336 |
aStream nextPut:#pushSpecialGlobal; nextPut:specialGlobalIndex. |
|
243
cdc1424ddaac
use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
337 |
^ self |
cdc1424ddaac
use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
338 |
]. |
cdc1424ddaac
use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
339 |
|
218
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
340 |
litIndex < 256 ifTrue:[ |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
341 |
aStream nextPut:#pushGlobalS; nextPut:litIndex |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
342 |
] ifFalse:[ |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
343 |
aStream nextPut:#pushGlobalL; nextPut:litIndex; nextPut:0 |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
344 |
]. |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
345 |
^ self |
14 | 346 |
]. |
554 | 347 |
|
360 | 348 |
(type == #ClassVariable) ifTrue:[ |
218
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
349 |
litIndex := aCompiler addLiteral:(selfClass name , ':' , name) asSymbol. |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
350 |
litIndex < 256 ifTrue:[ |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
351 |
aStream nextPut:#pushClassVarS; nextPut:litIndex |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
352 |
] ifFalse:[ |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
353 |
aStream nextPut:#pushClassVarL; nextPut:litIndex; nextPut:0 |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
354 |
]. |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
355 |
^ self |
14 | 356 |
]. |
554 | 357 |
|
360 | 358 |
(type == #PrivateClass) ifTrue:[ |
359 |
litIndex := aCompiler addLiteral:(selfClass name , '::' , name) asSymbol. |
|
360 |
litIndex < 256 ifTrue:[ |
|
361 |
aStream nextPut:#pushGlobalS; nextPut:litIndex |
|
362 |
] ifFalse:[ |
|
363 |
aStream nextPut:#pushGlobalL; nextPut:litIndex; nextPut:0 |
|
364 |
]. |
|
365 |
^ self |
|
366 |
]. |
|
14 | 367 |
|
368 |
(type == #ClassInstanceVariable) ifTrue:[ |
|
218
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
369 |
aStream nextPut:#pushClassInstVar; nextPut:index. |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
370 |
^ self |
14 | 371 |
]. |
554 | 372 |
|
14 | 373 |
(type == #ThisContext) ifTrue:[ |
218
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
374 |
aStream nextPut:#pushThisContext. ^ self |
14 | 375 |
]. |
376 |
||
377 |
"not reached" |
|
378 |
self halt:'bad type'. |
|
218
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
379 |
|
559 | 380 |
"Created: 25.6.1997 / 16:14:17 / cg" |
381 |
"Modified: 26.6.1997 / 10:15:11 / cg" |
|
382 |
! |
|
383 |
||
384 |
codeOn:aStream inBlock:codeBlock for:aCompiler |
|
385 |
self |
|
386 |
codeLoadOn:aStream type:type index:index inBlock:codeBlock for:aCompiler |
|
387 |
||
388 |
"Modified: 26.6.1997 / 10:06:10 / cg" |
|
14 | 389 |
! |
390 |
||
104 | 391 |
codeStoreOn:aStream inBlock:codeBlock valueNeeded:valueNeeded for:aCompiler |
559 | 392 |
self |
393 |
codeStoreOn:aStream type:type index:index |
|
394 |
inBlock:codeBlock valueNeeded:valueNeeded for:aCompiler |
|
395 |
||
396 |
"Modified: 25.6.1997 / 16:15:28 / cg" |
|
397 |
! |
|
398 |
||
399 |
codeStoreOn:aStream type:type index:index inBlock:codeBlock valueNeeded:valueNeeded for:aCompiler |
|
400 |
|theCode b deltaLevel litIndex bvIdx blocksCode| |
|
14 | 401 |
|
402 |
valueNeeded ifTrue:[ |
|
218
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
403 |
aStream nextPut:#dup |
14 | 404 |
]. |
554 | 405 |
|
14 | 406 |
(type == #MethodVariable) ifTrue:[ |
218
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
407 |
(index <= 6) ifTrue:[ |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
408 |
theCode := #(storeMethodVar1 storeMethodVar2 |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
409 |
storeMethodVar3 storeMethodVar4 |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
410 |
storeMethodVar5 storeMethodVar6) at:index. |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
411 |
aStream nextPut:theCode. |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
412 |
^ self |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
413 |
]. |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
414 |
aStream nextPut:#storeMethodVar; nextPut:index. |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
415 |
^ self |
14 | 416 |
]. |
554 | 417 |
|
14 | 418 |
(type == #InstanceVariable) ifTrue:[ |
218
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
419 |
(index <= 10) ifTrue:[ |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
420 |
theCode := #(storeInstVar1 storeInstVar2 |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
421 |
storeInstVar3 storeInstVar4 |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
422 |
storeInstVar5 storeInstVar6 |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
423 |
storeInstVar7 storeInstVar8 |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
424 |
storeInstVar9 storeInstVar10) at:index. |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
425 |
aStream nextPut:theCode. |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
426 |
^ self |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
427 |
]. |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
428 |
aStream nextPut:#storeInstVar; nextPut:index. |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
429 |
^ self |
14 | 430 |
]. |
554 | 431 |
|
14 | 432 |
(type == #BlockVariable) ifTrue:[ |
559 | 433 |
bvIdx := index. |
434 |
||
435 |
"/ find the context where that variable is contained physically |
|
436 |
blocksCode := block. |
|
437 |
[blocksCode notNil and:[blocksCode isInlineBlock]] whileTrue:[ |
|
438 |
blocksCode := blocksCode home |
|
439 |
]. |
|
440 |
||
218
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
441 |
"find deltaLevel to block, where variable was defined" |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
442 |
b := codeBlock. |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
443 |
deltaLevel := 0. |
559 | 444 |
[b notNil and:[b ~~ blocksCode]] whileTrue:[ |
554 | 445 |
b isInlineBlock ifFalse:[ |
218
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
446 |
deltaLevel := deltaLevel + 1 |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
447 |
]. |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
448 |
b := b home |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
449 |
]. |
14 | 450 |
|
559 | 451 |
b isNil ifTrue:[ |
452 |
codeBlock isNil ifTrue:[ |
|
453 |
"/ a block which is inlined in the method. |
|
454 |
"/ Generate a pushMVAR |
|
455 |
||
456 |
bvIdx := block indexOfFirstTemp + index - 1. |
|
457 |
bvIdx := bvIdx + block numArgs. |
|
458 |
^ self |
|
459 |
codeStoreOn:aStream |
|
460 |
type:#MethodVariable index:bvIdx |
|
461 |
inBlock:codeBlock |
|
462 |
valueNeeded:false "/ already dupped if value is needed |
|
463 |
for:aCompiler |
|
464 |
]. |
|
465 |
"/ a var of a block which is inlined in the outer block. |
|
466 |
"/ Generate a pushBVAR |
|
467 |
||
468 |
bvIdx := block indexOfFirstTemp + index - 1. |
|
469 |
bvIdx := bvIdx + block numArgs. |
|
470 |
] ifFalse:[ |
|
471 |
block isInlineBlock ifTrue:[ |
|
472 |
"/ a var of a block which is inlined in another block. |
|
473 |
"/ Generate a pushBVAR / pushOuterBVAR |
|
474 |
bvIdx := block indexOfFirstTemp + index - 1. |
|
475 |
bvIdx := bvIdx + block numArgs. |
|
476 |
] |
|
477 |
]. |
|
478 |
||
218
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
479 |
(deltaLevel == 0) ifTrue:[ |
559 | 480 |
bvIdx <= 3 ifTrue:[ |
481 |
aStream nextPut:(#(storeBlockVar1 storeBlockVar2 storeBlockVar3) at:bvIdx). |
|
218
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
482 |
^ self |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
483 |
]. |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
484 |
aStream nextPut:#storeBlockVar |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
485 |
] ifFalse:[ |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
486 |
aStream nextPut:#storeOuterBlockVar; nextPut:deltaLevel |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
487 |
]. |
559 | 488 |
aStream nextPut:bvIdx. |
218
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
489 |
^ self |
14 | 490 |
]. |
554 | 491 |
|
117 | 492 |
(type == #GlobalVariable) ifTrue:[ |
218
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
493 |
litIndex := aCompiler addLiteral:name asSymbol. |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
494 |
litIndex < 256 ifTrue:[ |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
495 |
aStream nextPut:#storeGlobalS; nextPut:litIndex |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
496 |
] ifFalse:[ |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
497 |
aStream nextPut:#storeGlobalL; nextPut:litIndex; nextPut:0 |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
498 |
]. |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
499 |
^ self |
117 | 500 |
]. |
554 | 501 |
|
14 | 502 |
(type == #ClassVariable) ifTrue:[ |
218
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
503 |
litIndex := aCompiler addLiteral:(selfClass name , ':' , name) asSymbol. |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
504 |
litIndex < 256 ifTrue:[ |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
505 |
aStream nextPut:#storeClassVarS; nextPut:litIndex |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
506 |
] ifFalse:[ |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
507 |
aStream nextPut:#storeClassVarL; nextPut:litIndex; nextPut:0 |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
508 |
]. |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
509 |
^ self |
14 | 510 |
]. |
554 | 511 |
|
14 | 512 |
(type == #ClassInstanceVariable) ifTrue:[ |
218
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
513 |
aStream nextPut:#storeClassInstVar; nextPut:index. |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
514 |
^ self |
14 | 515 |
]. |
554 | 516 |
|
106 | 517 |
"not reached" |
14 | 518 |
^ self error:'bad assignment' |
218
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
519 |
|
559 | 520 |
"Created: 25.6.1997 / 16:14:40 / cg" |
521 |
"Modified: 26.6.1997 / 10:18:53 / cg" |
|
14 | 522 |
! ! |
523 |
||
539
69a1cd05c7d6
added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
524 |
!VariableNode methodsFor:'enumeration'! |
69a1cd05c7d6
added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
525 |
|
69a1cd05c7d6
added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
526 |
nodeDo:anEnumerator |
69a1cd05c7d6
added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
527 |
"helper for parse tree walking" |
69a1cd05c7d6
added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
528 |
|
69a1cd05c7d6
added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
529 |
^ anEnumerator doVariable:self name:name |
69a1cd05c7d6
added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
530 |
|
69a1cd05c7d6
added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
531 |
"Created: 19.6.1997 / 16:41:35 / cg" |
69a1cd05c7d6
added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
532 |
! ! |
69a1cd05c7d6
added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
533 |
|
140 | 534 |
!VariableNode methodsFor:'evaluating'! |
535 |
||
536 |
evaluate |
|
537 |
(type == #MethodVariable |
|
538 |
or:[type == #BlockArg |
|
539 |
or:[type == #BlockVariable]]) ifTrue:[ |
|
420 | 540 |
^ token variableValue |
140 | 541 |
]. |
542 |
(type == #InstanceVariable) ifTrue:[ |
|
420 | 543 |
^ selfValue instVarAt:index |
140 | 544 |
]. |
545 |
(type == #GlobalVariable) ifTrue:[ |
|
420 | 546 |
(Smalltalk includesKey:name) ifTrue:[ |
547 |
^ Smalltalk at:name |
|
548 |
]. |
|
140 | 549 |
" |
420 | 550 |
self error:('global ' , name , ' is undefined'). |
140 | 551 |
" |
552 |
||
420 | 553 |
^ UndefinedVariable name:name. |
554 |
^ nil |
|
140 | 555 |
]. |
556 |
(type == #ClassVariable) ifTrue:[ |
|
420 | 557 |
^ Smalltalk at:(selfClass name , ':' , name) asSymbol |
140 | 558 |
]. |
559 |
(type == #ClassInstanceVariable) ifTrue:[ |
|
420 | 560 |
^ selfClass instVarAt:index |
140 | 561 |
]. |
562 |
(type == #ThisContext) ifTrue:[ |
|
420 | 563 |
^ thisContext |
564 |
]. |
|
565 |
(type == #PrivateClass) ifTrue:[ |
|
566 |
^ selfClass privateClassesAt:name asSymbol |
|
140 | 567 |
]. |
568 |
"not reached" |
|
569 |
self halt:'bad type'. |
|
570 |
^ value |
|
420 | 571 |
|
572 |
"Modified: 6.11.1996 / 17:28:17 / cg" |
|
140 | 573 |
! |
574 |
||
575 |
store:aValue |
|
576 |
(type == #MethodVariable |
|
577 |
or:[type == #BlockVariable]) ifTrue:[ |
|
578 |
token value:aValue. ^ aValue |
|
579 |
]. |
|
580 |
(type == #InstanceVariable) ifTrue:[ |
|
581 |
^ selfValue instVarAt:index put:aValue |
|
582 |
]. |
|
583 |
(type == #GlobalVariable) ifTrue:[ |
|
584 |
^ Smalltalk at:name put:aValue |
|
585 |
]. |
|
586 |
(type == #ClassVariable) ifTrue:[ |
|
587 |
^ Smalltalk at:(selfClass name , ':' , name) asSymbol put:aValue |
|
588 |
]. |
|
589 |
(type == #ClassInstanceVariable) ifTrue:[ |
|
590 |
^ selfClass instVarAt:index put:aValue |
|
591 |
]. |
|
592 |
"not reached" |
|
593 |
self halt:'bad type'. |
|
594 |
^ aValue |
|
595 |
! ! |
|
596 |
||
14 | 597 |
!VariableNode methodsFor:'printing'! |
598 |
||
599 |
displayString |
|
600 |
^ 'InterpreterVariable(' , self printString , ')' |
|
601 |
! |
|
602 |
||
603 |
printOn:aStream indent:i |
|
98 | 604 |
|
605 |
(type == #MethodArg "/ actually only a debug-check |
|
606 |
or:[type == #MethodVariable |
|
607 |
or:[type == #InstanceVariable |
|
608 |
or:[type == #BlockArg |
|
609 |
or:[type == #GlobalVariable |
|
610 |
or:[type == #ClassVariable |
|
611 |
or:[type == #BlockVariable |
|
465 | 612 |
or:[type == #PrivateClass |
613 |
or:[type == #ClassInstanceVariable]]]]]]]]) ifTrue:[ |
|
614 |
aStream nextPutAll:name. ^ self |
|
14 | 615 |
]. |
616 |
(type == #ThisContext) ifTrue:[ |
|
465 | 617 |
aStream nextPutAll:'thisContext'. ^ self |
14 | 618 |
]. |
619 |
"not reached" |
|
620 |
self halt:'bad type'. |
|
465 | 621 |
|
622 |
"Modified: 5.1.1997 / 16:42:39 / cg" |
|
14 | 623 |
! ! |
140 | 624 |
|
625 |
!VariableNode methodsFor:'queries'! |
|
626 |
||
243
cdc1424ddaac
use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
627 |
canReuseAsArg:anotherNode |
cdc1424ddaac
use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
628 |
anotherNode isVariable ifTrue:[ |
cdc1424ddaac
use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
629 |
anotherNode type ~~ type ifTrue:[^ false]. |
cdc1424ddaac
use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
630 |
|
cdc1424ddaac
use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
631 |
(type == #ThisContext) ifTrue:[^ true]. |
cdc1424ddaac
use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
632 |
|
cdc1424ddaac
use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
633 |
index notNil ifTrue:[ |
cdc1424ddaac
use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
634 |
anotherNode index ~~ index ifTrue:[^ false]. |
cdc1424ddaac
use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
635 |
]. |
cdc1424ddaac
use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
636 |
(type == #MethodArg) ifTrue:[^ true]. |
cdc1424ddaac
use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
637 |
(type == #MethodVariable) ifTrue:[^ true]. |
cdc1424ddaac
use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
638 |
(type == #InstanceVariable) ifTrue:[^ true]. |
cdc1424ddaac
use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
639 |
|
cdc1424ddaac
use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
640 |
name notNil ifTrue:[ |
cdc1424ddaac
use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
641 |
anotherNode name ~~ name ifTrue:[^ false]. |
cdc1424ddaac
use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
642 |
]. |
cdc1424ddaac
use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
643 |
(type == #GlobalVariable) ifTrue:[^ true]. |
cdc1424ddaac
use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
644 |
(type == #ClassVariable) ifTrue:[^ true]. |
cdc1424ddaac
use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
645 |
]. |
cdc1424ddaac
use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
646 |
^ false |
cdc1424ddaac
use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
647 |
|
cdc1424ddaac
use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
648 |
"Created: 14.4.1996 / 00:46:18 / cg" |
cdc1424ddaac
use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
649 |
"Modified: 14.4.1996 / 00:55:25 / cg" |
cdc1424ddaac
use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
650 |
! |
cdc1424ddaac
use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
651 |
|
140 | 652 |
isGlobal |
653 |
"return true, if this is a node for a global variable" |
|
654 |
||
655 |
^ (type == #GlobalVariable) and:[Smalltalk includesKey:name] |
|
218
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
656 |
! |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
657 |
|
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
658 |
isLocal |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
659 |
"return true, if this is a node for a local (block or method) variable" |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
660 |
|
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
661 |
^ (type == #MethodVariable) or:[type == #BlockVariable] |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
662 |
|
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
663 |
"Created: 1.3.1996 / 00:03:53 / cg" |
748b4c509a51
use new BlockVar instructions
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
664 |
"Modified: 1.3.1996 / 00:04:46 / cg" |
243
cdc1424ddaac
use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
665 |
! |
cdc1424ddaac
use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
666 |
|
cdc1424ddaac
use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
667 |
isVariable |
cdc1424ddaac
use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
668 |
"return true, if this is a node for a variable" |
cdc1424ddaac
use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
669 |
|
cdc1424ddaac
use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
670 |
^ true |
cdc1424ddaac
use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
671 |
|
cdc1424ddaac
use dup if possible when pushing args / faster access to common globals
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
672 |
"Created: 14.4.1996 / 00:46:32 / cg" |
140 | 673 |
! ! |
674 |
||
360 | 675 |
!VariableNode class methodsFor:'documentation'! |
148 | 676 |
|
677 |
version |
|
559 | 678 |
^ '$Header: /cvs/stx/stx/libcomp/Attic/VarNode.st,v 1.29 1997-06-26 08:41:55 cg Exp $' |
148 | 679 |
! ! |