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