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