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