InstrumentingCompiler.st
author Claus Gittinger <cg@exept.de>
Wed, 31 Jul 2013 17:47:01 +0200
changeset 3246 d0c8d1d6bad7
parent 3239 a603d73841d4
child 3570 0ac6e8f11416
permissions -rw-r--r--
class: ConstantNode class definition removed: #endCharIndex #endCharIndex: #endLineNr #endLineNr: ouch: some leftover bad code: classVariables accessed like instance variables. Removed vars and accessors.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"{ Package: 'stx:libcomp' }"
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
ByteCodeCompiler subclass:#InstrumentingCompiler
2949
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
     4
	instanceVariableNames:'method methodEntryInfo blockInvocationInfo'
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
     5
	classVariableNames:''
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
     6
	poolDictionaries:''
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
     7
	category:'System-Compiler-Instrumentation'
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
2634
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
    10
InstrumentationInfo subclass:#StatementExecutionInfo
3239
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
    11
	instanceVariableNames:'startPosition endPosition count'
2949
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
    12
	classVariableNames:''
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
    13
	poolDictionaries:''
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
    14
	privateIn:InstrumentingCompiler
2359
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
    15
!
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
    16
2967
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
    17
InstrumentingCompiler::StatementExecutionInfo subclass:#StatementExecutionInfoForCoverageInAlreadyEnteredState
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
    18
	instanceVariableNames:''
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
    19
	classVariableNames:''
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
    20
	poolDictionaries:''
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
    21
	privateIn:InstrumentingCompiler::StatementExecutionInfo
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
    22
!
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
    23
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
    24
InstrumentingCompiler::StatementExecutionInfo subclass:#StatementExecutionInfoInAlreadyEnteredState
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
    25
	instanceVariableNames:''
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
    26
	classVariableNames:''
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
    27
	poolDictionaries:''
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
    28
	privateIn:InstrumentingCompiler::StatementExecutionInfo
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
    29
!
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
    30
2635
Claus Gittinger <cg@exept.de>
parents: 2634
diff changeset
    31
InstrumentationInfo subclass:#MethodInvocationInfo
2973
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
    32
	instanceVariableNames:'count recursiveEntry infoPerReceiverClass'
2949
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
    33
	classVariableNames:''
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
    34
	poolDictionaries:''
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
    35
	privateIn:InstrumentingCompiler
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
Object subclass:#MethodInvocationInfoPerReceiverClass
2949
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
    39
	instanceVariableNames:'infoPerSendingMethod'
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
    40
	classVariableNames:''
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
    41
	poolDictionaries:''
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
    42
	privateIn:InstrumentingCompiler::MethodInvocationInfo
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
Object subclass:#MethodInvocationInfoPerSendingMethod
2949
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
    46
	instanceVariableNames:'countPerSendersClass invokedViaPerform'
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
    47
	classVariableNames:''
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
    48
	poolDictionaries:''
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
    49
	privateIn:InstrumentingCompiler::MethodInvocationInfo::MethodInvocationInfoPerReceiverClass
2948
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
    50
!
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
    51
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
    52
InstrumentingCompiler::MethodInvocationInfo subclass:#MethodInvocationInfoForCoverageInAlreadyEnteredState
2949
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
    53
	instanceVariableNames:''
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
    54
	classVariableNames:''
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
    55
	poolDictionaries:''
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
    56
	privateIn:InstrumentingCompiler
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
2711
63f9264d17f0 speedup for coverage-only
Claus Gittinger <cg@exept.de>
parents: 2675
diff changeset
    59
InstrumentingCompiler::MethodInvocationInfo subclass:#MethodInvocationInfoInAlreadyEnteredState
2949
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
    60
	instanceVariableNames:''
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
    61
	classVariableNames:''
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
    62
	poolDictionaries:''
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
    63
	privateIn:InstrumentingCompiler
2711
63f9264d17f0 speedup for coverage-only
Claus Gittinger <cg@exept.de>
parents: 2675
diff changeset
    64
!
63f9264d17f0 speedup for coverage-only
Claus Gittinger <cg@exept.de>
parents: 2675
diff changeset
    65
2715
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
    66
InstrumentingCompiler::StatementExecutionInfo subclass:#VariableAccessExecutionInfo
2949
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
    67
	instanceVariableNames:''
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
    68
	classVariableNames:''
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
    69
	poolDictionaries:''
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
    70
	privateIn:InstrumentingCompiler
2715
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
    71
!
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
    72
2390
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
    73
InstrumentingCompiler::StatementExecutionInfo subclass:#BlockExecutionInfo
3239
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
    74
	instanceVariableNames:''
2949
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
    75
	classVariableNames:''
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
    76
	poolDictionaries:''
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
    77
	privateIn:InstrumentingCompiler
2390
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
    78
!
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
    79
2967
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
    80
InstrumentingCompiler::BlockExecutionInfo subclass:#BlockExecutionInfoForCoverageInAlreadyEnteredState
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
    81
	instanceVariableNames:''
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
    82
	classVariableNames:''
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
    83
	poolDictionaries:''
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
    84
	privateIn:InstrumentingCompiler::BlockExecutionInfo
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
    85
!
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
    86
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
    87
InstrumentingCompiler::BlockExecutionInfo subclass:#BlockExecutionInfoInAlreadyEnteredState
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
    88
	instanceVariableNames:''
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
    89
	classVariableNames:''
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
    90
	poolDictionaries:''
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
    91
	privateIn:InstrumentingCompiler::BlockExecutionInfo
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
    92
!
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
    93
2715
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
    94
InstrumentingCompiler::VariableAccessExecutionInfo subclass:#ReadAccessExecutionInfo
2949
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
    95
	instanceVariableNames:''
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
    96
	classVariableNames:''
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
    97
	poolDictionaries:''
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
    98
	privateIn:InstrumentingCompiler
2715
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
    99
!
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   100
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   101
InstrumentingCompiler::VariableAccessExecutionInfo subclass:#WriteAccessExecutionInfo
2949
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
   102
	instanceVariableNames:''
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
   103
	classVariableNames:''
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
   104
	poolDictionaries:''
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
   105
	privateIn:InstrumentingCompiler
2715
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   106
!
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   107
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
!InstrumentingCompiler class methodsFor:'documentation'!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
documentation
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
"
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   112
    an experiment - recompile classes using this compiler adds instrumentation code.
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   113
    This remembers who calls a method from where (methodInvocationInfo) what the receiver's types are
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   114
    (inherited classes) and how often basic blocks (blockExecutionInfo) and statements 
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   115
    (statementExecutionInfo) are invoked .
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   116
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   117
    The who-calls and receiver type info may produce some overhead, which can be avoided by 
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   118
    using the somewhat more naive InstrumentingForSimpleCoverageCompiler (that is what people are
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   119
    used to from the C/Java world, anyway).
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   120
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   121
    From the first bulk, we can compute the inheritanceCoverage info (which methods have been called for which
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   122
    subclass) in addition to the known line and block coverages.
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
"
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
! !
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
!InstrumentingCompiler class methodsFor:'compilation-public'!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
compileClass:aClass
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
    "compile all methods of aClass with instrumentation"
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
2958
4bb6acd04cfe added: #compilePackage:
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
   131
    aClass instAndClassMethodsDo:[:eachMethod |
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
        self compileMethod:eachMethod
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
    ].
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
compileMethod:aMethod
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
    "compile a single method with instrumentation"
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
2972
204f077ff866 class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2967
diff changeset
   139
    Class withoutUpdatingChangesDo:[
3237
a6b2f875bcc3 Fix in InstrumentingCompiler>>#compileMethod:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3192
diff changeset
   140
        Class packageQuerySignal answer: aMethod package do:[
a6b2f875bcc3 Fix in InstrumentingCompiler>>#compileMethod:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3192
diff changeset
   141
            self 
a6b2f875bcc3 Fix in InstrumentingCompiler>>#compileMethod:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3192
diff changeset
   142
                compile:(aMethod source)
a6b2f875bcc3 Fix in InstrumentingCompiler>>#compileMethod:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3192
diff changeset
   143
                forClass:(aMethod mclass) 
a6b2f875bcc3 Fix in InstrumentingCompiler>>#compileMethod:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3192
diff changeset
   144
                inCategory:(aMethod category)
a6b2f875bcc3 Fix in InstrumentingCompiler>>#compileMethod:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3192
diff changeset
   145
        ]
2972
204f077ff866 class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2967
diff changeset
   146
    ]
3237
a6b2f875bcc3 Fix in InstrumentingCompiler>>#compileMethod:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3192
diff changeset
   147
a6b2f875bcc3 Fix in InstrumentingCompiler>>#compileMethod:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3192
diff changeset
   148
    "Modified: / 28-07-2013 / 16:59:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2958
4bb6acd04cfe added: #compilePackage:
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
   149
!
4bb6acd04cfe added: #compilePackage:
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
   150
4bb6acd04cfe added: #compilePackage:
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
   151
compilePackage:aPackageID
4bb6acd04cfe added: #compilePackage:
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
   152
    "compile all classes of a package instrumentation"
4bb6acd04cfe added: #compilePackage:
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
   153
4bb6acd04cfe added: #compilePackage:
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
   154
    Smalltalk allClassesInPackage:aPackageID do:[:eachClass |
4bb6acd04cfe added: #compilePackage:
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
   155
        self compileClass:eachClass
4bb6acd04cfe added: #compilePackage:
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
   156
    ].
4bb6acd04cfe added: #compilePackage:
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
   157
4bb6acd04cfe added: #compilePackage:
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
   158
    "
4bb6acd04cfe added: #compilePackage:
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
   159
     InstrumentingCompiler compilePackage:'exept:workflow'.
4bb6acd04cfe added: #compilePackage:
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
   160
     InstrumentingCompiler compilePackage:'exept:expecco'.
4bb6acd04cfe added: #compilePackage:
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
   161
    "
2972
204f077ff866 class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2967
diff changeset
   162
!
204f077ff866 class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2967
diff changeset
   163
204f077ff866 class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2967
diff changeset
   164
compilePackages:aCollectionOfPackageIDs
204f077ff866 class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2967
diff changeset
   165
    "compile all classes of some packages with instrumentation"
204f077ff866 class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2967
diff changeset
   166
204f077ff866 class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2967
diff changeset
   167
    aCollectionOfPackageIDs do:[:eachPackage |
204f077ff866 class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2967
diff changeset
   168
        self compilePackage:eachPackage
204f077ff866 class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2967
diff changeset
   169
    ].
204f077ff866 class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2967
diff changeset
   170
204f077ff866 class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2967
diff changeset
   171
    "
204f077ff866 class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2967
diff changeset
   172
     InstrumentingCompiler compilePackages:#( 'exept:workflow' 'exept:expecco' ).
204f077ff866 class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2967
diff changeset
   173
    "
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
! !
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
!InstrumentingCompiler class methodsFor:'special'!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   178
allInstrumentedMethods
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
    ^ InstrumentedMethod allInstances 
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   181
    "
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   182
     self allInstrumentedMethods
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   183
    "
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
    "Modified: / 27-04-2010 / 13:37:51 / cg"
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   186
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
callersOf:aMethod do:aBlock
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   189
    "enumerate all callers of aMethod into a block"
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   190
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
    |info|
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   192
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   193
    info := aMethod methodInvocationInfo.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   194
    info notNil ifTrue:[
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   195
        info callingMethodsDo:[:callingMethod |
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   196
            aBlock value:callingMethod
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
        ]
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   198
    ]
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   199
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   200
    "Modified: / 27-04-2010 / 13:35:00 / cg"
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   201
    "Modified (comment): / 07-08-2011 / 15:08:33 / cg"
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   202
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   203
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   204
isInstrumented:aMethod
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   205
    ^ aMethod isInstrumented
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   206
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   207
    "
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
     self methodInfoOf:aMethod
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   209
    "
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   210
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
    "Modified: / 27-04-2010 / 13:35:21 / cg"
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   212
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   213
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   214
methodInfoOf:aMethod
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   215
    <resource: #obsolete>
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   216
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   217
    self obsoleteMethodWarning:'please use Method >> methodInvocationInfo'.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   218
    ^ aMethod methodInvocationInfo
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   219
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   220
    "
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   221
     self methodInfoOf:aMethod
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
    "
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   223
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   224
    "Modified: / 27-04-2010 / 13:37:31 / cg"
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   225
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   227
methodInvocationInfoOf:aMethod
3192
4a3a9fa54b94 class: InstrumentingCompiler
Stefan Vogel <sv@exept.de>
parents: 2981
diff changeset
   228
    <resource: #obsolete>
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   229
    self obsoleteMethodWarning:'please use method>>methodInvocationInfo'.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   230
    ^ aMethod methodInvocationInfo
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   231
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   232
    "
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   233
     self methodInfoOf:aMethod
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   234
    "
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   235
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   236
    "Created: / 27-04-2010 / 12:28:56 / cg"
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   237
    "Modified: / 27-04-2010 / 13:34:36 / cg"
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   238
! !
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   239
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   240
!InstrumentingCompiler methodsFor:'code generation helpers'!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   241
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   242
addBlockCounterTo:aBlockNode
2951
340d0405f582 comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
   243
    "called by the compiler to instrument a block node"
340d0405f582 comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
   244
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   245
    |countCode blockEntryInfo|
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   246
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   247
    blockInvocationInfo isNil ifTrue:[
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   248
        blockInvocationInfo := OrderedCollection new.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   249
    ].
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   250
    blockEntryInfo := self blockExecutionInfoInstance.
2370
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   251
    blockEntryInfo startPosition:aBlockNode startPosition endPosition:aBlockNode endPosition.
2675
3e8368ea406e comment/format in: #addBlockCounterTo:
Claus Gittinger <cg@exept.de>
parents: 2665
diff changeset
   252
"/    Transcript show:aBlockNode startPosition;
3e8368ea406e comment/format in: #addBlockCounterTo:
Claus Gittinger <cg@exept.de>
parents: 2665
diff changeset
   253
"/     show:' -> ';
3e8368ea406e comment/format in: #addBlockCounterTo:
Claus Gittinger <cg@exept.de>
parents: 2665
diff changeset
   254
"/     showCR: aBlockNode endPosition.
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   255
    blockInvocationInfo add:blockEntryInfo.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   256
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   257
    countCode := 
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   258
        StatementNode 
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   259
            expression:(MessageNode 
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   260
                            receiver:(ConstantNode value:blockEntryInfo)
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   261
                            selector:#entry:
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   262
                            arg:(VariableNode type:#ThisContext context:contextToEvaluateIn)).
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   263
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   264
    aBlockNode isEmptyBlock ifTrue:[
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   265
        "/ q: are we interested in empty blocks ?
2665
2071b01a050f changed: #addBlockCounterTo:
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
   266
        countCode nextStatement:(StatementNode expression:(ConstantNode value:nil)).
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   267
        aBlockNode statements:countCode.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   268
    ] ifFalse:[
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   269
        countCode nextStatement:aBlockNode statements.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   270
        aBlockNode statements:countCode.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   271
    ].
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   272
2675
3e8368ea406e comment/format in: #addBlockCounterTo:
Claus Gittinger <cg@exept.de>
parents: 2665
diff changeset
   273
    "Modified: / 21-08-2011 / 16:02:52 / cg"
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   274
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   275
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   276
addBlockCountersToEachBlockIn:aCollection
2951
340d0405f582 comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
   277
    "called by the compiler to instrument a collection of block nodes"
340d0405f582 comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
   278
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   279
    aCollection do:[:eachNode |
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   280
        eachNode isBlockNode ifTrue:[
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   281
            self addBlockCounterTo:eachNode
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   282
        ]
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   283
    ].
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   284
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   285
    "Created: / 27-04-2010 / 11:47:56 / cg"
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   286
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   287
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   288
createMethod
2951
340d0405f582 comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
   289
    "called by the compiler to instatiate a new method instance"
340d0405f582 comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
   290
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   291
    method := super createMethod.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   292
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   293
    methodEntryInfo notNil ifTrue:[
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   294
        methodEntryInfo owningMethod:method    
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   295
    ].
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   296
    blockInvocationInfo notNil ifTrue:[
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   297
        blockInvocationInfo do:[:eachInfo | eachInfo owningMethod:method]
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   298
    ].
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   299
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   300
    ^ method
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   301
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   302
    "Modified: / 27-04-2010 / 14:04:50 / cg"
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   303
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   304
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   305
methodClass
2951
340d0405f582 comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
   306
    "called by the compiler to ask for the method instance's class"
340d0405f582 comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
   307
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   308
    ^ InstrumentedMethod
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   309
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   310
    "Created: / 27-04-2010 / 12:17:22 / cg"
2390
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   311
!
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   312
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   313
statementCounterBefore:aStatementNode
2951
340d0405f582 comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
   314
    "called by the compiler to instrument a statement node (head of a basic block)"
340d0405f582 comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
   315
2390
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   316
    |countCode statementEntryInfo|
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   317
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   318
    blockInvocationInfo isNil ifTrue:[
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   319
        blockInvocationInfo := OrderedCollection new.
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   320
    ].
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   321
    statementEntryInfo := self statementExecutionInfoInstance.
2390
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   322
    statementEntryInfo startPosition:aStatementNode startPosition.
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   323
    blockInvocationInfo add:statementEntryInfo.
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   324
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   325
    countCode := 
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   326
        StatementNode 
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   327
            expression:(MessageNode 
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   328
                            receiver:(ConstantNode value:statementEntryInfo)
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   329
                            selector:#entry:
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   330
                            arg:(VariableNode type:#ThisContext context:contextToEvaluateIn)).
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   331
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   332
    countCode nextStatement:aStatementNode.
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   333
    ^ countCode
2571
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   334
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   335
    "Modified: / 07-08-2011 / 15:32:45 / cg"
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   336
! !
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   337
2715
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   338
!InstrumentingCompiler methodsFor:'code generation hooks'!
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   339
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   340
assignmentRewriteHookFor:anAssignmentNode
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   341
    "invoked whenever an assignment node has been generated"
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   342
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   343
    ^ anAssignmentNode
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   344
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   345
    "Created: / 30-09-2011 / 12:28:09 / cg"
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   346
!
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   347
2370
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   348
blockNodeRewriteHookFor:aBlockNode
2715
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   349
    "invoked whenever a block node has been generated"
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   350
2370
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   351
    "/ add a counter for the block
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   352
    self addBlockCounterTo:aBlockNode.
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   353
    ^ aBlockNode
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   354
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   355
    "Created: / 28-04-2010 / 14:21:27 / cg"
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   356
!
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   357
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   358
messageNodeRewriteHookFor:aMessageNode
2715
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   359
    "invoked whenever a message send node has been generated"
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   360
2370
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   361
"/ see blockNodeRewriter...
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   362
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   363
"/    "/ argument could be a constantNode (due to contant-folding optimization)
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   364
"/    aMessageNode isConstant ifTrue:[^ aMessageNode].
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   365
"/    (
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   366
"/        #( 
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   367
"/            ifTrue: 
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   368
"/            ifFalse:
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   369
"/            ifTrue:ifFalse: 
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   370
"/            ifFalse:ifTrue: 
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   371
"/        )
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   372
"/        includes:aMessageNode selector
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   373
"/    ) ifTrue:[
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   374
"/        "/ add a counter for the block
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   375
"/        self addBlockCountersToEachBlockIn:(aMessageNode arguments)
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   376
"/    ].
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   377
    ^ aMessageNode
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   378
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   379
    "Created: / 27-04-2010 / 11:43:22 / cg"
2370
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   380
    "Modified: / 28-04-2010 / 14:22:05 / cg"
2715
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   381
    "Modified (comment): / 30-09-2011 / 12:16:56 / cg"
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   382
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   383
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   384
startCodeGenerationHookOn:codeStream
2715
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   385
    "invoked before code is generated"
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   386
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   387
    methodEntryInfo := self methodInvocationInfoInstance.
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   388
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   389
    (StatementNode 
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   390
        expression:(MessageNode 
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   391
                        receiver:(ConstantNode value:methodEntryInfo)
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   392
                        selector:#entry:
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   393
                        arg:(VariableNode type:#ThisContext context:contextToEvaluateIn)))
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   394
            codeForSideEffectOn:codeStream inBlock:nil for:self.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   395
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   396
    "Modified: / 07-08-2011 / 15:34:09 / cg"
2715
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   397
    "Modified (comment): / 30-09-2011 / 12:16:05 / cg"
2390
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   398
!
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   399
3239
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   400
statementListRewriteHookFor:firstStatementArg
2715
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   401
    "invoked whenever a statement list node has been generated"
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   402
2390
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   403
    "/ care for blocks which return...
3239
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   404
    |thisStatement prevStatement countStatement mustInsertExecutionInfo statementInfo firstStatement |
2390
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   405
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   406
    mustInsertExecutionInfo := false.
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   407
    prevStatement := nil.
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   408
3239
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   409
    thisStatement := firstStatementArg.
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   410
    thisStatement isNil ifTrue:[^ firstStatementArg].
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   411
    firstStatement := self statementCounterBefore:thisStatement.
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   412
    statementInfo := firstStatement expression receiver value. 
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   413
    statementInfo endPosition: thisStatement endPosition.
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   414
2390
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   415
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   416
    [true] whileTrue:[
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   417
        mustInsertExecutionInfo ifTrue:[
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   418
            "/ prev-stat had a return in it (a block with a return);
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   419
            "/ insert a statement-entry here.
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   420
            thisStatement notNil ifTrue:[
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   421
                countStatement := self statementCounterBefore:thisStatement.
3239
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   422
                statementInfo := countStatement expression receiver value.
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   423
                statementInfo endPosition: thisStatement endPosition.
2390
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   424
                prevStatement nextStatement:countStatement.
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   425
                mustInsertExecutionInfo := false.
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   426
                prevStatement := countStatement.
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   427
            ]
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   428
        ].
3239
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   429
        thisStatement isNil ifTrue:[ ^ firstStatement ].
2390
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   430
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   431
        thisStatement isReturnNode ifFalse:[
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   432
            thisStatement containsReturn ifTrue:[
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   433
                mustInsertExecutionInfo := true    
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   434
            ]
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   435
        ].
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   436
        prevStatement := thisStatement.
3239
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   437
        statementInfo notNil ifTrue:[
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   438
            statementInfo endPosition: prevStatement endPosition.
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   439
        ].
2390
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   440
        thisStatement := thisStatement nextStatement.
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   441
    ].
2715
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   442
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   443
    "Modified (comment): / 30-09-2011 / 12:15:52 / cg"
3239
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   444
    "Modified: / 29-07-2013 / 00:11:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2715
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   445
!
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   446
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   447
variableReadRewriteHookFor:aVariableNode
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   448
    "invoked whenever a variable access node has been generated"
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   449
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   450
    ^ aVariableNode
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   451
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   452
    "Created: / 30-09-2011 / 12:27:47 / cg"
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   453
! !
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   454
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   455
!InstrumentingCompiler methodsFor:'redefinable'!
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   456
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   457
blockExecutionInfoInstance
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   458
    "one instance is generated for every block,
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   459
     and called at execution time with entry:"
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   460
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   461
    ^ BlockExecutionInfo new cleanInfoWithChange:false.
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   462
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   463
    "Created: / 07-08-2011 / 15:13:42 / cg"
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   464
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   465
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   466
methodInvocationInfoInstance
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   467
    "one instance is generated for every method,
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   468
     and called at execution time with entry:"
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   469
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   470
    ^ MethodInvocationInfo new.
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   471
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   472
    "Created: / 07-08-2011 / 15:33:57 / cg"
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   473
!
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   474
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   475
statementExecutionInfoInstance
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   476
    "one instance is generated for every statement,
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   477
     and called at execution time with entry:"
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   478
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   479
    ^ StatementExecutionInfo new cleanInfoWithChange:false.
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   480
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   481
    "Created: / 07-08-2011 / 15:32:36 / cg"
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   482
! !
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   483
2715
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   484
!InstrumentingCompiler::StatementExecutionInfo class methodsFor:'documentation'!
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   485
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   486
documentation
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   487
"
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   488
    (sub)instances of me are updated by instrumented code when statements are executed.
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   489
"
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   490
! !
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   491
2390
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   492
!InstrumentingCompiler::StatementExecutionInfo methodsFor:'accessing'!
2359
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   493
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   494
callCount
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   495
    ^ count
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   496
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   497
    "Created: / 27-04-2010 / 13:45:15 / cg"
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   498
!
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   499
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   500
characterPosition
2370
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   501
    ^ startPosition
2359
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   502
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   503
    "Created: / 23-06-2006 / 13:31:19 / cg"
2370
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   504
    "Modified: / 28-04-2010 / 15:54:24 / cg"
2359
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   505
!
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   506
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   507
characterPosition:something
2370
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   508
    startPosition := something.
2359
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   509
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   510
    "Created: / 23-06-2006 / 13:31:19 / cg"
2370
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   511
    "Modified: / 28-04-2010 / 15:54:30 / cg"
2359
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   512
!
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   513
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   514
count
2973
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   515
    "how often have I been called"
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   516
2981
f82dd89f0459 count values
Claus Gittinger <cg@exept.de>
parents: 2976
diff changeset
   517
    ^ count ? 0
2359
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   518
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   519
    "Created: / 23-06-2006 / 13:31:28 / cg"
2370
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   520
!
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   521
3239
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   522
endPosition
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   523
    ^ endPosition
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   524
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   525
    "Created: / 28-04-2010 / 15:57:14 / cg"
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   526
!
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   527
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   528
endPosition:anInteger
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   529
    endPosition := anInteger.
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   530
!
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   531
2370
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   532
startPosition
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   533
    ^ startPosition
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   534
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   535
    "Created: / 28-04-2010 / 15:54:26 / cg"
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   536
!
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   537
3239
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   538
startPosition:anInteger
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   539
    startPosition := anInteger.
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   540
!
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   541
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   542
startPosition:startArg endPosition:endArg
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   543
    startPosition := startArg.
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   544
    endPosition := endArg.
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   545
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   546
    "Created: / 28-04-2010 / 15:54:47 / cg"
2359
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   547
! !
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   548
2390
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   549
!InstrumentingCompiler::StatementExecutionInfo methodsFor:'cleanup'!
2359
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   550
2571
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   551
cleanInfoWithChange:withChange
2569
e9fcb54ac3d4 change notifications
Claus Gittinger <cg@exept.de>
parents: 2528
diff changeset
   552
    count := 0.
2571
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   553
    withChange ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   554
        Smalltalk changed:#methodCoverageInfo with:owningMethod.
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   555
    ].
2569
e9fcb54ac3d4 change notifications
Claus Gittinger <cg@exept.de>
parents: 2528
diff changeset
   556
2570
f0b8fc6cdabb change info
Claus Gittinger <cg@exept.de>
parents: 2569
diff changeset
   557
    "Modified: / 20-07-2011 / 17:55:49 / cg"
2571
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   558
    "Created: / 20-07-2011 / 18:59:01 / cg"
2359
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   559
! !
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   560
3239
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   561
!InstrumentingCompiler::StatementExecutionInfo methodsFor:'debugging'!
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   562
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   563
inspector2TabSource
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   564
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   565
    | source |
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   566
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   567
    source := owningMethod source asText.
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   568
    startPosition isNil ifTrue:[
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   569
        source colorizeAllWith: Color red.
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   570
    ] ifFalse:[
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   571
        endPosition isNil ifTrue:[
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   572
            source emphasizeFrom:startPosition to:source string size with: #bold.
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   573
            source emphasizeFrom:startPosition to:source string size with: #color -> Color red.
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   574
        ] ifFalse:[
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   575
            source emphasizeFrom:startPosition to: endPosition with: #bold.
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   576
            source emphasizeFrom:startPosition to: endPosition with: #color -> Color blue.
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   577
        ].
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   578
    ].
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   579
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   580
    ^self newInspector2Tab
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   581
        label: 'Source';
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   582
        priority: 50;
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   583
        view: ((ScrollableView for:EditTextView) contents: source; yourself)
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   584
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   585
    "Created: / 28-07-2013 / 23:16:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   586
!
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   587
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   588
inspector2Tabs
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   589
    ^ #( inspector2TabForBasicInspect inspector2TabSource )
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   590
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   591
    "Created: / 28-07-2013 / 23:18:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   592
! !
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
   593
2390
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   594
!InstrumentingCompiler::StatementExecutionInfo methodsFor:'instrumentation calls'!
2359
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   595
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   596
entry:callingContext
2528
e57cc8caf6f9 dont instrument the instrumentation code
Claus Gittinger <cg@exept.de>
parents: 2391
diff changeset
   597
    "invoked by instrumented code;
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   598
     called whenever the block/statment is entered"
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   599
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   600
    |context|
2359
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   601
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   602
    context := InstrumentationContext current.
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   603
    context isNil ifTrue:[^ self].
2960
8adc66fe55fb care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents: 2958
diff changeset
   604
    context inInstrumentedCode ifTrue:[^ self].
2711
63f9264d17f0 speedup for coverage-only
Claus Gittinger <cg@exept.de>
parents: 2675
diff changeset
   605
    context coverageOnly ifTrue:[
63f9264d17f0 speedup for coverage-only
Claus Gittinger <cg@exept.de>
parents: 2675
diff changeset
   606
        self hasBeenExecuted ifTrue:[^ self].
63f9264d17f0 speedup for coverage-only
Claus Gittinger <cg@exept.de>
parents: 2675
diff changeset
   607
    ].
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   608
    context enabledAndNotInInstrumentedCode ifFalse:[^ self].
2528
e57cc8caf6f9 dont instrument the instrumentation code
Claus Gittinger <cg@exept.de>
parents: 2391
diff changeset
   609
2359
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   610
    count := count + 1.
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   611
    count == 1 ifTrue:[
2960
8adc66fe55fb care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents: 2958
diff changeset
   612
        "/ the very first time, send a change notification, so the browsers update the coloring
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   613
2944
b0a2b03382fa fixes and tuning
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   614
        [
b0a2b03382fa fixes and tuning
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   615
            context inInstrumentedCode:true.
b0a2b03382fa fixes and tuning
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   616
            Smalltalk changed:#methodCoverageInfo with:owningMethod.
2967
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   617
            context coverageOnly ifTrue:[
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   618
                self changeClassToCoverageAndAlreadyEntered.
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   619
            ] ifFalse:[
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   620
                self changeClassToAlreadyEntered.
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   621
            ].
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   622
            "/ attention: no self sends here - class has changed!!
2944
b0a2b03382fa fixes and tuning
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   623
        ] ensure:[
b0a2b03382fa fixes and tuning
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   624
            context inInstrumentedCode:false.
b0a2b03382fa fixes and tuning
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   625
        ]
2359
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   626
    ].
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   627
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   628
    "Created: / 23-06-2006 / 13:31:16 / cg"
2711
63f9264d17f0 speedup for coverage-only
Claus Gittinger <cg@exept.de>
parents: 2675
diff changeset
   629
    "Modified: / 23-08-2011 / 21:29:39 / cg"
2359
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   630
! !
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   631
2973
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   632
!InstrumentingCompiler::StatementExecutionInfo methodsFor:'private'!
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   633
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   634
changeClassToAlreadyEntered
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   635
    self class == InstrumentingCompiler::StatementExecutionInfo ifTrue:[
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   636
        self changeClassTo: StatementExecutionInfoInAlreadyEnteredState
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   637
    ].
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   638
!
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   639
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   640
changeClassToCoverageAndAlreadyEntered
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   641
    self class == InstrumentingCompiler::StatementExecutionInfo ifTrue:[
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   642
        self changeClassTo: StatementExecutionInfoForCoverageInAlreadyEnteredState
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   643
    ].
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   644
! !
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   645
2390
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   646
!InstrumentingCompiler::StatementExecutionInfo methodsFor:'queries'!
2370
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   647
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   648
hasBeenExecuted
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   649
    ^ count > 0
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   650
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   651
    "Created: / 28-04-2010 / 14:39:46 / cg"
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   652
! !
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   653
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   654
!InstrumentingCompiler::StatementExecutionInfo methodsFor:'testing'!
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   655
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   656
isStatementExecutionInfo
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   657
    ^ true
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   658
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   659
    "Created: / 08-08-2011 / 14:40:51 / cg"
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   660
! !
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   661
2967
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   662
!InstrumentingCompiler::StatementExecutionInfo::StatementExecutionInfoForCoverageInAlreadyEnteredState methodsFor:'cleanup'!
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   663
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   664
cleanInfoWithChange:withChange
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   665
    super cleanInfoWithChange:withChange.
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   666
    self changeClassTo:InstrumentingCompiler::StatementExecutionInfo.
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   667
! !
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   668
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   669
!InstrumentingCompiler::StatementExecutionInfo::StatementExecutionInfoForCoverageInAlreadyEnteredState methodsFor:'instrumentation calls'!
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   670
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   671
entry:callingContext
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   672
    "already been invoked - nothing to record"
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   673
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   674
    ^ self
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   675
! !
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   676
2973
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   677
!InstrumentingCompiler::StatementExecutionInfo::StatementExecutionInfoForCoverageInAlreadyEnteredState methodsFor:'queries'!
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   678
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   679
hasBeenExecuted
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   680
    ^ true
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   681
! !
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   682
2967
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   683
!InstrumentingCompiler::StatementExecutionInfo::StatementExecutionInfoInAlreadyEnteredState methodsFor:'cleanup'!
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   684
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   685
cleanInfoWithChange:withChange
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   686
    super cleanInfoWithChange:withChange.
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   687
    self changeClassTo:InstrumentingCompiler::StatementExecutionInfo.
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   688
! !
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   689
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   690
!InstrumentingCompiler::StatementExecutionInfo::StatementExecutionInfoInAlreadyEnteredState methodsFor:'instrumentation calls'!
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   691
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   692
entry:callingContext
2973
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   693
    "already been invoked - no update notifications to browsers"
2967
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   694
2973
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   695
    count := count + 1.
2967
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   696
! !
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   697
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   698
!InstrumentingCompiler::MethodInvocationInfo methodsFor:'accessing'!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   699
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   700
callingMethodsDo:aBlock
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   701
    infoPerReceiverClass notNil ifTrue:[
2949
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
   702
        infoPerReceiverClass ~~ true ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
   703
            infoPerReceiverClass do:[:each |
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
   704
                each callingMethodsDo:aBlock
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
   705
            ]
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   706
        ]
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   707
    ]
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   708
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   709
2973
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   710
count
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   711
    "how often have I been called"
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   712
2981
f82dd89f0459 count values
Claus Gittinger <cg@exept.de>
parents: 2976
diff changeset
   713
    ^ count ? 0
2973
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   714
!
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   715
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   716
hasBeenCalled
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   717
    ^ infoPerReceiverClass notEmptyOrNil
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   718
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   719
    "Created: / 27-04-2010 / 13:43:15 / cg"
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   720
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   721
2368
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   722
invokedViaPerform
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   723
    ^ infoPerReceiverClass contains:[:someInfo | someInfo invokedViaPerform].
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   724
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   725
    "Created: / 27-04-2010 / 18:21:56 / cg"
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   726
!
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   727
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   728
invokingMethods
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   729
    |setOfMethods|
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   730
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   731
    setOfMethods := IdentitySet new.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   732
    self invokingMethodsDo:[:m | setOfMethods add:m].
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   733
    ^ setOfMethods.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   734
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   735
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   736
invokingMethodsDo:aBlock
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   737
    infoPerReceiverClass isNil ifTrue:[ ^ self].
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   738
    ^ infoPerReceiverClass do:[:eachInfo | eachInfo invokingMethodsDo:aBlock].
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   739
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   740
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   741
numberOfInvocations
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   742
    infoPerReceiverClass isNil ifTrue:[ ^ 0].
2951
340d0405f582 comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
   743
    infoPerReceiverClass == true ifTrue:[ ^ 0].
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   744
    ^ infoPerReceiverClass inject:0 into:[:sumSoFar :info | sumSoFar + info numberOfInvocations] 
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   745
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   746
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   747
numberOfInvocationsFromExternalOf:aClass
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   748
    |sum|
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   749
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   750
    infoPerReceiverClass isNil ifTrue:[ ^ 0].
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   751
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   752
    sum := 0.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   753
    infoPerReceiverClass keysAndValuesDo:[:recClass :info |
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   754
        sum := sum + (info numberOfInvocationsFromExternalOf:aClass)
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   755
    ]. 
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   756
    ^ sum
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   757
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   758
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   759
numberOfInvocationsFromInternalOf:aClass
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   760
    |sum|
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   761
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   762
    infoPerReceiverClass isNil ifTrue:[ ^ 0].
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   763
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   764
    sum := 0.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   765
    infoPerReceiverClass keysAndValuesDo:[:recClass :info |
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   766
        sum := sum + (info numberOfInvocationsFromInternalOf:aClass)
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   767
    ]. 
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   768
    ^ sum
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   769
! !
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   770
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   771
!InstrumentingCompiler::MethodInvocationInfo methodsFor:'cleanup'!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   772
2571
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   773
cleanInfoWithChange:withChange
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   774
    infoPerReceiverClass := nil.
2571
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   775
    withChange ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   776
        Smalltalk changed:#methodCoverageInfo with:owningMethod.
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   777
    ]
2569
e9fcb54ac3d4 change notifications
Claus Gittinger <cg@exept.de>
parents: 2528
diff changeset
   778
2570
f0b8fc6cdabb change info
Claus Gittinger <cg@exept.de>
parents: 2569
diff changeset
   779
    "Modified: / 20-07-2011 / 17:55:35 / cg"
2571
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   780
    "Created: / 20-07-2011 / 18:59:22 / cg"
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   781
! !
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   782
2973
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   783
!InstrumentingCompiler::MethodInvocationInfo methodsFor:'instrumentation calls'!
2967
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   784
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   785
entry:aContext
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   786
    "invoked by instrumented compiled code, upon method entry"
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   787
2948
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   788
    |context receiversClass infoPerReceiver firstEntry coverageOnly|
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   789
2960
8adc66fe55fb care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents: 2958
diff changeset
   790
    recursiveEntry == true ifTrue:[
8adc66fe55fb care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents: 2958
diff changeset
   791
        "/ hurry, get out of here
8adc66fe55fb care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents: 2958
diff changeset
   792
    ].
8adc66fe55fb care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents: 2958
diff changeset
   793
8adc66fe55fb care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents: 2958
diff changeset
   794
    "/ this is a hack - we have to be very careful to avoid recursive
8adc66fe55fb care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents: 2958
diff changeset
   795
    "/ instrumentation entries when instrumenting collection classes!!
8adc66fe55fb care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents: 2958
diff changeset
   796
    "/ Do not change without extensive testing.
8adc66fe55fb care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents: 2958
diff changeset
   797
    recursiveEntry := true.
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   798
    context := InstrumentationContext current.
2960
8adc66fe55fb care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents: 2958
diff changeset
   799
    context isNil ifTrue:[recursiveEntry := false. ^ self].
8adc66fe55fb care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents: 2958
diff changeset
   800
    context enabledAndNotInInstrumentedCode ifFalse:[recursiveEntry := false. ^ self].
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   801
2973
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   802
    count := (count ? 0) + 1.
2944
b0a2b03382fa fixes and tuning
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   803
    [
b0a2b03382fa fixes and tuning
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   804
        context inInstrumentedCode:true.
b0a2b03382fa fixes and tuning
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   805
2875
f7f46f53bc84 entry code tuned
Claus Gittinger <cg@exept.de>
parents: 2715
diff changeset
   806
        firstEntry := false.
f7f46f53bc84 entry code tuned
Claus Gittinger <cg@exept.de>
parents: 2715
diff changeset
   807
2948
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   808
        (coverageOnly := context coverageOnly) ifTrue:[
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   809
            "/ only interested in entry, but not in a per-receiver statistics
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   810
            "/ that is the normal coverage usage
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   811
            infoPerReceiverClass isNil ifTrue:[
2949
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
   812
                infoPerReceiverClass := true.
2948
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   813
                firstEntry := true.
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   814
            ].
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   815
        ] ifFalse:[
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   816
            "/ interested in a per-receiver statistics (remembering with which receiver-class a method has been invoked).
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   817
            "/ that is used by the OOM package
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   818
            infoPerReceiverClass isNil ifTrue:[
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   819
                infoPerReceiverClass := IdentityDictionary new.
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   820
                firstEntry := true.
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   821
            ].
2944
b0a2b03382fa fixes and tuning
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   822
            receiversClass := aContext receiver class.
b0a2b03382fa fixes and tuning
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   823
            infoPerReceiver := infoPerReceiverClass 
b0a2b03382fa fixes and tuning
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   824
                                        at:receiversClass 
b0a2b03382fa fixes and tuning
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   825
                                        ifAbsentPut:[MethodInvocationInfoPerReceiverClass new].
b0a2b03382fa fixes and tuning
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   826
            infoPerReceiver entry:aContext.
b0a2b03382fa fixes and tuning
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   827
        ].
2569
e9fcb54ac3d4 change notifications
Claus Gittinger <cg@exept.de>
parents: 2528
diff changeset
   828
2960
8adc66fe55fb care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents: 2958
diff changeset
   829
        "/ the very first time, send a change notification, so the browsers update the coloring
2944
b0a2b03382fa fixes and tuning
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   830
        firstEntry ifTrue:[
b0a2b03382fa fixes and tuning
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   831
            Smalltalk changed:#methodCoverageInfo with:owningMethod.
b0a2b03382fa fixes and tuning
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   832
        ].
2948
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   833
        coverageOnly ifTrue:[
2967
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   834
            self changeClassToCoverageAndAlreadyEntered.
2948
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   835
        ] ifFalse:[
2967
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   836
            self changeClassToAlreadyEntered.
2948
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   837
        ].
2967
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   838
        "/ attention: no self sends here - class has changed!!
2944
b0a2b03382fa fixes and tuning
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   839
    ] ensure:[
b0a2b03382fa fixes and tuning
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   840
        context inInstrumentedCode:false.
2960
8adc66fe55fb care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents: 2958
diff changeset
   841
        recursiveEntry := false.
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   842
    ].
2528
e57cc8caf6f9 dont instrument the instrumentation code
Claus Gittinger <cg@exept.de>
parents: 2391
diff changeset
   843
2960
8adc66fe55fb care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents: 2958
diff changeset
   844
    "Modified (comment): / 26-10-2012 / 12:59:44 / cg"
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   845
! !
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   846
2973
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   847
!InstrumentingCompiler::MethodInvocationInfo methodsFor:'private'!
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   848
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   849
changeClassToAlreadyEntered
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   850
    self class == InstrumentingCompiler::MethodInvocationInfo ifTrue:[
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   851
        self changeClassTo: InstrumentingCompiler::MethodInvocationInfoInAlreadyEnteredState
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   852
    ].
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   853
!
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   854
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   855
changeClassToCoverageAndAlreadyEntered
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   856
    self class == InstrumentingCompiler::MethodInvocationInfo ifTrue:[
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   857
        self changeClassTo: InstrumentingCompiler::MethodInvocationInfoForCoverageInAlreadyEnteredState
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   858
    ].
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   859
! !
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
   860
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   861
!InstrumentingCompiler::MethodInvocationInfo methodsFor:'testing'!
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   862
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   863
isMethodInvocationInfo
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   864
    ^ true
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   865
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   866
    "Created: / 08-08-2011 / 14:37:58 / cg"
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   867
! !
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   868
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   869
!InstrumentingCompiler::MethodInvocationInfo::MethodInvocationInfoPerReceiverClass methodsFor:'accessing'!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   870
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   871
callingMethodsDo:aBlock
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   872
    infoPerSendingMethod keysAndValuesDo:[:m :eachInfo |
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   873
        aBlock value:m
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   874
    ]
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   875
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   876
2368
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   877
invokedViaPerform
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   878
    ^ infoPerSendingMethod contains:[:someInfo | someInfo invokedViaPerform].
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   879
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   880
    "Created: / 27-04-2010 / 18:21:36 / cg"
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   881
!
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   882
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   883
invokingMethodsDo:aBlock
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   884
    infoPerSendingMethod isNil ifTrue:[ ^ self].
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   885
    ^ infoPerSendingMethod keysDo:aBlock.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   886
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   887
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   888
numberOfInvocations
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   889
    infoPerSendingMethod isNil ifTrue:[ ^ 0].
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   890
    ^ infoPerSendingMethod inject:0 into:[:sumSoFar :info | sumSoFar + info numberOfInvocations] 
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   891
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   892
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   893
numberOfInvocationsFromExternalOf:aClass
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   894
    |sum|
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   895
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   896
    infoPerSendingMethod isNil ifTrue:[ ^ 0].
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   897
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   898
    sum := 0.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   899
    infoPerSendingMethod keysAndValuesDo:[:sendingMethod :info |
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   900
        |sendingMethodsClass|
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   901
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   902
        sendingMethodsClass := sendingMethod mclass.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   903
        sendingMethodsClass notNil ifTrue:[
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   904
            ((sendingMethodsClass isSubclassOf:aClass) 
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   905
            or:[(aClass isSubclassOf:sendingMethodsClass )]) ifFalse:[
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   906
                sum := sum + (info numberOfInvocations)
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   907
            ]
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   908
        ]
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   909
    ]. 
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   910
    ^ sum
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   911
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   912
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   913
numberOfInvocationsFromInternalOf:aClass
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   914
    |sum|
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   915
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   916
    infoPerSendingMethod isNil ifTrue:[ ^ 0].
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   917
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   918
    sum := 0.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   919
    infoPerSendingMethod keysAndValuesDo:[:sendingMethod :info |
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   920
        |sendingMethodsClass|
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   921
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   922
        sendingMethodsClass := sendingMethod mclass.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   923
        sendingMethodsClass notNil ifTrue:[
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   924
            ((sendingMethodsClass isSubclassOf:aClass) 
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   925
            or:[(aClass isSubclassOf:sendingMethodsClass)]) ifTrue:[
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   926
                sum := sum + (info numberOfInvocations)
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   927
            ]
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   928
        ]
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   929
    ]. 
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   930
    ^ sum
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   931
! !
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   932
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   933
!InstrumentingCompiler::MethodInvocationInfo::MethodInvocationInfoPerReceiverClass methodsFor:'instrumentation calls'!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   934
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   935
entry:aContext
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   936
    "invoked by instrumented compiled code, upon method entry"
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   937
2368
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   938
    |sender sendingMethod infoPerMethod viaPerform|
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   939
2391
2bd90c14cd75 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2390
diff changeset
   940
    aContext selector == #doesNotUnderstand: ifTrue:[
2bd90c14cd75 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2390
diff changeset
   941
        sender := aContext sender sender methodHome.
2bd90c14cd75 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2390
diff changeset
   942
    ] ifFalse:[
2bd90c14cd75 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2390
diff changeset
   943
        sender := aContext sender methodHome.
2bd90c14cd75 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2390
diff changeset
   944
    ].
2370
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   945
    sender isNil ifTrue:[
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   946
        ^ self.
2569
e9fcb54ac3d4 change notifications
Claus Gittinger <cg@exept.de>
parents: 2528
diff changeset
   947
    ].
e9fcb54ac3d4 change notifications
Claus Gittinger <cg@exept.de>
parents: 2528
diff changeset
   948
    sendingMethod := sender method.
e9fcb54ac3d4 change notifications
Claus Gittinger <cg@exept.de>
parents: 2528
diff changeset
   949
    sendingMethod isNil ifTrue:[^ self].
2391
2bd90c14cd75 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2390
diff changeset
   950
2569
e9fcb54ac3d4 change notifications
Claus Gittinger <cg@exept.de>
parents: 2528
diff changeset
   951
    viaPerform := false.
e9fcb54ac3d4 change notifications
Claus Gittinger <cg@exept.de>
parents: 2528
diff changeset
   952
    (sendingMethod mclass == Object 
e9fcb54ac3d4 change notifications
Claus Gittinger <cg@exept.de>
parents: 2528
diff changeset
   953
    and:[ sendingMethod selector startsWith:'perform:'] ) ifTrue:[
e9fcb54ac3d4 change notifications
Claus Gittinger <cg@exept.de>
parents: 2528
diff changeset
   954
        "/ Transcript showCR:('%1 [info]: skipping #perform' bindWith:self class nameWithoutPrefix).
e9fcb54ac3d4 change notifications
Claus Gittinger <cg@exept.de>
parents: 2528
diff changeset
   955
        sender := sender sender methodHome.
e9fcb54ac3d4 change notifications
Claus Gittinger <cg@exept.de>
parents: 2528
diff changeset
   956
        sendingMethod := sender method.
e9fcb54ac3d4 change notifications
Claus Gittinger <cg@exept.de>
parents: 2528
diff changeset
   957
        viaPerform := true.
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   958
    ].
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   959
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   960
    infoPerSendingMethod isNil ifTrue:[
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   961
        infoPerSendingMethod := IdentityDictionary new.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   962
    ].
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   963
    infoPerMethod := infoPerSendingMethod 
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   964
                        at:sendingMethod 
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   965
                        ifAbsentPut:[ MethodInvocationInfoPerSendingMethod new ].
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   966
2368
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   967
    infoPerMethod entry:aContext viaPerform:viaPerform
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   968
2569
e9fcb54ac3d4 change notifications
Claus Gittinger <cg@exept.de>
parents: 2528
diff changeset
   969
    "Modified: / 20-07-2011 / 17:26:31 / cg"
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   970
! !
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   971
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   972
!InstrumentingCompiler::MethodInvocationInfo::MethodInvocationInfoPerReceiverClass::MethodInvocationInfoPerSendingMethod methodsFor:'accessing'!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   973
2368
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   974
invokedViaPerform
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   975
    ^ invokedViaPerform ? false
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   976
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   977
    "Created: / 27-04-2010 / 18:20:05 / cg"
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   978
!
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   979
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   980
numberOfInvocations
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   981
    countPerSendersClass isNil ifTrue:[ ^ 0].
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   982
    ^ countPerSendersClass inject:0 into:[:sumSoFar :count | sumSoFar + count] 
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   983
! !
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   984
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   985
!InstrumentingCompiler::MethodInvocationInfo::MethodInvocationInfoPerReceiverClass::MethodInvocationInfoPerSendingMethod methodsFor:'instrumentation calls'!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   986
2368
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   987
entry:aContext viaPerform:viaPerformBoolean
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   988
    "invoked by instrumented compiled code, upon method entry"
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   989
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   990
    |sendersClass count|
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   991
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   992
    sendersClass := aContext sender receiver class.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   993
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   994
    countPerSendersClass isNil ifTrue:[
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   995
        countPerSendersClass := IdentityDictionary new.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   996
    ].
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   997
    count := countPerSendersClass at:sendersClass ifAbsentPut:0.
2368
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   998
    countPerSendersClass at:sendersClass put:(count + 1).
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   999
    viaPerformBoolean ifTrue:[ invokedViaPerform := true ].
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
  1000
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
  1001
    "Created: / 27-04-2010 / 18:17:27 / cg"
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1002
! !
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1003
2948
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
  1004
!InstrumentingCompiler::MethodInvocationInfoForCoverageInAlreadyEnteredState methodsFor:'cleanup'!
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
  1005
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
  1006
cleanInfoWithChange:withChange
2967
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1007
    super cleanInfoWithChange:withChange.
2948
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
  1008
    self changeClassTo:InstrumentingCompiler::MethodInvocationInfo.
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
  1009
! !
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
  1010
2973
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
  1011
!InstrumentingCompiler::MethodInvocationInfoForCoverageInAlreadyEnteredState methodsFor:'instrumentation calls'!
2948
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
  1012
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
  1013
entry:aContext
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
  1014
    "already been invoked - nothing to record"
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
  1015
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
  1016
    ^ self
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
  1017
! !
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
  1018
2711
63f9264d17f0 speedup for coverage-only
Claus Gittinger <cg@exept.de>
parents: 2675
diff changeset
  1019
!InstrumentingCompiler::MethodInvocationInfoInAlreadyEnteredState methodsFor:'cleanup'!
63f9264d17f0 speedup for coverage-only
Claus Gittinger <cg@exept.de>
parents: 2675
diff changeset
  1020
63f9264d17f0 speedup for coverage-only
Claus Gittinger <cg@exept.de>
parents: 2675
diff changeset
  1021
cleanInfoWithChange:withChange
2967
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1022
    super cleanInfoWithChange:withChange.
2711
63f9264d17f0 speedup for coverage-only
Claus Gittinger <cg@exept.de>
parents: 2675
diff changeset
  1023
    self changeClassTo:InstrumentingCompiler::MethodInvocationInfo.
63f9264d17f0 speedup for coverage-only
Claus Gittinger <cg@exept.de>
parents: 2675
diff changeset
  1024
63f9264d17f0 speedup for coverage-only
Claus Gittinger <cg@exept.de>
parents: 2675
diff changeset
  1025
    "Modified: / 20-07-2011 / 17:55:35 / cg"
63f9264d17f0 speedup for coverage-only
Claus Gittinger <cg@exept.de>
parents: 2675
diff changeset
  1026
    "Created: / 24-08-2011 / 11:10:29 / cg"
63f9264d17f0 speedup for coverage-only
Claus Gittinger <cg@exept.de>
parents: 2675
diff changeset
  1027
! !
63f9264d17f0 speedup for coverage-only
Claus Gittinger <cg@exept.de>
parents: 2675
diff changeset
  1028
2973
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
  1029
!InstrumentingCompiler::MethodInvocationInfoInAlreadyEnteredState methodsFor:'instrumentation calls'!
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
  1030
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
  1031
entry:aContext
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
  1032
    "already been invoked - no notifications to send"
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
  1033
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
  1034
    count := count + 1
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
  1035
! !
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
  1036
2715
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1037
!InstrumentingCompiler::VariableAccessExecutionInfo class methodsFor:'documentation'!
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1038
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1039
documentation
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1040
"
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1041
    (sub)instances of me are updated by instrumented code when a variable is accessed
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1042
"
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1043
! !
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1044
2976
6e3f4e2b20f8 class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  1045
!InstrumentingCompiler::VariableAccessExecutionInfo methodsFor:'testing'!
6e3f4e2b20f8 class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  1046
6e3f4e2b20f8 class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  1047
isVariableAccessExecutionInfo
6e3f4e2b20f8 class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  1048
    ^ true
6e3f4e2b20f8 class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  1049
! !
6e3f4e2b20f8 class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  1050
2715
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1051
!InstrumentingCompiler::BlockExecutionInfo class methodsFor:'documentation'!
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1052
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1053
documentation
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1054
"
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1055
    (sub)instances of me are updated by instrumented code when a block is executed.
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1056
"
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1057
! !
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1058
2967
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1059
!InstrumentingCompiler::BlockExecutionInfo methodsFor:'entry'!
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1060
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1061
changeClassToAlreadyEntered
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1062
    self class == InstrumentingCompiler::BlockExecutionInfo ifTrue:[
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1063
        self changeClassTo: BlockExecutionInfoInAlreadyEnteredState
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1064
    ].
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1065
!
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1066
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1067
changeClassToCoverageAndAlreadyEntered
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1068
    self class == InstrumentingCompiler::BlockExecutionInfo ifTrue:[
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1069
        self changeClassTo: BlockExecutionInfoForCoverageInAlreadyEnteredState
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1070
    ].
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1071
! !
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1072
2675
3e8368ea406e comment/format in: #addBlockCounterTo:
Claus Gittinger <cg@exept.de>
parents: 2665
diff changeset
  1073
!InstrumentingCompiler::BlockExecutionInfo methodsFor:'printing'!
3e8368ea406e comment/format in: #addBlockCounterTo:
Claus Gittinger <cg@exept.de>
parents: 2665
diff changeset
  1074
3e8368ea406e comment/format in: #addBlockCounterTo:
Claus Gittinger <cg@exept.de>
parents: 2665
diff changeset
  1075
printOn:aStream 
3e8368ea406e comment/format in: #addBlockCounterTo:
Claus Gittinger <cg@exept.de>
parents: 2665
diff changeset
  1076
    aStream nextPutAll:'['.
3e8368ea406e comment/format in: #addBlockCounterTo:
Claus Gittinger <cg@exept.de>
parents: 2665
diff changeset
  1077
    startPosition printOn:aStream.
3e8368ea406e comment/format in: #addBlockCounterTo:
Claus Gittinger <cg@exept.de>
parents: 2665
diff changeset
  1078
    aStream nextPutAll:'...'.
3e8368ea406e comment/format in: #addBlockCounterTo:
Claus Gittinger <cg@exept.de>
parents: 2665
diff changeset
  1079
    endPosition printOn:aStream.
3e8368ea406e comment/format in: #addBlockCounterTo:
Claus Gittinger <cg@exept.de>
parents: 2665
diff changeset
  1080
    aStream nextPutAll:']'.
3e8368ea406e comment/format in: #addBlockCounterTo:
Claus Gittinger <cg@exept.de>
parents: 2665
diff changeset
  1081
3e8368ea406e comment/format in: #addBlockCounterTo:
Claus Gittinger <cg@exept.de>
parents: 2665
diff changeset
  1082
    "Created: / 21-08-2011 / 14:02:01 / cg"
3e8368ea406e comment/format in: #addBlockCounterTo:
Claus Gittinger <cg@exept.de>
parents: 2665
diff changeset
  1083
! !
3e8368ea406e comment/format in: #addBlockCounterTo:
Claus Gittinger <cg@exept.de>
parents: 2665
diff changeset
  1084
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  1085
!InstrumentingCompiler::BlockExecutionInfo methodsFor:'testing'!
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  1086
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  1087
isBlockExecutionInfo
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  1088
    ^ true
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  1089
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  1090
    "Created: / 07-08-2011 / 17:06:39 / cg"
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  1091
! !
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  1092
2967
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1093
!InstrumentingCompiler::BlockExecutionInfo::BlockExecutionInfoForCoverageInAlreadyEnteredState methodsFor:'cleanup'!
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1094
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1095
cleanInfoWithChange:withChange
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1096
    super cleanInfoWithChange:withChange.
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1097
    self changeClassTo:InstrumentingCompiler::BlockExecutionInfo.
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1098
! !
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1099
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1100
!InstrumentingCompiler::BlockExecutionInfo::BlockExecutionInfoForCoverageInAlreadyEnteredState methodsFor:'instrumentation probe calls'!
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1101
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1102
entry:callingContext
2973
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
  1103
    "already been invoked - nothing to do"
2967
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1104
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1105
    ^ self
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1106
! !
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1107
2973
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
  1108
!InstrumentingCompiler::BlockExecutionInfo::BlockExecutionInfoForCoverageInAlreadyEnteredState methodsFor:'queries'!
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
  1109
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
  1110
hasBeenExecuted
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
  1111
    ^ true
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
  1112
! !
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
  1113
2967
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1114
!InstrumentingCompiler::BlockExecutionInfo::BlockExecutionInfoInAlreadyEnteredState methodsFor:'cleanup'!
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1115
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1116
cleanInfoWithChange:withChange
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1117
    super cleanInfoWithChange:withChange.
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1118
    self changeClassTo:InstrumentingCompiler::BlockExecutionInfo.
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1119
! !
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1120
2973
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
  1121
!InstrumentingCompiler::BlockExecutionInfo::BlockExecutionInfoInAlreadyEnteredState methodsFor:'instrumentation probe calls'!
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
  1122
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
  1123
entry:callingContext
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
  1124
    "already been invoked - no update notification for browsers"
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
  1125
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
  1126
    count := count + 1.
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
  1127
! !
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
  1128
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
  1129
!InstrumentingCompiler::BlockExecutionInfo::BlockExecutionInfoInAlreadyEnteredState methodsFor:'queries'!
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
  1130
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
  1131
hasBeenExecuted
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
  1132
    ^ true
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
  1133
! !
9de309c79d6c class: InstrumentingCompiler
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
  1134
2715
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1135
!InstrumentingCompiler::ReadAccessExecutionInfo class methodsFor:'documentation'!
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1136
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1137
documentation
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1138
"
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1139
    (sub)instances of me are updated by instrumented code when a variable is read
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1140
"
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1141
! !
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1142
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1143
!InstrumentingCompiler::WriteAccessExecutionInfo class methodsFor:'documentation'!
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1144
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1145
documentation
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1146
"
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1147
    (sub)instances of me are updated by instrumented code when a variable is written
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1148
"
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1149
! !
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1150
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1151
!InstrumentingCompiler class methodsFor:'documentation'!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1152
2570
f0b8fc6cdabb change info
Claus Gittinger <cg@exept.de>
parents: 2569
diff changeset
  1153
version
3239
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
  1154
    ^ '$Header: /cvs/stx/stx/libcomp/InstrumentingCompiler.st,v 1.33 2013-07-28 23:20:46 vrany Exp $'
2570
f0b8fc6cdabb change info
Claus Gittinger <cg@exept.de>
parents: 2569
diff changeset
  1155
!
f0b8fc6cdabb change info
Claus Gittinger <cg@exept.de>
parents: 2569
diff changeset
  1156
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1157
version_CVS
3239
a603d73841d4 Coverage refactored - add statement execution info even for the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3237
diff changeset
  1158
    ^ '$Header: /cvs/stx/stx/libcomp/InstrumentingCompiler.st,v 1.33 2013-07-28 23:20:46 vrany Exp $'
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1159
! !
3192
4a3a9fa54b94 class: InstrumentingCompiler
Stefan Vogel <sv@exept.de>
parents: 2981
diff changeset
  1160