1001 "/ typeSymbol, |
1001 "/ typeSymbol, |
1002 "/ instVarNames |
1002 "/ instVarNames |
1003 "/ classVarNames |
1003 "/ classVarNames |
1004 "/ category |
1004 "/ category |
1005 "/ classInstVarNames |
1005 "/ classInstVarNames |
1006 |
1006 "/ comment |
1007 superclass name storeBinaryOn:stream manager:manager. |
1007 |
|
1008 superclass isNil ifTrue:[ |
|
1009 s := nil |
|
1010 ] ifFalse:[ |
|
1011 s := superclass name |
|
1012 ]. |
|
1013 s storeBinaryOn:stream manager:manager. |
1008 name storeBinaryOn:stream manager:manager. |
1014 name storeBinaryOn:stream manager:manager. |
1009 flags storeBinaryOn:stream manager:manager. |
1015 flags storeBinaryOn:stream manager:manager. |
1010 (instvars notNil and:[instvars isEmpty]) ifTrue:[ |
1016 (instvars notNil and:[instvars isEmpty]) ifTrue:[ |
1011 nil storeBinaryOn:stream manager:manager. |
1017 s := nil |
1012 ] ifFalse:[ |
1018 ] ifFalse:[ |
1013 instvars storeBinaryOn:stream manager:manager. |
1019 s := instvars |
1014 ]. |
1020 ]. |
|
1021 s storeBinaryOn:stream manager:manager. |
|
1022 |
1015 (classvars notNil and:[classvars isEmpty]) ifTrue:[ |
1023 (classvars notNil and:[classvars isEmpty]) ifTrue:[ |
1016 nil storeBinaryOn:stream manager:manager. |
1024 s := nil |
1017 ] ifFalse:[ |
1025 ] ifFalse:[ |
1018 classvars storeBinaryOn:stream manager:manager. |
1026 s := classvars |
1019 ]. |
1027 ]. |
|
1028 s storeBinaryOn:stream manager:manager. |
|
1029 |
1020 category storeBinaryOn:stream manager:manager. |
1030 category storeBinaryOn:stream manager:manager. |
1021 s := self class instanceVariableString. |
1031 s := self class instanceVariableString. |
1022 (s notNil and:[s isEmpty]) ifTrue:[ |
1032 (s notNil and:[s isEmpty]) ifTrue:[ |
1023 nil storeBinaryOn:stream manager:manager. |
1033 s := nil |
1024 ] ifFalse:[ |
1034 ]. |
1025 s storeBinaryOn:stream manager:manager. |
1035 s storeBinaryOn:stream manager:manager. |
1026 ]. |
1036 |
|
1037 s := comment. |
|
1038 manager sourceMode == #discard ifTrue:[ |
|
1039 s := nil |
|
1040 ]. |
|
1041 s storeBinaryOn:stream manager:manager. |
1027 |
1042 |
1028 "/ store |
1043 "/ store |
1029 "/ number of class methods |
1044 "/ number of class methods |
1030 selectors := self class selectorArray. |
1045 selectors := self class selectorArray copy. |
1031 selectors storeBinaryOn:stream manager:manager. |
1046 selectors storeBinaryOn:stream manager:manager. |
1032 |
1047 |
1033 "/ store |
1048 "/ store |
1034 "/ class methods |
1049 "/ class methods |
1035 nSel := selectors size. |
1050 selectors do:[:sel | |
1036 1 to:nSel do:[:i | |
|
1037 |m| |
1051 |m| |
1038 |
1052 |
1039 m := self class methodArray at:i. |
1053 m := self class compiledMethodAt:sel. |
1040 m isLazyMethod ifTrue:[ |
1054 m isLazyMethod ifTrue:[ |
1041 m := m makeRealMethod |
1055 m := m makeRealMethod |
1042 ]. |
1056 ]. |
1043 |
1057 |
1044 m storeFullBinaryDefinitionOn:stream manager:manager |
1058 m storeFullBinaryDefinitionOn:stream manager:manager |
1045 ]. |
1059 ]. |
1046 |
1060 |
1047 "/ store |
1061 "/ store |
1048 "/ number of inst methods |
1062 "/ number of inst methods |
1049 |
1063 |
1050 selectorArray storeBinaryOn:stream manager:manager. |
1064 selectors := selectorArray copy. |
|
1065 selectors storeBinaryOn:stream manager:manager. |
1051 |
1066 |
1052 "/ store |
1067 "/ store |
1053 "/ inst methods |
1068 "/ inst methods |
1054 nSel := selectorArray size. |
1069 selectors do:[:sel | |
1055 1 to:nSel do:[:i | |
|
1056 |m| |
1070 |m| |
1057 |
1071 |
1058 m := methodArray at:i. |
1072 m := self compiledMethodAt:sel. |
1059 m isLazyMethod ifTrue:[ |
1073 m isLazyMethod ifTrue:[ |
1060 m := m makeRealMethod |
1074 m := m makeRealMethod |
1061 ]. |
1075 ]. |
1062 |
1076 |
1063 m storeFullBinaryDefinitionOn:stream manager:manager |
1077 m storeFullBinaryDefinitionOn:stream manager:manager |
1085 binaryClassDefinitionFrom:stream manager:manager |
1099 binaryClassDefinitionFrom:stream manager:manager |
1086 "retrieve a class as stored previously with |
1100 "retrieve a class as stored previously with |
1087 #storeBinaryClassOn:manager:" |
1101 #storeBinaryClassOn:manager:" |
1088 |
1102 |
1089 |superclassName name flags instvars classvars category classInstVars |
1103 |superclassName name flags instvars classvars category classInstVars |
1090 nSel sel lastCategory |
1104 comment nSel sel lastCategory |
1091 newClass superClass selectors methods cselectors cmethods| |
1105 newClass superClass selectors methods cselectors cmethods| |
1092 |
1106 |
1093 "/ the following order must correlate to |
1107 "/ the following order must correlate to |
1094 "/ the storing in #storeBinaryClassOn:manager: |
1108 "/ the storing in #storeBinaryClassOn:manager: |
1095 |
1109 |
1099 "/ typeSymbol, |
1113 "/ typeSymbol, |
1100 "/ instVarNames |
1114 "/ instVarNames |
1101 "/ classVarNames |
1115 "/ classVarNames |
1102 "/ category |
1116 "/ category |
1103 "/ classInstVarNames |
1117 "/ classInstVarNames |
|
1118 "/ comment |
1104 |
1119 |
1105 superclassName := manager nextObject. |
1120 superclassName := manager nextObject. |
1106 |
1121 superclassName notNil ifTrue:[ |
1107 superClass := Smalltalk at:superclassName ifAbsent:nil. |
1122 superClass := Smalltalk at:superclassName ifAbsent:nil. |
|
1123 ]. |
1108 superClass notNil ifTrue:[ |
1124 superClass notNil ifTrue:[ |
1109 "/ ('loading superclass: ' , superclassName ) printNL. |
1125 "/ ('loading superclass: ' , superclassName ) printNL. |
1110 superClass autoload. |
1126 superClass autoload. |
1111 superClass := Smalltalk at:superclassName. |
1127 superClass := Smalltalk at:superclassName. |
1112 ]. |
1128 ]. |
1118 classvars := manager nextObject. |
1134 classvars := manager nextObject. |
1119 classvars isNil ifTrue:[classvars := '']. |
1135 classvars isNil ifTrue:[classvars := '']. |
1120 category := manager nextObject. |
1136 category := manager nextObject. |
1121 classInstVars := manager nextObject. |
1137 classInstVars := manager nextObject. |
1122 classInstVars isNil ifTrue:[classInstVars := '']. |
1138 classInstVars isNil ifTrue:[classInstVars := '']. |
1123 |
1139 comment := manager nextObject. |
1124 "/ ('create class: ' , name ) printNL. |
|
1125 |
|
1126 newClass := superClass class |
|
1127 name:name asSymbol |
|
1128 inEnvironment:Smalltalk |
|
1129 subclassOf:superClass |
|
1130 instanceVariableNames:instvars |
|
1131 variable:false |
|
1132 words:false |
|
1133 pointers:true |
|
1134 classVariableNames:classvars |
|
1135 poolDictionaries:'' |
|
1136 category:category |
|
1137 comment:nil |
|
1138 changed:false |
|
1139 classInstanceVariableNames:classInstVars. |
|
1140 |
|
1141 "/ newClass := superClass |
|
1142 "/ subclass:name asSymbol |
|
1143 "/ instanceVariableNames:instvars |
|
1144 "/ classVariableNames:classvars |
|
1145 "/ poolDictionaries:'' |
|
1146 "/ category:category. |
|
1147 |
1140 |
1148 "/ 'got superName:' print. superclassName printNL. |
1141 "/ 'got superName:' print. superclassName printNL. |
1149 "/ 'got name:' print. name printNL. |
1142 "/ 'got name:' print. name printNL. |
1150 "/ 'got flags: ' print. flags printNL. |
1143 "/ 'got flags: ' print. flags printNL. |
1151 "/ 'got instvars: ' print. instvars printNL. |
1144 "/ 'got instvars: ' print. instvars printNL. |
1152 "/ 'got classvars: ' print. classvars printNL. |
1145 "/ 'got classvars: ' print. classvars printNL. |
1153 "/ 'got category: ' print. category printNL. |
1146 "/ 'got category: ' print. category printNL. |
1154 "/ 'got classInstvars: ' print. classInstVars printNL. |
1147 "/ 'got classInstvars: ' print. classInstVars printNL. |
1155 |
1148 |
|
1149 "/ ('create class: ' , name ) printNL. |
|
1150 |
|
1151 (superClass notNil or:[superclassName isNil]) ifTrue:[ |
|
1152 newClass := superClass class |
|
1153 name:name asSymbol |
|
1154 inEnvironment:Smalltalk |
|
1155 subclassOf:superClass |
|
1156 instanceVariableNames:instvars |
|
1157 variable:false |
|
1158 words:false |
|
1159 pointers:true |
|
1160 classVariableNames:classvars |
|
1161 poolDictionaries:'' |
|
1162 category:category |
|
1163 comment:comment |
|
1164 changed:false |
|
1165 classInstanceVariableNames:classInstVars. |
|
1166 ]. |
|
1167 |
1156 "/ retrieve |
1168 "/ retrieve |
1157 "/ number of class methods |
1169 "/ number of class methods |
1158 |
1170 |
1159 cselectors := manager nextObject. |
1171 cselectors := manager nextObject. |
1160 nSel := cselectors size. |
1172 nSel := cselectors size. |