JavaClassReloader.st
branchdevelopment
changeset 1895 2d30e588124c
parent 1864 60a8dc26c8c6
child 2069 75d40b7b986f
equal deleted inserted replaced
1894:d1b5ffa1f991 1895:2d30e588124c
   138     "Created: / 21-02-2012 / 09:58:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   138     "Created: / 21-02-2012 / 09:58:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   139 !
   139 !
   140 
   140 
   141 migrate
   141 migrate
   142     "Possibly migrate instances and class. Return the class that should
   142     "Possibly migrate instances and class. Return the class that should
   143      be installed in registry afterwards"
   143      be installed in registry once reloader finishes his job.
       
   144      
       
   145      At this point, all references are already invalidated (see #reload)
       
   146      "
   144 
   147 
   145     mustMigrateInstances ifTrue:[
   148     mustMigrateInstances ifTrue:[
   146         self migrateInstances.
   149         self migrateInstances.
   147         mustMigrateClass ifTrue:[
   150         mustMigrateClass ifTrue:[
   148             self migrateClass
   151             self migrateClass
   152 
   155 
   153     mustMigrateClass ifTrue:[
   156     mustMigrateClass ifTrue:[
   154         self migrateClass.
   157         self migrateClass.
   155         ^newClass.
   158         ^newClass.
   156     ].
   159     ].
   157     self update.
   160     self updateOldClass.
   158     ^oldClass.
   161     ^oldClass.
   159 
   162 
   160     "Created: / 20-02-2012 / 23:40:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   163     "Created: / 20-02-2012 / 23:40:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   164     "Modified (comment): / 16-12-2012 / 17:39:26 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
   161 !
   165 !
   162 
   166 
   163 migrateClass
   167 migrateClass
   164 
   168 
   165     "/self error:'Not yet supported'
   169     "/self error:'Not yet supported'
   256     ].
   260     ].
   257 
   261 
   258     "Created: / 21-02-2012 / 09:45:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   262     "Created: / 21-02-2012 / 09:45:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   259 !
   263 !
   260 
   264 
   261 update
   265 updateOldClass
   262 
   266     "at this point we know that both classes have same layout. So we can
   263     "Brute force, copy instvars directly"
   267      simply copy methods and other info from new class to old one. 
   264     self assert: oldClass class instSize == newClass class instSize.
   268      References must be flushed anyway!!"
   265 
   269 
   266     1 to: newClass class instSize do:[:i|
   270 
   267         newClass instVarAt: i put: (oldClass instVarAt: i).
   271 
   268     ].
   272     oldClass setMethodDictionary: newClass methodDictionary.
   269 
   273     oldClass setConstantPool: newClass constantPool.
   270     "Created: / 21-02-2012 / 11:04:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   274 
       
   275     "Created: / 16-12-2012 / 17:36:52 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
   271 ! !
   276 ! !
   272 
   277 
   273 !JavaClassReloader::SingleClassReloader methodsFor:'reloading'!
   278 !JavaClassReloader::SingleClassReloader methodsFor:'reloading'!
   274 
   279 
   275 reload
   280 reload