InstrumentedMethod.st
author Claus Gittinger <cg@exept.de>
Tue, 02 Nov 2010 13:01:10 +0100
changeset 2444 e6b39d346228
parent 2389 13ce41b28d4e
child 2572 c43311807ee9
permissions -rw-r--r--
changed: #correctableError:position:to:from: #correctableSelectorWarning:position:to:from:

"
 COPYRIGHT (c) 2010 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
"{ Package: 'stx:libcomp' }"

Method variableSubclass:#InstrumentedMethod
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'System-Compiler-Instrumentation'
!

!InstrumentedMethod class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 2010 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
!

documentation
"
    Instances of me are created by the instrumenting compiler.

    [author:]
        Claus Gittinger
"
! !

!InstrumentedMethod class methodsFor:'cleanup'!

cleanAllInfo
    InstrumentingCompiler::InstrumentationInfo cleanAllInfo

    "Created: / 27-04-2010 / 19:00:22 / cg"
! !

!InstrumentedMethod methodsFor:'accessing'!

blockInvocationInfo
    |info|

    info := OrderedCollection new.
    self literalsDo:[:lit | 
        (lit isMemberOf:InstrumentingCompiler::BlockExecutionInfo) ifTrue:[
            info add:lit
        ]
    ].
    ^ info

    "Created: / 27-04-2010 / 13:47:21 / cg"
    "Modified: / 27-04-2010 / 14:52:30 / cg"
!

invokedViaPerform
    "true if the method is ever invoked via perform"

    |info|

    info := self methodInvocationInfo.
    ^ info notNil and:[info invokedViaPerform]

    "Created: / 27-04-2010 / 18:23:10 / cg"
!

methodInvocationInfo
    ^ self literalsDetect:[:lit | lit isKindOf:InstrumentingCompiler::MethodInvocationInfo] ifNone:nil

    "Created: / 27-04-2010 / 13:34:01 / cg"
!

statementInvocationInfo
    |info|

    info := OrderedCollection new.
    self literalsDo:[:lit | 
        (lit isMemberOf:InstrumentingCompiler::StatementExecutionInfo) ifTrue:[
            info add:lit
        ]
    ].
    ^ info
! !

!InstrumentedMethod methodsFor:'queries'!

hasBeenCalled
    |info|

    ^ (info := self methodInvocationInfo) notNil
    and:[ info hasBeenCalled ]

    "Created: / 27-04-2010 / 13:03:33 / cg"
!

haveAllBlocksBeenExecuted
    ^ self blockInvocationInfo conform:[:eachBlockInfo | eachBlockInfo callCount > 0]

    "Modified: / 27-04-2010 / 13:44:46 / cg"
!

isInstrumented
    ^ true

    "Created: / 27-04-2010 / 12:25:39 / cg"
! !

!InstrumentedMethod class methodsFor:'documentation'!

version_CVS
    ^ '$Header: /cvs/stx/stx/libcomp/InstrumentedMethod.st,v 1.4 2010-05-03 17:41:23 cg Exp $'
! !