458 !InstrumentingCompiler::MethodInvocationInfo::MethodInvocationInfoPerReceiverClass methodsFor:'instrumentation calls'! |
470 !InstrumentingCompiler::MethodInvocationInfo::MethodInvocationInfoPerReceiverClass methodsFor:'instrumentation calls'! |
459 |
471 |
460 entry:aContext |
472 entry:aContext |
461 "invoked by instrumented compiled code, upon method entry" |
473 "invoked by instrumented compiled code, upon method entry" |
462 |
474 |
463 |sender sendingMethod infoPerMethod| |
475 |sender sendingMethod infoPerMethod viaPerform| |
464 |
476 |
465 sender := aContext sender methodHome. |
477 sender := aContext sender methodHome. |
466 sendingMethod := sender method. |
478 sendingMethod := sender method. |
|
479 viaPerform := false. |
467 |
480 |
468 (sendingMethod mclass == Object |
481 (sendingMethod mclass == Object |
469 and:[ sendingMethod selector startsWith:'perform:'] ) ifTrue:[ |
482 and:[ sendingMethod selector startsWith:'perform:'] ) ifTrue:[ |
470 Transcript showCR:('%1 [info]: skipping #perform' bindWith:self class nameWithoutPrefix). |
483 "/ Transcript showCR:('%1 [info]: skipping #perform' bindWith:self class nameWithoutPrefix). |
471 sender := sender sender methodHome. |
484 sender := sender sender methodHome. |
472 sendingMethod := sender method. |
485 sendingMethod := sender method. |
|
486 viaPerform := true. |
473 ]. |
487 ]. |
474 |
488 |
475 infoPerSendingMethod isNil ifTrue:[ |
489 infoPerSendingMethod isNil ifTrue:[ |
476 infoPerSendingMethod := IdentityDictionary new. |
490 infoPerSendingMethod := IdentityDictionary new. |
477 ]. |
491 ]. |
478 infoPerMethod := infoPerSendingMethod |
492 infoPerMethod := infoPerSendingMethod |
479 at:sendingMethod |
493 at:sendingMethod |
480 ifAbsentPut:[ MethodInvocationInfoPerSendingMethod new ]. |
494 ifAbsentPut:[ MethodInvocationInfoPerSendingMethod new ]. |
481 infoPerMethod entry:aContext |
495 |
482 |
496 infoPerMethod entry:aContext viaPerform:viaPerform |
483 "Modified: / 27-04-2010 / 12:13:08 / cg" |
497 |
|
498 "Modified: / 27-04-2010 / 18:19:04 / cg" |
484 ! ! |
499 ! ! |
485 |
500 |
486 !InstrumentingCompiler::MethodInvocationInfo::MethodInvocationInfoPerReceiverClass::MethodInvocationInfoPerSendingMethod methodsFor:'accessing'! |
501 !InstrumentingCompiler::MethodInvocationInfo::MethodInvocationInfoPerReceiverClass::MethodInvocationInfoPerSendingMethod methodsFor:'accessing'! |
|
502 |
|
503 invokedViaPerform |
|
504 ^ invokedViaPerform ? false |
|
505 |
|
506 "Created: / 27-04-2010 / 18:20:05 / cg" |
|
507 ! |
487 |
508 |
488 numberOfInvocations |
509 numberOfInvocations |
489 countPerSendersClass isNil ifTrue:[ ^ 0]. |
510 countPerSendersClass isNil ifTrue:[ ^ 0]. |
490 ^ countPerSendersClass inject:0 into:[:sumSoFar :count | sumSoFar + count] |
511 ^ countPerSendersClass inject:0 into:[:sumSoFar :count | sumSoFar + count] |
491 ! ! |
512 ! ! |
492 |
513 |
493 !InstrumentingCompiler::MethodInvocationInfo::MethodInvocationInfoPerReceiverClass::MethodInvocationInfoPerSendingMethod methodsFor:'instrumentation calls'! |
514 !InstrumentingCompiler::MethodInvocationInfo::MethodInvocationInfoPerReceiverClass::MethodInvocationInfoPerSendingMethod methodsFor:'instrumentation calls'! |
494 |
515 |
495 entry:aContext |
516 entry:aContext viaPerform:viaPerformBoolean |
496 "invoked by instrumented compiled code, upon method entry" |
517 "invoked by instrumented compiled code, upon method entry" |
497 |
518 |
498 |sendersClass count| |
519 |sendersClass count| |
499 |
520 |
500 sendersClass := aContext sender receiver class. |
521 sendersClass := aContext sender receiver class. |
501 |
522 |
502 countPerSendersClass isNil ifTrue:[ |
523 countPerSendersClass isNil ifTrue:[ |
503 countPerSendersClass := IdentityDictionary new. |
524 countPerSendersClass := IdentityDictionary new. |
504 ]. |
525 ]. |
505 count := countPerSendersClass at:sendersClass ifAbsentPut:0. |
526 count := countPerSendersClass at:sendersClass ifAbsentPut:0. |
506 countPerSendersClass at:sendersClass put:(count + 1) |
527 countPerSendersClass at:sendersClass put:(count + 1). |
|
528 viaPerformBoolean ifTrue:[ invokedViaPerform := true ]. |
|
529 |
|
530 "Created: / 27-04-2010 / 18:17:27 / cg" |
507 ! ! |
531 ! ! |
508 |
532 |
509 !InstrumentingCompiler class methodsFor:'documentation'! |
533 !InstrumentingCompiler class methodsFor:'documentation'! |
510 |
534 |
511 version_CVS |
535 version_CVS |
512 ^ '$Header: /cvs/stx/stx/libcomp/InstrumentingCompiler.st,v 1.2 2010-04-27 12:54:19 cg Exp $' |
536 ^ '$Header: /cvs/stx/stx/libcomp/InstrumentingCompiler.st,v 1.3 2010-04-27 17:04:32 cg Exp $' |
513 ! ! |
537 ! ! |