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