author | Stefan Vogel <sv@exept.de> |
Thu, 08 Dec 2016 11:36:24 +0100 | |
changeset 21113 | b2e1c03c663b |
parent 21095 | 395754cfc670 |
child 21117 | 43e651d0a0a3 |
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 |
|
146 |
inspect |
|
147 |
"this method is required to allow inspection of the object" |
|
148 |
||
149 |
^ (Object compiledMethodAt:#inspect) |
|
150 |
valueWithReceiver:self |
|
151 |
arguments:nil |
|
152 |
selector:#inspect |
|
153 |
! |
|
154 |
||
155 |
instVarAt:index |
|
156 |
"this method is required to allow inspection of the object" |
|
157 |
||
158 |
^ (Object compiledMethodAt:#instVarAt:) |
|
159 |
valueWithReceiver:self |
|
160 |
arguments:{index} |
|
161 |
selector:#instVarAt: |
|
21095 | 162 |
! |
163 |
||
21113 | 164 |
perform:aSelector |
165 |
"this method is required to allow inspection of the object" |
|
166 |
||
167 |
^ self perform:aSelector withArguments:#(). |
|
168 |
! |
|
169 |
||
170 |
perform:aSelector with:arg1 |
|
171 |
"this method is required to allow inspection of the object" |
|
172 |
||
173 |
^ self perform:aSelector withArguments:{arg1}. |
|
174 |
! |
|
175 |
||
176 |
perform:aSelector with:arg1 with:arg2 |
|
177 |
"this method is required to allow inspection of the object" |
|
178 |
||
179 |
^ self perform:aSelector withArguments:{arg1. arg2}. |
|
180 |
! |
|
181 |
||
182 |
perform:aSelector with:arg1 with:arg2 with:arg3 |
|
183 |
"this method is required to allow inspection of the object" |
|
184 |
||
185 |
^ self perform:aSelector withArguments:{arg1. arg2. arg3}. |
|
186 |
! |
|
187 |
||
188 |
perform:aSelector with:arg1 with:arg2 with:arg3 with:arg4 |
|
189 |
"this method is required to allow inspection of the object" |
|
190 |
||
191 |
^ self perform:aSelector withArguments:{arg1. arg2. arg3. arg4}. |
|
192 |
! |
|
193 |
||
194 |
perform:aSelector with:arg1 with:arg2 with:arg3 with:arg4 with:arg5 |
|
195 |
"this method is required to allow inspection of the object" |
|
196 |
||
197 |
^ self perform:aSelector withArguments:{arg1. arg2. arg3. arg4. arg5}. |
|
198 |
! |
|
199 |
||
200 |
perform:aSelector with:arg1 with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 |
|
201 |
"this method is required to allow inspection of the object" |
|
202 |
||
203 |
^ self perform:aSelector withArguments:{arg1. arg2. arg3. arg4. arg5. arg6}. |
|
204 |
! |
|
205 |
||
206 |
perform:aSelector withArguments:argArray |
|
207 |
"send the message aSelector with all args taken from argArray |
|
208 |
to the receiver. |
|
209 |
||
210 |
1-to-1 Copy from the same method in Object!!" |
|
211 |
||
212 |
|numberOfArgs a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15| |
|
213 |
||
214 |
%{ |
|
215 |
#ifdef __SCHTEAM__ |
|
216 |
return context.PERFORM_WITH_ARGUMENTS(self, aSelector, argArray); |
|
217 |
#else |
|
218 |
REGISTER OBJ *argP; |
|
219 |
int nargs; |
|
220 |
OBJ l; |
|
221 |
||
222 |
if (__isArrayLike(argArray)) { |
|
223 |
nargs = __arraySize(argArray); |
|
224 |
argP = __arrayVal(argArray); |
|
225 |
} else { |
|
226 |
if (__isNonNilObject(argArray)) { |
|
227 |
static struct inlineCache ilcSize = __ILC0(@line); |
|
228 |
int i; |
|
229 |
||
230 |
numberOfArgs = (*ilcSize.ilc_func)(argArray, @symbol(size), nil, &ilcSize); |
|
231 |
if (!__isSmallInteger(numberOfArgs)) |
|
232 |
goto bad; |
|
233 |
nargs = __intVal(numberOfArgs); |
|
234 |
argP = (OBJ *)(&a1); |
|
235 |
for (i=1; i <= nargs; i++) { |
|
236 |
*argP++ = __AT_(argArray, __mkSmallInteger(i)); |
|
237 |
} |
|
238 |
argP = (OBJ *)(&a1); |
|
239 |
} else { |
|
240 |
nargs = 0; |
|
241 |
} |
|
242 |
} |
|
243 |
switch (nargs) { |
|
244 |
case 0: |
|
245 |
if (InterruptPending == nil) { |
|
246 |
static OBJ last0_0 = nil; static struct inlineCache ilc0_0 = __ILCPERF0(@line); |
|
247 |
static OBJ last0_1 = nil; static struct inlineCache ilc0_1 = __ILCPERF0(@line); |
|
248 |
static OBJ last0_2 = nil; static struct inlineCache ilc0_2 = __ILCPERF0(@line); |
|
249 |
static OBJ last0_3 = nil; static struct inlineCache ilc0_3 = __ILCPERF0(@line); |
|
250 |
static int flip0 = 0; |
|
251 |
struct inlineCache *pIlc; |
|
252 |
||
253 |
if (aSelector == last0_0) { |
|
254 |
pIlc = &ilc0_0; |
|
255 |
} else if (aSelector == last0_1) { |
|
256 |
pIlc = &ilc0_1; |
|
257 |
} else if (aSelector == last0_2) { |
|
258 |
pIlc = &ilc0_2; |
|
259 |
} else if (aSelector == last0_3) { |
|
260 |
pIlc = &ilc0_3; |
|
261 |
} else { |
|
262 |
if (flip0 == 0) { |
|
263 |
pIlc = &ilc0_0; |
|
264 |
flip0 = 1; |
|
265 |
last0_0 = aSelector; |
|
266 |
} else if (flip0 == 1) { |
|
267 |
pIlc = &ilc0_1; |
|
268 |
flip0 = 2; |
|
269 |
last0_1 = aSelector; |
|
270 |
} else if (flip0 == 2) { |
|
271 |
pIlc = &ilc0_2; |
|
272 |
flip0 = 3; |
|
273 |
last0_2 = aSelector; |
|
274 |
} else { |
|
275 |
pIlc = &ilc0_3; |
|
276 |
flip0 = 0; |
|
277 |
last0_3 = aSelector; |
|
278 |
} |
|
279 |
||
280 |
pIlc->ilc_func = __SEND0ADDR__; |
|
281 |
if (pIlc->ilc_poly) { |
|
282 |
__flushPolyCache(pIlc->ilc_poly); |
|
283 |
pIlc->ilc_poly = 0; |
|
284 |
} |
|
285 |
} |
|
286 |
RETURN ((*pIlc->ilc_func)(self, aSelector, nil, pIlc)); |
|
287 |
} else { |
|
288 |
static struct inlineCache ilc0 = __DUMMYILCSELF0(@line+1); |
|
289 |
RETURN (_SEND0(self, aSelector, nil, &ilc0)); |
|
290 |
} |
|
291 |
||
292 |
case 1: |
|
293 |
if (InterruptPending == nil) { |
|
294 |
static OBJ last1_0 = nil; static struct inlineCache ilc1_0 = __ILCPERF1(@line); |
|
295 |
static OBJ last1_1 = nil; static struct inlineCache ilc1_1 = __ILCPERF1(@line); |
|
296 |
static OBJ last1_2 = nil; static struct inlineCache ilc1_2 = __ILCPERF1(@line); |
|
297 |
static OBJ last1_3 = nil; static struct inlineCache ilc1_3 = __ILCPERF1(@line); |
|
298 |
static int flip1 = 0; |
|
299 |
struct inlineCache *pIlc; |
|
300 |
||
301 |
if (aSelector == last1_0) { |
|
302 |
pIlc = &ilc1_0; |
|
303 |
} else if (aSelector == last1_1) { |
|
304 |
pIlc = &ilc1_1; |
|
305 |
} else if (aSelector == last1_2) { |
|
306 |
pIlc = &ilc1_2; |
|
307 |
} else if (aSelector == last1_3) { |
|
308 |
pIlc = &ilc1_3; |
|
309 |
} else { |
|
310 |
if (flip1 == 0) { |
|
311 |
pIlc = &ilc1_0; |
|
312 |
flip1 = 1; |
|
313 |
last1_0 = aSelector; |
|
314 |
} else if (flip1 == 1) { |
|
315 |
pIlc = &ilc1_1; |
|
316 |
flip1 = 2; |
|
317 |
last1_1 = aSelector; |
|
318 |
} else if (flip1 == 2) { |
|
319 |
pIlc = &ilc1_2; |
|
320 |
flip1 = 3; |
|
321 |
last1_2 = aSelector; |
|
322 |
} else { |
|
323 |
pIlc = &ilc1_3; |
|
324 |
flip1 = 0; |
|
325 |
last1_3 = aSelector; |
|
326 |
} |
|
327 |
||
328 |
pIlc->ilc_func = __SEND1ADDR__; |
|
329 |
if (pIlc->ilc_poly) { |
|
330 |
__flushPolyCache(pIlc->ilc_poly); |
|
331 |
pIlc->ilc_poly = 0; |
|
332 |
} |
|
333 |
} |
|
334 |
RETURN ((*pIlc->ilc_func)(self, aSelector, nil, pIlc, argP[0])); |
|
335 |
} else { |
|
336 |
static struct inlineCache ilc1 = __DUMMYILCSELF1(@line+1); |
|
337 |
RETURN (_SEND1(self, aSelector, nil, &ilc1, argP[0])); |
|
338 |
} |
|
339 |
||
340 |
case 2: |
|
341 |
if (InterruptPending == nil) { |
|
342 |
static OBJ last2_0 = nil; static struct inlineCache ilc2_0 = __ILCPERF2(@line); |
|
343 |
static OBJ last2_1 = nil; static struct inlineCache ilc2_1 = __ILCPERF2(@line); |
|
344 |
static int flip2 = 0; |
|
345 |
struct inlineCache *pIlc; |
|
346 |
||
347 |
if (aSelector == last2_0) { |
|
348 |
pIlc = &ilc2_0; |
|
349 |
} else if (aSelector == last2_1) { |
|
350 |
pIlc = &ilc2_1; |
|
351 |
} else { |
|
352 |
if (flip2 == 0) { |
|
353 |
pIlc = &ilc2_0; |
|
354 |
flip2 = 1; |
|
355 |
last2_0 = aSelector; |
|
356 |
} else { |
|
357 |
pIlc = &ilc2_1; |
|
358 |
flip2 = 0; |
|
359 |
last2_1 = aSelector; |
|
360 |
} |
|
361 |
||
362 |
pIlc->ilc_func = __SEND2ADDR__; |
|
363 |
if (pIlc->ilc_poly) { |
|
364 |
__flushPolyCache(pIlc->ilc_poly); |
|
365 |
pIlc->ilc_poly = 0; |
|
366 |
} |
|
367 |
} |
|
368 |
RETURN ((*pIlc->ilc_func)(self, aSelector, nil, pIlc, argP[0], argP[1])); |
|
369 |
} else { |
|
370 |
static struct inlineCache ilc2 = __DUMMYILCSELF2(@line+1); |
|
371 |
RETURN (_SEND2(self, aSelector, nil, &ilc2, argP[0], argP[1])); |
|
372 |
} |
|
373 |
||
374 |
case 3: |
|
375 |
if (InterruptPending == nil) { |
|
376 |
static OBJ last3_0 = nil; static struct inlineCache ilc3_0 = __ILCPERF3(@line); |
|
377 |
static OBJ last3_1 = nil; static struct inlineCache ilc3_1 = __ILCPERF3(@line); |
|
378 |
static int flip3 = 0; |
|
379 |
struct inlineCache *pIlc; |
|
380 |
||
381 |
if (aSelector == last3_0) { |
|
382 |
pIlc = &ilc3_0; |
|
383 |
} else if (aSelector == last3_1) { |
|
384 |
pIlc = &ilc3_1; |
|
385 |
} else { |
|
386 |
if (flip3 == 0) { |
|
387 |
pIlc = &ilc3_0; |
|
388 |
flip3 = 1; |
|
389 |
last3_0 = aSelector; |
|
390 |
} else { |
|
391 |
pIlc = &ilc3_1; |
|
392 |
flip3 = 0; |
|
393 |
last3_1 = aSelector; |
|
394 |
} |
|
395 |
||
396 |
pIlc->ilc_func = __SEND3ADDR__; |
|
397 |
if (pIlc->ilc_poly) { |
|
398 |
__flushPolyCache(pIlc->ilc_poly); |
|
399 |
pIlc->ilc_poly = 0; |
|
400 |
} |
|
401 |
} |
|
402 |
RETURN ((*pIlc->ilc_func)(self, aSelector, nil, pIlc, argP[0], argP[1], argP[2])); |
|
403 |
} else { |
|
404 |
static struct inlineCache ilc3 = __DUMMYILCSELF3(@line+1); |
|
405 |
RETURN (_SEND3(self, aSelector, nil, &ilc3, argP[0], argP[1], argP[2])); |
|
406 |
} |
|
407 |
||
408 |
case 4: |
|
409 |
{ |
|
410 |
static OBJ last4 = nil; static struct inlineCache ilc4 = __ILCPERF4(@line); |
|
411 |
||
412 |
if ((InterruptPending != nil) || (aSelector != last4)) { |
|
413 |
ilc4.ilc_func = __SEND4ADDR__; |
|
414 |
if (ilc4.ilc_poly) { |
|
415 |
__flushPolyCache(ilc4.ilc_poly); |
|
416 |
ilc4.ilc_poly = 0; |
|
417 |
} |
|
418 |
last4 = aSelector; |
|
419 |
} |
|
420 |
RETURN ( (*ilc4.ilc_func)(self, aSelector, nil, &ilc4, |
|
421 |
argP[0], argP[1], argP[2], argP[3])); |
|
422 |
} |
|
423 |
||
424 |
case 5: |
|
425 |
{ |
|
426 |
static OBJ last5 = nil; static struct inlineCache ilc5 = __ILCPERF5(@line); |
|
427 |
||
428 |
if ((InterruptPending != nil) || (aSelector != last5)) { |
|
429 |
ilc5.ilc_func = __SEND5ADDR__; |
|
430 |
if (ilc5.ilc_poly) { |
|
431 |
__flushPolyCache(ilc5.ilc_poly); |
|
432 |
ilc5.ilc_poly = 0; |
|
433 |
} |
|
434 |
last5 = aSelector; |
|
435 |
} |
|
436 |
RETURN ( (*ilc5.ilc_func)(self, aSelector, nil, &ilc5, |
|
437 |
argP[0], argP[1], argP[2], argP[3], argP[4])); |
|
438 |
} |
|
439 |
||
440 |
case 6: |
|
441 |
{ |
|
442 |
static OBJ last6 = nil; static struct inlineCache ilc6 = __ILCPERF6(@line); |
|
443 |
||
444 |
if ((InterruptPending != nil) || (aSelector != last6)) { |
|
445 |
ilc6.ilc_func = __SEND6ADDR__; |
|
446 |
if (ilc6.ilc_poly) { |
|
447 |
__flushPolyCache(ilc6.ilc_poly); |
|
448 |
ilc6.ilc_poly = 0; |
|
449 |
} |
|
450 |
last6 = aSelector; |
|
451 |
} |
|
452 |
RETURN ( (*ilc6.ilc_func)(self, aSelector, nil, &ilc6, |
|
453 |
argP[0], argP[1], argP[2], argP[3], argP[4], |
|
454 |
argP[5])); |
|
455 |
} |
|
456 |
||
457 |
case 7: |
|
458 |
{ |
|
459 |
static OBJ last7 = nil; static struct inlineCache ilc7 = __ILCPERF7(@line); |
|
460 |
||
461 |
if ((InterruptPending != nil) || (aSelector != last7)) { |
|
462 |
ilc7.ilc_func = __SEND7ADDR__; |
|
463 |
if (ilc7.ilc_poly) { |
|
464 |
__flushPolyCache(ilc7.ilc_poly); |
|
465 |
ilc7.ilc_poly = 0; |
|
466 |
} |
|
467 |
last7 = aSelector; |
|
468 |
} |
|
469 |
RETURN ( (*ilc7.ilc_func)(self, aSelector, nil, &ilc7, |
|
470 |
argP[0], argP[1], argP[2], argP[3], argP[4], |
|
471 |
argP[5], argP[6])); |
|
472 |
} |
|
473 |
||
474 |
case 8: |
|
475 |
{ |
|
476 |
static OBJ last8 = nil; static struct inlineCache ilc8 = __ILCPERF8(@line); |
|
477 |
||
478 |
if ((InterruptPending != nil) || (aSelector != last8)) { |
|
479 |
ilc8.ilc_func = __SEND8ADDR__; |
|
480 |
if (ilc8.ilc_poly) { |
|
481 |
__flushPolyCache(ilc8.ilc_poly); |
|
482 |
ilc8.ilc_poly = 0; |
|
483 |
} |
|
484 |
last8 = aSelector; |
|
485 |
} |
|
486 |
RETURN ( (*ilc8.ilc_func)(self, aSelector, nil, &ilc8, |
|
487 |
argP[0], argP[1], argP[2], argP[3], argP[4], |
|
488 |
argP[5], argP[6], argP[7])); |
|
489 |
} |
|
490 |
||
491 |
case 9: |
|
492 |
{ |
|
493 |
static OBJ last9 = nil; static struct inlineCache ilc9 = __ILCPERF9(@line); |
|
494 |
||
495 |
if ((InterruptPending != nil) || (aSelector != last9)) { |
|
496 |
ilc9.ilc_func = __SEND9ADDR__; |
|
497 |
if (ilc9.ilc_poly) { |
|
498 |
__flushPolyCache(ilc9.ilc_poly); |
|
499 |
ilc9.ilc_poly = 0; |
|
500 |
} |
|
501 |
last9 = aSelector; |
|
502 |
} |
|
503 |
RETURN ( (*ilc9.ilc_func)(self, aSelector, nil, &ilc9, |
|
504 |
argP[0], argP[1], argP[2], argP[3], argP[4], |
|
505 |
argP[5], argP[6], argP[7], argP[8])); |
|
506 |
} |
|
507 |
||
508 |
case 10: |
|
509 |
{ |
|
510 |
static OBJ last10 = nil; static struct inlineCache ilc10 = __ILCPERF10(@line); |
|
511 |
||
512 |
if ((InterruptPending != nil) || (aSelector != last10)) { |
|
513 |
ilc10.ilc_func = __SEND10ADDR__; |
|
514 |
if (ilc10.ilc_poly) { |
|
515 |
__flushPolyCache(ilc10.ilc_poly); |
|
516 |
ilc10.ilc_poly = 0; |
|
517 |
} |
|
518 |
last10 = aSelector; |
|
519 |
} |
|
520 |
RETURN ( (*ilc10.ilc_func)(self, aSelector, nil, &ilc10, |
|
521 |
argP[0], argP[1], argP[2], argP[3], argP[4], |
|
522 |
argP[5], argP[6], argP[7], argP[8], argP[9])); |
|
523 |
} |
|
524 |
||
525 |
case 11: |
|
526 |
{ |
|
527 |
static OBJ last11 = nil; static struct inlineCache ilc11 = __ILCPERF11(@line); |
|
528 |
||
529 |
if ((InterruptPending != nil) || (aSelector != last11)) { |
|
530 |
ilc11.ilc_func = __SEND11ADDR__; |
|
531 |
if (ilc11.ilc_poly) { |
|
532 |
__flushPolyCache(ilc11.ilc_poly); |
|
533 |
ilc11.ilc_poly = 0; |
|
534 |
} |
|
535 |
last11 = aSelector; |
|
536 |
} |
|
537 |
RETURN ( (*ilc11.ilc_func)(self, aSelector, nil, &ilc11, |
|
538 |
argP[0], argP[1], argP[2], argP[3], argP[4], |
|
539 |
argP[5], argP[6], argP[7], argP[8], argP[9], |
|
540 |
argP[10])); |
|
541 |
} |
|
542 |
||
543 |
case 12: |
|
544 |
{ |
|
545 |
static OBJ last12 = nil; static struct inlineCache ilc12 = __ILCPERF12(@line); |
|
546 |
||
547 |
if ((InterruptPending != nil) || (aSelector != last12)) { |
|
548 |
ilc12.ilc_func = __SEND12ADDR__; |
|
549 |
if (ilc12.ilc_poly) { |
|
550 |
__flushPolyCache(ilc12.ilc_poly); |
|
551 |
ilc12.ilc_poly = 0; |
|
552 |
} |
|
553 |
last12 = aSelector; |
|
554 |
} |
|
555 |
RETURN ( (*ilc12.ilc_func)(self, aSelector, nil, &ilc12, |
|
556 |
argP[0], argP[1], argP[2], argP[3], argP[4], |
|
557 |
argP[5], argP[6], argP[7], argP[8], argP[9], |
|
558 |
argP[10], argP[11])); |
|
559 |
} |
|
560 |
||
561 |
case 13: |
|
562 |
{ |
|
563 |
static OBJ last13 = nil; static struct inlineCache ilc13 = __ILCPERF13(@line); |
|
564 |
||
565 |
if ((InterruptPending != nil) || (aSelector != last13)) { |
|
566 |
ilc13.ilc_func = __SEND13ADDR__; |
|
567 |
if (ilc13.ilc_poly) { |
|
568 |
__flushPolyCache(ilc13.ilc_poly); |
|
569 |
ilc13.ilc_poly = 0; |
|
570 |
} |
|
571 |
last13 = aSelector; |
|
572 |
} |
|
573 |
RETURN ( (*ilc13.ilc_func)(self, aSelector, nil, &ilc13, |
|
574 |
argP[0], argP[1], argP[2], argP[3], argP[4], |
|
575 |
argP[5], argP[6], argP[7], argP[8], argP[9], |
|
576 |
argP[10], argP[11], argP[12])); |
|
577 |
} |
|
578 |
||
579 |
case 14: |
|
580 |
{ |
|
581 |
static OBJ last14 = nil; static struct inlineCache ilc14 = __ILCPERF14(@line); |
|
582 |
||
583 |
if ((InterruptPending != nil) || (aSelector != last14)) { |
|
584 |
ilc14.ilc_func = __SEND14ADDR__; |
|
585 |
if (ilc14.ilc_poly) { |
|
586 |
__flushPolyCache(ilc14.ilc_poly); |
|
587 |
ilc14.ilc_poly = 0; |
|
588 |
} |
|
589 |
last14 = aSelector; |
|
590 |
} |
|
591 |
RETURN ( (*ilc14.ilc_func)(self, aSelector, nil, &ilc14, |
|
592 |
argP[0], argP[1], argP[2], argP[3], argP[4], |
|
593 |
argP[5], argP[6], argP[7], argP[8], argP[9], |
|
594 |
argP[10], argP[11], argP[12], argP[13])); |
|
595 |
} |
|
596 |
||
597 |
case 15: |
|
598 |
{ |
|
599 |
static OBJ last15 = nil; static struct inlineCache ilc15 = __ILCPERF15(@line); |
|
600 |
||
601 |
if ((InterruptPending != nil) || (aSelector != last15)) { |
|
602 |
ilc15.ilc_func = __SEND15ADDR__; |
|
603 |
if (ilc15.ilc_poly) { |
|
604 |
__flushPolyCache(ilc15.ilc_poly); |
|
605 |
ilc15.ilc_poly = 0; |
|
606 |
} |
|
607 |
last15 = aSelector; |
|
608 |
} |
|
609 |
RETURN ( (*ilc15.ilc_func)(self, aSelector, nil, &ilc15, |
|
610 |
argP[0], argP[1], argP[2], argP[3], argP[4], |
|
611 |
argP[5], argP[6], argP[7], argP[8], argP[9], |
|
612 |
argP[10], argP[11], argP[12], argP[13], |
|
613 |
argP[14])); |
|
614 |
} |
|
615 |
} |
|
616 |
bad:; |
|
617 |
#endif |
|
618 |
%}. |
|
619 |
||
620 |
"/ arrive here, if bad number of arguments (too many) |
|
621 |
"/ ST/X (currently) only allows up to 15 method arguments |
|
622 |
||
623 |
^ self primitiveFailed |
|
624 |
! |
|
625 |
||
21095 | 626 |
referencesAny:anObject |
627 |
"this method is required to allow inspection of the object" |
|
628 |
||
629 |
^ (Object compiledMethodAt:#referencesAny:) |
|
630 |
valueWithReceiver:self |
|
631 |
arguments:{anObject} |
|
632 |
selector:#referencesAny |
|
633 |
! |
|
634 |
||
635 |
referencesObject:anObject |
|
636 |
"this method is required to allow inspection of the object" |
|
637 |
||
638 |
^ (Object compiledMethodAt:#referencesObject:) |
|
639 |
valueWithReceiver:self |
|
640 |
arguments:{anObject} |
|
641 |
selector:#referencesObject |
|
21076 | 642 |
! ! |
643 |
||
6844 | 644 |
!ProtoObject methodsFor:'queries'! |
645 |
||
646 |
class |
|
19678 | 647 |
"return the receiver's class" |
6844 | 648 |
|
649 |
%{ /* NOCONTEXT */ |
|
650 |
||
651 |
RETURN ( __Class(self) ); |
|
652 |
%} |
|
653 |
||
654 |
" |
|
655 |
*** WARNING |
|
656 |
*** |
|
657 |
*** this method has been automatically created, |
|
658 |
*** since all nil-subclasses should respond to some minimum required |
|
659 |
*** protocol. |
|
660 |
*** |
|
661 |
*** Inspection and/or debugging of instances may not be possible, |
|
662 |
*** if you remove/change this method. |
|
663 |
" |
|
19678 | 664 |
|
665 |
"Modified (comment): / 30-04-2016 / 15:51:12 / cg" |
|
10589 | 666 |
! |
667 |
||
668 |
identityHash |
|
669 |
"return an Integer useful as a hash key for the receiver. |
|
670 |
This hash should return same values for the same object (i.e. use |
|
671 |
this to hash on identity of objects). |
|
672 |
||
673 |
We cannot use the Objects address (as other smalltalks do) since |
|
674 |
no object-table exists and the hashval must not change when objects |
|
675 |
are moved by the collector. Therefore we assign each object a unique |
|
676 |
Id in the object header itself as its hashed upon. |
|
677 |
(luckily we have 11 bits spare to do this - unluckily its only 11 bits). |
|
678 |
Time will show, if 11 bits are enough; if not, another entry in the |
|
679 |
object header will be needed, adding 4 bytes to every object. Alternatively, |
|
680 |
hashed-upon objects could add an instvar containing the hash value." |
|
681 |
||
682 |
%{ /* NOCONTEXT */ |
|
683 |
||
684 |
REGISTER unsigned INT hash; |
|
685 |
static unsigned nextHash = 0; |
|
686 |
||
687 |
if (__isNonNilObject(self)) { |
|
688 |
hash = __GET_HASH(self); |
|
689 |
if (hash == 0) { |
|
690 |
/* has no hash yet */ |
|
691 |
||
692 |
if (++nextHash > __MAX_HASH__) { |
|
693 |
nextHash = 1; |
|
694 |
} |
|
695 |
hash = nextHash; |
|
696 |
__SET_HASH(self, hash); |
|
697 |
} |
|
698 |
||
699 |
/* |
|
700 |
* now, we got 11 bits for hashing; |
|
701 |
* make it as large as possible; since most hashers use the returned |
|
702 |
* key and take it modulo some prime number, this will allow for |
|
703 |
* better distribution (i.e. bigger empty spaces) in hashed collection. |
|
704 |
*/ |
|
705 |
hash = __MAKE_HASH__(hash); |
|
706 |
RETURN ( __mkSmallInteger(hash) ); |
|
707 |
} |
|
708 |
%}. |
|
709 |
^ 0 "never reached, since redefined in UndefinedObject and SmallInteger" |
|
710 |
||
711 |
"Created: / 31-05-2007 / 23:18:40 / cg" |
|
6844 | 712 |
! ! |
713 |
||
714 |
!ProtoObject methodsFor:'testing'! |
|
715 |
||
12571 | 716 |
ifNil:aBlock |
717 |
^ self |
|
718 |
! |
|
719 |
||
720 |
ifNotNil:aBlockOrValue |
|
18439 | 721 |
(aBlockOrValue isBlock and:[aBlockOrValue argumentCount == 1]) ifTrue:[ |
16158 | 722 |
^ aBlockOrValue value:self. |
723 |
]. |
|
12571 | 724 |
^ aBlockOrValue value |
725 |
! |
|
726 |
||
6844 | 727 |
isBehavior |
18351 | 728 |
"return true, if the receiver is describing another object's behavior. |
9222 | 729 |
False is returned here - the method is only redefined in Behavior." |
730 |
||
6844 | 731 |
^ false |
7661
71d2cac1b959
some tests aded to avoid trouble in debugger
Claus Gittinger <cg@exept.de>
parents:
7659
diff
changeset
|
732 |
! |
6844 | 733 |
|
7661
71d2cac1b959
some tests aded to avoid trouble in debugger
Claus Gittinger <cg@exept.de>
parents:
7659
diff
changeset
|
734 |
isBlock |
71d2cac1b959
some tests aded to avoid trouble in debugger
Claus Gittinger <cg@exept.de>
parents:
7659
diff
changeset
|
735 |
^ false |
7659 | 736 |
! |
737 |
||
21085 | 738 |
isBridgeProxy |
739 |
^ false |
|
740 |
! |
|
741 |
||
7659 | 742 |
isException |
743 |
^ false |
|
744 |
! |
|
745 |
||
746 |
isExceptionHandler |
|
747 |
^ false |
|
748 |
! |
|
749 |
||
750 |
isJavaObject |
|
751 |
^ false |
|
10589 | 752 |
! |
753 |
||
754 |
isLazyValue |
|
755 |
^ false |
|
756 |
||
757 |
"Created: / 03-06-2007 / 14:02:12 / cg" |
|
10591 | 758 |
! |
759 |
||
760 |
isLiteral |
|
761 |
^ false |
|
762 |
||
763 |
"Created: / 04-06-2007 / 17:19:10 / cg" |
|
21075 | 764 |
! |
765 |
||
766 |
isNil |
|
767 |
^ false. |
|
768 |
! |
|
769 |
||
770 |
isProtoObject |
|
771 |
^ true |
|
6844 | 772 |
! ! |
773 |
||
774 |
!ProtoObject class methodsFor:'documentation'! |
|
775 |
||
776 |
version |
|
19678 | 777 |
^ '$Header$' |
12571 | 778 |
! |
779 |
||
780 |
version_CVS |
|
19678 | 781 |
^ '$Header$' |
6844 | 782 |
! ! |
16158 | 783 |