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