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