author | Stefan Vogel <sv@exept.de> |
Thu, 22 Mar 2018 11:44:25 +0100 | |
changeset 22647 | 8d71f14e06fa |
parent 22385 | 1c6129237329 |
child 23024 | 83305ccbb6b0 |
permissions | -rw-r--r-- |
8728 | 1 |
" |
2 |
COPYRIGHT (c) 2004 by eXept Software AG |
|
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 |
" |
|
6844 | 12 |
"{ Package: 'stx:libbasic' }" |
13 |
||
18351 | 14 |
"{ NameSpace: Smalltalk }" |
15 |
||
6844 | 16 |
nil subclass:#ProtoObject |
17 |
instanceVariableNames:'' |
|
18 |
classVariableNames:'' |
|
19 |
poolDictionaries:'' |
|
6912 | 20 |
category:'Kernel-Objects' |
6844 | 21 |
! |
22 |
||
23 |
!ProtoObject class methodsFor:'documentation'! |
|
24 |
||
8728 | 25 |
copyright |
26 |
" |
|
27 |
COPYRIGHT (c) 2004 by eXept Software AG |
|
28 |
All Rights Reserved |
|
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 |
||
6844 | 39 |
documentation |
40 |
" |
|
41 |
a minimum object without much protocol; |
|
7659 | 42 |
Provides the minimum required to prevent inspectors from crashing, |
43 |
and debuggers from blocking. |
|
44 |
(i.e. instead of inheriting from nil, better inherit from this). |
|
45 |
||
6844 | 46 |
Named after a similar class found in Dolphin-Smalltalk. |
47 |
||
48 |
[author:] |
|
49 |
Claus Gittinger (not much authoring, though) |
|
50 |
" |
|
51 |
! ! |
|
52 |
||
21076 | 53 |
!ProtoObject class methodsFor:'helpers'! |
54 |
||
55 |
shallowCopyOf:anObject |
|
56 |
"return a copy of anObject with shared subobjects (a shallow copy) |
|
57 |
i.e. the copy shares referenced instvars with its original." |
|
58 |
||
59 |
%{ /* NOCONTEXT */ |
|
60 |
int ninsts, spc, sz; |
|
61 |
OBJ theCopy; |
|
62 |
OBJ cls = __qClass(anObject); |
|
63 |
int flags = __intVal(__ClassInstPtr(cls)->c_flags); |
|
64 |
||
65 |
/* |
|
66 |
* bail out for special objects .. |
|
67 |
*/ |
|
68 |
if (((flags & ~ARRAYMASK) == 0) |
|
69 |
&& ((flags & ARRAYMASK) != WKPOINTERARRAY)) { |
|
70 |
sz = __qSize(anObject); |
|
71 |
__PROTECT__(anObject); |
|
72 |
__qNew(theCopy, sz); /* OBJECT ALLOCATION */ |
|
73 |
__UNPROTECT__(anObject); |
|
74 |
if (theCopy) { |
|
75 |
cls = __qClass(anObject); |
|
76 |
spc = __qSpace(theCopy); |
|
77 |
||
78 |
theCopy->o_class = cls; __STORE_SPC(theCopy, cls, spc); |
|
79 |
||
80 |
sz = sz - OHDR_SIZE; |
|
81 |
if (sz) { |
|
82 |
char *src, *dst; |
|
83 |
||
84 |
src = (char *)(__InstPtr(anObject)->i_instvars); |
|
85 |
dst = (char *)(__InstPtr(theCopy)->i_instvars); |
|
86 |
#ifdef bcopy4 |
|
87 |
{ |
|
88 |
/* care for odd-number of longs */ |
|
89 |
int nW = sz >> 2; |
|
90 |
||
91 |
if (sz & 3) { |
|
92 |
nW++; |
|
93 |
} |
|
94 |
||
95 |
bcopy4(src, dst, nW); |
|
96 |
} |
|
97 |
#else |
|
98 |
bcopy(src, dst, sz); |
|
99 |
#endif |
|
100 |
||
101 |
flags &= ARRAYMASK; |
|
102 |
if (flags == POINTERARRAY) { |
|
103 |
ninsts = __BYTES2OBJS__(sz); |
|
104 |
} else { |
|
105 |
ninsts = __intVal(__ClassInstPtr(cls)->c_ninstvars); |
|
106 |
} |
|
107 |
if (ninsts) { |
|
108 |
do { |
|
109 |
OBJ el; |
|
110 |
||
111 |
el = __InstPtr(theCopy)->i_instvars[ninsts-1]; |
|
112 |
__STORE_SPC(theCopy, el, spc); |
|
113 |
} while (--ninsts); |
|
114 |
} |
|
115 |
} |
|
116 |
RETURN (theCopy); |
|
117 |
} |
|
118 |
} |
|
119 |
%}. |
|
120 |
"/ fallBack for special objects & memoryAllocation failure case |
|
121 |
||
21079 | 122 |
^ self error:'ProtoObject>>#shallowCopyOf: failed' |
123 |
! ! |
|
124 |
||
21085 | 125 |
!ProtoObject methodsFor:'error handling'! |
126 |
||
127 |
doesNotUnderstand:aMessage |
|
128 |
"this message is sent by the runtime system (VM) when |
|
129 |
a message is not understood by some object (i.e. there |
|
130 |
is no method for that selector). The original message has |
|
131 |
been packed into aMessage (i.e. the receiver, selector and |
|
132 |
any arguments) and the original receiver is then sent the |
|
133 |
#doesNotUnderstand: message. |
|
134 |
Here, we raise another signal which usually enters the debugger. |
|
135 |
You can of course redefine #doesNotUnderstand: in your classes |
|
136 |
to implement message delegation, |
|
137 |
or handle the MessageNotUnderstood exception gracefully." |
|
138 |
||
139 |
<context: #return> |
|
140 |
||
141 |
^ MessageNotUnderstood raiseRequestWith:aMessage |
|
142 |
! ! |
|
143 |
||
144 |
!ProtoObject methodsFor:'inspecting'! |
|
21079 | 145 |
|
22385 | 146 |
basicInspect |
21079 | 147 |
"this method is required to allow inspection of the object" |
148 |
||
22385 | 149 |
^ (Object compiledMethodAt:#basicInspect) |
21079 | 150 |
valueWithReceiver:self |
151 |
arguments:nil |
|
22385 | 152 |
selector:#basicInspect |
153 |
||
154 |
"Created: / 28-11-2017 / 19:23:47 / stefan" |
|
155 |
! |
|
156 |
||
157 |
inspect |
|
158 |
"{ Pragma: +optSpace }" |
|
159 |
||
160 |
"launch an inspector on the receiver. |
|
161 |
this method (or better: inspectorClass) can be redefined in subclasses |
|
162 |
to start special inspectors." |
|
163 |
||
164 |
|cls| |
|
165 |
||
166 |
cls := self inspectorClass. |
|
167 |
cls isNil ifTrue:[ |
|
168 |
self basicInspect. |
|
169 |
^ self. |
|
170 |
]. |
|
171 |
cls openOn:self |
|
172 |
||
173 |
" |
|
174 |
ProtoObject new inspect |
|
175 |
" |
|
176 |
||
177 |
"Modified: / 29-11-2017 / 10:39:38 / stefan" |
|
178 |
! |
|
179 |
||
180 |
inspectorClass |
|
181 |
Inspector ~~ MiniInspector ifTrue:[ |
|
182 |
|cls| |
|
183 |
||
184 |
cls := Smalltalk classNamed: #'Tools::Inspector2'. |
|
185 |
cls notNil ifTrue:[ |
|
186 |
^ cls. |
|
187 |
]. |
|
188 |
]. |
|
189 |
Inspector notNil ifTrue:[ |
|
190 |
^ Inspector. |
|
191 |
]. |
|
192 |
^ Smalltalk classNamed: #'InspectorView'. |
|
193 |
||
194 |
"Created: / 29-11-2017 / 10:20:09 / stefan" |
|
21079 | 195 |
! |
196 |
||
197 |
instVarAt:index |
|
198 |
"this method is required to allow inspection of the object" |
|
199 |
||
200 |
^ (Object compiledMethodAt:#instVarAt:) |
|
201 |
valueWithReceiver:self |
|
202 |
arguments:{index} |
|
203 |
selector:#instVarAt: |
|
21095 | 204 |
! |
205 |
||
21117 | 206 |
isKindOf:aBehavior |
207 |
"this method is required Behavior>>#allSubInstancesDo:" |
|
208 |
||
209 |
aBehavior == Object ifTrue:[^ true]. |
|
210 |
||
211 |
^ (Object compiledMethodAt:#isKindOf:) |
|
212 |
valueWithReceiver:self |
|
213 |
arguments:{aBehavior} |
|
214 |
selector:#isKindOf: |
|
215 |
! |
|
216 |
||
21113 | 217 |
perform:aSelector |
218 |
"this method is required to allow inspection of the object" |
|
219 |
||
220 |
^ self perform:aSelector withArguments:#(). |
|
221 |
! |
|
222 |
||
223 |
perform:aSelector with:arg1 |
|
224 |
"this method is required to allow inspection of the object" |
|
225 |
||
226 |
^ self perform:aSelector withArguments:{arg1}. |
|
227 |
! |
|
228 |
||
229 |
perform:aSelector with:arg1 with:arg2 |
|
230 |
"this method is required to allow inspection of the object" |
|
231 |
||
232 |
^ self perform:aSelector withArguments:{arg1. arg2}. |
|
233 |
! |
|
234 |
||
235 |
perform:aSelector with:arg1 with:arg2 with:arg3 |
|
236 |
"this method is required to allow inspection of the object" |
|
237 |
||
238 |
^ self perform:aSelector withArguments:{arg1. arg2. arg3}. |
|
239 |
! |
|
240 |
||
241 |
perform:aSelector with:arg1 with:arg2 with:arg3 with:arg4 |
|
242 |
"this method is required to allow inspection of the object" |
|
243 |
||
244 |
^ self perform:aSelector withArguments:{arg1. arg2. arg3. arg4}. |
|
245 |
! |
|
246 |
||
247 |
perform:aSelector with:arg1 with:arg2 with:arg3 with:arg4 with:arg5 |
|
248 |
"this method is required to allow inspection of the object" |
|
249 |
||
250 |
^ self perform:aSelector withArguments:{arg1. arg2. arg3. arg4. arg5}. |
|
251 |
! |
|
252 |
||
253 |
perform:aSelector with:arg1 with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 |
|
254 |
"this method is required to allow inspection of the object" |
|
255 |
||
256 |
^ self perform:aSelector withArguments:{arg1. arg2. arg3. arg4. arg5. arg6}. |
|
257 |
! |
|
258 |
||
259 |
perform:aSelector withArguments:argArray |
|
260 |
"send the message aSelector with all args taken from argArray |
|
261 |
to the receiver. |
|
262 |
||
263 |
1-to-1 Copy from the same method in Object!!" |
|
264 |
||
265 |
|numberOfArgs a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15| |
|
266 |
||
267 |
%{ |
|
268 |
#ifdef __SCHTEAM__ |
|
269 |
return context.PERFORM_WITH_ARGUMENTS(self, aSelector, argArray); |
|
270 |
#else |
|
271 |
REGISTER OBJ *argP; |
|
272 |
int nargs; |
|
273 |
OBJ l; |
|
274 |
||
275 |
if (__isArrayLike(argArray)) { |
|
276 |
nargs = __arraySize(argArray); |
|
277 |
argP = __arrayVal(argArray); |
|
278 |
} else { |
|
279 |
if (__isNonNilObject(argArray)) { |
|
280 |
static struct inlineCache ilcSize = __ILC0(@line); |
|
281 |
int i; |
|
282 |
||
283 |
numberOfArgs = (*ilcSize.ilc_func)(argArray, @symbol(size), nil, &ilcSize); |
|
284 |
if (!__isSmallInteger(numberOfArgs)) |
|
285 |
goto bad; |
|
286 |
nargs = __intVal(numberOfArgs); |
|
287 |
argP = (OBJ *)(&a1); |
|
288 |
for (i=1; i <= nargs; i++) { |
|
289 |
*argP++ = __AT_(argArray, __mkSmallInteger(i)); |
|
290 |
} |
|
291 |
argP = (OBJ *)(&a1); |
|
292 |
} else { |
|
293 |
nargs = 0; |
|
294 |
} |
|
295 |
} |
|
296 |
switch (nargs) { |
|
297 |
case 0: |
|
298 |
if (InterruptPending == nil) { |
|
299 |
static OBJ last0_0 = nil; static struct inlineCache ilc0_0 = __ILCPERF0(@line); |
|
300 |
static OBJ last0_1 = nil; static struct inlineCache ilc0_1 = __ILCPERF0(@line); |
|
301 |
static OBJ last0_2 = nil; static struct inlineCache ilc0_2 = __ILCPERF0(@line); |
|
302 |
static OBJ last0_3 = nil; static struct inlineCache ilc0_3 = __ILCPERF0(@line); |
|
303 |
static int flip0 = 0; |
|
304 |
struct inlineCache *pIlc; |
|
305 |
||
306 |
if (aSelector == last0_0) { |
|
307 |
pIlc = &ilc0_0; |
|
308 |
} else if (aSelector == last0_1) { |
|
309 |
pIlc = &ilc0_1; |
|
310 |
} else if (aSelector == last0_2) { |
|
311 |
pIlc = &ilc0_2; |
|
312 |
} else if (aSelector == last0_3) { |
|
313 |
pIlc = &ilc0_3; |
|
314 |
} else { |
|
315 |
if (flip0 == 0) { |
|
316 |
pIlc = &ilc0_0; |
|
317 |
flip0 = 1; |
|
318 |
last0_0 = aSelector; |
|
319 |
} else if (flip0 == 1) { |
|
320 |
pIlc = &ilc0_1; |
|
321 |
flip0 = 2; |
|
322 |
last0_1 = aSelector; |
|
323 |
} else if (flip0 == 2) { |
|
324 |
pIlc = &ilc0_2; |
|
325 |
flip0 = 3; |
|
326 |
last0_2 = aSelector; |
|
327 |
} else { |
|
328 |
pIlc = &ilc0_3; |
|
329 |
flip0 = 0; |
|
330 |
last0_3 = aSelector; |
|
331 |
} |
|
332 |
||
333 |
pIlc->ilc_func = __SEND0ADDR__; |
|
334 |
if (pIlc->ilc_poly) { |
|
335 |
__flushPolyCache(pIlc->ilc_poly); |
|
336 |
pIlc->ilc_poly = 0; |
|
337 |
} |
|
338 |
} |
|
339 |
RETURN ((*pIlc->ilc_func)(self, aSelector, nil, pIlc)); |
|
340 |
} else { |
|
341 |
static struct inlineCache ilc0 = __DUMMYILCSELF0(@line+1); |
|
342 |
RETURN (_SEND0(self, aSelector, nil, &ilc0)); |
|
343 |
} |
|
344 |
||
345 |
case 1: |
|
346 |
if (InterruptPending == nil) { |
|
347 |
static OBJ last1_0 = nil; static struct inlineCache ilc1_0 = __ILCPERF1(@line); |
|
348 |
static OBJ last1_1 = nil; static struct inlineCache ilc1_1 = __ILCPERF1(@line); |
|
349 |
static OBJ last1_2 = nil; static struct inlineCache ilc1_2 = __ILCPERF1(@line); |
|
350 |
static OBJ last1_3 = nil; static struct inlineCache ilc1_3 = __ILCPERF1(@line); |
|
351 |
static int flip1 = 0; |
|
352 |
struct inlineCache *pIlc; |
|
353 |
||
354 |
if (aSelector == last1_0) { |
|
355 |
pIlc = &ilc1_0; |
|
356 |
} else if (aSelector == last1_1) { |
|
357 |
pIlc = &ilc1_1; |
|
358 |
} else if (aSelector == last1_2) { |
|
359 |
pIlc = &ilc1_2; |
|
360 |
} else if (aSelector == last1_3) { |
|
361 |
pIlc = &ilc1_3; |
|
362 |
} else { |
|
363 |
if (flip1 == 0) { |
|
364 |
pIlc = &ilc1_0; |
|
365 |
flip1 = 1; |
|
366 |
last1_0 = aSelector; |
|
367 |
} else if (flip1 == 1) { |
|
368 |
pIlc = &ilc1_1; |
|
369 |
flip1 = 2; |
|
370 |
last1_1 = aSelector; |
|
371 |
} else if (flip1 == 2) { |
|
372 |
pIlc = &ilc1_2; |
|
373 |
flip1 = 3; |
|
374 |
last1_2 = aSelector; |
|
375 |
} else { |
|
376 |
pIlc = &ilc1_3; |
|
377 |
flip1 = 0; |
|
378 |
last1_3 = aSelector; |
|
379 |
} |
|
380 |
||
381 |
pIlc->ilc_func = __SEND1ADDR__; |
|
382 |
if (pIlc->ilc_poly) { |
|
383 |
__flushPolyCache(pIlc->ilc_poly); |
|
384 |
pIlc->ilc_poly = 0; |
|
385 |
} |
|
386 |
} |
|
387 |
RETURN ((*pIlc->ilc_func)(self, aSelector, nil, pIlc, argP[0])); |
|
388 |
} else { |
|
389 |
static struct inlineCache ilc1 = __DUMMYILCSELF1(@line+1); |
|
390 |
RETURN (_SEND1(self, aSelector, nil, &ilc1, argP[0])); |
|
391 |
} |
|
392 |
||
393 |
case 2: |
|
394 |
if (InterruptPending == nil) { |
|
395 |
static OBJ last2_0 = nil; static struct inlineCache ilc2_0 = __ILCPERF2(@line); |
|
396 |
static OBJ last2_1 = nil; static struct inlineCache ilc2_1 = __ILCPERF2(@line); |
|
397 |
static int flip2 = 0; |
|
398 |
struct inlineCache *pIlc; |
|
399 |
||
400 |
if (aSelector == last2_0) { |
|
401 |
pIlc = &ilc2_0; |
|
402 |
} else if (aSelector == last2_1) { |
|
403 |
pIlc = &ilc2_1; |
|
404 |
} else { |
|
405 |
if (flip2 == 0) { |
|
406 |
pIlc = &ilc2_0; |
|
407 |
flip2 = 1; |
|
408 |
last2_0 = aSelector; |
|
409 |
} else { |
|
410 |
pIlc = &ilc2_1; |
|
411 |
flip2 = 0; |
|
412 |
last2_1 = aSelector; |
|
413 |
} |
|
414 |
||
415 |
pIlc->ilc_func = __SEND2ADDR__; |
|
416 |
if (pIlc->ilc_poly) { |
|
417 |
__flushPolyCache(pIlc->ilc_poly); |
|
418 |
pIlc->ilc_poly = 0; |
|
419 |
} |
|
420 |
} |
|
421 |
RETURN ((*pIlc->ilc_func)(self, aSelector, nil, pIlc, argP[0], argP[1])); |
|
422 |
} else { |
|
423 |
static struct inlineCache ilc2 = __DUMMYILCSELF2(@line+1); |
|
424 |
RETURN (_SEND2(self, aSelector, nil, &ilc2, argP[0], argP[1])); |
|
425 |
} |
|
426 |
||
427 |
case 3: |
|
428 |
if (InterruptPending == nil) { |
|
429 |
static OBJ last3_0 = nil; static struct inlineCache ilc3_0 = __ILCPERF3(@line); |
|
430 |
static OBJ last3_1 = nil; static struct inlineCache ilc3_1 = __ILCPERF3(@line); |
|
431 |
static int flip3 = 0; |
|
432 |
struct inlineCache *pIlc; |
|
433 |
||
434 |
if (aSelector == last3_0) { |
|
435 |
pIlc = &ilc3_0; |
|
436 |
} else if (aSelector == last3_1) { |
|
437 |
pIlc = &ilc3_1; |
|
438 |
} else { |
|
439 |
if (flip3 == 0) { |
|
440 |
pIlc = &ilc3_0; |
|
441 |
flip3 = 1; |
|
442 |
last3_0 = aSelector; |
|
443 |
} else { |
|
444 |
pIlc = &ilc3_1; |
|
445 |
flip3 = 0; |
|
446 |
last3_1 = aSelector; |
|
447 |
} |
|
448 |
||
449 |
pIlc->ilc_func = __SEND3ADDR__; |
|
450 |
if (pIlc->ilc_poly) { |
|
451 |
__flushPolyCache(pIlc->ilc_poly); |
|
452 |
pIlc->ilc_poly = 0; |
|
453 |
} |
|
454 |
} |
|
455 |
RETURN ((*pIlc->ilc_func)(self, aSelector, nil, pIlc, argP[0], argP[1], argP[2])); |
|
456 |
} else { |
|
457 |
static struct inlineCache ilc3 = __DUMMYILCSELF3(@line+1); |
|
458 |
RETURN (_SEND3(self, aSelector, nil, &ilc3, argP[0], argP[1], argP[2])); |
|
459 |
} |
|
460 |
||
461 |
case 4: |
|
462 |
{ |
|
463 |
static OBJ last4 = nil; static struct inlineCache ilc4 = __ILCPERF4(@line); |
|
464 |
||
465 |
if ((InterruptPending != nil) || (aSelector != last4)) { |
|
466 |
ilc4.ilc_func = __SEND4ADDR__; |
|
467 |
if (ilc4.ilc_poly) { |
|
468 |
__flushPolyCache(ilc4.ilc_poly); |
|
469 |
ilc4.ilc_poly = 0; |
|
470 |
} |
|
471 |
last4 = aSelector; |
|
472 |
} |
|
473 |
RETURN ( (*ilc4.ilc_func)(self, aSelector, nil, &ilc4, |
|
474 |
argP[0], argP[1], argP[2], argP[3])); |
|
475 |
} |
|
476 |
||
477 |
case 5: |
|
478 |
{ |
|
479 |
static OBJ last5 = nil; static struct inlineCache ilc5 = __ILCPERF5(@line); |
|
480 |
||
481 |
if ((InterruptPending != nil) || (aSelector != last5)) { |
|
482 |
ilc5.ilc_func = __SEND5ADDR__; |
|
483 |
if (ilc5.ilc_poly) { |
|
484 |
__flushPolyCache(ilc5.ilc_poly); |
|
485 |
ilc5.ilc_poly = 0; |
|
486 |
} |
|
487 |
last5 = aSelector; |
|
488 |
} |
|
489 |
RETURN ( (*ilc5.ilc_func)(self, aSelector, nil, &ilc5, |
|
490 |
argP[0], argP[1], argP[2], argP[3], argP[4])); |
|
491 |
} |
|
492 |
||
493 |
case 6: |
|
494 |
{ |
|
495 |
static OBJ last6 = nil; static struct inlineCache ilc6 = __ILCPERF6(@line); |
|
496 |
||
497 |
if ((InterruptPending != nil) || (aSelector != last6)) { |
|
498 |
ilc6.ilc_func = __SEND6ADDR__; |
|
499 |
if (ilc6.ilc_poly) { |
|
500 |
__flushPolyCache(ilc6.ilc_poly); |
|
501 |
ilc6.ilc_poly = 0; |
|
502 |
} |
|
503 |
last6 = aSelector; |
|
504 |
} |
|
505 |
RETURN ( (*ilc6.ilc_func)(self, aSelector, nil, &ilc6, |
|
506 |
argP[0], argP[1], argP[2], argP[3], argP[4], |
|
507 |
argP[5])); |
|
508 |
} |
|
509 |
||
510 |
case 7: |
|
511 |
{ |
|
512 |
static OBJ last7 = nil; static struct inlineCache ilc7 = __ILCPERF7(@line); |
|
513 |
||
514 |
if ((InterruptPending != nil) || (aSelector != last7)) { |
|
515 |
ilc7.ilc_func = __SEND7ADDR__; |
|
516 |
if (ilc7.ilc_poly) { |
|
517 |
__flushPolyCache(ilc7.ilc_poly); |
|
518 |
ilc7.ilc_poly = 0; |
|
519 |
} |
|
520 |
last7 = aSelector; |
|
521 |
} |
|
522 |
RETURN ( (*ilc7.ilc_func)(self, aSelector, nil, &ilc7, |
|
523 |
argP[0], argP[1], argP[2], argP[3], argP[4], |
|
524 |
argP[5], argP[6])); |
|
525 |
} |
|
526 |
||
527 |
case 8: |
|
528 |
{ |
|
529 |
static OBJ last8 = nil; static struct inlineCache ilc8 = __ILCPERF8(@line); |
|
530 |
||
531 |
if ((InterruptPending != nil) || (aSelector != last8)) { |
|
532 |
ilc8.ilc_func = __SEND8ADDR__; |
|
533 |
if (ilc8.ilc_poly) { |
|
534 |
__flushPolyCache(ilc8.ilc_poly); |
|
535 |
ilc8.ilc_poly = 0; |
|
536 |
} |
|
537 |
last8 = aSelector; |
|
538 |
} |
|
539 |
RETURN ( (*ilc8.ilc_func)(self, aSelector, nil, &ilc8, |
|
540 |
argP[0], argP[1], argP[2], argP[3], argP[4], |
|
541 |
argP[5], argP[6], argP[7])); |
|
542 |
} |
|
543 |
||
544 |
case 9: |
|
545 |
{ |
|
546 |
static OBJ last9 = nil; static struct inlineCache ilc9 = __ILCPERF9(@line); |
|
547 |
||
548 |
if ((InterruptPending != nil) || (aSelector != last9)) { |
|
549 |
ilc9.ilc_func = __SEND9ADDR__; |
|
550 |
if (ilc9.ilc_poly) { |
|
551 |
__flushPolyCache(ilc9.ilc_poly); |
|
552 |
ilc9.ilc_poly = 0; |
|
553 |
} |
|
554 |
last9 = aSelector; |
|
555 |
} |
|
556 |
RETURN ( (*ilc9.ilc_func)(self, aSelector, nil, &ilc9, |
|
557 |
argP[0], argP[1], argP[2], argP[3], argP[4], |
|
558 |
argP[5], argP[6], argP[7], argP[8])); |
|
559 |
} |
|
560 |
||
561 |
case 10: |
|
562 |
{ |
|
563 |
static OBJ last10 = nil; static struct inlineCache ilc10 = __ILCPERF10(@line); |
|
564 |
||
565 |
if ((InterruptPending != nil) || (aSelector != last10)) { |
|
566 |
ilc10.ilc_func = __SEND10ADDR__; |
|
567 |
if (ilc10.ilc_poly) { |
|
568 |
__flushPolyCache(ilc10.ilc_poly); |
|
569 |
ilc10.ilc_poly = 0; |
|
570 |
} |
|
571 |
last10 = aSelector; |
|
572 |
} |
|
573 |
RETURN ( (*ilc10.ilc_func)(self, aSelector, nil, &ilc10, |
|
574 |
argP[0], argP[1], argP[2], argP[3], argP[4], |
|
575 |
argP[5], argP[6], argP[7], argP[8], argP[9])); |
|
576 |
} |
|
577 |
||
578 |
case 11: |
|
579 |
{ |
|
580 |
static OBJ last11 = nil; static struct inlineCache ilc11 = __ILCPERF11(@line); |
|
581 |
||
582 |
if ((InterruptPending != nil) || (aSelector != last11)) { |
|
583 |
ilc11.ilc_func = __SEND11ADDR__; |
|
584 |
if (ilc11.ilc_poly) { |
|
585 |
__flushPolyCache(ilc11.ilc_poly); |
|
586 |
ilc11.ilc_poly = 0; |
|
587 |
} |
|
588 |
last11 = aSelector; |
|
589 |
} |
|
590 |
RETURN ( (*ilc11.ilc_func)(self, aSelector, nil, &ilc11, |
|
591 |
argP[0], argP[1], argP[2], argP[3], argP[4], |
|
592 |
argP[5], argP[6], argP[7], argP[8], argP[9], |
|
593 |
argP[10])); |
|
594 |
} |
|
595 |
||
596 |
case 12: |
|
597 |
{ |
|
598 |
static OBJ last12 = nil; static struct inlineCache ilc12 = __ILCPERF12(@line); |
|
599 |
||
600 |
if ((InterruptPending != nil) || (aSelector != last12)) { |
|
601 |
ilc12.ilc_func = __SEND12ADDR__; |
|
602 |
if (ilc12.ilc_poly) { |
|
603 |
__flushPolyCache(ilc12.ilc_poly); |
|
604 |
ilc12.ilc_poly = 0; |
|
605 |
} |
|
606 |
last12 = aSelector; |
|
607 |
} |
|
608 |
RETURN ( (*ilc12.ilc_func)(self, aSelector, nil, &ilc12, |
|
609 |
argP[0], argP[1], argP[2], argP[3], argP[4], |
|
610 |
argP[5], argP[6], argP[7], argP[8], argP[9], |
|
611 |
argP[10], argP[11])); |
|
612 |
} |
|
613 |
||
614 |
case 13: |
|
615 |
{ |
|
616 |
static OBJ last13 = nil; static struct inlineCache ilc13 = __ILCPERF13(@line); |
|
617 |
||
618 |
if ((InterruptPending != nil) || (aSelector != last13)) { |
|
619 |
ilc13.ilc_func = __SEND13ADDR__; |
|
620 |
if (ilc13.ilc_poly) { |
|
621 |
__flushPolyCache(ilc13.ilc_poly); |
|
622 |
ilc13.ilc_poly = 0; |
|
623 |
} |
|
624 |
last13 = aSelector; |
|
625 |
} |
|
626 |
RETURN ( (*ilc13.ilc_func)(self, aSelector, nil, &ilc13, |
|
627 |
argP[0], argP[1], argP[2], argP[3], argP[4], |
|
628 |
argP[5], argP[6], argP[7], argP[8], argP[9], |
|
629 |
argP[10], argP[11], argP[12])); |
|
630 |
} |
|
631 |
||
632 |
case 14: |
|
633 |
{ |
|
634 |
static OBJ last14 = nil; static struct inlineCache ilc14 = __ILCPERF14(@line); |
|
635 |
||
636 |
if ((InterruptPending != nil) || (aSelector != last14)) { |
|
637 |
ilc14.ilc_func = __SEND14ADDR__; |
|
638 |
if (ilc14.ilc_poly) { |
|
639 |
__flushPolyCache(ilc14.ilc_poly); |
|
640 |
ilc14.ilc_poly = 0; |
|
641 |
} |
|
642 |
last14 = aSelector; |
|
643 |
} |
|
644 |
RETURN ( (*ilc14.ilc_func)(self, aSelector, nil, &ilc14, |
|
645 |
argP[0], argP[1], argP[2], argP[3], argP[4], |
|
646 |
argP[5], argP[6], argP[7], argP[8], argP[9], |
|
647 |
argP[10], argP[11], argP[12], argP[13])); |
|
648 |
} |
|
649 |
||
650 |
case 15: |
|
651 |
{ |
|
652 |
static OBJ last15 = nil; static struct inlineCache ilc15 = __ILCPERF15(@line); |
|
653 |
||
654 |
if ((InterruptPending != nil) || (aSelector != last15)) { |
|
655 |
ilc15.ilc_func = __SEND15ADDR__; |
|
656 |
if (ilc15.ilc_poly) { |
|
657 |
__flushPolyCache(ilc15.ilc_poly); |
|
658 |
ilc15.ilc_poly = 0; |
|
659 |
} |
|
660 |
last15 = aSelector; |
|
661 |
} |
|
662 |
RETURN ( (*ilc15.ilc_func)(self, aSelector, nil, &ilc15, |
|
663 |
argP[0], argP[1], argP[2], argP[3], argP[4], |
|
664 |
argP[5], argP[6], argP[7], argP[8], argP[9], |
|
665 |
argP[10], argP[11], argP[12], argP[13], |
|
666 |
argP[14])); |
|
667 |
} |
|
668 |
} |
|
669 |
bad:; |
|
670 |
#endif |
|
671 |
%}. |
|
672 |
||
673 |
"/ arrive here, if bad number of arguments (too many) |
|
674 |
"/ ST/X (currently) only allows up to 15 method arguments |
|
675 |
||
676 |
^ self primitiveFailed |
|
677 |
! |
|
678 |
||
21095 | 679 |
referencesAny:anObject |
680 |
"this method is required to allow inspection of the object" |
|
681 |
||
682 |
^ (Object compiledMethodAt:#referencesAny:) |
|
683 |
valueWithReceiver:self |
|
684 |
arguments:{anObject} |
|
685 |
selector:#referencesAny |
|
686 |
! |
|
687 |
||
22001 | 688 |
referencesInstanceOf:anObject |
689 |
"this method is required to allow inspection of the object" |
|
690 |
||
691 |
^ false |
|
692 |
||
693 |
"Created: / 13-07-2017 / 12:12:45 / Maren" |
|
694 |
! |
|
695 |
||
21095 | 696 |
referencesObject:anObject |
697 |
"this method is required to allow inspection of the object" |
|
698 |
||
699 |
^ (Object compiledMethodAt:#referencesObject:) |
|
700 |
valueWithReceiver:self |
|
701 |
arguments:{anObject} |
|
702 |
selector:#referencesObject |
|
21076 | 703 |
! ! |
704 |
||
6844 | 705 |
!ProtoObject methodsFor:'queries'! |
706 |
||
22385 | 707 |
basicSize |
708 |
"this method is required to allow restore of the object" |
|
709 |
||
710 |
^ (Object compiledMethodAt:#basicSize) |
|
711 |
valueWithReceiver:self |
|
712 |
arguments:nil |
|
713 |
selector:#basicSize |
|
714 |
||
715 |
"Created: / 28-11-2017 / 19:30:09 / stefan" |
|
716 |
! |
|
717 |
||
6844 | 718 |
class |
19678 | 719 |
"return the receiver's class" |
6844 | 720 |
|
721 |
%{ /* NOCONTEXT */ |
|
722 |
||
723 |
RETURN ( __Class(self) ); |
|
724 |
%} |
|
725 |
||
726 |
" |
|
727 |
*** WARNING |
|
728 |
*** |
|
729 |
*** this method has been automatically created, |
|
730 |
*** since all nil-subclasses should respond to some minimum required |
|
731 |
*** protocol. |
|
732 |
*** |
|
733 |
*** Inspection and/or debugging of instances may not be possible, |
|
734 |
*** if you remove/change this method. |
|
735 |
" |
|
19678 | 736 |
|
737 |
"Modified (comment): / 30-04-2016 / 15:51:12 / cg" |
|
10589 | 738 |
! |
739 |
||
740 |
identityHash |
|
741 |
"return an Integer useful as a hash key for the receiver. |
|
742 |
This hash should return same values for the same object (i.e. use |
|
743 |
this to hash on identity of objects). |
|
744 |
||
745 |
We cannot use the Objects address (as other smalltalks do) since |
|
746 |
no object-table exists and the hashval must not change when objects |
|
747 |
are moved by the collector. Therefore we assign each object a unique |
|
748 |
Id in the object header itself as its hashed upon. |
|
749 |
(luckily we have 11 bits spare to do this - unluckily its only 11 bits). |
|
750 |
Time will show, if 11 bits are enough; if not, another entry in the |
|
751 |
object header will be needed, adding 4 bytes to every object. Alternatively, |
|
752 |
hashed-upon objects could add an instvar containing the hash value." |
|
753 |
||
754 |
%{ /* NOCONTEXT */ |
|
755 |
||
756 |
REGISTER unsigned INT hash; |
|
757 |
static unsigned nextHash = 0; |
|
758 |
||
759 |
if (__isNonNilObject(self)) { |
|
760 |
hash = __GET_HASH(self); |
|
761 |
if (hash == 0) { |
|
762 |
/* has no hash yet */ |
|
763 |
||
764 |
if (++nextHash > __MAX_HASH__) { |
|
765 |
nextHash = 1; |
|
766 |
} |
|
767 |
hash = nextHash; |
|
768 |
__SET_HASH(self, hash); |
|
769 |
} |
|
770 |
||
771 |
/* |
|
772 |
* now, we got 11 bits for hashing; |
|
773 |
* make it as large as possible; since most hashers use the returned |
|
774 |
* key and take it modulo some prime number, this will allow for |
|
775 |
* better distribution (i.e. bigger empty spaces) in hashed collection. |
|
776 |
*/ |
|
777 |
hash = __MAKE_HASH__(hash); |
|
778 |
RETURN ( __mkSmallInteger(hash) ); |
|
779 |
} |
|
780 |
%}. |
|
781 |
^ 0 "never reached, since redefined in UndefinedObject and SmallInteger" |
|
782 |
||
783 |
"Created: / 31-05-2007 / 23:18:40 / cg" |
|
6844 | 784 |
! ! |
785 |
||
786 |
!ProtoObject methodsFor:'testing'! |
|
787 |
||
12571 | 788 |
ifNil:aBlock |
789 |
^ self |
|
790 |
! |
|
791 |
||
792 |
ifNotNil:aBlockOrValue |
|
22647 | 793 |
^ aBlockOrValue valueWithOptionalArgument:self |
21665 | 794 |
|
22647 | 795 |
"Modified: / 22-03-2018 / 11:39:11 / stefan" |
12571 | 796 |
! |
797 |
||
6844 | 798 |
isBehavior |
18351 | 799 |
"return true, if the receiver is describing another object's behavior. |
9222 | 800 |
False is returned here - the method is only redefined in Behavior." |
801 |
||
6844 | 802 |
^ false |
7661
71d2cac1b959
some tests aded to avoid trouble in debugger
Claus Gittinger <cg@exept.de>
parents:
7659
diff
changeset
|
803 |
! |
6844 | 804 |
|
7661
71d2cac1b959
some tests aded to avoid trouble in debugger
Claus Gittinger <cg@exept.de>
parents:
7659
diff
changeset
|
805 |
isBlock |
71d2cac1b959
some tests aded to avoid trouble in debugger
Claus Gittinger <cg@exept.de>
parents:
7659
diff
changeset
|
806 |
^ false |
7659 | 807 |
! |
808 |
||
21085 | 809 |
isBridgeProxy |
810 |
^ false |
|
811 |
! |
|
812 |
||
7659 | 813 |
isException |
814 |
^ false |
|
815 |
! |
|
816 |
||
817 |
isExceptionHandler |
|
818 |
^ false |
|
819 |
! |
|
820 |
||
821 |
isJavaObject |
|
822 |
^ false |
|
10589 | 823 |
! |
824 |
||
825 |
isLazyValue |
|
826 |
^ false |
|
827 |
||
828 |
"Created: / 03-06-2007 / 14:02:12 / cg" |
|
10591 | 829 |
! |
830 |
||
831 |
isLiteral |
|
832 |
^ false |
|
833 |
||
834 |
"Created: / 04-06-2007 / 17:19:10 / cg" |
|
21075 | 835 |
! |
836 |
||
837 |
isNil |
|
838 |
^ false. |
|
839 |
! |
|
840 |
||
841 |
isProtoObject |
|
842 |
^ true |
|
6844 | 843 |
! ! |
844 |
||
845 |
!ProtoObject class methodsFor:'documentation'! |
|
846 |
||
847 |
version |
|
19678 | 848 |
^ '$Header$' |
12571 | 849 |
! |
850 |
||
851 |
version_CVS |
|
19678 | 852 |
^ '$Header$' |
6844 | 853 |
! ! |
16158 | 854 |