author | Marcel Hlopko <marcel.hlopko@gmail.com> |
Tue, 08 Oct 2013 19:02:01 +0200 | |
branch | development |
changeset 2817 | 96f3e2254489 |
parent 2757 | 66f842986836 |
child 2976 | a384a02381c0 |
permissions | -rw-r--r-- |
454 | 1 |
" |
2151 | 2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
3 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
4 |
New code and modifications done at SWING Research Group [1]: |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
5 |
|
2151 | 6 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
7 |
SWING Research Group, Czech Technical University in Prague |
454 | 8 |
|
9 |
This software is furnished under a license and may be used |
|
10 |
only in accordance with the terms of that license and with the |
|
11 |
inclusion of the above copyright notice. This software may not |
|
12 |
be provided or otherwise made available to, or used by, any |
|
13 |
other person. No title to or ownership of the software is |
|
14 |
hereby transferred. |
|
2151 | 15 |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
16 |
[1] Code written at SWING Research Group contains a signature |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
17 |
of one of the above copright owners. For exact set of such code, |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
18 |
see the differences between this version and version stx:libjava |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
19 |
as of 1.9.2010 |
2151 | 20 |
" |
713 | 21 |
"{ Package: 'stx:libjava' }" |
22 |
||
2678
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
23 |
Array variableSubclass:#JavaConstantPool |
89 | 24 |
instanceVariableNames:'owner' |
2817
96f3e2254489
remove JavaConstantPool#ConstantPools weak array, use JavaVM registry instead
Marcel Hlopko <marcel.hlopko@gmail.com>
parents:
2757
diff
changeset
|
25 |
classVariableNames:'' |
89 | 26 |
poolDictionaries:'' |
713 | 27 |
category:'Languages-Java-Reader-Support' |
89 | 28 |
! |
29 |
||
454 | 30 |
!JavaConstantPool class methodsFor:'documentation'! |
31 |
||
32 |
copyright |
|
33 |
" |
|
2151 | 34 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
35 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
36 |
New code and modifications done at SWING Research Group [1]: |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
37 |
|
2151 | 38 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
39 |
SWING Research Group, Czech Technical University in Prague |
454 | 40 |
|
41 |
This software is furnished under a license and may be used |
|
42 |
only in accordance with the terms of that license and with the |
|
43 |
inclusion of the above copyright notice. This software may not |
|
44 |
be provided or otherwise made available to, or used by, any |
|
45 |
other person. No title to or ownership of the software is |
|
46 |
hereby transferred. |
|
2151 | 47 |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
48 |
[1] Code written at SWING Research Group contains a signature |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
49 |
of one of the above copright owners. For exact set of such code, |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
50 |
see the differences between this version and version stx:libjava |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
51 |
as of 1.9.2010 |
2151 | 52 |
|
454 | 53 |
" |
2151 | 54 |
! ! |
55 |
||
243 | 56 |
!JavaConstantPool class methodsFor:'special'! |
57 |
||
2151 | 58 |
invalidateForClass: internalJavaClassName |
59 |
"Go over all constant pools and call invalidateForClass on all |
|
60 |
references. (usable when given class was unloaded etc)" |
|
2817
96f3e2254489
remove JavaConstantPool#ConstantPools weak array, use JavaVM registry instead
Marcel Hlopko <marcel.hlopko@gmail.com>
parents:
2757
diff
changeset
|
61 |
JavaVM registry classesDo: [ :eachClass | |
96f3e2254489
remove JavaConstantPool#ConstantPools weak array, use JavaVM registry instead
Marcel Hlopko <marcel.hlopko@gmail.com>
parents:
2757
diff
changeset
|
62 |
eachClass versionsArray do: [ :eachVersion | |
96f3e2254489
remove JavaConstantPool#ConstantPools weak array, use JavaVM registry instead
Marcel Hlopko <marcel.hlopko@gmail.com>
parents:
2757
diff
changeset
|
63 |
eachVersion constantPool invalidateForClass: internalJavaClassName. |
96f3e2254489
remove JavaConstantPool#ConstantPools weak array, use JavaVM registry instead
Marcel Hlopko <marcel.hlopko@gmail.com>
parents:
2757
diff
changeset
|
64 |
]. |
96f3e2254489
remove JavaConstantPool#ConstantPools weak array, use JavaVM registry instead
Marcel Hlopko <marcel.hlopko@gmail.com>
parents:
2757
diff
changeset
|
65 |
]. |
243 | 66 |
|
2757
66f842986836
cleanup multiple Java class versions handling
Marcel Hlopko <marcel.hlopko@gmail.com>
parents:
2755
diff
changeset
|
67 |
"Created: / 08-04-2011 / 16:52:52 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
2817
96f3e2254489
remove JavaConstantPool#ConstantPools weak array, use JavaVM registry instead
Marcel Hlopko <marcel.hlopko@gmail.com>
parents:
2757
diff
changeset
|
68 |
"Modified (format): / 08-10-2013 / 18:43:59 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>" |
243 | 69 |
! ! |
70 |
||
89 | 71 |
!JavaConstantPool methodsFor:'accessing'! |
72 |
||
73 |
owner |
|
74 |
"return owner" |
|
75 |
||
76 |
^ owner |
|
77 |
||
78 |
"Created: 28.6.1996 / 21:12:22 / cg" |
|
79 |
! |
|
80 |
||
81 |
owner:something |
|
82 |
"set owner" |
|
83 |
||
84 |
owner := something. |
|
85 |
||
86 |
"Created: 28.6.1996 / 21:12:22 / cg" |
|
87 |
! ! |
|
88 |
||
2151 | 89 |
!JavaConstantPool methodsFor:'adding'! |
90 |
||
91 |
at: classRefIndex putClassRefWithNameAt: classNameIndex |
|
92 |
self at: classRefIndex |
|
93 |
put: (JavaClassRef2 in: self withNameAt: classNameIndex). |
|
94 |
||
95 |
"Created: / 13-05-2011 / 09:48:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
96 |
! |
|
97 |
||
98 |
at: fieldRefIndex putFieldRefWithClassAt: classRefIndex andNameAndTypeAt: nameAndTypeIndex |
|
99 |
self at: fieldRefIndex |
|
100 |
put: (JavaFieldRef2 |
|
101 |
in: self |
|
102 |
withNameAndTypeAt: nameAndTypeIndex |
|
103 |
andClassAt: classRefIndex). |
|
104 |
||
105 |
"Created: / 13-05-2011 / 09:08:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
106 |
! |
|
107 |
||
108 |
at: interfaceMethodRefIndex putInterfaceMethodRefWithClassAt: classRefIndex andNameAndTypeAt: nameAndTypeIndex |
|
109 |
self at: interfaceMethodRefIndex |
|
110 |
put: (JavaInterfaceMethodRef2 |
|
111 |
in: self |
|
112 |
withNameAndTypeAt: nameAndTypeIndex |
|
113 |
andClassAt: classRefIndex). |
|
114 |
||
115 |
"Created: / 13-05-2011 / 09:08:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
116 |
! |
|
117 |
||
118 |
at: methodRefIndex putMethodRefWithClassAt: classRefIndex andNameAndTypeAt: nameAndTypeIndex |
|
119 |
self at: methodRefIndex |
|
120 |
put: (JavaMethodRef2 in: self withNameAndTypeAt: nameAndTypeIndex andClassAt:classRefIndex). |
|
121 |
||
122 |
"Created: / 13-05-2011 / 09:07:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
123 |
! |
|
124 |
||
125 |
at: nameAndTypeIndex putNameAndTypeWithNameAt: nameIndex andDescriptorAt: descriptorIndex |
|
126 |
self at: nameAndTypeIndex |
|
127 |
put: (JavaNameAndType2 in: self withNameAt: nameIndex andDescriptorAt: descriptorIndex). |
|
128 |
||
129 |
"Created: / 13-05-2011 / 09:05:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
130 |
! ! |
|
131 |
||
132 |
||
89 | 133 |
!JavaConstantPool methodsFor:'printing & storing'! |
134 |
||
135 |
displayString |
|
136 |
owner isNil ifTrue:[ |
|
137 |
^ '*** unowned ConstantPool' |
|
138 |
]. |
|
139 |
^ 'ConstantPool of ' , owner fullName |
|
140 |
||
141 |
"Created: 28.6.1996 / 21:13:41 / cg" |
|
142 |
"Modified: 28.6.1996 / 21:20:26 / cg" |
|
143 |
! ! |
|
144 |
||
171 | 145 |
!JavaConstantPool methodsFor:'queries'! |
146 |
||
147 |
refersToMethod:aJavaMethod |
|
2151 | 148 |
|
149 |
self error: 'JV@2011-07-26: Update to new resolving scheme!!'. |
|
150 |
||
171 | 151 |
self do:[:constItem | |
152 |
(constItem == aJavaMethod) ifTrue:[^ true]. |
|
2151 | 153 |
|
154 |
]. |
|
155 |
^ false |
|
156 |
||
157 |
"Created: / 29-07-1997 / 17:39:19 / cg" |
|
158 |
"Modified: / 26-07-2011 / 18:00:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
159 |
! |
|
160 |
||
161 |
refersToMethodNamed:aJavaMethodName |
|
162 |
||
163 |
self error: 'JV@2011-07-26: Update to new resolving scheme!!'. |
|
164 |
||
165 |
self do:[:constItem | |
|
166 |
(constItem isKindOf:JavaMethod) ifTrue:[ |
|
167 |
constItem name = aJavaMethodName ifTrue:[^ true]. |
|
168 |
] ifFalse:[ |
|
169 |
||
2108 | 170 |
] |
749 | 171 |
]. |
172 |
^ false |
|
173 |
||
2151 | 174 |
"Created: / 29-07-1997 / 17:39:24 / cg" |
175 |
"Modified: / 16-10-1998 / 01:22:02 / cg" |
|
176 |
"Modified: / 26-07-2011 / 17:54:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
171 | 177 |
! ! |
178 |
||
203 | 179 |
!JavaConstantPool methodsFor:'special'! |
180 |
||
252 | 181 |
classReferencesDo:aBlock |
182 |
self do:[:constItem | |
|
183 |
constItem isJavaClass ifTrue:[ |
|
184 |
aBlock value:constItem |
|
185 |
] |
|
186 |
] |
|
187 |
||
188 |
"Modified: / 7.8.1997 / 19:17:38 / cg" |
|
189 |
"Created: / 4.1.1998 / 00:40:11 / cg" |
|
190 |
! |
|
191 |
||
2151 | 192 |
invalidateAll |
193 |
"go over all entries and call invalidate on all references" |
|
194 |
||
195 |
self do: |
|
196 |
[:entry | |
|
197 |
entry isJavaRef |
|
198 |
ifTrue: [ entry invalidate] ]. |
|
199 |
||
200 |
"Created: / 13-05-2011 / 09:37:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
201 |
! |
|
202 |
||
203 | 203 |
updateClassRefsFrom:oldClass to:newClass |
206 | 204 |
owner == oldClass ifTrue:[ |
205 |
self halt. |
|
206 |
^ self |
|
207 |
]. |
|
208 |
||
203 | 209 |
self keysAndValuesDo:[:index :constItem | |
313 | 210 |
|nameIndex| |
211 |
||
203 | 212 |
constItem == oldClass ifTrue:[ |
213 |
self at:index put:newClass |
|
214 |
] ifFalse:[ |
|
206 | 215 |
(constItem isNil |
216 |
or:[constItem isNumber]) ifFalse:[ |
|
203 | 217 |
constItem isString ifTrue:[ |
218 |
"/ nothing done ... |
|
219 |
] ifFalse:[ |
|
220 |
(constItem isMemberOf:(Java java_lang_String)) ifTrue:[ |
|
221 |
"/ nothing done ... |
|
222 |
] ifFalse:[ |
|
206 | 223 |
constItem isBehavior ifFalse:[ |
203 | 224 |
constItem updateClassRefsFrom:oldClass to:newClass |
206 | 225 |
] ifTrue:[ |
226 |
constItem isJavaClass ifTrue:[ |
|
227 |
constItem fullName = oldClass fullName ifTrue:[ |
|
228 |
'JAVA: class update by name [in pool].' infoPrintCR. |
|
313 | 229 |
newClass isNil ifTrue:[ |
230 |
"/ mhm - must find a slot for the classes name |
|
231 |
nameIndex := -1. |
|
232 |
self |
|
233 |
at:index |
|
234 |
put:(JavaUnresolvedClassConstant |
|
235 |
pool:self |
|
236 |
poolIndex:index |
|
237 |
nameIndex:nameIndex) |
|
238 |
] ifFalse:[ |
|
239 |
self at:index put:newClass |
|
240 |
] |
|
206 | 241 |
] |
242 |
] |
|
203 | 243 |
] |
244 |
] |
|
245 |
] |
|
246 |
] |
|
247 |
] |
|
248 |
] |
|
249 |
||
313 | 250 |
"Modified: / 4.2.1998 / 22:12:03 / cg" |
203 | 251 |
! ! |
252 |
||
135 | 253 |
!JavaConstantPool class methodsFor:'documentation'! |
89 | 254 |
|
255 |
version |
|
2678
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
256 |
^ '$Header: /cvs/stx/stx/libjava/JavaConstantPool.st,v 1.20 2013-09-06 00:41:22 vrany Exp $' |
2213 | 257 |
! |
258 |
||
259 |
version_CVS |
|
2678
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
260 |
^ '$Header: /cvs/stx/stx/libjava/JavaConstantPool.st,v 1.20 2013-09-06 00:41:22 vrany Exp $' |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
261 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
262 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
263 |
version_HG |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
264 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
265 |
^ '$Changeset: <not expanded> $' |
2151 | 266 |
! |
267 |
||
268 |
version_SVN |
|
2731
13f5be2bf83b
Merged d87e89dd5276 and fe83a843a7bf (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
269 |
^ 'Id' |
89 | 270 |
! ! |
2151 | 271 |