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