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
|
|
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 |
|
|
52 |
!ObjectFileHandle methodsFor:'accessing'!
|
|
53 |
|
122
|
54 |
classes
|
|
55 |
"return the classes"
|
|
56 |
|
125
|
57 |
weakClassRefs isNil ifTrue:[^nil].
|
122
|
58 |
^ weakClassRefs asArray
|
|
59 |
|
|
60 |
"Created: 14.9.1995 / 21:13:13 / claus"
|
|
61 |
!
|
|
62 |
|
|
63 |
classes:aCollectionOfClasses
|
|
64 |
"set the classes collection"
|
|
65 |
|
|
66 |
weakClassRefs := WeakArray withAll:aCollectionOfClasses.
|
|
67 |
handleType := #classLibraryObject
|
|
68 |
|
|
69 |
"Created: 14.9.1995 / 21:13:13 / claus"
|
|
70 |
!
|
|
71 |
|
120
|
72 |
method
|
|
73 |
"return method"
|
|
74 |
|
|
75 |
^ weakMethodRef at:1
|
|
76 |
|
|
77 |
"Created: 14.9.1995 / 21:13:13 / claus"
|
|
78 |
!
|
|
79 |
|
|
80 |
method:something
|
|
81 |
"set method"
|
|
82 |
|
|
83 |
weakMethodRef := WeakArray with:something.
|
122
|
84 |
handleType := #methodObject.
|
120
|
85 |
|
|
86 |
"Created: 14.9.1995 / 21:13:13 / claus"
|
141
|
87 |
!
|
|
88 |
|
|
89 |
moduleID
|
|
90 |
"return moduleID"
|
|
91 |
|
|
92 |
^ moduleID
|
|
93 |
|
|
94 |
"Created: 14.9.1995 / 21:13:12 / claus"
|
|
95 |
!
|
|
96 |
|
|
97 |
moduleID:something
|
|
98 |
"set moduleID"
|
|
99 |
|
|
100 |
moduleID := something.
|
|
101 |
|
|
102 |
"Created: 14.9.1995 / 21:13:12 / claus"
|
|
103 |
!
|
|
104 |
|
|
105 |
pathName
|
|
106 |
"return pathName"
|
|
107 |
|
|
108 |
^ pathName
|
|
109 |
|
|
110 |
"Created: 14.9.1995 / 21:13:12 / claus"
|
|
111 |
!
|
|
112 |
|
|
113 |
pathName:something
|
|
114 |
"set pathName"
|
|
115 |
|
|
116 |
pathName := something.
|
|
117 |
|
|
118 |
"Created: 14.9.1995 / 21:13:12 / claus"
|
|
119 |
!
|
|
120 |
|
|
121 |
sysHandle1
|
|
122 |
"return sysHandle1"
|
|
123 |
|
|
124 |
^ sysHandle1
|
|
125 |
|
|
126 |
"Created: 14.9.1995 / 21:13:12 / claus"
|
|
127 |
!
|
|
128 |
|
|
129 |
sysHandle1:something
|
|
130 |
"set sysHandle1"
|
|
131 |
|
|
132 |
sysHandle1 := something.
|
|
133 |
|
|
134 |
"Created: 14.9.1995 / 21:13:12 / claus"
|
|
135 |
!
|
|
136 |
|
|
137 |
sysHandle2
|
|
138 |
"return sysHandle2"
|
|
139 |
|
|
140 |
^ sysHandle2
|
|
141 |
|
|
142 |
"Created: 14.9.1995 / 21:13:12 / claus"
|
|
143 |
!
|
|
144 |
|
|
145 |
sysHandle2:something
|
|
146 |
"set sysHandle2"
|
|
147 |
|
|
148 |
sysHandle2 := something.
|
|
149 |
|
|
150 |
"Created: 14.9.1995 / 21:13:12 / claus"
|
114
|
151 |
! !
|
141
|
152 |
|
|
153 |
!ObjectFileHandle methodsFor:'queries'!
|
|
154 |
|
|
155 |
isClassLibHandle
|
|
156 |
"return true, if I am a handle for a class library"
|
|
157 |
|
|
158 |
^ handleType == #classLibraryObject
|
|
159 |
!
|
|
160 |
|
|
161 |
isMethodHandle
|
|
162 |
"return true, if I am a handle for a single compiled method"
|
|
163 |
|
|
164 |
^ handleType == #methodObject
|
|
165 |
!
|
|
166 |
|
|
167 |
isObsolete
|
|
168 |
"return true, if my clases/method has already been removed from
|
|
169 |
the image. I.e. if the object file can be unloaded without danger."
|
|
170 |
|
|
171 |
handleType == #classLibraryObject ifTrue:[
|
|
172 |
^ (weakClassRefs findFirst:[:x | x notNil]) == 0
|
|
173 |
].
|
|
174 |
handleType == #methodObject ifTrue:[
|
|
175 |
^ (weakMethodRef at:1) isNil
|
|
176 |
].
|
|
177 |
^ false
|
|
178 |
! !
|
|
179 |
|
148
|
180 |
!ObjectFileHandle class methodsFor:'documentation'!
|
|
181 |
|
|
182 |
version
|
|
183 |
^ '$Header: /cvs/stx/stx/libcomp/ObjectFileHandle.st,v 1.8 1995-12-03 12:11:28 cg Exp $'
|
|
184 |
! !
|