InstrumentingCompiler.st
changeset 2973 9de309c79d6c
parent 2972 204f077ff866
child 2976 6e3f4e2b20f8
--- a/InstrumentingCompiler.st	Wed Nov 07 14:19:12 2012 +0100
+++ b/InstrumentingCompiler.st	Wed Nov 07 23:18:08 2012 +0100
@@ -29,7 +29,7 @@
 !
 
 InstrumentationInfo subclass:#MethodInvocationInfo
-	instanceVariableNames:'recursiveEntry infoPerReceiverClass'
+	instanceVariableNames:'count recursiveEntry infoPerReceiverClass'
 	classVariableNames:''
 	poolDictionaries:''
 	privateIn:InstrumentingCompiler
@@ -497,6 +497,8 @@
 !
 
 count
+    "how often have I been called"
+
     ^ count
 
     "Created: / 23-06-2006 / 13:31:28 / cg"
@@ -526,18 +528,6 @@
 
 !InstrumentingCompiler::StatementExecutionInfo methodsFor:'instrumentation calls'!
 
-changeClassToAlreadyEntered
-    self class == InstrumentingCompiler::StatementExecutionInfo ifTrue:[
-        self changeClassTo: StatementExecutionInfoInAlreadyEnteredState
-    ].
-!
-
-changeClassToCoverageAndAlreadyEntered
-    self class == InstrumentingCompiler::StatementExecutionInfo ifTrue:[
-        self changeClassTo: StatementExecutionInfoForCoverageInAlreadyEnteredState
-    ].
-!
-
 entry:callingContext
     "invoked by instrumented code;
      called whenever the block/statment is entered"
@@ -574,6 +564,20 @@
     "Modified: / 23-08-2011 / 21:29:39 / cg"
 ! !
 
+!InstrumentingCompiler::StatementExecutionInfo methodsFor:'private'!
+
+changeClassToAlreadyEntered
+    self class == InstrumentingCompiler::StatementExecutionInfo ifTrue:[
+        self changeClassTo: StatementExecutionInfoInAlreadyEnteredState
+    ].
+!
+
+changeClassToCoverageAndAlreadyEntered
+    self class == InstrumentingCompiler::StatementExecutionInfo ifTrue:[
+        self changeClassTo: StatementExecutionInfoForCoverageInAlreadyEnteredState
+    ].
+! !
+
 !InstrumentingCompiler::StatementExecutionInfo methodsFor:'queries'!
 
 hasBeenExecuted
@@ -605,6 +609,12 @@
     ^ self
 ! !
 
+!InstrumentingCompiler::StatementExecutionInfo::StatementExecutionInfoForCoverageInAlreadyEnteredState methodsFor:'queries'!
+
+hasBeenExecuted
+    ^ true
+! !
+
 !InstrumentingCompiler::StatementExecutionInfo::StatementExecutionInfoInAlreadyEnteredState methodsFor:'cleanup'!
 
 cleanInfoWithChange:withChange
@@ -615,9 +625,9 @@
 !InstrumentingCompiler::StatementExecutionInfo::StatementExecutionInfoInAlreadyEnteredState methodsFor:'instrumentation calls'!
 
 entry:callingContext
-    "already been invoked - nothing to record"
+    "already been invoked - no update notifications to browsers"
 
-    ^ self
+    count := count + 1.
 ! !
 
 !InstrumentingCompiler::MethodInvocationInfo methodsFor:'accessing'!
@@ -632,6 +642,12 @@
     ]
 !
 
+count
+    "how often have I been called"
+
+    ^ count
+!
+
 hasBeenCalled
     ^ infoPerReceiverClass notEmptyOrNil
 
@@ -699,19 +715,7 @@
     "Created: / 20-07-2011 / 18:59:22 / cg"
 ! !
 
-!InstrumentingCompiler::MethodInvocationInfo methodsFor:'instrumentation probe calls'!
-
-changeClassToAlreadyEntered
-    self class == InstrumentingCompiler::MethodInvocationInfo ifTrue:[
-        self changeClassTo: InstrumentingCompiler::MethodInvocationInfoInAlreadyEnteredState
-    ].
-!
-
-changeClassToCoverageAndAlreadyEntered
-    self class == InstrumentingCompiler::MethodInvocationInfo ifTrue:[
-        self changeClassTo: InstrumentingCompiler::MethodInvocationInfoForCoverageInAlreadyEnteredState
-    ].
-!
+!InstrumentingCompiler::MethodInvocationInfo methodsFor:'instrumentation calls'!
 
 entry:aContext
     "invoked by instrumented compiled code, upon method entry"
@@ -730,6 +734,7 @@
     context isNil ifTrue:[recursiveEntry := false. ^ self].
     context enabledAndNotInInstrumentedCode ifFalse:[recursiveEntry := false. ^ self].
 
+    count := (count ? 0) + 1.
     [
         context inInstrumentedCode:true.
 
@@ -774,6 +779,20 @@
     "Modified (comment): / 26-10-2012 / 12:59:44 / cg"
 ! !
 
+!InstrumentingCompiler::MethodInvocationInfo methodsFor:'private'!
+
+changeClassToAlreadyEntered
+    self class == InstrumentingCompiler::MethodInvocationInfo ifTrue:[
+        self changeClassTo: InstrumentingCompiler::MethodInvocationInfoInAlreadyEnteredState
+    ].
+!
+
+changeClassToCoverageAndAlreadyEntered
+    self class == InstrumentingCompiler::MethodInvocationInfo ifTrue:[
+        self changeClassTo: InstrumentingCompiler::MethodInvocationInfoForCoverageInAlreadyEnteredState
+    ].
+! !
+
 !InstrumentingCompiler::MethodInvocationInfo methodsFor:'testing'!
 
 isMethodInvocationInfo
@@ -924,7 +943,7 @@
     self changeClassTo:InstrumentingCompiler::MethodInvocationInfo.
 ! !
 
-!InstrumentingCompiler::MethodInvocationInfoForCoverageInAlreadyEnteredState methodsFor:'instrumentation probe calls'!
+!InstrumentingCompiler::MethodInvocationInfoForCoverageInAlreadyEnteredState methodsFor:'instrumentation calls'!
 
 entry:aContext
     "already been invoked - nothing to record"
@@ -942,6 +961,14 @@
     "Created: / 24-08-2011 / 11:10:29 / cg"
 ! !
 
+!InstrumentingCompiler::MethodInvocationInfoInAlreadyEnteredState methodsFor:'instrumentation calls'!
+
+entry:aContext
+    "already been invoked - no notifications to send"
+
+    count := count + 1
+! !
+
 !InstrumentingCompiler::VariableAccessExecutionInfo class methodsFor:'documentation'!
 
 documentation
@@ -1017,11 +1044,17 @@
 !InstrumentingCompiler::BlockExecutionInfo::BlockExecutionInfoForCoverageInAlreadyEnteredState methodsFor:'instrumentation probe calls'!
 
 entry:callingContext
-    "already been invoked - nothing to record"
+    "already been invoked - nothing to do"
 
     ^ self
 ! !
 
+!InstrumentingCompiler::BlockExecutionInfo::BlockExecutionInfoForCoverageInAlreadyEnteredState methodsFor:'queries'!
+
+hasBeenExecuted
+    ^ true
+! !
+
 !InstrumentingCompiler::BlockExecutionInfo::BlockExecutionInfoInAlreadyEnteredState methodsFor:'cleanup'!
 
 cleanInfoWithChange:withChange
@@ -1029,6 +1062,20 @@
     self changeClassTo:InstrumentingCompiler::BlockExecutionInfo.
 ! !
 
+!InstrumentingCompiler::BlockExecutionInfo::BlockExecutionInfoInAlreadyEnteredState methodsFor:'instrumentation probe calls'!
+
+entry:callingContext
+    "already been invoked - no update notification for browsers"
+
+    count := count + 1.
+! !
+
+!InstrumentingCompiler::BlockExecutionInfo::BlockExecutionInfoInAlreadyEnteredState methodsFor:'queries'!
+
+hasBeenExecuted
+    ^ true
+! !
+
 !InstrumentingCompiler::ReadAccessExecutionInfo class methodsFor:'documentation'!
 
 documentation
@@ -1048,9 +1095,9 @@
 !InstrumentingCompiler class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/InstrumentingCompiler.st,v 1.27 2012-11-07 13:19:12 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/InstrumentingCompiler.st,v 1.28 2012-11-07 22:18:08 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libcomp/InstrumentingCompiler.st,v 1.27 2012-11-07 13:19:12 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/InstrumentingCompiler.st,v 1.28 2012-11-07 22:18:08 cg Exp $'
 ! !