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