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