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