author | Stefan Vogel <sv@exept.de> |
Thu, 13 Jun 1996 00:11:10 +0200 | |
changeset 1461 | dd25bb1e9973 |
parent 1293 | 02fb05148c98 |
child 1493 | 33e226c7d187 |
permissions | -rw-r--r-- |
84 | 1 |
" |
2 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
159 | 3 |
All Rights Reserved |
84 | 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 |
||
1461
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1293
diff
changeset
|
13 |
'From Smalltalk/X, Version:2.10.9 on 11-jun-1996 at 16:33:14' ! |
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1293
diff
changeset
|
14 |
|
249 | 15 |
ExecutableFunction subclass:#CompiledCode |
1182
d8f8e18928a5
only CompiledCode, Method & Block are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
16 |
instanceVariableNames:'flags byteCode literals' |
d8f8e18928a5
only CompiledCode, Method & Block are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
17 |
classVariableNames:'NoByteCodeSignal InvalidByteCodeSignal InvalidInstructionSignal |
d8f8e18928a5
only CompiledCode, Method & Block are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
18 |
BadLiteralsSignal NonBooleanReceiverSignal ArgumentSignal' |
d8f8e18928a5
only CompiledCode, Method & Block are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
19 |
poolDictionaries:'' |
d8f8e18928a5
only CompiledCode, Method & Block are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
20 |
category:'Kernel-Methods' |
84 | 21 |
! |
22 |
||
249 | 23 |
!CompiledCode class methodsFor:'documentation'! |
84 | 24 |
|
88 | 25 |
copyright |
26 |
" |
|
27 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
159 | 28 |
All Rights Reserved |
88 | 29 |
|
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
! |
|
38 |
||
84 | 39 |
documentation |
40 |
" |
|
41 |
This is an abstract class, to merge common attributes of Blocks and |
|
328 | 42 |
Methods i.e. describe all objects consisting of either compiled or |
43 |
interpreted code. |
|
84 | 44 |
|
1254 | 45 |
Instances of CompiledCode are not to be created by user code |
46 |
(the compilers create Blocks, Methods etc.) |
|
47 |
||
48 |
||
1293 | 49 |
[Instance variables:] |
84 | 50 |
|
357 | 51 |
flags <SmallInteger> special flag bits coded in a number |
225 | 52 |
byteCode <ByteArray> bytecode if its an interpreted codeobject |
53 |
literals <Array> the block/methods literal array |
|
54 |
||
55 |
||
1293 | 56 |
[Class variables:] |
225 | 57 |
|
58 |
NoByteCodeSignal raised if a codeObject is about to be executed |
|
1254 | 59 |
which has neither code nor byteCode (i.e. both are nil) |
225 | 60 |
InvalidByteCodeSignal raised if byteCode is not an instance of ByteArray |
61 |
InvalidInstructionSignal raised if an invalid instruction opcode is encountered |
|
62 |
BadLiteralsSignal raised if literalArray is not an array |
|
63 |
NonBooleanReceiverSignal raised for conditional jumps where receiver is not a boolean |
|
64 |
ArgumentSignal raised if argument count is not what the codeObject expects |
|
65 |
||
66 |
all of these signals are children of ExecutionErrorSignal. |
|
84 | 67 |
|
68 |
NOTICE: layout known by runtime system and compiler - do not change |
|
1293 | 69 |
|
70 |
[author:] |
|
71 |
Claus Gittinger |
|
72 |
||
84 | 73 |
" |
74 |
! ! |
|
75 |
||
249 | 76 |
!CompiledCode class methodsFor:'initialization'! |
106 | 77 |
|
78 |
initialize |
|
1254 | 79 |
"create signals raised by various errors" |
80 |
||
106 | 81 |
NoByteCodeSignal isNil ifTrue:[ |
1254 | 82 |
NoByteCodeSignal := ExecutionErrorSignal newSignalMayProceed:true. |
83 |
NoByteCodeSignal nameClass:self message:#noByteCodeSignal. |
|
84 |
NoByteCodeSignal notifierString:'nil byteCode in code-object - not executable'. |
|
159 | 85 |
|
1254 | 86 |
InvalidByteCodeSignal := ExecutionErrorSignal newSignalMayProceed:true. |
87 |
InvalidByteCodeSignal nameClass:self message:#invalidByteCodeSignal. |
|
88 |
InvalidByteCodeSignal notifierString:'invalid byteCode in code-object - not executable'. |
|
159 | 89 |
|
1254 | 90 |
InvalidInstructionSignal := ExecutionErrorSignal newSignalMayProceed:true. |
91 |
InvalidInstructionSignal nameClass:self message:#invalidInstructionSignal. |
|
92 |
InvalidInstructionSignal notifierString:'invalid instruction in code-object - not executable'. |
|
159 | 93 |
|
1254 | 94 |
BadLiteralsSignal := ExecutionErrorSignal newSignalMayProceed:true. |
95 |
BadLiteralsSignal nameClass:self message:#badLiteralsSignal. |
|
96 |
BadLiteralsSignal notifierString:'bad literal table in code-object - should not happen'. |
|
159 | 97 |
|
1254 | 98 |
NonBooleanReceiverSignal := ExecutionErrorSignal newSignalMayProceed:true. |
99 |
NonBooleanReceiverSignal nameClass:self message:#nonBooleanReceiverSignal. |
|
100 |
NonBooleanReceiverSignal notifierString:'if/while on non-boolean receiver'. |
|
159 | 101 |
|
1254 | 102 |
ArgumentSignal := ExecutionErrorSignal newSignalMayProceed:true. |
103 |
ArgumentSignal nameClass:self message:#argumentSignal. |
|
104 |
ArgumentSignal notifierString:'bad argument(s)'. |
|
106 | 105 |
] |
1254 | 106 |
|
107 |
"Modified: 22.4.1996 / 16:33:38 / cg" |
|
106 | 108 |
! ! |
109 |
||
345 | 110 |
!CompiledCode class methodsFor:'Signal constants'! |
106 | 111 |
|
112 |
argumentSignal |
|
113 |
"return the signal raised when something's wrong with the |
|
114 |
arguments" |
|
115 |
||
116 |
^ ArgumentSignal |
|
623 | 117 |
! |
118 |
||
119 |
executionErrorSignal |
|
120 |
"return the parent-signal of all execution errors" |
|
121 |
||
122 |
^ ExecutionErrorSignal |
|
106 | 123 |
! ! |
124 |
||
249 | 125 |
!CompiledCode class methodsFor:'queries'! |
84 | 126 |
|
127 |
isBuiltInClass |
|
1264 | 128 |
"return true if this class is known by the run-time-system. |
129 |
Here, true is returned for myself, false for subclasses." |
|
84 | 130 |
|
1182
d8f8e18928a5
only CompiledCode, Method & Block are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
131 |
^ self == CompiledCode |
d8f8e18928a5
only CompiledCode, Method & Block are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
132 |
|
1264 | 133 |
"Modified: 23.4.1996 / 15:57:03 / cg" |
84 | 134 |
! ! |
135 |
||
249 | 136 |
!CompiledCode methodsFor:'accessing'! |
84 | 137 |
|
138 |
byteCode |
|
139 |
"return the bytecode (a ByteArray)" |
|
140 |
||
141 |
^ byteCode |
|
142 |
! |
|
143 |
||
144 |
literals |
|
145 |
"return the literal array" |
|
146 |
||
147 |
^ literals |
|
148 |
! ! |
|
149 |
||
1461
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1293
diff
changeset
|
150 |
!CompiledCode methodsFor:'converting'! |
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1293
diff
changeset
|
151 |
|
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1293
diff
changeset
|
152 |
makeRealMethod |
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1293
diff
changeset
|
153 |
"by default, we are a real method. |
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1293
diff
changeset
|
154 |
Subclasses (e.g. LazyMethod) may redefine this" |
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1293
diff
changeset
|
155 |
|
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1293
diff
changeset
|
156 |
^ self |
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1293
diff
changeset
|
157 |
|
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1293
diff
changeset
|
158 |
"Created: 7.6.1996 / 12:45:50 / stefan" |
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1293
diff
changeset
|
159 |
! ! |
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1293
diff
changeset
|
160 |
|
623 | 161 |
!CompiledCode methodsFor:'error handling'! |
162 |
||
163 |
badArgumentArray |
|
164 |
"this error is triggered, if a non array is passed to |
|
165 |
#valueWithReceiver:.. methods" |
|
166 |
||
167 |
^ ArgumentSignal |
|
168 |
raiseRequestWith:self |
|
169 |
errorString:'argumentArray must be an Array' |
|
170 |
! |
|
171 |
||
172 |
badLiteralTable |
|
173 |
"this error is triggered, when a block/method is called with a bad literal |
|
174 |
array (i.e. non-array) - this can only happen, if the |
|
175 |
compiler is broken or someone played around with a block/methods |
|
176 |
literal table or the GC is broken and corrupted it." |
|
177 |
||
178 |
^ BadLiteralsSignal raise. |
|
179 |
! |
|
180 |
||
181 |
invalidByteCode |
|
182 |
"this error is triggered when the interpreter tries to execute a |
|
183 |
code object, where the byteCode is nonNil, but not a ByteArray. |
|
184 |
Can only happen when Compiler/runtime system is broken or |
|
185 |
someone played around with a block/method." |
|
186 |
||
187 |
^ InvalidByteCodeSignal raise. |
|
188 |
! |
|
189 |
||
190 |
invalidInstruction |
|
191 |
"this error is triggered when the bytecode-interpreter tries to |
|
192 |
execute an invalid bytecode instruction. |
|
193 |
Can only happen when Compiler/runtime system is broken or |
|
194 |
someone played around with the block/methods code." |
|
195 |
||
196 |
^ InvalidInstructionSignal raise. |
|
197 |
! |
|
198 |
||
199 |
noByteCode |
|
200 |
"this error is triggered when the interpreter tries to execute a |
|
201 |
code object, where both the code and byteCode instances are nil. |
|
202 |
This can happen if: |
|
203 |
the Compiler/runtime system is broken, |
|
204 |
someone played around with a block/method, |
|
205 |
compilation of a lazy method failed |
|
206 |
(i.e. the lazy method contains an error or |
|
207 |
it contains primitive code and there is no stc compiler available) |
|
208 |
an unloaded object modules method is called for. |
|
209 |
Only the first case is to be considered serious - it should not happen |
|
210 |
if the system is used correctly." |
|
211 |
||
212 |
^ NoByteCodeSignal raise. |
|
213 |
! |
|
214 |
||
215 |
receiverNotBoolean:anObject |
|
216 |
"this error is triggered when the bytecode-interpreter tries to |
|
217 |
execute ifTrue:/ifFalse or whileTrue: type of expressions where the |
|
218 |
receiver is neither true nor false." |
|
219 |
||
220 |
^ NonBooleanReceiverSignal raise. |
|
221 |
! |
|
222 |
||
223 |
tooManyArguments |
|
224 |
"this error is triggered, when a method/block tries to perform a send with |
|
225 |
more arguments than supported by the interpreter. This can only happen, |
|
226 |
if the compiler has been changed without updating the VM." |
|
227 |
||
228 |
^ ArgumentSignal |
|
229 |
raiseRequestWith:self |
|
230 |
errorString:'too many args in send' |
|
231 |
! ! |
|
232 |
||
233 |
!CompiledCode methodsFor:'private accessing'! |
|
234 |
||
235 |
byteCode:aByteArray |
|
236 |
"set the bytecode field - DANGER ALERT" |
|
237 |
||
238 |
byteCode := aByteArray |
|
239 |
! |
|
240 |
||
241 |
dynamic |
|
242 |
"return the flag stating that the machine code was created |
|
243 |
dynamically (from bytecode)." |
|
244 |
||
245 |
%{ /* NOCONTEXT */ |
|
246 |
||
247 |
/* made this a primitive to get define in stc.h */ |
|
248 |
||
1133 | 249 |
RETURN ((__intVal(__INST(flags)) & F_DYNAMIC) ? true : false); |
623 | 250 |
%} |
251 |
! |
|
252 |
||
253 |
dynamic:aBoolean |
|
254 |
"set/clear the flag bit stating that the machine code was created |
|
255 |
dynamically and should be flushed on image-restart. |
|
256 |
Obsolete - now done in VM" |
|
257 |
||
258 |
%{ /* NOCONTEXT */ |
|
259 |
||
1133 | 260 |
int newFlags = __intVal(__INST(flags)); |
623 | 261 |
|
262 |
/* made this a primitive to get define in stc.h */ |
|
263 |
if (aBoolean == true) |
|
264 |
newFlags |= F_DYNAMIC; |
|
265 |
else |
|
266 |
newFlags &= ~F_DYNAMIC; |
|
267 |
||
1133 | 268 |
__INST(flags) = __MKSMALLINT(newFlags); |
623 | 269 |
%} |
270 |
! |
|
271 |
||
272 |
literals:aLiteralArray |
|
273 |
"set the literal array for evaluation - DANGER ALERT" |
|
274 |
||
275 |
literals := aLiteralArray |
|
276 |
! |
|
277 |
||
278 |
markFlag |
|
279 |
"return the mark bits value as a boolean" |
|
280 |
||
281 |
%{ /* NOCONTEXT */ |
|
282 |
||
283 |
/* made this a primitive to get define in stc.h */ |
|
284 |
||
1133 | 285 |
RETURN ((__intVal(__INST(flags)) & F_MARKBIT) ? true : false); |
623 | 286 |
%} |
287 |
! |
|
288 |
||
289 |
markFlag:aBoolean |
|
290 |
"set/clear the mark flag bit. |
|
291 |
This bit is not used by the VM, but instead free to mark codeObjects |
|
292 |
for any (debugging/tracing) use. For example, the coverage test uses |
|
293 |
these to mark reached methods. (inspired by a note in c.l.s)" |
|
294 |
||
295 |
%{ /* NOCONTEXT */ |
|
296 |
||
1133 | 297 |
int newFlags = __intVal(__INST(flags)); |
623 | 298 |
|
299 |
/* made this a primitive to get define in stc.h */ |
|
300 |
if (aBoolean == true) |
|
301 |
newFlags |= F_MARKBIT; |
|
302 |
else |
|
303 |
newFlags &= ~F_MARKBIT; |
|
304 |
||
1133 | 305 |
__INST(flags) = __MKSMALLINT(newFlags); |
623 | 306 |
%} |
307 |
! ! |
|
308 |
||
328 | 309 |
!CompiledCode methodsFor:'queries'! |
310 |
||
1196
7b3eeec128d3
moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
311 |
decompileTo:aStream |
7b3eeec128d3
moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
312 |
Decompiler notNil ifTrue:[ |
7b3eeec128d3
moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
313 |
Autoload autoloadFailedSignal handle:[:ex | |
7b3eeec128d3
moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
314 |
ex return |
7b3eeec128d3
moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
315 |
] do:[ |
7b3eeec128d3
moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
316 |
Decompiler autoload. |
7b3eeec128d3
moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
317 |
]. |
7b3eeec128d3
moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
318 |
]. |
7b3eeec128d3
moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
319 |
(Decompiler isNil or:[Decompiler isLoaded not]) ifTrue:[ |
7b3eeec128d3
moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
320 |
^ false |
7b3eeec128d3
moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
321 |
]. |
7b3eeec128d3
moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
322 |
|
7b3eeec128d3
moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
323 |
Decompiler decompile:self to:aStream. |
7b3eeec128d3
moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
324 |
^ true |
7b3eeec128d3
moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
325 |
|
7b3eeec128d3
moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
326 |
"Created: 16.4.1996 / 20:25:40 / cg" |
7b3eeec128d3
moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
327 |
"Modified: 16.4.1996 / 20:31:26 / cg" |
7b3eeec128d3
moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
328 |
! |
7b3eeec128d3
moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
329 |
|
1195
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
330 |
isExecutable |
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
331 |
"return true, if this method is executable. |
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
332 |
I.e. neither an invalidated nor an unloaded method" |
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
333 |
|
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
334 |
self isInvalid ifTrue:[^ false]. |
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
335 |
^ self byteCode notNil or:[self code notNil] |
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
336 |
|
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
337 |
"Created: 16.4.1996 / 17:52:16 / cg" |
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
338 |
! |
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
339 |
|
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
340 |
isUnloaded |
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
341 |
"return true, if the methods machine code has been unloaded |
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
342 |
from the system (i.e. it is not executable)." |
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
343 |
|
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
344 |
^ (self code isNil and:[self byteCode isNil]) |
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
345 |
|
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
346 |
"Created: 16.4.1996 / 17:51:47 / cg" |
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
347 |
! |
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
348 |
|
328 | 349 |
messages |
350 |
"return a Set of all symbols referenced by this thingy. |
|
351 |
(this is more than the message selectors, since also global names |
|
352 |
and symbols found in immediate arrays are included)." |
|
353 |
||
354 |
|symbolSet| |
|
355 |
||
356 |
symbolSet := IdentitySet new. |
|
357 |
literals notNil ifTrue:[ |
|
358 |
literals do: [ :lit | |
|
370 | 359 |
lit isSymbol ifTrue: [ |
328 | 360 |
symbolSet add: lit |
361 |
] ifFalse: [ |
|
370 | 362 |
lit isArray ifTrue: [ |
328 | 363 |
lit traverse: [ :el | |
370 | 364 |
el isSymbol ifTrue: [symbolSet add: el] |
328 | 365 |
] |
366 |
] |
|
367 |
] |
|
368 |
] |
|
369 |
]. |
|
370 |
^ symbolSet |
|
371 |
||
372 |
" |
|
373 |
(CompiledCode compiledMethodAt:#messages) messages |
|
374 |
" |
|
1190
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
375 |
! |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
376 |
|
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
377 |
referencesGlobal:aGlobalSymbol |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
378 |
"return true, if this method references the global |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
379 |
bound to aGlobalSymbol." |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
380 |
|
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
381 |
|lits| |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
382 |
|
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
383 |
(lits := self literals) isNil ifTrue:[^ false]. |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
384 |
^ (lits identityIndexOf:aGlobalSymbol startingAt:1) ~~ 0 |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
385 |
|
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
386 |
"Created: 16.4.1996 / 16:36:32 / cg" |
328 | 387 |
! ! |
388 |
||
1182
d8f8e18928a5
only CompiledCode, Method & Block are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
389 |
!CompiledCode class methodsFor:'documentation'! |
d8f8e18928a5
only CompiledCode, Method & Block are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
390 |
|
d8f8e18928a5
only CompiledCode, Method & Block are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
391 |
version |
1461
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1293
diff
changeset
|
392 |
^ '$Header: /cvs/stx/stx/libbasic/CompiledCode.st,v 1.30 1996-06-12 22:10:44 stefan Exp $' |
1182
d8f8e18928a5
only CompiledCode, Method & Block are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
393 |
! ! |
623 | 394 |
CompiledCode initialize! |