author | Claus Gittinger <cg@exept.de> |
Wed, 18 Dec 2019 16:29:37 +0100 | |
changeset 4612 | 6e212516ccfc |
parent 4538 | a3a74945da5a |
child 4620 | b3fff8f79239 |
permissions | -rw-r--r-- |
4354 | 1 |
"{ Encoding: utf8 }" |
2 |
||
4126 | 3 |
" |
4 |
COPYRIGHT (c) 2010 by Claus Gittinger |
|
5 |
All Rights Reserved |
|
6 |
||
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
2357 | 14 |
"{ Package: 'stx:libcomp' }" |
15 |
||
3570
0ac6e8f11416
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
3239
diff
changeset
|
16 |
"{ NameSpace: Smalltalk }" |
0ac6e8f11416
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
3239
diff
changeset
|
17 |
|
2357 | 18 |
ByteCodeCompiler subclass:#InstrumentingCompiler |
2949 | 19 |
instanceVariableNames:'method methodEntryInfo blockInvocationInfo' |
20 |
classVariableNames:'' |
|
21 |
poolDictionaries:'' |
|
22 |
category:'System-Compiler-Instrumentation' |
|
2357 | 23 |
! |
24 |
||
2634 | 25 |
InstrumentationInfo subclass:#StatementExecutionInfo |
3239
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
26 |
instanceVariableNames:'startPosition endPosition count' |
2949 | 27 |
classVariableNames:'' |
28 |
poolDictionaries:'' |
|
29 |
privateIn:InstrumentingCompiler |
|
2359 | 30 |
! |
31 |
||
2967
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
32 |
InstrumentingCompiler::StatementExecutionInfo subclass:#StatementExecutionInfoForCoverageInAlreadyEnteredState |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
33 |
instanceVariableNames:'' |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
34 |
classVariableNames:'' |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
35 |
poolDictionaries:'' |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
36 |
privateIn:InstrumentingCompiler::StatementExecutionInfo |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
37 |
! |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
38 |
|
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
39 |
InstrumentingCompiler::StatementExecutionInfo subclass:#StatementExecutionInfoInAlreadyEnteredState |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
40 |
instanceVariableNames:'' |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
41 |
classVariableNames:'' |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
42 |
poolDictionaries:'' |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
43 |
privateIn:InstrumentingCompiler::StatementExecutionInfo |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
44 |
! |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
45 |
|
2635 | 46 |
InstrumentationInfo subclass:#MethodInvocationInfo |
2973
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
47 |
instanceVariableNames:'count recursiveEntry infoPerReceiverClass' |
2949 | 48 |
classVariableNames:'' |
49 |
poolDictionaries:'' |
|
50 |
privateIn:InstrumentingCompiler |
|
2357 | 51 |
! |
52 |
||
53 |
Object subclass:#MethodInvocationInfoPerReceiverClass |
|
2949 | 54 |
instanceVariableNames:'infoPerSendingMethod' |
55 |
classVariableNames:'' |
|
56 |
poolDictionaries:'' |
|
57 |
privateIn:InstrumentingCompiler::MethodInvocationInfo |
|
2357 | 58 |
! |
59 |
||
60 |
Object subclass:#MethodInvocationInfoPerSendingMethod |
|
2949 | 61 |
instanceVariableNames:'countPerSendersClass invokedViaPerform' |
62 |
classVariableNames:'' |
|
63 |
poolDictionaries:'' |
|
64 |
privateIn:InstrumentingCompiler::MethodInvocationInfo::MethodInvocationInfoPerReceiverClass |
|
2948 | 65 |
! |
66 |
||
67 |
InstrumentingCompiler::MethodInvocationInfo subclass:#MethodInvocationInfoForCoverageInAlreadyEnteredState |
|
2949 | 68 |
instanceVariableNames:'' |
69 |
classVariableNames:'' |
|
70 |
poolDictionaries:'' |
|
71 |
privateIn:InstrumentingCompiler |
|
2357 | 72 |
! |
73 |
||
2711 | 74 |
InstrumentingCompiler::MethodInvocationInfo subclass:#MethodInvocationInfoInAlreadyEnteredState |
2949 | 75 |
instanceVariableNames:'' |
76 |
classVariableNames:'' |
|
77 |
poolDictionaries:'' |
|
78 |
privateIn:InstrumentingCompiler |
|
2711 | 79 |
! |
80 |
||
2715 | 81 |
InstrumentingCompiler::StatementExecutionInfo subclass:#VariableAccessExecutionInfo |
2949 | 82 |
instanceVariableNames:'' |
83 |
classVariableNames:'' |
|
84 |
poolDictionaries:'' |
|
85 |
privateIn:InstrumentingCompiler |
|
2715 | 86 |
! |
87 |
||
2390 | 88 |
InstrumentingCompiler::StatementExecutionInfo subclass:#BlockExecutionInfo |
3239
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
89 |
instanceVariableNames:'' |
2949 | 90 |
classVariableNames:'' |
91 |
poolDictionaries:'' |
|
92 |
privateIn:InstrumentingCompiler |
|
2390 | 93 |
! |
94 |
||
2967
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
95 |
InstrumentingCompiler::BlockExecutionInfo subclass:#BlockExecutionInfoForCoverageInAlreadyEnteredState |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
96 |
instanceVariableNames:'' |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
97 |
classVariableNames:'' |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
98 |
poolDictionaries:'' |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
99 |
privateIn:InstrumentingCompiler::BlockExecutionInfo |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
100 |
! |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
101 |
|
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
102 |
InstrumentingCompiler::BlockExecutionInfo subclass:#BlockExecutionInfoInAlreadyEnteredState |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
103 |
instanceVariableNames:'' |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
104 |
classVariableNames:'' |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
105 |
poolDictionaries:'' |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
106 |
privateIn:InstrumentingCompiler::BlockExecutionInfo |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
107 |
! |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
108 |
|
2715 | 109 |
InstrumentingCompiler::VariableAccessExecutionInfo subclass:#ReadAccessExecutionInfo |
2949 | 110 |
instanceVariableNames:'' |
111 |
classVariableNames:'' |
|
112 |
poolDictionaries:'' |
|
113 |
privateIn:InstrumentingCompiler |
|
2715 | 114 |
! |
115 |
||
116 |
InstrumentingCompiler::VariableAccessExecutionInfo subclass:#WriteAccessExecutionInfo |
|
2949 | 117 |
instanceVariableNames:'' |
118 |
classVariableNames:'' |
|
119 |
poolDictionaries:'' |
|
120 |
privateIn:InstrumentingCompiler |
|
2715 | 121 |
! |
122 |
||
2357 | 123 |
!InstrumentingCompiler class methodsFor:'documentation'! |
124 |
||
4126 | 125 |
copyright |
126 |
" |
|
127 |
COPYRIGHT (c) 2010 by Claus Gittinger |
|
128 |
All Rights Reserved |
|
129 |
||
130 |
This software is furnished under a license and may be used |
|
131 |
only in accordance with the terms of that license and with the |
|
132 |
inclusion of the above copyright notice. This software may not |
|
133 |
be provided or otherwise made available to, or used by, any |
|
134 |
other person. No title to or ownership of the software is |
|
135 |
hereby transferred. |
|
136 |
" |
|
137 |
! |
|
138 |
||
2357 | 139 |
documentation |
140 |
" |
|
2632 | 141 |
an experiment - recompile classes using this compiler adds instrumentation code. |
142 |
This remembers who calls a method from where (methodInvocationInfo) what the receiver's types are |
|
143 |
(inherited classes) and how often basic blocks (blockExecutionInfo) and statements |
|
144 |
(statementExecutionInfo) are invoked . |
|
145 |
||
146 |
The who-calls and receiver type info may produce some overhead, which can be avoided by |
|
147 |
using the somewhat more naive InstrumentingForSimpleCoverageCompiler (that is what people are |
|
148 |
used to from the C/Java world, anyway). |
|
149 |
||
150 |
From the first bulk, we can compute the inheritanceCoverage info (which methods have been called for which |
|
151 |
subclass) in addition to the known line and block coverages. |
|
2357 | 152 |
" |
153 |
! ! |
|
154 |
||
155 |
!InstrumentingCompiler class methodsFor:'compilation-public'! |
|
156 |
||
157 |
compileClass:aClass |
|
158 |
"compile all methods of aClass with instrumentation" |
|
159 |
||
2958 | 160 |
aClass instAndClassMethodsDo:[:eachMethod | |
2357 | 161 |
self compileMethod:eachMethod |
162 |
]. |
|
163 |
! |
|
164 |
||
165 |
compileMethod:aMethod |
|
166 |
"compile a single method with instrumentation" |
|
167 |
||
2972
204f077ff866
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2967
diff
changeset
|
168 |
Class withoutUpdatingChangesDo:[ |
3237
a6b2f875bcc3
Fix in InstrumentingCompiler>>#compileMethod:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3192
diff
changeset
|
169 |
Class packageQuerySignal answer: aMethod package do:[ |
a6b2f875bcc3
Fix in InstrumentingCompiler>>#compileMethod:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3192
diff
changeset
|
170 |
self |
a6b2f875bcc3
Fix in InstrumentingCompiler>>#compileMethod:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3192
diff
changeset
|
171 |
compile:(aMethod source) |
a6b2f875bcc3
Fix in InstrumentingCompiler>>#compileMethod:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3192
diff
changeset
|
172 |
forClass:(aMethod mclass) |
a6b2f875bcc3
Fix in InstrumentingCompiler>>#compileMethod:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3192
diff
changeset
|
173 |
inCategory:(aMethod category) |
a6b2f875bcc3
Fix in InstrumentingCompiler>>#compileMethod:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3192
diff
changeset
|
174 |
] |
2972
204f077ff866
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2967
diff
changeset
|
175 |
] |
3237
a6b2f875bcc3
Fix in InstrumentingCompiler>>#compileMethod:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3192
diff
changeset
|
176 |
|
a6b2f875bcc3
Fix in InstrumentingCompiler>>#compileMethod:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3192
diff
changeset
|
177 |
"Modified: / 28-07-2013 / 16:59:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2958 | 178 |
! |
179 |
||
180 |
compilePackage:aPackageID |
|
181 |
"compile all classes of a package instrumentation" |
|
182 |
||
183 |
Smalltalk allClassesInPackage:aPackageID do:[:eachClass | |
|
184 |
self compileClass:eachClass |
|
185 |
]. |
|
186 |
||
187 |
" |
|
188 |
InstrumentingCompiler compilePackage:'exept:workflow'. |
|
189 |
InstrumentingCompiler compilePackage:'exept:expecco'. |
|
190 |
" |
|
2972
204f077ff866
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2967
diff
changeset
|
191 |
! |
204f077ff866
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2967
diff
changeset
|
192 |
|
204f077ff866
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2967
diff
changeset
|
193 |
compilePackages:aCollectionOfPackageIDs |
204f077ff866
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2967
diff
changeset
|
194 |
"compile all classes of some packages with instrumentation" |
204f077ff866
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2967
diff
changeset
|
195 |
|
204f077ff866
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2967
diff
changeset
|
196 |
aCollectionOfPackageIDs do:[:eachPackage | |
204f077ff866
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2967
diff
changeset
|
197 |
self compilePackage:eachPackage |
204f077ff866
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2967
diff
changeset
|
198 |
]. |
204f077ff866
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2967
diff
changeset
|
199 |
|
204f077ff866
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2967
diff
changeset
|
200 |
" |
204f077ff866
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2967
diff
changeset
|
201 |
InstrumentingCompiler compilePackages:#( 'exept:workflow' 'exept:expecco' ). |
204f077ff866
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2967
diff
changeset
|
202 |
" |
2357 | 203 |
! ! |
204 |
||
205 |
!InstrumentingCompiler class methodsFor:'special'! |
|
206 |
||
207 |
allInstrumentedMethods |
|
208 |
^ InstrumentedMethod allInstances |
|
209 |
||
210 |
" |
|
211 |
self allInstrumentedMethods |
|
212 |
" |
|
213 |
||
214 |
"Modified: / 27-04-2010 / 13:37:51 / cg" |
|
215 |
! |
|
216 |
||
217 |
callersOf:aMethod do:aBlock |
|
2632 | 218 |
"enumerate all callers of aMethod into a block" |
219 |
||
2357 | 220 |
|info| |
221 |
||
222 |
info := aMethod methodInvocationInfo. |
|
223 |
info notNil ifTrue:[ |
|
224 |
info callingMethodsDo:[:callingMethod | |
|
225 |
aBlock value:callingMethod |
|
226 |
] |
|
227 |
] |
|
228 |
||
229 |
"Modified: / 27-04-2010 / 13:35:00 / cg" |
|
2632 | 230 |
"Modified (comment): / 07-08-2011 / 15:08:33 / cg" |
2357 | 231 |
! |
232 |
||
233 |
isInstrumented:aMethod |
|
234 |
^ aMethod isInstrumented |
|
235 |
||
236 |
" |
|
237 |
self methodInfoOf:aMethod |
|
238 |
" |
|
239 |
||
240 |
"Modified: / 27-04-2010 / 13:35:21 / cg" |
|
241 |
! |
|
242 |
||
243 |
methodInfoOf:aMethod |
|
244 |
<resource: #obsolete> |
|
245 |
||
246 |
self obsoleteMethodWarning:'please use Method >> methodInvocationInfo'. |
|
247 |
^ aMethod methodInvocationInfo |
|
248 |
||
249 |
" |
|
250 |
self methodInfoOf:aMethod |
|
251 |
" |
|
252 |
||
253 |
"Modified: / 27-04-2010 / 13:37:31 / cg" |
|
254 |
! |
|
255 |
||
256 |
methodInvocationInfoOf:aMethod |
|
3192 | 257 |
<resource: #obsolete> |
2357 | 258 |
self obsoleteMethodWarning:'please use method>>methodInvocationInfo'. |
259 |
^ aMethod methodInvocationInfo |
|
260 |
||
261 |
" |
|
262 |
self methodInfoOf:aMethod |
|
263 |
" |
|
264 |
||
265 |
"Created: / 27-04-2010 / 12:28:56 / cg" |
|
266 |
"Modified: / 27-04-2010 / 13:34:36 / cg" |
|
267 |
! ! |
|
268 |
||
269 |
!InstrumentingCompiler methodsFor:'code generation helpers'! |
|
270 |
||
271 |
addBlockCounterTo:aBlockNode |
|
2951 | 272 |
"called by the compiler to instrument a block node" |
273 |
||
2357 | 274 |
|countCode blockEntryInfo| |
275 |
||
276 |
blockInvocationInfo isNil ifTrue:[ |
|
277 |
blockInvocationInfo := OrderedCollection new. |
|
278 |
]. |
|
2632 | 279 |
blockEntryInfo := self blockExecutionInfoInstance. |
2370
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
280 |
blockEntryInfo startPosition:aBlockNode startPosition endPosition:aBlockNode endPosition. |
2675
3e8368ea406e
comment/format in: #addBlockCounterTo:
Claus Gittinger <cg@exept.de>
parents:
2665
diff
changeset
|
281 |
"/ Transcript show:aBlockNode startPosition; |
3e8368ea406e
comment/format in: #addBlockCounterTo:
Claus Gittinger <cg@exept.de>
parents:
2665
diff
changeset
|
282 |
"/ show:' -> '; |
3e8368ea406e
comment/format in: #addBlockCounterTo:
Claus Gittinger <cg@exept.de>
parents:
2665
diff
changeset
|
283 |
"/ showCR: aBlockNode endPosition. |
2357 | 284 |
blockInvocationInfo add:blockEntryInfo. |
285 |
||
286 |
countCode := |
|
287 |
StatementNode |
|
288 |
expression:(MessageNode |
|
289 |
receiver:(ConstantNode value:blockEntryInfo) |
|
290 |
selector:#entry: |
|
291 |
arg:(VariableNode type:#ThisContext context:contextToEvaluateIn)). |
|
292 |
||
293 |
aBlockNode isEmptyBlock ifTrue:[ |
|
294 |
"/ q: are we interested in empty blocks ? |
|
2665
2071b01a050f
changed: #addBlockCounterTo:
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
295 |
countCode nextStatement:(StatementNode expression:(ConstantNode value:nil)). |
2357 | 296 |
aBlockNode statements:countCode. |
297 |
] ifFalse:[ |
|
298 |
countCode nextStatement:aBlockNode statements. |
|
299 |
aBlockNode statements:countCode. |
|
300 |
]. |
|
301 |
||
2675
3e8368ea406e
comment/format in: #addBlockCounterTo:
Claus Gittinger <cg@exept.de>
parents:
2665
diff
changeset
|
302 |
"Modified: / 21-08-2011 / 16:02:52 / cg" |
2357 | 303 |
! |
304 |
||
305 |
addBlockCountersToEachBlockIn:aCollection |
|
2951 | 306 |
"called by the compiler to instrument a collection of block nodes" |
307 |
||
2357 | 308 |
aCollection do:[:eachNode | |
309 |
eachNode isBlockNode ifTrue:[ |
|
310 |
self addBlockCounterTo:eachNode |
|
311 |
] |
|
312 |
]. |
|
313 |
||
314 |
"Created: / 27-04-2010 / 11:47:56 / cg" |
|
315 |
! |
|
316 |
||
317 |
createMethod |
|
2951 | 318 |
"called by the compiler to instatiate a new method instance" |
319 |
||
2357 | 320 |
method := super createMethod. |
321 |
||
322 |
methodEntryInfo notNil ifTrue:[ |
|
323 |
methodEntryInfo owningMethod:method |
|
324 |
]. |
|
325 |
blockInvocationInfo notNil ifTrue:[ |
|
326 |
blockInvocationInfo do:[:eachInfo | eachInfo owningMethod:method] |
|
327 |
]. |
|
328 |
||
329 |
^ method |
|
330 |
||
331 |
"Modified: / 27-04-2010 / 14:04:50 / cg" |
|
332 |
! |
|
333 |
||
334 |
methodClass |
|
2951 | 335 |
"called by the compiler to ask for the method instance's class" |
336 |
||
2357 | 337 |
^ InstrumentedMethod |
338 |
||
339 |
"Created: / 27-04-2010 / 12:17:22 / cg" |
|
2390 | 340 |
! |
341 |
||
342 |
statementCounterBefore:aStatementNode |
|
2951 | 343 |
"called by the compiler to instrument a statement node (head of a basic block)" |
344 |
||
2390 | 345 |
|countCode statementEntryInfo| |
346 |
||
347 |
blockInvocationInfo isNil ifTrue:[ |
|
348 |
blockInvocationInfo := OrderedCollection new. |
|
349 |
]. |
|
2632 | 350 |
statementEntryInfo := self statementExecutionInfoInstance. |
2390 | 351 |
statementEntryInfo startPosition:aStatementNode startPosition. |
352 |
blockInvocationInfo add:statementEntryInfo. |
|
353 |
||
354 |
countCode := |
|
355 |
StatementNode |
|
356 |
expression:(MessageNode |
|
357 |
receiver:(ConstantNode value:statementEntryInfo) |
|
358 |
selector:#entry: |
|
359 |
arg:(VariableNode type:#ThisContext context:contextToEvaluateIn)). |
|
360 |
||
361 |
countCode nextStatement:aStatementNode. |
|
362 |
^ countCode |
|
2571 | 363 |
|
2632 | 364 |
"Modified: / 07-08-2011 / 15:32:45 / cg" |
2357 | 365 |
! ! |
366 |
||
2715 | 367 |
!InstrumentingCompiler methodsFor:'code generation hooks'! |
368 |
||
369 |
assignmentRewriteHookFor:anAssignmentNode |
|
370 |
"invoked whenever an assignment node has been generated" |
|
371 |
||
372 |
^ anAssignmentNode |
|
373 |
||
374 |
"Created: / 30-09-2011 / 12:28:09 / cg" |
|
375 |
! |
|
2357 | 376 |
|
2370
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
377 |
blockNodeRewriteHookFor:aBlockNode |
2715 | 378 |
"invoked whenever a block node has been generated" |
379 |
||
2370
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
380 |
"/ add a counter for the block |
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
381 |
self addBlockCounterTo:aBlockNode. |
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
382 |
^ aBlockNode |
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
383 |
|
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
384 |
"Created: / 28-04-2010 / 14:21:27 / cg" |
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
385 |
! |
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
386 |
|
2357 | 387 |
messageNodeRewriteHookFor:aMessageNode |
2715 | 388 |
"invoked whenever a message send node has been generated" |
389 |
||
2370
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
390 |
"/ see blockNodeRewriter... |
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
391 |
|
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
392 |
"/ "/ argument could be a constantNode (due to contant-folding optimization) |
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
393 |
"/ aMessageNode isConstant ifTrue:[^ aMessageNode]. |
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
394 |
"/ ( |
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
395 |
"/ #( |
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
396 |
"/ ifTrue: |
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
397 |
"/ ifFalse: |
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
398 |
"/ ifTrue:ifFalse: |
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
399 |
"/ ifFalse:ifTrue: |
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
400 |
"/ ) |
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
401 |
"/ includes:aMessageNode selector |
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
402 |
"/ ) ifTrue:[ |
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
403 |
"/ "/ add a counter for the block |
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
404 |
"/ self addBlockCountersToEachBlockIn:(aMessageNode arguments) |
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
405 |
"/ ]. |
2357 | 406 |
^ aMessageNode |
407 |
||
408 |
"Created: / 27-04-2010 / 11:43:22 / cg" |
|
2370
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
409 |
"Modified: / 28-04-2010 / 14:22:05 / cg" |
2715 | 410 |
"Modified (comment): / 30-09-2011 / 12:16:56 / cg" |
2357 | 411 |
! |
412 |
||
413 |
startCodeGenerationHookOn:codeStream |
|
2715 | 414 |
"invoked before code is generated" |
415 |
||
2632 | 416 |
methodEntryInfo := self methodInvocationInfoInstance. |
2357 | 417 |
|
418 |
(StatementNode |
|
419 |
expression:(MessageNode |
|
420 |
receiver:(ConstantNode value:methodEntryInfo) |
|
421 |
selector:#entry: |
|
422 |
arg:(VariableNode type:#ThisContext context:contextToEvaluateIn))) |
|
423 |
codeForSideEffectOn:codeStream inBlock:nil for:self. |
|
424 |
||
2632 | 425 |
"Modified: / 07-08-2011 / 15:34:09 / cg" |
2715 | 426 |
"Modified (comment): / 30-09-2011 / 12:16:05 / cg" |
2390 | 427 |
! |
428 |
||
3239
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
429 |
statementListRewriteHookFor:firstStatementArg |
2715 | 430 |
"invoked whenever a statement list node has been generated" |
431 |
||
2390 | 432 |
"/ care for blocks which return... |
3239
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
433 |
|thisStatement prevStatement countStatement mustInsertExecutionInfo statementInfo firstStatement | |
2390 | 434 |
|
435 |
mustInsertExecutionInfo := false. |
|
436 |
prevStatement := nil. |
|
437 |
||
3239
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
438 |
thisStatement := firstStatementArg. |
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
439 |
thisStatement isNil ifTrue:[^ firstStatementArg]. |
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
440 |
firstStatement := self statementCounterBefore:thisStatement. |
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
441 |
statementInfo := firstStatement expression receiver value. |
4354 | 442 |
statementInfo endPosition:(thisStatement endPosition). |
3239
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
443 |
|
2390 | 444 |
|
445 |
[true] whileTrue:[ |
|
446 |
mustInsertExecutionInfo ifTrue:[ |
|
447 |
"/ prev-stat had a return in it (a block with a return); |
|
448 |
"/ insert a statement-entry here. |
|
449 |
thisStatement notNil ifTrue:[ |
|
450 |
countStatement := self statementCounterBefore:thisStatement. |
|
3239
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
451 |
statementInfo := countStatement expression receiver value. |
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
452 |
statementInfo endPosition: thisStatement endPosition. |
2390 | 453 |
prevStatement nextStatement:countStatement. |
454 |
mustInsertExecutionInfo := false. |
|
455 |
prevStatement := countStatement. |
|
456 |
] |
|
457 |
]. |
|
3239
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
458 |
thisStatement isNil ifTrue:[ ^ firstStatement ]. |
2390 | 459 |
|
460 |
thisStatement isReturnNode ifFalse:[ |
|
461 |
thisStatement containsReturn ifTrue:[ |
|
462 |
mustInsertExecutionInfo := true |
|
463 |
] |
|
464 |
]. |
|
465 |
prevStatement := thisStatement. |
|
3239
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
466 |
statementInfo notNil ifTrue:[ |
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
467 |
statementInfo endPosition: prevStatement endPosition. |
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
468 |
]. |
2390 | 469 |
thisStatement := thisStatement nextStatement. |
470 |
]. |
|
2715 | 471 |
|
472 |
"Modified (comment): / 30-09-2011 / 12:15:52 / cg" |
|
3239
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
473 |
"Modified: / 29-07-2013 / 00:11:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4354 | 474 |
"Modified (format): / 15-02-2019 / 14:39:55 / Claus Gittinger" |
2715 | 475 |
! |
476 |
||
477 |
variableReadRewriteHookFor:aVariableNode |
|
478 |
"invoked whenever a variable access node has been generated" |
|
479 |
||
480 |
^ aVariableNode |
|
481 |
||
482 |
"Created: / 30-09-2011 / 12:27:47 / cg" |
|
2357 | 483 |
! ! |
484 |
||
2632 | 485 |
!InstrumentingCompiler methodsFor:'redefinable'! |
2357 | 486 |
|
2632 | 487 |
blockExecutionInfoInstance |
488 |
"one instance is generated for every block, |
|
489 |
and called at execution time with entry:" |
|
2357 | 490 |
|
2632 | 491 |
^ BlockExecutionInfo new cleanInfoWithChange:false. |
492 |
||
493 |
"Created: / 07-08-2011 / 15:13:42 / cg" |
|
2357 | 494 |
! |
495 |
||
2632 | 496 |
methodInvocationInfoInstance |
497 |
"one instance is generated for every method, |
|
498 |
and called at execution time with entry:" |
|
2357 | 499 |
|
2632 | 500 |
^ MethodInvocationInfo new. |
2357 | 501 |
|
2632 | 502 |
"Created: / 07-08-2011 / 15:33:57 / cg" |
503 |
! |
|
2357 | 504 |
|
2632 | 505 |
statementExecutionInfoInstance |
506 |
"one instance is generated for every statement, |
|
507 |
and called at execution time with entry:" |
|
2357 | 508 |
|
2632 | 509 |
^ StatementExecutionInfo new cleanInfoWithChange:false. |
2357 | 510 |
|
2632 | 511 |
"Created: / 07-08-2011 / 15:32:36 / cg" |
2357 | 512 |
! ! |
513 |
||
2715 | 514 |
!InstrumentingCompiler::StatementExecutionInfo class methodsFor:'documentation'! |
515 |
||
516 |
documentation |
|
517 |
" |
|
518 |
(sub)instances of me are updated by instrumented code when statements are executed. |
|
519 |
" |
|
520 |
! ! |
|
521 |
||
2390 | 522 |
!InstrumentingCompiler::StatementExecutionInfo methodsFor:'accessing'! |
2359 | 523 |
|
524 |
callCount |
|
525 |
^ count |
|
526 |
||
527 |
"Created: / 27-04-2010 / 13:45:15 / cg" |
|
528 |
! |
|
529 |
||
530 |
characterPosition |
|
2370
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
531 |
^ startPosition |
2359 | 532 |
|
533 |
"Created: / 23-06-2006 / 13:31:19 / cg" |
|
2370
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
534 |
"Modified: / 28-04-2010 / 15:54:24 / cg" |
2359 | 535 |
! |
536 |
||
537 |
characterPosition:something |
|
2370
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
538 |
startPosition := something. |
2359 | 539 |
|
540 |
"Created: / 23-06-2006 / 13:31:19 / cg" |
|
2370
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
541 |
"Modified: / 28-04-2010 / 15:54:30 / cg" |
2359 | 542 |
! |
543 |
||
544 |
count |
|
2973
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
545 |
"how often have I been called" |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
546 |
|
2981 | 547 |
^ count ? 0 |
2359 | 548 |
|
549 |
"Created: / 23-06-2006 / 13:31:28 / cg" |
|
2370
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
550 |
! |
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
551 |
|
3239
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
552 |
endPosition |
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
553 |
^ endPosition |
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
554 |
|
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
555 |
"Created: / 28-04-2010 / 15:57:14 / cg" |
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
556 |
! |
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
557 |
|
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
558 |
endPosition:anInteger |
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
559 |
endPosition := anInteger. |
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
560 |
! |
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
561 |
|
2370
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
562 |
startPosition |
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
563 |
^ startPosition |
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
564 |
|
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
565 |
"Created: / 28-04-2010 / 15:54:26 / cg" |
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
566 |
! |
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
567 |
|
3239
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
568 |
startPosition:anInteger |
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
569 |
startPosition := anInteger. |
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
570 |
! |
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
571 |
|
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
572 |
startPosition:startArg endPosition:endArg |
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
573 |
startPosition := startArg. |
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
574 |
endPosition := endArg. |
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
575 |
|
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
576 |
"Created: / 28-04-2010 / 15:54:47 / cg" |
2359 | 577 |
! ! |
578 |
||
2390 | 579 |
!InstrumentingCompiler::StatementExecutionInfo methodsFor:'cleanup'! |
2359 | 580 |
|
2571 | 581 |
cleanInfoWithChange:withChange |
2569 | 582 |
count := 0. |
2571 | 583 |
withChange ifTrue:[ |
584 |
Smalltalk changed:#methodCoverageInfo with:owningMethod. |
|
585 |
]. |
|
2569 | 586 |
|
2570 | 587 |
"Modified: / 20-07-2011 / 17:55:49 / cg" |
2571 | 588 |
"Created: / 20-07-2011 / 18:59:01 / cg" |
2359 | 589 |
! ! |
590 |
||
3239
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
591 |
!InstrumentingCompiler::StatementExecutionInfo methodsFor:'debugging'! |
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
592 |
|
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
593 |
inspector2TabSource |
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
594 |
| source | |
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
595 |
|
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
596 |
source := owningMethod source asText. |
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
597 |
startPosition isNil ifTrue:[ |
4538 | 598 |
source allRed. |
3239
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
599 |
] ifFalse:[ |
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
600 |
endPosition isNil ifTrue:[ |
4538 | 601 |
|end| |
602 |
end := source string size. |
|
603 |
source emphasizeFrom:startPosition to:end with: #bold. |
|
604 |
source emphasizeFrom:startPosition to:end with: #color -> Color red. |
|
3239
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
605 |
] ifFalse:[ |
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
606 |
source emphasizeFrom:startPosition to: endPosition with: #bold. |
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
607 |
source emphasizeFrom:startPosition to: endPosition with: #color -> Color blue. |
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
608 |
]. |
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
609 |
]. |
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
610 |
|
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
611 |
^self newInspector2Tab |
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
612 |
label: 'Source'; |
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
613 |
priority: 50; |
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
614 |
view: ((ScrollableView for:EditTextView) contents: source; yourself) |
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
615 |
|
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
616 |
"Created: / 28-07-2013 / 23:16:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
617 |
! |
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
618 |
|
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
619 |
inspector2Tabs |
3585
1f2291b908b7
Fixed #inspector2Tabs method: always call 'super inspector2Tabs'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3570
diff
changeset
|
620 |
^ super inspector2Tabs , #( inspector2TabSource ) |
3239
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
621 |
|
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
622 |
"Created: / 28-07-2013 / 23:18:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3585
1f2291b908b7
Fixed #inspector2Tabs method: always call 'super inspector2Tabs'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3570
diff
changeset
|
623 |
"Modified: / 13-02-2015 / 21:03:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3239
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
624 |
! ! |
a603d73841d4
Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
625 |
|
2390 | 626 |
!InstrumentingCompiler::StatementExecutionInfo methodsFor:'instrumentation calls'! |
2359 | 627 |
|
628 |
entry:callingContext |
|
2528
e57cc8caf6f9
dont instrument the instrumentation code
Claus Gittinger <cg@exept.de>
parents:
2391
diff
changeset
|
629 |
"invoked by instrumented code; |
2632 | 630 |
called whenever the block/statment is entered" |
631 |
||
632 |
|context| |
|
2359 | 633 |
|
2632 | 634 |
context := InstrumentationContext current. |
635 |
context isNil ifTrue:[^ self]. |
|
2960
8adc66fe55fb
care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents:
2958
diff
changeset
|
636 |
context inInstrumentedCode ifTrue:[^ self]. |
2711 | 637 |
context coverageOnly ifTrue:[ |
638 |
self hasBeenExecuted ifTrue:[^ self]. |
|
639 |
]. |
|
2632 | 640 |
context enabledAndNotInInstrumentedCode ifFalse:[^ self]. |
2528
e57cc8caf6f9
dont instrument the instrumentation code
Claus Gittinger <cg@exept.de>
parents:
2391
diff
changeset
|
641 |
|
2359 | 642 |
count := count + 1. |
643 |
count == 1 ifTrue:[ |
|
2960
8adc66fe55fb
care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents:
2958
diff
changeset
|
644 |
"/ the very first time, send a change notification, so the browsers update the coloring |
2632 | 645 |
|
2944 | 646 |
[ |
647 |
context inInstrumentedCode:true. |
|
648 |
Smalltalk changed:#methodCoverageInfo with:owningMethod. |
|
2967
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
649 |
context coverageOnly ifTrue:[ |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
650 |
self changeClassToCoverageAndAlreadyEntered. |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
651 |
] ifFalse:[ |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
652 |
self changeClassToAlreadyEntered. |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
653 |
]. |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
654 |
"/ attention: no self sends here - class has changed!! |
2944 | 655 |
] ensure:[ |
656 |
context inInstrumentedCode:false. |
|
657 |
] |
|
2359 | 658 |
]. |
659 |
||
660 |
"Created: / 23-06-2006 / 13:31:16 / cg" |
|
2711 | 661 |
"Modified: / 23-08-2011 / 21:29:39 / cg" |
2359 | 662 |
! ! |
663 |
||
4398 | 664 |
!InstrumentingCompiler::StatementExecutionInfo methodsFor:'printing'! |
665 |
||
666 |
printOn:aStream |
|
667 |
aStream nextPutAll:'['. |
|
668 |
startPosition printOn:aStream. |
|
669 |
aStream nextPutAll:'...'. |
|
670 |
endPosition printOn:aStream. |
|
671 |
aStream nextPutAll:' | count: '. |
|
672 |
count printOn:aStream. |
|
673 |
aStream nextPutAll:' | code: '. |
|
674 |
(owningMethod source asString |
|
675 |
copyFrom:startPosition |
|
676 |
to:endPosition) printOn:aStream. |
|
677 |
aStream nextPutAll:']'. |
|
678 |
||
679 |
"Created: / 21-08-2011 / 14:02:01 / cg" |
|
680 |
"Modified: / 22-03-2019 / 08:43:56 / Claus Gittinger" |
|
681 |
! ! |
|
682 |
||
2973
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
683 |
!InstrumentingCompiler::StatementExecutionInfo methodsFor:'private'! |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
684 |
|
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
685 |
changeClassToAlreadyEntered |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
686 |
self class == InstrumentingCompiler::StatementExecutionInfo ifTrue:[ |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
687 |
self changeClassTo: StatementExecutionInfoInAlreadyEnteredState |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
688 |
]. |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
689 |
! |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
690 |
|
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
691 |
changeClassToCoverageAndAlreadyEntered |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
692 |
self class == InstrumentingCompiler::StatementExecutionInfo ifTrue:[ |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
693 |
self changeClassTo: StatementExecutionInfoForCoverageInAlreadyEnteredState |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
694 |
]. |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
695 |
! ! |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
696 |
|
2390 | 697 |
!InstrumentingCompiler::StatementExecutionInfo methodsFor:'queries'! |
2370
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
698 |
|
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
699 |
hasBeenExecuted |
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
700 |
^ count > 0 |
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
701 |
|
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
702 |
"Created: / 28-04-2010 / 14:39:46 / cg" |
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
703 |
! ! |
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
704 |
|
2632 | 705 |
!InstrumentingCompiler::StatementExecutionInfo methodsFor:'testing'! |
706 |
||
707 |
isStatementExecutionInfo |
|
708 |
^ true |
|
709 |
||
710 |
"Created: / 08-08-2011 / 14:40:51 / cg" |
|
711 |
! ! |
|
712 |
||
2967
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
713 |
!InstrumentingCompiler::StatementExecutionInfo::StatementExecutionInfoForCoverageInAlreadyEnteredState methodsFor:'cleanup'! |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
714 |
|
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
715 |
cleanInfoWithChange:withChange |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
716 |
super cleanInfoWithChange:withChange. |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
717 |
self changeClassTo:InstrumentingCompiler::StatementExecutionInfo. |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
718 |
! ! |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
719 |
|
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
720 |
!InstrumentingCompiler::StatementExecutionInfo::StatementExecutionInfoForCoverageInAlreadyEnteredState methodsFor:'instrumentation calls'! |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
721 |
|
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
722 |
entry:callingContext |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
723 |
"already been invoked - nothing to record" |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
724 |
|
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
725 |
^ self |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
726 |
! ! |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
727 |
|
2973
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
728 |
!InstrumentingCompiler::StatementExecutionInfo::StatementExecutionInfoForCoverageInAlreadyEnteredState methodsFor:'queries'! |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
729 |
|
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
730 |
hasBeenExecuted |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
731 |
^ true |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
732 |
! ! |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
733 |
|
2967
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
734 |
!InstrumentingCompiler::StatementExecutionInfo::StatementExecutionInfoInAlreadyEnteredState methodsFor:'cleanup'! |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
735 |
|
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
736 |
cleanInfoWithChange:withChange |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
737 |
super cleanInfoWithChange:withChange. |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
738 |
self changeClassTo:InstrumentingCompiler::StatementExecutionInfo. |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
739 |
! ! |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
740 |
|
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
741 |
!InstrumentingCompiler::StatementExecutionInfo::StatementExecutionInfoInAlreadyEnteredState methodsFor:'instrumentation calls'! |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
742 |
|
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
743 |
entry:callingContext |
2973
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
744 |
"already been invoked - no update notifications to browsers" |
2967
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
745 |
|
2973
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
746 |
count := count + 1. |
2967
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
747 |
! ! |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
748 |
|
2357 | 749 |
!InstrumentingCompiler::MethodInvocationInfo methodsFor:'accessing'! |
750 |
||
751 |
callingMethodsDo:aBlock |
|
752 |
infoPerReceiverClass notNil ifTrue:[ |
|
2949 | 753 |
infoPerReceiverClass ~~ true ifTrue:[ |
754 |
infoPerReceiverClass do:[:each | |
|
755 |
each callingMethodsDo:aBlock |
|
756 |
] |
|
2357 | 757 |
] |
758 |
] |
|
759 |
! |
|
760 |
||
2973
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
761 |
count |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
762 |
"how often have I been called" |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
763 |
|
2981 | 764 |
^ count ? 0 |
2973
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
765 |
! |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
766 |
|
2357 | 767 |
hasBeenCalled |
768 |
^ infoPerReceiverClass notEmptyOrNil |
|
769 |
||
770 |
"Created: / 27-04-2010 / 13:43:15 / cg" |
|
771 |
! |
|
772 |
||
2368 | 773 |
invokedViaPerform |
774 |
^ infoPerReceiverClass contains:[:someInfo | someInfo invokedViaPerform]. |
|
775 |
||
776 |
"Created: / 27-04-2010 / 18:21:56 / cg" |
|
777 |
! |
|
778 |
||
2357 | 779 |
invokingMethods |
780 |
|setOfMethods| |
|
781 |
||
782 |
setOfMethods := IdentitySet new. |
|
783 |
self invokingMethodsDo:[:m | setOfMethods add:m]. |
|
784 |
^ setOfMethods. |
|
785 |
! |
|
786 |
||
787 |
invokingMethodsDo:aBlock |
|
4527 | 788 |
infoPerReceiverClass notNil ifTrue:[ |
789 |
infoPerReceiverClass do:[:eachInfo | eachInfo invokingMethodsDo:aBlock]. |
|
790 |
] |
|
2357 | 791 |
! |
792 |
||
793 |
numberOfInvocations |
|
794 |
infoPerReceiverClass isNil ifTrue:[ ^ 0]. |
|
2951 | 795 |
infoPerReceiverClass == true ifTrue:[ ^ 0]. |
2357 | 796 |
^ infoPerReceiverClass inject:0 into:[:sumSoFar :info | sumSoFar + info numberOfInvocations] |
797 |
! |
|
798 |
||
799 |
numberOfInvocationsFromExternalOf:aClass |
|
800 |
|sum| |
|
801 |
||
802 |
infoPerReceiverClass isNil ifTrue:[ ^ 0]. |
|
803 |
||
804 |
sum := 0. |
|
805 |
infoPerReceiverClass keysAndValuesDo:[:recClass :info | |
|
806 |
sum := sum + (info numberOfInvocationsFromExternalOf:aClass) |
|
807 |
]. |
|
808 |
^ sum |
|
809 |
! |
|
810 |
||
811 |
numberOfInvocationsFromInternalOf:aClass |
|
812 |
|sum| |
|
813 |
||
814 |
infoPerReceiverClass isNil ifTrue:[ ^ 0]. |
|
815 |
||
816 |
sum := 0. |
|
817 |
infoPerReceiverClass keysAndValuesDo:[:recClass :info | |
|
818 |
sum := sum + (info numberOfInvocationsFromInternalOf:aClass) |
|
819 |
]. |
|
820 |
^ sum |
|
821 |
! ! |
|
822 |
||
823 |
!InstrumentingCompiler::MethodInvocationInfo methodsFor:'cleanup'! |
|
824 |
||
2571 | 825 |
cleanInfoWithChange:withChange |
2357 | 826 |
infoPerReceiverClass := nil. |
2571 | 827 |
withChange ifTrue:[ |
828 |
Smalltalk changed:#methodCoverageInfo with:owningMethod. |
|
829 |
] |
|
2569 | 830 |
|
2570 | 831 |
"Modified: / 20-07-2011 / 17:55:35 / cg" |
2571 | 832 |
"Created: / 20-07-2011 / 18:59:22 / cg" |
2357 | 833 |
! ! |
834 |
||
2973
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
835 |
!InstrumentingCompiler::MethodInvocationInfo methodsFor:'instrumentation calls'! |
2967
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
836 |
|
2357 | 837 |
entry:aContext |
838 |
"invoked by instrumented compiled code, upon method entry" |
|
839 |
||
2948 | 840 |
|context receiversClass infoPerReceiver firstEntry coverageOnly| |
2357 | 841 |
|
2960
8adc66fe55fb
care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents:
2958
diff
changeset
|
842 |
recursiveEntry == true ifTrue:[ |
8adc66fe55fb
care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents:
2958
diff
changeset
|
843 |
"/ hurry, get out of here |
8adc66fe55fb
care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents:
2958
diff
changeset
|
844 |
]. |
8adc66fe55fb
care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents:
2958
diff
changeset
|
845 |
|
8adc66fe55fb
care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents:
2958
diff
changeset
|
846 |
"/ this is a hack - we have to be very careful to avoid recursive |
8adc66fe55fb
care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents:
2958
diff
changeset
|
847 |
"/ instrumentation entries when instrumenting collection classes!! |
8adc66fe55fb
care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents:
2958
diff
changeset
|
848 |
"/ Do not change without extensive testing. |
8adc66fe55fb
care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents:
2958
diff
changeset
|
849 |
recursiveEntry := true. |
2632 | 850 |
context := InstrumentationContext current. |
2960
8adc66fe55fb
care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents:
2958
diff
changeset
|
851 |
context isNil ifTrue:[recursiveEntry := false. ^ self]. |
8adc66fe55fb
care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents:
2958
diff
changeset
|
852 |
context enabledAndNotInInstrumentedCode ifFalse:[recursiveEntry := false. ^ self]. |
2632 | 853 |
|
2973
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
854 |
count := (count ? 0) + 1. |
2944 | 855 |
[ |
856 |
context inInstrumentedCode:true. |
|
857 |
||
2875 | 858 |
firstEntry := false. |
859 |
||
2948 | 860 |
(coverageOnly := context coverageOnly) ifTrue:[ |
861 |
"/ only interested in entry, but not in a per-receiver statistics |
|
862 |
"/ that is the normal coverage usage |
|
863 |
infoPerReceiverClass isNil ifTrue:[ |
|
2949 | 864 |
infoPerReceiverClass := true. |
2948 | 865 |
firstEntry := true. |
866 |
]. |
|
867 |
] ifFalse:[ |
|
868 |
"/ interested in a per-receiver statistics (remembering with which receiver-class a method has been invoked). |
|
869 |
"/ that is used by the OOM package |
|
870 |
infoPerReceiverClass isNil ifTrue:[ |
|
871 |
infoPerReceiverClass := IdentityDictionary new. |
|
872 |
firstEntry := true. |
|
873 |
]. |
|
2944 | 874 |
receiversClass := aContext receiver class. |
875 |
infoPerReceiver := infoPerReceiverClass |
|
876 |
at:receiversClass |
|
877 |
ifAbsentPut:[MethodInvocationInfoPerReceiverClass new]. |
|
878 |
infoPerReceiver entry:aContext. |
|
879 |
]. |
|
2569 | 880 |
|
2960
8adc66fe55fb
care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents:
2958
diff
changeset
|
881 |
"/ the very first time, send a change notification, so the browsers update the coloring |
2944 | 882 |
firstEntry ifTrue:[ |
883 |
Smalltalk changed:#methodCoverageInfo with:owningMethod. |
|
884 |
]. |
|
2948 | 885 |
coverageOnly ifTrue:[ |
2967
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
886 |
self changeClassToCoverageAndAlreadyEntered. |
2948 | 887 |
] ifFalse:[ |
2967
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
888 |
self changeClassToAlreadyEntered. |
2948 | 889 |
]. |
2967
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
890 |
"/ attention: no self sends here - class has changed!! |
2944 | 891 |
] ensure:[ |
892 |
context inInstrumentedCode:false. |
|
2960
8adc66fe55fb
care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents:
2958
diff
changeset
|
893 |
recursiveEntry := false. |
2632 | 894 |
]. |
2528
e57cc8caf6f9
dont instrument the instrumentation code
Claus Gittinger <cg@exept.de>
parents:
2391
diff
changeset
|
895 |
|
2960
8adc66fe55fb
care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents:
2958
diff
changeset
|
896 |
"Modified (comment): / 26-10-2012 / 12:59:44 / cg" |
2632 | 897 |
! ! |
898 |
||
2973
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
899 |
!InstrumentingCompiler::MethodInvocationInfo methodsFor:'private'! |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
900 |
|
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
901 |
changeClassToAlreadyEntered |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
902 |
self class == InstrumentingCompiler::MethodInvocationInfo ifTrue:[ |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
903 |
self changeClassTo: InstrumentingCompiler::MethodInvocationInfoInAlreadyEnteredState |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
904 |
]. |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
905 |
! |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
906 |
|
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
907 |
changeClassToCoverageAndAlreadyEntered |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
908 |
self class == InstrumentingCompiler::MethodInvocationInfo ifTrue:[ |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
909 |
self changeClassTo: InstrumentingCompiler::MethodInvocationInfoForCoverageInAlreadyEnteredState |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
910 |
]. |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
911 |
! ! |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
912 |
|
2632 | 913 |
!InstrumentingCompiler::MethodInvocationInfo methodsFor:'testing'! |
914 |
||
915 |
isMethodInvocationInfo |
|
916 |
^ true |
|
917 |
||
918 |
"Created: / 08-08-2011 / 14:37:58 / cg" |
|
2357 | 919 |
! ! |
920 |
||
921 |
!InstrumentingCompiler::MethodInvocationInfo::MethodInvocationInfoPerReceiverClass methodsFor:'accessing'! |
|
922 |
||
923 |
callingMethodsDo:aBlock |
|
924 |
infoPerSendingMethod keysAndValuesDo:[:m :eachInfo | |
|
925 |
aBlock value:m |
|
926 |
] |
|
927 |
! |
|
928 |
||
2368 | 929 |
invokedViaPerform |
930 |
^ infoPerSendingMethod contains:[:someInfo | someInfo invokedViaPerform]. |
|
931 |
||
932 |
"Created: / 27-04-2010 / 18:21:36 / cg" |
|
933 |
! |
|
934 |
||
2357 | 935 |
invokingMethodsDo:aBlock |
936 |
infoPerSendingMethod isNil ifTrue:[ ^ self]. |
|
3570
0ac6e8f11416
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
3239
diff
changeset
|
937 |
infoPerSendingMethod keysDo:aBlock. |
2357 | 938 |
! |
939 |
||
940 |
numberOfInvocations |
|
941 |
infoPerSendingMethod isNil ifTrue:[ ^ 0]. |
|
942 |
^ infoPerSendingMethod inject:0 into:[:sumSoFar :info | sumSoFar + info numberOfInvocations] |
|
943 |
! |
|
944 |
||
945 |
numberOfInvocationsFromExternalOf:aClass |
|
946 |
|sum| |
|
947 |
||
948 |
infoPerSendingMethod isNil ifTrue:[ ^ 0]. |
|
949 |
||
950 |
sum := 0. |
|
951 |
infoPerSendingMethod keysAndValuesDo:[:sendingMethod :info | |
|
952 |
|sendingMethodsClass| |
|
953 |
||
954 |
sendingMethodsClass := sendingMethod mclass. |
|
955 |
sendingMethodsClass notNil ifTrue:[ |
|
956 |
((sendingMethodsClass isSubclassOf:aClass) |
|
957 |
or:[(aClass isSubclassOf:sendingMethodsClass )]) ifFalse:[ |
|
958 |
sum := sum + (info numberOfInvocations) |
|
959 |
] |
|
960 |
] |
|
961 |
]. |
|
962 |
^ sum |
|
963 |
! |
|
964 |
||
965 |
numberOfInvocationsFromInternalOf:aClass |
|
966 |
|sum| |
|
967 |
||
968 |
infoPerSendingMethod isNil ifTrue:[ ^ 0]. |
|
969 |
||
970 |
sum := 0. |
|
971 |
infoPerSendingMethod keysAndValuesDo:[:sendingMethod :info | |
|
972 |
|sendingMethodsClass| |
|
973 |
||
974 |
sendingMethodsClass := sendingMethod mclass. |
|
975 |
sendingMethodsClass notNil ifTrue:[ |
|
976 |
((sendingMethodsClass isSubclassOf:aClass) |
|
977 |
or:[(aClass isSubclassOf:sendingMethodsClass)]) ifTrue:[ |
|
978 |
sum := sum + (info numberOfInvocations) |
|
979 |
] |
|
980 |
] |
|
981 |
]. |
|
982 |
^ sum |
|
983 |
! ! |
|
984 |
||
985 |
!InstrumentingCompiler::MethodInvocationInfo::MethodInvocationInfoPerReceiverClass methodsFor:'instrumentation calls'! |
|
986 |
||
987 |
entry:aContext |
|
988 |
"invoked by instrumented compiled code, upon method entry" |
|
989 |
||
2368 | 990 |
|sender sendingMethod infoPerMethod viaPerform| |
2357 | 991 |
|
2391 | 992 |
aContext selector == #doesNotUnderstand: ifTrue:[ |
993 |
sender := aContext sender sender methodHome. |
|
994 |
] ifFalse:[ |
|
995 |
sender := aContext sender methodHome. |
|
996 |
]. |
|
2370
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
997 |
sender isNil ifTrue:[ |
a801cc4df234
added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
998 |
^ self. |
2569 | 999 |
]. |
1000 |
sendingMethod := sender method. |
|
1001 |
sendingMethod isNil ifTrue:[^ self]. |
|
2391 | 1002 |
|
2569 | 1003 |
viaPerform := false. |
1004 |
(sendingMethod mclass == Object |
|
1005 |
and:[ sendingMethod selector startsWith:'perform:'] ) ifTrue:[ |
|
1006 |
"/ Transcript showCR:('%1 [info]: skipping #perform' bindWith:self class nameWithoutPrefix). |
|
1007 |
sender := sender sender methodHome. |
|
1008 |
sendingMethod := sender method. |
|
1009 |
viaPerform := true. |
|
2357 | 1010 |
]. |
1011 |
||
1012 |
infoPerSendingMethod isNil ifTrue:[ |
|
1013 |
infoPerSendingMethod := IdentityDictionary new. |
|
1014 |
]. |
|
1015 |
infoPerMethod := infoPerSendingMethod |
|
1016 |
at:sendingMethod |
|
1017 |
ifAbsentPut:[ MethodInvocationInfoPerSendingMethod new ]. |
|
1018 |
||
2368 | 1019 |
infoPerMethod entry:aContext viaPerform:viaPerform |
1020 |
||
2569 | 1021 |
"Modified: / 20-07-2011 / 17:26:31 / cg" |
2357 | 1022 |
! ! |
1023 |
||
1024 |
!InstrumentingCompiler::MethodInvocationInfo::MethodInvocationInfoPerReceiverClass::MethodInvocationInfoPerSendingMethod methodsFor:'accessing'! |
|
1025 |
||
2368 | 1026 |
invokedViaPerform |
1027 |
^ invokedViaPerform ? false |
|
1028 |
||
1029 |
"Created: / 27-04-2010 / 18:20:05 / cg" |
|
1030 |
! |
|
1031 |
||
2357 | 1032 |
numberOfInvocations |
1033 |
countPerSendersClass isNil ifTrue:[ ^ 0]. |
|
1034 |
^ countPerSendersClass inject:0 into:[:sumSoFar :count | sumSoFar + count] |
|
1035 |
! ! |
|
1036 |
||
1037 |
!InstrumentingCompiler::MethodInvocationInfo::MethodInvocationInfoPerReceiverClass::MethodInvocationInfoPerSendingMethod methodsFor:'instrumentation calls'! |
|
1038 |
||
2368 | 1039 |
entry:aContext viaPerform:viaPerformBoolean |
2357 | 1040 |
"invoked by instrumented compiled code, upon method entry" |
1041 |
||
1042 |
|sendersClass count| |
|
1043 |
||
1044 |
sendersClass := aContext sender receiver class. |
|
1045 |
||
1046 |
countPerSendersClass isNil ifTrue:[ |
|
1047 |
countPerSendersClass := IdentityDictionary new. |
|
1048 |
]. |
|
1049 |
count := countPerSendersClass at:sendersClass ifAbsentPut:0. |
|
2368 | 1050 |
countPerSendersClass at:sendersClass put:(count + 1). |
1051 |
viaPerformBoolean ifTrue:[ invokedViaPerform := true ]. |
|
1052 |
||
1053 |
"Created: / 27-04-2010 / 18:17:27 / cg" |
|
2357 | 1054 |
! ! |
1055 |
||
2948 | 1056 |
!InstrumentingCompiler::MethodInvocationInfoForCoverageInAlreadyEnteredState methodsFor:'cleanup'! |
1057 |
||
1058 |
cleanInfoWithChange:withChange |
|
2967
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
1059 |
super cleanInfoWithChange:withChange. |
2948 | 1060 |
self changeClassTo:InstrumentingCompiler::MethodInvocationInfo. |
1061 |
! ! |
|
1062 |
||
2973
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
1063 |
!InstrumentingCompiler::MethodInvocationInfoForCoverageInAlreadyEnteredState methodsFor:'instrumentation calls'! |
2948 | 1064 |
|
1065 |
entry:aContext |
|
1066 |
"already been invoked - nothing to record" |
|
1067 |
||
1068 |
^ self |
|
1069 |
! ! |
|
1070 |
||
2711 | 1071 |
!InstrumentingCompiler::MethodInvocationInfoInAlreadyEnteredState methodsFor:'cleanup'! |
1072 |
||
1073 |
cleanInfoWithChange:withChange |
|
2967
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
1074 |
super cleanInfoWithChange:withChange. |
2711 | 1075 |
self changeClassTo:InstrumentingCompiler::MethodInvocationInfo. |
1076 |
||
1077 |
"Modified: / 20-07-2011 / 17:55:35 / cg" |
|
1078 |
"Created: / 24-08-2011 / 11:10:29 / cg" |
|
1079 |
! ! |
|
1080 |
||
2973
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
1081 |
!InstrumentingCompiler::MethodInvocationInfoInAlreadyEnteredState methodsFor:'instrumentation calls'! |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
1082 |
|
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
1083 |
entry:aContext |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
1084 |
"already been invoked - no notifications to send" |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
1085 |
|
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
1086 |
count := count + 1 |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
1087 |
! ! |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
1088 |
|
2715 | 1089 |
!InstrumentingCompiler::VariableAccessExecutionInfo class methodsFor:'documentation'! |
1090 |
||
1091 |
documentation |
|
1092 |
" |
|
1093 |
(sub)instances of me are updated by instrumented code when a variable is accessed |
|
1094 |
" |
|
1095 |
! ! |
|
1096 |
||
2976
6e3f4e2b20f8
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2973
diff
changeset
|
1097 |
!InstrumentingCompiler::VariableAccessExecutionInfo methodsFor:'testing'! |
6e3f4e2b20f8
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2973
diff
changeset
|
1098 |
|
6e3f4e2b20f8
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2973
diff
changeset
|
1099 |
isVariableAccessExecutionInfo |
6e3f4e2b20f8
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2973
diff
changeset
|
1100 |
^ true |
6e3f4e2b20f8
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2973
diff
changeset
|
1101 |
! ! |
6e3f4e2b20f8
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2973
diff
changeset
|
1102 |
|
2715 | 1103 |
!InstrumentingCompiler::BlockExecutionInfo class methodsFor:'documentation'! |
1104 |
||
1105 |
documentation |
|
1106 |
" |
|
1107 |
(sub)instances of me are updated by instrumented code when a block is executed. |
|
1108 |
" |
|
1109 |
! ! |
|
1110 |
||
2967
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
1111 |
!InstrumentingCompiler::BlockExecutionInfo methodsFor:'entry'! |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
1112 |
|
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
1113 |
changeClassToAlreadyEntered |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
1114 |
self class == InstrumentingCompiler::BlockExecutionInfo ifTrue:[ |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
1115 |
self changeClassTo: BlockExecutionInfoInAlreadyEnteredState |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
1116 |
]. |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
1117 |
! |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
1118 |
|
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
1119 |
changeClassToCoverageAndAlreadyEntered |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
1120 |
self class == InstrumentingCompiler::BlockExecutionInfo ifTrue:[ |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
1121 |
self changeClassTo: BlockExecutionInfoForCoverageInAlreadyEnteredState |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
1122 |
]. |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
1123 |
! ! |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
1124 |
|
2632 | 1125 |
!InstrumentingCompiler::BlockExecutionInfo methodsFor:'testing'! |
1126 |
||
1127 |
isBlockExecutionInfo |
|
1128 |
^ true |
|
1129 |
||
1130 |
"Created: / 07-08-2011 / 17:06:39 / cg" |
|
1131 |
! ! |
|
1132 |
||
2967
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
1133 |
!InstrumentingCompiler::BlockExecutionInfo::BlockExecutionInfoForCoverageInAlreadyEnteredState methodsFor:'cleanup'! |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
1134 |
|
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
1135 |
cleanInfoWithChange:withChange |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
1136 |
super cleanInfoWithChange:withChange. |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
1137 |
self changeClassTo:InstrumentingCompiler::BlockExecutionInfo. |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
1138 |
! ! |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
1139 |
|
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
1140 |
!InstrumentingCompiler::BlockExecutionInfo::BlockExecutionInfoForCoverageInAlreadyEnteredState methodsFor:'instrumentation probe calls'! |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
1141 |
|
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
1142 |
entry:callingContext |
2973
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
1143 |
"already been invoked - nothing to do" |
2967
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
1144 |
|
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
1145 |
^ self |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
1146 |
! ! |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
1147 |
|
2973
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
1148 |
!InstrumentingCompiler::BlockExecutionInfo::BlockExecutionInfoForCoverageInAlreadyEnteredState methodsFor:'queries'! |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
1149 |
|
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
1150 |
hasBeenExecuted |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
1151 |
^ true |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
1152 |
! ! |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
1153 |
|
2967
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
1154 |
!InstrumentingCompiler::BlockExecutionInfo::BlockExecutionInfoInAlreadyEnteredState methodsFor:'cleanup'! |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
1155 |
|
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
1156 |
cleanInfoWithChange:withChange |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
1157 |
super cleanInfoWithChange:withChange. |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
1158 |
self changeClassTo:InstrumentingCompiler::BlockExecutionInfo. |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
1159 |
! ! |
33ec78ee2aa9
tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents:
2960
diff
changeset
|
1160 |
|
2973
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
1161 |
!InstrumentingCompiler::BlockExecutionInfo::BlockExecutionInfoInAlreadyEnteredState methodsFor:'instrumentation probe calls'! |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
1162 |
|
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
1163 |
entry:callingContext |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
1164 |
"already been invoked - no update notification for browsers" |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
1165 |
|
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
1166 |
count := count + 1. |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
1167 |
! ! |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
1168 |
|
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
1169 |
!InstrumentingCompiler::BlockExecutionInfo::BlockExecutionInfoInAlreadyEnteredState methodsFor:'queries'! |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
1170 |
|
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
1171 |
hasBeenExecuted |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
1172 |
^ true |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
1173 |
! ! |
9de309c79d6c
class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents:
2972
diff
changeset
|
1174 |
|
2715 | 1175 |
!InstrumentingCompiler::ReadAccessExecutionInfo class methodsFor:'documentation'! |
1176 |
||
1177 |
documentation |
|
1178 |
" |
|
1179 |
(sub)instances of me are updated by instrumented code when a variable is read |
|
1180 |
" |
|
1181 |
! ! |
|
1182 |
||
1183 |
!InstrumentingCompiler::WriteAccessExecutionInfo class methodsFor:'documentation'! |
|
1184 |
||
1185 |
documentation |
|
1186 |
" |
|
1187 |
(sub)instances of me are updated by instrumented code when a variable is written |
|
1188 |
" |
|
1189 |
! ! |
|
1190 |
||
2357 | 1191 |
!InstrumentingCompiler class methodsFor:'documentation'! |
1192 |
||
2570 | 1193 |
version |
3862 | 1194 |
^ '$Header$' |
2570 | 1195 |
! |
1196 |
||
2357 | 1197 |
version_CVS |
3862 | 1198 |
^ '$Header$' |
2357 | 1199 |
! ! |
3192 | 1200 |