--- a/ObjectFileLoader.st Fri Jul 06 13:45:56 2012 +0200
+++ b/ObjectFileLoader.st Tue Jul 17 09:12:47 2012 +0200
@@ -1158,13 +1158,13 @@
handle := self handleForDynamicObject:filename.
handle notNil ifTrue:[
- "already loaded"
- ^ handle.
+ "already loaded"
+ ^ handle.
].
handle := self loadDynamicObject:filename.
handle isNil ifTrue:[
- ^ nil
+ ^ nil
].
didInit := false.
@@ -1174,25 +1174,27 @@
are to be resolved. If that's the case, load all libraries ..."
ParserFlags searchedLibraries notNil ifTrue:[
- (self hasUndefinedSymbolsIn:handle) ifTrue:[
- self initializeLoader.
-
- ParserFlags searchedLibraries do:[:libName |
- (self hasUndefinedSymbolsIn:handle) ifTrue:[
- Transcript showCR:' ... trying ' , libName , ' to resolve undefined symbols ...'.
- dummyHandle := Array new:4.
- dummyHandle := self primLoadDynamicObject:libName into:dummyHandle.
+ (self hasUndefinedSymbolsIn:handle) ifTrue:[
+ self initializeLoader.
+
+ ParserFlags searchedLibraries do:[:libName |
+ (self hasUndefinedSymbolsIn:handle) ifTrue:[
+ Transcript showCR:' ... trying ' , libName , ' to resolve undefined symbols ...'.
+ dummyHandle := Array new:4.
+ dummyHandle := self primLoadDynamicObject:libName into:dummyHandle.
"/ dummyHandle isNil ifTrue:[
"/ Transcript showCR:' ... load of library ' , libName , ' failed.'.
"/ ]
- ]
- ].
- (self hasUndefinedSymbolsIn:handle) isNil ifTrue:[
- Transcript showCR:('ObjectFileLoader [info]: still undefined symbols in ', pathName,'.').
- ].
- ]
+ ]
+ ].
+ (self hasUndefinedSymbolsIn:handle) isNil ifTrue:[
+ Transcript showCR:('ObjectFileLoader [info]: still undefined symbols in ', pathName,'.').
+ ].
+ ]
].
- invokeInitializeMethods ifFalse:[^ handle].
+
+"/ do not return here - have to initialize the methods and more...
+"/ invokeInitializeMethods ifFalse:[^ handle].
"
first, expect the classes-name to be the fileNames-baseName
@@ -1208,156 +1210,156 @@
initAddr := self findInitFunction:className in:handle.
initAddr notNil ifTrue:[
- Verbose ifTrue:[
- ('calling init at:' , (initAddr printStringRadix:16)) errorPrintCR.
- ].
- info := self
- performModuleInitAt:initAddr
- invokeInitializeMethods:invokeInitializeMethods
- for:nil
- identifyAs:handle.
- status := info at:1.
- status == #ok ifTrue:[
- didInit := true.
- ]
+ Verbose ifTrue:[
+ ('calling init at:' , (initAddr printStringRadix:16)) errorPrintCR.
+ ].
+ info := self
+ performModuleInitAt:initAddr
+ invokeInitializeMethods:invokeInitializeMethods
+ for:nil
+ identifyAs:handle.
+ status := info at:1.
+ status == #ok ifTrue:[
+ didInit := true.
+ ]
] ifFalse:[
- "look for explicit C-init (xxx__Init) function
- This is used in C object files"
-
- initAddr := self findFunction:className suffix:'__Init' in:handle.
- initAddr notNil ifTrue:[
- isCModule := true.
-
- OSSignalInterrupt handle:[:ex |
- ('ObjectFileLoader [warning]: hard error in initFunction of class-module: ' , pathName) errorPrintCR.
- status := #initFailed.
- ] do:[
- (self
- saveCallInitFunctionAt:initAddr
- in:pathNameOrFilename
- specialInit:false
- forceOld:true
- interruptable:false
- argument:0
- identifyAs:handle
- returnsObject:false) < 0
- ifTrue:[
- Verbose ifTrue:[
- 'init function return failure ... unload' errorPrintCR.
- ].
- status := #initFailed.
- ] ifFalse:[
- didInit := true.
- ]
- ]
- ] ifFalse:[
- status := #noInitFunction.
-
- "look for any init-function(s); call them all"
- Verbose ifTrue:[
- 'no good init functions found; looking for candidates ...' errorPrintCR.
- ].
- initNames := self namesMatching:'*_Init' segment:'[tT?]' in:pathName.
- initNames notNil ifTrue:[
- initNames do:[:aName |
- initAddr := self getFunction:aName from:handle.
- initAddr isNil ifTrue:[
- (aName startsWith:'_') ifTrue:[
- initAddr := self getFunction:(aName copyFrom:2) from:handle.
- ].
- ].
- initAddr isNil ifTrue:[
- Transcript showCR:('no symbol: ',aName,' in ', pathName).
- ] ifFalse:[
- Verbose ifTrue:[
- ('calling init at:' , (initAddr printStringRadix:16)) errorPrintCR
- ].
- self
- performModuleInitAt:initAddr
- invokeInitializeMethods:invokeInitializeMethods
- for:nil
- identifyAs:handle.
- didInit := true.
- ]
- ].
- ].
- ]
+ "look for explicit C-init (xxx__Init) function
+ This is used in C object files"
+
+ initAddr := self findFunction:className suffix:'__Init' in:handle.
+ initAddr notNil ifTrue:[
+ isCModule := true.
+
+ OSSignalInterrupt handle:[:ex |
+ ('ObjectFileLoader [warning]: hard error in initFunction of class-module: ' , pathName) errorPrintCR.
+ status := #initFailed.
+ ] do:[
+ (self
+ saveCallInitFunctionAt:initAddr
+ in:pathNameOrFilename
+ specialInit:false
+ forceOld:true
+ interruptable:false
+ argument:0
+ identifyAs:handle
+ returnsObject:false) < 0
+ ifTrue:[
+ Verbose ifTrue:[
+ 'init function return failure ... unload' errorPrintCR.
+ ].
+ status := #initFailed.
+ ] ifFalse:[
+ didInit := true.
+ ]
+ ]
+ ] ifFalse:[
+ status := #noInitFunction.
+
+ "look for any init-function(s); call them all"
+ Verbose ifTrue:[
+ 'no good init functions found; looking for candidates ...' errorPrintCR.
+ ].
+ initNames := self namesMatching:'*_Init' segment:'[tT?]' in:pathName.
+ initNames notNil ifTrue:[
+ initNames do:[:aName |
+ initAddr := self getFunction:aName from:handle.
+ initAddr isNil ifTrue:[
+ (aName startsWith:'_') ifTrue:[
+ initAddr := self getFunction:(aName copyFrom:2) from:handle.
+ ].
+ ].
+ initAddr isNil ifTrue:[
+ Transcript showCR:('no symbol: ',aName,' in ', pathName).
+ ] ifFalse:[
+ Verbose ifTrue:[
+ ('calling init at:' , (initAddr printStringRadix:16)) errorPrintCR
+ ].
+ self
+ performModuleInitAt:initAddr
+ invokeInitializeMethods:invokeInitializeMethods
+ for:nil
+ identifyAs:handle.
+ didInit := true.
+ ]
+ ].
+ ].
+ ]
].
(invokeInitializeMethods and:[didInit not]) ifTrue:[
- status == #noInitFunction ifTrue:[
- msg := 'no init function; assume load ok'
- ] ifFalse:[
- (status ~~ #registrationFailed
- and:[status ~~ #initFailed
- and:[status ~~ #missingClass
- and:[status ~~ #versionMismatch]]])
- ifTrue:[
- self listUndefinedSymbolsIn:handle.
- ].
-
- Verbose ifTrue:[
- 'unloading, since init failed ...' errorPrintCR.
- ].
-
- "/ give caller a chance to prevent unloading (to register later, when a prerequisite class comes)
- status == #missingClass ifTrue:[
- self breakPoint:#sv.
- doNotUnload := (SuperClassMissingErrorNotification query ? false).
- ] ifFalse:[
- status == #registrationFailed ifTrue:[
- self breakPoint:#sv.
- doNotUnload := (RegistrationFailedErrorNotification query ? false).
- ] ifFalse:[
- doNotUnload := false.
- ].
- ].
- doNotUnload ifFalse:[
- self unloadDynamicObject:handle.
- Verbose ifTrue:[
- 'unloaded.' errorPrintCR.
- ].
- handle := nil.
- ].
-
- status == #initFailed ifTrue:[
- msg := 'module not loaded (init function signaled failure).'
- ] ifFalse:[
- status == #missingClass ifTrue:[
- msg := 'module not loaded (superclass missing: ' , (info at:2) , ').'
- ] ifFalse:[
- status == #registrationFailed ifTrue:[
- msg := 'module registration failed (incompatible object or missing superclass)'
- ] ifFalse:[
- status == #versionMismatch ifTrue:[
- msg := 'module registration failed (class version mismatch ' , (info at:2) printString , ')'
- ] ifFalse:[
- (self namesMatching:'*__sepInitCode__*' segment:'[tT?]' in:pathName) notNil ifTrue:[
- msg := 'module not loaded (unknown error reason).'
- ] ifFalse:[
- msg := 'module not loaded (no _Init entry in object file ?).'
- ]
- ]
- ].
- ].
- ].
- ].
- msg := 'ObjectFileLoader [info]: <1p>: <2p>' expandMacrosWith:pathNameOrFilename asFilename baseName with:msg.
- Smalltalk isStandAloneApp ifTrue:[
- msg errorPrintCR
- ] ifFalse:[
- Transcript showCR:msg
- ].
+ status == #noInitFunction ifTrue:[
+ msg := 'no init function; assume load ok'
+ ] ifFalse:[
+ (status ~~ #registrationFailed
+ and:[status ~~ #initFailed
+ and:[status ~~ #missingClass
+ and:[status ~~ #versionMismatch]]])
+ ifTrue:[
+ self listUndefinedSymbolsIn:handle.
+ ].
+
+ Verbose ifTrue:[
+ 'unloading, since init failed ...' errorPrintCR.
+ ].
+
+ "/ give caller a chance to prevent unloading (to register later, when a prerequisite class comes)
+ status == #missingClass ifTrue:[
+ self breakPoint:#sv.
+ doNotUnload := (SuperClassMissingErrorNotification query ? false).
+ ] ifFalse:[
+ status == #registrationFailed ifTrue:[
+ self breakPoint:#sv.
+ doNotUnload := (RegistrationFailedErrorNotification query ? false).
+ ] ifFalse:[
+ doNotUnload := false.
+ ].
+ ].
+ doNotUnload ifFalse:[
+ self unloadDynamicObject:handle.
+ Verbose ifTrue:[
+ 'unloaded.' errorPrintCR.
+ ].
+ handle := nil.
+ ].
+
+ status == #initFailed ifTrue:[
+ msg := 'module not loaded (init function signaled failure).'
+ ] ifFalse:[
+ status == #missingClass ifTrue:[
+ msg := 'module not loaded (superclass missing: ' , (info at:2) , ').'
+ ] ifFalse:[
+ status == #registrationFailed ifTrue:[
+ msg := 'module registration failed (incompatible object or missing superclass)'
+ ] ifFalse:[
+ status == #versionMismatch ifTrue:[
+ msg := 'module registration failed (class version mismatch ' , (info at:2) printString , ')'
+ ] ifFalse:[
+ (self namesMatching:'*__sepInitCode__*' segment:'[tT?]' in:pathName) notNil ifTrue:[
+ msg := 'module not loaded (unknown error reason).'
+ ] ifFalse:[
+ msg := 'module not loaded (no _Init entry in object file ?).'
+ ]
+ ]
+ ].
+ ].
+ ].
+ ].
+ msg := 'ObjectFileLoader [info]: <1p>: <2p>' expandMacrosWith:pathNameOrFilename asFilename baseName with:msg.
+ Smalltalk isStandAloneApp ifTrue:[
+ msg errorPrintCR
+ ] ifFalse:[
+ Transcript showCR:msg
+ ].
].
isCModule ifFalse:[
- Smalltalk flushCachedClasses.
- Class flushSubclassInfo.
- Smalltalk isInitialized ifTrue:[
- "really don't know, if and what has changed ...
- ... but assume, that new classes have been installed."
- Smalltalk changed.
- ].
+ Smalltalk flushCachedClasses.
+ Class flushSubclassInfo.
+ Smalltalk isInitialized ifTrue:[
+ "really don't know, if and what has changed ...
+ ... but assume, that new classes have been installed."
+ Smalltalk changed.
+ ].
].
^ handle
@@ -2161,232 +2163,213 @@
"reload all object modules as were loaded when the image was saved.
Some care has to be taken, if files are missing or otherwise corrupted."
- |oldDummyMethod who m newHandle
- savedOldClasses savedByteCodeMethods savedMethods
- functions saveOldMethodsPerClass anyModulesToInitialize|
+ |oldDummyMethod who newHandle
+ savedOldClasses functions saveOldMethodsPerClass anyModulesToInitialize m|
PreviouslyLoadedObjects notNil ifTrue:[
- anyModulesToInitialize := false.
-
- PreviouslyLoadedObjects do:[:entry |
- |fileName handle cls sel|
-
- fileName := entry key.
- handle := entry value.
- handle moduleID:nil.
-
- handle isClassLibHandle ifTrue:[
- "/ ('ObjectFileLoader [info]: reloading classes in ' , fileName , ' ...') infoPrintCR.
-
- "/
- "/ remember all byteCode methods (as added in the session)
- "/
- savedByteCodeMethods := Dictionary new.
- savedOldClasses := IdentitySet new.
- saveOldMethodsPerClass := Dictionary new.
-
- handle classes do:[:aClass |
- |clsName mthdDict|
-
- (aClass notNil and:[aClass ~~ 0]) ifTrue:[
- clsName := aClass name.
- mthdDict := aClass methodDictionary.
- saveOldMethodsPerClass at:clsName put:mthdDict copy.
- savedMethods := IdentityDictionary new.
- savedOldClasses add:aClass.
- mthdDict keysAndValuesDo:[:sel :m |
- m byteCode notNil ifTrue:[
- "/ an interpreted method - must be preserved
- savedMethods at:sel put:m
- ]
- ].
- savedMethods notEmpty ifTrue:[
- savedByteCodeMethods at:clsName put:savedMethods
- ].
- ]
- ].
- "/
- "/ load the class binary
- "/
- handle := self loadObjectFile:fileName invokeInitializeMethods:false.
- handle notNil ifTrue:[
- anyModulesToInitialize := true
- ].
-
- "/ after reloading of the objectFile,
- "/ some of the changes made in the previous life have to be
- "/ redone here - otherwise, we will be left with the
- "/ state contained in the loaded objectModule - instead of
- "/ what we had when saving the image ...
-
- "/
- "/ reinstall the byteCode methods
- "/
- savedByteCodeMethods keysAndValuesDo:[:nm :savedMethods |
- |cls|
-
- cls := Smalltalk classNamed:nm.
- savedMethods keysAndValuesDo:[:sel :m |
- cls primAddSelector:sel withMethod:m.
-"/ ('preserved ' , cls name , '>>' , sel) printCR.
- ]
- ].
-
- "/
- "/ re-remove removed methods
- "/ and re-change method categories
- "/
- savedOldClasses do:[:oldClass |
- |newClass oldMethods newMethodDict oldMthd newMthd
- oldCat oldClassVarString oldClassCategory|
-
- newClass := Smalltalk classNamed:(oldClass name).
- newClass notNil ifTrue:[
- oldClassVarString := oldClass classVariableString.
- newClass classVariableString ~= oldClassVarString ifTrue:[
- "/ there is no need to recreate the variable
- "/ (its in the smalltalk dictionary)
- newClass setClassVariableString:oldClassVarString
- ].
- newClass isMeta ifFalse:[
- newClass setSharedPoolNames:(oldClass sharedPoolNames).
- oldClassCategory := oldClass category.
- newClass category ~= oldClassCategory ifTrue:[
- newClass setCategory:oldClassCategory
- ]
- ].
- oldMethods := saveOldMethodsPerClass at:oldClass name.
- newMethodDict := newClass methodDictionary.
- newMethodDict keys copy do:[:newSelector |
- (oldMethods includesKey:newSelector) ifFalse:[
+ anyModulesToInitialize := false.
+
+ PreviouslyLoadedObjects do:[:entry |
+ |fileName handle cls sel|
+
+ fileName := entry key.
+ handle := entry value.
+ handle moduleID:nil.
+
+ handle isClassLibHandle ifTrue:[
+ "/ ('ObjectFileLoader [info]: reloading classes in ' , fileName , ' ...') infoPrintCR.
+
+ "/
+ "/ remember all byteCode methods (as added in the session)
+ "/
+ savedOldClasses := IdentitySet new.
+ saveOldMethodsPerClass := IdentityDictionary new.
+
+ handle classes do:[:eachClass |
+ (eachClass notNil and:[eachClass ~~ 0]) ifTrue:[
+ saveOldMethodsPerClass at:eachClass put:eachClass methodDictionary copy.
+ savedOldClasses add:eachClass.
+ ].
+ ].
+ "/
+ "/ load the class binary
+ "/
+ handle := self loadObjectFile:fileName invokeInitializeMethods:false.
+ handle notNil ifTrue:[
+ anyModulesToInitialize := true
+ ].
+
+ "/ after reloading of the objectFile,
+ "/ some of the changes made in the previous life have to be
+ "/ redone here - otherwise, we will be left with the
+ "/ state contained in the loaded objectModule - instead of
+ "/ what we had when saving the image ...
+
+
+ "/
+ "/ re-remove removed methods
+ "/ and re-change method categories
+ "/
+ savedOldClasses do:[:oldClass |
+ |newClass oldMethods newMethodDict oldMthd newMthd
+ oldCat oldClassVarString oldClassCategory|
+
+ newClass := Smalltalk classNamed:(oldClass name).
+ newClass notNil ifTrue:[
+ oldClassVarString := oldClass classVariableString.
+ newClass classVariableString ~= oldClassVarString ifTrue:[
+ "/ there is no need to recreate the variable
+ "/ (its in the smalltalk dictionary)
+ newClass setClassVariableString:oldClassVarString
+ ].
+ newClass isMeta ifFalse:[
+ newClass setSharedPoolNames:(oldClass sharedPoolNames).
+ oldClassCategory := oldClass category.
+ newClass category ~= oldClassCategory ifTrue:[
+ newClass setCategory:oldClassCategory
+ ]
+ ].
+ oldMethods := saveOldMethodsPerClass at:oldClass.
+ newMethodDict := newClass methodDictionary.
+ newMethodDict keys copy do:[:newSelector |
+ (oldMethods includesKey:newSelector) ifFalse:[
"/ ('ObjectFileLoader [info]: remove method #' , newSelector , ' from reloaded ' , oldClass name , '.') infoPrintCR.
- newMethodDict removeKey:newSelector
- ] ifTrue:[
- oldMthd := oldMethods at:newSelector.
- newMthd := newMethodDict at:newSelector.
- newMthd category:oldMthd category
- ]
- ]
- ]
- ].
-
- "/
- "/ validate old-classes vs. new classes.
- "/ and if things look ok, get rid of old stuff
- "/ and make instances become instances of the new class
- "/
+ newMethodDict removeKey:newSelector
+ ] ifTrue:[
+ oldMthd := oldMethods at:newSelector.
+ oldMthd byteCode isNil ifTrue:[
+ "a compiled method, load the new code (address may have been changed)"
+ newMthd := newMethodDict at:newSelector.
+ oldMthd code:newMthd code.
+ ] ifFalse:[
+ oldMthd code:nil.
+ ].
+ newClass primAddSelector:newSelector withMethod:oldMthd.
+ ].
+ ]
+ ]
+ ].
+
+ "/
+ "/ validate old-classes vs. new classes.
+ "/ and if things look ok, get rid of old stuff
+ "/ and make instances become instances of the new class
+ "/
"/ ('ObjectFileLoader [info]: migrating classes ...') infoPrintCR.
- savedOldClasses do:[:oldClass |
- |newClass oldCat oldCVars|
-
- newClass := Smalltalk classNamed:(oldClass name).
- newClass == oldClass ifTrue:[
+ savedOldClasses do:[:oldClass |
+ |newClass oldCat oldCVars|
+
+ newClass := Smalltalk classNamed:(oldClass name).
+ newClass == oldClass ifTrue:[
"/ ('ObjectFileLoader [info]: class ' , oldClass name , ' reloaded.') infoPrintCR.
- ] ifFalse:[
- (newClass isNil or:[newClass == oldClass]) ifTrue:[
- ('ObjectFileLoader [warning]: reload of ' , oldClass name , ' seemed to fail.') errorPrintCR.
- ] ifFalse:[
+ ] ifFalse:[
+ (newClass isNil or:[newClass == oldClass]) ifTrue:[
+ ('ObjectFileLoader [warning]: reload of ' , oldClass name , ' seemed to fail.') errorPrintCR.
+ ] ifFalse:[
"/'oldSize: ' print. oldClass instSize print. ' (' print. oldClass instSize class name print. ') ' print.
"/'newSize: ' print. newClass instSize print. ' (' print. oldClass instSize class name print. ') ' printCR.
- oldClass instSize ~~ newClass instSize ifTrue:[
- ('ObjectFileLoader [warning]: ' , oldClass name , ' has changed its size.') errorPrintCR.
- ] ifFalse:[
- oldClass class instSize ~~ newClass class instSize ifTrue:[
- ('ObjectFileLoader [warning]: ' , oldClass name , ' class has changed its size.') errorPrintCR.
- ] ifFalse:[
+ oldClass instSize ~~ newClass instSize ifTrue:[
+ ('ObjectFileLoader [warning]: ' , oldClass name , ' has changed its size.') errorPrintCR.
+ ] ifFalse:[
+ oldClass class instSize ~~ newClass class instSize ifTrue:[
+ ('ObjectFileLoader [warning]: ' , oldClass name , ' class has changed its size.') errorPrintCR.
+ ] ifFalse:[
"/ ('ObjectFileLoader [info]: migrating ' , oldClass name) infoPrintCR.
- (oldCat := oldClass category) ~= newClass category ifTrue:[
- newClass setCategory:oldCat.
- ].
- (oldCVars := oldClass classVariableString) ~= newClass classVariableString ifTrue:[
- newClass setClassVariableString:oldCVars
- ].
- "/ copy over the oldClasses class-instVars
- (Class instSize + 1) to:(oldClass class instSize) do:[:idx |
- newClass instVarAt:idx put:(oldClass instVarAt:idx)
- ].
- oldClass becomeSameAs:newClass
+ (oldCat := oldClass category) ~= newClass category ifTrue:[
+ newClass setCategory:oldCat.
+ ].
+ (oldCVars := oldClass classVariableString) ~= newClass classVariableString ifTrue:[
+ newClass setClassVariableString:oldCVars
+ ].
+ "/ copy over the oldClasses class-instVars
+ (Class instSize + 1) to:(oldClass class instSize) do:[:idx |
+ newClass instVarAt:idx put:(oldClass instVarAt:idx)
+ ].
+ oldClass becomeSameAs:newClass
"/ oldClass become:newClass
- ]
- ]
- ]
- ]
- ]
-
- ] ifFalse:[
- handle isMethodHandle ifTrue:[
- oldDummyMethod := handle method.
- (oldDummyMethod isKindOf:Method) ifFalse:[
- ('ObjectFileLoader [info]: ignore obsolete (already collected) method in ' , fileName) infoPrintCR
- ] ifTrue:[
- ('ObjectFileLoader [info]: reloading method in ' , fileName , ' ...') infoPrintCR.
- who := oldDummyMethod who.
- newHandle := self loadMethodObjectFile:fileName.
- newHandle isNil ifTrue:[
- ('ObjectFileLoader [warning]: failed to reload method in ' , fileName , ' ...') errorPrintCR.
- handle moduleID:nil.
- ] ifFalse:[
- m := newHandle method.
- oldDummyMethod sourceFilename notNil ifTrue:[
- m sourceFilename:(oldDummyMethod sourceFilename)
- position:(oldDummyMethod sourcePosition).
- ] ifFalse:[
- m source:(oldDummyMethod source).
- ].
- m setPackage:(oldDummyMethod package).
- who notNil ifTrue:[
- cls := who methodClass.
- sel := who methodSelector.
- m == (cls compiledMethodAt:sel) ifFalse:[
- 'ObjectFileLoader [warning]: oops - loaded method installed wrong' errorPrintCR.
- ] ifTrue:[
+ ]
+ ]
+ ]
+ ]
+ ]
+
+ ] ifFalse:[
+ handle isMethodHandle ifTrue:[
+ oldDummyMethod := handle method.
+ (oldDummyMethod isKindOf:Method) ifFalse:[
+ ('ObjectFileLoader [info]: ignore obsolete (already collected) method in ' , fileName) infoPrintCR
+ ] ifTrue:[
+ ('ObjectFileLoader [info]: reloading method in ' , fileName , ' ...') infoPrintCR.
+ who := oldDummyMethod who.
+ newHandle := self loadMethodObjectFile:fileName.
+ newHandle isNil ifTrue:[
+ ('ObjectFileLoader [warning]: failed to reload method in ' , fileName , ' ...') errorPrintCR.
+ handle moduleID:nil.
+ ] ifFalse:[
+ m := newHandle method.
+ oldDummyMethod sourceFilename notNil ifTrue:[
+ m sourceFilename:(oldDummyMethod sourceFilename)
+ position:(oldDummyMethod sourcePosition).
+ ] ifFalse:[
+ m source:(oldDummyMethod source).
+ ].
+ m setPackage:(oldDummyMethod package).
+ who notNil ifTrue:[
+ cls := who methodClass.
+ sel := who methodSelector.
+ m == (cls compiledMethodAt:sel) ifFalse:[
+ 'ObjectFileLoader [warning]: oops - loaded method installed wrong' errorPrintCR.
+ ] ifTrue:[
"/ cls changed:#methodDictionary with:(Array with:sel with:oldDummyMethod).
- ]
- ].
- ]
- ]
- ] ifFalse:[
- handle isFunctionObjectHandle ifTrue:[
- functions := handle functions.
- functions isEmpty ifTrue:[
- ('ObjectFileLoader [info]: ignore obsolete (unreferenced) functions in ' , fileName) infoPrintCR
- ] ifFalse:[
- newHandle := self loadDynamicObject:fileName.
- newHandle isNil ifTrue:[
- ('ObjectFileLoader [warning]: failed to reload ' , fileName , ' ...') errorPrintCR.
- handle moduleID:nil.
- ] ifFalse:[
- ('ObjectFileLoader [info]: reloading ' , fileName , ' ...') infoPrintCR.
- functions do:[:eachFunction | |addr|
- addr := newHandle getFunctionAddress:(eachFunction name) into:eachFunction.
- addr isNil ifTrue:[
- ('ObjectFileLoader [info]: function: ''' , eachFunction name , ''' no longer present.') errorPrintCR.
- eachFunction invalidate.
- ] ifFalse:[
- eachFunction setModuleHandle:newHandle.
- ('ObjectFileLoader [info]: rebound function: ''' , eachFunction name , '''.') infoPrintCR.
- ]
- ].
- handle becomeSameAs:newHandle. "/ the old handle is now void
- ]
- ]
- ] ifFalse:[
- ('ObjectFileLoader [info]: ignored invalid (obsolete) objectFile handle: ' , handle printString) infoPrintCR.
- ]
- ]
- ]
- ].
- PreviouslyLoadedObjects := nil.
-
- "/ now, as we hopefully have all loaded,
- "/ send #reinitializeAfterLoad to each of them
- anyModulesToInitialize ifTrue:[
- AbortOperationRequest catch:[
- self moduleInit:4 forceOld:false interruptable:true.
- ]
- ]
+ ]
+ ].
+ ]
+ ]
+ ] ifFalse:[
+ handle isFunctionObjectHandle ifTrue:[
+ functions := handle functions.
+ functions isEmpty ifTrue:[
+ ('ObjectFileLoader [info]: ignore obsolete (unreferenced) functions in ' , fileName) infoPrintCR
+ ] ifFalse:[
+ newHandle := self loadDynamicObject:fileName.
+ newHandle isNil ifTrue:[
+ ('ObjectFileLoader [warning]: failed to reload ' , fileName , ' ...') errorPrintCR.
+ handle moduleID:nil.
+ ] ifFalse:[
+ ('ObjectFileLoader [info]: reloading ' , fileName , ' ...') infoPrintCR.
+ functions do:[:eachFunction | |addr|
+ addr := newHandle getFunctionAddress:(eachFunction name) into:eachFunction.
+ addr isNil ifTrue:[
+ ('ObjectFileLoader [info]: function: ''' , eachFunction name , ''' no longer present.') errorPrintCR.
+ eachFunction invalidate.
+ ] ifFalse:[
+ eachFunction setModuleHandle:newHandle.
+ ('ObjectFileLoader [info]: rebound function: ''' , eachFunction name , '''.') infoPrintCR.
+ ]
+ ].
+ handle becomeSameAs:newHandle. "/ the old handle is now void
+ ]
+ ]
+ ] ifFalse:[
+ ('ObjectFileLoader [info]: ignore invalid (obsolete) objectFile handle: ' , handle printString) infoPrintCR.
+ ]
+ ]
+ ]
+ ].
+ PreviouslyLoadedObjects := nil.
+
+ "/ now, as we hopefully have all loaded,
+ "/ send #reinitializeAfterLoad to each of them
+ anyModulesToInitialize ifTrue:[
+ AbortOperationRequest catch:[
+"/ self moduleInit:0 forceOld:true interruptable:true.
+"/ self moduleInit:1 forceOld:true interruptable:true.
+"/ self moduleInit:2 forceOld:true interruptable:true.
+ self moduleInit:4 forceOld:false interruptable:true.
+ ]
+ ]
]
"Modified: / 18-01-2011 / 20:42:57 / cg"
@@ -4332,11 +4315,11 @@
!ObjectFileLoader class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libcomp/ObjectFileLoader.st,v 1.311 2012-01-31 11:13:59 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libcomp/ObjectFileLoader.st,v 1.312 2012-07-17 07:12:47 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libcomp/ObjectFileLoader.st,v 1.311 2012-01-31 11:13:59 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libcomp/ObjectFileLoader.st,v 1.312 2012-07-17 07:12:47 stefan Exp $'
! !
ObjectFileLoader initialize!