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