ObjectFileLoader.st
changeset 1988 6d075e94c774
parent 1975 ef4a78faca4a
child 1993 b83da4907a07
equal deleted inserted replaced
1987:9e2e24397b1f 1988:6d075e94c774
  1116      Return nil on error, an objectFile handle if ok."
  1116      Return nil on error, an objectFile handle if ok."
  1117 
  1117 
  1118     |handle initAddr className initNames didInit info status
  1118     |handle initAddr className initNames didInit info status
  1119      dummyHandle msg isCModule|
  1119      dummyHandle msg isCModule|
  1120 
  1120 
       
  1121     handle := self handleForDynamicObject:aFileName.
       
  1122     handle notNil ifTrue:[
       
  1123         "already loaded"
       
  1124         ^ handle.
       
  1125     ].
       
  1126 
  1121     handle := self loadDynamicObject:aFileName.
  1127     handle := self loadDynamicObject:aFileName.
  1122     handle isNil ifTrue:[
  1128     handle isNil ifTrue:[
  1123 	^ nil
  1129         ^ nil
  1124     ].
  1130     ].
  1125 
  1131 
  1126     didInit := false.
  1132     didInit := false.
  1127     isCModule := false.
  1133     isCModule := false.
  1128 
  1134 
  1129     "/ with dld, load may have worked, even if undefined symbols
  1135     "/ with dld, load may have worked, even if undefined symbols
  1130     "/ are to be resolved. If thats the case, load all libraries ...
  1136     "/ are to be resolved. If thats the case, load all libraries ...
  1131 
  1137 
  1132     ParserFlags searchedLibraries notNil ifTrue:[
  1138     ParserFlags searchedLibraries notNil ifTrue:[
  1133 	(self hasUndefinedSymbolsIn:handle) ifTrue:[
  1139         (self hasUndefinedSymbolsIn:handle) ifTrue:[
  1134 	    self initializeLoader.
  1140             self initializeLoader.
  1135 
  1141 
  1136 	    ParserFlags searchedLibraries do:[:libName |
  1142             ParserFlags searchedLibraries do:[:libName |
  1137 		(self hasUndefinedSymbolsIn:handle) ifTrue:[
  1143                 (self hasUndefinedSymbolsIn:handle) ifTrue:[
  1138 		    Transcript showCR:'   ... trying ' , libName , ' to resolve undefined symbols ...'.
  1144                     Transcript showCR:'   ... trying ' , libName , ' to resolve undefined symbols ...'.
  1139 		    dummyHandle := Array new:4.
  1145                     dummyHandle := Array new:4.
  1140 		    dummyHandle := self primLoadDynamicObject:libName into:dummyHandle.
  1146                     dummyHandle := self primLoadDynamicObject:libName into:dummyHandle.
  1141 "/                    dummyHandle isNil ifTrue:[
  1147 "/                    dummyHandle isNil ifTrue:[
  1142 "/                        Transcript showCR:'   ... load of library ' , libName , ' failed.'.
  1148 "/                        Transcript showCR:'   ... load of library ' , libName , ' failed.'.
  1143 "/                    ]
  1149 "/                    ]
  1144 		]
  1150                 ]
  1145 	    ].
  1151             ].
  1146 	    (self hasUndefinedSymbolsIn:handle) isNil ifTrue:[
  1152             (self hasUndefinedSymbolsIn:handle) isNil ifTrue:[
  1147 		Transcript showCR:('ObjectFileLoader [info]: still undefined symbols in ',aFileName,'.').
  1153                 Transcript showCR:('ObjectFileLoader [info]: still undefined symbols in ',aFileName,'.').
  1148 	    ].
  1154             ].
  1149 	]
  1155         ]
  1150     ].
  1156     ].
  1151 
  1157 
  1152     "
  1158     "
  1153      first, expect the classes-name to be the fileNames-baseName
  1159      first, expect the classes-name to be the fileNames-baseName
  1154      (if its not, it may be a method or function module;
  1160      (if its not, it may be a method or function module;
  1162     "/ This is used in ST object files
  1168     "/ This is used in ST object files
  1163     "/
  1169     "/
  1164     initAddr := self findInitFunction:className in:handle.
  1170     initAddr := self findInitFunction:className in:handle.
  1165 
  1171 
  1166     initAddr notNil ifTrue:[
  1172     initAddr notNil ifTrue:[
  1167 	Verbose ifTrue:[
  1173         Verbose ifTrue:[
  1168 	    ('calling init at:' , (initAddr printStringRadix:16)) errorPrintCR.
  1174             ('calling init at:' , (initAddr printStringRadix:16)) errorPrintCR.
  1169 	].
  1175         ].
  1170 	info := self
  1176         info := self
  1171 		    performModuleInitAt:initAddr
  1177                     performModuleInitAt:initAddr
  1172 		    invokeInitializeMethods:invokeInitializeMethods
  1178                     invokeInitializeMethods:invokeInitializeMethods
  1173 		    for:nil
  1179                     for:nil
  1174 		    identifyAs:handle.
  1180                     identifyAs:handle.
  1175 	status := info at:1.
  1181         status := info at:1.
  1176 	status == #ok ifTrue:[
  1182         status == #ok ifTrue:[
  1177 	    didInit := true.
  1183             didInit := true.
  1178 	]
  1184         ]
  1179     ] ifFalse:[
  1185     ] ifFalse:[
  1180 	"/
  1186         "/
  1181 	"/ look for explicit C-init (xxx__Init) function
  1187         "/ look for explicit C-init (xxx__Init) function
  1182 	"/ This is used in C object files
  1188         "/ This is used in C object files
  1183 	"/
  1189         "/
  1184 	initAddr := self findFunction:className suffix:'__Init' in:handle.
  1190         initAddr := self findFunction:className suffix:'__Init' in:handle.
  1185 	initAddr notNil ifTrue:[
  1191         initAddr notNil ifTrue:[
  1186 	    isCModule := true.
  1192             isCModule := true.
  1187 
  1193 
  1188 	    OSSignalInterrupt handle:[:ex |
  1194             OSSignalInterrupt handle:[:ex |
  1189 		('ObjectFileLoader [warning]: hard error in initFunction of class-module: ' , aFileName) errorPrintCR.
  1195                 ('ObjectFileLoader [warning]: hard error in initFunction of class-module: ' , aFileName) errorPrintCR.
  1190 		status := #initFailed.
  1196                 status := #initFailed.
  1191 	    ] do:[
  1197             ] do:[
  1192 		(self callInitFunctionAt:initAddr
  1198                 (self callInitFunctionAt:initAddr
  1193 		     specialInit:false
  1199                      specialInit:false
  1194 		     forceOld:true
  1200                      forceOld:true
  1195 		     interruptable:false
  1201                      interruptable:false
  1196 		     argument:0
  1202                      argument:0
  1197 		     identifyAs:handle
  1203                      identifyAs:handle
  1198 		     returnsObject:false) < 0 ifTrue:[
  1204                      returnsObject:false) < 0 ifTrue:[
  1199 
  1205 
  1200 		    Verbose ifTrue:[
  1206                     Verbose ifTrue:[
  1201 			'init function return failure ... unload' errorPrintCR.
  1207                         'init function return failure ... unload' errorPrintCR.
  1202 		    ].
  1208                     ].
  1203 		    status := #initFailed.
  1209                     status := #initFailed.
  1204 		] ifFalse:[
  1210                 ] ifFalse:[
  1205 		    didInit := true.
  1211                     didInit := true.
  1206 		]
  1212                 ]
  1207 	    ]
  1213             ]
  1208 	] ifFalse:[
  1214         ] ifFalse:[
  1209 	    status := #noInitFunction.
  1215             status := #noInitFunction.
  1210 
  1216 
  1211 	    "
  1217             "
  1212 	     look for any init-function(s); call them all
  1218              look for any init-function(s); call them all
  1213 	    "
  1219             "
  1214 	    Verbose ifTrue:[
  1220             Verbose ifTrue:[
  1215 		'no good init functions found; looking for candidates ...' errorPrintCR.
  1221                 'no good init functions found; looking for candidates ...' errorPrintCR.
  1216 	    ].
  1222             ].
  1217 	    initNames := self namesMatching:'*_Init' segment:'[tT?]' in:aFileName.
  1223             initNames := self namesMatching:'*_Init' segment:'[tT?]' in:aFileName.
  1218 	    initNames notNil ifTrue:[
  1224             initNames notNil ifTrue:[
  1219 		initNames do:[:aName |
  1225                 initNames do:[:aName |
  1220 		    initAddr := self getFunction:aName from:handle.
  1226                     initAddr := self getFunction:aName from:handle.
  1221 		    initAddr isNil ifTrue:[
  1227                     initAddr isNil ifTrue:[
  1222 			(aName startsWith:'_') ifTrue:[
  1228                         (aName startsWith:'_') ifTrue:[
  1223 			    initAddr := self getFunction:(aName copyFrom:2) from:handle.
  1229                             initAddr := self getFunction:(aName copyFrom:2) from:handle.
  1224 			].
  1230                         ].
  1225 		    ].
  1231                     ].
  1226 		    initAddr isNil ifTrue:[
  1232                     initAddr isNil ifTrue:[
  1227 			Transcript showCR:('no symbol: ',aName,' in ',aFileName).
  1233                         Transcript showCR:('no symbol: ',aName,' in ',aFileName).
  1228 		    ] ifFalse:[
  1234                     ] ifFalse:[
  1229 			Verbose ifTrue:[
  1235                         Verbose ifTrue:[
  1230 			    ('calling init at:' , (initAddr printStringRadix:16)) errorPrintCR
  1236                             ('calling init at:' , (initAddr printStringRadix:16)) errorPrintCR
  1231 			].
  1237                         ].
  1232 			self
  1238                         self
  1233 			    performModuleInitAt:initAddr
  1239                             performModuleInitAt:initAddr
  1234 			    invokeInitializeMethods:invokeInitializeMethods
  1240                             invokeInitializeMethods:invokeInitializeMethods
  1235 			    for:nil
  1241                             for:nil
  1236 			    identifyAs:handle.
  1242                             identifyAs:handle.
  1237 			didInit := true.
  1243                         didInit := true.
  1238 		    ]
  1244                     ]
  1239 		].
  1245                 ].
  1240 	    ].
  1246             ].
  1241 	]
  1247         ]
  1242     ].
  1248     ].
  1243 
  1249 
  1244     didInit ifFalse:[
  1250     didInit ifFalse:[
  1245 	status == #noInitFunction ifTrue:[
  1251         status == #noInitFunction ifTrue:[
  1246 	    msg := 'ObjectFileLoader [info]: no init function; assume load ok'
  1252             msg := 'ObjectFileLoader [info]: no init function; assume load ok'
  1247 	] ifFalse:[
  1253         ] ifFalse:[
  1248 
  1254 
  1249 	    (status ~~ #registrationFailed
  1255             (status ~~ #registrationFailed
  1250 	    and:[status ~~ #initFailed
  1256             and:[status ~~ #initFailed
  1251 	    and:[status ~~ #missingClass
  1257             and:[status ~~ #missingClass
  1252 	    and:[status ~~ #versionMismatch]]])
  1258             and:[status ~~ #versionMismatch]]])
  1253 	    ifTrue:[
  1259             ifTrue:[
  1254 		self listUndefinedSymbolsIn:handle.
  1260                 self listUndefinedSymbolsIn:handle.
  1255 	    ].
  1261             ].
  1256 
  1262 
  1257 	    Verbose ifTrue:[
  1263             Verbose ifTrue:[
  1258 		'unloading, since init failed ...' errorPrintCR.
  1264                 'unloading, since init failed ...' errorPrintCR.
  1259 	    ].
  1265             ].
  1260 	    self unloadDynamicObject:handle.
  1266             self unloadDynamicObject:handle.
  1261 	    Verbose ifTrue:[
  1267             Verbose ifTrue:[
  1262 		'unloaded.' errorPrintCR.
  1268                 'unloaded.' errorPrintCR.
  1263 	    ].
  1269             ].
  1264 	    handle := nil.
  1270             handle := nil.
  1265 
  1271 
  1266 	    status == #initFailed ifTrue:[
  1272             status == #initFailed ifTrue:[
  1267 		msg := 'ObjectFileLoader [info]: module not loaded (init function signalled failure).'
  1273                 msg := 'ObjectFileLoader [info]: module not loaded (init function signalled failure).'
  1268 	    ] ifFalse:[
  1274             ] ifFalse:[
  1269 		status == #missingClass ifTrue:[
  1275                 status == #missingClass ifTrue:[
  1270 		    msg := 'ObjectFileLoader [info]: module not loaded (superclass missing: ' , (info at:2) , ').'
  1276                     msg := 'ObjectFileLoader [info]: module not loaded (superclass missing: ' , (info at:2) , ').'
  1271 		] ifFalse:[
  1277                 ] ifFalse:[
  1272 		    status == #registrationFailed ifTrue:[
  1278                     status == #registrationFailed ifTrue:[
  1273 			msg :=  'ObjectFileLoader [info]: module registration failed (incompatible object or missing superclass)'
  1279                         msg :=  'ObjectFileLoader [info]: module registration failed (incompatible object or missing superclass)'
  1274 		    ] ifFalse:[
  1280                     ] ifFalse:[
  1275 			status == #versionMismatch ifTrue:[
  1281                         status == #versionMismatch ifTrue:[
  1276 			    msg :=  'ObjectFileLoader [info]: module registration failed (class version mismatch ' , (info at:2) printString , ')'
  1282                             msg :=  'ObjectFileLoader [info]: module registration failed (class version mismatch ' , (info at:2) printString , ')'
  1277 			] ifFalse:[
  1283                         ] ifFalse:[
  1278 			    (self namesMatching:'*__sepInitCode__*' segment:'[tT?]' in:aFileName) notNil ifTrue:[
  1284                             (self namesMatching:'*__sepInitCode__*' segment:'[tT?]' in:aFileName) notNil ifTrue:[
  1279 				msg := 'ObjectFileLoader [info]: module not loaded (unknown error reason).'
  1285                                 msg := 'ObjectFileLoader [info]: module not loaded (unknown error reason).'
  1280 			    ] ifFalse:[
  1286                             ] ifFalse:[
  1281 				msg := 'ObjectFileLoader [info]: module not loaded (no _Init entry in object file ?).'
  1287                                 msg := 'ObjectFileLoader [info]: module not loaded (no _Init entry in object file ?).'
  1282 			    ]
  1288                             ]
  1283 			]
  1289                         ]
  1284 		    ].
  1290                     ].
  1285 		].
  1291                 ].
  1286 	    ].
  1292             ].
  1287 	].
  1293         ].
  1288 	Smalltalk isStandAloneApp ifTrue:[
  1294         Smalltalk isStandAloneApp ifTrue:[
  1289 	    msg errorPrintCR
  1295             msg errorPrintCR
  1290 	] ifFalse:[
  1296         ] ifFalse:[
  1291 	    Transcript showCR:msg
  1297             Transcript showCR:msg
  1292 	].
  1298         ].
  1293     ].
  1299     ].
  1294 
  1300 
  1295     isCModule ifFalse:[
  1301     isCModule ifFalse:[
  1296 	"/ Smalltalk flushCachedClasses.
  1302         "/ Smalltalk flushCachedClasses.
  1297 	Smalltalk isInitialized ifTrue:[
  1303         Smalltalk isInitialized ifTrue:[
  1298 	    "
  1304             "
  1299 	     really dont know, if it has changed ...
  1305              really dont know, if it has changed ...
  1300 	     ... but assume, that new classes have been installed.
  1306              ... but assume, that new classes have been installed.
  1301 	    "
  1307             "
  1302 	    Smalltalk changed.
  1308             Smalltalk changed.
  1303 	]
  1309         ]
  1304     ].
  1310     ].
  1305     ^ handle
  1311     ^ handle
  1306 
  1312 
  1307     "Modified: / 06-12-2006 / 18:22:49 / cg"
  1313     "Modified: / 06-12-2006 / 18:22:49 / cg"
  1308 !
  1314 !
  2709     "
  2715     "
  2710 
  2716 
  2711     |handle buffer|
  2717     |handle buffer|
  2712 
  2718 
  2713     Verbose ifTrue:[
  2719     Verbose ifTrue:[
  2714 	('loadDynamic: ' , pathName , ' ...') errorPrintCR
  2720         ('loadDynamic: ' , pathName , ' ...') errorPrintCR
  2715     ].
  2721     ].
  2716 
  2722 
  2717     "/ already loaded ?
  2723     "/ already loaded ?
  2718 
  2724 
  2719     LoadedObjects notNil ifTrue:[
  2725     handle := self handleForDynamicObject:pathName.
  2720 	handle := LoadedObjects at:pathName ifAbsent:nil.
  2726     handle notNil ifTrue:[
  2721 	handle notNil ifTrue:[
  2727         Verbose ifTrue:[
  2722 	    Verbose ifTrue:[
  2728             ('... ' , pathName , ' already loaded.') errorPrintCR.
  2723 		('... ' , pathName , ' already loaded.') errorPrintCR.
  2729         ].
  2724 	    ].
  2730         ^ handle
  2725 	    ^ handle
       
  2726 	].
       
  2727     ].
  2731     ].
  2728 
  2732 
  2729     Verbose ifTrue:[
  2733     Verbose ifTrue:[
  2730 	('initializeLoader...') errorPrintCR
  2734         ('initializeLoader...') errorPrintCR
  2731     ].
  2735     ].
  2732     self initializeLoader.
  2736     self initializeLoader.
  2733 
  2737 
  2734     "/
  2738     "/
  2735     "/ the 1st two entries are system dependent;
  2739     "/ the 1st two entries are system dependent;
  2739     buffer := Array new:4.
  2743     buffer := Array new:4.
  2740     buffer at:3 put:pathName.
  2744     buffer at:3 put:pathName.
  2741     buffer at:4 put:NextHandleID. NextHandleID := NextHandleID + 1.
  2745     buffer at:4 put:NextHandleID. NextHandleID := NextHandleID + 1.
  2742 
  2746 
  2743     Verbose ifTrue:[
  2747     Verbose ifTrue:[
  2744 	('primLoadDynamicObject...') errorPrintCR
  2748         ('primLoadDynamicObject...') errorPrintCR
  2745     ].
  2749     ].
  2746 
  2750 
  2747     buffer := self primLoadDynamicObject:pathName into:buffer.
  2751     buffer := self primLoadDynamicObject:pathName into:buffer.
  2748     Verbose ifTrue:[
  2752     Verbose ifTrue:[
  2749 	('done') errorPrintCR
  2753         ('done') errorPrintCR
  2750     ].
  2754     ].
  2751 
  2755 
  2752     buffer isNil ifTrue:[
  2756     buffer isNil ifTrue:[
  2753 	LastError == #notImplemented ifTrue:[
  2757         LastError == #notImplemented ifTrue:[
  2754 	    'ObjectFileLoader [warning]: no dynamic load facility present.' infoPrintCR.
  2758             'ObjectFileLoader [warning]: no dynamic load facility present.' infoPrintCR.
  2755 	] ifFalse:[
  2759         ] ifFalse:[
  2756 	    LastError == #linkError ifTrue:[
  2760             LastError == #linkError ifTrue:[
  2757 		LinkErrorMessage notNil ifTrue:[
  2761                 LinkErrorMessage notNil ifTrue:[
  2758 		    ('ObjectFileLoader [warning]: load error:' , LinkErrorMessage) infoPrintCR.
  2762                     ('ObjectFileLoader [warning]: load error:' , LinkErrorMessage) infoPrintCR.
  2759 		] ifFalse:[
  2763                 ] ifFalse:[
  2760 		    ('ObjectFileLoader [warning]: load error') infoPrintCR.
  2764                     ('ObjectFileLoader [warning]: load error') infoPrintCR.
  2761 		].
  2765                 ].
  2762 	    ].
  2766             ].
  2763 	].
  2767         ].
  2764 	('ObjectFileLoader [warning]: failed to load: ' , pathName) infoPrintCR.
  2768         ('ObjectFileLoader [warning]: failed to load: ' , pathName) infoPrintCR.
  2765 	Transcript showCR:('ObjectFileLoader [warning]: failed to load: ' , pathName).
  2769         Transcript showCR:('ObjectFileLoader [warning]: failed to load: ' , pathName).
  2766 	^ nil
  2770         ^ nil
  2767     ].
  2771     ].
  2768 
  2772 
  2769     "
  2773     "
  2770      remember loaded object for later unloading
  2774      remember loaded object for later unloading
  2771     "
  2775     "
  2774     handle sysHandle2:(buffer at:2).
  2778     handle sysHandle2:(buffer at:2).
  2775     handle pathName:(buffer at:3).
  2779     handle pathName:(buffer at:3).
  2776     handle moduleID:(buffer at:4).
  2780     handle moduleID:(buffer at:4).
  2777 
  2781 
  2778     LoadedObjects isNil ifTrue:[
  2782     LoadedObjects isNil ifTrue:[
  2779 	LoadedObjects := Dictionary new.
  2783         LoadedObjects := Dictionary new.
  2780     ].
  2784     ].
  2781     LoadedObjects at:pathName put:handle.
  2785     LoadedObjects at:pathName put:handle.
  2782     "/ Smalltalk flushCachedClasses.
  2786     "/ Smalltalk flushCachedClasses.
  2783 
  2787 
  2784     Verbose ifTrue:[
  2788     Verbose ifTrue:[
  2785 	('loadDynamic ok; handle is: ' , handle printString) errorPrintCR.
  2789         ('loadDynamic ok; handle is: ' , handle printString) errorPrintCR.
  2786     ].
  2790     ].
  2787 
  2791 
  2788     ^ handle
  2792     ^ handle
  2789 
  2793 
  2790     "sys5.4:
  2794     "sys5.4:
  3519     "
  3523     "
  3520 
  3524 
  3521     "Modified: 8.1.1997 / 18:13:01 / cg"
  3525     "Modified: 8.1.1997 / 18:13:01 / cg"
  3522 !
  3526 !
  3523 
  3527 
       
  3528 handleForDynamicObject:pathName
       
  3529     "answer the handle of pathName (or nil if it has not been loaded)"
       
  3530 
       
  3531     LoadedObjects isNil ifTrue:[
       
  3532         ^ nil.
       
  3533     ].
       
  3534     ^ LoadedObjects at:pathName ifAbsent:nil.
       
  3535 !
       
  3536 
  3524 loadedObjectFiles
  3537 loadedObjectFiles
  3525     "return a collection containing the names of all
  3538     "return a collection containing the names of all
  3526      dynamically loaded objects."
  3539      dynamically loaded objects."
  3527 
  3540 
  3528     LoadedObjects isNil ifTrue:[^ #()].
  3541     LoadedObjects isNil ifTrue:[^ #()].
  3719 	    RETURN (retVal);
  3732 	    RETURN (retVal);
  3720 	}
  3733 	}
  3721     }
  3734     }
  3722 %}.
  3735 %}.
  3723     self primitiveFailed
  3736     self primitiveFailed
       
  3737 !
       
  3738 
       
  3739 classPresentCheck:aClassOrClassName
       
  3740     "callBack from class registration code in VM:
       
  3741      make certain, that aClassOrClassName is loaded too ...
       
  3742      (req'd if a subclass of an autoloaded class has been loaded).
       
  3743     This is now invoked both for superClasses AND preRequisite classnames (for extensions)"
       
  3744 
       
  3745     |className class|
       
  3746 
       
  3747     aClassOrClassName isBehavior ifTrue:[
       
  3748 	class := aClassOrClassName.
       
  3749 	className := aClassOrClassName name.
       
  3750     ] ifFalse:[
       
  3751 	aClassOrClassName isString ifTrue:[
       
  3752 	    className := aClassOrClassName.
       
  3753 	    class := Smalltalk classNamed:aClassOrClassName.
       
  3754 	] ifFalse:[
       
  3755 	    'ObjectFileLoader [warning]: check failed - no behavior' errorPrintCR.
       
  3756 	    ^ false
       
  3757 	]
       
  3758     ].
       
  3759 
       
  3760     class isNil ifTrue:[
       
  3761 	Verbose ifTrue:[
       
  3762 	    ('ObjectFileLoader [info]: missing class: ' , className) errorPrintCR.
       
  3763 	].
       
  3764 	"/ how can I find this missing class - need some package info
       
  3765 	^ false.
       
  3766     ].
       
  3767 
       
  3768     class notNil ifTrue:[
       
  3769 	Verbose ifTrue:[
       
  3770 	    ('ObjectFileLoader [info]: check for ' , className , ' being loaded') errorPrintCR.
       
  3771 	].
       
  3772 
       
  3773 	class autoload.
       
  3774 	(class isBehavior and:[class isLoaded]) ifTrue:[
       
  3775 	    Verbose ifTrue:[
       
  3776 		('ObjectFileLoader [info]: ok, loaded. continue registration of actual class') errorPrintCR.
       
  3777 	    ].
       
  3778 	    class signature.       "/ req'd in VM for validation
       
  3779 	    ^ true
       
  3780 	].
       
  3781     ].
       
  3782 
       
  3783     ('ObjectFileLoader [warning]: superclass not loaded; registration of ' , className , ' fails') errorPrintCR.
       
  3784     ^ false
       
  3785 
       
  3786     "Modified: 10.1.1997 / 17:58:48 / cg"
  3724 !
  3787 !
  3725 
  3788 
  3726 deinitializeClassesFromModule:handle
  3789 deinitializeClassesFromModule:handle
  3727     "send #deinitialize and an #aboutToUnload notification
  3790     "send #deinitialize and an #aboutToUnload notification
  3728      to all classes of a module."
  3791      to all classes of a module."
  4027 %{
  4090 %{
  4028     __REVALIDATE_BY_ID(__intVal(id));
  4091     __REVALIDATE_BY_ID(__intVal(id));
  4029 %}
  4092 %}
  4030 !
  4093 !
  4031 
  4094 
  4032 classPresentCheck:aClassOrClassName
       
  4033     "callBack from class registration code in VM:
       
  4034      make certain, that aClassOrClassName is loaded too ...
       
  4035      (req'd if a subclass of an autoloaded class has been loaded).
       
  4036     This is now invoked both for superClasses AND preRequisite classnames (for extensions)"
       
  4037 
       
  4038     |className class|
       
  4039 
       
  4040     aClassOrClassName isBehavior ifTrue:[
       
  4041 	class := aClassOrClassName.
       
  4042 	className := aClassOrClassName name.
       
  4043     ] ifFalse:[
       
  4044 	aClassOrClassName isString ifTrue:[
       
  4045 	    className := aClassOrClassName.
       
  4046 	    class := Smalltalk classNamed:aClassOrClassName.
       
  4047 	] ifFalse:[
       
  4048 	    'ObjectFileLoader [warning]: check failed - no behavior' errorPrintCR.
       
  4049 	    ^ false
       
  4050 	]
       
  4051     ].
       
  4052 
       
  4053     class isNil ifTrue:[
       
  4054 	Verbose ifTrue:[
       
  4055 	    ('ObjectFileLoader [info]: missing class: ' , className) errorPrintCR.
       
  4056 	].
       
  4057 	"/ how can I find this missing class - need some package info
       
  4058 	^ false.
       
  4059     ].
       
  4060 
       
  4061     class notNil ifTrue:[
       
  4062 	Verbose ifTrue:[
       
  4063 	    ('ObjectFileLoader [info]: check for ' , className , ' being loaded') errorPrintCR.
       
  4064 	].
       
  4065 
       
  4066 	class autoload.
       
  4067 	(class isBehavior and:[class isLoaded]) ifTrue:[
       
  4068 	    Verbose ifTrue:[
       
  4069 		('ObjectFileLoader [info]: ok, loaded. continue registration of actual class') errorPrintCR.
       
  4070 	    ].
       
  4071 	    class signature.       "/ req'd in VM for validation
       
  4072 	    ^ true
       
  4073 	].
       
  4074     ].
       
  4075 
       
  4076     ('ObjectFileLoader [warning]: superclass not loaded; registration of ' , className , ' fails') errorPrintCR.
       
  4077     ^ false
       
  4078 
       
  4079     "Modified: 10.1.1997 / 17:58:48 / cg"
       
  4080 !
       
  4081 
       
  4082 unregisterModule:handle
  4095 unregisterModule:handle
  4083     "unregister classes in the VM.
  4096     "unregister classes in the VM.
  4084      This invalidates all of the classes code objects ..."
  4097      This invalidates all of the classes code objects ..."
  4085 
  4098 
  4086     |id|
  4099     |id|
  4097 ! !
  4110 ! !
  4098 
  4111 
  4099 !ObjectFileLoader class methodsFor:'documentation'!
  4112 !ObjectFileLoader class methodsFor:'documentation'!
  4100 
  4113 
  4101 version
  4114 version
  4102     ^ '$Header: /cvs/stx/stx/libcomp/ObjectFileLoader.st,v 1.259 2007-01-24 15:11:47 cg Exp $'
  4115     ^ '$Header: /cvs/stx/stx/libcomp/ObjectFileLoader.st,v 1.260 2007-02-22 16:44:58 stefan Exp $'
  4103 ! !
  4116 ! !
  4104 
  4117 
  4105 ObjectFileLoader initialize!
  4118 ObjectFileLoader initialize!