InstrumentingCompiler.st
changeset 2571 b441a3fc0ce6
parent 2570 f0b8fc6cdabb
child 2632 734313b470d3
equal deleted inserted replaced
2570:f0b8fc6cdabb 2571:b441a3fc0ce6
   144     |countCode blockEntryInfo|
   144     |countCode blockEntryInfo|
   145 
   145 
   146     blockInvocationInfo isNil ifTrue:[
   146     blockInvocationInfo isNil ifTrue:[
   147         blockInvocationInfo := OrderedCollection new.
   147         blockInvocationInfo := OrderedCollection new.
   148     ].
   148     ].
   149     blockEntryInfo := BlockExecutionInfo new cleanInfo.
   149     blockEntryInfo := BlockExecutionInfo new cleanInfoWithChange:false.
   150     blockEntryInfo startPosition:aBlockNode startPosition endPosition:aBlockNode endPosition.
   150     blockEntryInfo startPosition:aBlockNode startPosition endPosition:aBlockNode endPosition.
   151     blockInvocationInfo add:blockEntryInfo.
   151     blockInvocationInfo add:blockEntryInfo.
   152 
   152 
   153     countCode := 
   153     countCode := 
   154         StatementNode 
   154         StatementNode 
   163     ] ifFalse:[
   163     ] ifFalse:[
   164         countCode nextStatement:aBlockNode statements.
   164         countCode nextStatement:aBlockNode statements.
   165         aBlockNode statements:countCode.
   165         aBlockNode statements:countCode.
   166     ].
   166     ].
   167 
   167 
   168     "Modified: / 28-04-2010 / 15:55:30 / cg"
   168     "Modified: / 20-07-2011 / 19:00:05 / cg"
   169 !
   169 !
   170 
   170 
   171 addBlockCountersToEachBlockIn:aCollection
   171 addBlockCountersToEachBlockIn:aCollection
   172     aCollection do:[:eachNode |
   172     aCollection do:[:eachNode |
   173         eachNode isBlockNode ifTrue:[
   173         eachNode isBlockNode ifTrue:[
   203     |countCode statementEntryInfo|
   203     |countCode statementEntryInfo|
   204 
   204 
   205     blockInvocationInfo isNil ifTrue:[
   205     blockInvocationInfo isNil ifTrue:[
   206         blockInvocationInfo := OrderedCollection new.
   206         blockInvocationInfo := OrderedCollection new.
   207     ].
   207     ].
   208     statementEntryInfo := StatementExecutionInfo new cleanInfo.
   208     statementEntryInfo := StatementExecutionInfo new cleanInfoWithChange:false.
   209     statementEntryInfo startPosition:aStatementNode startPosition.
   209     statementEntryInfo startPosition:aStatementNode startPosition.
   210     blockInvocationInfo add:statementEntryInfo.
   210     blockInvocationInfo add:statementEntryInfo.
   211 
   211 
   212     countCode := 
   212     countCode := 
   213         StatementNode 
   213         StatementNode 
   216                             selector:#entry:
   216                             selector:#entry:
   217                             arg:(VariableNode type:#ThisContext context:contextToEvaluateIn)).
   217                             arg:(VariableNode type:#ThisContext context:contextToEvaluateIn)).
   218 
   218 
   219     countCode nextStatement:aStatementNode.
   219     countCode nextStatement:aStatementNode.
   220     ^ countCode
   220     ^ countCode
       
   221 
       
   222     "Modified: / 20-07-2011 / 19:00:13 / cg"
   221 ! !
   223 ! !
   222 
   224 
   223 !InstrumentingCompiler methodsFor:'code generation-hooks'!
   225 !InstrumentingCompiler methodsFor:'code generation-hooks'!
   224 
   226 
   225 blockNodeRewriteHookFor:aBlockNode
   227 blockNodeRewriteHookFor:aBlockNode
   311     ].
   313     ].
   312 
   314 
   313     "Created: / 27-04-2010 / 12:09:03 / cg"
   315     "Created: / 27-04-2010 / 12:09:03 / cg"
   314 !
   316 !
   315 
   317 
   316 cleanAllInfo
   318 cleanAllInfoWithChange:withChange
   317     self allInfosDo:[:l |
   319     self allInfosDo:[:l |
   318         l cleanInfo.
   320         l cleanInfoWithChange:withChange.
   319     ].
   321     ].
   320 
   322 
   321     "
   323     "
   322      InstrumentingCompiler::InstrumentationInfo cleanAllInfo
   324      InstrumentingCompiler::InstrumentationInfo cleanAllInfo
   323      InstrumentingCompiler::MethodInvocationInfo cleanAllInfo
   325      InstrumentingCompiler::MethodInvocationInfo cleanAllInfo
   324     "
   326     "
   325 
   327 
   326     "Modified: / 27-04-2010 / 12:10:07 / cg"
   328     "Modified: / 27-04-2010 / 12:10:07 / cg"
       
   329     "Created: / 20-07-2011 / 19:00:37 / cg"
   327 ! !
   330 ! !
   328 
   331 
   329 !InstrumentingCompiler::InstrumentationInfo methodsFor:'accessing'!
   332 !InstrumentingCompiler::InstrumentationInfo methodsFor:'accessing'!
   330 
   333 
   331 owningMethod:something
   334 owningMethod:something
   378     startPosition := something.
   381     startPosition := something.
   379 ! !
   382 ! !
   380 
   383 
   381 !InstrumentingCompiler::StatementExecutionInfo methodsFor:'cleanup'!
   384 !InstrumentingCompiler::StatementExecutionInfo methodsFor:'cleanup'!
   382 
   385 
   383 cleanInfo
   386 cleanInfoWithChange:withChange
   384     count := 0.
   387     count := 0.
   385     Smalltalk changed:#methodCoverageInfo with:owningMethod.
   388     withChange ifTrue:[
       
   389         Smalltalk changed:#methodCoverageInfo with:owningMethod.
       
   390     ].
   386 
   391 
   387     "Modified: / 20-07-2011 / 17:55:49 / cg"
   392     "Modified: / 20-07-2011 / 17:55:49 / cg"
       
   393     "Created: / 20-07-2011 / 18:59:01 / cg"
   388 ! !
   394 ! !
   389 
   395 
   390 !InstrumentingCompiler::StatementExecutionInfo methodsFor:'instrumentation calls'!
   396 !InstrumentingCompiler::StatementExecutionInfo methodsFor:'instrumentation calls'!
   391 
   397 
   392 entry:callingContext
   398 entry:callingContext
   482     ^ sum
   488     ^ sum
   483 ! !
   489 ! !
   484 
   490 
   485 !InstrumentingCompiler::MethodInvocationInfo methodsFor:'cleanup'!
   491 !InstrumentingCompiler::MethodInvocationInfo methodsFor:'cleanup'!
   486 
   492 
   487 cleanInfo
   493 cleanInfoWithChange:withChange
   488     infoPerReceiverClass := nil.
   494     infoPerReceiverClass := nil.
   489     Smalltalk changed:#methodCoverageInfo with:owningMethod.
   495     withChange ifTrue:[
       
   496         Smalltalk changed:#methodCoverageInfo with:owningMethod.
       
   497     ]
   490 
   498 
   491     "Modified: / 20-07-2011 / 17:55:35 / cg"
   499     "Modified: / 20-07-2011 / 17:55:35 / cg"
       
   500     "Created: / 20-07-2011 / 18:59:22 / cg"
   492 ! !
   501 ! !
   493 
   502 
   494 !InstrumentingCompiler::MethodInvocationInfo methodsFor:'instrumentation probe calls'!
   503 !InstrumentingCompiler::MethodInvocationInfo methodsFor:'instrumentation probe calls'!
   495 
   504 
   496 entry:aContext
   505 entry:aContext
   673 ! !
   682 ! !
   674 
   683 
   675 !InstrumentingCompiler class methodsFor:'documentation'!
   684 !InstrumentingCompiler class methodsFor:'documentation'!
   676 
   685 
   677 version
   686 version
   678     ^ '$Header: /cvs/stx/stx/libcomp/InstrumentingCompiler.st,v 1.9 2011-07-20 15:56:29 cg Exp $'
   687     ^ '$Header: /cvs/stx/stx/libcomp/InstrumentingCompiler.st,v 1.10 2011-07-20 18:16:33 cg Exp $'
   679 !
   688 !
   680 
   689 
   681 version_CVS
   690 version_CVS
   682     ^ '$Header: /cvs/stx/stx/libcomp/InstrumentingCompiler.st,v 1.9 2011-07-20 15:56:29 cg Exp $'
   691     ^ '$Header: /cvs/stx/stx/libcomp/InstrumentingCompiler.st,v 1.10 2011-07-20 18:16:33 cg Exp $'
   683 ! !
   692 ! !