40 classVariableNames:'' |
40 classVariableNames:'' |
41 poolDictionaries:'' |
41 poolDictionaries:'' |
42 privateIn:InstrumentingCompiler |
42 privateIn:InstrumentingCompiler |
43 ! |
43 ! |
44 |
44 |
|
45 InstrumentingCompiler::StatementExecutionInfo subclass:#VariableAccessExecutionInfo |
|
46 instanceVariableNames:'' |
|
47 classVariableNames:'' |
|
48 poolDictionaries:'' |
|
49 privateIn:InstrumentingCompiler |
|
50 ! |
|
51 |
45 InstrumentingCompiler::StatementExecutionInfo subclass:#BlockExecutionInfo |
52 InstrumentingCompiler::StatementExecutionInfo subclass:#BlockExecutionInfo |
46 instanceVariableNames:'endPosition' |
53 instanceVariableNames:'endPosition' |
|
54 classVariableNames:'' |
|
55 poolDictionaries:'' |
|
56 privateIn:InstrumentingCompiler |
|
57 ! |
|
58 |
|
59 InstrumentingCompiler::VariableAccessExecutionInfo subclass:#ReadAccessExecutionInfo |
|
60 instanceVariableNames:'' |
|
61 classVariableNames:'' |
|
62 poolDictionaries:'' |
|
63 privateIn:InstrumentingCompiler |
|
64 ! |
|
65 |
|
66 InstrumentingCompiler::VariableAccessExecutionInfo subclass:#WriteAccessExecutionInfo |
|
67 instanceVariableNames:'' |
47 classVariableNames:'' |
68 classVariableNames:'' |
48 poolDictionaries:'' |
69 poolDictionaries:'' |
49 privateIn:InstrumentingCompiler |
70 privateIn:InstrumentingCompiler |
50 ! |
71 ! |
51 |
72 |
235 ^ countCode |
256 ^ countCode |
236 |
257 |
237 "Modified: / 07-08-2011 / 15:32:45 / cg" |
258 "Modified: / 07-08-2011 / 15:32:45 / cg" |
238 ! ! |
259 ! ! |
239 |
260 |
240 !InstrumentingCompiler methodsFor:'code generation-hooks'! |
261 !InstrumentingCompiler methodsFor:'code generation hooks'! |
|
262 |
|
263 assignmentRewriteHookFor:anAssignmentNode |
|
264 "invoked whenever an assignment node has been generated" |
|
265 |
|
266 ^ anAssignmentNode |
|
267 |
|
268 "Created: / 30-09-2011 / 12:28:09 / cg" |
|
269 ! |
241 |
270 |
242 blockNodeRewriteHookFor:aBlockNode |
271 blockNodeRewriteHookFor:aBlockNode |
|
272 "invoked whenever a block node has been generated" |
|
273 |
243 "/ add a counter for the block |
274 "/ add a counter for the block |
244 self addBlockCounterTo:aBlockNode. |
275 self addBlockCounterTo:aBlockNode. |
245 ^ aBlockNode |
276 ^ aBlockNode |
246 |
277 |
247 "Created: / 28-04-2010 / 14:21:27 / cg" |
278 "Created: / 28-04-2010 / 14:21:27 / cg" |
248 ! |
279 ! |
249 |
280 |
250 messageNodeRewriteHookFor:aMessageNode |
281 messageNodeRewriteHookFor:aMessageNode |
|
282 "invoked whenever a message send node has been generated" |
|
283 |
251 "/ see blockNodeRewriter... |
284 "/ see blockNodeRewriter... |
252 |
285 |
253 "/ "/ argument could be a constantNode (due to contant-folding optimization) |
286 "/ "/ argument could be a constantNode (due to contant-folding optimization) |
254 "/ aMessageNode isConstant ifTrue:[^ aMessageNode]. |
287 "/ aMessageNode isConstant ifTrue:[^ aMessageNode]. |
255 "/ ( |
288 "/ ( |
266 "/ ]. |
299 "/ ]. |
267 ^ aMessageNode |
300 ^ aMessageNode |
268 |
301 |
269 "Created: / 27-04-2010 / 11:43:22 / cg" |
302 "Created: / 27-04-2010 / 11:43:22 / cg" |
270 "Modified: / 28-04-2010 / 14:22:05 / cg" |
303 "Modified: / 28-04-2010 / 14:22:05 / cg" |
|
304 "Modified (comment): / 30-09-2011 / 12:16:56 / cg" |
271 ! |
305 ! |
272 |
306 |
273 startCodeGenerationHookOn:codeStream |
307 startCodeGenerationHookOn:codeStream |
|
308 "invoked before code is generated" |
|
309 |
274 methodEntryInfo := self methodInvocationInfoInstance. |
310 methodEntryInfo := self methodInvocationInfoInstance. |
275 |
311 |
276 (StatementNode |
312 (StatementNode |
277 expression:(MessageNode |
313 expression:(MessageNode |
278 receiver:(ConstantNode value:methodEntryInfo) |
314 receiver:(ConstantNode value:methodEntryInfo) |
279 selector:#entry: |
315 selector:#entry: |
280 arg:(VariableNode type:#ThisContext context:contextToEvaluateIn))) |
316 arg:(VariableNode type:#ThisContext context:contextToEvaluateIn))) |
281 codeForSideEffectOn:codeStream inBlock:nil for:self. |
317 codeForSideEffectOn:codeStream inBlock:nil for:self. |
282 |
318 |
283 "Modified: / 07-08-2011 / 15:34:09 / cg" |
319 "Modified: / 07-08-2011 / 15:34:09 / cg" |
|
320 "Modified (comment): / 30-09-2011 / 12:16:05 / cg" |
284 ! |
321 ! |
285 |
322 |
286 statementListRewriteHookFor:firstStatement |
323 statementListRewriteHookFor:firstStatement |
|
324 "invoked whenever a statement list node has been generated" |
|
325 |
287 "/ care for blocks which return... |
326 "/ care for blocks which return... |
288 |thisStatement prevStatement countStatement mustInsertExecutionInfo| |
327 |thisStatement prevStatement countStatement mustInsertExecutionInfo| |
289 |
328 |
290 mustInsertExecutionInfo := false. |
329 mustInsertExecutionInfo := false. |
291 prevStatement := nil. |
330 prevStatement := nil. |
312 ] |
351 ] |
313 ]. |
352 ]. |
314 prevStatement := thisStatement. |
353 prevStatement := thisStatement. |
315 thisStatement := thisStatement nextStatement. |
354 thisStatement := thisStatement nextStatement. |
316 ]. |
355 ]. |
|
356 |
|
357 "Modified (comment): / 30-09-2011 / 12:15:52 / cg" |
|
358 ! |
|
359 |
|
360 variableReadRewriteHookFor:aVariableNode |
|
361 "invoked whenever a variable access node has been generated" |
|
362 |
|
363 ^ aVariableNode |
|
364 |
|
365 "Created: / 30-09-2011 / 12:27:47 / cg" |
317 ! ! |
366 ! ! |
318 |
367 |
319 !InstrumentingCompiler methodsFor:'redefinable'! |
368 !InstrumentingCompiler methodsFor:'redefinable'! |
320 |
369 |
321 blockExecutionInfoInstance |
370 blockExecutionInfoInstance |
341 and called at execution time with entry:" |
390 and called at execution time with entry:" |
342 |
391 |
343 ^ StatementExecutionInfo new cleanInfoWithChange:false. |
392 ^ StatementExecutionInfo new cleanInfoWithChange:false. |
344 |
393 |
345 "Created: / 07-08-2011 / 15:32:36 / cg" |
394 "Created: / 07-08-2011 / 15:32:36 / cg" |
|
395 ! ! |
|
396 |
|
397 !InstrumentingCompiler::StatementExecutionInfo class methodsFor:'documentation'! |
|
398 |
|
399 documentation |
|
400 " |
|
401 (sub)instances of me are updated by instrumented code when statements are executed. |
|
402 " |
346 ! ! |
403 ! ! |
347 |
404 |
348 !InstrumentingCompiler::StatementExecutionInfo methodsFor:'accessing'! |
405 !InstrumentingCompiler::StatementExecutionInfo methodsFor:'accessing'! |
349 |
406 |
350 callCount |
407 callCount |
706 |
763 |
707 "Modified: / 20-07-2011 / 17:55:35 / cg" |
764 "Modified: / 20-07-2011 / 17:55:35 / cg" |
708 "Created: / 24-08-2011 / 11:10:29 / cg" |
765 "Created: / 24-08-2011 / 11:10:29 / cg" |
709 ! ! |
766 ! ! |
710 |
767 |
|
768 !InstrumentingCompiler::VariableAccessExecutionInfo class methodsFor:'documentation'! |
|
769 |
|
770 documentation |
|
771 " |
|
772 (sub)instances of me are updated by instrumented code when a variable is accessed |
|
773 " |
|
774 ! ! |
|
775 |
|
776 !InstrumentingCompiler::BlockExecutionInfo class methodsFor:'documentation'! |
|
777 |
|
778 documentation |
|
779 " |
|
780 (sub)instances of me are updated by instrumented code when a block is executed. |
|
781 " |
|
782 ! ! |
|
783 |
711 !InstrumentingCompiler::BlockExecutionInfo methodsFor:'accessing'! |
784 !InstrumentingCompiler::BlockExecutionInfo methodsFor:'accessing'! |
712 |
785 |
713 endPosition |
786 endPosition |
714 ^ endPosition |
787 ^ endPosition |
715 |
788 |
741 ^ true |
814 ^ true |
742 |
815 |
743 "Created: / 07-08-2011 / 17:06:39 / cg" |
816 "Created: / 07-08-2011 / 17:06:39 / cg" |
744 ! ! |
817 ! ! |
745 |
818 |
|
819 !InstrumentingCompiler::ReadAccessExecutionInfo class methodsFor:'documentation'! |
|
820 |
|
821 documentation |
|
822 " |
|
823 (sub)instances of me are updated by instrumented code when a variable is read |
|
824 " |
|
825 ! ! |
|
826 |
|
827 !InstrumentingCompiler::WriteAccessExecutionInfo class methodsFor:'documentation'! |
|
828 |
|
829 documentation |
|
830 " |
|
831 (sub)instances of me are updated by instrumented code when a variable is written |
|
832 " |
|
833 ! ! |
|
834 |
746 !InstrumentingCompiler class methodsFor:'documentation'! |
835 !InstrumentingCompiler class methodsFor:'documentation'! |
747 |
836 |
748 version |
837 version |
749 ^ '$Header: /cvs/stx/stx/libcomp/InstrumentingCompiler.st,v 1.16 2011-09-30 09:59:55 cg Exp $' |
838 ^ '$Header: /cvs/stx/stx/libcomp/InstrumentingCompiler.st,v 1.17 2011-09-30 10:29:09 cg Exp $' |
750 ! |
839 ! |
751 |
840 |
752 version_CVS |
841 version_CVS |
753 ^ '$Header: /cvs/stx/stx/libcomp/InstrumentingCompiler.st,v 1.16 2011-09-30 09:59:55 cg Exp $' |
842 ^ '$Header: /cvs/stx/stx/libcomp/InstrumentingCompiler.st,v 1.17 2011-09-30 10:29:09 cg Exp $' |
754 ! ! |
843 ! ! |