author | Claus Gittinger <cg@exept.de> |
Wed, 26 Jun 2019 22:06:12 +0200 | |
changeset 24369 | e796791ea838 |
parent 24353 | 60396a765720 |
child 24401 | 0f0bdade5733 |
permissions | -rw-r--r-- |
22431 | 1 |
"{ Encoding: utf8 }" |
2 |
||
84 | 3 |
" |
4 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
159 | 5 |
All Rights Reserved |
84 | 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 |
" |
|
5426 | 14 |
"{ Package: 'stx:libbasic' }" |
15 |
||
17513 | 16 |
"{ NameSpace: Smalltalk }" |
17 |
||
1493
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
18 |
ExecutableFunction variableSubclass:#CompiledCode |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
19 |
instanceVariableNames:'flags byteCode' |
7603
88c60268d47f
Exception classes initialize themself.
Stefan Vogel <sv@exept.de>
parents:
7261
diff
changeset
|
20 |
classVariableNames:'' |
1182
d8f8e18928a5
only CompiledCode, Method & Block are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
21 |
poolDictionaries:'' |
d8f8e18928a5
only CompiledCode, Method & Block are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
22 |
category:'Kernel-Methods' |
84 | 23 |
! |
24 |
||
1772
d5d1d1fac79d
the dynamic flag may never be set by anyone except the VM;
Claus Gittinger <cg@exept.de>
parents:
1771
diff
changeset
|
25 |
!CompiledCode class methodsFor:'documentation'! |
84 | 26 |
|
88 | 27 |
copyright |
28 |
" |
|
29 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
159 | 30 |
All Rights Reserved |
88 | 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 |
||
84 | 41 |
documentation |
42 |
" |
|
43 |
This is an abstract class, to merge common attributes of Blocks and |
|
14068 | 44 |
Methods i.e. describe all objects consisting of either compiled or |
328 | 45 |
interpreted code. |
84 | 46 |
|
1254 | 47 |
Instances of CompiledCode are not to be created by user code |
48 |
(the compilers create Blocks, Methods etc.) |
|
49 |
||
50 |
||
1293 | 51 |
[Instance variables:] |
84 | 52 |
|
357 | 53 |
flags <SmallInteger> special flag bits coded in a number |
21416 | 54 |
byteCode <ByteArray> bytecode if it's an interpreted codeobject |
1493
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
55 |
|
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
56 |
The block/methods literals are stored in the indexed instance variables. |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
57 |
If there is only one indexed instvar, it contains a reference to an |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
58 |
Object containing the literals. |
225 | 59 |
|
60 |
||
1293 | 61 |
[Class variables:] |
225 | 62 |
|
63 |
NoByteCodeSignal raised if a codeObject is about to be executed |
|
23571
4aa9bc1a2076
extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents:
22934
diff
changeset
|
64 |
which has neither code nor byteCode (i.e. both are nil) |
225 | 65 |
InvalidByteCodeSignal raised if byteCode is not an instance of ByteArray |
66 |
InvalidInstructionSignal raised if an invalid instruction opcode is encountered |
|
67 |
BadLiteralsSignal raised if literalArray is not an array |
|
68 |
NonBooleanReceiverSignal raised for conditional jumps where receiver is not a boolean |
|
69 |
ArgumentSignal raised if argument count is not what the codeObject expects |
|
70 |
||
71 |
all of these signals are children of ExecutionErrorSignal. |
|
84 | 72 |
|
73 |
NOTICE: layout known by runtime system and compiler - do not change |
|
1293 | 74 |
|
75 |
[author:] |
|
23571
4aa9bc1a2076
extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents:
22934
diff
changeset
|
76 |
Claus Gittinger |
84 | 77 |
" |
78 |
! ! |
|
79 |
||
1772
d5d1d1fac79d
the dynamic flag may never be set by anyone except the VM;
Claus Gittinger <cg@exept.de>
parents:
1771
diff
changeset
|
80 |
!CompiledCode class methodsFor:'instance creation'! |
1493
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
81 |
|
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
82 |
new |
3218
78255e232c66
Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents:
3145
diff
changeset
|
83 |
"create a new method with an indirect literal array |
1493
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
84 |
stored in the first and only indexed instvar" |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
85 |
|
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
86 |
^ self basicNew:1. |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
87 |
|
3218
78255e232c66
Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents:
3145
diff
changeset
|
88 |
"Created: / 24.6.1996 / 17:21:46 / stefan" |
78255e232c66
Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents:
3145
diff
changeset
|
89 |
"Modified: / 23.1.1998 / 16:31:28 / stefan" |
1493
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
90 |
! |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
91 |
|
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
92 |
new:numberOfLiterals |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
93 |
"create a new method with numberOfLiterals. |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
94 |
Implementation note: |
14068 | 95 |
If (self size) == 1, the only literal is an indirect literal |
96 |
containing an array of literals. Otherwise the literals |
|
97 |
are stored in self. |
|
1493
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
98 |
" |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
99 |
|
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
100 |
|nlits| |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
101 |
|
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
102 |
nlits := numberOfLiterals. |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
103 |
nlits <= 1 ifTrue:[ |
14068 | 104 |
nlits := nlits + 1. |
1493
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
105 |
]. |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
106 |
^ self basicNew:nlits. |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
107 |
|
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
108 |
"Created: 24.6.1996 / 17:20:13 / stefan" |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
109 |
"Modified: 25.6.1996 / 14:25:14 / stefan" |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
110 |
! ! |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
111 |
|
1772
d5d1d1fac79d
the dynamic flag may never be set by anyone except the VM;
Claus Gittinger <cg@exept.de>
parents:
1771
diff
changeset
|
112 |
!CompiledCode class methodsFor:'Signal constants'! |
106 | 113 |
|
7150 | 114 |
wongNumberOfArgumentsSignal |
115 |
"return the signal raised when the number of arguments is wrong in a call" |
|
116 |
||
117 |
^ WrongNumberOfArgumentsError |
|
106 | 118 |
! ! |
119 |
||
1772
d5d1d1fac79d
the dynamic flag may never be set by anyone except the VM;
Claus Gittinger <cg@exept.de>
parents:
1771
diff
changeset
|
120 |
!CompiledCode class methodsFor:'queries'! |
84 | 121 |
|
18943 | 122 |
isAbstract |
123 |
^ self == CompiledCode |
|
124 |
! |
|
125 |
||
84 | 126 |
isBuiltInClass |
1264 | 127 |
"return true if this class is known by the run-time-system. |
128 |
Here, true is returned for myself, false for subclasses." |
|
84 | 129 |
|
1182
d8f8e18928a5
only CompiledCode, Method & Block are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
130 |
^ self == CompiledCode |
d8f8e18928a5
only CompiledCode, Method & Block are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
131 |
|
1264 | 132 |
"Modified: 23.4.1996 / 15:57:03 / cg" |
2806
9d3c4cf5f6e9
moved #maxNumberOfArguments from Method
Claus Gittinger <cg@exept.de>
parents:
2804
diff
changeset
|
133 |
! |
9d3c4cf5f6e9
moved #maxNumberOfArguments from Method
Claus Gittinger <cg@exept.de>
parents:
2804
diff
changeset
|
134 |
|
9d3c4cf5f6e9
moved #maxNumberOfArguments from Method
Claus Gittinger <cg@exept.de>
parents:
2804
diff
changeset
|
135 |
maxNumberOfArguments |
9d3c4cf5f6e9
moved #maxNumberOfArguments from Method
Claus Gittinger <cg@exept.de>
parents:
2804
diff
changeset
|
136 |
"return the maximum number of arguments a method can have. |
14068 | 137 |
This is a limit in the VM, which may be removed in one of |
2806
9d3c4cf5f6e9
moved #maxNumberOfArguments from Method
Claus Gittinger <cg@exept.de>
parents:
2804
diff
changeset
|
138 |
the next versions ..." |
9d3c4cf5f6e9
moved #maxNumberOfArguments from Method
Claus Gittinger <cg@exept.de>
parents:
2804
diff
changeset
|
139 |
|
9d3c4cf5f6e9
moved #maxNumberOfArguments from Method
Claus Gittinger <cg@exept.de>
parents:
2804
diff
changeset
|
140 |
%{ /* NOCONTEXT */ |
8913 | 141 |
RETURN (__mkSmallInteger(MAX_METHOD_ARGS)); |
18416 | 142 |
%}. |
143 |
"/ fallback if no VM limit |
|
144 |
||
145 |
"/ actually: this limit is due to the single-byte encoding |
|
146 |
"/ in the send bytecode. |
|
147 |
^ 255 |
|
5674 | 148 |
! |
149 |
||
150 |
numArgsMaskInFlags |
|
151 |
||
152 |
%{ /* NOCONTEXT */ |
|
153 |
/* made this a primitive to get define in stc.h */ |
|
154 |
||
8913 | 155 |
RETURN (__mkSmallInteger(F_NARGS)); |
5674 | 156 |
%}. |
18416 | 157 |
^ nil "/ fallback if no primitive code |
5674 | 158 |
|
159 |
" |
|
160 |
self numArgsMaskInFlags |
|
5729 | 161 |
" |
162 |
! |
|
5674 | 163 |
|
164 |
numArgsShiftInFlags |
|
165 |
||
166 |
%{ /* NOCONTEXT */ |
|
167 |
/* made this a primitive to get define in stc.h */ |
|
168 |
||
8913 | 169 |
RETURN (__mkSmallInteger(F_NARGSHIFT)); |
5674 | 170 |
%}. |
18416 | 171 |
^ nil "/ fallback if no primitive code |
5674 | 172 |
|
173 |
" |
|
174 |
self numArgsShiftInFlags |
|
5729 | 175 |
" |
176 |
! |
|
5674 | 177 |
|
178 |
numVarsMaskInFlags |
|
179 |
||
180 |
%{ /* NOCONTEXT */ |
|
181 |
/* made this a primitive to get define in stc.h */ |
|
182 |
||
8913 | 183 |
RETURN (__mkSmallInteger(F_NVARS)); |
5674 | 184 |
%}. |
18416 | 185 |
^ nil "/ fallback if no primitive code |
5674 | 186 |
|
187 |
" |
|
188 |
self numVarsMaskInFlags |
|
5729 | 189 |
" |
190 |
! |
|
5674 | 191 |
|
192 |
numVarsShiftInFlags |
|
193 |
||
194 |
%{ /* NOCONTEXT */ |
|
195 |
/* made this a primitive to get define in stc.h */ |
|
196 |
||
8913 | 197 |
RETURN (__mkSmallInteger(F_NVARSHIFT)); |
5674 | 198 |
%}. |
18416 | 199 |
^ nil "/ fallback if no primitive code |
5674 | 200 |
|
201 |
" |
|
202 |
self numVarsShiftInFlags |
|
5729 | 203 |
" |
204 |
! ! |
|
84 | 205 |
|
21124 | 206 |
!CompiledCode methodsFor:'Compatibility-ANSI'! |
207 |
||
208 |
argumentCount |
|
209 |
"ANSI alias for numArgs: return the number of arguments, the method expects." |
|
210 |
||
211 |
%{ /* NOCONTEXT */ |
|
212 |
#ifdef __SCHTEAM__ |
|
213 |
return __c__._RETURN( self.getNumberOfArguments() ); |
|
214 |
#else |
|
215 |
/* made this a primitive to get define in stc.h */ |
|
216 |
||
217 |
RETURN (__mkSmallInteger((__intVal(__INST(flags)) & F_NARGS) >> F_NARGSHIFT)); |
|
218 |
#endif |
|
219 |
%}. |
|
220 |
" |
|
221 |
The old implementation simply counted the arguments from |
|
222 |
the methods source - new versions include this information |
|
223 |
in the flag instVar, for more security in #perform: |
|
224 |
" |
|
225 |
||
226 |
" |
|
227 |
(Method compiledMethodAt:#source) numArgs |
|
228 |
(Method compiledMethodAt:#source:) numArgs |
|
229 |
" |
|
230 |
! ! |
|
231 |
||
7261 | 232 |
!CompiledCode methodsFor:'Compatibility-ST80'! |
2567 | 233 |
|
2696
0ab535637edc
added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2695
diff
changeset
|
234 |
getSource |
22934 | 235 |
"return the code object's source code, nil if none is available" |
2696
0ab535637edc
added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2695
diff
changeset
|
236 |
|
0ab535637edc
added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2695
diff
changeset
|
237 |
^ self source. |
0ab535637edc
added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2695
diff
changeset
|
238 |
|
0ab535637edc
added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2695
diff
changeset
|
239 |
"Created: 19.6.1997 / 16:32:15 / cg" |
0ab535637edc
added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2695
diff
changeset
|
240 |
! |
0ab535637edc
added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2695
diff
changeset
|
241 |
|
0ab535637edc
added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2695
diff
changeset
|
242 |
getSourceForUserIfNone:aBlock |
22934 | 243 |
"return the code object's source code. |
2696
0ab535637edc
added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2695
diff
changeset
|
244 |
If none is available, return the result from evaluating aBlock." |
0ab535637edc
added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2695
diff
changeset
|
245 |
|
14068 | 246 |
|src| |
2696
0ab535637edc
added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2695
diff
changeset
|
247 |
|
0ab535637edc
added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2695
diff
changeset
|
248 |
Screen current shiftDown ifTrue:[^ aBlock value]. |
0ab535637edc
added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2695
diff
changeset
|
249 |
src := self source. |
0ab535637edc
added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2695
diff
changeset
|
250 |
src isNil ifTrue:[^ aBlock value]. |
0ab535637edc
added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2695
diff
changeset
|
251 |
^ src withoutTrailingSeparators |
0ab535637edc
added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2695
diff
changeset
|
252 |
|
0ab535637edc
added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2695
diff
changeset
|
253 |
"Modified: 19.6.1997 / 16:31:53 / cg" |
0ab535637edc
added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2695
diff
changeset
|
254 |
! |
0ab535637edc
added #getSource & #getSourceForUser* for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2695
diff
changeset
|
255 |
|
16129 | 256 |
initialPC |
257 |
^ 1 |
|
258 |
! |
|
259 |
||
5304 | 260 |
methodClass |
261 |
"return the class I am defined in" |
|
262 |
||
263 |
^ self mclass. |
|
264 |
||
265 |
"Created: 19.6.1997 / 16:32:15 / cg" |
|
266 |
! |
|
267 |
||
268 |
sourceString |
|
22934 | 269 |
"return the code object's source code, nil if none is available" |
5304 | 270 |
|
271 |
^ self source. |
|
272 |
||
273 |
"Created: 19.6.1997 / 16:32:15 / cg" |
|
274 |
! |
|
275 |
||
2567 | 276 |
withAllBlockMethodsDo:aBlock |
277 |
aBlock value:self |
|
278 |
||
279 |
"Created: 18.4.1997 / 20:42:07 / cg" |
|
280 |
! ! |
|
281 |
||
14044 | 282 |
!CompiledCode methodsFor:'Compatibility-V''Age'! |
283 |
||
284 |
bytecodes |
|
285 |
^ self byteCode |
|
286 |
||
287 |
"Created: / 05-03-2012 / 15:51:48 / cg" |
|
288 |
! ! |
|
289 |
||
249 | 290 |
!CompiledCode methodsFor:'accessing'! |
84 | 291 |
|
2703 | 292 |
allLiterals |
293 |
"return a collection of all literals (includes all block literals)" |
|
294 |
||
295 |
^ self literals ? #() |
|
296 |
||
297 |
"Modified: 19.6.1997 / 17:37:52 / cg" |
|
298 |
! |
|
299 |
||
3076 | 300 |
allSymbolLiterals |
301 |
"return a collection of all symbol-literals" |
|
302 |
||
303 |
^ self allLiterals select:[:lit | lit isSymbol] |
|
304 |
||
305 |
"Modified: / 19.6.1997 / 17:37:52 / cg" |
|
306 |
"Created: / 1.11.1997 / 13:14:44 / cg" |
|
307 |
! |
|
308 |
||
84 | 309 |
byteCode |
310 |
"return the bytecode (a ByteArray)" |
|
311 |
||
312 |
^ byteCode |
|
313 |
! |
|
314 |
||
1493
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
315 |
changeLiteral:aLiteral to:newLiteral |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
316 |
"change aLiteral to newLiteral" |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
317 |
|
1526 | 318 |
|lits nLits "{ Class: SmallInteger }" | |
1493
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
319 |
|
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
320 |
self size == 1 ifTrue:[ |
14068 | 321 |
lits := self at:1. |
1493
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
322 |
] ifFalse:[ |
14068 | 323 |
lits := self. |
1493
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
324 |
]. |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
325 |
|
1526 | 326 |
nLits := lits size. |
327 |
1 to:nLits do:[:i| |
|
14068 | 328 |
(lits at:i) == aLiteral ifTrue:[ |
329 |
lits at:i put:newLiteral. |
|
330 |
^ true. |
|
331 |
]. |
|
1493
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
332 |
]. |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
333 |
^ false. |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
334 |
|
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
335 |
"Created: 24.6.1996 / 15:08:11 / stefan" |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
336 |
"Modified: 24.6.1996 / 17:07:56 / stefan" |
1526 | 337 |
"Modified: 4.7.1996 / 11:12:39 / cg" |
1493
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
338 |
! |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
339 |
|
3962
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
340 |
decompiledSource |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
341 |
"reconstruct some synthetic source by decompiling by byteCode" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
342 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
343 |
|s| |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
344 |
|
8222
f2c454a9a038
replaced '' writeStream by String writeStream
Claus Gittinger <cg@exept.de>
parents:
7603
diff
changeset
|
345 |
s := String writeStream. |
3962
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
346 |
self decompileTo:s. |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
347 |
^ s contents |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
348 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
349 |
"Modified: / 30.1.1999 / 14:53:30 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
350 |
"Created: / 30.1.1999 / 14:54:09 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
351 |
! |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
352 |
|
6084
c6cf46dc9ac8
#decompiler -> #decompilerClass
Claus Gittinger <cg@exept.de>
parents:
6013
diff
changeset
|
353 |
decompilerClass |
2810 | 354 |
^ Decompiler |
355 |
||
356 |
"Created: 30.7.1997 / 16:36:40 / cg" |
|
357 |
! |
|
358 |
||
1493
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
359 |
do:aBlock |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
360 |
"same as #literalsDo:, in order to get common protocol with Array" |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
361 |
|
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
362 |
^ self literalsDo:aBlock |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
363 |
|
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
364 |
"Modified: 25.6.1996 / 22:16:44 / stefan" |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
365 |
! |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
366 |
|
3882 | 367 |
flags |
3962
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
368 |
"return the flags (number of method variables, stacksize etc.). |
20793 | 369 |
Don't depend on the values in the flag field - its interpretations |
3962
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
370 |
may change without notice." |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
371 |
|
3882 | 372 |
^ flags |
373 |
||
3962
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
374 |
"Modified: / 30.1.1999 / 14:51:59 / cg" |
3882 | 375 |
! |
376 |
||
14490 | 377 |
homeMethod |
378 |
"for common protocol with blocks: if the receiver is a method, |
|
21416 | 379 |
return the receiver; otherwise, if it's a block, return its home |
14490 | 380 |
method." |
381 |
||
382 |
^ self |
|
21416 | 383 |
|
384 |
"Modified (comment): / 13-02-2017 / 19:58:51 / cg" |
|
14490 | 385 |
! |
386 |
||
5744 | 387 |
literalAt:index |
10472 | 388 |
"return a literal element" |
389 |
||
390 |
^ self literalAt:index ifAbsent:[self error:'bad literal index'] |
|
391 |
! |
|
392 |
||
393 |
literalAt:index ifAbsent:exceptionalValue |
|
394 |
"return a literal element" |
|
5744 | 395 |
|
396 |
|lits numLits "{ Class: SmallInteger }"| |
|
397 |
||
398 |
numLits := self size. |
|
399 |
numLits == 0 ifTrue:[ |
|
14068 | 400 |
^ exceptionalValue value |
5744 | 401 |
]. |
402 |
numLits == 1 ifTrue:[ |
|
14068 | 403 |
lits := self at:1. |
404 |
lits isArray ifFalse:[ |
|
405 |
index == 1 ifTrue:[^ lits]. |
|
406 |
^ exceptionalValue value |
|
407 |
]. |
|
408 |
^ lits at:index. |
|
5744 | 409 |
]. |
410 |
||
411 |
"there may be a dummy (nil) literal to make the size > 1" |
|
412 |
(self at:2) isNil ifTrue:[ |
|
14068 | 413 |
index == 1 ifTrue:[^ self at:1]. |
414 |
^ exceptionalValue value |
|
5744 | 415 |
]. |
416 |
||
417 |
^ self at:index |
|
418 |
! |
|
419 |
||
9447 | 420 |
literalAt:index put:newValue |
14068 | 421 |
"change a literal slots value. |
10472 | 422 |
WARNING: dangerous internal interface; only for knowledgable users" |
9447 | 423 |
|
424 |
|lits numLits "{ Class: SmallInteger }"| |
|
425 |
||
426 |
numLits := self size. |
|
427 |
numLits == 0 ifTrue:[ |
|
14068 | 428 |
self error:'bad literal index' |
9447 | 429 |
]. |
430 |
numLits == 1 ifTrue:[ |
|
14068 | 431 |
lits := self at:1. |
432 |
lits isArray ifFalse:[ |
|
433 |
index == 1 ifTrue:[^ self at:1 put:newValue.]. |
|
434 |
self error:'bad literal index' |
|
435 |
]. |
|
436 |
^ lits at:index put:newValue. |
|
9447 | 437 |
]. |
438 |
||
439 |
"there may be a dummy (nil) literal to make the size > 1" |
|
440 |
(self at:2) isNil ifTrue:[ |
|
14068 | 441 |
index == 1 ifTrue:[^ self at:1 put:newValue]. |
442 |
self error:'bad literal index'. |
|
9447 | 443 |
]. |
444 |
||
445 |
^ self at:index put:newValue |
|
446 |
||
447 |
"Created: / 16-07-2006 / 13:01:15 / cg" |
|
448 |
! |
|
449 |
||
84 | 450 |
literals |
6013 | 451 |
"return the literals as an array" |
84 | 452 |
|
2330
6f501907d079
type hints for literal accessors
Claus Gittinger <cg@exept.de>
parents:
2087
diff
changeset
|
453 |
|lits numLits "{ Class: SmallInteger }"| |
6f501907d079
type hints for literal accessors
Claus Gittinger <cg@exept.de>
parents:
2087
diff
changeset
|
454 |
|
3218
78255e232c66
Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents:
3145
diff
changeset
|
455 |
numLits := self size. |
78255e232c66
Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents:
3145
diff
changeset
|
456 |
numLits == 0 ifTrue:[ |
14068 | 457 |
^ #() |
3218
78255e232c66
Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents:
3145
diff
changeset
|
458 |
]. |
78255e232c66
Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents:
3145
diff
changeset
|
459 |
numLits == 1 ifTrue:[ |
14068 | 460 |
lits := self at:1. |
461 |
lits isArray ifFalse:[ |
|
462 |
^ Array with:lits. |
|
463 |
]. |
|
464 |
^ lits. |
|
3218
78255e232c66
Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents:
3145
diff
changeset
|
465 |
]. |
78255e232c66
Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents:
3145
diff
changeset
|
466 |
|
78255e232c66
Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents:
3145
diff
changeset
|
467 |
"there may be a dummy (nil) literal to make the size > 1" |
78255e232c66
Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents:
3145
diff
changeset
|
468 |
(self at:2) isNil ifTrue:[ |
14068 | 469 |
numLits := 1. |
2330
6f501907d079
type hints for literal accessors
Claus Gittinger <cg@exept.de>
parents:
2087
diff
changeset
|
470 |
]. |
1493
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
471 |
|
2330
6f501907d079
type hints for literal accessors
Claus Gittinger <cg@exept.de>
parents:
2087
diff
changeset
|
472 |
lits := Array new:numLits. |
6f501907d079
type hints for literal accessors
Claus Gittinger <cg@exept.de>
parents:
2087
diff
changeset
|
473 |
1 to:numLits do:[:i| |
14068 | 474 |
lits at:i put:(self at:i). |
1493
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
475 |
]. |
2330
6f501907d079
type hints for literal accessors
Claus Gittinger <cg@exept.de>
parents:
2087
diff
changeset
|
476 |
^ lits. |
1493
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
477 |
|
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
478 |
" |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
479 |
(CompiledCode compiledMethodAt:#literals) literals |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
480 |
" |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
481 |
|
3218
78255e232c66
Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents:
3145
diff
changeset
|
482 |
"Modified: / 30.1.1997 / 17:09:06 / cg" |
78255e232c66
Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents:
3145
diff
changeset
|
483 |
"Modified: / 23.1.1998 / 16:30:07 / stefan" |
1493
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
484 |
! |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
485 |
|
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
486 |
literalsDetect:aBlock ifNone:exceptionBlock |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
487 |
"execute a one arg block for each of our literals. |
14488
12675c2b138a
comment/format in: #literalsDetect:ifNone:
Claus Gittinger <cg@exept.de>
parents:
14441
diff
changeset
|
488 |
Return the first literal for which aBlock returns true, |
6013 | 489 |
or the value from exceptionBlock, if either no literals or |
490 |
none satisfied the block" |
|
1493
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
491 |
|
6013 | 492 |
self literalsDo:[:eachLiteral | |
18416 | 493 |
(aBlock value:eachLiteral) ifTrue:[ |
494 |
^ eachLiteral |
|
495 |
] |
|
1493
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
496 |
]. |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
497 |
^ exceptionBlock value. |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
498 |
|
3218
78255e232c66
Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents:
3145
diff
changeset
|
499 |
"Created: / 24.6.1996 / 14:27:35 / stefan" |
78255e232c66
Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents:
3145
diff
changeset
|
500 |
"Modified: / 30.1.1997 / 16:24:04 / cg" |
78255e232c66
Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents:
3145
diff
changeset
|
501 |
"Modified: / 23.1.1998 / 17:08:37 / stefan" |
1493
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
502 |
! |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
503 |
|
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
504 |
literalsDo:aBlock |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
505 |
"execute a one arg block for each of our literals" |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
506 |
|
2330
6f501907d079
type hints for literal accessors
Claus Gittinger <cg@exept.de>
parents:
2087
diff
changeset
|
507 |
|lits numLits "{ Class: SmallInteger }" | |
1493
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
508 |
|
3218
78255e232c66
Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents:
3145
diff
changeset
|
509 |
numLits := self size. |
78255e232c66
Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents:
3145
diff
changeset
|
510 |
numLits == 0 ifTrue:[ |
14068 | 511 |
^ self |
3218
78255e232c66
Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents:
3145
diff
changeset
|
512 |
]. |
78255e232c66
Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents:
3145
diff
changeset
|
513 |
numLits == 1 ifTrue:[ |
14068 | 514 |
lits := self at:1. |
515 |
numLits := lits size. |
|
6308 | 516 |
|
14068 | 517 |
lits isArray ifFalse:[ |
518 |
lits := self. |
|
519 |
numLits := 1. |
|
520 |
] |
|
1493
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
521 |
] ifFalse:[ |
14068 | 522 |
lits := self. |
523 |
"there may be a dummy (nil) literal to make the size > 1" |
|
524 |
(self at:2) isNil ifTrue:[ |
|
525 |
numLits := 1. |
|
526 |
]. |
|
1493
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
527 |
]. |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
528 |
|
2330
6f501907d079
type hints for literal accessors
Claus Gittinger <cg@exept.de>
parents:
2087
diff
changeset
|
529 |
1 to:numLits do:[:i | |
14068 | 530 |
aBlock value:(lits at:i). |
1493
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
531 |
]. |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
532 |
|
3218
78255e232c66
Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents:
3145
diff
changeset
|
533 |
"Created: / 24.6.1996 / 14:17:12 / stefan" |
78255e232c66
Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents:
3145
diff
changeset
|
534 |
"Modified: / 30.1.1997 / 17:08:05 / cg" |
78255e232c66
Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents:
3145
diff
changeset
|
535 |
"Modified: / 23.1.1998 / 16:39:17 / stefan" |
2695
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2567
diff
changeset
|
536 |
! |
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2567
diff
changeset
|
537 |
|
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2567
diff
changeset
|
538 |
mclass |
19447 | 539 |
"return the class of the receiver's home method. |
20407 | 540 |
That's the class of the method where the block was compiled." |
2695
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2567
diff
changeset
|
541 |
|
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2567
diff
changeset
|
542 |
^ self homeMethod mclass |
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2567
diff
changeset
|
543 |
|
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2567
diff
changeset
|
544 |
"Modified: 19.6.1997 / 16:24:58 / cg" |
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2567
diff
changeset
|
545 |
"Created: 19.6.1997 / 16:27:34 / cg" |
3328 | 546 |
! |
547 |
||
10601 | 548 |
numLiterals |
549 |
"return the number of literals I have" |
|
550 |
||
551 |
|lits numLits "{ Class: SmallInteger }" | |
|
552 |
||
553 |
numLits := self size. |
|
554 |
numLits == 1 ifTrue:[ |
|
14068 | 555 |
lits := self at:1. |
556 |
numLits := lits size. |
|
10601 | 557 |
|
14068 | 558 |
lits isArray ifFalse:[ |
559 |
lits := self. |
|
560 |
numLits := 1. |
|
561 |
] |
|
10601 | 562 |
] ifFalse:[ |
14068 | 563 |
lits := self. |
564 |
"there may be a dummy (nil) literal to make the size > 1" |
|
565 |
(self at:2) isNil ifTrue:[ |
|
566 |
numLits := 1. |
|
567 |
]. |
|
10601 | 568 |
]. |
569 |
^ numLits |
|
570 |
||
571 |
"Created: / 07-06-2007 / 10:08:01 / cg" |
|
572 |
! |
|
573 |
||
3962
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
574 |
numberOfMethodArgs |
18436 | 575 |
<resource: #obsolete> |
3962
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
576 |
"return the number of arguments, the method expects. |
18436 | 577 |
This method is left for backward compatibility - use #argumentCount." |
3962
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
578 |
|
18436 | 579 |
"/ self obsoleteMethodWarning:'use argumentCount'. |
580 |
^ self argumentCount |
|
3962
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
581 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
582 |
"Modified: / 30.1.1999 / 14:55:27 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
583 |
"Created: / 30.1.1999 / 14:55:47 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
584 |
! |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
585 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
586 |
numberOfMethodVars |
14068 | 587 |
"return the number of method local variables. |
588 |
This method is left for backward compatibility - use #numVars." |
|
3962
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
589 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
590 |
"/ self obsoleteMethodWarning:'use numVars'. |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
591 |
^ self numVars |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
592 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
593 |
"Modified: / 30.1.1999 / 14:55:42 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
594 |
"Created: / 30.1.1999 / 14:55:51 / cg" |
14490 | 595 |
! |
596 |
||
597 |
source |
|
598 |
^ self subclassResponsibility. |
|
84 | 599 |
! ! |
600 |
||
6546
9cada8214da7
allow for method to define individual syntaxHighlighterClass
Claus Gittinger <cg@exept.de>
parents:
6544
diff
changeset
|
601 |
!CompiledCode methodsFor:'compiler interface'! |
9cada8214da7
allow for method to define individual syntaxHighlighterClass
Claus Gittinger <cg@exept.de>
parents:
6544
diff
changeset
|
602 |
|
12160 | 603 |
compilerClass |
604 |
"who is responsible to parse the source code? |
|
605 |
Fetch it from the class" |
|
606 |
||
607 |
^ self programmingLanguage compilerClass |
|
608 |
||
609 |
" |
|
610 |
(Object compiledMethodAt:#at:) compilerClass |
|
611 |
" |
|
612 |
! |
|
613 |
||
8419 | 614 |
parserClass |
9304 | 615 |
"who is responsible to parse the source code? |
616 |
Fetch it from the class" |
|
617 |
||
12160 | 618 |
^ self programmingLanguage parserClass |
619 |
||
620 |
" |
|
621 |
(Object compiledMethodAt:#at:) parserClass |
|
622 |
" |
|
623 |
! |
|
8425 | 624 |
|
12160 | 625 |
programmingLanguage |
18416 | 626 |
"/ the following is correct, but might be too slow... |
627 |
"/ we have language-specific Method subclasses anyway, |
|
628 |
"/ so simply redefine there. |
|
629 |
"/ |mclass| |
|
630 |
"/ |
|
631 |
"/ mclass := self mclass. |
|
632 |
"/ mclass isNil ifTrue:[^ SmalltalkLanguage]. |
|
633 |
"/ ^ mclass programmingLanguage |
|
12160 | 634 |
^ SmalltalkLanguage instance |
8419 | 635 |
|
636 |
" |
|
637 |
(Object compiledMethodAt:#at:) parserClass |
|
638 |
" |
|
14153
6f22f72de84d
changed: #programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
14068
diff
changeset
|
639 |
|
6f22f72de84d
changed: #programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
14068
diff
changeset
|
640 |
"Modified (comment): / 01-06-2012 / 21:10:56 / cg" |
8419 | 641 |
! |
642 |
||
6546
9cada8214da7
allow for method to define individual syntaxHighlighterClass
Claus Gittinger <cg@exept.de>
parents:
6544
diff
changeset
|
643 |
syntaxHighlighterClass |
9cada8214da7
allow for method to define individual syntaxHighlighterClass
Claus Gittinger <cg@exept.de>
parents:
6544
diff
changeset
|
644 |
"if #askClass is returned here, my owning class will be asked for the syntaxHighlighter. |
9cada8214da7
allow for method to define individual syntaxHighlighterClass
Claus Gittinger <cg@exept.de>
parents:
6544
diff
changeset
|
645 |
if nil is returned, no syntaxHighlighting will be done. |
9cada8214da7
allow for method to define individual syntaxHighlighterClass
Claus Gittinger <cg@exept.de>
parents:
6544
diff
changeset
|
646 |
Can be redefined in subclasses (MetaMethod) which use special syntax." |
9cada8214da7
allow for method to define individual syntaxHighlighterClass
Claus Gittinger <cg@exept.de>
parents:
6544
diff
changeset
|
647 |
|
12160 | 648 |
^ self programmingLanguage syntaxHighlighterClass |
6546
9cada8214da7
allow for method to define individual syntaxHighlighterClass
Claus Gittinger <cg@exept.de>
parents:
6544
diff
changeset
|
649 |
! ! |
9cada8214da7
allow for method to define individual syntaxHighlighterClass
Claus Gittinger <cg@exept.de>
parents:
6544
diff
changeset
|
650 |
|
1461
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1293
diff
changeset
|
651 |
!CompiledCode methodsFor:'converting'! |
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1293
diff
changeset
|
652 |
|
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1293
diff
changeset
|
653 |
makeRealMethod |
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1293
diff
changeset
|
654 |
"by default, we are a real method. |
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1293
diff
changeset
|
655 |
Subclasses (e.g. LazyMethod) may redefine this" |
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1293
diff
changeset
|
656 |
|
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1293
diff
changeset
|
657 |
^ self |
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1293
diff
changeset
|
658 |
|
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1293
diff
changeset
|
659 |
"Created: 7.6.1996 / 12:45:50 / stefan" |
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1293
diff
changeset
|
660 |
! ! |
dd25bb1e9973
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
1293
diff
changeset
|
661 |
|
3962
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
662 |
!CompiledCode methodsFor:'debugging'! |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
663 |
|
5304 | 664 |
breakPointAfter:countInvocations |
665 |
"arrange for a breakpoint-debugger to be opened when this method |
|
666 |
was invoked countInvocations times." |
|
667 |
||
668 |
MessageTracer trapMethod:self after:countInvocations. |
|
669 |
||
670 |
! |
|
671 |
||
5538 | 672 |
breakPointIf:conditionBlock |
673 |
"arrange for a breakpoint-debugger to be opened when this method |
|
22431 | 674 |
is invoked AND conditionBlock evaluates to true. |
675 |
conditionBlock gets context and method as (optional) arguments." |
|
5538 | 676 |
|
677 |
MessageTracer trapMethod:self if:conditionBlock |
|
678 |
||
679 |
"Created: / 18.8.2000 / 22:09:59 / cg" |
|
680 |
! |
|
681 |
||
3962
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
682 |
breakPointInProcess:aProcess |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
683 |
"arrange for a breakpoint-debugger to be opened when this method |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
684 |
is invoked from withn aProcess." |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
685 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
686 |
MessageTracer trapMethod:self inProcess:aProcess. |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
687 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
688 |
"Modified: / 12.1.1998 / 18:22:39 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
689 |
"Created: / 30.1.1999 / 14:50:01 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
690 |
! |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
691 |
|
22431 | 692 |
breakPointOnReturnIf:conditionBlock |
693 |
"arrange for a breakpoint-debugger to be opened when this method |
|
694 |
returns AND conditionBlock evaluates to true. |
|
695 |
conditionBlock gets returnValue, context and method as (optional) arguments." |
|
696 |
||
697 |
MessageTracer trapMethod:self onReturnIf:conditionBlock |
|
698 |
||
699 |
"Created: / 18.8.2000 / 22:09:59 / cg" |
|
700 |
! |
|
701 |
||
3962
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
702 |
clearBreakPoint |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
703 |
"remove any break/trace-point on this method" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
704 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
705 |
MessageTracer unwrapMethod:self. |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
706 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
707 |
"Modified: / 12.1.1998 / 18:22:14 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
708 |
"Created: / 30.1.1999 / 14:49:53 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
709 |
! |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
710 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
711 |
isCounted |
5525 | 712 |
"obsolete - replaced by isCountingMemoryUsage" |
3962
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
713 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
714 |
^ MessageTracer notNil |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
715 |
and:[MessageTracer isCountingMemoryUsage:self] |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
716 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
717 |
"Modified: / 27.7.1998 / 11:05:36 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
718 |
"Created: / 30.1.1999 / 14:48:57 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
719 |
! |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
720 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
721 |
isCounting |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
722 |
"return true, if invokations of this method are counted" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
723 |
|
15409 | 724 |
^ MessageTracer notNil and:[MessageTracer isCounting:self] |
3962
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
725 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
726 |
"Modified: / 27.7.1998 / 11:06:00 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
727 |
"Created: / 30.1.1999 / 14:49:19 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
728 |
! |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
729 |
|
15409 | 730 |
isCountingByReceiverClass |
731 |
"return true, if invokations of this method are counted" |
|
732 |
||
733 |
^ MessageTracer notNil and:[MessageTracer isCountingByReceiverClass:self] |
|
734 |
! |
|
735 |
||
3962
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
736 |
isCountingMemoryUsage |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
737 |
"return true, if memory allocations done by this method (and callees) |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
738 |
are counted" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
739 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
740 |
^ MessageTracer notNil |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
741 |
and:[MessageTracer isCountingMemoryUsage:self] |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
742 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
743 |
"Modified: / 27.7.1998 / 11:06:23 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
744 |
"Created: / 30.1.1999 / 14:49:26 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
745 |
! |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
746 |
|
5525 | 747 |
isTiming |
21788 | 748 |
"return true if timing statistics are being gathered on this method." |
5525 | 749 |
|
750 |
^ MessageTracer notNil |
|
751 |
and:[MessageTracer isTiming:self] |
|
21788 | 752 |
|
753 |
"Modified (comment): / 08-06-2017 / 14:01:59 / mawalch" |
|
5525 | 754 |
! |
755 |
||
3962
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
756 |
resetCountingStatistics |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
757 |
"reset count statistics of the receiver" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
758 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
759 |
MessageTracer resetCountOfMethod:self |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
760 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
761 |
"Modified: / 12.1.1998 / 18:24:30 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
762 |
"Created: / 30.1.1999 / 14:50:19 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
763 |
! |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
764 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
765 |
resetMemoryUsageStatistics |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
766 |
"reset count statistics of the receiver" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
767 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
768 |
MessageTracer resetMemoryUsageOfMethod:self |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
769 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
770 |
"Modified: / 12.1.1998 / 18:24:30 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
771 |
"Created: / 30.1.1999 / 14:50:22 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
772 |
! |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
773 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
774 |
resetTimingStatistics |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
775 |
"reset timing statistics of the receiver" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
776 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
777 |
MessageTracer resetExecutionTimesOfMethod:self |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
778 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
779 |
"Modified: / 12.1.1998 / 18:24:30 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
780 |
"Created: / 30.1.1999 / 14:50:25 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
781 |
! |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
782 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
783 |
setBreakPoint |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
784 |
"arrange for a breakpoint-debugger to be opened when this method |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
785 |
is invoked." |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
786 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
787 |
MessageTracer trapMethod:self. |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
788 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
789 |
"Modified: / 12.1.1998 / 18:22:36 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
790 |
"Created: / 30.1.1999 / 14:50:27 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
791 |
! |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
792 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
793 |
setTraceFullPoint |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
794 |
"arrange for a full-backtrace to be sent to the standard-error stream |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
795 |
when this method is invoked." |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
796 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
797 |
MessageTracer traceMethodFull:self on:Transcript |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
798 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
799 |
"Modified: / 12.1.1998 / 18:23:11 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
800 |
"Created: / 30.1.1999 / 14:50:30 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
801 |
! |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
802 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
803 |
setTracePoint |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
804 |
"arrange for a trace-message to be sent to the standard-error stream |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
805 |
when this method is invoked." |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
806 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
807 |
MessageTracer traceMethod:self on:Transcript |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
808 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
809 |
"Modified: / 12.1.1998 / 18:23:23 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
810 |
"Created: / 30.1.1999 / 14:50:33 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
811 |
! |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
812 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
813 |
setTraceSenderPoint |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
814 |
"arrange for a sender-trace-message to be sent to the standard-error stream |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
815 |
when this method is invoked." |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
816 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
817 |
MessageTracer traceMethodSender:self on:Transcript |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
818 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
819 |
"Modified: / 12.1.1998 / 18:23:31 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
820 |
"Created: / 30.1.1999 / 14:50:36 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
821 |
! |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
822 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
823 |
startCounting |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
824 |
"start counting invokations of the receiver" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
825 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
826 |
MessageTracer countMethod:self |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
827 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
828 |
"Modified: / 12.1.1998 / 18:23:45 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
829 |
"Created: / 30.1.1999 / 14:50:38 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
830 |
! |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
831 |
|
15409 | 832 |
startCountingByReceiverClass |
833 |
"start counting invokations of the receiver" |
|
834 |
||
835 |
MessageTracer countMethodByReceiverClass:self |
|
836 |
||
837 |
"Modified: / 12.1.1998 / 18:23:45 / cg" |
|
838 |
"Created: / 30.1.1999 / 14:50:38 / cg" |
|
839 |
! |
|
840 |
||
3962
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
841 |
startCountingMemoryUsage |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
842 |
"start counting memory usage of the receiver (and every callee)" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
843 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
844 |
MessageTracer countMemoryUsageOfMethod:self |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
845 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
846 |
"Modified: / 27.7.1998 / 11:06:55 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
847 |
"Created: / 30.1.1999 / 14:50:41 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
848 |
! |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
849 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
850 |
startTiming |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
851 |
"start timing the receiver" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
852 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
853 |
MessageTracer timeMethod:self |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
854 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
855 |
"Modified: / 12.1.1998 / 18:24:05 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
856 |
"Created: / 30.1.1999 / 14:50:44 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
857 |
! |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
858 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
859 |
stopCounting |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
860 |
"stop counting calls of the receiver" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
861 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
862 |
MessageTracer stopCountingMethod:self |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
863 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
864 |
"Modified: / 12.1.1998 / 18:24:15 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
865 |
"Created: / 30.1.1999 / 14:50:47 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
866 |
! |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
867 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
868 |
stopCountingMemoryUsage |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
869 |
"stop counting memory usage of the receiver" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
870 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
871 |
MessageTracer stopCountingMemoryUsageOfMethod:self |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
872 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
873 |
"Modified: / 12.1.1998 / 18:24:22 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
874 |
"Created: / 30.1.1999 / 14:50:51 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
875 |
! |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
876 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
877 |
stopTiming |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
878 |
"stop timing of the receiver" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
879 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
880 |
MessageTracer stopTimingMethod:self |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
881 |
|
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
882 |
"Modified: / 12.1.1998 / 18:24:30 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
883 |
"Created: / 30.1.1999 / 14:50:54 / cg" |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
884 |
! ! |
c941b3a72553
code move from Method (stuff common to Method & JavaMethod)
Claus Gittinger <cg@exept.de>
parents:
3933
diff
changeset
|
885 |
|
17546
dbbc0f131425
Moved breakpointsDo: to CompiledCode
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17513
diff
changeset
|
886 |
!CompiledCode methodsFor:'enumeration'! |
dbbc0f131425
Moved breakpointsDo: to CompiledCode
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17513
diff
changeset
|
887 |
|
dbbc0f131425
Moved breakpointsDo: to CompiledCode
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17513
diff
changeset
|
888 |
breakpointsDo:aBlock |
dbbc0f131425
Moved breakpointsDo: to CompiledCode
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17513
diff
changeset
|
889 |
"Evaluate `aBlock` for every breakpoint installed in this method" |
dbbc0f131425
Moved breakpointsDo: to CompiledCode
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17513
diff
changeset
|
890 |
|
dbbc0f131425
Moved breakpointsDo: to CompiledCode
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17513
diff
changeset
|
891 |
"Created: / 23-02-2015 / 14:46:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
dbbc0f131425
Moved breakpointsDo: to CompiledCode
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17513
diff
changeset
|
892 |
! ! |
dbbc0f131425
Moved breakpointsDo: to CompiledCode
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17513
diff
changeset
|
893 |
|
623 | 894 |
!CompiledCode methodsFor:'error handling'! |
895 |
||
7150 | 896 |
badArgumentArray:argsGiven |
1872 | 897 |
"{ Pragma: +optSpace }" |
898 |
||
14068 | 899 |
"this error is triggered, if a non-array is passed to |
1544 | 900 |
#valueWithReceiver:.. type of methods" |
623 | 901 |
|
7603
88c60268d47f
Exception classes initialize themself.
Stefan Vogel <sv@exept.de>
parents:
7261
diff
changeset
|
902 |
^ ArgumentError |
14068 | 903 |
raiseRequestWith:self |
904 |
errorString:' - argumentArray is not an Array' |
|
1544 | 905 |
|
1872 | 906 |
"Modified: 4.11.1996 / 22:46:52 / cg" |
623 | 907 |
! |
908 |
||
909 |
badLiteralTable |
|
1872 | 910 |
"{ Pragma: +optSpace }" |
911 |
||
623 | 912 |
"this error is triggered, when a block/method is called with a bad literal |
913 |
array (i.e. non-array) - this can only happen, if the |
|
1544 | 914 |
compiler is broken or someone played around with a blocks/methods |
623 | 915 |
literal table or the GC is broken and corrupted it." |
916 |
||
7603
88c60268d47f
Exception classes initialize themself.
Stefan Vogel <sv@exept.de>
parents:
7261
diff
changeset
|
917 |
^ BadLiteralsError raise. |
1544 | 918 |
|
1872 | 919 |
"Modified: 4.11.1996 / 22:46:55 / cg" |
623 | 920 |
! |
921 |
||
5744 | 922 |
interpretWithReceiver:aReceiver |
6544 | 923 |
"invoked by VM for non-Smalltalk-methods (MetaMethods)" |
924 |
||
925 |
self subclassResponsibility |
|
5744 | 926 |
! |
927 |
||
928 |
interpretWithReceiver:aReceiver arg:arg1 |
|
6544 | 929 |
"invoked by VM for non-Smalltalk-methods (MetaMethods)" |
930 |
||
931 |
self subclassResponsibility |
|
5744 | 932 |
! |
933 |
||
934 |
interpretWithReceiver:aReceiver arg:arg1 arg:arg2 |
|
6544 | 935 |
"invoked by VM for non-Smalltalk-methods (MetaMethods)" |
936 |
||
937 |
self subclassResponsibility |
|
5744 | 938 |
! |
939 |
||
940 |
interpretWithReceiver:aReceiver arg:arg1 arg:arg2 arg:arg3 |
|
6544 | 941 |
"invoked by VM for non-Smalltalk-methods (MetaMethods)" |
942 |
||
943 |
self subclassResponsibility |
|
944 |
! |
|
945 |
||
946 |
interpretWithReceiver:aReceiver arguments:argVector |
|
947 |
"invoked by VM for non-Smalltalk-methods (MetaMethods)" |
|
948 |
||
949 |
self subclassResponsibility |
|
5744 | 950 |
! |
951 |
||
623 | 952 |
invalidByteCode |
1872 | 953 |
"{ Pragma: +optSpace }" |
954 |
||
623 | 955 |
"this error is triggered when the interpreter tries to execute a |
956 |
code object, where the byteCode is nonNil, but not a ByteArray. |
|
957 |
Can only happen when Compiler/runtime system is broken or |
|
1544 | 958 |
someone played around with a blocks/methods code." |
623 | 959 |
|
7603
88c60268d47f
Exception classes initialize themself.
Stefan Vogel <sv@exept.de>
parents:
7261
diff
changeset
|
960 |
^ InvalidByteCodeError raise. |
1544 | 961 |
|
1872 | 962 |
"Modified: 4.11.1996 / 22:46:59 / cg" |
623 | 963 |
! |
964 |
||
965 |
invalidInstruction |
|
1872 | 966 |
"{ Pragma: +optSpace }" |
967 |
||
623 | 968 |
"this error is triggered when the bytecode-interpreter tries to |
969 |
execute an invalid bytecode instruction. |
|
970 |
Can only happen when Compiler/runtime system is broken or |
|
1544 | 971 |
someone played around with a blocks/methods code." |
623 | 972 |
|
7603
88c60268d47f
Exception classes initialize themself.
Stefan Vogel <sv@exept.de>
parents:
7261
diff
changeset
|
973 |
^ InvalidInstructionError raise. |
1544 | 974 |
|
1872 | 975 |
"Modified: 4.11.1996 / 22:47:03 / cg" |
623 | 976 |
! |
977 |
||
978 |
noByteCode |
|
1872 | 979 |
"{ Pragma: +optSpace }" |
980 |
||
623 | 981 |
"this error is triggered when the interpreter tries to execute a |
982 |
code object, where both the code and byteCode instances are nil. |
|
983 |
This can happen if: |
|
14068 | 984 |
- the Compiler/runtime system is broken, (should not happen) |
1544 | 985 |
|
14068 | 986 |
- someone played around with a block/method, (you should not do this) |
1544 | 987 |
|
14068 | 988 |
- compilation of a lazy method failed |
989 |
(i.e. the lazy method contains an error or |
|
990 |
it contains primitive code and there is no stc compiler available) |
|
1544 | 991 |
|
14068 | 992 |
- an unloaded object modules method is called for. |
1544 | 993 |
|
14068 | 994 |
Only the first case is to be considered serious |
1544 | 995 |
- it should not happen if the system is used correctly." |
623 | 996 |
|
9296
ff844fd2a954
NoByteCodeError is proceedable
Claus Gittinger <cg@exept.de>
parents:
8913
diff
changeset
|
997 |
^ NoByteCodeError raiseRequest. |
1544 | 998 |
|
1872 | 999 |
"Modified: 4.11.1996 / 22:47:07 / cg" |
623 | 1000 |
! |
1001 |
||
1002 |
receiverNotBoolean:anObject |
|
1872 | 1003 |
"{ Pragma: +optSpace }" |
1004 |
||
623 | 1005 |
"this error is triggered when the bytecode-interpreter tries to |
1544 | 1006 |
execute ifTrue:/ifFalse or whileTrue: - type of expressions where the |
1007 |
receiver is neither true nor false. |
|
1008 |
Machine compiled code does not detect this, and may behave undeterministec." |
|
623 | 1009 |
|
7603
88c60268d47f
Exception classes initialize themself.
Stefan Vogel <sv@exept.de>
parents:
7261
diff
changeset
|
1010 |
^ NonBooleanReceiverError raise. |
1544 | 1011 |
|
1872 | 1012 |
"Modified: 4.11.1996 / 22:47:11 / cg" |
623 | 1013 |
! |
1014 |
||
1015 |
tooManyArguments |
|
1872 | 1016 |
"{ Pragma: +optSpace }" |
1017 |
||
623 | 1018 |
"this error is triggered, when a method/block tries to perform a send with |
14068 | 1019 |
more arguments than supported by the interpreter. |
1020 |
This can only happen, if the compiler has been changed without |
|
1544 | 1021 |
updating the VM, since the compiler checks for allowed number of |
1022 |
arguments." |
|
623 | 1023 |
|
14441 | 1024 |
^ WrongNumberOfArgumentsError |
18416 | 1025 |
raiseRequestWith:self |
1026 |
errorString:' - too many args in send' |
|
1544 | 1027 |
|
1872 | 1028 |
"Modified: 4.11.1996 / 22:47:14 / cg" |
2827
0f653b53179a
provide #wrongNumberOfArgs: for all subclasses.
Claus Gittinger <cg@exept.de>
parents:
2810
diff
changeset
|
1029 |
! |
0f653b53179a
provide #wrongNumberOfArgs: for all subclasses.
Claus Gittinger <cg@exept.de>
parents:
2810
diff
changeset
|
1030 |
|
7150 | 1031 |
wrongNumberOfArguments:numArgsGiven |
2827
0f653b53179a
provide #wrongNumberOfArgs: for all subclasses.
Claus Gittinger <cg@exept.de>
parents:
2810
diff
changeset
|
1032 |
"{ Pragma: +optSpace }" |
0f653b53179a
provide #wrongNumberOfArgs: for all subclasses.
Claus Gittinger <cg@exept.de>
parents:
2810
diff
changeset
|
1033 |
|
0f653b53179a
provide #wrongNumberOfArgs: for all subclasses.
Claus Gittinger <cg@exept.de>
parents:
2810
diff
changeset
|
1034 |
"this error is triggered by the VM, if a method is called with a wrong number |
14068 | 1035 |
of arguments. |
2827
0f653b53179a
provide #wrongNumberOfArgs: for all subclasses.
Claus Gittinger <cg@exept.de>
parents:
2810
diff
changeset
|
1036 |
This only applies to #valueWithReceiverXXX and #perform:withArguments: - sends. |
0f653b53179a
provide #wrongNumberOfArgs: for all subclasses.
Claus Gittinger <cg@exept.de>
parents:
2810
diff
changeset
|
1037 |
With a normal send, this error cannot happen." |
0f653b53179a
provide #wrongNumberOfArgs: for all subclasses.
Claus Gittinger <cg@exept.de>
parents:
2810
diff
changeset
|
1038 |
|
7150 | 1039 |
^ WrongNumberOfArgumentsError |
20292 | 1040 |
raiseRequestWith:self |
1041 |
errorString:(' - %1 got %2 arg(s) where %3 expected' |
|
1042 |
bindWith:self printString "/ self class name |
|
1043 |
with:numArgsGiven |
|
1044 |
with:self argumentCount) |
|
2827
0f653b53179a
provide #wrongNumberOfArgs: for all subclasses.
Claus Gittinger <cg@exept.de>
parents:
2810
diff
changeset
|
1045 |
|
6663
a0a42694a4d5
errorStrings when raising exceptions.
Stefan Vogel <sv@exept.de>
parents:
6546
diff
changeset
|
1046 |
" |
10905
96c44ab0e80f
wrongNumberOfArguments: error message
Claus Gittinger <cg@exept.de>
parents:
10601
diff
changeset
|
1047 |
2 perform:#+ |
6663
a0a42694a4d5
errorStrings when raising exceptions.
Stefan Vogel <sv@exept.de>
parents:
6546
diff
changeset
|
1048 |
" |
a0a42694a4d5
errorStrings when raising exceptions.
Stefan Vogel <sv@exept.de>
parents:
6546
diff
changeset
|
1049 |
|
2827
0f653b53179a
provide #wrongNumberOfArgs: for all subclasses.
Claus Gittinger <cg@exept.de>
parents:
2810
diff
changeset
|
1050 |
"Modified: 1.8.1997 / 00:23:10 / cg" |
623 | 1051 |
! ! |
1052 |
||
2800
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1053 |
!CompiledCode methodsFor:'executing'! |
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1054 |
|
24353 | 1055 |
valueWithReceiver:anObject |
1056 |
"low level call of a method's code - BIG DANGER ALERT. |
|
1057 |
Perform the receiver-method on anObject as receiver and no arguments. |
|
1058 |
This does NO message lookup at all and mimics a traditional function call. |
|
1059 |
This method is provided for debugging- and breakpoint-support |
|
1060 |
(replacing a method by a stub and recalling the original), or to implement |
|
1061 |
experimental MI implementations - it is not for general use. |
|
1062 |
||
1063 |
The receiver must be a method compiled in anObject's class or one of its |
|
1064 |
superclasses and also, the number of arguments given must match the method's |
|
1065 |
expectations - |
|
1066 |
- otherwise strange things (and also strange crashes) can occur. |
|
1067 |
The system is NOT always detecting a wrong method/receiver combination. |
|
1068 |
YOU HAVE BEEN WARNED." |
|
1069 |
||
1070 |
^ self |
|
1071 |
valueWithReceiver:anObject |
|
1072 |
arguments:nil |
|
1073 |
selector:nil |
|
1074 |
search:nil |
|
1075 |
sender:nil |
|
1076 |
||
1077 |
"Created: / 25-06-2019 / 09:13:02 / Claus Gittinger" |
|
1078 |
! |
|
1079 |
||
2800
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1080 |
valueWithReceiver:anObject arguments:argArray |
22367 | 1081 |
"low level call of a method's code - BIG DANGER ALERT. |
24353 | 1082 |
Perform the receiver-method on anObject as receiver and argArray as arguments. |
1083 |
This does NO message lookup at all and mimics a traditional function call. |
|
14068 | 1084 |
This method is provided for debugging- and breakpoint-support |
2800
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1085 |
(replacing a method by a stub and recalling the original), or to implement |
14068 | 1086 |
experimental MI implementations - it is not for general use. |
2800
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1087 |
|
22934 | 1088 |
The receiver must be a method compiled in anObject's class or one of its |
22367 | 1089 |
superclasses and also, the number of arguments given must match the method's |
2800
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1090 |
expectations - |
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1091 |
- otherwise strange things (and also strange crashes) can occur. |
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1092 |
The system is NOT always detecting a wrong method/receiver combination. |
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1093 |
YOU HAVE BEEN WARNED." |
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1094 |
|
14068 | 1095 |
^ self |
24353 | 1096 |
valueWithReceiver:anObject |
1097 |
arguments:argArray |
|
1098 |
selector:nil |
|
1099 |
search:nil |
|
1100 |
sender:nil |
|
2800
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1101 |
|
22367 | 1102 |
"Modified: / 04-04-1997 / 23:33:56 / cg" |
1103 |
"Created: / 30-07-1997 / 12:04:52 / cg" |
|
1104 |
"Modified (comment): / 21-11-2017 / 13:00:13 / cg" |
|
24353 | 1105 |
"Modified (comment): / 25-06-2019 / 09:43:32 / Claus Gittinger" |
2800
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1106 |
! |
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1107 |
|
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1108 |
valueWithReceiver:anObject arguments:argArray selector:aSymbol |
24353 | 1109 |
"low level call of a method's code - BIG DANGER ALERT. |
1110 |
Perform the receiver-method on anObject as receiver and argArray as arguments. |
|
1111 |
This does NO message lookup at all and mimics a traditional function call. |
|
14068 | 1112 |
This method is provided for debugging- and breakpoint-support |
2800
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1113 |
(replacing a method by a stub and recalling the original), or to implement |
14068 | 1114 |
experimental MI implementations - it is not for general use. |
2800
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1115 |
|
22934 | 1116 |
The receiver must be a method compiled in anObject's class or one of its |
22367 | 1117 |
superclasses and also, the number of arguments given must match the method's |
2800
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1118 |
expectations - |
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1119 |
- otherwise strange things (and also strange crashes) can occur. |
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1120 |
The system is NOT always detecting a wrong method/receiver combination. |
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1121 |
YOU HAVE BEEN WARNED." |
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1122 |
|
14068 | 1123 |
^ self |
24353 | 1124 |
valueWithReceiver:anObject |
1125 |
arguments:argArray |
|
1126 |
selector:aSymbol |
|
1127 |
search:nil |
|
1128 |
sender:nil |
|
2800
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1129 |
|
22367 | 1130 |
"Modified: / 04-04-1997 / 23:34:08 / cg" |
1131 |
"Created: / 30-07-1997 / 12:04:49 / cg" |
|
1132 |
"Modified (comment): / 21-11-2017 / 13:00:23 / cg" |
|
24353 | 1133 |
"Modified (comment): / 25-06-2019 / 09:43:41 / Claus Gittinger" |
2800
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1134 |
! |
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1135 |
|
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1136 |
valueWithReceiver:anObject arguments:argArray selector:aSymbol search:aClass |
24353 | 1137 |
"low level call of a method's code - BIG DANGER ALERT. |
1138 |
Perform the receiver-method on anObject as receiver and argArray as arguments. |
|
1139 |
This does NO message lookup at all and mimics a traditional function call. |
|
14068 | 1140 |
This method is provided for debugging- and breakpoint-support |
2800
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1141 |
(replacing a method by a stub and recalling the original), or to implement |
14068 | 1142 |
experimental MI implementations - it is not for general use. |
2800
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1143 |
|
22934 | 1144 |
The receiver must be a method compiled in anObject's class or one of its |
22367 | 1145 |
superclasses and also, the number of arguments given must match the method's |
2800
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1146 |
expectations - |
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1147 |
- otherwise strange things (and also strange crashes) can occur. |
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1148 |
The system is NOT always detecting a wrong method/receiver combination. |
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1149 |
YOU HAVE BEEN WARNED." |
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1150 |
|
14068 | 1151 |
^ self |
24353 | 1152 |
valueWithReceiver:anObject |
1153 |
arguments:argArray |
|
1154 |
selector:aSymbol |
|
1155 |
search:nil |
|
1156 |
sender:nil |
|
2800
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1157 |
|
22367 | 1158 |
"Modified: / 04-04-1997 / 23:34:19 / cg" |
1159 |
"Created: / 30-07-1997 / 12:04:46 / cg" |
|
1160 |
"Modified (comment): / 21-11-2017 / 13:00:28 / cg" |
|
24353 | 1161 |
"Modified (comment): / 25-06-2019 / 09:43:58 / Claus Gittinger" |
2800
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1162 |
! |
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1163 |
|
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1164 |
valueWithReceiver:anObject arguments:argArray selector:aSymbol search:aClass sender:virtualSender |
24353 | 1165 |
"low level call of a method's code - BIG DANGER ALERT. |
18416 | 1166 |
Perform the receiver-method on anObject as receiver and argArray as arguments. |
1167 |
This does NO message lookup at all and mimics a traditional function call. |
|
14068 | 1168 |
This method is provided for debugging- and breakpoint-support |
2800
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1169 |
(replacing a method by a stub and recalling the original), or to implement |
14068 | 1170 |
experimental MI implementations - it is not for general use. |
2800
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1171 |
|
18416 | 1172 |
The receiver must be a method compiled in anObject's class or one of its |
2800
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1173 |
superclasses and also, the number of arguments given must match the methods |
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1174 |
expectations - |
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1175 |
- otherwise strange things (and also strange crashes) can occur. |
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1176 |
The system is NOT always detecting a wrong method/receiver combination. |
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1177 |
YOU HAVE BEEN WARNED." |
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1178 |
|
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1179 |
%{ |
18423 | 1180 |
#ifdef __SCHTEAM__ |
1181 |
{ |
|
24353 | 1182 |
int numArgs = 0; |
1183 |
STVector v = null; |
|
1184 |
||
1185 |
if (argArray != STObject.Nil) { |
|
1186 |
v = argArray.asSTVector(); |
|
1187 |
numArgs = v.vectorLength(); |
|
1188 |
} |
|
1189 |
||
1190 |
STCallable me = (STCompiledMethod)self.smalltalkCheckNumberOfArgs(1+numArgs); |
|
1191 |
||
1192 |
__c__.push(anObject); |
|
1193 |
for (int i=0; i<numArgs; i++) { |
|
1194 |
__c__.push( v.vectorRef(i) ); |
|
1195 |
} |
|
1196 |
// the selector and searchClass args are not needed/passed |
|
1197 |
// the virtualSender is (currently) not supported |
|
1198 |
// (this is cosmetics only; therefore it's done later) |
|
1199 |
return __c__.TAILCALL_nPUSHED( me, 1+numArgs); |
|
18423 | 1200 |
} |
1201 |
/* NOT REACHED */ |
|
1202 |
#else |
|
2800
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1203 |
OBJFUNC code; |
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1204 |
OBJ searchClass; |
20292 | 1205 |
static struct inlineCache dummy = __DUMMYILC0(0); |
2800
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1206 |
int nargs; |
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1207 |
OBJ *ap; |
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1208 |
|
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1209 |
/* |
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1210 |
* args must be an array, or nil |
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1211 |
*/ |
18196 | 1212 |
if (__isArrayLike(argArray)) { |
24353 | 1213 |
nargs = __arraySize(argArray); |
1214 |
ap = __ArrayInstPtr(argArray)->a_element; |
|
2800
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1215 |
} else { |
24353 | 1216 |
if (argArray != nil) { |
1217 |
goto badArgs; |
|
1218 |
} |
|
1219 |
nargs = 0; |
|
1220 |
ap = (OBJ *)0; |
|
2800
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1221 |
} |
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1222 |
|
18423 | 1223 |
# ifdef F_NARGS |
14068 | 1224 |
if (((__intVal(__INST(flags)) & F_NARGS) >> F_NARGSHIFT) == nargs) |
18423 | 1225 |
# endif |
2800
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1226 |
{ |
24353 | 1227 |
code = __MethodInstPtr(self)->m_code; |
1228 |
if (aClass == nil) { |
|
1229 |
searchClass = dummy.ilc_class = __Class(anObject); |
|
1230 |
} else { |
|
1231 |
searchClass = dummy.ilc_class = aClass; |
|
1232 |
} |
|
1233 |
||
1234 |
if (nargs <= 15) { |
|
1235 |
OBJ rslt; |
|
18423 | 1236 |
# ifdef CONTEXT_DEBUG |
24353 | 1237 |
OBJ sav = __thisContext; |
18423 | 1238 |
# endif |
3140 | 1239 |
|
24353 | 1240 |
/* |
1241 |
* add virtual sender (unwinding) here later, |
|
1242 |
* to allow hiding contexts in lazy methods. |
|
1243 |
* (this is cosmetics only; therefore its done later) |
|
1244 |
*/ |
|
1245 |
if (code) { |
|
1246 |
/* compiled code */ |
|
1247 |
switch (nargs) { |
|
1248 |
case 0: |
|
1249 |
rslt = (*code)(anObject, aSymbol, searchClass, &dummy); |
|
1250 |
break; |
|
1251 |
||
1252 |
case 1: |
|
1253 |
rslt = (*code)(anObject, aSymbol, searchClass, &dummy, ap[0]); |
|
1254 |
break; |
|
1255 |
||
1256 |
case 2: |
|
1257 |
rslt = (*code)(anObject, aSymbol, searchClass, &dummy, ap[0], ap[1]); |
|
1258 |
break; |
|
1259 |
||
1260 |
case 3: |
|
1261 |
rslt = (*code)(anObject, aSymbol, searchClass, &dummy, ap[0], ap[1], ap[2]); |
|
1262 |
break; |
|
1263 |
||
1264 |
case 4: |
|
1265 |
rslt = (*code)(anObject, aSymbol, searchClass, &dummy, |
|
1266 |
ap[0], ap[1], ap[2], ap[3]); |
|
1267 |
break; |
|
1268 |
||
1269 |
case 5: |
|
1270 |
rslt = (*code)(anObject, aSymbol, searchClass, &dummy, |
|
1271 |
ap[0], ap[1], ap[2], ap[3], ap[4]); |
|
1272 |
break; |
|
1273 |
||
1274 |
case 6: |
|
1275 |
rslt = (*code)(anObject, aSymbol, searchClass, &dummy, |
|
1276 |
ap[0], ap[1], ap[2], ap[3], ap[4], ap[5]); |
|
1277 |
break; |
|
1278 |
||
1279 |
case 7: |
|
1280 |
rslt = (*code)(anObject, aSymbol, searchClass, &dummy, |
|
1281 |
ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6]); |
|
1282 |
break; |
|
1283 |
||
1284 |
case 8: |
|
1285 |
rslt = (*code)(anObject, aSymbol, searchClass, &dummy, |
|
1286 |
ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7]); |
|
1287 |
break; |
|
1288 |
||
1289 |
case 9: |
|
1290 |
rslt = (*code)(anObject, aSymbol, searchClass, &dummy, |
|
1291 |
ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8]); |
|
1292 |
break; |
|
1293 |
||
1294 |
case 10: |
|
1295 |
rslt = (*code)(anObject, aSymbol, searchClass, &dummy, |
|
1296 |
ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8], |
|
1297 |
ap[9]); |
|
1298 |
break; |
|
1299 |
||
1300 |
case 11: |
|
1301 |
rslt = (*code)(anObject, aSymbol, searchClass, &dummy, |
|
1302 |
ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8], |
|
1303 |
ap[9], ap[10]); |
|
1304 |
break; |
|
1305 |
||
1306 |
case 12: |
|
1307 |
rslt = (*code)(anObject, aSymbol, searchClass, &dummy, |
|
1308 |
ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8], |
|
1309 |
ap[9], ap[10], ap[11]); |
|
1310 |
break; |
|
1311 |
||
1312 |
case 13: |
|
1313 |
rslt = (*code)(anObject, aSymbol, searchClass, &dummy, |
|
1314 |
ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8], |
|
1315 |
ap[9], ap[10], ap[11], ap[12]); |
|
1316 |
break; |
|
1317 |
||
1318 |
case 14: |
|
1319 |
rslt = (*code)(anObject, aSymbol, searchClass, &dummy, |
|
1320 |
ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8], |
|
1321 |
ap[9], ap[10], ap[11], ap[12], ap[13]); |
|
1322 |
break; |
|
1323 |
||
1324 |
case 15: |
|
1325 |
rslt = (*code)(anObject, aSymbol, searchClass, &dummy, |
|
1326 |
ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8], |
|
1327 |
ap[9], ap[10], ap[11], ap[12], ap[13], ap[14]); |
|
1328 |
break; |
|
1329 |
} |
|
1330 |
} else { |
|
1331 |
/* interpreted code */ |
|
18423 | 1332 |
# ifdef PASS_ARG_POINTER |
24353 | 1333 |
rslt = __interpret(self, nargs, anObject, aSymbol, searchClass, &dummy, ap); |
18423 | 1334 |
# else |
24353 | 1335 |
switch (nargs) { |
1336 |
case 0: |
|
1337 |
rslt = __interpret(self, 0, anObject, aSymbol, searchClass, &dummy); |
|
1338 |
break; |
|
1339 |
||
1340 |
case 1: |
|
1341 |
rslt = __interpret(self, 1, anObject, aSymbol, searchClass, &dummy, |
|
1342 |
ap[0]); |
|
1343 |
break; |
|
1344 |
||
1345 |
case 2: |
|
1346 |
rslt = __interpret(self, 2, anObject, aSymbol, searchClass, &dummy, |
|
1347 |
ap[0], ap[1]); |
|
1348 |
break; |
|
1349 |
||
1350 |
case 3: |
|
1351 |
rslt = __interpret(self, 3, anObject, aSymbol, searchClass, &dummy, |
|
1352 |
ap[0], ap[1], ap[2]); |
|
1353 |
break; |
|
1354 |
||
1355 |
case 4: |
|
1356 |
rslt = __interpret(self, 4, anObject, aSymbol, searchClass, &dummy, |
|
1357 |
ap[0], ap[1], ap[2], ap[3]); |
|
1358 |
break; |
|
1359 |
||
1360 |
case 5: |
|
1361 |
rslt = __interpret(self, 5, anObject, aSymbol, searchClass, &dummy, |
|
1362 |
ap[0], ap[1], ap[2], ap[3], ap[4]); |
|
1363 |
break; |
|
1364 |
||
1365 |
case 6: |
|
1366 |
rslt = __interpret(self, 6, anObject, aSymbol, searchClass, &dummy, |
|
1367 |
ap[0], ap[1], ap[2], ap[3], ap[4], ap[5]); |
|
1368 |
break; |
|
1369 |
||
1370 |
case 7: |
|
1371 |
rslt = __interpret(self, 7, anObject, aSymbol, searchClass, &dummy, |
|
1372 |
ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6]); |
|
1373 |
break; |
|
1374 |
||
1375 |
case 8: |
|
1376 |
rslt = __interpret(self, 8, anObject, aSymbol, searchClass, &dummy, |
|
1377 |
ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], |
|
1378 |
ap[7]); |
|
1379 |
break; |
|
1380 |
||
1381 |
case 9: |
|
1382 |
rslt = __interpret(self, 9, anObject, aSymbol, searchClass, &dummy, |
|
1383 |
ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], |
|
1384 |
ap[7], ap[8]); |
|
1385 |
break; |
|
1386 |
||
1387 |
case 10: |
|
1388 |
rslt = __interpret(self, 10, anObject, aSymbol, searchClass, &dummy, |
|
1389 |
ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], |
|
1390 |
ap[7], ap[8], ap[9]); |
|
1391 |
break; |
|
1392 |
||
1393 |
case 11: |
|
1394 |
rslt = __interpret(self, 11, anObject, aSymbol, searchClass, &dummy, |
|
1395 |
ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], |
|
1396 |
ap[7], ap[8], ap[9], ap[10]); |
|
1397 |
break; |
|
1398 |
||
1399 |
case 12: |
|
1400 |
rslt = __interpret(self, 12, anObject, aSymbol, searchClass, &dummy, |
|
1401 |
ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], |
|
1402 |
ap[7], ap[8], ap[9], ap[10], ap[11]); |
|
1403 |
break; |
|
1404 |
||
1405 |
case 13: |
|
1406 |
rslt = __interpret(self, 13, anObject, aSymbol, searchClass, &dummy, |
|
1407 |
ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], |
|
1408 |
ap[7], ap[8], ap[9], ap[10], ap[11], ap[12]); |
|
1409 |
break; |
|
1410 |
||
1411 |
case 14: |
|
1412 |
rslt = __interpret(self, 14, anObject, aSymbol, searchClass, &dummy, |
|
1413 |
ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], |
|
1414 |
ap[7], ap[8], ap[9], ap[10], ap[11], ap[12], ap[13]); |
|
1415 |
break; |
|
1416 |
||
1417 |
case 15: |
|
1418 |
rslt = __interpret(self, 15, anObject, aSymbol, searchClass, &dummy, |
|
1419 |
ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], |
|
1420 |
ap[7], ap[8], ap[9], ap[10], ap[11], ap[12], ap[13], ap[14]); |
|
1421 |
break; |
|
1422 |
} |
|
18423 | 1423 |
# endif |
24353 | 1424 |
} |
18423 | 1425 |
# ifdef CONTEXT_DEBUG |
24353 | 1426 |
if (sav != __thisContext) { |
1427 |
if (code) { |
|
1428 |
printf("CONTEXT BOTCH after execution of %x\n", code); |
|
1429 |
} else { |
|
1430 |
printf("CONTEXT BOTCH after execution of interpreted method\n"); |
|
1431 |
printf("code now: %x\n", __MethodInstPtr(self)->m_code); |
|
1432 |
} |
|
1433 |
printf("context before:\n"); |
|
1434 |
__dumpObject__(sav, __LINE__,__FILE__); |
|
1435 |
printf("context now:\n"); |
|
1436 |
__dumpObject__(__thisContext, __LINE__,__FILE__); |
|
1437 |
} |
|
18423 | 1438 |
# endif |
24353 | 1439 |
RETURN (rslt); |
1440 |
} |
|
2800
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1441 |
} |
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1442 |
badArgs: ; |
18423 | 1443 |
#endif /* not SCHTEAM */ |
2800
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1444 |
%}. |
18196 | 1445 |
(argArray isArray) ifFalse:[ |
24353 | 1446 |
(self argumentCount ~~ 0 |
1447 |
or:[argArray notNil]) ifTrue:[ |
|
1448 |
" |
|
1449 |
arguments must be either nil or an array |
|
1450 |
" |
|
1451 |
^ self badArgumentArray:argArray |
|
1452 |
] |
|
2800
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1453 |
]. |
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1454 |
|
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1455 |
(argArray size ~~ self numArgs) ifTrue:[ |
24353 | 1456 |
" |
1457 |
the method expects a different number of arguments |
|
1458 |
" |
|
1459 |
^ self wrongNumberOfArguments:argArray size |
|
2800
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1460 |
]. |
14068 | 1461 |
|
18416 | 1462 |
"/ if the VM only supports a limited number of arguments in sends (ST/X: 15) |
5426 | 1463 |
argArray size > self class maxNumberOfArguments ifTrue:[ |
24353 | 1464 |
^ self tooManyArguments |
5426 | 1465 |
]. |
1466 |
^ self primitiveFailed |
|
2800
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1467 |
|
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1468 |
" |
14068 | 1469 |
(Float compiledMethodAt:#+) |
24353 | 1470 |
valueWithReceiver:1.0 arguments:#(2.0) |
2800
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1471 |
|
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1472 |
'the next example is a wrong one - which is detected by True's method ...'. |
14068 | 1473 |
(True compiledMethodAt:#printString) |
24353 | 1474 |
valueWithReceiver:false arguments:nil |
2800
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1475 |
|
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1476 |
'the next example is a wrong one - it is nowhere detected |
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1477 |
and a wrong value returned ...'. |
14068 | 1478 |
(Point compiledMethodAt:#x) |
24353 | 1479 |
valueWithReceiver:(1->2) arguments:nil |
2800
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1480 |
|
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1481 |
'the next example is VERY bad one - it is nowhere detected |
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1482 |
and may crash the system WARNING: save your work before doing this ...'. |
14068 | 1483 |
(Point compiledMethodAt:#x) |
24353 | 1484 |
valueWithReceiver:(Object new) arguments:nil |
2800
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1485 |
|
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1486 |
'the next example is a wrong one - which is detected here ...'. |
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1487 |
(Object compiledMethodAt:#printOn:) |
24353 | 1488 |
valueWithReceiver:false arguments:nil |
2800
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1489 |
|
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1490 |
'the next example is a wrong one - which is detected here ...'. |
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1491 |
(Object compiledMethodAt:#printOn:) |
24353 | 1492 |
valueWithReceiver:false arguments:#() |
2800
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1493 |
" |
13776
7705d7d06a11
changed: #valueWithReceiver:arguments:selector:search:sender:
Claus Gittinger <cg@exept.de>
parents:
13640
diff
changeset
|
1494 |
|
13777
7308f6b1eede
changed: #valueWithReceiver:arguments:selector:search:sender:
Claus Gittinger <cg@exept.de>
parents:
13776
diff
changeset
|
1495 |
"Modified: / 07-10-2011 / 13:58:21 / cg" |
24353 | 1496 |
"Modified: / 25-06-2019 / 09:43:54 / Claus Gittinger" |
2800
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1497 |
! ! |
f6ab31b2a27d
moved valueWithReceiver-methods from Method to here
Claus Gittinger <cg@exept.de>
parents:
2703
diff
changeset
|
1498 |
|
7258 | 1499 |
!CompiledCode methodsFor:'private-accessing'! |
623 | 1500 |
|
1501 |
byteCode:aByteArray |
|
1502 |
"set the bytecode field - DANGER ALERT" |
|
1503 |
||
1504 |
byteCode := aByteArray |
|
1505 |
! |
|
1506 |
||
1640 | 1507 |
checked:aBoolean |
1508 |
"set/clear the flag bit stating that this method has already been checked |
|
18416 | 1509 |
by the just-in-time compiler. |
1510 |
Setting the flag prevents it from trying any compilation. |
|
1640 | 1511 |
Not for public use - for VM debugging only." |
1512 |
||
1513 |
%{ /* NOCONTEXT */ |
|
1514 |
||
2869 | 1515 |
INT newFlags = __intVal(__INST(flags)); |
1640 | 1516 |
|
1517 |
/* made this a primitive to get define in stc.h */ |
|
1518 |
if (aBoolean == true) |
|
14068 | 1519 |
newFlags |= F_CHECKED; |
1640 | 1520 |
else |
14068 | 1521 |
newFlags &= ~F_CHECKED; |
1640 | 1522 |
|
8913 | 1523 |
__INST(flags) = __mkSmallInteger(newFlags); |
1640 | 1524 |
%} |
1525 |
! |
|
1526 |
||
16346 | 1527 |
clearJittedCodeAndForceJittingAgain |
1528 |
"clear the method's jitted code and clear the flag bit stating that this method has already been checked |
|
1529 |
by the just-in-time compiler. Thus, it will be recompiled when called the next time. |
|
1530 |
Not for public use - for VM debugging only." |
|
1531 |
||
1532 |
%{ /* NOCONTEXT */ |
|
1533 |
__INST(flags) = (OBJ)((INT)__INST(flags) & ~__MASKSMALLINT(F_CHECKED)); |
|
1534 |
// prevent clearing code of non-jitted code (static library) |
|
18416 | 1535 |
if ( (INT)(__INST(flags)) & __MASKSMALLINT(F_DYNAMIC)) { |
1536 |
__INST(code_) = nil; |
|
16346 | 1537 |
} |
1538 |
%} |
|
1539 |
! |
|
1540 |
||
623 | 1541 |
dynamic |
1542 |
"return the flag stating that the machine code was created |
|
1774 | 1543 |
dynamically (from bytecode) or loaded dynamically from an objectFile |
1544 |
(i.e. has machineCode, but is not in the executable)." |
|
623 | 1545 |
|
3662
efe759ae4541
renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1546 |
"/ obsolete |
efe759ae4541
renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1547 |
^ self isDynamic |
623 | 1548 |
|
3662
efe759ae4541
renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1549 |
"Modified: / 20.7.1998 / 14:22:35 / cg" |
623 | 1550 |
! |
1551 |
||
14068 | 1552 |
literals:aLiteralArray |
623 | 1553 |
"set the literal array for evaluation - DANGER ALERT" |
1554 |
||
1493
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
1555 |
|i| |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
1556 |
|
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
1557 |
aLiteralArray isNil ifTrue:[ |
14068 | 1558 |
^ self. |
1493
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
1559 |
]. |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
1560 |
|
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
1561 |
self size == 1 ifTrue:[ |
14068 | 1562 |
self at:1 put:(aLiteralArray asArray). |
1493
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
1563 |
] ifFalse:[ |
14068 | 1564 |
i := 1. |
1565 |
aLiteralArray do:[:literal| |
|
1566 |
self at:i put:literal. |
|
1567 |
i := i + 1. |
|
1568 |
]. |
|
1493
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
1569 |
]. |
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
1570 |
|
3313
06da74a9cb04
make certain that literal array really is an array
Claus Gittinger <cg@exept.de>
parents:
3218
diff
changeset
|
1571 |
"Modified: / 25.6.1996 / 22:13:08 / stefan" |
06da74a9cb04
make certain that literal array really is an array
Claus Gittinger <cg@exept.de>
parents:
3218
diff
changeset
|
1572 |
"Modified: / 5.3.1998 / 02:05:56 / cg" |
623 | 1573 |
! |
1574 |
||
1575 |
markFlag |
|
18416 | 1576 |
"return the mark bits value as a boolean. |
1577 |
This bit is not used by the VM, but instead free to mark codeObjects |
|
1578 |
for any (debugging/tracing) use. For example, the coverage test uses |
|
1579 |
these to mark reached methods. (inspired by a note in c.l.s)" |
|
623 | 1580 |
|
1581 |
%{ /* NOCONTEXT */ |
|
1582 |
||
1583 |
/* made this a primitive to get define in stc.h */ |
|
1584 |
||
1771 | 1585 |
RETURN (( (INT)(__INST(flags)) & __MASKSMALLINT(F_MARKBIT)) ? true : false); |
623 | 1586 |
%} |
1587 |
! |
|
1588 |
||
1589 |
markFlag:aBoolean |
|
1590 |
"set/clear the mark flag bit. |
|
1591 |
This bit is not used by the VM, but instead free to mark codeObjects |
|
1592 |
for any (debugging/tracing) use. For example, the coverage test uses |
|
1593 |
these to mark reached methods. (inspired by a note in c.l.s)" |
|
1594 |
||
1595 |
%{ /* NOCONTEXT */ |
|
1596 |
||
2869 | 1597 |
INT newFlags = __intVal(__INST(flags)); |
623 | 1598 |
|
1599 |
/* made this a primitive to get define in stc.h */ |
|
1600 |
if (aBoolean == true) |
|
1601 |
newFlags |= F_MARKBIT; |
|
1602 |
else |
|
1603 |
newFlags &= ~F_MARKBIT; |
|
1604 |
||
8913 | 1605 |
__INST(flags) = __mkSmallInteger(newFlags); |
623 | 1606 |
%} |
1607 |
! ! |
|
1608 |
||
2540
a9388e872a51
moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1609 |
!CompiledCode methodsFor:'private-compiler interface'! |
a9388e872a51
moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1610 |
|
4489
b7e297fa3f64
pass down contextMustBeReturnable flag
Claus Gittinger <cg@exept.de>
parents:
3962
diff
changeset
|
1611 |
contextMustBeReturnable:aBoolean |
b7e297fa3f64
pass down contextMustBeReturnable flag
Claus Gittinger <cg@exept.de>
parents:
3962
diff
changeset
|
1612 |
%{ /* NOCONTEXT */ |
b7e297fa3f64
pass down contextMustBeReturnable flag
Claus Gittinger <cg@exept.de>
parents:
3962
diff
changeset
|
1613 |
/* made this a primitive to get define in stc.h */ |
b7e297fa3f64
pass down contextMustBeReturnable flag
Claus Gittinger <cg@exept.de>
parents:
3962
diff
changeset
|
1614 |
if (aBoolean == true) { |
14068 | 1615 |
__INST(flags) = (OBJ)( (INT)__INST(flags) | __MASKSMALLINT(F_RETURNABLE)); |
4489
b7e297fa3f64
pass down contextMustBeReturnable flag
Claus Gittinger <cg@exept.de>
parents:
3962
diff
changeset
|
1616 |
} else { |
14068 | 1617 |
__INST(flags) = (OBJ)( (INT)__INST(flags) & ~__MASKSMALLINT(F_RETURNABLE)); |
4489
b7e297fa3f64
pass down contextMustBeReturnable flag
Claus Gittinger <cg@exept.de>
parents:
3962
diff
changeset
|
1618 |
} |
b7e297fa3f64
pass down contextMustBeReturnable flag
Claus Gittinger <cg@exept.de>
parents:
3962
diff
changeset
|
1619 |
%} |
b7e297fa3f64
pass down contextMustBeReturnable flag
Claus Gittinger <cg@exept.de>
parents:
3962
diff
changeset
|
1620 |
|
b7e297fa3f64
pass down contextMustBeReturnable flag
Claus Gittinger <cg@exept.de>
parents:
3962
diff
changeset
|
1621 |
! |
b7e297fa3f64
pass down contextMustBeReturnable flag
Claus Gittinger <cg@exept.de>
parents:
3962
diff
changeset
|
1622 |
|
2540
a9388e872a51
moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1623 |
flags:newFlags |
a9388e872a51
moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1624 |
"set the flags (number of method variables, stacksize). |
a9388e872a51
moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1625 |
WARNING: for internal use by the compiler only. |
23571
4aa9bc1a2076
extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents:
22934
diff
changeset
|
1626 |
playing around here with incorrect values |
4aa9bc1a2076
extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents:
22934
diff
changeset
|
1627 |
may crash smalltalk badly. |
2540
a9388e872a51
moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1628 |
|
20793 | 1629 |
Don't depend on the values in the flag field - its interpretations |
2540
a9388e872a51
moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1630 |
may change without notice." |
a9388e872a51
moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1631 |
|
a9388e872a51
moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1632 |
"/ protect myself a bit - putting in an object would crash me ... |
a9388e872a51
moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1633 |
|
a9388e872a51
moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1634 |
(newFlags isMemberOf:SmallInteger) ifTrue:[ |
23571
4aa9bc1a2076
extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents:
22934
diff
changeset
|
1635 |
flags := newFlags |
2540
a9388e872a51
moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1636 |
] |
a9388e872a51
moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1637 |
|
a9388e872a51
moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1638 |
"Modified: 8.3.1996 / 13:26:05 / cg" |
a9388e872a51
moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1639 |
"Created: 13.4.1997 / 00:01:11 / cg" |
a9388e872a51
moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1640 |
! |
a9388e872a51
moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1641 |
|
13427 | 1642 |
marked: aBoolean |
1643 |
||
1644 |
"Sets the mark bit. You may use it for whatever you want. Actually, |
|
1645 |
it's used for marking profiled methods" |
|
1646 |
||
18416 | 1647 |
self markFlag:aBoolean. |
13427 | 1648 |
|
18416 | 1649 |
"/ duplicate code... |
13427 | 1650 |
|
18416 | 1651 |
"/%{ /* NOCONTEXT */ |
1652 |
"/ |
|
1653 |
"/ INT newFlags = __intVal(__INST(flags)); |
|
1654 |
"/ |
|
1655 |
"/ /* made this a primitive to get define in stc.h */ |
|
1656 |
"/ if (aBoolean == true) |
|
1657 |
"/ newFlags |= F_MARKBIT; |
|
1658 |
"/ else |
|
1659 |
"/ newFlags &= ~F_MARKBIT; |
|
1660 |
"/ |
|
1661 |
"/ __INST(flags) = __mkSmallInteger(newFlags); |
|
1662 |
"/%} |
|
1663 |
"/ |
|
1664 |
"/ "Created: / 29-11-2010 / 21:20:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13427 | 1665 |
! |
1666 |
||
2804
6b8a6d6bedf0
added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents:
2800
diff
changeset
|
1667 |
numberOfArgs:aNumber |
6b8a6d6bedf0
added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents:
2800
diff
changeset
|
1668 |
"set the number of arguments, the codeObject expects. |
14068 | 1669 |
WARNING: for internal use by the compiler only. |
1670 |
playing around here with incorrect values |
|
1671 |
may (will ?) crash smalltalk badly. |
|
2804
6b8a6d6bedf0
added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents:
2800
diff
changeset
|
1672 |
|
6b8a6d6bedf0
added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents:
2800
diff
changeset
|
1673 |
The limitation in the max. number of arguments is due to the |
14068 | 1674 |
missing SENDxx functions in the VM and cases in #perform. This too |
2804
6b8a6d6bedf0
added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents:
2800
diff
changeset
|
1675 |
will be removed in a later release, allowing any number of arguments." |
6b8a6d6bedf0
added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents:
2800
diff
changeset
|
1676 |
|
6b8a6d6bedf0
added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents:
2800
diff
changeset
|
1677 |
(aNumber between:0 and:self class maxNumberOfArguments) ifFalse:[ |
14068 | 1678 |
self error:('ST/X only supports up to a maximum of ' , |
1679 |
self class maxNumberOfArguments printString , |
|
1680 |
' method arguments'). |
|
1681 |
^ self |
|
2804
6b8a6d6bedf0
added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents:
2800
diff
changeset
|
1682 |
]. |
6b8a6d6bedf0
added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents:
2800
diff
changeset
|
1683 |
%{ |
18416 | 1684 |
#ifdef __SCHTEAM__ |
1685 |
self.setNumberOfArguments( aNumber.intValue() ); |
|
1686 |
#else |
|
2804
6b8a6d6bedf0
added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents:
2800
diff
changeset
|
1687 |
/* made this a primitive to get define in stc.h */ |
18416 | 1688 |
# ifdef F_NARGS |
8913 | 1689 |
__INST(flags) = __mkSmallInteger( (__intVal(__INST(flags)) & ~F_NARGS) | (__intVal(aNumber) << F_NARGSHIFT) ); |
18416 | 1690 |
# endif |
2804
6b8a6d6bedf0
added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents:
2800
diff
changeset
|
1691 |
#endif |
6b8a6d6bedf0
added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents:
2800
diff
changeset
|
1692 |
%} |
6b8a6d6bedf0
added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents:
2800
diff
changeset
|
1693 |
|
6b8a6d6bedf0
added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents:
2800
diff
changeset
|
1694 |
|
6b8a6d6bedf0
added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents:
2800
diff
changeset
|
1695 |
! |
6b8a6d6bedf0
added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents:
2800
diff
changeset
|
1696 |
|
6b8a6d6bedf0
added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents:
2800
diff
changeset
|
1697 |
numberOfVars:aNumber |
6b8a6d6bedf0
added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents:
2800
diff
changeset
|
1698 |
"set the number of local variables - for use by compiler only. |
14068 | 1699 |
WARNING: for internal use by the compiler only. |
1700 |
playing around here with incorrect values |
|
1701 |
may (will ?) crash smalltalk badly." |
|
2804
6b8a6d6bedf0
added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents:
2800
diff
changeset
|
1702 |
|
6b8a6d6bedf0
added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents:
2800
diff
changeset
|
1703 |
%{ /* NOCONTEXT */ |
18416 | 1704 |
#ifdef __SCHTEAM__ |
1705 |
self.setNumberOfLocals( aNumber.intValue() ); |
|
1706 |
#else |
|
2869 | 1707 |
INT f = __intVal(__INST(flags)); |
2804
6b8a6d6bedf0
added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents:
2800
diff
changeset
|
1708 |
|
6b8a6d6bedf0
added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents:
2800
diff
changeset
|
1709 |
/* made this a primitive to get define in stc.h */ |
6b8a6d6bedf0
added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents:
2800
diff
changeset
|
1710 |
if (__isSmallInteger(aNumber)) { |
14068 | 1711 |
f = (f & ~F_NVARS) | (__intVal(aNumber) << F_NVARSHIFT); |
1712 |
__INST(flags) = __mkSmallInteger(f); |
|
2804
6b8a6d6bedf0
added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents:
2800
diff
changeset
|
1713 |
} |
18416 | 1714 |
#endif |
2804
6b8a6d6bedf0
added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents:
2800
diff
changeset
|
1715 |
%} |
6b8a6d6bedf0
added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents:
2800
diff
changeset
|
1716 |
|
6b8a6d6bedf0
added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents:
2800
diff
changeset
|
1717 |
|
6b8a6d6bedf0
added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents:
2800
diff
changeset
|
1718 |
! |
6b8a6d6bedf0
added #numberOfVars: / #numberOfArgs:
Claus Gittinger <cg@exept.de>
parents:
2800
diff
changeset
|
1719 |
|
2543 | 1720 |
stackSize |
1721 |
"return thedepth of the local stack in the context. |
|
1722 |
||
1723 |
WARNING: for internal use by ST/X debuggers only. |
|
14068 | 1724 |
This method may be removed without notice." |
2543 | 1725 |
|
1726 |
%{ /* NOCONTEXT */ |
|
18416 | 1727 |
#ifdef __SCHTEAM__ |
1728 |
return __c__._RETURN( self.getNumberOfStackTemporaries() ); |
|
1729 |
#else |
|
8913 | 1730 |
INT n = (__intVal(__INST(flags)) & F_NSTACK) >> F_NSTACKSHIFT; |
2543 | 1731 |
|
1732 |
/* made this a primitive to get define in stc.h */ |
|
8913 | 1733 |
RETURN (__mkSmallInteger(n)); |
18416 | 1734 |
#endif |
2543 | 1735 |
%} |
1736 |
||
1737 |
! |
|
1738 |
||
2540
a9388e872a51
moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1739 |
stackSize:aNumber |
a9388e872a51
moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1740 |
"set the depth of the local stack. |
a9388e872a51
moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1741 |
|
a9388e872a51
moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1742 |
WARNING: for internal use by the compiler only. |
14068 | 1743 |
playing around here with incorrect values |
1744 |
may crash smalltalk badly. |
|
18416 | 1745 |
if the runtime library was compiled with DEBUG, |
1746 |
a bad stack will be detected and triggers an error |
|
1747 |
(by default, the VM is compiled with this option)" |
|
2540
a9388e872a51
moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1748 |
|
a9388e872a51
moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1749 |
%{ /* NOCONTEXT */ |
18416 | 1750 |
#ifdef __SCHTEAM__ |
1751 |
self.setNumberOfStackTemporaries( aNumber.intValue() ); |
|
1752 |
#else |
|
2869 | 1753 |
INT f = __intVal(__INST(flags)); |
2540
a9388e872a51
moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1754 |
|
a9388e872a51
moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1755 |
/* made this a primitive to get define in stc.h */ |
a9388e872a51
moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1756 |
if (__isSmallInteger(aNumber)) { |
14068 | 1757 |
f = (f & ~F_NSTACK) | (__intVal(aNumber) << F_NSTACKSHIFT); |
1758 |
__INST(flags) = __mkSmallInteger(f); |
|
2540
a9388e872a51
moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1759 |
} |
18416 | 1760 |
#endif |
2540
a9388e872a51
moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1761 |
%} |
a9388e872a51
moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1762 |
|
a9388e872a51
moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1763 |
! ! |
a9388e872a51
moved #flags: and #stackSize: up from Method
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1764 |
|
328 | 1765 |
!CompiledCode methodsFor:'queries'! |
1766 |
||
1196
7b3eeec128d3
moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1767 |
decompileTo:aStream |
8835 | 1768 |
|decompilerClass decompiler| |
2810 | 1769 |
|
8835 | 1770 |
decompilerClass := self decompilerClass. |
1771 |
decompilerClass isNil ifTrue:[ |
|
14068 | 1772 |
^ false |
1196
7b3eeec128d3
moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1773 |
]. |
8314 | 1774 |
|
1775 |
Autoload autoloadFailedSignal handle:[:ex | |
|
14068 | 1776 |
^ false. |
8314 | 1777 |
] do:[ |
14068 | 1778 |
decompilerClass autoload. |
1196
7b3eeec128d3
moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1779 |
]. |
7b3eeec128d3
moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1780 |
|
8835 | 1781 |
decompiler := decompilerClass new. |
1782 |
decompiler targetClass:self mclass. |
|
2810 | 1783 |
decompiler decompile:self to:aStream. |
1196
7b3eeec128d3
moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1784 |
^ true |
7b3eeec128d3
moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1785 |
|
7b3eeec128d3
moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1786 |
"Created: 16.4.1996 / 20:25:40 / cg" |
2810 | 1787 |
"Modified: 30.7.1997 / 16:37:14 / cg" |
1196
7b3eeec128d3
moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1788 |
! |
7b3eeec128d3
moved decompilation into codeObject (allows handling of alien codeObjects)
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1789 |
|
16333 | 1790 |
hasAnnotation: key |
1791 |
"Return false here, as a fallback" |
|
1792 |
||
1793 |
^ false |
|
1794 |
! |
|
1795 |
||
13427 | 1796 |
isChecked |
1797 |
"return true, if this method has been analyzed for jitting" |
|
1798 |
||
1799 |
%{ /* NOCONTEXT */ |
|
1800 |
||
1801 |
/* made this a primitive to get define in stc.h */ |
|
1802 |
||
1803 |
RETURN (( (INT)(__INST(flags)) & __MASKSMALLINT(F_CHECKED)) ? true : false); |
|
18416 | 1804 |
%}. |
1805 |
^ true "/ an arbtrary return value as fallback |
|
13427 | 1806 |
|
1807 |
"Created: / 29-11-2010 / 21:16:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1808 |
! |
|
1809 |
||
3662
efe759ae4541
renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1810 |
isDynamic |
efe759ae4541
renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1811 |
"return true, if the machine code was created |
efe759ae4541
renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1812 |
dynamically (from bytecode); false if the machine code was |
efe759ae4541
renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1813 |
already present in an objectFile |
efe759ae4541
renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1814 |
(i.e. has JIT-compiled machineCode, as opposed to stc-compiled code)." |
efe759ae4541
renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1815 |
|
efe759ae4541
renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1816 |
%{ /* NOCONTEXT */ |
efe759ae4541
renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1817 |
|
efe759ae4541
renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1818 |
/* made this a primitive to get define in stc.h */ |
efe759ae4541
renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1819 |
|
efe759ae4541
renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1820 |
RETURN (( (INT)(__INST(flags)) & __MASKSMALLINT(F_DYNAMIC)) ? true : false); |
18416 | 1821 |
%}. |
1822 |
^ false "/ an arbitrary return value as fallback |
|
3662
efe759ae4541
renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1823 |
! |
efe759ae4541
renamed #dynamic to #isDynamic
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1824 |
|
1195
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
1825 |
isExecutable |
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
1826 |
"return true, if this method is executable. |
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
1827 |
I.e. neither an invalidated nor an unloaded method" |
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
1828 |
|
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
1829 |
self isInvalid ifTrue:[^ false]. |
3933 | 1830 |
^ self byteCode notNil or:[self hasCode] |
1195
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
1831 |
|
3933 | 1832 |
"Created: / 16.4.1996 / 17:52:16 / cg" |
1833 |
"Modified: / 13.11.1998 / 23:18:01 / cg" |
|
1195
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
1834 |
! |
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
1835 |
|
13640 | 1836 |
isExtension |
1837 |
"return true, if this method is an extension (i.e. package ~= classes' package)" |
|
1838 |
||
1839 |
^ false |
|
1840 |
||
1841 |
"Created: / 07-09-2011 / 09:28:57 / cg" |
|
1842 |
! |
|
1843 |
||
13427 | 1844 |
isMarked |
1845 |
"return true, if this method has been marked (for whatever reason)" |
|
1846 |
||
18416 | 1847 |
^ self markFlag |
13427 | 1848 |
|
18416 | 1849 |
"/ duplicate code: |
13427 | 1850 |
|
18416 | 1851 |
"/%{ /* NOCONTEXT */ |
1852 |
"/ |
|
1853 |
"/ /* made this a primitive to get define in stc.h */ |
|
1854 |
"/ |
|
1855 |
"/ RETURN (( (INT)(__INST(flags)) & __MASKSMALLINT(F_MARKBIT)) ? true : false); |
|
1856 |
"/%} |
|
1857 |
"/ |
|
1858 |
"/ "Created: / 29-11-2010 / 21:17:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13427 | 1859 |
! |
1860 |
||
1195
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
1861 |
isUnloaded |
22367 | 1862 |
"return true, if the method's machine code has been unloaded |
1195
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
1863 |
from the system (i.e. it is not executable)." |
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
1864 |
|
3933 | 1865 |
^ (self hasCode not and:[self byteCode isNil]) |
1195
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
1866 |
|
22367 | 1867 |
"Created: / 16-04-1996 / 17:51:47 / cg" |
1868 |
"Modified: / 13-11-1998 / 23:18:18 / cg" |
|
1869 |
"Modified (comment): / 21-11-2017 / 12:59:51 / cg" |
|
1195
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
1870 |
! |
618e2cf3fb56
moved some protocol to upper levels; generalized queries
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
1871 |
|
328 | 1872 |
messages |
1873 |
"return a Set of all symbols referenced by this thingy. |
|
1874 |
(this is more than the message selectors, since also global names |
|
1875 |
and symbols found in immediate arrays are included)." |
|
1876 |
||
1877 |
|symbolSet| |
|
1878 |
||
1879 |
symbolSet := IdentitySet new. |
|
1493
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
1880 |
self literalsDo: [ :lit | |
14068 | 1881 |
lit isSymbol ifTrue: [ |
1882 |
symbolSet add: lit |
|
1883 |
] ifFalse: [ |
|
1884 |
lit isArray ifTrue: [ |
|
1885 |
lit traverse: [ :el | |
|
1886 |
el isSymbol ifTrue: [symbolSet add: el] |
|
1887 |
] |
|
1888 |
] |
|
1889 |
] |
|
328 | 1890 |
]. |
1891 |
^ symbolSet |
|
1892 |
||
1893 |
" |
|
14068 | 1894 |
(CompiledCode compiledMethodAt:#messages) messages |
328 | 1895 |
" |
1493
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
1896 |
|
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
1897 |
"Modified: 25.6.1996 / 22:24:20 / stefan" |
1190
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
1898 |
! |
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
1899 |
|
3218
78255e232c66
Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents:
3145
diff
changeset
|
1900 |
numArgs |
21124 | 1901 |
"return the number of arguments, the method expects. |
1902 |
Please use argumentCount for ANSI compatibility." |
|
3218
78255e232c66
Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents:
3145
diff
changeset
|
1903 |
|
78255e232c66
Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents:
3145
diff
changeset
|
1904 |
%{ /* NOCONTEXT */ |
18416 | 1905 |
#ifdef __SCHTEAM__ |
1906 |
return __c__._RETURN( self.getNumberOfArguments() ); |
|
1907 |
#else |
|
3218
78255e232c66
Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents:
3145
diff
changeset
|
1908 |
/* made this a primitive to get define in stc.h */ |
78255e232c66
Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents:
3145
diff
changeset
|
1909 |
|
8913 | 1910 |
RETURN (__mkSmallInteger((__intVal(__INST(flags)) & F_NARGS) >> F_NARGSHIFT)); |
18416 | 1911 |
#endif |
3218
78255e232c66
Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents:
3145
diff
changeset
|
1912 |
%}. |
78255e232c66
Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents:
3145
diff
changeset
|
1913 |
" |
78255e232c66
Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents:
3145
diff
changeset
|
1914 |
The old implementation simply counted the arguments from |
78255e232c66
Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents:
3145
diff
changeset
|
1915 |
the methods source - new versions include this information |
78255e232c66
Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents:
3145
diff
changeset
|
1916 |
in the flag instVar, for more security in #perform: |
78255e232c66
Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents:
3145
diff
changeset
|
1917 |
" |
78255e232c66
Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents:
3145
diff
changeset
|
1918 |
|
78255e232c66
Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents:
3145
diff
changeset
|
1919 |
" |
14068 | 1920 |
(Method compiledMethodAt:#source) numArgs |
1921 |
(Method compiledMethodAt:#source:) numArgs |
|
3218
78255e232c66
Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents:
3145
diff
changeset
|
1922 |
" |
78255e232c66
Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents:
3145
diff
changeset
|
1923 |
! |
78255e232c66
Fixes for #literalsDo: and #literalsDetect:ifNone:
Stefan Vogel <sv@exept.de>
parents:
3145
diff
changeset
|
1924 |
|
1869 | 1925 |
numVars |
14068 | 1926 |
"return the number of block local variables. |
1869 | 1927 |
Do not depend on the returned value - future optimizations |
1928 |
may change things here (i.e. when moving locals into |
|
1929 |
surrounding context for inlining). |
|
1930 |
- for debugging only." |
|
1931 |
||
1932 |
%{ /* NOCONTEXT */ |
|
18416 | 1933 |
#ifdef __SCHTEAM__ |
1934 |
return __c__._RETURN( self.getNumberOfLocals() ); |
|
1935 |
#else |
|
1869 | 1936 |
/* made this a primitive to get define in stc.h */ |
1937 |
||
8913 | 1938 |
RETURN (__mkSmallInteger((__intVal(__INST(flags)) & F_NVARS) >> F_NVARSHIFT)); |
18416 | 1939 |
#endif |
1869 | 1940 |
%} |
1941 |
||
1942 |
||
1943 |
||
1944 |
! |
|
1945 |
||
1190
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
1946 |
referencesGlobal:aGlobalSymbol |
17513 | 1947 |
"return true, if this method references the global named aGlobalSymbol. |
3054
a9616d9bc9a0
cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents:
2869
diff
changeset
|
1948 |
For now, this is the same as #referencesLiteral:, |
a9616d9bc9a0
cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents:
2869
diff
changeset
|
1949 |
but this might change in the future to perform a deeper |
17513 | 1950 |
analyzes on the bytecodes, to detect implicit global |
3054
a9616d9bc9a0
cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents:
2869
diff
changeset
|
1951 |
refs (as done by some special bytecodes)" |
1190
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
1952 |
|
3054
a9616d9bc9a0
cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents:
2869
diff
changeset
|
1953 |
^ self referencesLiteral:aGlobalSymbol |
1190
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
1954 |
|
1493
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
1955 |
" |
4977 | 1956 |
(CompiledCode compiledMethodAt:#referencesGlobal:) referencesGlobal:#referencesLiteral: |
14068 | 1957 |
(CompiledCode compiledMethodAt:#referencesGlobal:) referencesGlobal:#bla |
1493
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
1958 |
" |
1190
4ad1c8d6d94d
moved & added some query methods (from method) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
1959 |
|
3054
a9616d9bc9a0
cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents:
2869
diff
changeset
|
1960 |
"Modified: / 24.6.1996 / 15:41:59 / stefan" |
4977 | 1961 |
"Modified: / 9.11.1999 / 17:03:44 / cg" |
1962 |
! |
|
1963 |
||
1964 |
referencesGlobalMatching:aMatchPattern |
|
18416 | 1965 |
"return true, if this method references the given a literal symbol, |
17513 | 1966 |
which matches the given pattern." |
4977 | 1967 |
|
1968 |
^ (self literalsDetect:[:mthdLit| |
|
18416 | 1969 |
(mthdLit isMemberOf:Symbol) |
1970 |
and:[aMatchPattern match:mthdLit] |
|
1971 |
] ifNone:[false]) ~~ false. |
|
4977 | 1972 |
|
1973 |
" |
|
1974 |
(CompiledCode compiledMethodAt:#referencesGlobalMatching:) referencesGlobalMatching:'*atch*' |
|
14068 | 1975 |
(CompiledCode compiledMethodAt:#referencesGlobalMatching:) referencesGlobalMatching:'*batch*' |
4977 | 1976 |
" |
1977 |
||
1978 |
"Modified: / 9.11.1999 / 17:03:16 / cg" |
|
3054
a9616d9bc9a0
cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents:
2869
diff
changeset
|
1979 |
! |
a9616d9bc9a0
cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents:
2869
diff
changeset
|
1980 |
|
a9616d9bc9a0
cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents:
2869
diff
changeset
|
1981 |
referencesLiteral:aLiteral |
20476 | 1982 |
"return true, if this method references the given literal directly |
17513 | 1983 |
(i.e. a flat search, which does not look deeper into literal arrays)." |
3054
a9616d9bc9a0
cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents:
2869
diff
changeset
|
1984 |
|
3771
9136d26808a9
allow for association to be passed to #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents:
3662
diff
changeset
|
1985 |
|lit| |
9136d26808a9
allow for association to be passed to #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents:
3662
diff
changeset
|
1986 |
|
9136d26808a9
allow for association to be passed to #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents:
3662
diff
changeset
|
1987 |
lit := aLiteral. |
9136d26808a9
allow for association to be passed to #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents:
3662
diff
changeset
|
1988 |
aLiteral isAssociation ifTrue:[ |
23571
4aa9bc1a2076
extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents:
22934
diff
changeset
|
1989 |
"/ for ST80 compatibility (where variableBindings are used...) |
4aa9bc1a2076
extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents:
22934
diff
changeset
|
1990 |
lit := lit key |
3771
9136d26808a9
allow for association to be passed to #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents:
3662
diff
changeset
|
1991 |
]. |
21310 | 1992 |
^ (self literalsDetect:[:mthdLit| mthdLit == lit] ifNone:[nil]) notNil. |
3054
a9616d9bc9a0
cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents:
2869
diff
changeset
|
1993 |
|
a9616d9bc9a0
cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents:
2869
diff
changeset
|
1994 |
" |
a9616d9bc9a0
cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents:
2869
diff
changeset
|
1995 |
(CompiledCode compiledMethodAt:#referencesLiteral:) referencesGlobal:#literalsDetect:ifNone: |
a9616d9bc9a0
cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents:
2869
diff
changeset
|
1996 |
(CompiledCode compiledMethodAt:#referencesLiteral:) referencesGlobal:#bla |
a9616d9bc9a0
cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents:
2869
diff
changeset
|
1997 |
" |
a9616d9bc9a0
cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents:
2869
diff
changeset
|
1998 |
|
a9616d9bc9a0
cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents:
2869
diff
changeset
|
1999 |
"Modified: / 24.6.1996 / 15:41:59 / stefan" |
a9616d9bc9a0
cleanup: #referencesGlobal: and #referencesLiteral:
Claus Gittinger <cg@exept.de>
parents:
2869
diff
changeset
|
2000 |
"Created: / 28.10.1997 / 13:09:40 / cg" |
5537 | 2001 |
"Modified: / 18.8.2000 / 21:18:51 / cg" |
3093 | 2002 |
! |
2003 |
||
5522 | 2004 |
refersToLiteral:aLiteral |
17513 | 2005 |
"return true if the receiver, or recursively any array element in the receiver, |
2006 |
refers to aLiteral (i.e. a deep search)" |
|
5522 | 2007 |
|
14068 | 2008 |
self literalsDo: [ :el | |
23571
4aa9bc1a2076
extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents:
22934
diff
changeset
|
2009 |
el == aLiteral ifTrue:[^true]. |
4aa9bc1a2076
extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents:
22934
diff
changeset
|
2010 |
el isArray ifTrue:[ |
4aa9bc1a2076
extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents:
22934
diff
changeset
|
2011 |
(el refersToLiteral: aLiteral) ifTrue: [^true] |
4aa9bc1a2076
extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents:
22934
diff
changeset
|
2012 |
] |
5522 | 2013 |
]. |
2014 |
^ false |
|
2015 |
||
2016 |
" |
|
14068 | 2017 |
(CompiledCode compiledMethodAt:#refersToLiteral:) refersToLiteral:#foo |
2018 |
(CompiledCode compiledMethodAt:#refersToLiteral:) refersToLiteral:#class |
|
5522 | 2019 |
" |
2020 |
||
14255
a5b9d39ad244
added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents:
14153
diff
changeset
|
2021 |
"Modified: / 03-03-1998 / 00:02:28 / stefan" |
a5b9d39ad244
added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents:
14153
diff
changeset
|
2022 |
"Modified: / 26-07-2012 / 15:44:33 / cg" |
a5b9d39ad244
added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents:
14153
diff
changeset
|
2023 |
! |
a5b9d39ad244
added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents:
14153
diff
changeset
|
2024 |
|
a5b9d39ad244
added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents:
14153
diff
changeset
|
2025 |
refersToLiteralMatching:aMatchPattern |
18416 | 2026 |
"return true if the receiver, or recursively any array element in the receiver, |
17513 | 2027 |
is symbolic and matches aMatchPattern (i.e. a deep search)" |
14255
a5b9d39ad244
added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents:
14153
diff
changeset
|
2028 |
|
a5b9d39ad244
added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents:
14153
diff
changeset
|
2029 |
self literalsDo: [ :el | |
23571
4aa9bc1a2076
extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents:
22934
diff
changeset
|
2030 |
(el isSymbol and:[ aMatchPattern match: el]) ifTrue:[^true]. |
4aa9bc1a2076
extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents:
22934
diff
changeset
|
2031 |
el isArray ifTrue:[ |
4aa9bc1a2076
extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents:
22934
diff
changeset
|
2032 |
(el refersToLiteralMatching: aMatchPattern) ifTrue: [^true] |
4aa9bc1a2076
extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents:
22934
diff
changeset
|
2033 |
] |
14255
a5b9d39ad244
added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents:
14153
diff
changeset
|
2034 |
]. |
a5b9d39ad244
added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents:
14153
diff
changeset
|
2035 |
^ false |
a5b9d39ad244
added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents:
14153
diff
changeset
|
2036 |
|
a5b9d39ad244
added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents:
14153
diff
changeset
|
2037 |
" |
a5b9d39ad244
added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents:
14153
diff
changeset
|
2038 |
(CompiledCode compiledMethodAt:#refersToLiteralMatching:) refersToLiteral:'is*' |
a5b9d39ad244
added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents:
14153
diff
changeset
|
2039 |
(CompiledCode compiledMethodAt:#refersToLiteralMatching:) refersToLiteral:'foo*' |
a5b9d39ad244
added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents:
14153
diff
changeset
|
2040 |
" |
a5b9d39ad244
added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents:
14153
diff
changeset
|
2041 |
|
a5b9d39ad244
added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents:
14153
diff
changeset
|
2042 |
"Modified: / 03-03-1998 / 00:02:28 / stefan" |
a5b9d39ad244
added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents:
14153
diff
changeset
|
2043 |
"Modified: / 18-08-2000 / 21:17:47 / cg" |
a5b9d39ad244
added: #refersToLiteralMatching:
Claus Gittinger <cg@exept.de>
parents:
14153
diff
changeset
|
2044 |
"Created: / 26-07-2012 / 15:37:23 / cg" |
328 | 2045 |
! ! |
2046 |
||
1772
d5d1d1fac79d
the dynamic flag may never be set by anyone except the VM;
Claus Gittinger <cg@exept.de>
parents:
1771
diff
changeset
|
2047 |
!CompiledCode class methodsFor:'documentation'! |
1182
d8f8e18928a5
only CompiledCode, Method & Block are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2048 |
|
13777
7308f6b1eede
changed: #valueWithReceiver:arguments:selector:search:sender:
Claus Gittinger <cg@exept.de>
parents:
13776
diff
changeset
|
2049 |
version |
18943 | 2050 |
^ '$Header$' |
13777
7308f6b1eede
changed: #valueWithReceiver:arguments:selector:search:sender:
Claus Gittinger <cg@exept.de>
parents:
13776
diff
changeset
|
2051 |
! |
7308f6b1eede
changed: #valueWithReceiver:arguments:selector:search:sender:
Claus Gittinger <cg@exept.de>
parents:
13776
diff
changeset
|
2052 |
|
13427 | 2053 |
version_CVS |
18943 | 2054 |
^ '$Header$' |
12160 | 2055 |
! |
2056 |
||
13427 | 2057 |
version_SVN |
15409 | 2058 |
^ '$ Id: CompiledCode.st 10643 2011-06-08 21:53:07Z vranyj1 $' |
1182
d8f8e18928a5
only CompiledCode, Method & Block are fixed - subclasses may look different
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2059 |
! ! |
24353 | 2060 |