author | Claus Gittinger <cg@exept.de> |
Sun, 24 May 2020 03:18:13 +0200 | |
changeset 4670 | 4ec715f14ddd |
parent 4622 | d39fbcb89f9c |
permissions | -rw-r--r-- |
4622 | 1 |
"{ Encoding: utf8 }" |
2 |
||
2355 | 3 |
" |
4 |
COPYRIGHT (c) 2010 by eXept Software AG |
|
5 |
All Rights Reserved |
|
6 |
||
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
14 |
"{ Package: 'stx:libcomp' }" |
|
15 |
||
3558 | 16 |
"{ NameSpace: Smalltalk }" |
17 |
||
2355 | 18 |
Method variableSubclass:#InstrumentedMethod |
19 |
instanceVariableNames:'' |
|
20 |
classVariableNames:'' |
|
21 |
poolDictionaries:'' |
|
22 |
category:'System-Compiler-Instrumentation' |
|
23 |
! |
|
24 |
||
25 |
!InstrumentedMethod class methodsFor:'documentation'! |
|
26 |
||
27 |
copyright |
|
28 |
" |
|
29 |
COPYRIGHT (c) 2010 by eXept Software AG |
|
30 |
All Rights Reserved |
|
31 |
||
32 |
This software is furnished under a license and may be used |
|
33 |
only in accordance with the terms of that license and with the |
|
34 |
inclusion of the above copyright notice. This software may not |
|
35 |
be provided or otherwise made available to, or used by, any |
|
36 |
other person. No title to or ownership of the software is |
|
37 |
hereby transferred. |
|
38 |
" |
|
39 |
! |
|
40 |
||
41 |
documentation |
|
42 |
" |
|
43 |
Instances of me are created by the instrumenting compiler. |
|
44 |
||
45 |
[author:] |
|
46 |
Claus Gittinger |
|
47 |
" |
|
48 |
! ! |
|
49 |
||
2367 | 50 |
!InstrumentedMethod class methodsFor:'cleanup'! |
51 |
||
2572 | 52 |
cleanAllInfoWithChange:withChange |
2707
f9eb45d7729d
changed: #cleanAllInfoWithChange:
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
53 |
InstrumentationInfo cleanAllInfoWithChange:withChange |
2367 | 54 |
|
2572 | 55 |
"Created: / 20-07-2011 / 19:01:21 / cg" |
2367 | 56 |
! ! |
57 |
||
2358 | 58 |
!InstrumentedMethod methodsFor:'accessing'! |
59 |
||
60 |
blockInvocationInfo |
|
2631 | 61 |
"return a collection of all block-info objects" |
62 |
||
2358 | 63 |
|info| |
64 |
||
65 |
info := OrderedCollection new. |
|
2631 | 66 |
self literalsDo:[:lit | |
2978 | 67 |
(lit isSpecialInstrumentationInfoLiteral |
68 |
and:[ lit isBlockExecutionInfo ]) ifTrue:[ |
|
69 |
info add:lit |
|
2358 | 70 |
] |
71 |
]. |
|
72 |
^ info |
|
73 |
||
74 |
"Created: / 27-04-2010 / 13:47:21 / cg" |
|
2631 | 75 |
"Modified: / 07-08-2011 / 17:05:02 / cg" |
2358 | 76 |
! |
77 |
||
2367 | 78 |
invokedViaPerform |
79 |
"true if the method is ever invoked via perform" |
|
80 |
||
81 |
|info| |
|
82 |
||
83 |
info := self methodInvocationInfo. |
|
84 |
^ info notNil and:[info invokedViaPerform] |
|
85 |
||
86 |
"Created: / 27-04-2010 / 18:23:10 / cg" |
|
87 |
! |
|
88 |
||
2358 | 89 |
methodInvocationInfo |
2978 | 90 |
"return the one and only method-invocatin info" |
2631 | 91 |
|
92 |
^ self |
|
2978 | 93 |
literalsDetect:[:lit | |
94 |
lit isSpecialInstrumentationInfoLiteral |
|
95 |
and:[ lit isMethodInvocationInfo]] |
|
2631 | 96 |
ifNone:nil |
2358 | 97 |
|
98 |
"Created: / 27-04-2010 / 13:34:01 / cg" |
|
2389 | 99 |
! |
100 |
||
101 |
statementInvocationInfo |
|
2978 | 102 |
"return all statement infos (but not block infos)" |
2725
86bbe6e76648
comment/format in: #statementInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
2707
diff
changeset
|
103 |
|
2389 | 104 |
|info| |
105 |
||
106 |
info := OrderedCollection new. |
|
107 |
self literalsDo:[:lit | |
|
2978 | 108 |
(lit isSpecialInstrumentationInfoLiteral |
109 |
and:[ lit isStatementExecutionInfo |
|
110 |
and:[ lit isBlockExecutionInfo not]]) ifTrue:[ |
|
2389 | 111 |
info add:lit |
112 |
] |
|
113 |
]. |
|
114 |
^ info |
|
2725
86bbe6e76648
comment/format in: #statementInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
2707
diff
changeset
|
115 |
|
86bbe6e76648
comment/format in: #statementInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
2707
diff
changeset
|
116 |
"Modified (comment): / 30-09-2011 / 12:05:06 / cg" |
2358 | 117 |
! ! |
118 |
||
3558 | 119 |
!InstrumentedMethod methodsFor:'cleanup'! |
120 |
||
121 |
cleanInstrumentationInfoWithChange:doChangeNotifications |
|
122 |
^ self |
|
123 |
literalsDo:[:lit | |
|
124 |
lit isSpecialInstrumentationInfoLiteral ifTrue:[ |
|
125 |
lit cleanInfoWithChange:doChangeNotifications |
|
126 |
] |
|
127 |
]. |
|
128 |
! ! |
|
129 |
||
2355 | 130 |
!InstrumentedMethod methodsFor:'queries'! |
131 |
||
2358 | 132 |
hasBeenCalled |
2950 | 133 |
"return true, if I have been called" |
134 |
||
2358 | 135 |
|info| |
136 |
||
137 |
^ (info := self methodInvocationInfo) notNil |
|
138 |
and:[ info hasBeenCalled ] |
|
139 |
||
140 |
"Created: / 27-04-2010 / 13:03:33 / cg" |
|
141 |
! |
|
142 |
||
143 |
haveAllBlocksBeenExecuted |
|
2950 | 144 |
"return true if all of my blocks have been called" |
145 |
||
2358 | 146 |
^ self blockInvocationInfo conform:[:eachBlockInfo | eachBlockInfo callCount > 0] |
147 |
||
148 |
"Modified: / 27-04-2010 / 13:44:46 / cg" |
|
149 |
! |
|
150 |
||
2355 | 151 |
isInstrumented |
4622 | 152 |
"return true, if this is an instrumented method." |
153 |
||
2355 | 154 |
^ true |
155 |
||
156 |
"Created: / 27-04-2010 / 12:25:39 / cg" |
|
157 |
! ! |
|
158 |
||
159 |
!InstrumentedMethod class methodsFor:'documentation'! |
|
160 |
||
161 |
version_CVS |
|
4622 | 162 |
^ '$Header$' |
2355 | 163 |
! ! |
3558 | 164 |