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