author | Claus Gittinger <cg@exept.de> |
Wed, 26 Apr 2006 13:26:08 +0200 | |
changeset 1743 | 7cd4c5cd0510 |
parent 1614 | 894cf7de352c |
child 1767 | 0ed1d952d4dc |
permissions | -rw-r--r-- |
141 | 1 |
" |
2 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
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 |
" |
|
114 | 12 |
|
1080 | 13 |
"{ Package: 'stx:libcomp' }" |
14 |
||
114 | 15 |
Object subclass:#ObjectFileHandle |
259 | 16 |
instanceVariableNames:'sysHandle1 sysHandle2 pathName moduleID handleType weakMethodRef |
1163
242ec57c2f27
Remove object files that have been collected and not been used
Stefan Vogel <sv@exept.de>
parents:
1080
diff
changeset
|
17 |
weakClassRefs weakFunctionRefs snapshot' |
259 | 18 |
classVariableNames:'' |
19 |
poolDictionaries:'' |
|
20 |
category:'System-Compiler' |
|
120 | 21 |
! |
22 |
||
368 | 23 |
!ObjectFileHandle class methodsFor:'documentation'! |
120 | 24 |
|
141 | 25 |
copyright |
26 |
" |
|
27 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
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 |
" |
|
114 | 37 |
! |
38 |
||
120 | 39 |
documentation |
40 |
" |
|
123 | 41 |
not for public use - used by ObjectFileLoader to keep track of loaded modules, |
42 |
associating objectFile names and moduleIDs to classes/methods. |
|
299
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
43 |
This is required to be able to fixup classes, methods and function references |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
44 |
when an image is restarted and the dynamic objects are reloaded. |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
45 |
|
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
46 |
[see also:] |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
47 |
ExternalFunction |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
48 |
ObjectFileLoader |
263 | 49 |
|
50 |
[author:] |
|
51 |
Claus Gittinger |
|
120 | 52 |
" |
114 | 53 |
! ! |
54 |
||
1163
242ec57c2f27
Remove object files that have been collected and not been used
Stefan Vogel <sv@exept.de>
parents:
1080
diff
changeset
|
55 |
!ObjectFileHandle class methodsFor:'change & update'! |
242ec57c2f27
Remove object files that have been collected and not been used
Stefan Vogel <sv@exept.de>
parents:
1080
diff
changeset
|
56 |
|
242ec57c2f27
Remove object files that have been collected and not been used
Stefan Vogel <sv@exept.de>
parents:
1080
diff
changeset
|
57 |
preSnapshot |
242ec57c2f27
Remove object files that have been collected and not been used
Stefan Vogel <sv@exept.de>
parents:
1080
diff
changeset
|
58 |
"about to write a snapshot. |
242ec57c2f27
Remove object files that have been collected and not been used
Stefan Vogel <sv@exept.de>
parents:
1080
diff
changeset
|
59 |
Mark all the current instances as beeing snapshotted" |
242ec57c2f27
Remove object files that have been collected and not been used
Stefan Vogel <sv@exept.de>
parents:
1080
diff
changeset
|
60 |
|
242ec57c2f27
Remove object files that have been collected and not been used
Stefan Vogel <sv@exept.de>
parents:
1080
diff
changeset
|
61 |
self allInstancesDo:[:i| i snapshot:true]. |
242ec57c2f27
Remove object files that have been collected and not been used
Stefan Vogel <sv@exept.de>
parents:
1080
diff
changeset
|
62 |
! ! |
242ec57c2f27
Remove object files that have been collected and not been used
Stefan Vogel <sv@exept.de>
parents:
1080
diff
changeset
|
63 |
|
114 | 64 |
!ObjectFileHandle methodsFor:'accessing'! |
65 |
||
122 | 66 |
classes |
67 |
"return the classes" |
|
68 |
||
963
efa3aeb6859c
always return a collection from #functions and #classes
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
69 |
weakClassRefs isNil ifTrue:[^ #()]. |
122 | 70 |
^ weakClassRefs asArray |
71 |
||
72 |
"Created: 14.9.1995 / 21:13:13 / claus" |
|
73 |
! |
|
74 |
||
75 |
classes:aCollectionOfClasses |
|
76 |
"set the classes collection" |
|
77 |
||
78 |
weakClassRefs := WeakArray withAll:aCollectionOfClasses. |
|
151
7f46f760ba45
automatically unload modules for garbage collected methods/classes
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
79 |
weakClassRefs addDependent:self. |
122 | 80 |
handleType := #classLibraryObject |
81 |
||
82 |
"Created: 14.9.1995 / 21:13:13 / claus" |
|
83 |
! |
|
84 |
||
299
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
85 |
functions |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
86 |
"return the functions which were already extracted from the module." |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
87 |
|
963
efa3aeb6859c
always return a collection from #functions and #classes
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
88 |
weakFunctionRefs isNil ifTrue:[^ #()]. |
490
621a7283b926
oops - changeArg is #ElementExpired; changedObject is the one we have to
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
89 |
^ weakFunctionRefs asArray select:[:f | f notNil and:[f ~~ 0]] |
299
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
90 |
|
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
91 |
"Created: 12.7.1996 / 15:33:09 / cg" |
490
621a7283b926
oops - changeArg is #ElementExpired; changedObject is the one we have to
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
92 |
"Modified: 30.1.1997 / 20:54:54 / cg" |
299
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
93 |
! |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
94 |
|
967
160ab002eed1
support proper unregistration, when a classLib fails to load
Claus Gittinger <cg@exept.de>
parents:
963
diff
changeset
|
95 |
makeClassLibHandle |
160ab002eed1
support proper unregistration, when a classLib fails to load
Claus Gittinger <cg@exept.de>
parents:
963
diff
changeset
|
96 |
"make this a classLibHandle - must be done manually when init failed for proper de-registration |
160ab002eed1
support proper unregistration, when a classLib fails to load
Claus Gittinger <cg@exept.de>
parents:
963
diff
changeset
|
97 |
later." |
160ab002eed1
support proper unregistration, when a classLib fails to load
Claus Gittinger <cg@exept.de>
parents:
963
diff
changeset
|
98 |
|
160ab002eed1
support proper unregistration, when a classLib fails to load
Claus Gittinger <cg@exept.de>
parents:
963
diff
changeset
|
99 |
handleType notNil ifTrue:[ |
160ab002eed1
support proper unregistration, when a classLib fails to load
Claus Gittinger <cg@exept.de>
parents:
963
diff
changeset
|
100 |
self error:'should not happen'. |
160ab002eed1
support proper unregistration, when a classLib fails to load
Claus Gittinger <cg@exept.de>
parents:
963
diff
changeset
|
101 |
]. |
160ab002eed1
support proper unregistration, when a classLib fails to load
Claus Gittinger <cg@exept.de>
parents:
963
diff
changeset
|
102 |
handleType := #classLibraryObject |
160ab002eed1
support proper unregistration, when a classLib fails to load
Claus Gittinger <cg@exept.de>
parents:
963
diff
changeset
|
103 |
! |
160ab002eed1
support proper unregistration, when a classLib fails to load
Claus Gittinger <cg@exept.de>
parents:
963
diff
changeset
|
104 |
|
120 | 105 |
method |
976 | 106 |
"return the method (or nil, if I am not a method-file handle)" |
120 | 107 |
|
157
d7f68808a258
reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents:
154
diff
changeset
|
108 |
weakMethodRef isNil ifTrue:[^ nil]. |
120 | 109 |
^ weakMethodRef at:1 |
110 |
||
111 |
"Created: 14.9.1995 / 21:13:13 / claus" |
|
112 |
! |
|
113 |
||
114 |
method:something |
|
157
d7f68808a258
reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents:
154
diff
changeset
|
115 |
"set the method" |
120 | 116 |
|
117 |
weakMethodRef := WeakArray with:something. |
|
151
7f46f760ba45
automatically unload modules for garbage collected methods/classes
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
118 |
weakMethodRef addDependent:self. |
122 | 119 |
handleType := #methodObject. |
120 | 120 |
|
121 |
"Created: 14.9.1995 / 21:13:13 / claus" |
|
141 | 122 |
! |
123 |
||
976 | 124 |
methods |
125 |
"return the collection of methods (or an empty collection, |
|
126 |
if I am not a method-file handle)" |
|
127 |
||
128 |
|m| |
|
129 |
||
130 |
(m := self method) isNil ifTrue:[^ #()]. |
|
131 |
"/ TODO: this will return a real collection, when method-only |
|
132 |
"/ binaries remember that relevant information ... |
|
133 |
^ Array with:m |
|
134 |
! |
|
135 |
||
141 | 136 |
moduleID |
137 |
"return moduleID" |
|
138 |
||
139 |
^ moduleID |
|
140 |
||
141 |
"Created: 14.9.1995 / 21:13:12 / claus" |
|
142 |
! |
|
143 |
||
144 |
moduleID:something |
|
145 |
"set moduleID" |
|
146 |
||
147 |
moduleID := something. |
|
148 |
||
149 |
"Created: 14.9.1995 / 21:13:12 / claus" |
|
150 |
! |
|
151 |
||
152 |
pathName |
|
153 |
"return pathName" |
|
154 |
||
155 |
^ pathName |
|
156 |
||
157 |
"Created: 14.9.1995 / 21:13:12 / claus" |
|
158 |
! |
|
159 |
||
160 |
pathName:something |
|
161 |
"set pathName" |
|
162 |
||
163 |
pathName := something. |
|
164 |
||
165 |
"Created: 14.9.1995 / 21:13:12 / claus" |
|
166 |
! |
|
167 |
||
1163
242ec57c2f27
Remove object files that have been collected and not been used
Stefan Vogel <sv@exept.de>
parents:
1080
diff
changeset
|
168 |
snapshot |
242ec57c2f27
Remove object files that have been collected and not been used
Stefan Vogel <sv@exept.de>
parents:
1080
diff
changeset
|
169 |
"return the value of the instance variable 'snapshot' (automatically generated)" |
242ec57c2f27
Remove object files that have been collected and not been used
Stefan Vogel <sv@exept.de>
parents:
1080
diff
changeset
|
170 |
|
242ec57c2f27
Remove object files that have been collected and not been used
Stefan Vogel <sv@exept.de>
parents:
1080
diff
changeset
|
171 |
^ snapshot |
242ec57c2f27
Remove object files that have been collected and not been used
Stefan Vogel <sv@exept.de>
parents:
1080
diff
changeset
|
172 |
! |
242ec57c2f27
Remove object files that have been collected and not been used
Stefan Vogel <sv@exept.de>
parents:
1080
diff
changeset
|
173 |
|
242ec57c2f27
Remove object files that have been collected and not been used
Stefan Vogel <sv@exept.de>
parents:
1080
diff
changeset
|
174 |
snapshot:something |
242ec57c2f27
Remove object files that have been collected and not been used
Stefan Vogel <sv@exept.de>
parents:
1080
diff
changeset
|
175 |
"set the value of the instance variable 'snapshot' (automatically generated)" |
242ec57c2f27
Remove object files that have been collected and not been used
Stefan Vogel <sv@exept.de>
parents:
1080
diff
changeset
|
176 |
|
242ec57c2f27
Remove object files that have been collected and not been used
Stefan Vogel <sv@exept.de>
parents:
1080
diff
changeset
|
177 |
snapshot := something. |
242ec57c2f27
Remove object files that have been collected and not been used
Stefan Vogel <sv@exept.de>
parents:
1080
diff
changeset
|
178 |
! |
242ec57c2f27
Remove object files that have been collected and not been used
Stefan Vogel <sv@exept.de>
parents:
1080
diff
changeset
|
179 |
|
141 | 180 |
sysHandle1 |
181 |
"return sysHandle1" |
|
182 |
||
183 |
^ sysHandle1 |
|
184 |
||
185 |
"Created: 14.9.1995 / 21:13:12 / claus" |
|
186 |
! |
|
187 |
||
188 |
sysHandle1:something |
|
189 |
"set sysHandle1" |
|
190 |
||
191 |
sysHandle1 := something. |
|
192 |
||
193 |
"Created: 14.9.1995 / 21:13:12 / claus" |
|
194 |
! |
|
195 |
||
196 |
sysHandle2 |
|
197 |
"return sysHandle2" |
|
198 |
||
199 |
^ sysHandle2 |
|
200 |
||
201 |
"Created: 14.9.1995 / 21:13:12 / claus" |
|
202 |
! |
|
203 |
||
204 |
sysHandle2:something |
|
205 |
"set sysHandle2" |
|
206 |
||
207 |
sysHandle2 := something. |
|
208 |
||
209 |
"Created: 14.9.1995 / 21:13:12 / claus" |
|
114 | 210 |
! ! |
141 | 211 |
|
1554 | 212 |
!ObjectFileHandle methodsFor:'actions'! |
213 |
||
214 |
unload |
|
215 |
"unload the object file represented by me" |
|
216 |
||
217 |
ObjectFileLoader unloadDynamicObject:self |
|
218 |
! ! |
|
219 |
||
259 | 220 |
!ObjectFileHandle methodsFor:'change & update'! |
221 |
||
222 |
update:something with:aParameter from:changedObject |
|
223 |
"my method/class object was collected - unload the underlying objectfile" |
|
224 |
||
490
621a7283b926
oops - changeArg is #ElementExpired; changedObject is the one we have to
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
225 |
changedObject == weakMethodRef ifTrue:[ |
474 | 226 |
weakMethodRef nilAllCorpsesAndDo:[:idx |]. |
367
87d4673fbd06
changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents:
304
diff
changeset
|
227 |
]. |
87d4673fbd06
changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents:
304
diff
changeset
|
228 |
|
490
621a7283b926
oops - changeArg is #ElementExpired; changedObject is the one we have to
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
229 |
changedObject == weakClassRefs ifTrue:[ |
474 | 230 |
weakClassRefs nilAllCorpsesAndDo:[:idx |]. |
367
87d4673fbd06
changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents:
304
diff
changeset
|
231 |
]. |
87d4673fbd06
changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents:
304
diff
changeset
|
232 |
|
259 | 233 |
self isObsolete ifTrue:[ |
490
621a7283b926
oops - changeArg is #ElementExpired; changedObject is the one we have to
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
234 |
weakFunctionRefs notNil ifTrue:[ |
621a7283b926
oops - changeArg is #ElementExpired; changedObject is the one we have to
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
235 |
weakFunctionRefs removeDependent:self. |
621a7283b926
oops - changeArg is #ElementExpired; changedObject is the one we have to
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
236 |
weakFunctionRefs := nil. |
621a7283b926
oops - changeArg is #ElementExpired; changedObject is the one we have to
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
237 |
]. |
621a7283b926
oops - changeArg is #ElementExpired; changedObject is the one we have to
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
238 |
weakClassRefs notNil ifTrue:[ |
621a7283b926
oops - changeArg is #ElementExpired; changedObject is the one we have to
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
239 |
weakClassRefs removeDependent:self. |
621a7283b926
oops - changeArg is #ElementExpired; changedObject is the one we have to
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
240 |
weakClassRefs := nil. |
621a7283b926
oops - changeArg is #ElementExpired; changedObject is the one we have to
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
241 |
]. |
621a7283b926
oops - changeArg is #ElementExpired; changedObject is the one we have to
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
242 |
weakMethodRef notNil ifTrue:[ |
621a7283b926
oops - changeArg is #ElementExpired; changedObject is the one we have to
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
243 |
weakMethodRef removeDependent:self. |
621a7283b926
oops - changeArg is #ElementExpired; changedObject is the one we have to
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
244 |
weakMethodRef := nil. |
621a7283b926
oops - changeArg is #ElementExpired; changedObject is the one we have to
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
245 |
]. |
474 | 246 |
('ObjectFileHandle [info]: unloading ' , pathName , ' (method/classes were garbageCollected)') infoPrintCR. |
1163
242ec57c2f27
Remove object files that have been collected and not been used
Stefan Vogel <sv@exept.de>
parents:
1080
diff
changeset
|
247 |
ObjectFileLoader unloadObjectFile:pathName. |
242ec57c2f27
Remove object files that have been collected and not been used
Stefan Vogel <sv@exept.de>
parents:
1080
diff
changeset
|
248 |
snapshot == true ifFalse:[ |
242ec57c2f27
Remove object files that have been collected and not been used
Stefan Vogel <sv@exept.de>
parents:
1080
diff
changeset
|
249 |
"This object file has never been saved in a snapshot, |
242ec57c2f27
Remove object files that have been collected and not been used
Stefan Vogel <sv@exept.de>
parents:
1080
diff
changeset
|
250 |
so it can be savely removed" |
242ec57c2f27
Remove object files that have been collected and not been used
Stefan Vogel <sv@exept.de>
parents:
1080
diff
changeset
|
251 |
|
242ec57c2f27
Remove object files that have been collected and not been used
Stefan Vogel <sv@exept.de>
parents:
1080
diff
changeset
|
252 |
pathName asFilename remove. |
242ec57c2f27
Remove object files that have been collected and not been used
Stefan Vogel <sv@exept.de>
parents:
1080
diff
changeset
|
253 |
]. |
259 | 254 |
]. |
255 |
||
256 |
"Created: 5.12.1995 / 18:05:08 / cg" |
|
490
621a7283b926
oops - changeArg is #ElementExpired; changedObject is the one we have to
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
257 |
"Modified: 30.1.1997 / 20:57:56 / cg" |
259 | 258 |
! ! |
259 |
||
260 |
!ObjectFileHandle methodsFor:'copying'! |
|
261 |
||
262 |
postCopy |
|
263 |
"flush module handles of the copy" |
|
264 |
||
265 |
sysHandle1 := sysHandle2 := moduleID := nil |
|
266 |
||
267 |
"Created: 5.12.1995 / 21:10:49 / cg" |
|
268 |
"Modified: 25.4.1996 / 09:43:53 / cg" |
|
1614 | 269 |
! |
270 |
||
271 |
postDeepCopy |
|
272 |
sysHandle1 := sysHandle2 := moduleID := nil |
|
259 | 273 |
! ! |
274 |
||
1080 | 275 |
!ObjectFileHandle methodsFor:'printing & storing'! |
157
d7f68808a258
reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents:
154
diff
changeset
|
276 |
|
d7f68808a258
reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents:
154
diff
changeset
|
277 |
printOn:aStream |
259 | 278 |
"append a printed representation of the receiver to aStream" |
279 |
||
157
d7f68808a258
reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents:
154
diff
changeset
|
280 |
aStream nextPutAll:self class name; nextPutAll:'(handle=<'. |
d7f68808a258
reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents:
154
diff
changeset
|
281 |
sysHandle1 printOn:aStream. |
d7f68808a258
reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents:
154
diff
changeset
|
282 |
aStream nextPutAll:' '. |
d7f68808a258
reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents:
154
diff
changeset
|
283 |
sysHandle2 printOn:aStream. |
d7f68808a258
reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents:
154
diff
changeset
|
284 |
aStream nextPutAll:'> path='''. |
d7f68808a258
reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents:
154
diff
changeset
|
285 |
pathName printOn:aStream. |
d7f68808a258
reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents:
154
diff
changeset
|
286 |
aStream nextPutAll:''' id='. |
d7f68808a258
reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents:
154
diff
changeset
|
287 |
moduleID printOn:aStream. |
d7f68808a258
reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents:
154
diff
changeset
|
288 |
aStream nextPutAll:' type='. |
d7f68808a258
reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents:
154
diff
changeset
|
289 |
handleType printOn:aStream. |
d7f68808a258
reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents:
154
diff
changeset
|
290 |
aStream nextPutAll:' method=<'. |
d7f68808a258
reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents:
154
diff
changeset
|
291 |
self method printOn:aStream. |
d7f68808a258
reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents:
154
diff
changeset
|
292 |
aStream nextPutAll:'> classes=<'. |
d7f68808a258
reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents:
154
diff
changeset
|
293 |
self classes printOn:aStream. |
d7f68808a258
reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents:
154
diff
changeset
|
294 |
aStream nextPutAll:'>'. |
d7f68808a258
reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents:
154
diff
changeset
|
295 |
|
d7f68808a258
reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents:
154
diff
changeset
|
296 |
aStream nextPutAll:')'. |
d7f68808a258
reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents:
154
diff
changeset
|
297 |
|
259 | 298 |
"Modified: 25.4.1996 / 09:44:08 / cg" |
157
d7f68808a258
reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents:
154
diff
changeset
|
299 |
! ! |
d7f68808a258
reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents:
154
diff
changeset
|
300 |
|
141 | 301 |
!ObjectFileHandle methodsFor:'queries'! |
302 |
||
299
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
303 |
getFunction:aString |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
304 |
"return a function object for an entry in the module represented by |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
305 |
the receiver." |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
306 |
|
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
307 |
|address f slot sz nW| |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
308 |
|
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
309 |
address := ObjectFileLoader getFunction:aString from:self. |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
310 |
address isNil ifTrue:[ |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
311 |
^ nil |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
312 |
]. |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
313 |
|
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
314 |
weakFunctionRefs isNil ifTrue:[ |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
315 |
handleType := #functionObject. |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
316 |
f := ExternalFunction basicNew code:address. |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
317 |
f setName:aString moduleHandle:self. |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
318 |
weakFunctionRefs := WeakArray with:f. |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
319 |
^ f. |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
320 |
]. |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
321 |
|
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
322 |
weakFunctionRefs nonNilElementsDo:[:anExternalFunction | |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
323 |
anExternalFunction code = address ifTrue:[ |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
324 |
^ anExternalFunction |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
325 |
] |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
326 |
]. |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
327 |
|
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
328 |
f := ExternalFunction basicNew code:address. |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
329 |
f setName:aString moduleHandle:self. |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
330 |
|
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
331 |
slot := weakFunctionRefs identityIndexOf:nil. |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
332 |
slot ~~ 0 ifTrue:[ |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
333 |
weakFunctionRefs at:slot put:f. |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
334 |
^ f. |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
335 |
]. |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
336 |
|
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
337 |
sz := weakFunctionRefs size. |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
338 |
nW := WeakArray new:(sz + 2). |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
339 |
nW replaceFrom:1 to:sz with:weakFunctionRefs startingAt:1. |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
340 |
nW at:sz+1 put:f. |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
341 |
|
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
342 |
weakFunctionRefs := nW. |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
343 |
^ f |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
344 |
|
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
345 |
"Created: 12.7.1996 / 14:59:09 / cg" |
368 | 346 |
"Modified: 18.10.1996 / 20:59:54 / cg" |
299
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
347 |
! |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
348 |
|
1603
4243be479e4f
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
1554
diff
changeset
|
349 |
getFunctionAddress:aString into:anExternalFunction |
1743 | 350 |
"fill the code address of the external function named aString into anExternalFunction. |
351 |
Returns the address, or nil." |
|
1603
4243be479e4f
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
1554
diff
changeset
|
352 |
|
4243be479e4f
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
1554
diff
changeset
|
353 |
|address f slot sz nW| |
4243be479e4f
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
1554
diff
changeset
|
354 |
|
4243be479e4f
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
1554
diff
changeset
|
355 |
address := ObjectFileLoader getFunction:aString from:self. |
4243be479e4f
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
1554
diff
changeset
|
356 |
address isNil ifTrue:[ |
4243be479e4f
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
1554
diff
changeset
|
357 |
^ nil |
4243be479e4f
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
1554
diff
changeset
|
358 |
]. |
4243be479e4f
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
1554
diff
changeset
|
359 |
|
4243be479e4f
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
1554
diff
changeset
|
360 |
anExternalFunction code:address. |
4243be479e4f
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
1554
diff
changeset
|
361 |
weakFunctionRefs isNil ifTrue:[ |
4243be479e4f
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
1554
diff
changeset
|
362 |
handleType := #functionObject. |
4243be479e4f
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
1554
diff
changeset
|
363 |
weakFunctionRefs := WeakArray with:f. |
4243be479e4f
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
1554
diff
changeset
|
364 |
^ address. |
4243be479e4f
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
1554
diff
changeset
|
365 |
]. |
4243be479e4f
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
1554
diff
changeset
|
366 |
|
4243be479e4f
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
1554
diff
changeset
|
367 |
weakFunctionRefs nonNilElementsDo:[:eachExternalFunction | |
4243be479e4f
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
1554
diff
changeset
|
368 |
eachExternalFunction == anExternalFunction ifTrue:[ |
4243be479e4f
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
1554
diff
changeset
|
369 |
^ address |
4243be479e4f
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
1554
diff
changeset
|
370 |
] |
4243be479e4f
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
1554
diff
changeset
|
371 |
]. |
4243be479e4f
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
1554
diff
changeset
|
372 |
|
4243be479e4f
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
1554
diff
changeset
|
373 |
slot := weakFunctionRefs identityIndexOf:nil. |
4243be479e4f
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
1554
diff
changeset
|
374 |
slot ~~ 0 ifTrue:[ |
4243be479e4f
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
1554
diff
changeset
|
375 |
weakFunctionRefs at:slot put:anExternalFunction. |
4243be479e4f
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
1554
diff
changeset
|
376 |
^ address. |
4243be479e4f
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
1554
diff
changeset
|
377 |
]. |
4243be479e4f
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
1554
diff
changeset
|
378 |
|
4243be479e4f
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
1554
diff
changeset
|
379 |
sz := weakFunctionRefs size. |
4243be479e4f
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
1554
diff
changeset
|
380 |
nW := WeakArray new:(sz + 2). |
4243be479e4f
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
1554
diff
changeset
|
381 |
nW replaceFrom:1 to:sz with:weakFunctionRefs startingAt:1. |
4243be479e4f
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
1554
diff
changeset
|
382 |
nW at:sz+1 put:anExternalFunction. |
4243be479e4f
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
1554
diff
changeset
|
383 |
|
4243be479e4f
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
1554
diff
changeset
|
384 |
weakFunctionRefs := nW. |
4243be479e4f
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
1554
diff
changeset
|
385 |
^ address |
4243be479e4f
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
1554
diff
changeset
|
386 |
! |
4243be479e4f
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
1554
diff
changeset
|
387 |
|
299
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
388 |
hasUndefinedSymbols |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
389 |
"return true, if the module has any undefined symbols. |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
390 |
The only system, which allows modules with undefined symbols to be |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
391 |
loaded is (currently) the linux a.out version." |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
392 |
|
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
393 |
^ ObjectFileLoader hasUndefinedSymbolsIn:self |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
394 |
|
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
395 |
"Created: 12.7.1996 / 14:59:09 / cg" |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
396 |
! |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
397 |
|
141 | 398 |
isClassLibHandle |
399 |
"return true, if I am a handle for a class library" |
|
400 |
||
401 |
^ handleType == #classLibraryObject |
|
402 |
! |
|
403 |
||
157
d7f68808a258
reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents:
154
diff
changeset
|
404 |
isForCollectedObject |
d7f68808a258
reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents:
154
diff
changeset
|
405 |
"return true, if my clases/method has already been garbage collected" |
d7f68808a258
reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents:
154
diff
changeset
|
406 |
|
367
87d4673fbd06
changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents:
304
diff
changeset
|
407 |
|ref| |
87d4673fbd06
changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents:
304
diff
changeset
|
408 |
|
157
d7f68808a258
reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents:
154
diff
changeset
|
409 |
handleType == #classLibraryObject ifTrue:[ |
367
87d4673fbd06
changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents:
304
diff
changeset
|
410 |
^ (weakClassRefs findFirst:[:x | x notNil and:[x ~~ 0]]) == 0 |
157
d7f68808a258
reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents:
154
diff
changeset
|
411 |
]. |
d7f68808a258
reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents:
154
diff
changeset
|
412 |
handleType == #methodObject ifTrue:[ |
1038 | 413 |
weakMethodRef isNil ifTrue:[^ true]. |
414 |
ref := weakMethodRef at:1. |
|
367
87d4673fbd06
changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents:
304
diff
changeset
|
415 |
^ ref isNil or:[ref == 0] |
157
d7f68808a258
reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents:
154
diff
changeset
|
416 |
]. |
299
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
417 |
handleType == #functionObject ifTrue:[ |
367
87d4673fbd06
changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents:
304
diff
changeset
|
418 |
^ (weakFunctionRefs findFirst:[:x | x notNil and:[x ~~ 0]]) == 0 |
299
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
419 |
]. |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
420 |
|
157
d7f68808a258
reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents:
154
diff
changeset
|
421 |
^ false |
d7f68808a258
reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents:
154
diff
changeset
|
422 |
|
d7f68808a258
reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents:
154
diff
changeset
|
423 |
"Created: 6.12.1995 / 17:46:58 / cg" |
299
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
424 |
"Modified: 12.7.1996 / 15:42:38 / cg" |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
425 |
! |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
426 |
|
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
427 |
isFunctionObjectHandle |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
428 |
"return true, if I am a handle for a c-code (or other) function object file" |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
429 |
|
304 | 430 |
^ handleType == #functionObject |
299
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
431 |
|
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
432 |
"Created: 12.7.1996 / 15:35:33 / cg" |
304 | 433 |
"Modified: 12.7.1996 / 17:25:31 / cg" |
157
d7f68808a258
reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents:
154
diff
changeset
|
434 |
! |
d7f68808a258
reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents:
154
diff
changeset
|
435 |
|
259 | 436 |
isMethodHandle |
437 |
"return true, if I am a handle for a single compiled method" |
|
438 |
||
439 |
^ handleType == #methodObject |
|
440 |
! |
|
441 |
||
141 | 442 |
isObsolete |
443 |
"return true, if my clases/method has already been removed from |
|
444 |
the image. I.e. if the object file can be unloaded without danger." |
|
445 |
||
367
87d4673fbd06
changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents:
304
diff
changeset
|
446 |
|ref| |
87d4673fbd06
changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents:
304
diff
changeset
|
447 |
|
154 | 448 |
moduleID notNil ifTrue:[ |
299
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
449 |
handleType == #classLibraryObject ifTrue:[ |
367
87d4673fbd06
changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents:
304
diff
changeset
|
450 |
^ (weakClassRefs findFirst:[:x | x notNil and:[x ~~ 0]]) == 0 |
299
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
451 |
]. |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
452 |
handleType == #methodObject ifTrue:[ |
367
87d4673fbd06
changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents:
304
diff
changeset
|
453 |
ref := weakMethodRef at:1. |
87d4673fbd06
changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents:
304
diff
changeset
|
454 |
^ (ref isNil or:[ref == 0]) |
299
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
455 |
]. |
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
456 |
handleType == #functionObject ifTrue:[ |
367
87d4673fbd06
changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents:
304
diff
changeset
|
457 |
^ (weakFunctionRefs findFirst:[:x | x notNil and:[x ~~ 0]]) == 0 |
299
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
458 |
]. |
141 | 459 |
]. |
460 |
^ false |
|
299
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
461 |
|
33a154508328
additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
462 |
"Modified: 12.7.1996 / 15:42:21 / cg" |
967
160ab002eed1
support proper unregistration, when a classLib fails to load
Claus Gittinger <cg@exept.de>
parents:
963
diff
changeset
|
463 |
! |
160ab002eed1
support proper unregistration, when a classLib fails to load
Claus Gittinger <cg@exept.de>
parents:
963
diff
changeset
|
464 |
|
160ab002eed1
support proper unregistration, when a classLib fails to load
Claus Gittinger <cg@exept.de>
parents:
963
diff
changeset
|
465 |
isUnknownHandle |
160ab002eed1
support proper unregistration, when a classLib fails to load
Claus Gittinger <cg@exept.de>
parents:
963
diff
changeset
|
466 |
"return true, if it is not (yet) known, what type of |
160ab002eed1
support proper unregistration, when a classLib fails to load
Claus Gittinger <cg@exept.de>
parents:
963
diff
changeset
|
467 |
file is represented by the handle. (i.e. when loaded, but not yet |
160ab002eed1
support proper unregistration, when a classLib fails to load
Claus Gittinger <cg@exept.de>
parents:
963
diff
changeset
|
468 |
registered/initialized)" |
160ab002eed1
support proper unregistration, when a classLib fails to load
Claus Gittinger <cg@exept.de>
parents:
963
diff
changeset
|
469 |
|
160ab002eed1
support proper unregistration, when a classLib fails to load
Claus Gittinger <cg@exept.de>
parents:
963
diff
changeset
|
470 |
^ handleType isNil |
973 | 471 |
! |
472 |
||
473 |
package |
|
474 |
"retrieve the packageID of the class-library handle" |
|
475 |
||
476 |
|cls mthd| |
|
477 |
||
478 |
"/ sigh - for now, the package must be extracted from the first classes/methods |
|
479 |
"/ package. |
|
480 |
||
481 |
self isClassLibHandle ifTrue:[ |
|
482 |
cls := self classes firstIfEmpty:nil. |
|
483 |
cls notNil ifTrue:[^ cls package] |
|
484 |
]. |
|
485 |
self isMethodHandle ifTrue:[ |
|
486 |
cls := self methods firstIfEmpty:nil. |
|
487 |
mthd notNil ifTrue:[^ mthd package] |
|
488 |
]. |
|
489 |
^ nil |
|
141 | 490 |
! ! |
491 |
||
368 | 492 |
!ObjectFileHandle class methodsFor:'documentation'! |
148 | 493 |
|
494 |
version |
|
1743 | 495 |
^ '$Header: /cvs/stx/stx/libcomp/ObjectFileHandle.st,v 1.33 2006-04-26 11:26:08 cg Exp $' |
148 | 496 |
! ! |