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