added: #blockNodeRewriteHookFor:
changed:
#addBlockCounterTo:
#messageNodeRewriteHookFor:
--- a/InstrumentingCompiler.st Fri Apr 30 11:58:03 2010 +0200
+++ b/InstrumentingCompiler.st Fri Apr 30 11:59:44 2010 +0200
@@ -15,7 +15,7 @@
!
InstrumentingCompiler::InstrumentationInfo subclass:#BlockExecutionInfo
- instanceVariableNames:'characterPosition count'
+ instanceVariableNames:'startPosition endPosition count'
classVariableNames:''
poolDictionaries:''
privateIn:InstrumentingCompiler
@@ -140,6 +140,7 @@
blockInvocationInfo := OrderedCollection new.
].
blockEntryInfo := BlockExecutionInfo new cleanInfo.
+ blockEntryInfo startPosition:aBlockNode startPosition endPosition:aBlockNode endPosition.
blockInvocationInfo add:blockEntryInfo.
countCode :=
@@ -157,7 +158,7 @@
aBlockNode statements:countCode.
].
- "Modified: / 27-04-2010 / 14:52:38 / cg"
+ "Modified: / 28-04-2010 / 15:55:30 / cg"
!
addBlockCountersToEachBlockIn:aCollection
@@ -193,25 +194,35 @@
!InstrumentingCompiler methodsFor:'code generation-hooks'!
+blockNodeRewriteHookFor:aBlockNode
+ "/ add a counter for the block
+ self addBlockCounterTo:aBlockNode.
+ ^ aBlockNode
+
+ "Created: / 28-04-2010 / 14:21:27 / cg"
+!
+
messageNodeRewriteHookFor:aMessageNode
- "/ argument could be a constantNode (due to contant-folding optimization)
- aMessageNode isConstant ifTrue:[^ aMessageNode].
- (
- #(
- ifTrue:
- ifFalse:
- ifTrue:ifFalse:
- ifFalse:ifTrue:
- )
- includes:aMessageNode selector
- ) ifTrue:[
- "/ add a counter for the block
- self addBlockCountersToEachBlockIn:(aMessageNode arguments)
- ].
+"/ see blockNodeRewriter...
+
+"/ "/ argument could be a constantNode (due to contant-folding optimization)
+"/ aMessageNode isConstant ifTrue:[^ aMessageNode].
+"/ (
+"/ #(
+"/ ifTrue:
+"/ ifFalse:
+"/ ifTrue:ifFalse:
+"/ ifFalse:ifTrue:
+"/ )
+"/ includes:aMessageNode selector
+"/ ) ifTrue:[
+"/ "/ add a counter for the block
+"/ self addBlockCountersToEachBlockIn:(aMessageNode arguments)
+"/ ].
^ aMessageNode
"Created: / 27-04-2010 / 11:43:22 / cg"
- "Modified: / 27-04-2010 / 12:45:27 / cg"
+ "Modified: / 28-04-2010 / 14:22:05 / cg"
!
startCodeGenerationHookOn:codeStream
@@ -277,21 +288,42 @@
!
characterPosition
- ^ characterPosition
+ ^ startPosition
"Created: / 23-06-2006 / 13:31:19 / cg"
+ "Modified: / 28-04-2010 / 15:54:24 / cg"
!
characterPosition:something
- characterPosition := something.
+ startPosition := something.
"Created: / 23-06-2006 / 13:31:19 / cg"
+ "Modified: / 28-04-2010 / 15:54:30 / cg"
!
count
^ count
"Created: / 23-06-2006 / 13:31:28 / cg"
+!
+
+endPosition
+ ^ endPosition
+
+ "Created: / 28-04-2010 / 15:57:14 / cg"
+!
+
+startPosition
+ ^ startPosition
+
+ "Created: / 28-04-2010 / 15:54:26 / cg"
+!
+
+startPosition:startArg endPosition:endArg
+ startPosition := startArg.
+ endPosition := endArg.
+
+ "Created: / 28-04-2010 / 15:54:47 / cg"
! !
!InstrumentingCompiler::BlockExecutionInfo methodsFor:'cleanup'!
@@ -316,6 +348,14 @@
"Modified: / 27-04-2010 / 14:03:29 / cg"
! !
+!InstrumentingCompiler::BlockExecutionInfo methodsFor:'queries'!
+
+hasBeenExecuted
+ ^ count > 0
+
+ "Created: / 28-04-2010 / 14:39:46 / cg"
+! !
+
!InstrumentingCompiler::MethodInvocationInfo methodsFor:'accessing'!
callingMethodsDo:aBlock
@@ -475,15 +515,19 @@
|sender sendingMethod infoPerMethod viaPerform|
sender := aContext sender methodHome.
- sendingMethod := sender method.
- viaPerform := false.
+ sender isNil ifTrue:[
+ ^ self.
+ ] ifFalse:[
+ sendingMethod := sender method.
+ 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.
+ (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:[
@@ -495,7 +539,7 @@
infoPerMethod entry:aContext viaPerform:viaPerform
- "Modified: / 27-04-2010 / 18:19:04 / cg"
+ "Modified: / 28-04-2010 / 16:09:04 / cg"
! !
!InstrumentingCompiler::MethodInvocationInfo::MethodInvocationInfoPerReceiverClass::MethodInvocationInfoPerSendingMethod methodsFor:'accessing'!
@@ -533,5 +577,5 @@
!InstrumentingCompiler class methodsFor:'documentation'!
version_CVS
- ^ '$Header: /cvs/stx/stx/libcomp/InstrumentingCompiler.st,v 1.3 2010-04-27 17:04:32 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libcomp/InstrumentingCompiler.st,v 1.4 2010-04-30 09:59:44 cg Exp $'
! !