InstrumentingCompiler.st
author Claus Gittinger <cg@exept.de>
Thu, 01 Nov 2012 12:11:33 +0100
changeset 2967 33ec78ee2aa9
parent 2960 8adc66fe55fb
child 2972 204f077ff866
permissions -rw-r--r--
tuning by changing the class to speedup entry into already entered code.
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
2949
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
    11
	instanceVariableNames:'startPosition count'
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
2960
8adc66fe55fb care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents: 2958
diff changeset
    32
	instanceVariableNames:'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
2949
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
    74
	instanceVariableNames:'endPosition'
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
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
    self 
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
        compile:(aMethod source)
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
        forClass:(aMethod mclass) 
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
        inCategory:(aMethod category)
2958
4bb6acd04cfe added: #compilePackage:
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
   143
!
4bb6acd04cfe added: #compilePackage:
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
   144
4bb6acd04cfe added: #compilePackage:
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
   145
compilePackage:aPackageID
4bb6acd04cfe added: #compilePackage:
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
   146
    "compile all classes of a package instrumentation"
4bb6acd04cfe added: #compilePackage:
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
   147
4bb6acd04cfe added: #compilePackage:
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
   148
    Smalltalk allClassesInPackage:aPackageID do:[:eachClass |
4bb6acd04cfe added: #compilePackage:
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
   149
        self compileClass:eachClass
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
4bb6acd04cfe added: #compilePackage:
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
   152
    "
4bb6acd04cfe added: #compilePackage:
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
   153
     InstrumentingCompiler compilePackage:'exept:workflow'.
4bb6acd04cfe added: #compilePackage:
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
   154
     InstrumentingCompiler compilePackage:'exept:expecco'.
4bb6acd04cfe added: #compilePackage:
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
   155
    "
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
! !
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   157
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   158
!InstrumentingCompiler class methodsFor:'special'!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   159
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   160
allInstrumentedMethods
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
    ^ InstrumentedMethod allInstances 
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   162
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
    "
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
     self allInstrumentedMethods
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
    "
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
    "Modified: / 27-04-2010 / 13:37:51 / cg"
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   170
callersOf:aMethod do:aBlock
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   171
    "enumerate all callers of aMethod into a block"
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   172
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   173
    |info|
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
    info := aMethod methodInvocationInfo.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
    info notNil ifTrue:[
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
        info callingMethodsDo:[:callingMethod |
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   178
            aBlock value:callingMethod
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
        ]
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
    "Modified: / 27-04-2010 / 13:35:00 / cg"
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   183
    "Modified (comment): / 07-08-2011 / 15:08:33 / cg"
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   186
isInstrumented:aMethod
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
    ^ aMethod isInstrumented
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   189
    "
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   190
     self methodInfoOf:aMethod
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
    "
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   192
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   193
    "Modified: / 27-04-2010 / 13:35:21 / cg"
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   194
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   195
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   196
methodInfoOf:aMethod
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
    <resource: #obsolete>
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   198
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   199
    self obsoleteMethodWarning:'please use Method >> methodInvocationInfo'.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   200
    ^ aMethod methodInvocationInfo
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   201
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   202
    "
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   203
     self methodInfoOf:aMethod
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   204
    "
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   205
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   206
    "Modified: / 27-04-2010 / 13:37:31 / cg"
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   207
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   209
methodInvocationInfoOf:aMethod
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   210
    self obsoleteMethodWarning:'please use method>>methodInvocationInfo'.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
    ^ aMethod methodInvocationInfo
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
     self methodInfoOf:aMethod
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   215
    "
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   216
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   217
    "Created: / 27-04-2010 / 12:28:56 / cg"
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   218
    "Modified: / 27-04-2010 / 13:34:36 / cg"
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
!InstrumentingCompiler methodsFor:'code generation helpers'!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   223
addBlockCounterTo:aBlockNode
2951
340d0405f582 comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
   224
    "called by the compiler to instrument a block node"
340d0405f582 comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
   225
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
    |countCode blockEntryInfo|
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   227
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   228
    blockInvocationInfo isNil ifTrue:[
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   229
        blockInvocationInfo := OrderedCollection new.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   230
    ].
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   231
    blockEntryInfo := self blockExecutionInfoInstance.
2370
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   232
    blockEntryInfo startPosition:aBlockNode startPosition endPosition:aBlockNode endPosition.
2675
3e8368ea406e comment/format in: #addBlockCounterTo:
Claus Gittinger <cg@exept.de>
parents: 2665
diff changeset
   233
"/    Transcript show:aBlockNode startPosition;
3e8368ea406e comment/format in: #addBlockCounterTo:
Claus Gittinger <cg@exept.de>
parents: 2665
diff changeset
   234
"/     show:' -> ';
3e8368ea406e comment/format in: #addBlockCounterTo:
Claus Gittinger <cg@exept.de>
parents: 2665
diff changeset
   235
"/     showCR: aBlockNode endPosition.
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   236
    blockInvocationInfo add:blockEntryInfo.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   237
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   238
    countCode := 
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   239
        StatementNode 
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   240
            expression:(MessageNode 
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   241
                            receiver:(ConstantNode value:blockEntryInfo)
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   242
                            selector:#entry:
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   243
                            arg:(VariableNode type:#ThisContext context:contextToEvaluateIn)).
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   244
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   245
    aBlockNode isEmptyBlock ifTrue:[
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   246
        "/ q: are we interested in empty blocks ?
2665
2071b01a050f changed: #addBlockCounterTo:
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
   247
        countCode nextStatement:(StatementNode expression:(ConstantNode value:nil)).
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   248
        aBlockNode statements:countCode.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   249
    ] ifFalse:[
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   250
        countCode nextStatement:aBlockNode statements.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   251
        aBlockNode statements:countCode.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   252
    ].
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   253
2675
3e8368ea406e comment/format in: #addBlockCounterTo:
Claus Gittinger <cg@exept.de>
parents: 2665
diff changeset
   254
    "Modified: / 21-08-2011 / 16:02:52 / cg"
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   255
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   256
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   257
addBlockCountersToEachBlockIn:aCollection
2951
340d0405f582 comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
   258
    "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
   259
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   260
    aCollection do:[:eachNode |
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   261
        eachNode isBlockNode ifTrue:[
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   262
            self addBlockCounterTo:eachNode
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   263
        ]
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   264
    ].
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   265
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   266
    "Created: / 27-04-2010 / 11:47:56 / cg"
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   267
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   268
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   269
createMethod
2951
340d0405f582 comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
   270
    "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
   271
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   272
    method := super createMethod.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   273
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   274
    methodEntryInfo notNil ifTrue:[
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   275
        methodEntryInfo owningMethod:method    
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   276
    ].
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   277
    blockInvocationInfo notNil ifTrue:[
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   278
        blockInvocationInfo do:[:eachInfo | eachInfo owningMethod:method]
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   279
    ].
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   280
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   281
    ^ method
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   282
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   283
    "Modified: / 27-04-2010 / 14:04:50 / cg"
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   284
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   285
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   286
methodClass
2951
340d0405f582 comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
   287
    "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
   288
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   289
    ^ InstrumentedMethod
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   290
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   291
    "Created: / 27-04-2010 / 12:17:22 / cg"
2390
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   292
!
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   293
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   294
statementCounterBefore:aStatementNode
2951
340d0405f582 comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
   295
    "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
   296
2390
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   297
    |countCode statementEntryInfo|
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   298
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   299
    blockInvocationInfo isNil ifTrue:[
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   300
        blockInvocationInfo := OrderedCollection new.
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   301
    ].
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   302
    statementEntryInfo := self statementExecutionInfoInstance.
2390
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   303
    statementEntryInfo startPosition:aStatementNode startPosition.
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   304
    blockInvocationInfo add:statementEntryInfo.
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   305
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   306
    countCode := 
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   307
        StatementNode 
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   308
            expression:(MessageNode 
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   309
                            receiver:(ConstantNode value:statementEntryInfo)
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   310
                            selector:#entry:
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   311
                            arg:(VariableNode type:#ThisContext context:contextToEvaluateIn)).
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   312
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   313
    countCode nextStatement:aStatementNode.
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   314
    ^ countCode
2571
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   315
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   316
    "Modified: / 07-08-2011 / 15:32:45 / cg"
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   317
! !
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   318
2715
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   319
!InstrumentingCompiler methodsFor:'code generation hooks'!
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   320
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   321
assignmentRewriteHookFor:anAssignmentNode
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   322
    "invoked whenever an assignment node has been generated"
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   323
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   324
    ^ anAssignmentNode
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   325
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   326
    "Created: / 30-09-2011 / 12:28:09 / cg"
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   327
!
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   328
2370
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   329
blockNodeRewriteHookFor:aBlockNode
2715
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   330
    "invoked whenever a block node has been generated"
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   331
2370
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   332
    "/ add a counter for the block
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   333
    self addBlockCounterTo:aBlockNode.
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   334
    ^ aBlockNode
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   335
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   336
    "Created: / 28-04-2010 / 14:21:27 / cg"
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   337
!
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   338
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   339
messageNodeRewriteHookFor:aMessageNode
2715
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   340
    "invoked whenever a message send node has been generated"
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   341
2370
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   342
"/ see blockNodeRewriter...
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   343
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   344
"/    "/ argument could be a constantNode (due to contant-folding optimization)
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   345
"/    aMessageNode isConstant ifTrue:[^ aMessageNode].
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   346
"/    (
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   347
"/        #( 
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   348
"/            ifTrue: 
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   349
"/            ifFalse:
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   350
"/            ifTrue:ifFalse: 
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   351
"/            ifFalse:ifTrue: 
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   352
"/        )
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   353
"/        includes:aMessageNode selector
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   354
"/    ) ifTrue:[
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   355
"/        "/ add a counter for the block
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   356
"/        self addBlockCountersToEachBlockIn:(aMessageNode arguments)
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
    ^ aMessageNode
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   359
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   360
    "Created: / 27-04-2010 / 11:43:22 / cg"
2370
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   361
    "Modified: / 28-04-2010 / 14:22:05 / cg"
2715
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   362
    "Modified (comment): / 30-09-2011 / 12:16:56 / cg"
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   363
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   364
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   365
startCodeGenerationHookOn:codeStream
2715
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   366
    "invoked before code is generated"
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   367
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   368
    methodEntryInfo := self methodInvocationInfoInstance.
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   369
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   370
    (StatementNode 
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   371
        expression:(MessageNode 
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   372
                        receiver:(ConstantNode value:methodEntryInfo)
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   373
                        selector:#entry:
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   374
                        arg:(VariableNode type:#ThisContext context:contextToEvaluateIn)))
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   375
            codeForSideEffectOn:codeStream inBlock:nil for:self.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   376
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   377
    "Modified: / 07-08-2011 / 15:34:09 / cg"
2715
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   378
    "Modified (comment): / 30-09-2011 / 12:16:05 / cg"
2390
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   379
!
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   380
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   381
statementListRewriteHookFor:firstStatement
2715
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   382
    "invoked whenever a statement list node has been generated"
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   383
2390
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   384
    "/ care for blocks which return...
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   385
    |thisStatement prevStatement countStatement mustInsertExecutionInfo|
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   386
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   387
    mustInsertExecutionInfo := false.
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   388
    prevStatement := nil.
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   389
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   390
    thisStatement := firstStatement.
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   391
    thisStatement isNil ifTrue:[^ firstStatement].
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   392
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   393
    [true] whileTrue:[
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   394
        mustInsertExecutionInfo ifTrue:[
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   395
            "/ prev-stat had a return in it (a block with a return);
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   396
            "/ insert a statement-entry here.
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   397
            thisStatement notNil ifTrue:[
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   398
                countStatement := self statementCounterBefore:thisStatement.
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   399
                prevStatement nextStatement:countStatement.
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   400
                mustInsertExecutionInfo := false.
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   401
                prevStatement := countStatement.
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   402
            ]
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   403
        ].
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   404
        thisStatement isNil ifTrue:[^ firstStatement].
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   405
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   406
        thisStatement isReturnNode ifFalse:[
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   407
            thisStatement containsReturn ifTrue:[
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   408
                mustInsertExecutionInfo := true    
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   409
            ]
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   410
        ].
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   411
        prevStatement := thisStatement.
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   412
        thisStatement := thisStatement nextStatement.
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   413
    ].
2715
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   414
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   415
    "Modified (comment): / 30-09-2011 / 12:15:52 / cg"
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   416
!
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   417
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   418
variableReadRewriteHookFor:aVariableNode
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   419
    "invoked whenever a variable access node has been generated"
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   420
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   421
    ^ aVariableNode
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   422
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   423
    "Created: / 30-09-2011 / 12:27:47 / cg"
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   424
! !
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   425
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   426
!InstrumentingCompiler methodsFor:'redefinable'!
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   427
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   428
blockExecutionInfoInstance
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   429
    "one instance is generated for every block,
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   430
     and called at execution time with entry:"
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   431
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   432
    ^ BlockExecutionInfo new cleanInfoWithChange:false.
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   433
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   434
    "Created: / 07-08-2011 / 15:13:42 / cg"
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   435
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   436
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   437
methodInvocationInfoInstance
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   438
    "one instance is generated for every method,
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   439
     and called at execution time with entry:"
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   440
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   441
    ^ MethodInvocationInfo new.
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   442
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   443
    "Created: / 07-08-2011 / 15:33:57 / cg"
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   444
!
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   445
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   446
statementExecutionInfoInstance
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   447
    "one instance is generated for every statement,
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   448
     and called at execution time with entry:"
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   449
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   450
    ^ StatementExecutionInfo new cleanInfoWithChange:false.
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   451
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   452
    "Created: / 07-08-2011 / 15:32:36 / 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
2715
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   455
!InstrumentingCompiler::StatementExecutionInfo class methodsFor:'documentation'!
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   456
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   457
documentation
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   458
"
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   459
    (sub)instances of me are updated by instrumented code when statements are executed.
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   460
"
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   461
! !
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   462
2390
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   463
!InstrumentingCompiler::StatementExecutionInfo methodsFor:'accessing'!
2359
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   464
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   465
callCount
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   466
    ^ count
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   467
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   468
    "Created: / 27-04-2010 / 13:45:15 / cg"
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   469
!
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   470
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   471
characterPosition
2370
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   472
    ^ startPosition
2359
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   473
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   474
    "Created: / 23-06-2006 / 13:31:19 / cg"
2370
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   475
    "Modified: / 28-04-2010 / 15:54:24 / cg"
2359
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   476
!
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   477
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   478
characterPosition:something
2370
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   479
    startPosition := something.
2359
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   480
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   481
    "Created: / 23-06-2006 / 13:31:19 / cg"
2370
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   482
    "Modified: / 28-04-2010 / 15:54:30 / cg"
2359
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   483
!
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   484
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   485
count
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   486
    ^ count
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   487
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   488
    "Created: / 23-06-2006 / 13:31:28 / cg"
2370
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   489
!
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   490
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   491
startPosition
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   492
    ^ startPosition
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   493
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   494
    "Created: / 28-04-2010 / 15:54:26 / cg"
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   495
!
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   496
2390
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   497
startPosition:something
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   498
    startPosition := something.
2359
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
2390
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   501
!InstrumentingCompiler::StatementExecutionInfo methodsFor:'cleanup'!
2359
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   502
2571
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   503
cleanInfoWithChange:withChange
2569
e9fcb54ac3d4 change notifications
Claus Gittinger <cg@exept.de>
parents: 2528
diff changeset
   504
    count := 0.
2571
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   505
    withChange ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   506
        Smalltalk changed:#methodCoverageInfo with:owningMethod.
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   507
    ].
2569
e9fcb54ac3d4 change notifications
Claus Gittinger <cg@exept.de>
parents: 2528
diff changeset
   508
2570
f0b8fc6cdabb change info
Claus Gittinger <cg@exept.de>
parents: 2569
diff changeset
   509
    "Modified: / 20-07-2011 / 17:55:49 / cg"
2571
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   510
    "Created: / 20-07-2011 / 18:59:01 / cg"
2359
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   511
! !
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   512
2390
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   513
!InstrumentingCompiler::StatementExecutionInfo methodsFor:'instrumentation calls'!
2359
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   514
2967
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   515
changeClassToAlreadyEntered
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   516
    self class == InstrumentingCompiler::StatementExecutionInfo ifTrue:[
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   517
        self changeClassTo: StatementExecutionInfoInAlreadyEnteredState
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   518
    ].
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   519
!
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   520
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   521
changeClassToCoverageAndAlreadyEntered
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   522
    self class == InstrumentingCompiler::StatementExecutionInfo ifTrue:[
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   523
        self changeClassTo: StatementExecutionInfoForCoverageInAlreadyEnteredState
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   524
    ].
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   525
!
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   526
2359
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   527
entry:callingContext
2528
e57cc8caf6f9 dont instrument the instrumentation code
Claus Gittinger <cg@exept.de>
parents: 2391
diff changeset
   528
    "invoked by instrumented code;
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   529
     called whenever the block/statment is entered"
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   530
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   531
    |context|
2359
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   532
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   533
    context := InstrumentationContext current.
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   534
    context isNil ifTrue:[^ self].
2960
8adc66fe55fb care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents: 2958
diff changeset
   535
    context inInstrumentedCode ifTrue:[^ self].
2711
63f9264d17f0 speedup for coverage-only
Claus Gittinger <cg@exept.de>
parents: 2675
diff changeset
   536
    context coverageOnly ifTrue:[
63f9264d17f0 speedup for coverage-only
Claus Gittinger <cg@exept.de>
parents: 2675
diff changeset
   537
        self hasBeenExecuted ifTrue:[^ self].
63f9264d17f0 speedup for coverage-only
Claus Gittinger <cg@exept.de>
parents: 2675
diff changeset
   538
    ].
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   539
    context enabledAndNotInInstrumentedCode ifFalse:[^ self].
2528
e57cc8caf6f9 dont instrument the instrumentation code
Claus Gittinger <cg@exept.de>
parents: 2391
diff changeset
   540
2359
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   541
    count := count + 1.
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   542
    count == 1 ifTrue:[
2960
8adc66fe55fb care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents: 2958
diff changeset
   543
        "/ 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
   544
2944
b0a2b03382fa fixes and tuning
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   545
        [
b0a2b03382fa fixes and tuning
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   546
            context inInstrumentedCode:true.
b0a2b03382fa fixes and tuning
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   547
            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
   548
            context coverageOnly ifTrue:[
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   549
                self changeClassToCoverageAndAlreadyEntered.
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   550
            ] ifFalse:[
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   551
                self changeClassToAlreadyEntered.
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   552
            ].
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   553
            "/ attention: no self sends here - class has changed!!
2944
b0a2b03382fa fixes and tuning
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   554
        ] ensure:[
b0a2b03382fa fixes and tuning
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   555
            context inInstrumentedCode:false.
b0a2b03382fa fixes and tuning
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   556
        ]
2359
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   557
    ].
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   558
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   559
    "Created: / 23-06-2006 / 13:31:16 / cg"
2711
63f9264d17f0 speedup for coverage-only
Claus Gittinger <cg@exept.de>
parents: 2675
diff changeset
   560
    "Modified: / 23-08-2011 / 21:29:39 / cg"
2359
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   561
! !
b70f2c9dddcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2357
diff changeset
   562
2390
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   563
!InstrumentingCompiler::StatementExecutionInfo methodsFor:'queries'!
2370
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   564
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   565
hasBeenExecuted
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   566
    ^ count > 0
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   567
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   568
    "Created: / 28-04-2010 / 14:39:46 / cg"
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   569
! !
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   570
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   571
!InstrumentingCompiler::StatementExecutionInfo methodsFor:'testing'!
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   572
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   573
isStatementExecutionInfo
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   574
    ^ true
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   575
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   576
    "Created: / 08-08-2011 / 14:40:51 / cg"
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   577
! !
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   578
2967
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   579
!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
   580
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   581
cleanInfoWithChange:withChange
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   582
    super cleanInfoWithChange:withChange.
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   583
    self changeClassTo:InstrumentingCompiler::StatementExecutionInfo.
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   584
! !
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   585
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   586
!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
   587
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   588
entry:callingContext
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   589
    "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
   590
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   591
    ^ self
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   592
! !
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   593
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   594
!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
   595
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   596
cleanInfoWithChange:withChange
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   597
    super cleanInfoWithChange:withChange.
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   598
    self changeClassTo:InstrumentingCompiler::StatementExecutionInfo.
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   599
! !
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   600
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   601
!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
   602
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   603
entry:callingContext
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   604
    "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
   605
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   606
    ^ self
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   607
! !
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   608
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   609
!InstrumentingCompiler::MethodInvocationInfo methodsFor:'accessing'!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   610
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   611
callingMethodsDo:aBlock
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   612
    infoPerReceiverClass notNil ifTrue:[
2949
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
   613
        infoPerReceiverClass ~~ true ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
   614
            infoPerReceiverClass do:[:each |
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
   615
                each callingMethodsDo:aBlock
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
   616
            ]
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   617
        ]
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   618
    ]
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   619
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   620
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   621
hasBeenCalled
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   622
    ^ infoPerReceiverClass notEmptyOrNil
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   623
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   624
    "Created: / 27-04-2010 / 13:43:15 / cg"
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   625
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   626
2368
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   627
invokedViaPerform
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   628
    ^ infoPerReceiverClass contains:[:someInfo | someInfo invokedViaPerform].
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   629
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   630
    "Created: / 27-04-2010 / 18:21:56 / cg"
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   631
!
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   632
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   633
invokingMethods
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   634
    |setOfMethods|
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   635
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   636
    setOfMethods := IdentitySet new.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   637
    self invokingMethodsDo:[:m | setOfMethods add:m].
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   638
    ^ setOfMethods.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   639
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   640
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   641
invokingMethodsDo:aBlock
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   642
    infoPerReceiverClass isNil ifTrue:[ ^ self].
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   643
    ^ infoPerReceiverClass do:[:eachInfo | eachInfo invokingMethodsDo:aBlock].
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   644
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   645
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   646
numberOfInvocations
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   647
    infoPerReceiverClass isNil ifTrue:[ ^ 0].
2951
340d0405f582 comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
   648
    infoPerReceiverClass == true ifTrue:[ ^ 0].
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   649
    ^ infoPerReceiverClass inject:0 into:[:sumSoFar :info | sumSoFar + info numberOfInvocations] 
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   650
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   651
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   652
numberOfInvocationsFromExternalOf:aClass
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   653
    |sum|
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   654
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   655
    infoPerReceiverClass isNil ifTrue:[ ^ 0].
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   656
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   657
    sum := 0.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   658
    infoPerReceiverClass keysAndValuesDo:[:recClass :info |
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   659
        sum := sum + (info numberOfInvocationsFromExternalOf:aClass)
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   660
    ]. 
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   661
    ^ sum
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   662
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   663
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   664
numberOfInvocationsFromInternalOf:aClass
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   665
    |sum|
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   666
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   667
    infoPerReceiverClass isNil ifTrue:[ ^ 0].
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   668
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   669
    sum := 0.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   670
    infoPerReceiverClass keysAndValuesDo:[:recClass :info |
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   671
        sum := sum + (info numberOfInvocationsFromInternalOf:aClass)
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   672
    ]. 
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   673
    ^ sum
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   674
! !
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   675
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   676
!InstrumentingCompiler::MethodInvocationInfo methodsFor:'cleanup'!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   677
2571
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   678
cleanInfoWithChange:withChange
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   679
    infoPerReceiverClass := nil.
2571
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   680
    withChange ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   681
        Smalltalk changed:#methodCoverageInfo with:owningMethod.
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   682
    ]
2569
e9fcb54ac3d4 change notifications
Claus Gittinger <cg@exept.de>
parents: 2528
diff changeset
   683
2570
f0b8fc6cdabb change info
Claus Gittinger <cg@exept.de>
parents: 2569
diff changeset
   684
    "Modified: / 20-07-2011 / 17:55:35 / cg"
2571
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   685
    "Created: / 20-07-2011 / 18:59:22 / cg"
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   686
! !
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   687
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   688
!InstrumentingCompiler::MethodInvocationInfo methodsFor:'instrumentation probe calls'!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   689
2967
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   690
changeClassToAlreadyEntered
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   691
    self class == InstrumentingCompiler::MethodInvocationInfo ifTrue:[
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   692
        self changeClassTo: InstrumentingCompiler::MethodInvocationInfoInAlreadyEnteredState
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   693
    ].
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   694
!
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   695
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   696
changeClassToCoverageAndAlreadyEntered
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   697
    self class == InstrumentingCompiler::MethodInvocationInfo ifTrue:[
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   698
        self changeClassTo: InstrumentingCompiler::MethodInvocationInfoForCoverageInAlreadyEnteredState
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   699
    ].
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   700
!
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   701
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   702
entry:aContext
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   703
    "invoked by instrumented compiled code, upon method entry"
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   704
2948
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   705
    |context receiversClass infoPerReceiver firstEntry coverageOnly|
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   706
2960
8adc66fe55fb care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents: 2958
diff changeset
   707
    recursiveEntry == true ifTrue:[
8adc66fe55fb care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents: 2958
diff changeset
   708
        "/ hurry, get out of here
8adc66fe55fb care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents: 2958
diff changeset
   709
    ].
8adc66fe55fb care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents: 2958
diff changeset
   710
8adc66fe55fb care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents: 2958
diff changeset
   711
    "/ 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
   712
    "/ 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
   713
    "/ 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
   714
    recursiveEntry := true.
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   715
    context := InstrumentationContext current.
2960
8adc66fe55fb care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents: 2958
diff changeset
   716
    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
   717
    context enabledAndNotInInstrumentedCode ifFalse:[recursiveEntry := false. ^ self].
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   718
2944
b0a2b03382fa fixes and tuning
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   719
    [
b0a2b03382fa fixes and tuning
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   720
        context inInstrumentedCode:true.
b0a2b03382fa fixes and tuning
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   721
2875
f7f46f53bc84 entry code tuned
Claus Gittinger <cg@exept.de>
parents: 2715
diff changeset
   722
        firstEntry := false.
f7f46f53bc84 entry code tuned
Claus Gittinger <cg@exept.de>
parents: 2715
diff changeset
   723
2948
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   724
        (coverageOnly := context coverageOnly) ifTrue:[
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   725
            "/ 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
   726
            "/ that is the normal coverage usage
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   727
            infoPerReceiverClass isNil ifTrue:[
2949
Claus Gittinger <cg@exept.de>
parents: 2948
diff changeset
   728
                infoPerReceiverClass := true.
2948
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   729
                firstEntry := true.
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   730
            ].
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   731
        ] ifFalse:[
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   732
            "/ 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
   733
            "/ that is used by the OOM package
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   734
            infoPerReceiverClass isNil ifTrue:[
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   735
                infoPerReceiverClass := IdentityDictionary new.
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   736
                firstEntry := true.
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   737
            ].
2944
b0a2b03382fa fixes and tuning
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   738
            receiversClass := aContext receiver class.
b0a2b03382fa fixes and tuning
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   739
            infoPerReceiver := infoPerReceiverClass 
b0a2b03382fa fixes and tuning
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   740
                                        at:receiversClass 
b0a2b03382fa fixes and tuning
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   741
                                        ifAbsentPut:[MethodInvocationInfoPerReceiverClass new].
b0a2b03382fa fixes and tuning
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   742
            infoPerReceiver entry:aContext.
b0a2b03382fa fixes and tuning
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   743
        ].
2569
e9fcb54ac3d4 change notifications
Claus Gittinger <cg@exept.de>
parents: 2528
diff changeset
   744
2960
8adc66fe55fb care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents: 2958
diff changeset
   745
        "/ 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
   746
        firstEntry ifTrue:[
b0a2b03382fa fixes and tuning
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   747
            Smalltalk changed:#methodCoverageInfo with:owningMethod.
b0a2b03382fa fixes and tuning
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   748
        ].
2948
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   749
        coverageOnly ifTrue:[
2967
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   750
            self changeClassToCoverageAndAlreadyEntered.
2948
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   751
        ] ifFalse:[
2967
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   752
            self changeClassToAlreadyEntered.
2948
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   753
        ].
2967
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   754
        "/ attention: no self sends here - class has changed!!
2944
b0a2b03382fa fixes and tuning
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   755
    ] ensure:[
b0a2b03382fa fixes and tuning
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   756
        context inInstrumentedCode:false.
2960
8adc66fe55fb care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents: 2958
diff changeset
   757
        recursiveEntry := false.
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   758
    ].
2528
e57cc8caf6f9 dont instrument the instrumentation code
Claus Gittinger <cg@exept.de>
parents: 2391
diff changeset
   759
2960
8adc66fe55fb care for recursive entry (instrumenting code which is needed
Claus Gittinger <cg@exept.de>
parents: 2958
diff changeset
   760
    "Modified (comment): / 26-10-2012 / 12:59:44 / cg"
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   761
! !
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   762
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   763
!InstrumentingCompiler::MethodInvocationInfo methodsFor:'testing'!
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   764
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   765
isMethodInvocationInfo
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   766
    ^ true
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   767
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   768
    "Created: / 08-08-2011 / 14:37:58 / cg"
2357
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::MethodInvocationInfoPerReceiverClass methodsFor:'accessing'!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   772
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   773
callingMethodsDo:aBlock
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   774
    infoPerSendingMethod keysAndValuesDo:[:m :eachInfo |
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   775
        aBlock value:m
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   776
    ]
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   777
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   778
2368
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   779
invokedViaPerform
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   780
    ^ infoPerSendingMethod contains:[:someInfo | someInfo invokedViaPerform].
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   781
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   782
    "Created: / 27-04-2010 / 18:21:36 / cg"
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   783
!
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   784
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   785
invokingMethodsDo:aBlock
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   786
    infoPerSendingMethod isNil ifTrue:[ ^ self].
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   787
    ^ infoPerSendingMethod keysDo:aBlock.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   788
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   789
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   790
numberOfInvocations
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   791
    infoPerSendingMethod isNil ifTrue:[ ^ 0].
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   792
    ^ infoPerSendingMethod inject:0 into:[:sumSoFar :info | sumSoFar + info numberOfInvocations] 
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   793
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   794
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   795
numberOfInvocationsFromExternalOf:aClass
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   796
    |sum|
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   797
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   798
    infoPerSendingMethod isNil ifTrue:[ ^ 0].
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   799
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   800
    sum := 0.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   801
    infoPerSendingMethod keysAndValuesDo:[:sendingMethod :info |
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   802
        |sendingMethodsClass|
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   803
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   804
        sendingMethodsClass := sendingMethod mclass.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   805
        sendingMethodsClass notNil ifTrue:[
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   806
            ((sendingMethodsClass isSubclassOf:aClass) 
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   807
            or:[(aClass isSubclassOf:sendingMethodsClass )]) ifFalse:[
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   808
                sum := sum + (info numberOfInvocations)
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   809
            ]
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   810
        ]
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   811
    ]. 
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   812
    ^ sum
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   813
!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   814
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   815
numberOfInvocationsFromInternalOf:aClass
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   816
    |sum|
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   817
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   818
    infoPerSendingMethod isNil ifTrue:[ ^ 0].
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   819
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   820
    sum := 0.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   821
    infoPerSendingMethod keysAndValuesDo:[:sendingMethod :info |
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   822
        |sendingMethodsClass|
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   823
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   824
        sendingMethodsClass := sendingMethod mclass.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   825
        sendingMethodsClass notNil ifTrue:[
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   826
            ((sendingMethodsClass isSubclassOf:aClass) 
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   827
            or:[(aClass isSubclassOf:sendingMethodsClass)]) ifTrue:[
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   828
                sum := sum + (info numberOfInvocations)
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   829
            ]
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   830
        ]
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   831
    ]. 
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   832
    ^ sum
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   833
! !
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   834
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   835
!InstrumentingCompiler::MethodInvocationInfo::MethodInvocationInfoPerReceiverClass methodsFor:'instrumentation calls'!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   836
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   837
entry:aContext
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   838
    "invoked by instrumented compiled code, upon method entry"
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   839
2368
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   840
    |sender sendingMethod infoPerMethod viaPerform|
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   841
2391
2bd90c14cd75 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2390
diff changeset
   842
    aContext selector == #doesNotUnderstand: ifTrue:[
2bd90c14cd75 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2390
diff changeset
   843
        sender := aContext sender sender methodHome.
2bd90c14cd75 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2390
diff changeset
   844
    ] ifFalse:[
2bd90c14cd75 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2390
diff changeset
   845
        sender := aContext sender methodHome.
2bd90c14cd75 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2390
diff changeset
   846
    ].
2370
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   847
    sender isNil ifTrue:[
a801cc4df234 added: #blockNodeRewriteHookFor:
Claus Gittinger <cg@exept.de>
parents: 2368
diff changeset
   848
        ^ self.
2569
e9fcb54ac3d4 change notifications
Claus Gittinger <cg@exept.de>
parents: 2528
diff changeset
   849
    ].
e9fcb54ac3d4 change notifications
Claus Gittinger <cg@exept.de>
parents: 2528
diff changeset
   850
    sendingMethod := sender method.
e9fcb54ac3d4 change notifications
Claus Gittinger <cg@exept.de>
parents: 2528
diff changeset
   851
    sendingMethod isNil ifTrue:[^ self].
2391
2bd90c14cd75 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2390
diff changeset
   852
2569
e9fcb54ac3d4 change notifications
Claus Gittinger <cg@exept.de>
parents: 2528
diff changeset
   853
    viaPerform := false.
e9fcb54ac3d4 change notifications
Claus Gittinger <cg@exept.de>
parents: 2528
diff changeset
   854
    (sendingMethod mclass == Object 
e9fcb54ac3d4 change notifications
Claus Gittinger <cg@exept.de>
parents: 2528
diff changeset
   855
    and:[ sendingMethod selector startsWith:'perform:'] ) ifTrue:[
e9fcb54ac3d4 change notifications
Claus Gittinger <cg@exept.de>
parents: 2528
diff changeset
   856
        "/ Transcript showCR:('%1 [info]: skipping #perform' bindWith:self class nameWithoutPrefix).
e9fcb54ac3d4 change notifications
Claus Gittinger <cg@exept.de>
parents: 2528
diff changeset
   857
        sender := sender sender methodHome.
e9fcb54ac3d4 change notifications
Claus Gittinger <cg@exept.de>
parents: 2528
diff changeset
   858
        sendingMethod := sender method.
e9fcb54ac3d4 change notifications
Claus Gittinger <cg@exept.de>
parents: 2528
diff changeset
   859
        viaPerform := true.
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   860
    ].
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   861
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   862
    infoPerSendingMethod isNil ifTrue:[
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   863
        infoPerSendingMethod := IdentityDictionary new.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   864
    ].
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   865
    infoPerMethod := infoPerSendingMethod 
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   866
                        at:sendingMethod 
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   867
                        ifAbsentPut:[ MethodInvocationInfoPerSendingMethod new ].
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   868
2368
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   869
    infoPerMethod entry:aContext viaPerform:viaPerform
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   870
2569
e9fcb54ac3d4 change notifications
Claus Gittinger <cg@exept.de>
parents: 2528
diff changeset
   871
    "Modified: / 20-07-2011 / 17:26:31 / cg"
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   872
! !
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   873
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   874
!InstrumentingCompiler::MethodInvocationInfo::MethodInvocationInfoPerReceiverClass::MethodInvocationInfoPerSendingMethod methodsFor:'accessing'!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   875
2368
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   876
invokedViaPerform
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   877
    ^ invokedViaPerform ? false
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   878
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   879
    "Created: / 27-04-2010 / 18:20:05 / cg"
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   880
!
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   881
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   882
numberOfInvocations
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   883
    countPerSendersClass isNil ifTrue:[ ^ 0].
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   884
    ^ countPerSendersClass inject:0 into:[:sumSoFar :count | sumSoFar + count] 
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   885
! !
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   886
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   887
!InstrumentingCompiler::MethodInvocationInfo::MethodInvocationInfoPerReceiverClass::MethodInvocationInfoPerSendingMethod methodsFor:'instrumentation calls'!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   888
2368
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   889
entry:aContext viaPerform:viaPerformBoolean
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   890
    "invoked by instrumented compiled code, upon method entry"
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   891
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   892
    |sendersClass count|
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   893
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   894
    sendersClass := aContext sender receiver class.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   895
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   896
    countPerSendersClass isNil ifTrue:[
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   897
        countPerSendersClass := IdentityDictionary new.
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   898
    ].
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   899
    count := countPerSendersClass at:sendersClass ifAbsentPut:0.
2368
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   900
    countPerSendersClass at:sendersClass put:(count + 1).
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   901
    viaPerformBoolean ifTrue:[ invokedViaPerform := true ].
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   902
e48d46439c08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2359
diff changeset
   903
    "Created: / 27-04-2010 / 18:17:27 / cg"
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   904
! !
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   905
2948
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   906
!InstrumentingCompiler::MethodInvocationInfoForCoverageInAlreadyEnteredState methodsFor:'cleanup'!
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   907
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   908
cleanInfoWithChange:withChange
2967
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   909
    super cleanInfoWithChange:withChange.
2948
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   910
    self changeClassTo:InstrumentingCompiler::MethodInvocationInfo.
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   911
! !
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   912
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   913
!InstrumentingCompiler::MethodInvocationInfoForCoverageInAlreadyEnteredState methodsFor:'instrumentation probe calls'!
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   914
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   915
entry:aContext
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   916
    "already been invoked - nothing to record"
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   917
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   918
    ^ self
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   919
! !
1af0db8d9945 entry fix and speedup
Claus Gittinger <cg@exept.de>
parents: 2946
diff changeset
   920
2711
63f9264d17f0 speedup for coverage-only
Claus Gittinger <cg@exept.de>
parents: 2675
diff changeset
   921
!InstrumentingCompiler::MethodInvocationInfoInAlreadyEnteredState methodsFor:'cleanup'!
63f9264d17f0 speedup for coverage-only
Claus Gittinger <cg@exept.de>
parents: 2675
diff changeset
   922
63f9264d17f0 speedup for coverage-only
Claus Gittinger <cg@exept.de>
parents: 2675
diff changeset
   923
cleanInfoWithChange:withChange
2967
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   924
    super cleanInfoWithChange:withChange.
2711
63f9264d17f0 speedup for coverage-only
Claus Gittinger <cg@exept.de>
parents: 2675
diff changeset
   925
    self changeClassTo:InstrumentingCompiler::MethodInvocationInfo.
63f9264d17f0 speedup for coverage-only
Claus Gittinger <cg@exept.de>
parents: 2675
diff changeset
   926
63f9264d17f0 speedup for coverage-only
Claus Gittinger <cg@exept.de>
parents: 2675
diff changeset
   927
    "Modified: / 20-07-2011 / 17:55:35 / cg"
63f9264d17f0 speedup for coverage-only
Claus Gittinger <cg@exept.de>
parents: 2675
diff changeset
   928
    "Created: / 24-08-2011 / 11:10:29 / cg"
63f9264d17f0 speedup for coverage-only
Claus Gittinger <cg@exept.de>
parents: 2675
diff changeset
   929
! !
63f9264d17f0 speedup for coverage-only
Claus Gittinger <cg@exept.de>
parents: 2675
diff changeset
   930
2715
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   931
!InstrumentingCompiler::VariableAccessExecutionInfo class methodsFor:'documentation'!
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   932
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   933
documentation
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   934
"
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   935
    (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
   936
"
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   937
! !
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   938
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   939
!InstrumentingCompiler::BlockExecutionInfo class methodsFor:'documentation'!
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   940
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   941
documentation
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   942
"
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   943
    (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
   944
"
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   945
! !
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   946
2390
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   947
!InstrumentingCompiler::BlockExecutionInfo methodsFor:'accessing'!
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   948
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   949
endPosition
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   950
    ^ endPosition
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   951
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   952
    "Created: / 28-04-2010 / 15:57:14 / cg"
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   953
!
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   954
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   955
startPosition:startArg endPosition:endArg
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   956
    startPosition := startArg.
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   957
    endPosition := endArg.
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   958
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   959
    "Created: / 28-04-2010 / 15:54:47 / cg"
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   960
! !
cada66e1eb70 changed:
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
   961
2967
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   962
!InstrumentingCompiler::BlockExecutionInfo methodsFor:'entry'!
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   963
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   964
changeClassToAlreadyEntered
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   965
    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
   966
        self changeClassTo: BlockExecutionInfoInAlreadyEnteredState
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   967
    ].
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   968
!
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   969
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   970
changeClassToCoverageAndAlreadyEntered
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   971
    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
   972
        self changeClassTo: BlockExecutionInfoForCoverageInAlreadyEnteredState
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   973
    ].
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   974
! !
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   975
2675
3e8368ea406e comment/format in: #addBlockCounterTo:
Claus Gittinger <cg@exept.de>
parents: 2665
diff changeset
   976
!InstrumentingCompiler::BlockExecutionInfo methodsFor:'printing'!
3e8368ea406e comment/format in: #addBlockCounterTo:
Claus Gittinger <cg@exept.de>
parents: 2665
diff changeset
   977
3e8368ea406e comment/format in: #addBlockCounterTo:
Claus Gittinger <cg@exept.de>
parents: 2665
diff changeset
   978
printOn:aStream 
3e8368ea406e comment/format in: #addBlockCounterTo:
Claus Gittinger <cg@exept.de>
parents: 2665
diff changeset
   979
    aStream nextPutAll:'['.
3e8368ea406e comment/format in: #addBlockCounterTo:
Claus Gittinger <cg@exept.de>
parents: 2665
diff changeset
   980
    startPosition printOn:aStream.
3e8368ea406e comment/format in: #addBlockCounterTo:
Claus Gittinger <cg@exept.de>
parents: 2665
diff changeset
   981
    aStream nextPutAll:'...'.
3e8368ea406e comment/format in: #addBlockCounterTo:
Claus Gittinger <cg@exept.de>
parents: 2665
diff changeset
   982
    endPosition printOn:aStream.
3e8368ea406e comment/format in: #addBlockCounterTo:
Claus Gittinger <cg@exept.de>
parents: 2665
diff changeset
   983
    aStream nextPutAll:']'.
3e8368ea406e comment/format in: #addBlockCounterTo:
Claus Gittinger <cg@exept.de>
parents: 2665
diff changeset
   984
3e8368ea406e comment/format in: #addBlockCounterTo:
Claus Gittinger <cg@exept.de>
parents: 2665
diff changeset
   985
    "Created: / 21-08-2011 / 14:02:01 / cg"
3e8368ea406e comment/format in: #addBlockCounterTo:
Claus Gittinger <cg@exept.de>
parents: 2665
diff changeset
   986
! !
3e8368ea406e comment/format in: #addBlockCounterTo:
Claus Gittinger <cg@exept.de>
parents: 2665
diff changeset
   987
2632
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   988
!InstrumentingCompiler::BlockExecutionInfo methodsFor:'testing'!
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   989
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   990
isBlockExecutionInfo
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   991
    ^ true
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   992
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   993
    "Created: / 07-08-2011 / 17:06:39 / cg"
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   994
! !
734313b470d3 refactoring
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   995
2967
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   996
!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
   997
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   998
cleanInfoWithChange:withChange
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
   999
    super cleanInfoWithChange:withChange.
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1000
    self changeClassTo:InstrumentingCompiler::BlockExecutionInfo.
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1001
! !
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1002
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1003
!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
  1004
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1005
entry:callingContext
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1006
    "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
  1007
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1008
    ^ self
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1009
! !
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1010
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1011
!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
  1012
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1013
cleanInfoWithChange:withChange
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1014
    super cleanInfoWithChange:withChange.
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1015
    self changeClassTo:InstrumentingCompiler::BlockExecutionInfo.
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1016
! !
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1017
2715
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1018
!InstrumentingCompiler::ReadAccessExecutionInfo class methodsFor:'documentation'!
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1019
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1020
documentation
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1021
"
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1022
    (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
  1023
"
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1024
! !
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1025
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1026
!InstrumentingCompiler::WriteAccessExecutionInfo class methodsFor:'documentation'!
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1027
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1028
documentation
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1029
"
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1030
    (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
  1031
"
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1032
! !
10a744f8ce68 comments
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1033
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1034
!InstrumentingCompiler class methodsFor:'documentation'!
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1035
2570
f0b8fc6cdabb change info
Claus Gittinger <cg@exept.de>
parents: 2569
diff changeset
  1036
version
2967
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1037
    ^ '$Header: /cvs/stx/stx/libcomp/InstrumentingCompiler.st,v 1.26 2012-11-01 11:11:33 cg Exp $'
2570
f0b8fc6cdabb change info
Claus Gittinger <cg@exept.de>
parents: 2569
diff changeset
  1038
!
f0b8fc6cdabb change info
Claus Gittinger <cg@exept.de>
parents: 2569
diff changeset
  1039
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1040
version_CVS
2967
33ec78ee2aa9 tuning by changing the class to speedup entry into already
Claus Gittinger <cg@exept.de>
parents: 2960
diff changeset
  1041
    ^ '$Header: /cvs/stx/stx/libcomp/InstrumentingCompiler.st,v 1.26 2012-11-01 11:11:33 cg Exp $'
2357
9eceec36beca initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1042
! !