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