ObjectFileLoader.st
changeset 2883 3a3feeae9c78
parent 2882 e7fb69ba1a54
child 2885 3dd4304a30da
equal deleted inserted replaced
2882:e7fb69ba1a54 2883:3a3feeae9c78
  2209                 "/
  2209                 "/
  2210                 "/ re-remove removed methods
  2210                 "/ re-remove removed methods
  2211                 "/ and re-change method categories
  2211                 "/ and re-change method categories
  2212                 "/
  2212                 "/
  2213                 savedOldClasses do:[:oldClass |
  2213                 savedOldClasses do:[:oldClass |
  2214                     |newClass oldMethods newMethodDict oldMthd newMthd
  2214                     |newClass oldMethods newMethodDict newMthd
  2215                      oldCat oldClassVarString oldClassCategory|
  2215                      oldCat oldClassVarString oldClassCategory|
  2216 
  2216 
  2217                     newClass := Smalltalk classNamed:(oldClass name).
  2217                     newClass := Smalltalk classNamed:(oldClass name).
  2218                     newClass notNil ifTrue:[
  2218                     newClass notNil ifTrue:[
  2219                         oldClassVarString := oldClass classVariableString.
  2219                         oldClassVarString := oldClass classVariableString.
  2229                                 newClass setCategory:oldClassCategory
  2229                                 newClass setCategory:oldClassCategory
  2230                             ]
  2230                             ]
  2231                         ].
  2231                         ].
  2232                         oldMethods := saveOldMethodsPerClass at:oldClass.
  2232                         oldMethods := saveOldMethodsPerClass at:oldClass.
  2233                         newMethodDict := newClass methodDictionary.
  2233                         newMethodDict := newClass methodDictionary.
  2234                         newMethodDict keys copy do:[:newSelector |
  2234                         oldMethods keysAndValuesDo:[:selector :oldMethod|
  2235                             (oldMethods includesKey:newSelector) ifFalse:[
  2235                             oldMethod
  2236 "/                                ('ObjectFileLoader [info]: remove method #' , newSelector , ' from reloaded ' , oldClass name , '.') infoPrintCR.
  2236                                 code:nil;
  2237                                 newMethodDict removeKey:newSelector
  2237                                 mclass:self.
  2238                             ] ifTrue:[
  2238                             oldMethod byteCode isNil ifTrue:[
  2239                                 oldMthd := oldMethods at:newSelector.
  2239                                 "a compiled method, load the new code (addresses may have been changed)"
  2240                                 oldMthd byteCode isNil ifTrue:[
  2240                                 newMthd := newMethodDict at:selector ifAbsent:nil.
  2241                                     "a compiled method, load the new code (address may have been changed)"
  2241                                 newMthd notNil ifTrue:[
  2242                                     newMthd := newMethodDict at:newSelector.
  2242                                      oldMethod code:newMthd code.
  2243                                     oldMthd code:newMthd code.
       
  2244                                 ] ifFalse:[
  2243                                 ] ifFalse:[
  2245                                     oldMthd code:nil.
  2244                                     ('ObjectFileLoader [warning]: ' , oldClass name , ' missing method: ', selector, '.') errorPrintCR.
  2246                                 ].
  2245                                 ].
  2247                                 newClass primAddSelector:newSelector withMethod:oldMthd.
       
  2248                             ].
  2246                             ].
  2249                         ]
  2247                         ].
  2250                     ]
  2248                         newClass setMethodDictionary:oldMethods.
       
  2249                     ].
  2251                 ].
  2250                 ].
  2252 
  2251 
  2253                 "/
  2252                 "/
  2254                 "/ validate old-classes vs. new classes.
  2253                 "/ validate old-classes vs. new classes.
  2255                 "/ and if things look ok, get rid of old stuff
  2254                 "/ and if things look ok, get rid of old stuff
  2362 
  2361 
  2363         "/ now, as we hopefully have all loaded,
  2362         "/ now, as we hopefully have all loaded,
  2364         "/ send #reinitializeAfterLoad to each of them
  2363         "/ send #reinitializeAfterLoad to each of them
  2365         anyModulesToInitialize ifTrue:[
  2364         anyModulesToInitialize ifTrue:[
  2366             AbortOperationRequest catch:[
  2365             AbortOperationRequest catch:[
  2367 "/                self moduleInit:0 forceOld:true interruptable:true.
       
  2368 "/                self moduleInit:1 forceOld:true interruptable:true.
       
  2369 "/                self moduleInit:2 forceOld:true interruptable:true.
       
  2370                 self moduleInit:4 forceOld:false interruptable:true.
  2366                 self moduleInit:4 forceOld:false interruptable:true.
  2371             ]
  2367             ]
  2372         ]
  2368         ]
  2373     ]
  2369     ]
  2374 
  2370 
  4313 ! !
  4309 ! !
  4314 
  4310 
  4315 !ObjectFileLoader class methodsFor:'documentation'!
  4311 !ObjectFileLoader class methodsFor:'documentation'!
  4316 
  4312 
  4317 version
  4313 version
  4318     ^ '$Header: /cvs/stx/stx/libcomp/ObjectFileLoader.st,v 1.312 2012-07-17 07:12:47 stefan Exp $'
  4314     ^ '$Header: /cvs/stx/stx/libcomp/ObjectFileLoader.st,v 1.313 2012-07-17 09:34:23 stefan Exp $'
  4319 !
  4315 !
  4320 
  4316 
  4321 version_CVS
  4317 version_CVS
  4322     ^ '$Header: /cvs/stx/stx/libcomp/ObjectFileLoader.st,v 1.312 2012-07-17 07:12:47 stefan Exp $'
  4318     ^ '$Header: /cvs/stx/stx/libcomp/ObjectFileLoader.st,v 1.313 2012-07-17 09:34:23 stefan Exp $'
  4323 ! !
  4319 ! !
  4324 
  4320 
  4325 ObjectFileLoader initialize!
  4321 ObjectFileLoader initialize!