Etoys: System-bf.57.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Etoys: System-bf.57.mcz

commits-2
Bert Freudenberg uploaded a new version of System to project Etoys:
http://source.squeak.org/etoys/System-bf.57.mcz

==================== Summary ====================

Name: System-bf.57
Author: bf
Time: 24 March 2012, 1:05:05 am
UUID: e513f00e-2caa-458d-b1cb-976b26b0db83
Ancestors: System-kfr.56

Fix loading classes from image segments if they changed shape.

=============== Diff against System-kfr.56 ===============

Item was changed:
  ----- Method: ImageSegment>>comeFullyUpOnReload: (in category 'fileIn/Out') -----
  comeFullyUpOnReload: smartRefStream
  "fix up the objects in the segment that changed size.  An object in the segment is the wrong size for the modern version of the class. Construct a fake class that is the old size.  Replace the modern class with the old one in outPointers.  Load the segment. Traverse the instances, making new instances by copying fields, and running conversion messages.  Keep the new instances.  Bulk forward become the old to the new.  Let go of the fake objects and classes.
  After the install (below), arrayOfRoots is filled in. Globalize new classes.  Caller may want to do some special install on certain objects in arrayOfRoots.
  May want to write the segment out to disk in its new form."
 
  | mapFakeClassesToReal ccFixups receiverClasses rootsToUnhiberhate myProject existing forgetDoItsClass |
 
  forgetDoItsClass _ Set new.
  RecentlyRenamedClasses _ nil. "in case old data hanging around"
  mapFakeClassesToReal _ smartRefStream reshapedClassesIn: outPointers.
  "Dictionary of just the ones that change shape. Substitute them in outPointers."
  ccFixups _ self remapCompactClasses: mapFakeClassesToReal
  refStrm: smartRefStream.
  ccFixups ifFalse: [^ self error: 'A class in the file is not compatible'].
  endMarker _ segment nextObject. "for enumeration of objects"
  endMarker == 0 ifTrue: [endMarker _ 'End' clone].
  self fixCapitalizationOfSymbols.
  arrayOfRoots _ self loadSegmentFrom: segment outPointers: outPointers.
  "Can't use install.  Not ready for rehashSets"
  mapFakeClassesToReal isEmpty ifFalse: [
  self reshapeClasses: mapFakeClassesToReal refStream: smartRefStream
  ].
  "When a Project is stored, arrayOfRoots has all objects in the project, except those in outPointers"
  arrayOfRoots do: [:importedObject |
  ((importedObject isMemberOf: WideString) or: [importedObject isMemberOf: WideSymbol]) ifTrue: [
  importedObject mutateJISX0208StringToUnicode.
  importedObject class = WideSymbol ifTrue: [
  "self halt."
  Symbol hasInterned: importedObject asString ifTrue: [:multiSymbol |
  multiSymbol == importedObject ifFalse: [
  importedObject becomeForward: multiSymbol.
  ].
  ].
  ].
  ].
  (importedObject isMemberOf: TTCFontSet) ifTrue: [
  existing _ TTCFontSet familyName: importedObject familyName
  pointSize: importedObject pointSize. "supplies default"
  existing == importedObject ifFalse: [importedObject becomeForward: existing].
  ].
  ].
 
  receiverClasses _ self restoreEndianness. "rehash sets"
  smartRefStream checkFatalReshape: receiverClasses.
 
  "Classes in this segment."
  arrayOfRoots do: [:importedObject |
  importedObject class class == Metaclass ifTrue: [forgetDoItsClass add: importedObject. self  declare: importedObject]].
  rootsToUnhiberhate := OrderedCollection new.
  arrayOfRoots do: [:importedObject |
  ((importedObject isMemberOf: ScriptEditorMorph)
  or: [(importedObject isKindOf: TileMorph)
  or: [(importedObject isMemberOf: ScriptingTileHolder)
  or: [importedObject isKindOf: CompoundTileMorph]]]) ifTrue: [
  rootsToUnhiberhate add: importedObject
  ].
  (importedObject isMemberOf: CompiledMethod) ifTrue: [
  importedObject sourcePointer > 0 ifTrue: [importedObject zapSourcePointer]].
  (importedObject isMemberOf: Project) ifTrue: [
  myProject _ importedObject.
  importedObject ensureChangeSetNameUnique.
  Project addingProject: importedObject.
  importedObject restoreReferences.
  self dependentsRestore: importedObject.
  ScriptEditorMorph writingUniversalTiles:
  ((importedObject projectPreferenceAt: #universalTiles) ifNil: [false])]].
 
  myProject ifNotNil: [
  myProject world setProperty: #thingsToUnhibernate toValue: rootsToUnhiberhate asArray.
  ].
 
  mapFakeClassesToReal isEmpty ifFalse: [
+ mapFakeClassesToReal keysAndValuesDo: [:aFake :aReal |
- mapFakeClassesToReal keys do: [:aFake |
  aFake indexIfCompact > 0 ifTrue: [aFake becomeUncompact].
+ aFake removeFromSystemUnlogged.
+ aFake becomeForward: aReal].
- aFake removeFromSystemUnlogged].
  SystemOrganization removeEmptyCategories].
  forgetDoItsClass do: [:c | c forgetDoIts].
  "^ self"
  !

_______________________________________________
etoys-dev mailing list
[hidden email]
http://lists.squeakland.org/mailman/listinfo/etoys-dev