author | Claus Gittinger <cg@exept.de> |
Tue, 05 Dec 1995 18:52:15 +0100 | |
changeset 151 | 7f46f760ba45 |
parent 148 | ef0e604209ec |
child 152 | d7c2314f393e |
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 |
|
13 |
Object subclass:#ObjectFileHandle |
|
141 | 14 |
instanceVariableNames:'sysHandle1 sysHandle2 pathName moduleID handleType weakMethodRef |
151
7f46f760ba45
automatically unload modules for garbage collected methods/classes
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
15 |
weakClassRefs' |
120 | 16 |
classVariableNames:'' |
17 |
poolDictionaries:'' |
|
18 |
category:'System-Compiler' |
|
19 |
! |
|
20 |
||
21 |
!ObjectFileHandle class methodsFor:'documentation'! |
|
22 |
||
141 | 23 |
copyright |
24 |
" |
|
25 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
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 |
" |
|
114 | 35 |
! |
36 |
||
120 | 37 |
documentation |
38 |
" |
|
123 | 39 |
not for public use - used by ObjectFileLoader to keep track of loaded modules, |
40 |
associating objectFile names and moduleIDs to classes/methods. |
|
120 | 41 |
" |
114 | 42 |
|
120 | 43 |
"Created: 14.9.1995 / 21:10:55 / claus" |
44 |
! |
|
114 | 45 |
|
120 | 46 |
history |
47 |
||
48 |
"Created: 14.9.1995 / 21:10:55 / claus" |
|
49 |
"Modified: 14.9.1995 / 21:10:55 / claus" |
|
114 | 50 |
! ! |
51 |
||
151
7f46f760ba45
automatically unload modules for garbage collected methods/classes
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
52 |
!ObjectFileHandle methodsFor:'change & update'! |
7f46f760ba45
automatically unload modules for garbage collected methods/classes
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
53 |
|
7f46f760ba45
automatically unload modules for garbage collected methods/classes
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
54 |
update:something with:aParameter from:changedObject |
7f46f760ba45
automatically unload modules for garbage collected methods/classes
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
55 |
"my method/class object was collected - unload the underlying objectfile" |
7f46f760ba45
automatically unload modules for garbage collected methods/classes
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
56 |
|
7f46f760ba45
automatically unload modules for garbage collected methods/classes
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
57 |
'unloading objectfiles for collected methods/classes' infoPrintNL. |
7f46f760ba45
automatically unload modules for garbage collected methods/classes
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
58 |
ObjectFileLoader unloadAllObsoleteObjectFiles |
7f46f760ba45
automatically unload modules for garbage collected methods/classes
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
59 |
|
7f46f760ba45
automatically unload modules for garbage collected methods/classes
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
60 |
"Created: 5.12.1995 / 18:05:08 / cg" |
7f46f760ba45
automatically unload modules for garbage collected methods/classes
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
61 |
! ! |
7f46f760ba45
automatically unload modules for garbage collected methods/classes
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
62 |
|
114 | 63 |
!ObjectFileHandle methodsFor:'accessing'! |
64 |
||
122 | 65 |
classes |
66 |
"return the classes" |
|
67 |
||
125 | 68 |
weakClassRefs isNil ifTrue:[^nil]. |
122 | 69 |
^ weakClassRefs asArray |
70 |
||
71 |
"Created: 14.9.1995 / 21:13:13 / claus" |
|
72 |
! |
|
73 |
||
74 |
classes:aCollectionOfClasses |
|
75 |
"set the classes collection" |
|
76 |
||
77 |
weakClassRefs := WeakArray withAll:aCollectionOfClasses. |
|
151
7f46f760ba45
automatically unload modules for garbage collected methods/classes
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
78 |
weakClassRefs addDependent:self. |
122 | 79 |
handleType := #classLibraryObject |
80 |
||
81 |
"Created: 14.9.1995 / 21:13:13 / claus" |
|
82 |
! |
|
83 |
||
120 | 84 |
method |
85 |
"return method" |
|
86 |
||
87 |
^ weakMethodRef at:1 |
|
88 |
||
89 |
"Created: 14.9.1995 / 21:13:13 / claus" |
|
90 |
! |
|
91 |
||
92 |
method:something |
|
93 |
"set method" |
|
94 |
||
95 |
weakMethodRef := WeakArray with:something. |
|
151
7f46f760ba45
automatically unload modules for garbage collected methods/classes
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
96 |
weakMethodRef addDependent:self. |
122 | 97 |
handleType := #methodObject. |
120 | 98 |
|
99 |
"Created: 14.9.1995 / 21:13:13 / claus" |
|
141 | 100 |
! |
101 |
||
102 |
moduleID |
|
103 |
"return moduleID" |
|
104 |
||
105 |
^ moduleID |
|
106 |
||
107 |
"Created: 14.9.1995 / 21:13:12 / claus" |
|
108 |
! |
|
109 |
||
110 |
moduleID:something |
|
111 |
"set moduleID" |
|
112 |
||
113 |
moduleID := something. |
|
114 |
||
115 |
"Created: 14.9.1995 / 21:13:12 / claus" |
|
116 |
! |
|
117 |
||
118 |
pathName |
|
119 |
"return pathName" |
|
120 |
||
121 |
^ pathName |
|
122 |
||
123 |
"Created: 14.9.1995 / 21:13:12 / claus" |
|
124 |
! |
|
125 |
||
126 |
pathName:something |
|
127 |
"set pathName" |
|
128 |
||
129 |
pathName := something. |
|
130 |
||
131 |
"Created: 14.9.1995 / 21:13:12 / claus" |
|
132 |
! |
|
133 |
||
134 |
sysHandle1 |
|
135 |
"return sysHandle1" |
|
136 |
||
137 |
^ sysHandle1 |
|
138 |
||
139 |
"Created: 14.9.1995 / 21:13:12 / claus" |
|
140 |
! |
|
141 |
||
142 |
sysHandle1:something |
|
143 |
"set sysHandle1" |
|
144 |
||
145 |
sysHandle1 := something. |
|
146 |
||
147 |
"Created: 14.9.1995 / 21:13:12 / claus" |
|
148 |
! |
|
149 |
||
150 |
sysHandle2 |
|
151 |
"return sysHandle2" |
|
152 |
||
153 |
^ sysHandle2 |
|
154 |
||
155 |
"Created: 14.9.1995 / 21:13:12 / claus" |
|
156 |
! |
|
157 |
||
158 |
sysHandle2:something |
|
159 |
"set sysHandle2" |
|
160 |
||
161 |
sysHandle2 := something. |
|
162 |
||
163 |
"Created: 14.9.1995 / 21:13:12 / claus" |
|
114 | 164 |
! ! |
141 | 165 |
|
166 |
!ObjectFileHandle methodsFor:'queries'! |
|
167 |
||
168 |
isClassLibHandle |
|
169 |
"return true, if I am a handle for a class library" |
|
170 |
||
171 |
^ handleType == #classLibraryObject |
|
172 |
! |
|
173 |
||
174 |
isMethodHandle |
|
175 |
"return true, if I am a handle for a single compiled method" |
|
176 |
||
177 |
^ handleType == #methodObject |
|
178 |
! |
|
179 |
||
180 |
isObsolete |
|
181 |
"return true, if my clases/method has already been removed from |
|
182 |
the image. I.e. if the object file can be unloaded without danger." |
|
183 |
||
184 |
handleType == #classLibraryObject ifTrue:[ |
|
185 |
^ (weakClassRefs findFirst:[:x | x notNil]) == 0 |
|
186 |
]. |
|
187 |
handleType == #methodObject ifTrue:[ |
|
188 |
^ (weakMethodRef at:1) isNil |
|
189 |
]. |
|
190 |
^ false |
|
191 |
! ! |
|
192 |
||
148 | 193 |
!ObjectFileHandle class methodsFor:'documentation'! |
194 |
||
195 |
version |
|
151
7f46f760ba45
automatically unload modules for garbage collected methods/classes
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
196 |
^ '$Header: /cvs/stx/stx/libcomp/ObjectFileHandle.st,v 1.9 1995-12-05 17:52:03 cg Exp $' |
148 | 197 |
! ! |