ObjectFileHandle.st
author Claus Gittinger <cg@exept.de>
Tue, 06 May 2003 16:03:55 +0200
changeset 1409 e965cfbd9a78
parent 1163 242ec57c2f27
child 1554 8e923008be65
permissions -rw-r--r--
checkin from browser
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
     1
"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
     2
 COPYRIGHT (c) 1995 by Claus Gittinger
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
     3
	      All Rights Reserved
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
     4
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
     5
 This software is furnished under a license and may be used
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
     6
 only in accordance with the terms of that license and with the
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
     8
 be provided or otherwise made available to, or used by, any
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
     9
 other person.  No title to or ownership of the software is
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    10
 hereby transferred.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    11
"
114
claus
parents:
diff changeset
    12
1080
bd3f19f6009a category change
Claus Gittinger <cg@exept.de>
parents: 1038
diff changeset
    13
"{ Package: 'stx:libcomp' }"
bd3f19f6009a category change
Claus Gittinger <cg@exept.de>
parents: 1038
diff changeset
    14
114
claus
parents:
diff changeset
    15
Object subclass:#ObjectFileHandle
259
a469695d8d19 commentary
Claus Gittinger <cg@exept.de>
parents: 157
diff changeset
    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
a469695d8d19 commentary
Claus Gittinger <cg@exept.de>
parents: 157
diff changeset
    18
	classVariableNames:''
a469695d8d19 commentary
Claus Gittinger <cg@exept.de>
parents: 157
diff changeset
    19
	poolDictionaries:''
a469695d8d19 commentary
Claus Gittinger <cg@exept.de>
parents: 157
diff changeset
    20
	category:'System-Compiler'
120
claus
parents: 114
diff changeset
    21
!
claus
parents: 114
diff changeset
    22
368
26e9268bde0f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
    23
!ObjectFileHandle class methodsFor:'documentation'!
120
claus
parents: 114
diff changeset
    24
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    25
copyright
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    26
"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    27
 COPYRIGHT (c) 1995 by Claus Gittinger
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    28
	      All Rights Reserved
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    29
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    30
 This software is furnished under a license and may be used
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    31
 only in accordance with the terms of that license and with the
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    33
 be provided or otherwise made available to, or used by, any
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    34
 other person.  No title to or ownership of the software is
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    35
 hereby transferred.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    36
"
114
claus
parents:
diff changeset
    37
!
claus
parents:
diff changeset
    38
120
claus
parents: 114
diff changeset
    39
documentation
claus
parents: 114
diff changeset
    40
"
123
claus
parents: 122
diff changeset
    41
    not for public use - used by ObjectFileLoader to keep track of loaded modules,
claus
parents: 122
diff changeset
    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
3b21d0991eff documentation
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
    49
3b21d0991eff documentation
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
    50
    [author:]
3b21d0991eff documentation
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
    51
        Claus Gittinger
120
claus
parents: 114
diff changeset
    52
"
114
claus
parents:
diff changeset
    53
! !
claus
parents:
diff changeset
    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
claus
parents:
diff changeset
    64
!ObjectFileHandle methodsFor:'accessing'!
claus
parents:
diff changeset
    65
122
claus
parents: 120
diff changeset
    66
classes
claus
parents: 120
diff changeset
    67
    "return the classes"
claus
parents: 120
diff changeset
    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
claus
parents: 120
diff changeset
    70
    ^ weakClassRefs asArray 
claus
parents: 120
diff changeset
    71
claus
parents: 120
diff changeset
    72
    "Created: 14.9.1995 / 21:13:13 / claus"
claus
parents: 120
diff changeset
    73
!
claus
parents: 120
diff changeset
    74
claus
parents: 120
diff changeset
    75
classes:aCollectionOfClasses 
claus
parents: 120
diff changeset
    76
    "set the classes collection"
claus
parents: 120
diff changeset
    77
claus
parents: 120
diff changeset
    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
claus
parents: 120
diff changeset
    80
    handleType := #classLibraryObject 
claus
parents: 120
diff changeset
    81
claus
parents: 120
diff changeset
    82
    "Created: 14.9.1995 / 21:13:13 / claus"
claus
parents: 120
diff changeset
    83
!
claus
parents: 120
diff changeset
    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
claus
parents: 114
diff changeset
   105
method
976
9078108d2af4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 973
diff changeset
   106
    "return the method (or nil, if I am not a method-file handle)"
120
claus
parents: 114
diff changeset
   107
157
d7f68808a258 reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
   108
    weakMethodRef isNil ifTrue:[^ nil].
120
claus
parents: 114
diff changeset
   109
    ^ weakMethodRef at:1 
claus
parents: 114
diff changeset
   110
claus
parents: 114
diff changeset
   111
    "Created: 14.9.1995 / 21:13:13 / claus"
claus
parents: 114
diff changeset
   112
!
claus
parents: 114
diff changeset
   113
claus
parents: 114
diff changeset
   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
claus
parents: 114
diff changeset
   116
claus
parents: 114
diff changeset
   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
claus
parents: 120
diff changeset
   119
    handleType := #methodObject.
120
claus
parents: 114
diff changeset
   120
claus
parents: 114
diff changeset
   121
    "Created: 14.9.1995 / 21:13:13 / claus"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   122
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   123
976
9078108d2af4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 973
diff changeset
   124
methods
9078108d2af4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 973
diff changeset
   125
    "return the collection of methods (or an empty collection,
9078108d2af4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 973
diff changeset
   126
     if I am not a method-file handle)"
9078108d2af4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 973
diff changeset
   127
9078108d2af4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 973
diff changeset
   128
    |m|
9078108d2af4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 973
diff changeset
   129
9078108d2af4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 973
diff changeset
   130
    (m := self method) isNil ifTrue:[^ #()].
9078108d2af4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 973
diff changeset
   131
    "/ TODO: this will return a real collection, when method-only
9078108d2af4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 973
diff changeset
   132
    "/ binaries remember that relevant information ...
9078108d2af4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 973
diff changeset
   133
    ^ Array with:m
9078108d2af4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 973
diff changeset
   134
!
9078108d2af4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 973
diff changeset
   135
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   136
moduleID
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   137
    "return moduleID"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   138
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   139
    ^ moduleID
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   140
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   141
    "Created: 14.9.1995 / 21:13:12 / claus"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   142
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   143
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   144
moduleID:something
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   145
    "set moduleID"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   146
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   147
    moduleID := something.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   148
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   149
    "Created: 14.9.1995 / 21:13:12 / claus"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   150
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   151
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   152
pathName
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   153
    "return pathName"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   154
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   155
    ^ pathName
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   156
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   157
    "Created: 14.9.1995 / 21:13:12 / claus"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   158
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   159
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   160
pathName:something
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   161
    "set pathName"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   162
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   163
    pathName := something.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   164
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   165
    "Created: 14.9.1995 / 21:13:12 / claus"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   166
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   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
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   180
sysHandle1
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   181
    "return sysHandle1"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   182
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   183
    ^ sysHandle1
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   184
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   185
    "Created: 14.9.1995 / 21:13:12 / claus"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   186
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   187
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   188
sysHandle1:something
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   189
    "set sysHandle1"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   190
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   191
    sysHandle1 := something.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   192
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   193
    "Created: 14.9.1995 / 21:13:12 / claus"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   194
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   195
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   196
sysHandle2
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   197
    "return sysHandle2"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   198
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   199
    ^ sysHandle2
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   200
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   201
    "Created: 14.9.1995 / 21:13:12 / claus"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   202
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   203
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   204
sysHandle2:something
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   205
    "set sysHandle2"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   206
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   207
    sysHandle2 := something.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   208
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   209
    "Created: 14.9.1995 / 21:13:12 / claus"
114
claus
parents:
diff changeset
   210
! !
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   211
259
a469695d8d19 commentary
Claus Gittinger <cg@exept.de>
parents: 157
diff changeset
   212
!ObjectFileHandle methodsFor:'change & update'!
a469695d8d19 commentary
Claus Gittinger <cg@exept.de>
parents: 157
diff changeset
   213
a469695d8d19 commentary
Claus Gittinger <cg@exept.de>
parents: 157
diff changeset
   214
update:something with:aParameter from:changedObject
a469695d8d19 commentary
Claus Gittinger <cg@exept.de>
parents: 157
diff changeset
   215
    "my method/class object was collected - unload the underlying objectfile"
a469695d8d19 commentary
Claus Gittinger <cg@exept.de>
parents: 157
diff changeset
   216
490
621a7283b926 oops - changeArg is #ElementExpired; changedObject is the one we have to
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   217
    changedObject == weakMethodRef ifTrue:[
474
bf2345df4093 new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 388
diff changeset
   218
        weakMethodRef nilAllCorpsesAndDo:[:idx |].
367
87d4673fbd06 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   219
    ].
87d4673fbd06 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   220
490
621a7283b926 oops - changeArg is #ElementExpired; changedObject is the one we have to
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   221
    changedObject == weakClassRefs ifTrue:[
474
bf2345df4093 new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 388
diff changeset
   222
        weakClassRefs nilAllCorpsesAndDo:[:idx |].
367
87d4673fbd06 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   223
    ].
87d4673fbd06 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   224
259
a469695d8d19 commentary
Claus Gittinger <cg@exept.de>
parents: 157
diff changeset
   225
    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
   226
        weakFunctionRefs notNil ifTrue:[
621a7283b926 oops - changeArg is #ElementExpired; changedObject is the one we have to
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   227
            weakFunctionRefs removeDependent:self.
621a7283b926 oops - changeArg is #ElementExpired; changedObject is the one we have to
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   228
            weakFunctionRefs := nil.
621a7283b926 oops - changeArg is #ElementExpired; changedObject is the one we have to
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   229
        ].
621a7283b926 oops - changeArg is #ElementExpired; changedObject is the one we have to
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   230
        weakClassRefs notNil ifTrue:[
621a7283b926 oops - changeArg is #ElementExpired; changedObject is the one we have to
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   231
            weakClassRefs removeDependent:self.
621a7283b926 oops - changeArg is #ElementExpired; changedObject is the one we have to
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   232
            weakClassRefs := nil.
621a7283b926 oops - changeArg is #ElementExpired; changedObject is the one we have to
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   233
        ].
621a7283b926 oops - changeArg is #ElementExpired; changedObject is the one we have to
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   234
        weakMethodRef notNil ifTrue:[
621a7283b926 oops - changeArg is #ElementExpired; changedObject is the one we have to
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   235
            weakMethodRef removeDependent:self.
621a7283b926 oops - changeArg is #ElementExpired; changedObject is the one we have to
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   236
            weakMethodRef := nil.
621a7283b926 oops - changeArg is #ElementExpired; changedObject is the one we have to
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   237
        ].
474
bf2345df4093 new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 388
diff changeset
   238
        ('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
   239
        ObjectFileLoader unloadObjectFile:pathName.
242ec57c2f27 Remove object files that have been collected and not been used
Stefan Vogel <sv@exept.de>
parents: 1080
diff changeset
   240
        snapshot == true ifFalse:[
242ec57c2f27 Remove object files that have been collected and not been used
Stefan Vogel <sv@exept.de>
parents: 1080
diff changeset
   241
            "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
   242
             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
   243
242ec57c2f27 Remove object files that have been collected and not been used
Stefan Vogel <sv@exept.de>
parents: 1080
diff changeset
   244
            pathName asFilename remove.
242ec57c2f27 Remove object files that have been collected and not been used
Stefan Vogel <sv@exept.de>
parents: 1080
diff changeset
   245
        ].
259
a469695d8d19 commentary
Claus Gittinger <cg@exept.de>
parents: 157
diff changeset
   246
    ].
a469695d8d19 commentary
Claus Gittinger <cg@exept.de>
parents: 157
diff changeset
   247
a469695d8d19 commentary
Claus Gittinger <cg@exept.de>
parents: 157
diff changeset
   248
    "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
   249
    "Modified: 30.1.1997 / 20:57:56 / cg"
259
a469695d8d19 commentary
Claus Gittinger <cg@exept.de>
parents: 157
diff changeset
   250
! !
a469695d8d19 commentary
Claus Gittinger <cg@exept.de>
parents: 157
diff changeset
   251
a469695d8d19 commentary
Claus Gittinger <cg@exept.de>
parents: 157
diff changeset
   252
!ObjectFileHandle methodsFor:'copying'!
a469695d8d19 commentary
Claus Gittinger <cg@exept.de>
parents: 157
diff changeset
   253
a469695d8d19 commentary
Claus Gittinger <cg@exept.de>
parents: 157
diff changeset
   254
postCopy
a469695d8d19 commentary
Claus Gittinger <cg@exept.de>
parents: 157
diff changeset
   255
    "flush module handles of the copy"
a469695d8d19 commentary
Claus Gittinger <cg@exept.de>
parents: 157
diff changeset
   256
a469695d8d19 commentary
Claus Gittinger <cg@exept.de>
parents: 157
diff changeset
   257
    sysHandle1 := sysHandle2 := moduleID := nil
a469695d8d19 commentary
Claus Gittinger <cg@exept.de>
parents: 157
diff changeset
   258
a469695d8d19 commentary
Claus Gittinger <cg@exept.de>
parents: 157
diff changeset
   259
    "Created: 5.12.1995 / 21:10:49 / cg"
a469695d8d19 commentary
Claus Gittinger <cg@exept.de>
parents: 157
diff changeset
   260
    "Modified: 25.4.1996 / 09:43:53 / cg"
a469695d8d19 commentary
Claus Gittinger <cg@exept.de>
parents: 157
diff changeset
   261
! !
a469695d8d19 commentary
Claus Gittinger <cg@exept.de>
parents: 157
diff changeset
   262
1080
bd3f19f6009a category change
Claus Gittinger <cg@exept.de>
parents: 1038
diff changeset
   263
!ObjectFileHandle methodsFor:'printing & storing'!
157
d7f68808a258 reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
   264
d7f68808a258 reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
   265
printOn:aStream
259
a469695d8d19 commentary
Claus Gittinger <cg@exept.de>
parents: 157
diff changeset
   266
    "append a printed representation of the receiver to aStream"
a469695d8d19 commentary
Claus Gittinger <cg@exept.de>
parents: 157
diff changeset
   267
157
d7f68808a258 reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
   268
    aStream nextPutAll:self class name; nextPutAll:'(handle=<'. 
d7f68808a258 reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
   269
    sysHandle1 printOn:aStream. 
d7f68808a258 reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
   270
    aStream nextPutAll:' '. 
d7f68808a258 reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
   271
    sysHandle2 printOn:aStream. 
d7f68808a258 reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
   272
    aStream nextPutAll:'> path='''. 
d7f68808a258 reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
   273
    pathName printOn:aStream. 
d7f68808a258 reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
   274
    aStream nextPutAll:''' id='. 
d7f68808a258 reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
   275
    moduleID printOn:aStream. 
d7f68808a258 reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
   276
    aStream nextPutAll:' type='. 
d7f68808a258 reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
   277
    handleType printOn:aStream.
d7f68808a258 reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
   278
    aStream nextPutAll:' method=<'.
d7f68808a258 reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
   279
    self method printOn:aStream.
d7f68808a258 reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
   280
    aStream nextPutAll:'> classes=<'.
d7f68808a258 reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
   281
    self classes 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
d7f68808a258 reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
   284
    aStream nextPutAll:')'.
d7f68808a258 reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
   285
259
a469695d8d19 commentary
Claus Gittinger <cg@exept.de>
parents: 157
diff changeset
   286
    "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
   287
! !
d7f68808a258 reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
   288
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   289
!ObjectFileHandle methodsFor:'queries'!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   290
299
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   291
getFunction:aString
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   292
    "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
   293
     the receiver."
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   294
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   295
    |address f slot sz nW|
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   296
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   297
    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
   298
    address isNil ifTrue:[
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   299
        ^ nil
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   300
    ].
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   301
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   302
    weakFunctionRefs isNil ifTrue:[
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   303
        handleType := #functionObject.
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   304
        f := ExternalFunction basicNew code:address.
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   305
        f setName:aString moduleHandle:self.
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   306
        weakFunctionRefs := WeakArray with:f.
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   307
        ^ f.
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
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   310
    weakFunctionRefs nonNilElementsDo:[:anExternalFunction |
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   311
        anExternalFunction code = address ifTrue:[
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   312
            ^ anExternalFunction
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
    ].
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   315
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
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   319
    slot := weakFunctionRefs identityIndexOf:nil.
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   320
    slot ~~ 0 ifTrue:[
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   321
        weakFunctionRefs at:slot put:f.
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   322
        ^ f.
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   323
    ].
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   324
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   325
    sz := weakFunctionRefs size.
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   326
    nW := WeakArray new:(sz + 2).
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   327
    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
   328
    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
   329
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   330
    weakFunctionRefs := nW.
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   331
    ^ f
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   332
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   333
    "Created: 12.7.1996 / 14:59:09 / cg"
368
26e9268bde0f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   334
    "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
   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
hasUndefinedSymbols
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   338
    "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
   339
     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
   340
     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
   341
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   342
    ^ ObjectFileLoader hasUndefinedSymbolsIn:self
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   343
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   344
    "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
   345
!
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   346
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   347
isClassLibHandle
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   348
    "return true, if I am a handle for a class library"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   349
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   350
    ^ handleType == #classLibraryObject 
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   351
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   352
157
d7f68808a258 reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
   353
isForCollectedObject
d7f68808a258 reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
   354
    "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
   355
367
87d4673fbd06 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   356
    |ref|
87d4673fbd06 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   357
157
d7f68808a258 reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
   358
    handleType == #classLibraryObject ifTrue:[
367
87d4673fbd06 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   359
        ^ (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
   360
    ].
d7f68808a258 reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
   361
    handleType == #methodObject ifTrue:[
1038
faf50ed50034 checkin from browser
ps
parents: 976
diff changeset
   362
        weakMethodRef isNil ifTrue:[^ true].
faf50ed50034 checkin from browser
ps
parents: 976
diff changeset
   363
        ref := weakMethodRef at:1.
367
87d4673fbd06 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   364
        ^ ref isNil or:[ref == 0]
157
d7f68808a258 reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
   365
    ].
299
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   366
    handleType == #functionObject ifTrue:[
367
87d4673fbd06 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   367
        ^ (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
   368
    ].
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   369
157
d7f68808a258 reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
   370
    ^ false
d7f68808a258 reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
   371
d7f68808a258 reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
   372
    "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
   373
    "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
   374
!
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   375
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   376
isFunctionObjectHandle
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   377
    "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
   378
304
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   379
    ^ handleType == #functionObject
299
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   380
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   381
    "Created: 12.7.1996 / 15:35:33 / cg"
304
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   382
    "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
   383
!
d7f68808a258 reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
   384
259
a469695d8d19 commentary
Claus Gittinger <cg@exept.de>
parents: 157
diff changeset
   385
isMethodHandle
a469695d8d19 commentary
Claus Gittinger <cg@exept.de>
parents: 157
diff changeset
   386
    "return true, if I am a handle for a single compiled method"
a469695d8d19 commentary
Claus Gittinger <cg@exept.de>
parents: 157
diff changeset
   387
a469695d8d19 commentary
Claus Gittinger <cg@exept.de>
parents: 157
diff changeset
   388
    ^ handleType == #methodObject
a469695d8d19 commentary
Claus Gittinger <cg@exept.de>
parents: 157
diff changeset
   389
!
a469695d8d19 commentary
Claus Gittinger <cg@exept.de>
parents: 157
diff changeset
   390
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   391
isObsolete
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   392
    "return true, if my clases/method has already been removed from
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   393
     the image. I.e. if the object file can be unloaded without danger."
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   394
367
87d4673fbd06 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   395
    |ref|
87d4673fbd06 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   396
154
04716b86ad29 reloading compiled methods
Claus Gittinger <cg@exept.de>
parents: 152
diff changeset
   397
    moduleID notNil ifTrue:[
299
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   398
        handleType == #classLibraryObject ifTrue:[
367
87d4673fbd06 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   399
            ^ (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
   400
        ].
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   401
        handleType == #methodObject ifTrue:[
367
87d4673fbd06 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   402
	    ref := weakMethodRef at:1.
87d4673fbd06 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   403
            ^ (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
   404
        ].
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   405
        handleType == #functionObject ifTrue:[
367
87d4673fbd06 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   406
            ^ (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
   407
        ].
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   408
    ].
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   409
    ^ false
299
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   410
33a154508328 additional support for non-ST object files (function modules)
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   411
    "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
   412
!
160ab002eed1 support proper unregistration, when a classLib fails to load
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   413
160ab002eed1 support proper unregistration, when a classLib fails to load
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   414
isUnknownHandle
160ab002eed1 support proper unregistration, when a classLib fails to load
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   415
    "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
   416
     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
   417
     registered/initialized)"
160ab002eed1 support proper unregistration, when a classLib fails to load
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   418
160ab002eed1 support proper unregistration, when a classLib fails to load
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   419
    ^ handleType isNil
973
67ea50ac2f99 added package access
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
   420
!
67ea50ac2f99 added package access
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
   421
67ea50ac2f99 added package access
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
   422
package
67ea50ac2f99 added package access
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
   423
    "retrieve the packageID of the class-library handle"
67ea50ac2f99 added package access
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
   424
67ea50ac2f99 added package access
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
   425
    |cls mthd|
67ea50ac2f99 added package access
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
   426
67ea50ac2f99 added package access
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
   427
    "/ sigh - for now, the package must be extracted from the first classes/methods
67ea50ac2f99 added package access
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
   428
    "/ package.
67ea50ac2f99 added package access
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
   429
67ea50ac2f99 added package access
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
   430
    self isClassLibHandle ifTrue:[
67ea50ac2f99 added package access
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
   431
        cls := self classes firstIfEmpty:nil.
67ea50ac2f99 added package access
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
   432
        cls notNil ifTrue:[^ cls package]
67ea50ac2f99 added package access
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
   433
    ].
67ea50ac2f99 added package access
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
   434
    self isMethodHandle ifTrue:[
67ea50ac2f99 added package access
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
   435
        cls := self methods firstIfEmpty:nil.
67ea50ac2f99 added package access
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
   436
        mthd notNil ifTrue:[^ mthd package]
67ea50ac2f99 added package access
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
   437
    ].
67ea50ac2f99 added package access
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
   438
    ^ nil
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   439
! !
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   440
368
26e9268bde0f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   441
!ObjectFileHandle class methodsFor:'documentation'!
148
ef0e604209ec version method at the end
Claus Gittinger <cg@exept.de>
parents: 141
diff changeset
   442
ef0e604209ec version method at the end
Claus Gittinger <cg@exept.de>
parents: 141
diff changeset
   443
version
1163
242ec57c2f27 Remove object files that have been collected and not been used
Stefan Vogel <sv@exept.de>
parents: 1080
diff changeset
   444
    ^ '$Header: /cvs/stx/stx/libcomp/ObjectFileHandle.st,v 1.29 2001-07-25 14:01:27 stefan Exp $'
148
ef0e604209ec version method at the end
Claus Gittinger <cg@exept.de>
parents: 141
diff changeset
   445
! !