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