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