InstrumentingCompiler.st
changeset 2569 e9fcb54ac3d4
parent 2528 e57cc8caf6f9
child 2570 f0b8fc6cdabb
--- a/InstrumentingCompiler.st	Wed Jul 20 17:40:45 2011 +0200
+++ b/InstrumentingCompiler.st	Wed Jul 20 17:55:15 2011 +0200
@@ -381,7 +381,10 @@
 !InstrumentingCompiler::StatementExecutionInfo methodsFor:'cleanup'!
 
 cleanInfo
-    count := 0
+    count := 0.
+    Smalltalk changed:#methodTrap with:owningMethod.
+
+    "Modified: / 20-07-2011 / 17:54:27 / cg"
 ! !
 
 !InstrumentingCompiler::StatementExecutionInfo methodsFor:'instrumentation calls'!
@@ -398,13 +401,13 @@
         p := Processor activeProcess.
         (p environmentAt:#inInstrument ifAbsent:false) ifFalse:[
             p withThreadVariable:#inInstrument boundTo:true do:[
-                owningMethod changed:#methodInfo
+                Smalltalk changed:#methodTrap with:owningMethod.
             ].
         ]
     ].
 
     "Created: / 23-06-2006 / 13:31:16 / cg"
-    "Modified: / 05-07-2011 / 13:35:25 / cg"
+    "Modified: / 20-07-2011 / 17:53:40 / cg"
 ! !
 
 !InstrumentingCompiler::StatementExecutionInfo methodsFor:'queries'!
@@ -483,6 +486,9 @@
 
 cleanInfo
     infoPerReceiverClass := nil.
+    Smalltalk changed:#methodTrap with:owningMethod.
+
+    "Modified: / 20-07-2011 / 17:54:34 / cg"
 ! !
 
 !InstrumentingCompiler::MethodInvocationInfo methodsFor:'instrumentation probe calls'!
@@ -490,22 +496,30 @@
 entry:aContext
     "invoked by instrumented compiled code, upon method entry"
 
-    |p receiversClass infoPerReceiver|
+    |p receiversClass infoPerReceiver firstEntry|
 
     p := Processor activeProcess.
     (p environmentAt:#inInstrument ifAbsent:false) ifTrue:[^ self].
+
     p withThreadVariable:#inInstrument boundTo:true do:[
         receiversClass := aContext receiver class.
         infoPerReceiverClass isNil ifTrue:[
             infoPerReceiverClass := IdentityDictionary new.
         ].
+        firstEntry := false.
         infoPerReceiver := infoPerReceiverClass 
                             at:receiversClass 
-                            ifAbsentPut:[ MethodInvocationInfoPerReceiverClass new ].
-        infoPerReceiver entry:aContext
+                            ifAbsentPut:[ firstEntry := true.
+                                          MethodInvocationInfoPerReceiverClass new ].
+        infoPerReceiver entry:aContext.
+
+        "/ the very first time, send a change notification
+        firstEntry ifTrue:[
+            Smalltalk changed:#methodTrap with:owningMethod.
+        ]
     ]
 
-    "Modified: / 05-07-2011 / 13:35:42 / cg"
+    "Modified: / 20-07-2011 / 17:54:08 / cg"
 ! !
 
 !InstrumentingCompiler::MethodInvocationInfo::MethodInvocationInfoPerReceiverClass methodsFor:'accessing'!
@@ -586,18 +600,17 @@
     ].
     sender isNil ifTrue:[
         ^ self.
-    ] ifFalse:[
-        sendingMethod := sender method.
-        sendingMethod isNil ifTrue:[^ self].
+    ].
+    sendingMethod := sender method.
+    sendingMethod isNil ifTrue:[^ self].
 
-        viaPerform := false.
-        (sendingMethod mclass == Object 
-        and:[ sendingMethod selector startsWith:'perform:'] ) ifTrue:[
-            "/ Transcript showCR:('%1 [info]: skipping #perform' bindWith:self class nameWithoutPrefix).
-            sender := sender sender methodHome.
-            sendingMethod := sender method.
-            viaPerform := true.
-        ].
+    viaPerform := false.
+    (sendingMethod mclass == Object 
+    and:[ sendingMethod selector startsWith:'perform:'] ) ifTrue:[
+        "/ Transcript showCR:('%1 [info]: skipping #perform' bindWith:self class nameWithoutPrefix).
+        sender := sender sender methodHome.
+        sendingMethod := sender method.
+        viaPerform := true.
     ].
 
     infoPerSendingMethod isNil ifTrue:[
@@ -609,7 +622,7 @@
 
     infoPerMethod entry:aContext viaPerform:viaPerform
 
-    "Modified: / 28-04-2010 / 16:09:04 / cg"
+    "Modified: / 20-07-2011 / 17:26:31 / cg"
 ! !
 
 !InstrumentingCompiler::MethodInvocationInfo::MethodInvocationInfoPerReceiverClass::MethodInvocationInfoPerSendingMethod methodsFor:'accessing'!
@@ -662,5 +675,5 @@
 !InstrumentingCompiler class methodsFor:'documentation'!
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libcomp/InstrumentingCompiler.st,v 1.7 2011-07-05 11:36:04 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/InstrumentingCompiler.st,v 1.8 2011-07-20 15:55:15 cg Exp $'
 ! !