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