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