equal
deleted
inserted
replaced
178 ! ! |
178 ! ! |
179 |
179 |
180 !InstrumentingCompiler methodsFor:'code generation helpers'! |
180 !InstrumentingCompiler methodsFor:'code generation helpers'! |
181 |
181 |
182 addBlockCounterTo:aBlockNode |
182 addBlockCounterTo:aBlockNode |
|
183 "called by the compiler to instrument a block node" |
|
184 |
183 |countCode blockEntryInfo| |
185 |countCode blockEntryInfo| |
184 |
186 |
185 blockInvocationInfo isNil ifTrue:[ |
187 blockInvocationInfo isNil ifTrue:[ |
186 blockInvocationInfo := OrderedCollection new. |
188 blockInvocationInfo := OrderedCollection new. |
187 ]. |
189 ]. |
210 |
212 |
211 "Modified: / 21-08-2011 / 16:02:52 / cg" |
213 "Modified: / 21-08-2011 / 16:02:52 / cg" |
212 ! |
214 ! |
213 |
215 |
214 addBlockCountersToEachBlockIn:aCollection |
216 addBlockCountersToEachBlockIn:aCollection |
|
217 "called by the compiler to instrument a collection of block nodes" |
|
218 |
215 aCollection do:[:eachNode | |
219 aCollection do:[:eachNode | |
216 eachNode isBlockNode ifTrue:[ |
220 eachNode isBlockNode ifTrue:[ |
217 self addBlockCounterTo:eachNode |
221 self addBlockCounterTo:eachNode |
218 ] |
222 ] |
219 ]. |
223 ]. |
220 |
224 |
221 "Created: / 27-04-2010 / 11:47:56 / cg" |
225 "Created: / 27-04-2010 / 11:47:56 / cg" |
222 ! |
226 ! |
223 |
227 |
224 createMethod |
228 createMethod |
|
229 "called by the compiler to instatiate a new method instance" |
|
230 |
225 method := super createMethod. |
231 method := super createMethod. |
226 |
232 |
227 methodEntryInfo notNil ifTrue:[ |
233 methodEntryInfo notNil ifTrue:[ |
228 methodEntryInfo owningMethod:method |
234 methodEntryInfo owningMethod:method |
229 ]. |
235 ]. |
235 |
241 |
236 "Modified: / 27-04-2010 / 14:04:50 / cg" |
242 "Modified: / 27-04-2010 / 14:04:50 / cg" |
237 ! |
243 ! |
238 |
244 |
239 methodClass |
245 methodClass |
|
246 "called by the compiler to ask for the method instance's class" |
|
247 |
240 ^ InstrumentedMethod |
248 ^ InstrumentedMethod |
241 |
249 |
242 "Created: / 27-04-2010 / 12:17:22 / cg" |
250 "Created: / 27-04-2010 / 12:17:22 / cg" |
243 ! |
251 ! |
244 |
252 |
245 statementCounterBefore:aStatementNode |
253 statementCounterBefore:aStatementNode |
|
254 "called by the compiler to instrument a statement node (head of a basic block)" |
|
255 |
246 |countCode statementEntryInfo| |
256 |countCode statementEntryInfo| |
247 |
257 |
248 blockInvocationInfo isNil ifTrue:[ |
258 blockInvocationInfo isNil ifTrue:[ |
249 blockInvocationInfo := OrderedCollection new. |
259 blockInvocationInfo := OrderedCollection new. |
250 ]. |
260 ]. |
543 ^ infoPerReceiverClass do:[:eachInfo | eachInfo invokingMethodsDo:aBlock]. |
553 ^ infoPerReceiverClass do:[:eachInfo | eachInfo invokingMethodsDo:aBlock]. |
544 ! |
554 ! |
545 |
555 |
546 numberOfInvocations |
556 numberOfInvocations |
547 infoPerReceiverClass isNil ifTrue:[ ^ 0]. |
557 infoPerReceiverClass isNil ifTrue:[ ^ 0]. |
|
558 infoPerReceiverClass == true ifTrue:[ ^ 0]. |
548 ^ infoPerReceiverClass inject:0 into:[:sumSoFar :info | sumSoFar + info numberOfInvocations] |
559 ^ infoPerReceiverClass inject:0 into:[:sumSoFar :info | sumSoFar + info numberOfInvocations] |
549 ! |
560 ! |
550 |
561 |
551 numberOfInvocationsFromExternalOf:aClass |
562 numberOfInvocationsFromExternalOf:aClass |
552 |sum| |
563 |sum| |
882 ! ! |
893 ! ! |
883 |
894 |
884 !InstrumentingCompiler class methodsFor:'documentation'! |
895 !InstrumentingCompiler class methodsFor:'documentation'! |
885 |
896 |
886 version |
897 version |
887 ^ '$Header: /cvs/stx/stx/libcomp/InstrumentingCompiler.st,v 1.22 2012-10-20 18:22:13 cg Exp $' |
898 ^ '$Header: /cvs/stx/stx/libcomp/InstrumentingCompiler.st,v 1.23 2012-10-20 19:17:14 cg Exp $' |
888 ! |
899 ! |
889 |
900 |
890 version_CVS |
901 version_CVS |
891 ^ '$Header: /cvs/stx/stx/libcomp/InstrumentingCompiler.st,v 1.22 2012-10-20 18:22:13 cg Exp $' |
902 ^ '$Header: /cvs/stx/stx/libcomp/InstrumentingCompiler.st,v 1.23 2012-10-20 19:17:14 cg Exp $' |
892 ! ! |
903 ! ! |