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