17735
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1995 by Claus Gittinger
|
|
3 |
All Rights Reserved
|
|
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 |
Object subclass:#VMBehavior
|
|
14 |
instanceVariableNames:'superclass flags selectorArray methodArray'
|
|
15 |
classVariableNames:''
|
|
16 |
poolDictionaries:''
|
|
17 |
category:'Kernel-Classes'
|
|
18 |
!
|
|
19 |
|
|
20 |
!VMBehavior class methodsFor:'documentation'!
|
|
21 |
|
|
22 |
copyright
|
|
23 |
"
|
|
24 |
COPYRIGHT (c) 1995 by Claus Gittinger
|
|
25 |
All Rights Reserved
|
|
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 |
This class describes what the VM considers to be a classLike object.
|
|
39 |
Every class in the system inherits from VMBehavior (via Behavior, Class, ClassDescription).
|
|
40 |
|
|
41 |
In contrast to Behavior (which describes smalltalk behavior), the things defined
|
|
42 |
here are valid for all objects for which the VM can do a method lookup.
|
|
43 |
In theory, you can create totally different object systems on top of VMBehavior.
|
|
44 |
This class is purely abstract - therefore, no smalltalk behavior is defined here.
|
|
45 |
|
|
46 |
This is certainly not for normal applications.
|
|
47 |
|
|
48 |
Instance variables:
|
|
49 |
|
|
50 |
superclass <Class> where lookup continues when a selector is not
|
|
51 |
found in the selector array
|
|
52 |
(i.e. the superclass in Smalltalk terms)
|
|
53 |
|
|
54 |
selectorArray <Array of Symbol> the selectors for which inst-methods are defined here
|
|
55 |
|
|
56 |
methodArray <Array of Method> the inst-methods corresponding to the selectors
|
|
57 |
|
|
58 |
flags <SmallInteger> special flag bits coded in a number
|
|
59 |
not for application use
|
|
60 |
|
|
61 |
flag bits (see stc.h):
|
|
62 |
|
|
63 |
NOTICE: layout known by compiler and runtime system; be careful when changing
|
|
64 |
"
|
|
65 |
! !
|
|
66 |
|
|
67 |
!VMBehavior class methodsFor:'initialization'!
|
|
68 |
|
|
69 |
initialize
|
|
70 |
self == VMBehavior ifTrue:[
|
|
71 |
self flags:(self flagBehavior).
|
|
72 |
]
|
|
73 |
|
|
74 |
"
|
|
75 |
self initialize
|
|
76 |
"
|
|
77 |
! !
|
|
78 |
|
|
79 |
!VMBehavior class methodsFor:'flag bit constants'!
|
|
80 |
|
|
81 |
flagBehavior
|
|
82 |
"return the flag code which marks Behavior-like instances.
|
|
83 |
You have to check this single bit in the flag value when
|
|
84 |
checking for behaviors."
|
|
85 |
|
|
86 |
%{ /* NOCONTEXT */
|
|
87 |
/* this is defined as a primitive to get defines from stc.h */
|
|
88 |
|
|
89 |
RETURN ( _MKSMALLINT(BEHAVIOR_INSTS) );
|
|
90 |
%}
|
|
91 |
|
|
92 |
"consistency check:
|
|
93 |
all class-entries must be behaviors;
|
|
94 |
all behaviors must be flagged so (in its class's flags)
|
|
95 |
(otherwise, VM will bark)
|
|
96 |
all non-behaviors may not be flagged
|
|
97 |
|
|
98 |
|bit|
|
|
99 |
bit := Class flagBehavior.
|
|
100 |
|
|
101 |
ObjectMemory allObjectsDo:[:o|
|
|
102 |
o isBehavior ifTrue:[
|
|
103 |
(o class flags bitTest:bit) ifFalse:[
|
|
104 |
self halt
|
|
105 |
].
|
|
106 |
] ifFalse:[
|
|
107 |
(o class flags bitTest:bit) ifTrue:[
|
|
108 |
self halt
|
|
109 |
].
|
|
110 |
].
|
|
111 |
o class isBehavior ifFalse:[
|
|
112 |
self halt
|
|
113 |
] ifTrue:[
|
|
114 |
(o class class flags bitTest:bit) ifFalse:[
|
|
115 |
self halt
|
|
116 |
]
|
|
117 |
]
|
|
118 |
]
|
|
119 |
"
|
|
120 |
!
|
|
121 |
|
|
122 |
flagBlock
|
|
123 |
"return the flag code which marks Block-like instances.
|
|
124 |
You have to check this single bit in the flag value when
|
|
125 |
checking for blocks."
|
|
126 |
|
|
127 |
%{ /* NOCONTEXT */
|
|
128 |
/* this is defined as a primitive to get defines from stc.h */
|
|
129 |
|
|
130 |
RETURN ( _MKSMALLINT(BLOCK_INSTS) );
|
|
131 |
%}
|
|
132 |
!
|
|
133 |
|
|
134 |
flagBlockContext
|
|
135 |
"return the flag code which marks BlockContext-like instances.
|
|
136 |
You have to check this single bit in the flag value when
|
|
137 |
checking for blockContexts."
|
|
138 |
|
|
139 |
%{ /* NOCONTEXT */
|
|
140 |
/* this is defined as a primitive to get defines from stc.h */
|
|
141 |
|
|
142 |
RETURN ( _MKSMALLINT(BCONTEXT_INSTS) );
|
|
143 |
%}
|
|
144 |
!
|
|
145 |
|
|
146 |
flagBytes
|
|
147 |
"return the flag code for byte-valued indexed instances.
|
|
148 |
You have to mask the flag value with indexMask when comparing
|
|
149 |
it with flagBytes."
|
|
150 |
|
|
151 |
%{ /* NOCONTEXT */
|
|
152 |
/* this is defined as a primitive to get defines from stc.h */
|
|
153 |
|
|
154 |
RETURN ( _MKSMALLINT(BYTEARRAY) );
|
|
155 |
%}
|
|
156 |
"
|
|
157 |
Behavior flagBytes
|
|
158 |
"
|
|
159 |
!
|
|
160 |
|
|
161 |
flagContext
|
|
162 |
"return the flag code which marks Context-like instances.
|
|
163 |
You have to check this single bit in the flag value when
|
|
164 |
checking for contexts."
|
|
165 |
|
|
166 |
%{ /* NOCONTEXT */
|
|
167 |
/* this is defined as a primitive to get defines from stc.h */
|
|
168 |
|
|
169 |
RETURN ( _MKSMALLINT(CONTEXT_INSTS) );
|
|
170 |
%}
|
|
171 |
!
|
|
172 |
|
|
173 |
flagDoubles
|
|
174 |
"return the flag code for double-valued indexed instances (i.e. 8-byte reals).
|
|
175 |
You have to mask the flag value with indexMask when comparing
|
|
176 |
it with flagDoubles."
|
|
177 |
|
|
178 |
%{ /* NOCONTEXT */
|
|
179 |
/* this is defined as a primitive to get defines from stc.h */
|
|
180 |
|
|
181 |
RETURN ( _MKSMALLINT(DOUBLEARRAY) );
|
|
182 |
%}
|
|
183 |
"
|
|
184 |
Behavior flagDoubles
|
|
185 |
"
|
|
186 |
!
|
|
187 |
|
|
188 |
flagFloat
|
|
189 |
"return the flag code which marks Float-like instances.
|
|
190 |
You have to check this single bit in the flag value when
|
|
191 |
checking for floats."
|
|
192 |
|
|
193 |
%{ /* NOCONTEXT */
|
|
194 |
/* this is defined as a primitive to get defines from stc.h */
|
|
195 |
|
|
196 |
RETURN ( _MKSMALLINT(FLOAT_INSTS) );
|
|
197 |
%}
|
|
198 |
!
|
|
199 |
|
|
200 |
flagFloats
|
|
201 |
"return the flag code for float-valued indexed instances (i.e. 4-byte reals).
|
|
202 |
You have to mask the flag value with indexMask when comparing
|
|
203 |
it with flagFloats."
|
|
204 |
|
|
205 |
%{ /* NOCONTEXT */
|
|
206 |
/* this is defined as a primitive to get defines from stc.h */
|
|
207 |
|
|
208 |
RETURN ( _MKSMALLINT(FLOATARRAY) );
|
|
209 |
%}
|
|
210 |
"
|
|
211 |
Behavior flagFloats
|
|
212 |
"
|
|
213 |
!
|
|
214 |
|
|
215 |
flagLongs
|
|
216 |
"return the flag code for long-valued indexed instances (i.e. 4-byte).
|
|
217 |
You have to mask the flag value with indexMask when comparing
|
|
218 |
it with flagLongs."
|
|
219 |
|
|
220 |
%{ /* NOCONTEXT */
|
|
221 |
/* this is defined as a primitive to get defines from stc.h */
|
|
222 |
|
|
223 |
RETURN ( _MKSMALLINT(LONGARRAY) );
|
|
224 |
%}
|
|
225 |
"
|
|
226 |
Behavior flagLongs
|
|
227 |
"
|
|
228 |
!
|
|
229 |
|
|
230 |
flagMethod
|
|
231 |
"return the flag code which marks Method-like instances.
|
|
232 |
You have to check this single bit in the flag value when
|
|
233 |
checking for methods."
|
|
234 |
|
|
235 |
%{ /* NOCONTEXT */
|
|
236 |
/* this is defined as a primitive to get defines from stc.h */
|
|
237 |
|
|
238 |
RETURN ( _MKSMALLINT(METHOD_INSTS) );
|
|
239 |
%}
|
|
240 |
!
|
|
241 |
|
|
242 |
flagNotIndexed
|
|
243 |
"return the flag code for non-indexed instances.
|
|
244 |
You have to mask the flag value with indexMask when comparing
|
|
245 |
it with flagNotIndexed."
|
|
246 |
|
|
247 |
^ 0
|
|
248 |
!
|
|
249 |
|
|
250 |
flagPointers
|
|
251 |
"return the flag code for pointer indexed instances (i.e. Array of object).
|
|
252 |
You have to mask the flag value with indexMask when comparing
|
|
253 |
it with flagPointers."
|
|
254 |
|
|
255 |
%{ /* NOCONTEXT */
|
|
256 |
/* this is defined as a primitive to get defines from stc.h */
|
|
257 |
|
|
258 |
RETURN ( _MKSMALLINT(POINTERARRAY) );
|
|
259 |
%}
|
|
260 |
"
|
|
261 |
Behavior flagPointers
|
|
262 |
"
|
|
263 |
!
|
|
264 |
|
|
265 |
flagSymbol
|
|
266 |
"return the flag code which marks Symbol-like instances.
|
|
267 |
You have to check this single bit in the flag value when
|
|
268 |
checking for symbols."
|
|
269 |
|
|
270 |
%{ /* NOCONTEXT */
|
|
271 |
/* this is defined as a primitive to get defines from stc.h */
|
|
272 |
|
|
273 |
RETURN ( _MKSMALLINT(SYMBOL_INSTS) );
|
|
274 |
%}
|
|
275 |
!
|
|
276 |
|
|
277 |
flagWeakPointers
|
|
278 |
"return the flag code for weak pointer indexed instances (i.e. WeakArray).
|
|
279 |
You have to mask the flag value with indexMask when comparing
|
|
280 |
it with flagWeakPointers."
|
|
281 |
|
|
282 |
%{ /* NOCONTEXT */
|
|
283 |
/* this is defined as a primitive to get defines from stc.h */
|
|
284 |
|
|
285 |
RETURN ( _MKSMALLINT(WKPOINTERARRAY) );
|
|
286 |
%}
|
|
287 |
!
|
|
288 |
|
|
289 |
flagWords
|
|
290 |
"return the flag code for word-valued indexed instances (i.e. 2-byte).
|
|
291 |
You have to mask the flag value with indexMask when comparing
|
|
292 |
it with flagWords."
|
|
293 |
|
|
294 |
%{ /* NOCONTEXT */
|
|
295 |
/* this is defined as a primitive to get defines from stc.h */
|
|
296 |
|
|
297 |
RETURN ( _MKSMALLINT(WORDARRAY) );
|
|
298 |
%}
|
|
299 |
"
|
|
300 |
Behavior flagWords
|
|
301 |
"
|
|
302 |
!
|
|
303 |
|
|
304 |
maskIndexType
|
|
305 |
"return a mask to extract all index-type bits"
|
|
306 |
|
|
307 |
%{ /* NOCONTEXT */
|
|
308 |
/* this is defined as a primitive to get defines from stc.h */
|
|
309 |
|
|
310 |
RETURN ( _MKSMALLINT(ARRAYMASK) );
|
|
311 |
%}
|
|
312 |
! !
|
|
313 |
|
|
314 |
!VMBehavior class methodsFor:'private'!
|
|
315 |
|
|
316 |
basicNew
|
|
317 |
"I dont know how to do this ..."
|
|
318 |
|
|
319 |
^ self subclassResponsibility
|
|
320 |
!
|
|
321 |
|
|
322 |
basicNew:size
|
|
323 |
"I dont know how to do this ..."
|
|
324 |
|
|
325 |
^ self subclassResponsibility
|
|
326 |
!
|
|
327 |
|
|
328 |
new
|
|
329 |
"I dont know how to do this ..."
|
|
330 |
|
|
331 |
^ self subclassResponsibility
|
|
332 |
!
|
|
333 |
|
|
334 |
new:size
|
|
335 |
"I dont know how to do this ..."
|
|
336 |
|
|
337 |
^ self subclassResponsibility
|
|
338 |
! !
|
|
339 |
|
|
340 |
!VMBehavior class methodsFor:'queries'!
|
|
341 |
|
|
342 |
isBuiltInClass
|
|
343 |
"this class is known by the run-time-system"
|
|
344 |
|
|
345 |
^ true
|
|
346 |
! !
|
|
347 |
|
|
348 |
!VMBehavior methodsFor:'accessing'!
|
|
349 |
|
|
350 |
flags
|
|
351 |
"return the receivers flag bits"
|
|
352 |
|
|
353 |
^ flags
|
|
354 |
!
|
|
355 |
|
|
356 |
methodArray
|
|
357 |
"return the receivers method array.
|
|
358 |
Notice: this is not compatible with ST-80."
|
|
359 |
|
|
360 |
^ methodArray
|
|
361 |
!
|
|
362 |
|
|
363 |
selectorArray
|
|
364 |
"return the receivers selector array.
|
|
365 |
Notice: this is not compatible with ST-80."
|
|
366 |
|
|
367 |
^ selectorArray
|
|
368 |
!
|
|
369 |
|
|
370 |
selectors:newSelectors methods:newMethods
|
|
371 |
"set both selector array and method array of the receiver,
|
|
372 |
and flush caches"
|
|
373 |
|
|
374 |
ObjectMemory flushCaches.
|
|
375 |
selectorArray := newSelectors.
|
|
376 |
methodArray := newMethods
|
|
377 |
!
|
|
378 |
|
|
379 |
superclass
|
|
380 |
"return the receivers superclass"
|
|
381 |
|
|
382 |
^ superclass
|
|
383 |
! !
|
|
384 |
|
|
385 |
!VMBehavior methodsFor:'private accessing'!
|
|
386 |
|
|
387 |
setFlags:aNumber
|
|
388 |
"set the flags.
|
|
389 |
Do NOT use it."
|
|
390 |
|
|
391 |
flags := aNumber
|
|
392 |
!
|
|
393 |
|
|
394 |
setMethodArray:anArray
|
|
395 |
"set the method array of the receiver.
|
|
396 |
this method is for special uses only - there will be no recompilation
|
|
397 |
and no change record written here.
|
|
398 |
NOT for general use."
|
|
399 |
|
|
400 |
methodArray := anArray
|
|
401 |
!
|
|
402 |
|
|
403 |
setSelectorArray:anArray
|
|
404 |
"set the selector array of the receiver.
|
|
405 |
this method is for special uses only - there will be no recompilation
|
|
406 |
and no change record written here.
|
|
407 |
NOT for general use."
|
|
408 |
|
|
409 |
selectorArray := anArray
|
|
410 |
!
|
|
411 |
|
|
412 |
setSelectors:sels methods:m
|
|
413 |
"set some inst vars.
|
|
414 |
this method is for special uses only - there will be no recompilation
|
|
415 |
and no change record written here;
|
|
416 |
Do NOT use it."
|
|
417 |
|
|
418 |
selectorArray := sels.
|
|
419 |
methodArray := m.
|
|
420 |
!
|
|
421 |
|
|
422 |
setSuperclass:aClass
|
|
423 |
"set the superclass of the receiver.
|
|
424 |
this method is for special uses only - there will be no recompilation
|
|
425 |
and no change record written here. Also, if the receiver class has
|
|
426 |
already been in use, future operation of the system is not guaranteed to
|
|
427 |
be correct, since no caches are flushed.
|
|
428 |
Therefore: do NOT use it; use Behavior>>superclass: (or flush the caches, at least)"
|
|
429 |
|
|
430 |
superclass := aClass
|
|
431 |
! !
|
|
432 |
|
|
433 |
!VMBehavior methodsFor:'queries'!
|
|
434 |
|
|
435 |
cachedLookupMethodFor:aSelector
|
|
436 |
"return the method, which would be executed if aSelector was sent to
|
|
437 |
an instance of the receiver. I.e. the selector arrays of the receiver
|
|
438 |
and all of its superclasses are searched for aSelector.
|
|
439 |
Return the method, or nil if instances do not understand aSelector.
|
|
440 |
This interface provides exactly the same information as #lookupMethodFor:,
|
|
441 |
but uses the lookup-cache in the VM for faster search.
|
|
442 |
However, keep in mind, that doing a lookup through the cache also adds new
|
|
443 |
entries and can thus slow down the system by polluting the cache with
|
|
444 |
irrelevant entries. (do NOT loop over all objects calling this method).
|
|
445 |
Does NOT (currently) handle MI"
|
|
446 |
|
|
447 |
%{ /* NOCONTEXT */
|
|
448 |
RETURN ( __lookup(self, aSelector, SENDER) );
|
|
449 |
%}
|
|
450 |
|
|
451 |
"
|
|
452 |
String cachedLookupMethodFor:#=
|
|
453 |
String cachedLookupMethodFor:#asOrderedCollection
|
|
454 |
"
|
|
455 |
!
|
|
456 |
|
|
457 |
isBits
|
|
458 |
"return true, if instances have indexed byte or short instance variables.
|
|
459 |
Ignore long, float and double arrays, since ST-80 code using isBits are probably
|
|
460 |
not prepared to handle them correctly."
|
|
461 |
|
|
462 |
%{ /* NOCONTEXT */
|
|
463 |
|
|
464 |
REGISTER int flags;
|
|
465 |
|
|
466 |
RETURN ( (((flags = (_intVal(_INST(flags)) & ARRAYMASK)) == BYTEARRAY)
|
|
467 |
|| (flags == WORDARRAY)) ? true : false );
|
|
468 |
%}
|
|
469 |
!
|
|
470 |
|
|
471 |
isBytes
|
|
472 |
"return true, if instances have indexed byte instance variables"
|
|
473 |
|
|
474 |
"this could be defined as:
|
|
475 |
^ (flags bitAnd:(VMBehavior maskIndexType)) == VMBehavior flagBytes
|
|
476 |
"
|
|
477 |
%{ /* NOCONTEXT */
|
|
478 |
|
|
479 |
RETURN ( ((_intVal(_INST(flags)) & ARRAYMASK) == BYTEARRAY) ? true : false );
|
|
480 |
%}
|
|
481 |
!
|
|
482 |
|
|
483 |
isDoubles
|
|
484 |
"return true, if instances have indexed double instance variables"
|
|
485 |
|
|
486 |
"this could be defined as:
|
|
487 |
^ (flags bitAnd:(VMBehavior maskIndexType)) == VMBehavior flagDoubles
|
|
488 |
"
|
|
489 |
%{ /* NOCONTEXT */
|
|
490 |
|
|
491 |
RETURN ( ((_intVal(_INST(flags)) & ARRAYMASK) == DOUBLEARRAY) ? true : false );
|
|
492 |
%}
|
|
493 |
!
|
|
494 |
|
|
495 |
isFixed
|
|
496 |
"return true, if instances do not have indexed instance variables"
|
|
497 |
|
|
498 |
"this could be defined as:
|
|
499 |
^ self isVariable not
|
|
500 |
"
|
|
501 |
|
|
502 |
%{ /* NOCONTEXT */
|
|
503 |
|
|
504 |
RETURN ( (_intVal(_INST(flags)) & ARRAYMASK) ? false : true );
|
|
505 |
%}
|
|
506 |
!
|
|
507 |
|
|
508 |
isFloats
|
|
509 |
"return true, if instances have indexed float instance variables"
|
|
510 |
|
|
511 |
"this could be defined as:
|
|
512 |
^ (flags bitAnd:(VMBehavior maskIndexType)) == VMBehavior flagFloats
|
|
513 |
"
|
|
514 |
%{ /* NOCONTEXT */
|
|
515 |
|
|
516 |
RETURN ( ((_intVal(_INST(flags)) & ARRAYMASK) == FLOATARRAY) ? true : false );
|
|
517 |
%}
|
|
518 |
!
|
|
519 |
|
|
520 |
isLongs
|
|
521 |
"return true, if instances have indexed long instance variables"
|
|
522 |
|
|
523 |
"this could be defined as:
|
|
524 |
^ (flags bitAnd:(VMBehavior maskIndexType)) == VMBehavior flagLongs
|
|
525 |
"
|
|
526 |
%{ /* NOCONTEXT */
|
|
527 |
|
|
528 |
RETURN ( ((_intVal(_INST(flags)) & ARRAYMASK) == LONGARRAY) ? true : false );
|
|
529 |
%}
|
|
530 |
!
|
|
531 |
|
|
532 |
isPointers
|
|
533 |
"return true, if instances have pointer instance variables
|
|
534 |
i.e. are either non-indexed or have indexed pointer variables"
|
|
535 |
|
|
536 |
"QUESTION: should we ignore WeakPointers ?"
|
|
537 |
|
|
538 |
%{ /* NOCONTEXT */
|
|
539 |
|
|
540 |
REGISTER int flags;
|
|
541 |
|
|
542 |
flags = _intVal(_INST(flags)) & ARRAYMASK;
|
|
543 |
switch (flags) {
|
|
544 |
default:
|
|
545 |
/* normal objects */
|
|
546 |
RETURN ( true );
|
|
547 |
|
|
548 |
case BYTEARRAY:
|
|
549 |
case WORDARRAY:
|
|
550 |
case LONGARRAY:
|
|
551 |
case FLOATARRAY:
|
|
552 |
case DOUBLEARRAY:
|
|
553 |
RETURN (false );
|
|
554 |
|
|
555 |
case WKPOINTERARRAY:
|
|
556 |
/* what about those ? */
|
|
557 |
RETURN (true );
|
|
558 |
}
|
|
559 |
%}
|
|
560 |
!
|
|
561 |
|
|
562 |
isVariable
|
|
563 |
"return true, if instances have indexed instance variables"
|
|
564 |
|
|
565 |
"this could be defined as:
|
|
566 |
^ (flags bitAnd:(VMBehavior maskIndexType)) ~~ 0
|
|
567 |
"
|
|
568 |
|
|
569 |
%{ /* NOCONTEXT */
|
|
570 |
|
|
571 |
RETURN ( (_intVal(_INST(flags)) & ARRAYMASK) ? true : false );
|
|
572 |
%}
|
|
573 |
!
|
|
574 |
|
|
575 |
isWords
|
|
576 |
"return true, if instances have indexed short instance variables"
|
|
577 |
|
|
578 |
"this could be defined as:
|
|
579 |
^ (flags bitAnd:(VMBehavior maskIndexType)) == VMBehavior flagWords
|
|
580 |
"
|
|
581 |
%{ /* NOCONTEXT */
|
|
582 |
|
|
583 |
RETURN ( ((_intVal(_INST(flags)) & ARRAYMASK) == WORDARRAY) ? true : false );
|
|
584 |
%}
|
|
585 |
!
|
|
586 |
|
|
587 |
lookupMethodFor:aSelector
|
|
588 |
"return the method, which would be executed if aSelector was sent to
|
|
589 |
an instance of the receiver. I.e. the selector arrays of the receiver
|
|
590 |
and all of its superclasses are searched for aSelector.
|
|
591 |
Return the method, or nil if instances do not understand aSelector.
|
|
592 |
EXPERIMENTAL: take care of multiple superclasses."
|
|
593 |
|
|
594 |
|m cls|
|
|
595 |
|
|
596 |
cls := self.
|
|
597 |
[cls notNil] whileTrue:[
|
|
598 |
m := cls compiledMethodAt:aSelector.
|
|
599 |
m notNil ifTrue:[^ m].
|
|
600 |
cls := cls superclass
|
|
601 |
].
|
|
602 |
^ nil
|
|
603 |
! !
|
|
604 |
|
|
605 |
!VMBehavior class methodsFor:'documentation'!
|
|
606 |
|
|
607 |
version
|
17909
|
608 |
^ '$Header: /cvs/stx/stx/libbasic/not_delivered/VMBehavior.st,v 1.1 1996/09/12 01:03:24 cg Exp $'
|
17735
|
609 |
! !
|
17846
|
610 |
VMBehavior initialize!
|
|
611 |
|
17909
|
612 |
|
17910
|
613 |
|
17911
|
614 |
|