changeset 1791 | 2bc8227a8b18 |
parent 1724 | b5bec24eeaaf |
child 1792 | 9848e561e597 |
1790:51711e3c7046 | 1791:2bc8227a8b18 |
---|---|
206 indexTypeFlags := flags bitAnd:Behavior maskIndexType. |
206 indexTypeFlags := flags bitAnd:Behavior maskIndexType. |
207 (indexTypeFlags = Behavior flagBytes) ifTrue:[ |
207 (indexTypeFlags = Behavior flagBytes) ifTrue:[ |
208 nBytes := (size - (intSize * 3)). |
208 nBytes := (size - (intSize * 3)). |
209 o := ImageByteObject new:nBytes. |
209 o := ImageByteObject new:nBytes. |
210 o classRef:classRef. |
210 o classRef:classRef. |
211 size > 8000 ifTrue:[self halt]. |
211 "/ size > 8000 ifTrue:[self halt]. |
212 o byteSize:size. |
212 o byteSize:size. |
213 o bits:bits. |
213 o bits:bits. |
214 |
214 |
215 imgAddr := self imageAddressOf:addr. |
215 imgAddr := self imageAddressOf:addr. |
216 stream position:imgAddr. |
216 stream position:imgAddr. |
335 |nameSlot| |
335 |nameSlot| |
336 |
336 |
337 (aClassRef isImageBehavior) ifFalse:[self halt]. |
337 (aClassRef isImageBehavior) ifFalse:[self halt]. |
338 ((aClassRef byteSize // intSize) - 3) < Class instSize ifTrue:[self halt.]. |
338 ((aClassRef byteSize // intSize) - 3) < Class instSize ifTrue:[self halt.]. |
339 |
339 |
340 nameSlot := aClassRef at:7. |
340 nameSlot := aClassRef nameSlot. |
341 nameSlot isInteger ifTrue:[ |
341 nameSlot isInteger ifTrue:[ |
342 nameSlot := self fetchObjectAt:nameSlot |
342 nameSlot := self fetchObjectAt:nameSlot |
343 ]. |
343 ]. |
344 nameSlot isImageSymbol ifFalse:[self halt]. |
344 nameSlot isImageSymbol ifFalse:[self halt]. |
345 ^ 'Class: ' , (self printStringOfSymbol:nameSlot) |
345 ^ 'Class: ' , (self printStringOfSymbol:nameSlot) |
723 ! |
723 ! |
724 |
724 |
725 byteSize:something |
725 byteSize:something |
726 "set the value of the instance variable 'size' (automatically generated)" |
726 "set the value of the instance variable 'size' (automatically generated)" |
727 |
727 |
728 something > 8000 ifTrue:[self halt]. |
728 "/ something > 8000 ifTrue:[self halt]. |
729 byteSize := something. |
729 byteSize := something. |
730 ! |
730 ! |
731 |
731 |
732 classRef |
732 classRef |
733 "return the value of the instance variable 'classRef' (automatically generated)" |
733 "return the value of the instance variable 'classRef' (automatically generated)" |
754 ! ! |
754 ! ! |
755 |
755 |
756 !SnapShotImageMemory::ImageHeader methodsFor:'queries'! |
756 !SnapShotImageMemory::ImageHeader methodsFor:'queries'! |
757 |
757 |
758 category |
758 category |
759 |categoryPtr categoryRef category| |
759 |categoryPtr categoryRef category categorySlotOffset| |
760 |
760 |
761 self isMethodOrLazyMethod ifTrue:[ |
761 self isMethodOrLazyMethod ifTrue:[ |
762 categoryPtr := self at:6. |
762 categorySlotOffset := Method instVarOffsetOf:'category'. |
763 "/ categorySlotOffset := 6. |
|
764 categoryPtr := self at:categorySlotOffset. |
|
763 categoryRef := memory fetchObjectAt:categoryPtr. |
765 categoryRef := memory fetchObjectAt:categoryPtr. |
764 category := memory fetchStringFor:categoryRef. |
766 category := memory fetchStringFor:categoryRef. |
765 ^ category |
767 ^ category |
766 ]. |
768 ]. |
767 self halt. |
769 self halt. |
1507 ]. |
1509 ]. |
1508 ^ self classVarNames asStringWith:(Character space) |
1510 ^ self classVarNames asStringWith:(Character space) |
1509 ! |
1511 ! |
1510 |
1512 |
1511 classVarsSlot |
1513 classVarsSlot |
1512 ^ self at:9 |
1514 ^ self at:(Class instVarOffsetOf:'classvars') |
1513 ! |
1515 ! |
1514 |
1516 |
1515 comment |
1517 comment |
1516 |commentRef comment| |
1518 |commentRef comment| |
1517 |
1519 |
1584 ]. |
1586 ]. |
1585 ^ instVarNames ? #() |
1587 ^ instVarNames ? #() |
1586 ! |
1588 ! |
1587 |
1589 |
1588 instVarsSlot |
1590 instVarsSlot |
1589 ^ self at:6 |
1591 ^ self at:(Class instVarOffsetOf:'instvars') |
1590 ! |
1592 ! |
1591 |
1593 |
1592 methodDictionary |
1594 methodDictionary |
1593 |methodDictionaryRef methodDictionary| |
1595 |methodDictionaryRef methodDictionary| |
1594 |
1596 |
1644 ]. |
1646 ]. |
1645 ^ primitiveSpec |
1647 ^ primitiveSpec |
1646 ! |
1648 ! |
1647 |
1649 |
1648 primitiveSpecSlot |
1650 primitiveSpecSlot |
1651 (Class instVarOffsetOf:'primitiveSpec') isNil ifTrue:[ |
|
1652 ^ self at:(Class instVarOffsetOf:'attributes') |
|
1653 ]. |
|
1649 ^ self at:(Class instVarOffsetOf:'primitiveSpec') |
1654 ^ self at:(Class instVarOffsetOf:'primitiveSpec') |
1650 ! |
1655 ! |
1651 |
1656 |
1652 revision |
1657 revision |
1653 |revisionRef revision| |
1658 |revisionRef revision| |
1661 ]. |
1666 ]. |
1662 ^ revision |
1667 ^ revision |
1663 ! |
1668 ! |
1664 |
1669 |
1665 revisionSlot |
1670 revisionSlot |
1666 ^ self at:14 |
1671 ^ self at:(Class instVarOffsetOf:'revision') |
1667 ! |
1672 ! |
1668 |
1673 |
1669 superclass |
1674 superclass |
1670 |superClassRef superClass| |
1675 |superClassRef superClass| |
1671 |
1676 |
1675 ]. |
1680 ]. |
1676 ^ superClass |
1681 ^ superClass |
1677 ! |
1682 ! |
1678 |
1683 |
1679 superclassSlot |
1684 superclassSlot |
1680 ^ self at:1 |
1685 ^ self at:(Class instVarOffsetOf:'superclass') |
1681 ! ! |
1686 ! ! |
1682 |
1687 |
1683 !SnapShotImageMemory::ImageClassObject methodsFor:'class protocol'! |
1688 !SnapShotImageMemory::ImageClassObject methodsFor:'class protocol'! |
1684 |
1689 |
1685 addAllClassVarNamesTo:aCollection |
1690 addAllClassVarNamesTo:aCollection |
2112 |
2117 |
2113 "Created: 15.10.1996 / 11:15:19 / cg" |
2118 "Created: 15.10.1996 / 11:15:19 / cg" |
2114 "Modified: 22.3.1997 / 16:11:56 / cg" |
2119 "Modified: 22.3.1997 / 16:11:56 / cg" |
2115 ! |
2120 ! |
2116 |
2121 |
2122 fileOutAllMethodsOn:aStream methodFilter:methodFilter |
|
2123 |collectionOfCategories| |
|
2124 |
|
2125 collectionOfCategories := self class categories asSortedCollection. |
|
2126 collectionOfCategories notNil ifTrue:[ |
|
2127 collectionOfCategories do:[:aCategory | |
|
2128 self class fileOutCategory:aCategory methodFilter:methodFilter on:aStream. |
|
2129 aStream cr |
|
2130 ] |
|
2131 ]. |
|
2132 collectionOfCategories := self categories asSortedCollection. |
|
2133 collectionOfCategories notNil ifTrue:[ |
|
2134 collectionOfCategories do:[:aCategory | |
|
2135 self fileOutCategory:aCategory methodFilter:methodFilter on:aStream. |
|
2136 aStream cr |
|
2137 ] |
|
2138 ]. |
|
2139 |
|
2140 self privateClassesSorted do:[:aClass | |
|
2141 aClass fileOutAllMethodsOn:aStream methodFilter:methodFilter |
|
2142 ]. |
|
2143 ! |
|
2144 |
|
2117 fileOutAs:fileNameString |
2145 fileOutAs:fileNameString |
2118 "create a file consisting of all methods in myself in |
2146 "create a file consisting of all methods in myself in |
2119 sourceForm, from which the class can be reconstructed (by filing in). |
2147 sourceForm, from which the class can be reconstructed (by filing in). |
2120 The given fileName should be a full path, including suffix. |
2148 The given fileName should be a full path, including suffix. |
2121 Care is taken, to not clobber any existing file in |
2149 Care is taken, to not clobber any existing file in |
3377 |
3405 |
3378 myName := self name. |
3406 myName := self name. |
3379 myNamePrefix := myName , '::'. |
3407 myNamePrefix := myName , '::'. |
3380 myNamePrefixLen := myNamePrefix size. |
3408 myNamePrefixLen := myNamePrefix size. |
3381 |
3409 |
3382 Smalltalk keysDo:[:nm | |
3410 memory image keysDo:[:nm | |
3383 |cls| |
3411 |cls| |
3384 |
3412 |
3385 (nm startsWith:myNamePrefix) ifTrue:[ |
3413 (nm startsWith:myNamePrefix) ifTrue:[ |
3386 (allOfThem |
3414 (allOfThem |
3387 or:[(nm indexOf:$: startingAt:myNamePrefixLen + 1) == 0]) ifTrue:[ |
3415 or:[(nm indexOf:$: startingAt:myNamePrefixLen + 1) == 0]) ifTrue:[ |
3388 cls := Smalltalk at:nm. |
3416 cls := memory image at:nm. |
3389 |
3417 |
3390 (cls isBehavior and:[cls isMeta not]) ifTrue:[ |
3418 (cls isBehavior and:[cls isMeta not]) ifTrue:[ |
3391 classes isNil ifTrue:[ |
3419 classes isNil ifTrue:[ |
3392 classes := IdentitySet new:10. |
3420 classes := IdentitySet new:10. |
3393 ]. |
3421 ]. |
3831 ] |
3859 ] |
3832 ! ! |
3860 ! ! |
3833 |
3861 |
3834 !SnapShotImageMemory::ImageClassObject methodsFor:'namespace protocol'! |
3862 !SnapShotImageMemory::ImageClassObject methodsFor:'namespace protocol'! |
3835 |
3863 |
3864 allClasses |
|
3865 |classes| |
|
3866 |
|
3867 classes := IdentitySet new. |
|
3868 self allClassesDo:[:aClass | classes add:aClass]. |
|
3869 ^ classes |
|
3870 ! |
|
3871 |
|
3836 allClassesDo:aBlock |
3872 allClassesDo:aBlock |
3837 |prefix| |
3873 |prefix| |
3838 |
3874 |
3839 self isNameSpace ifFalse:[ self error ]. |
3875 self isNameSpace ifFalse:[ self error ]. |
3840 prefix := self name , '::'. |
3876 prefix := self name , '::'. |
3948 |
3984 |
3949 isSignedWords |
3985 isSignedWords |
3950 ^ (self flags bitAnd:Behavior maskIndexType) == Behavior flagSignedWords. |
3986 ^ (self flags bitAnd:Behavior maskIndexType) == Behavior flagSignedWords. |
3951 ! |
3987 ! |
3952 |
3988 |
3989 isTopLevelNameSpace |
|
3990 "return true, if this is a nameSpace." |
|
3991 |
|
3992 <resource:#obsolete> |
|
3993 |
|
3994 ^ self isNameSpace |
|
3995 ! |
|
3996 |
|
3953 isTopLevelNamespace |
3997 isTopLevelNamespace |
3954 "return true, if this is a nameSpace." |
3998 "return true, if this is a nameSpace." |
3999 |
|
4000 <resource:#obsolete> |
|
3955 |
4001 |
3956 ^ self isNameSpace |
4002 ^ self isNameSpace |
3957 ! |
4003 ! |
3958 |
4004 |
3959 isVariable |
4005 isVariable |
3986 |
4032 |
3987 owningClass |
4033 owningClass |
3988 |ownerPtr owner| |
4034 |ownerPtr owner| |
3989 |
4035 |
3990 classRef isPrivateMeta ifFalse:[^ nil]. |
4036 classRef isPrivateMeta ifFalse:[^ nil]. |
3991 ownerPtr := classRef at:8. |
4037 ownerPtr := classRef at:(PrivateMetaclass instVarOffsetOf:'owningClass'). |
3992 owner := memory fetchClassObjectAt:ownerPtr. |
4038 owner := memory fetchClassObjectAt:ownerPtr. |
3993 ^ owner |
4039 ^ owner |
3994 ! |
4040 ! |
3995 |
4041 |
3996 owningClassOrYourself |
4042 owningClassOrYourself |