branch | jv |
changeset 18403 | 9a3fc7cc7127 |
parent 18120 | e3a375d5f6a8 |
parent 18400 | 68951cdfb08b |
child 18786 | 237a87b4fe8f |
18397:20527009f352 | 18403:9a3fc7cc7127 |
---|---|
671 initialize |
671 initialize |
672 "initialize the class" |
672 "initialize the class" |
673 |
673 |
674 "/ protect against double initialization |
674 "/ protect against double initialization |
675 AllocationFailureSignal isNil ifTrue:[ |
675 AllocationFailureSignal isNil ifTrue:[ |
676 AllocationFailureSignal := AllocationFailure. |
676 AllocationFailureSignal := AllocationFailure. |
677 AllocationFailureSignal notifierString:'allocation failure'. |
677 AllocationFailureSignal notifierString:'allocation failure'. |
678 |
678 |
679 MallocFailureSignal := MallocFailure. |
679 MallocFailureSignal := MallocFailure. |
680 MallocFailureSignal notifierString:'(malloc) allocation failure'. |
680 MallocFailureSignal notifierString:'(malloc) allocation failure'. |
681 |
681 |
682 LowSpaceSemaphore := Semaphore new name:'LowSpaceSemaphore'. |
682 LowSpaceSemaphore := Semaphore new name:'LowSpaceSemaphore'. |
683 |
683 |
684 DisposeInterruptHandler := self. |
684 DisposeInterruptHandler := self. |
685 |
685 |
686 "/ BackgroundCollectMaximumInterval := 3600. "/ run it at least once an hour |
686 "/ BackgroundCollectMaximumInterval := 3600. "/ run it at least once an hour |
687 BackgroundCollectMaximumInterval := nil. "/ only run when space situation makes it feasable |
687 BackgroundCollectMaximumInterval := nil. "/ only run when space situation makes it feasable |
688 IncrementalGCLimit := 500000. "/ run it whenever 500k have been allocated |
688 IncrementalGCLimit := 500000. "/ run it whenever 500k have been allocated |
689 FreeSpaceGCLimit := FreeSpaceGCAmount := nil. "/ no minumum-freeSpace trigger. |
689 FreeSpaceGCLimit := FreeSpaceGCAmount := nil. "/ no minumum-freeSpace trigger. |
690 MemoryInterruptHandler := self. |
690 MemoryInterruptHandler := self. |
691 ExceptionInterruptHandler := self. |
691 ExceptionInterruptHandler := self. |
692 |
692 |
693 VMSelectors := #( #noByteCode #invalidCodeObject #invalidByteCode #invalidInstruction |
693 VMSelectors := #( #noByteCode #invalidCodeObject #invalidByteCode #invalidInstruction |
694 #tooManyArguments #badLiteralTable #receiverNotBoolean: #typeCheckError |
694 #tooManyArguments #badLiteralTable #receiverNotBoolean: #typeCheckError |
695 #integerCheckError #wrongNumberOfArguments: #privateMethodCalled |
695 #integerCheckError #wrongNumberOfArguments: #privateMethodCalled |
696 #doesNotUnderstand: #invalidReturn: #invalidReturnOrRestart: |
696 #doesNotUnderstand: #invalidReturn: #invalidReturnOrRestart: |
697 #userInterrupt #internalError: #spyInterrupt #timerInterrupt #stepInterrupt |
697 #userInterrupt #internalError: #spyInterrupt #timerInterrupt #stepInterrupt |
698 #errorInterrupt:with: #disposeInterrupt #recursionInterrupt |
698 #errorInterrupt:with: #disposeInterrupt #recursionInterrupt |
699 #memoryInterrupt #fpExceptionInterrupt #signalInterrupt: #childSignalInterrupt |
699 #memoryInterrupt #fpExceptionInterrupt #signalInterrupt: #childSignalInterrupt |
700 #ioInterrupt #customInterrupt #schedulerInterrupt #contextInterrupt |
700 #ioInterrupt #customInterrupt #schedulerInterrupt #contextInterrupt |
701 #interruptLatency:receiver:class:selector:vmActivity:id:). |
701 #interruptLatency:receiver:class:selector:vmActivity:id:). |
702 ] |
702 ] |
703 |
703 |
704 "Modified: / 5.8.1998 / 15:30:12 / cg" |
704 "Modified: / 5.8.1998 / 15:30:12 / cg" |
705 ! ! |
705 ! ! |
706 |
706 |
722 bytesPerOOP |
722 bytesPerOOP |
723 "return the number of bytes an object reference (for example: an instvar) |
723 "return the number of bytes an object reference (for example: an instvar) |
724 takes" |
724 takes" |
725 |
725 |
726 %{ /* NOCONTEXT */ |
726 %{ /* NOCONTEXT */ |
727 #ifdef __SCHTEAM__ |
|
728 return __c__._RETURN(8); // not really true |
|
729 #else |
|
727 RETURN(__mkSmallInteger(sizeof(OBJ))); |
730 RETURN(__mkSmallInteger(sizeof(OBJ))); |
731 #endif |
|
728 %} |
732 %} |
729 |
733 |
730 " |
734 " |
731 ObjectMemory bytesPerOOP |
735 ObjectMemory bytesPerOOP |
732 " |
736 " |
735 bytesPerOTE |
739 bytesPerOTE |
736 "return the number of overhead bytes of an object. |
740 "return the number of overhead bytes of an object. |
737 i.e. the number of bytes in every objects header." |
741 i.e. the number of bytes in every objects header." |
738 |
742 |
739 %{ /* NOCONTEXT */ |
743 %{ /* NOCONTEXT */ |
744 #ifdef __SCHTEAM__ |
|
745 return __c__._RETURN(0); // not really true |
|
746 #else |
|
740 RETURN(__mkSmallInteger(OHDR_SIZE)); |
747 RETURN(__mkSmallInteger(OHDR_SIZE)); |
748 #endif |
|
741 %} |
749 %} |
742 |
750 |
743 " |
751 " |
744 ObjectMemory bytesPerOTE |
752 ObjectMemory bytesPerOTE |
745 " |
753 " |
854 debugPrinting |
862 debugPrinting |
855 "return true, if various debug printouts in the VM |
863 "return true, if various debug printouts in the VM |
856 are turned on, false of off." |
864 are turned on, false of off." |
857 |
865 |
858 %{ /* NOCONTEXT */ |
866 %{ /* NOCONTEXT */ |
867 #ifdef __SCHTEAM__ |
|
868 return __c__._RETURN( STMain.DebugPrinting ? STObject.True : STObject.False); |
|
869 #else |
|
859 extern int __getDebugPrinting(); |
870 extern int __getDebugPrinting(); |
860 |
871 |
861 RETURN (__getDebugPrinting() ? true : false); |
872 RETURN (__getDebugPrinting() ? true : false); |
873 #endif |
|
862 %}. |
874 %}. |
863 " |
875 " |
864 ObjectMemory debugPrinting |
876 ObjectMemory debugPrinting |
865 " |
877 " |
866 ! |
878 ! |
872 If off, those messages are suppressed. |
884 If off, those messages are suppressed. |
873 The default is on, since these messages are only printed for severe errors. |
885 The default is on, since these messages are only printed for severe errors. |
874 Returns the previous setting." |
886 Returns the previous setting." |
875 |
887 |
876 %{ /* NOCONTEXT */ |
888 %{ /* NOCONTEXT */ |
889 #ifdef __SCHTEAM__ |
|
890 { |
|
891 boolean prev = STMain.DebugPrinting; |
|
892 |
|
893 STMain.DebugPrinting = (aBoolean == STObject.True); |
|
894 return __c__._RETURN( prev ? STObject.True : STObject.False); |
|
895 } |
|
896 /* NOTREACHED */ |
|
897 #else |
|
877 extern int __setDebugPrinting(); |
898 extern int __setDebugPrinting(); |
878 |
899 |
879 RETURN ( __setDebugPrinting( (aBoolean == true) ) ? true : false); |
900 RETURN ( __setDebugPrinting( (aBoolean == true) ) ? true : false); |
901 #endif |
|
880 %} |
902 %} |
881 ! |
903 ! |
882 |
904 |
883 infoPrinting |
905 infoPrinting |
884 "return true, if various informational printouts in the VM |
906 "return true, if various informational printouts in the VM |
885 are turned on, false of off." |
907 are turned on, false of off." |
886 |
908 |
887 %{ /* NOCONTEXT */ |
909 %{ /* NOCONTEXT */ |
910 #ifdef __SCHTEAM__ |
|
911 return __c__._RETURN( STMain.InfoPrinting ? STObject.True : STObject.False); |
|
912 #else |
|
888 extern int __getInfoPrinting(); |
913 extern int __getInfoPrinting(); |
889 |
914 |
890 RETURN (__getInfoPrinting() ? true : false); |
915 RETURN (__getInfoPrinting() ? true : false); |
916 #endif |
|
891 %} |
917 %} |
892 " |
918 " |
893 ObjectMemory infoPrinting |
919 ObjectMemory infoPrinting |
894 " |
920 " |
895 ! |
921 ! |
900 this flags setting. |
926 this flags setting. |
901 The default is true, since (currently) those messages are useful for ST/X developers. |
927 The default is true, since (currently) those messages are useful for ST/X developers. |
902 Returns the previous setting." |
928 Returns the previous setting." |
903 |
929 |
904 %{ /* NOCONTEXT */ |
930 %{ /* NOCONTEXT */ |
931 #ifdef __SCHTEAM__ |
|
932 { |
|
933 boolean prev = STMain.InfoPrinting; |
|
934 |
|
935 STMain.InfoPrinting = (aBoolean == STObject.True); |
|
936 return __c__._RETURN( prev ? STObject.True : STObject.False); |
|
937 } |
|
938 /* NOTREACHED */ |
|
939 #else |
|
905 extern int __setInfoPrinting(); |
940 extern int __setInfoPrinting(); |
906 |
941 |
907 RETURN ( __setInfoPrinting( (aBoolean == true) ) ? true : false); |
942 RETURN ( __setInfoPrinting( (aBoolean == true) ) ? true : false); |
943 #endif |
|
908 %} |
944 %} |
909 ! |
945 ! |
910 |
946 |
911 initTrace:aBoolean |
947 initTrace:aBoolean |
912 "turn on/off various init-trace printouts in the VM. |
948 "turn on/off various init-trace printouts in the VM. |
913 The default is false. |
949 The default is false. |
914 Returns the previous setting." |
950 Returns the previous setting." |
915 |
951 |
916 %{ /* NOCONTEXT */ |
952 %{ /* NOCONTEXT */ |
953 #ifdef __SCHTEAM__ |
|
954 return __c__._RETURN_false(); |
|
955 #else |
|
917 extern int __setInitTrace(); |
956 extern int __setInitTrace(); |
918 |
957 |
919 RETURN ( __setInitTrace( (aBoolean == true) ) ? true : false); |
958 RETURN ( __setInitTrace( (aBoolean == true) ) ? true : false); |
959 #endif |
|
920 %} |
960 %} |
921 ! ! |
961 ! ! |
922 |
962 |
923 !ObjectMemory class methodsFor:'VM unwind protect support'! |
963 !ObjectMemory class methodsFor:'VM unwind protect support'! |
924 |
964 |
973 By default, this is on in the ST/X IDE, but off for standAlone (packaged) endUser |
1013 By default, this is on in the ST/X IDE, but off for standAlone (packaged) endUser |
974 applications. Method privacy is an experimental feature, which may be removed in later |
1014 applications. Method privacy is an experimental feature, which may be removed in later |
975 versions, if it turns out to be not useful." |
1015 versions, if it turns out to be not useful." |
976 |
1016 |
977 %{ /* NOCONTEXT */ |
1017 %{ /* NOCONTEXT */ |
1018 #ifdef __SCHTEAM__ |
|
1019 return __c__._RETURN_false(); |
|
1020 #else |
|
978 extern int __setPrivacyChecks__(); |
1021 extern int __setPrivacyChecks__(); |
979 |
1022 |
980 RETURN ( __setPrivacyChecks__( (aBoolean == true) ) ? true : false); |
1023 RETURN ( __setPrivacyChecks__( (aBoolean == true) ) ? true : false); |
1024 #endif |
|
981 %} |
1025 %} |
982 ! |
1026 ! |
983 |
1027 |
984 setTrapOnAccessFor:anObject |
1028 setTrapOnAccessFor:anObject |
985 "install an access trap for anObject; |
1029 "install an access trap for anObject; |
986 An accessSignal will be raised, whenever any instvar of anObject is either read or written. |
1030 An accessSignal will be raised, whenever any instvar of anObject is either read or written. |
987 This is not supported on all architectures, therefore the return value |
1031 This is not supported on all architectures, therefore the return value |
988 (true of trap was installed ok, false if failed) should be checked." |
1032 (true of trap was installed ok, false if failed) should be checked." |
989 |
1033 |
990 %{ /* NOCONTEXT */ |
1034 %{ /* NOCONTEXT */ |
1035 #ifdef __SCHTEAM__ |
|
1036 return __c__._RETURN_false(); |
|
1037 #else |
|
991 RETURN (__addTrapOnAccess(anObject, 2) ? true : false); |
1038 RETURN (__addTrapOnAccess(anObject, 2) ? true : false); |
1039 #endif |
|
992 %} |
1040 %} |
993 ! |
1041 ! |
994 |
1042 |
995 setTrapOnReadFor:anObject |
1043 setTrapOnReadFor:anObject |
996 "install a read trap for anObject; |
1044 "install a read trap for anObject; |
997 An accessSignal will be raised, whenever any access into anObject occurrs. |
1045 An accessSignal will be raised, whenever any access into anObject occurrs. |
998 This is not supported on all architectures, therefore the return value |
1046 This is not supported on all architectures, therefore the return value |
999 (true of trap was installed ok, false if failed) should be checked." |
1047 (true of trap was installed ok, false if failed) should be checked." |
1000 |
1048 |
1001 %{ /* NOCONTEXT */ |
1049 %{ /* NOCONTEXT */ |
1050 #ifdef __SCHTEAM__ |
|
1051 return __c__._RETURN_false(); |
|
1052 #else |
|
1002 RETURN (__addTrapOnAccess(anObject, 0) ? true : false); |
1053 RETURN (__addTrapOnAccess(anObject, 0) ? true : false); |
1054 #endif |
|
1003 %} |
1055 %} |
1004 ! |
1056 ! |
1005 |
1057 |
1006 setTrapOnWriteFor:anObject |
1058 setTrapOnWriteFor:anObject |
1007 "install a write trap for anObject; |
1059 "install a write trap for anObject; |
1008 An accessSignal will be raised, whenever any instvar of anObject is written to. |
1060 An accessSignal will be raised, whenever any instvar of anObject is written to. |
1009 This is not supported on all architectures, therefore the return value |
1061 This is not supported on all architectures, therefore the return value |
1010 (true of trap was installed ok, false if failed) should be checked." |
1062 (true of trap was installed ok, false if failed) should be checked." |
1011 |
1063 |
1012 %{ /* NOCONTEXT */ |
1064 %{ /* NOCONTEXT */ |
1065 #ifdef __SCHTEAM__ |
|
1066 return __c__._RETURN_false(); |
|
1067 #else |
|
1013 RETURN (__addTrapOnAccess(anObject, 1) ? true : false); |
1068 RETURN (__addTrapOnAccess(anObject, 1) ? true : false); |
1069 #endif |
|
1014 %} |
1070 %} |
1015 ! |
1071 ! |
1016 |
1072 |
1017 unsetAllTraps |
1073 unsetAllTraps |
1018 "remove all access traps" |
1074 "remove all access traps" |
1034 |
1090 |
1035 debugBreakPoint3 |
1091 debugBreakPoint3 |
1036 |
1092 |
1037 %{ |
1093 %{ |
1038 #ifndef WIN32 |
1094 #ifndef WIN32 |
1039 /*extern void __debugBreakPoint3__();*/ |
1095 /*extern void __debugBreakPoint3__();*/ |
1040 __debugBreakPoint3__(); |
1096 __debugBreakPoint3__(); |
1041 #endif |
1097 #endif |
1042 %}. |
1098 %}. |
1043 ^ 0 |
1099 ^ 0 |
1044 |
|
1045 ! |
1100 ! |
1046 |
1101 |
1047 flushCaches |
1102 flushCaches |
1048 "flush method and inline caches for all classes" |
1103 "flush method and inline caches for all classes" |
1049 |
1104 |
1143 __flushMethodCacheForSelector(aSelector); |
1198 __flushMethodCacheForSelector(aSelector); |
1144 %} |
1199 %} |
1145 ! |
1200 ! |
1146 |
1201 |
1147 ilcMisses: newValue |
1202 ilcMisses: newValue |
1148 |
1203 newValue class == SmallInteger ifFalse:[ |
1149 newValue class == SmallInteger ifFalse:[^self error:'Not an integer value']. |
1204 ^ self error:'Not an integer value' |
1150 %{ /* NOCONTEXT */ |
1205 ]. |
1151 /*extern int __ilcMisses(int);*/ |
1206 |
1207 %{ /* NOCONTEXT */ |
|
1208 /*extern int __ilcMisses(int);*/ |
|
1152 #ifdef ILC_PROFILING |
1209 #ifdef ILC_PROFILING |
1153 RETURN ( __MKSMALLINT ( __ilcMisses ( __intVal ( newValue ) ) ) ); |
1210 RETURN ( __MKSMALLINT ( __ilcMisses ( __intVal ( newValue ) ) ) ); |
1154 #endif |
1211 #endif |
1155 %}. |
1212 %}. |
1156 ^ -1 |
1213 ^ -1 |
1157 |
1214 |
1158 ! |
1215 ! |
1159 |
1216 |
1160 ilcMissesTrace: bool |
1217 ilcMissesTrace: bool |
1161 |
1218 |
1162 %{ |
1219 %{ |
1163 /*extern int __ilcMissesTrace(int);*/ |
1220 /*extern int __ilcMissesTrace(int);*/ |
1164 #ifdef ILC_PROFILING |
1221 #ifdef ILC_PROFILING |
1165 RETURN ( __ilcMissesTrace ( bool == true ) ? true : false ); |
1222 RETURN ( __ilcMissesTrace ( bool == true ) ? true : false ); |
1166 #endif |
1223 #endif |
1167 %}. |
1224 %}. |
1168 ^ 0 |
1225 ^ 0 |
1169 |
1226 |
1170 ! |
1227 ! |
1171 |
1228 |
1172 incrementSnapshotID |
1229 incrementSnapshotID |
1173 "obsolete - do not use" |
1230 "obsolete - do not use" |
1183 stored with the image. |
1240 stored with the image. |
1184 Not for normal users, this is used by the VM to invalidate |
1241 Not for normal users, this is used by the VM to invalidate |
1185 caches which are stored with the image" |
1242 caches which are stored with the image" |
1186 |
1243 |
1187 %{ /* NOCONTEXT */ |
1244 %{ /* NOCONTEXT */ |
1245 #ifdef __SCHTEAM__ |
|
1246 return __c__._RETURN(0); |
|
1247 #else |
|
1188 RETURN ( __mkSmallInteger( __snapshotID() )); |
1248 RETURN ( __mkSmallInteger( __snapshotID() )); |
1249 #endif |
|
1189 %} |
1250 %} |
1190 " |
1251 " |
1191 ObjectMemory snapshotID |
1252 ObjectMemory snapshotID |
1192 " |
1253 " |
1193 ! |
1254 ! |
1201 It may change or even vanish (if it shows to be not useful)." |
1262 It may change or even vanish (if it shows to be not useful)." |
1202 |
1263 |
1203 |oldTrap| |
1264 |oldTrap| |
1204 |
1265 |
1205 %{ |
1266 %{ |
1206 if (__setTrapRestrictedMethods(trap == true)) |
1267 #ifdef __SCHTEAM__ |
1207 oldTrap = true; |
1268 return __c__._RETURN_false(); |
1208 else |
1269 #else |
1209 oldTrap = false; |
1270 if (__setTrapRestrictedMethods(trap == true)) |
1210 %}. |
1271 oldTrap = true; |
1211 |
1272 else |
1273 oldTrap = false; |
|
1274 #endif |
|
1275 %}. |
|
1212 (trap and:[oldTrap not]) ifTrue:[ |
1276 (trap and:[oldTrap not]) ifTrue:[ |
1213 self flushCaches |
1277 self flushCaches |
1214 ]. |
1278 ]. |
1215 ^ oldTrap |
1279 ^ oldTrap |
1216 |
1280 |
1228 next scavenge/collect. |
1292 next scavenge/collect. |
1229 WARNING: this method is for ST/X debugging only |
1293 WARNING: this method is for ST/X debugging only |
1230 it will be removed without notice" |
1294 it will be removed without notice" |
1231 |
1295 |
1232 %{ /* NOCONTEXT */ |
1296 %{ /* NOCONTEXT */ |
1233 |
1297 #ifdef __SCHTEAM__ |
1298 return __c__._RETURN(0); |
|
1299 #else |
|
1234 if (anObject != nil) { |
1300 if (anObject != nil) { |
1235 if (! __isNonNilObject(anObject)) { |
1301 if (! __isNonNilObject(anObject)) { |
1236 RETURN ( nil ); |
1302 RETURN ( nil ); |
1237 } |
1303 } |
1238 } |
1304 } |
1239 if ((unsigned INT)anObject <= _MAX_INT) { |
1305 if ((unsigned INT)anObject <= _MAX_INT) { |
1240 RETURN ( __mkSmallInteger((INT)anObject) ); |
1306 RETURN ( __mkSmallInteger((INT)anObject) ); |
1241 } |
1307 } |
1242 RETURN ( __MKUINT((INT)anObject) ); |
1308 RETURN ( __MKUINT((INT)anObject) ); |
1309 #endif |
|
1243 %} |
1310 %} |
1244 " |
1311 " |
1245 |p| |
1312 |p| |
1246 p := Point new. |
1313 p := Point new. |
1247 ((ObjectMemory addressOf:p) printStringRadix:16) printCR. |
1314 ((ObjectMemory addressOf:p) printStringRadix:16) printCR. |
1256 For old objects and living contexts, the returned number is invalid. |
1323 For old objects and living contexts, the returned number is invalid. |
1257 WARNING: this method is for ST/X debugging only |
1324 WARNING: this method is for ST/X debugging only |
1258 it will be removed without notice" |
1325 it will be removed without notice" |
1259 |
1326 |
1260 %{ /* NOCONTEXT */ |
1327 %{ /* NOCONTEXT */ |
1261 |
1328 #ifdef __SCHTEAM__ |
1329 return __c__._RETURN(0); |
|
1330 #else |
|
1262 if (! __isNonNilObject(anObject)) { |
1331 if (! __isNonNilObject(anObject)) { |
1263 RETURN ( 0 ); |
1332 RETURN ( 0 ); |
1264 } |
1333 } |
1265 RETURN ( __mkSmallInteger( _GET_AGE(anObject) ) ); |
1334 RETURN ( __mkSmallInteger( _GET_AGE(anObject) ) ); |
1335 #endif |
|
1266 %} |
1336 %} |
1267 " |
1337 " |
1268 |p| |
1338 |p| |
1269 p := Point new. |
1339 p := Point new. |
1270 (ObjectMemory ageOf:p) printCR. |
1340 (ObjectMemory ageOf:p) printCR. |
1345 lbl := Label label:'compressing garbage ...' in:top. |
1415 lbl := Label label:'compressing garbage ...' in:top. |
1346 lbl adjust:#left. |
1416 lbl adjust:#left. |
1347 lbl origin:(0.0@0.0) corner:(1.0@0.0). |
1417 lbl origin:(0.0@0.0) corner:(1.0@0.0). |
1348 h := lbl preferredHeight. |
1418 h := lbl preferredHeight. |
1349 lbl |
1419 lbl |
1350 topInset:5; |
1420 topInset:5; |
1351 bottomInset:(h+5) negated; |
1421 bottomInset:(h+5) negated; |
1352 leftInset:5; |
1422 leftInset:5; |
1353 rightInset:5. |
1423 rightInset:5. |
1354 |
1424 |
1355 progress := ProgressIndicator in:top. |
1425 progress := ProgressIndicator in:top. |
1356 progress origin:(0.0@45) corner:(1.0@45). |
1426 progress origin:(0.0@45) corner:(1.0@45). |
1357 progress level:-1. |
1427 progress level:-1. |
1358 h := progress preferredHeight. |
1428 h := progress preferredHeight. |
1359 progress |
1429 progress |
1360 topInset:(h // 2) negated; |
1430 topInset:(h // 2) negated; |
1361 bottomInset:(h // 2) negated; |
1431 bottomInset:(h // 2) negated; |
1362 leftInset:5; |
1432 leftInset:5; |
1363 rightInset:5. |
1433 rightInset:5. |
1364 progress beInvisible. |
1434 progress beInvisible. |
1365 |
1435 |
1366 listV := HVScrollableView for:SelectionInListView in:top. |
1436 listV := HVScrollableView for:SelectionInListView in:top. |
1367 listV origin:(0.0@55) corner:(1.0@1.0). |
1437 listV origin:(0.0@55) corner:(1.0@1.0). |
1368 listV |
1438 listV |
1369 topInset:(h // 2); |
1439 topInset:(h // 2); |
1370 bottomInset:40; |
1440 bottomInset:40; |
1371 leftInset:5; |
1441 leftInset:5; |
1372 rightInset:5. |
1442 rightInset:5. |
1373 listV beInvisible. |
1443 listV beInvisible. |
1374 |
1444 |
1375 panel := HorizontalPanelView in:top. |
1445 panel := HorizontalPanelView in:top. |
1376 panel origin:(0.0@1.0) corner:(1.0@1.0). |
1446 panel origin:(0.0@1.0) corner:(1.0@1.0). |
1377 panel topInset:-40. |
1447 panel topInset:-40. |
1406 Smalltalk at:#'__VMProcesses__' put:(self processesKnownInVM). |
1476 Smalltalk at:#'__VMProcesses__' put:(self processesKnownInVM). |
1407 |
1477 |
1408 firstRound := true. |
1478 firstRound := true. |
1409 |
1479 |
1410 [done] whileFalse:[ |
1480 [done] whileFalse:[ |
1411 anyShown := false. |
1481 anyShown := false. |
1412 |
1482 |
1413 progress percentage:0. |
1483 progress percentage:0. |
1414 firstRound ifTrue:[ |
1484 firstRound ifTrue:[ |
1415 firstRound := false. |
1485 firstRound := false. |
1416 ] ifFalse:[ |
1486 ] ifFalse:[ |
1417 lbl label:'compressing garbage ...'. |
1487 lbl label:'compressing garbage ...'. |
1418 self garbageCollect. |
1488 self garbageCollect. |
1419 ]. |
1489 ]. |
1420 |
1490 |
1421 lbl label:('searching level ' |
1491 lbl label:('searching level ' |
1422 , levels size printString |
1492 , levels size printString |
1423 , ' (' , objects size printString , ' refs) ...'). |
1493 , ' (' , objects size printString , ' refs) ...'). |
1424 nAll := objects size. |
1494 nAll := objects size. |
1425 nDone := 0. |
1495 nDone := 0. |
1426 |
1496 |
1427 objectArray := objects asArray. |
1497 objectArray := objects asArray. |
1428 |
1498 |
1429 owners := "Weak"IdentitySet new. |
1499 owners := "Weak"IdentitySet new. |
1430 |
1500 |
1431 numObjectsDone := 0. |
1501 numObjectsDone := 0. |
1432 found := false. |
1502 found := false. |
1433 |
1503 |
1434 AbortOperationRequest catch:[ |
1504 AbortOperationRequest catch:[ |
1435 self allObjectsIncludingContextsDo:[:o | |
1505 self allObjectsIncludingContextsDo:[:o | |
1436 |inPrevLevel isOwner| |
1506 |inPrevLevel isOwner| |
1437 |
1507 |
1438 stop ifTrue:[AbortOperationRequest raise]. |
1508 stop ifTrue:[AbortOperationRequest raise]. |
1439 stop ifFalse:[ |
1509 stop ifFalse:[ |
1440 isOwner := false. |
1510 isOwner := false. |
1441 (o referencesAny:objectArray) ifTrue:[ |
1511 (o referencesAny:objectArray) ifTrue:[ |
1442 o isBehavior ifTrue:[ |
1512 o isBehavior ifTrue:[ |
1443 o == Smalltalk ifTrue:[ |
1513 o == Smalltalk ifTrue:[ |
1444 found := true. |
1514 found := true. |
1445 ] ifFalse:[ |
1515 ] ifFalse:[ |
1446 "/ only add it if it has classInstVars |
1516 "/ only add it if it has classInstVars |
1447 o instSize ~~ Class instSize ifTrue:[ |
1517 o instSize ~~ Class instSize ifTrue:[ |
1448 isOwner := true. |
1518 isOwner := true. |
1449 ] |
1519 ] |
1450 ] |
1520 ] |
1451 ] ifFalse:[ |
1521 ] ifFalse:[ |
1452 o class ~~ WeakArray ifTrue:[ |
1522 o class ~~ WeakArray ifTrue:[ |
1453 isOwner := true. |
1523 isOwner := true. |
1454 ] |
1524 ] |
1455 ]. |
1525 ]. |
1456 ]. |
1526 ]. |
1457 |
1527 |
1458 isOwner ifTrue:[ |
1528 isOwner ifTrue:[ |
1459 (objects includesIdentical:o) ifFalse:[ |
1529 (objects includesIdentical:o) ifFalse:[ |
1460 inPrevLevel := false. |
1530 inPrevLevel := false. |
1461 levels do:[:lColl | |
1531 levels do:[:lColl | |
1462 lColl == o ifTrue:[ |
1532 lColl == o ifTrue:[ |
1463 inPrevLevel := true |
1533 inPrevLevel := true |
1464 ] ifFalse:[ |
1534 ] ifFalse:[ |
1465 (lColl includesIdentical:o) ifTrue:[inPrevLevel := true]. |
1535 (lColl includesIdentical:o) ifTrue:[inPrevLevel := true]. |
1466 ] |
1536 ] |
1467 ]. |
1537 ]. |
1468 inPrevLevel ifFalse:[ |
1538 inPrevLevel ifFalse:[ |
1469 owners add:o. |
1539 owners add:o. |
1470 (limitOrNil notNil and:[owners size >= limitOrNil]) ifTrue:[ |
1540 (limitOrNil notNil and:[owners size >= limitOrNil]) ifTrue:[ |
1471 AbortOperationRequest raise |
1541 AbortOperationRequest raise |
1472 ]. |
1542 ]. |
1473 ] |
1543 ] |
1474 ] |
1544 ] |
1475 ]. |
1545 ]. |
1476 |
1546 |
1477 numObjectsDone := numObjectsDone + 1. |
1547 numObjectsDone := numObjectsDone + 1. |
1478 numObjects notNil ifTrue:[ |
1548 numObjects notNil ifTrue:[ |
1479 numObjectsDone \\ 1000 == 0 ifTrue:[ |
1549 numObjectsDone \\ 1000 == 0 ifTrue:[ |
1480 progress percentage:(numObjectsDone / numObjects * 100). |
1550 progress percentage:(numObjectsDone / numObjects * 100). |
1481 Processor yield. |
1551 Processor yield. |
1482 ] |
1552 ] |
1483 ] |
1553 ] |
1484 ] |
1554 ] |
1485 ]. |
1555 ]. |
1486 ]. |
1556 ]. |
1487 progress percentage:100. |
1557 progress percentage:100. |
1488 |
1558 |
1489 numObjects isNil ifTrue:[ |
1559 numObjects isNil ifTrue:[ |
1490 numObjects := numObjectsDone. |
1560 numObjects := numObjectsDone. |
1491 ]. |
1561 ]. |
1492 |
1562 |
1493 owners remove:aCollection ifAbsent:nil. |
1563 owners remove:aCollection ifAbsent:nil. |
1494 owners remove:thisContext ifAbsent:nil. |
1564 owners remove:thisContext ifAbsent:nil. |
1495 owners remove:objectArray ifAbsent:nil. |
1565 owners remove:objectArray ifAbsent:nil. |
1496 owners remove:objects keyArray ifAbsent:nil. |
1566 owners remove:objects keyArray ifAbsent:nil. |
1497 owners remove:owners keyArray ifAbsent:nil. |
1567 owners remove:owners keyArray ifAbsent:nil. |
1498 |
1568 |
1499 "/ 'done with level: ' print. levels size print. ' found ' print. owners size print. ' refs' printCR. |
1569 "/ 'done with level: ' print. levels size print. ' found ' print. owners size print. ' refs' printCR. |
1500 |
1570 |
1501 owners isEmpty ifTrue:[ |
1571 owners isEmpty ifTrue:[ |
1502 found ifFalse:[ |
1572 found ifFalse:[ |
1503 stop := true. |
1573 stop := true. |
1504 ] |
1574 ] |
1505 ]. |
1575 ]. |
1506 |
1576 |
1507 stop ifFalse:[ |
1577 stop ifFalse:[ |
1508 done := found or:[(owners includesIdentical:Smalltalk)]. |
1578 done := found or:[(owners includesIdentical:Smalltalk)]. |
1509 done ifTrue:[ |
1579 done ifTrue:[ |
1510 moreChainsOnThisLevel := true. |
1580 moreChainsOnThisLevel := true. |
1511 temporaryRemoved := IdentitySet new. |
1581 temporaryRemoved := IdentitySet new. |
1512 |
1582 |
1513 levels size > 0 ifTrue:[ |
1583 levels size > 0 ifTrue:[ |
1514 "/ show what we found so far. |
1584 "/ show what we found so far. |
1515 levels last add:Smalltalk. |
1585 levels last add:Smalltalk. |
1516 levels reverse. |
1586 levels reverse. |
1517 ]. |
1587 ]. |
1518 |
1588 |
1519 chains := OrderedCollection new. |
1589 chains := OrderedCollection new. |
1520 |
1590 |
1521 tLevels := levels collect:[:lColl | lColl copy]. |
1591 tLevels := levels collect:[:lColl | lColl copy]. |
1522 |
1592 |
1523 lbl label:('building refchains ...'). |
1593 lbl label:('building refchains ...'). |
1524 |
1594 |
1525 nAll := aCollection size. |
1595 nAll := aCollection size. |
1526 nDone := 0. |
1596 nDone := 0. |
1527 aCollection do:[:anObject | |theseChains| |
1597 aCollection do:[:anObject | |theseChains| |
1528 stop ifFalse:[ |
1598 stop ifFalse:[ |
1529 theseChains := self |
1599 theseChains := self |
1530 refChainsFrom:Smalltalk |
1600 refChainsFrom:Smalltalk |
1531 to:anObject |
1601 to:anObject |
1532 inRefSets:tLevels |
1602 inRefSets:tLevels |
1533 startingAt:1. |
1603 startingAt:1. |
1534 |
1604 |
1535 theseChains size > 0 ifTrue:[ |
1605 theseChains size > 0 ifTrue:[ |
1536 chains addAll:theseChains |
1606 chains addAll:theseChains |
1537 ]. |
1607 ]. |
1538 nDone := nDone + 1. |
1608 nDone := nDone + 1. |
1539 progress percentage:(nDone / nAll * 100). |
1609 progress percentage:(nDone / nAll * 100). |
1540 ] |
1610 ] |
1541 ]. |
1611 ]. |
1542 |
1612 |
1543 tLevels := nil. |
1613 tLevels := nil. |
1544 |
1614 |
1545 levels size > 0 ifTrue:[ |
1615 levels size > 0 ifTrue:[ |
1546 levels reverse. |
1616 levels reverse. |
1547 levels last remove:Smalltalk. |
1617 levels last remove:Smalltalk. |
1548 ]. |
1618 ]. |
1549 |
1619 |
1550 [stop not |
1620 [stop not |
1551 and:[chains size > 0]] whileTrue:[ |
1621 and:[chains size > 0]] whileTrue:[ |
1552 chain := chains first. |
1622 chain := chains first. |
1553 chains removeFirst. |
1623 chains removeFirst. |
1554 |
1624 |
1555 lbl label:('found a reference chain.'). |
1625 lbl label:('found a reference chain.'). |
1556 progress beInvisible. |
1626 progress beInvisible. |
1557 |
1627 |
1558 chain addFirst:Smalltalk. |
1628 chain addFirst:Smalltalk. |
1559 list := OrderedCollection newWithSize:chain size. |
1629 list := OrderedCollection newWithSize:chain size. |
1560 1 to:chain size-1 do:[:i | |
1630 1 to:chain size-1 do:[:i | |
1561 list |
1631 list |
1562 at:i |
1632 at:i |
1563 put:(self refNameFor:(chain at:i+1) in:(chain at:i)) |
1633 put:(self refNameFor:(chain at:i+1) in:(chain at:i)) |
1564 ]. |
1634 ]. |
1565 list at:list size put:(chain last classNameWithArticle). |
1635 list at:list size put:(chain last classNameWithArticle). |
1566 |
1636 |
1567 "/ hide the VMProcesses stuff from the user ... |
1637 "/ hide the VMProcesses stuff from the user ... |
1568 (list at:1) string = 'Smalltalk:__VMProcesses__' ifTrue:[ |
1638 (list at:1) string = 'Smalltalk:__VMProcesses__' ifTrue:[ |
1569 list at:1 put:'__VMProcesses__ (a hidden VM reference)'. |
1639 list at:1 put:'__VMProcesses__ (a hidden VM reference)'. |
1570 list removeIndex:2. |
1640 list removeIndex:2. |
1571 chain at:1 put:nil. |
1641 chain at:1 put:nil. |
1572 chain removeIndex:2. |
1642 chain removeIndex:2. |
1573 ]. |
1643 ]. |
1574 |
1644 |
1575 listV list:list. |
1645 listV list:list. |
1576 |
1646 |
1577 listV beVisible. |
1647 listV beVisible. |
1578 listV doubleClickAction:[:idx | |o| |
1648 listV doubleClickAction:[:idx | |o| |
1579 (o := chain at:idx) notNil ifTrue:[ |
1649 (o := chain at:idx) notNil ifTrue:[ |
1580 o inspect. |
1650 o inspect. |
1581 ] |
1651 ] |
1582 ]. |
1652 ]. |
1583 moreButton beVisible. |
1653 moreButton beVisible. |
1584 anyShown := anyShownInAnyLevel := true. |
1654 anyShown := anyShownInAnyLevel := true. |
1585 showMore := false. |
1655 showMore := false. |
1586 |
1656 |
1587 "/ kludge - wait for some user action |
1657 "/ kludge - wait for some user action |
1588 |
1658 |
1589 [showMore or:[stop or:[top realized not]]] whileFalse:[ |
1659 [showMore or:[stop or:[top realized not]]] whileFalse:[ |
1590 Delay waitForSeconds:0.1 |
1660 Delay waitForSeconds:0.1 |
1591 ]. |
1661 ]. |
1592 |
1662 |
1593 chain := nil. |
1663 chain := nil. |
1594 |
1664 |
1595 top realized ifFalse:[ |
1665 top realized ifFalse:[ |
1596 stop := true |
1666 stop := true |
1597 ] ifTrue:[ |
1667 ] ifTrue:[ |
1598 listV doubleClickAction:nil. |
1668 listV doubleClickAction:nil. |
1599 showMore ifFalse:[ |
1669 showMore ifFalse:[ |
1600 stop := true. |
1670 stop := true. |
1601 ]. |
1671 ]. |
1602 ]. |
1672 ]. |
1603 done := false. |
1673 done := false. |
1604 |
1674 |
1605 stop ifFalse:[ |
1675 stop ifFalse:[ |
1606 progress beVisible. |
1676 progress beVisible. |
1607 listV beInvisible. |
1677 listV beInvisible. |
1608 moreButton beInvisible. |
1678 moreButton beInvisible. |
1609 |
1679 |
1610 chain := nil. |
1680 chain := nil. |
1611 ] |
1681 ] |
1612 ]. |
1682 ]. |
1613 levels size > 0 ifTrue:[ |
1683 levels size > 0 ifTrue:[ |
1614 levels last addAll:temporaryRemoved. |
1684 levels last addAll:temporaryRemoved. |
1615 ] |
1685 ] |
1616 ]. |
1686 ]. |
1617 ]. |
1687 ]. |
1618 |
1688 |
1619 owners remove:Smalltalk ifAbsent:nil. |
1689 owners remove:Smalltalk ifAbsent:nil. |
1620 owners remove:(owners keyArray) ifAbsent:nil. |
1690 owners remove:(owners keyArray) ifAbsent:nil. |
1621 owners remove:objectArray ifAbsent:nil. |
1691 owners remove:objectArray ifAbsent:nil. |
1622 levels do:[:lColl | |
1692 levels do:[:lColl | |
1623 owners remove:lColl ifAbsent:nil |
1693 owners remove:lColl ifAbsent:nil |
1624 ]. |
1694 ]. |
1625 |
1695 |
1626 levels add:owners. |
1696 levels add:owners. |
1627 |
1697 |
1628 objects := owners. |
1698 objects := owners. |
1629 |
1699 |
1630 objects size == 0 ifTrue:[ |
1700 objects size == 0 ifTrue:[ |
1631 stop := true |
1701 stop := true |
1632 ]. |
1702 ]. |
1633 |
1703 |
1634 stop ifTrue:[ |
1704 stop ifTrue:[ |
1635 Smalltalk at:#'__VMProcesses__' put:nil. |
1705 Smalltalk at:#'__VMProcesses__' put:nil. |
1636 top destroy. |
1706 top destroy. |
1637 anyShown ifFalse:[ |
1707 anyShown ifFalse:[ |
1638 userStop ifFalse:[ |
1708 userStop ifFalse:[ |
1639 self information:(anyShownInAnyLevel ifTrue:['no more references'] ifFalse:['no references']). |
1709 self information:(anyShownInAnyLevel ifTrue:['no more references'] ifFalse:['no references']). |
1640 ] |
1710 ] |
1641 ]. |
1711 ]. |
1642 ^ self. |
1712 ^ self. |
1643 ]. |
1713 ]. |
1644 |
1714 |
1645 ]. |
1715 ]. |
1646 |
1716 |
1647 anyShown ifTrue:[ |
1717 anyShown ifTrue:[ |
1648 userStop ifFalse:[ |
1718 userStop ifFalse:[ |
1649 self information:'no more references'. |
1719 self information:'no more references'. |
1650 ] |
1720 ] |
1651 ]. |
1721 ]. |
1652 Smalltalk at:#'__VMProcesses__' put:nil. |
1722 Smalltalk at:#'__VMProcesses__' put:nil. |
1653 ^ self |
1723 ^ self |
1654 |
1724 |
1655 " |
1725 " |
1702 "low level dump an object. |
1772 "low level dump an object. |
1703 WARNING: this method is for ST/X debugging only |
1773 WARNING: this method is for ST/X debugging only |
1704 it may be removed (or replaced by a noop) without notice" |
1774 it may be removed (or replaced by a noop) without notice" |
1705 |
1775 |
1706 %{ |
1776 %{ |
1777 #ifdef __SCHTEAM__ |
|
1778 someObject.dumpObject(); |
|
1779 #else |
|
1707 __dumpObject__(someObject, __LINE__); |
1780 __dumpObject__(someObject, __LINE__); |
1781 #endif |
|
1708 %} |
1782 %} |
1709 " |
1783 " |
1710 ObjectMemory dumpObject:true |
1784 ObjectMemory dumpObject:true |
1711 ObjectMemory dumpObject:(Array new:10) |
1785 ObjectMemory dumpObject:(Array new:10) |
1712 ObjectMemory dumpObject:(10@20 corner:30@40) |
1786 ObjectMemory dumpObject:(10@20 corner:30@40) |
1715 |
1789 |
1716 dumpSender |
1790 dumpSender |
1717 "dump my senders context" |
1791 "dump my senders context" |
1718 |
1792 |
1719 %{ |
1793 %{ |
1794 #ifdef __SCHTEAM__ |
|
1795 __c__.currentContinuation.dumpObject(); |
|
1796 #else |
|
1720 __PATCHUPCONTEXT(__thisContext); |
1797 __PATCHUPCONTEXT(__thisContext); |
1721 __dumpContext__(__ContextInstPtr(__thisContext)->c_sender); |
1798 __dumpContext__(__ContextInstPtr(__thisContext)->c_sender); |
1799 #endif |
|
1722 %} |
1800 %} |
1723 " |
1801 " |
1724 ObjectMemory dumpSender |
1802 ObjectMemory dumpSender |
1725 " |
1803 " |
1726 ! |
1804 ! |
1729 "For debugging only. |
1807 "For debugging only. |
1730 WARNING: this method is for ST/X debugging only |
1808 WARNING: this method is for ST/X debugging only |
1731 it will be removed without notice" |
1809 it will be removed without notice" |
1732 |
1810 |
1733 %{ /* NOCONTEXT */ |
1811 %{ /* NOCONTEXT */ |
1734 |
1812 #ifdef __SCHTEAM__ |
1813 return __c__._RETURN(0); |
|
1814 #else |
|
1735 if (! __isNonNilObject(anObject)) { |
1815 if (! __isNonNilObject(anObject)) { |
1736 RETURN ( nil ); |
1816 RETURN ( nil ); |
1737 } |
1817 } |
1738 RETURN ( __mkSmallInteger( anObject->o_flags ) ); |
1818 RETURN ( __mkSmallInteger( anObject->o_flags ) ); |
1819 #endif |
|
1739 %} |
1820 %} |
1740 " |
1821 " |
1741 F_ISREMEMBERED 1 /* a new-space thing being refd by some oldSpace thing */ |
1822 F_ISREMEMBERED 1 /* a new-space thing being refd by some oldSpace thing */ |
1742 F_ISFORWARDED 2 /* a forwarded object (you will never see this here) */ |
1823 F_ISFORWARDED 2 /* a forwarded object (you will never see this here) */ |
1743 F_DEREFERENCED 4 /* a collection after grow (not currently used) */ |
1824 F_DEREFERENCED 4 /* a collection after grow (not currently used) */ |
1766 INT addr = __longIntVal(anAddress); |
1847 INT addr = __longIntVal(anAddress); |
1767 |
1848 |
1768 if (addr) { |
1849 if (addr) { |
1769 RETURN ((OBJ)(addr)); |
1850 RETURN ((OBJ)(addr)); |
1770 } |
1851 } |
1771 RETURN (nil); |
1852 %}. |
1772 %} |
1853 ^ nil |
1773 ! |
1854 ! |
1774 |
1855 |
1775 printReferences:anObject |
1856 printReferences:anObject |
1776 "for debugging: print referents to anObject. |
1857 "for debugging: print referents to anObject. |
1777 WARNING: this method is for ST/X debugging only |
1858 WARNING: this method is for ST/X debugging only |
1928 (this is not the same as 'anObject size'). |
2009 (this is not the same as 'anObject size'). |
1929 WARNING: this method is for ST/X debugging only |
2010 WARNING: this method is for ST/X debugging only |
1930 it will be removed without notice" |
2011 it will be removed without notice" |
1931 |
2012 |
1932 %{ /* NOCONTEXT */ |
2013 %{ /* NOCONTEXT */ |
1933 |
2014 #ifdef __SCHTEAM__ |
2015 return __c__._RETURN(0); |
|
2016 #else |
|
1934 RETURN ( __isNonNilObject(anObject) ? __mkSmallInteger(__qSize(anObject)) : __mkSmallInteger(0) ) |
2017 RETURN ( __isNonNilObject(anObject) ? __mkSmallInteger(__qSize(anObject)) : __mkSmallInteger(0) ) |
2018 #endif |
|
1935 %} |
2019 %} |
1936 " |
2020 " |
1937 |hist big nw| |
2021 |hist big nw| |
1938 |
2022 |
1939 hist := Array new:100 withAll:0. |
2023 hist := Array new:100 withAll:0. |
1957 the returned value may be invalid after the next scavenge/collect. |
2041 the returned value may be invalid after the next scavenge/collect. |
1958 WARNING: this method is for ST/X debugging only |
2042 WARNING: this method is for ST/X debugging only |
1959 it will be removed without notice" |
2043 it will be removed without notice" |
1960 |
2044 |
1961 %{ /* NOCONTEXT */ |
2045 %{ /* NOCONTEXT */ |
1962 |
2046 #ifdef __SCHTEAM__ |
2047 return __c__._RETURN(0); |
|
2048 #else |
|
1963 if (! __isNonNilObject(anObject)) { |
2049 if (! __isNonNilObject(anObject)) { |
1964 RETURN ( nil ); |
2050 RETURN ( nil ); |
1965 } |
2051 } |
1966 RETURN ( __mkSmallInteger( __qSpace(anObject) ) ); |
2052 RETURN ( __mkSmallInteger( __qSpace(anObject) ) ); |
2053 #endif |
|
1967 %} |
2054 %} |
1968 ! ! |
2055 ! ! |
1969 |
2056 |
1970 !ObjectMemory class methodsFor:'debugging ST/X'! |
2057 !ObjectMemory class methodsFor:'debugging ST/X'! |
1971 |
2058 |
2010 (You may turn off the stack print with debugPrinting:false) |
2097 (You may turn off the stack print with debugPrinting:false) |
2011 WARNING: this method is for debugging only |
2098 WARNING: this method is for debugging only |
2012 it will be removed without notice" |
2099 it will be removed without notice" |
2013 |
2100 |
2014 %{ |
2101 %{ |
2102 #ifdef __SCHTEAM__ |
|
2103 __c__.printWalkback( STObject.StandardErrorStream ); |
|
2104 #else |
|
2015 __printStack(__context); |
2105 __printStack(__context); |
2106 #endif |
|
2016 %} |
2107 %} |
2017 |
2108 |
2018 " |
2109 " |
2019 ObjectMemory printStackBacktrace |
2110 ObjectMemory printStackBacktrace |
2020 " |
2111 " |
2206 |
2297 |
2207 %{ |
2298 %{ |
2208 extern OBJ __processesKnownInVM(); |
2299 extern OBJ __processesKnownInVM(); |
2209 |
2300 |
2210 RETURN (__processesKnownInVM()); |
2301 RETURN (__processesKnownInVM()); |
2211 %} |
2302 %}. |
2303 ^ #() |
|
2304 |
|
2212 " |
2305 " |
2213 ObjectMemory processesKnownInVM |
2306 ObjectMemory processesKnownInVM |
2214 " |
2307 " |
2215 ! ! |
2308 ! ! |
2216 |
2309 |
2281 %{ |
2374 %{ |
2282 if (! __garbageCollect(__context)) { |
2375 if (! __garbageCollect(__context)) { |
2283 __markAndSweep(); |
2376 __markAndSweep(); |
2284 RETURN (false); |
2377 RETURN (false); |
2285 } |
2378 } |
2286 RETURN (true); |
2379 %}. |
2287 %} |
2380 ^ true |
2288 |
2381 |
2289 " |
2382 " |
2290 ObjectMemory compressingGarbageCollect |
2383 ObjectMemory compressingGarbageCollect |
2291 " |
2384 " |
2292 ! |
2385 ! |
2327 If no limit has been reached yet, do nothing and return false. |
2420 If no limit has been reached yet, do nothing and return false. |
2328 This is called by the ProcessorScheduler at idle times or by the |
2421 This is called by the ProcessorScheduler at idle times or by the |
2329 backgroundCollector." |
2422 backgroundCollector." |
2330 |
2423 |
2331 |done limit| |
2424 |done limit| |
2425 |
|
2426 self isSchteamEngine ifTrue:[^ false ]. |
|
2332 |
2427 |
2333 AbortOperationRequest handle:[:ex | |
2428 AbortOperationRequest handle:[:ex | |
2334 "/ in case of abort (from the debugger), |
2429 "/ in case of abort (from the debugger), |
2335 "/ disable gcSteps. |
2430 "/ disable gcSteps. |
2336 done := true. |
2431 done := true. |
2389 cases, this can avoid a pause (in the higher prio processes) due to |
2484 cases, this can avoid a pause (in the higher prio processes) due to |
2390 a blocking GC." |
2485 a blocking GC." |
2391 |
2486 |
2392 |delay| |
2487 |delay| |
2393 |
2488 |
2489 self isSchteamEngine ifTrue:[^ self]. |
|
2490 |
|
2394 Processor activeProcess priority > Processor userBackgroundPriority ifTrue:[ |
2491 Processor activeProcess priority > Processor userBackgroundPriority ifTrue:[ |
2395 delay := Delay forMilliseconds:1 |
2492 delay := Delay forMilliseconds:1 |
2396 ]. |
2493 ]. |
2397 |
2494 |
2398 ((self incrementalGCPhaseSymbolic ~~ #idle) |
2495 ((self incrementalGCPhaseSymbolic ~~ #idle) |
2498 Use this, if you have suspendable background processes which |
2595 Use this, if you have suspendable background processes which |
2499 run all the time, and therefore would prevent the idle-collector |
2596 run all the time, and therefore would prevent the idle-collector |
2500 from running. See documentation in this class for more details." |
2597 from running. See documentation in this class for more details." |
2501 |
2598 |
2502 |p| |
2599 |p| |
2600 |
|
2601 self isSchteamEngine ifTrue:[^ self]. |
|
2503 |
2602 |
2504 "/ |
2603 "/ |
2505 "/ its not useful, to run it more than once |
2604 "/ its not useful, to run it more than once |
2506 "/ |
2605 "/ |
2507 BackgroundCollectProcess notNil ifTrue:[ |
2606 BackgroundCollectProcess notNil ifTrue:[ |
2879 value should be used to switch back." |
2978 value should be used to switch back." |
2880 |
2979 |
2881 |result| |
2980 |result| |
2882 |
2981 |
2883 %{ |
2982 %{ |
2983 #ifdef __SCHTEAM__ |
|
2984 return __c__._RETURN_false(); |
|
2985 #else |
|
2884 extern int __fastMoreOldSpaceAllocation(); |
2986 extern int __fastMoreOldSpaceAllocation(); |
2885 |
2987 |
2886 result = __fastMoreOldSpaceAllocation(aBoolean == true ? 1 : 0) ? true : false; |
2988 result = __fastMoreOldSpaceAllocation(aBoolean == true ? 1 : 0) ? true : false; |
2989 #endif |
|
2887 %}. |
2990 %}. |
2888 self saveGarbageCollectorSetting:#fastMoreOldSpaceAllocation: value:aBoolean. |
2991 self saveGarbageCollectorSetting:#fastMoreOldSpaceAllocation: value:aBoolean. |
2889 |
2992 |
2890 ^ result |
2993 ^ result |
2891 |
2994 |
3056 used by applications - it may vanish without notice" |
3159 used by applications - it may vanish without notice" |
3057 |
3160 |
3058 |result| |
3161 |result| |
3059 |
3162 |
3060 %{ |
3163 %{ |
3164 #ifdef __SCHTEAM__ |
|
3165 return __c__._RETURN_false(); |
|
3166 #else |
|
3061 result = __incrementalSweep((aBoolean == true) ? 1 : 0) ? true : false; |
3167 result = __incrementalSweep((aBoolean == true) ? 1 : 0) ? true : false; |
3168 #endif |
|
3062 %}. |
3169 %}. |
3063 self saveGarbageCollectorSetting:#incrementalSweep: value:aBoolean. |
3170 self saveGarbageCollectorSetting:#incrementalSweep: value:aBoolean. |
3064 |
3171 |
3065 ^ result. |
3172 ^ result. |
3066 |
3173 |
3090 |
3197 |
3091 This is an EXPERIMENTAL interface. |
3198 This is an EXPERIMENTAL interface. |
3092 " |
3199 " |
3093 |
3200 |
3094 %{ |
3201 %{ |
3202 #ifdef __SCHTEAM__ |
|
3203 return __c__._RETURN_false(); |
|
3204 #else |
|
3095 if (flag == true) { |
3205 if (flag == true) { |
3096 __tenure(__context); |
3206 __tenure(__context); |
3097 } |
3207 } |
3098 __lockTenure(flag == true ? 1 : 0); |
3208 __lockTenure(flag == true ? 1 : 0); |
3209 #endif |
|
3099 %}. |
3210 %}. |
3100 |
3211 |
3101 self saveGarbageCollectorSetting:#lockTenure: value:flag. |
3212 self saveGarbageCollectorSetting:#lockTenure: value:flag. |
3102 ! |
3213 ! |
3103 |
3214 |
3171 On systems which do not support the mmap (or equivalent) system call, |
3282 On systems which do not support the mmap (or equivalent) system call, |
3172 this (currently) implies a compressing garbage collect - so its slow. |
3283 this (currently) implies a compressing garbage collect - so its slow. |
3173 Notice: this is a nonstandard interface - use only in special situations." |
3284 Notice: this is a nonstandard interface - use only in special situations." |
3174 |
3285 |
3175 %{ |
3286 %{ |
3287 #ifdef __SCHTEAM__ |
|
3288 return __c__._RETURN_true(); |
|
3289 #else |
|
3176 if (__isSmallInteger(howMuch)) { |
3290 if (__isSmallInteger(howMuch)) { |
3177 RETURN( __moreOldSpace(__context, __intVal(howMuch)) ? true : false ); |
3291 RETURN( __moreOldSpace(__context, __intVal(howMuch)) ? true : false ); |
3178 } |
3292 } |
3179 RETURN (false); |
3293 RETURN (false); |
3294 #endif |
|
3180 %} |
3295 %} |
3181 " |
3296 " |
3182 ObjectMemory moreOldSpace:1000000 |
3297 ObjectMemory moreOldSpace:1000000 |
3183 " |
3298 " |
3184 ! |
3299 ! |
3227 excessive scavenges. You have been warned." |
3342 excessive scavenges. You have been warned." |
3228 |
3343 |
3229 |result| |
3344 |result| |
3230 |
3345 |
3231 %{ |
3346 %{ |
3347 #ifdef __SCHTEAM__ |
|
3348 return __c__._RETURN_false(); |
|
3349 #else |
|
3232 extern int __setNewSpaceSize(); |
3350 extern int __setNewSpaceSize(); |
3233 |
3351 |
3234 if (__isSmallInteger(newSize)) { |
3352 if (__isSmallInteger(newSize)) { |
3235 result = __setNewSpaceSize(__intVal(newSize)) ? true : false; |
3353 result = __setNewSpaceSize(__intVal(newSize)) ? true : false; |
3236 } |
3354 } |
3355 #endif |
|
3237 %}. |
3356 %}. |
3238 result isNil ifTrue:[ |
3357 result isNil ifTrue:[ |
3239 self primitiveFailed. |
3358 self primitiveFailed. |
3240 ]. |
3359 ]. |
3241 result ifTrue:[ |
3360 result ifTrue:[ |
3708 __isSmallInteger(aNumber) |
3827 __isSmallInteger(aNumber) |
3709 ? __intVal(aNumber) |
3828 ? __intVal(aNumber) |
3710 : -1); |
3829 : -1); |
3711 RETURN (__mkSmallInteger(prev)); |
3830 RETURN (__mkSmallInteger(prev)); |
3712 %}. |
3831 %}. |
3832 ^ 0 |
|
3713 |
3833 |
3714 " |
3834 " |
3715 ObjectMemory byteCodeSizeLimitForDynamicCompilation:nil |
3835 ObjectMemory byteCodeSizeLimitForDynamicCompilation:nil |
3716 ObjectMemory byteCodeSizeLimitForDynamicCompilation:8000 |
3836 ObjectMemory byteCodeSizeLimitForDynamicCompilation:8000 |
3717 " |
3837 " |
3735 %{ /* NOCONTEXT */ |
3855 %{ /* NOCONTEXT */ |
3736 extern OBJ __codeForCPU(); |
3856 extern OBJ __codeForCPU(); |
3737 |
3857 |
3738 RETURN (__codeForCPU(aCPUSymbol)); |
3858 RETURN (__codeForCPU(aCPUSymbol)); |
3739 %}. |
3859 %}. |
3860 ^ nil |
|
3740 |
3861 |
3741 " |
3862 " |
3742 ObjectMemory codeForCPU:nil |
3863 ObjectMemory codeForCPU:nil |
3743 ObjectMemory codeForCPU:#i486 |
3864 ObjectMemory codeForCPU:#i486 |
3744 ObjectMemory codeForCPU:#i586 |
3865 ObjectMemory codeForCPU:#i586 |
3760 prev = __codeSizeLimitForDynamicCompilation( __isSmallInteger(aNumber) |
3881 prev = __codeSizeLimitForDynamicCompilation( __isSmallInteger(aNumber) |
3761 ? __intVal(aNumber) |
3882 ? __intVal(aNumber) |
3762 : -1); |
3883 : -1); |
3763 RETURN (__mkSmallInteger(prev)); |
3884 RETURN (__mkSmallInteger(prev)); |
3764 %}. |
3885 %}. |
3886 ^ 0 |
|
3765 |
3887 |
3766 " |
3888 " |
3767 ObjectMemory codeSizeLimitForDynamicCompilation:nil |
3889 ObjectMemory codeSizeLimitForDynamicCompilation:nil |
3768 ObjectMemory codeSizeLimitForDynamicCompilation:8000 |
3890 ObjectMemory codeSizeLimitForDynamicCompilation:8000 |
3769 " |
3891 " |
3778 extern __compiledCodeCounter(); |
3900 extern __compiledCodeCounter(); |
3779 int nBytes; |
3901 int nBytes; |
3780 |
3902 |
3781 nBytes = __compiledCodeCounter(); |
3903 nBytes = __compiledCodeCounter(); |
3782 RETURN (__mkSmallInteger(nBytes)); |
3904 RETURN (__mkSmallInteger(nBytes)); |
3783 %} |
3905 %}. |
3906 ^ 0 |
|
3907 |
|
3784 " |
3908 " |
3785 ObjectMemory compiledCodeCounter |
3909 ObjectMemory compiledCodeCounter |
3786 " |
3910 " |
3787 ! |
3911 ! |
3788 |
3912 |
3794 extern __compiledCodeSpaceUsed(); |
3918 extern __compiledCodeSpaceUsed(); |
3795 int nBytes; |
3919 int nBytes; |
3796 |
3920 |
3797 nBytes = __compiledCodeSpaceUsed(); |
3921 nBytes = __compiledCodeSpaceUsed(); |
3798 RETURN (__mkSmallInteger(nBytes)); |
3922 RETURN (__mkSmallInteger(nBytes)); |
3799 %} |
3923 %}. |
3924 ^ 0 |
|
3925 |
|
3800 " |
3926 " |
3801 ObjectMemory compiledCodeSpaceUsed |
3927 ObjectMemory compiledCodeSpaceUsed |
3802 " |
3928 " |
3803 ! |
3929 ! |
3804 |
3930 |
3805 fullSingleStepSupport |
3931 fullSingleStepSupport |
3806 "return the setting of the full single step support flag" |
3932 "return the setting of the full single step support flag" |
3807 |
3933 |
3808 %{ /* NOCONTEXT */ |
3934 %{ /* NOCONTEXT */ |
3935 #ifdef __SCHTEAM__ |
|
3936 return __c__._RETURN_false(); |
|
3937 #else |
|
3809 extern int __fullSingleStep(); |
3938 extern int __fullSingleStep(); |
3810 |
3939 |
3811 RETURN (__fullSingleStep(-1) ? true : false); |
3940 RETURN (__fullSingleStep(-1) ? true : false); |
3941 #endif |
|
3812 %} |
3942 %} |
3813 " |
3943 " |
3814 ObjectMemory fullSingleStepSupport |
3944 ObjectMemory fullSingleStepSupport |
3815 " |
3945 " |
3816 |
3946 |
3822 stores are not steppable, but treated like atomar invisible operations. |
3952 stores are not steppable, but treated like atomar invisible operations. |
3823 If on, single step halts at those operations. |
3953 If on, single step halts at those operations. |
3824 Execution is a bit slower if enabled." |
3954 Execution is a bit slower if enabled." |
3825 |
3955 |
3826 %{ /* NOCONTEXT */ |
3956 %{ /* NOCONTEXT */ |
3957 #ifdef __SCHTEAM__ |
|
3958 return __c__._RETURN_false(); |
|
3959 #else |
|
3827 extern int __fullSingleStep(); |
3960 extern int __fullSingleStep(); |
3828 int prev; |
3961 int prev; |
3829 |
3962 |
3830 prev = __fullSingleStep(aBoolean == true |
3963 prev = __fullSingleStep(aBoolean == true |
3831 ? 1 |
3964 ? 1 |
3832 : (aBoolean == false) |
3965 : (aBoolean == false) |
3833 ? 0 |
3966 ? 0 |
3834 : -1); |
3967 : -1); |
3835 RETURN (prev ? true : false); |
3968 RETURN (prev ? true : false); |
3969 #endif |
|
3836 %} |
3970 %} |
3837 " |
3971 " |
3838 ObjectMemory fullSingleStepSupport:true |
3972 ObjectMemory fullSingleStepSupport:true |
3839 ObjectMemory fullSingleStepSupport:false |
3973 ObjectMemory fullSingleStepSupport:false |
3840 " |
3974 " |
3850 |
3984 |
3851 limit = __dynamicCodeLimit(); |
3985 limit = __dynamicCodeLimit(); |
3852 if (limit) { |
3986 if (limit) { |
3853 RETURN (__mkSmallInteger(limit)); |
3987 RETURN (__mkSmallInteger(limit)); |
3854 } |
3988 } |
3855 RETURN (nil); |
3989 %}. |
3856 %} |
3990 ^ nil |
3857 ! |
3991 ! |
3858 |
3992 |
3859 insnSizeLimitForDynamicCompilation:aNumber |
3993 insnSizeLimitForDynamicCompilation:aNumber |
3860 "set a limit on a methods number of internal insns. |
3994 "set a limit on a methods number of internal insns. |
3861 Compilation of a method into machine code is aborted, |
3995 Compilation of a method into machine code is aborted, |
3873 prev = __insnSizeLimitForDynamicCompilation( __isSmallInteger(aNumber) |
4007 prev = __insnSizeLimitForDynamicCompilation( __isSmallInteger(aNumber) |
3874 ? __intVal(aNumber) |
4008 ? __intVal(aNumber) |
3875 : -1); |
4009 : -1); |
3876 RETURN (__mkSmallInteger(prev)); |
4010 RETURN (__mkSmallInteger(prev)); |
3877 %}. |
4011 %}. |
4012 ^ 0 |
|
3878 |
4013 |
3879 " |
4014 " |
3880 ObjectMemory insnSizeLimitForDynamicCompilation:nil |
4015 ObjectMemory insnSizeLimitForDynamicCompilation:nil |
3881 ObjectMemory insnSizeLimitForDynamicCompilation:8000 |
4016 ObjectMemory insnSizeLimitForDynamicCompilation:8000 |
3882 " |
4017 " |
3887 |
4022 |
3888 %{ /* NOCONTEXT */ |
4023 %{ /* NOCONTEXT */ |
3889 extern int __javaJustInTimeCompilation(); |
4024 extern int __javaJustInTimeCompilation(); |
3890 |
4025 |
3891 RETURN (__javaJustInTimeCompilation(-1) ? true : false); |
4026 RETURN (__javaJustInTimeCompilation(-1) ? true : false); |
3892 %} |
4027 %}. |
4028 ^ false |
|
4029 |
|
3893 " |
4030 " |
3894 ObjectMemory javaJustInTimeCompilation |
4031 ObjectMemory javaJustInTimeCompilation |
3895 " |
4032 " |
3896 |
4033 |
3897 ! |
4034 ! |
3988 : (aBoolean == false) |
4125 : (aBoolean == false) |
3989 ? 0 |
4126 ? 0 |
3990 : -1); |
4127 : -1); |
3991 RETURN (prev ? true : false); |
4128 RETURN (prev ? true : false); |
3992 %}. |
4129 %}. |
4130 ^ false |
|
4131 |
|
3993 " |
4132 " |
3994 ObjectMemory justInTimeCompilation:true |
4133 ObjectMemory justInTimeCompilation:true |
3995 ObjectMemory justInTimeCompilation:false |
4134 ObjectMemory justInTimeCompilation:false |
3996 " |
4135 " |
3997 ! |
4136 ! |
4001 |
4140 |
4002 %{ /* NOCONTEXT */ |
4141 %{ /* NOCONTEXT */ |
4003 extern int __optimizeContexts(); |
4142 extern int __optimizeContexts(); |
4004 |
4143 |
4005 RETURN (__optimizeContexts(-1) ? true : false); |
4144 RETURN (__optimizeContexts(-1) ? true : false); |
4006 %} |
4145 %}. |
4146 ^ false |
|
4147 |
|
4007 " |
4148 " |
4008 ObjectMemory optimizeContexts |
4149 ObjectMemory optimizeContexts |
4009 " |
4150 " |
4010 ! |
4151 ! |
4011 |
4152 |
4022 ? 1 |
4163 ? 1 |
4023 : (aBoolean == false) |
4164 : (aBoolean == false) |
4024 ? 0 |
4165 ? 0 |
4025 : -1); |
4166 : -1); |
4026 RETURN (prev ? true : false); |
4167 RETURN (prev ? true : false); |
4027 %} |
4168 %}. |
4169 ^ false |
|
4170 |
|
4028 " |
4171 " |
4029 ObjectMemory optimizeContexts:true |
4172 ObjectMemory optimizeContexts:true |
4030 ObjectMemory optimizeContexts:false |
4173 ObjectMemory optimizeContexts:false |
4031 " |
4174 " |
4032 ! |
4175 ! |
4086 |
4229 |
4087 %{ /* NOCONTEXT */ |
4230 %{ /* NOCONTEXT */ |
4088 extern int __canDoJustInTimeCompilation(); |
4231 extern int __canDoJustInTimeCompilation(); |
4089 |
4232 |
4090 RETURN (__canDoJustInTimeCompilation() ? true : false); |
4233 RETURN (__canDoJustInTimeCompilation() ? true : false); |
4091 %} |
4234 %}. |
4235 ^ false |
|
4236 |
|
4092 " |
4237 " |
4093 ObjectMemory supportsJustInTimeCompilation |
4238 ObjectMemory supportsJustInTimeCompilation |
4094 " |
4239 " |
4095 |
4240 |
4096 ! ! |
4241 ! ! |
4363 %{ /* NOCONTEXT */ |
4508 %{ /* NOCONTEXT */ |
4364 extern unsigned INT __oldSpaceUsed(), __freeListSpace(); |
4509 extern unsigned INT __oldSpaceUsed(), __freeListSpace(); |
4365 extern unsigned int __newSpaceUsed(); |
4510 extern unsigned int __newSpaceUsed(); |
4366 |
4511 |
4367 RETURN ( __MKUINT(__oldSpaceUsed() + (INT)__newSpaceUsed() - __freeListSpace()) ); |
4512 RETURN ( __MKUINT(__oldSpaceUsed() + (INT)__newSpaceUsed() - __freeListSpace()) ); |
4368 %} |
4513 %}. |
4514 ^ 0 |
|
4515 |
|
4369 " |
4516 " |
4370 ObjectMemory bytesUsed |
4517 ObjectMemory bytesUsed |
4371 " |
4518 " |
4372 ! |
4519 ! |
4373 |
4520 |
4395 #ifdef COLLECTEDOLD_ADDRESS |
4542 #ifdef COLLECTEDOLD_ADDRESS |
4396 RETURN(__MKUINT(COLLECTEDOLD_ADDRESS)); |
4543 RETURN(__MKUINT(COLLECTEDOLD_ADDRESS)); |
4397 #else |
4544 #else |
4398 RETURN(__mkSmallInteger(0)); |
4545 RETURN(__mkSmallInteger(0)); |
4399 #endif |
4546 #endif |
4400 %} |
4547 %}. |
4548 ^ 0 |
|
4401 |
4549 |
4402 " |
4550 " |
4403 self collectedOldSpaceAddress |
4551 self collectedOldSpaceAddress |
4404 " |
4552 " |
4405 ! |
4553 ! |
4409 |
4557 |
4410 %{ /* NOCONTEXT */ |
4558 %{ /* NOCONTEXT */ |
4411 extern unsigned __fixSpaceSize(); |
4559 extern unsigned __fixSpaceSize(); |
4412 |
4560 |
4413 RETURN ( __MKUINT(__fixSpaceSize()) ); |
4561 RETURN ( __MKUINT(__fixSpaceSize()) ); |
4414 %} |
4562 %}. |
4563 ^ 0 |
|
4564 |
|
4415 " |
4565 " |
4416 ObjectMemory fixSpaceSize |
4566 ObjectMemory fixSpaceSize |
4417 " |
4567 " |
4418 ! |
4568 ! |
4419 |
4569 |
4422 |
4572 |
4423 %{ /* NOCONTEXT */ |
4573 %{ /* NOCONTEXT */ |
4424 extern unsigned __fixSpaceUsed(); |
4574 extern unsigned __fixSpaceUsed(); |
4425 |
4575 |
4426 RETURN ( __MKUINT(__fixSpaceUsed()) ); |
4576 RETURN ( __MKUINT(__fixSpaceUsed()) ); |
4427 %} |
4577 %}. |
4578 ^ 0 |
|
4579 |
|
4428 " |
4580 " |
4429 ObjectMemory fixSpaceUsed |
4581 ObjectMemory fixSpaceUsed |
4430 " |
4582 " |
4431 ! |
4583 ! |
4432 |
4584 |
4436 |
4588 |
4437 %{ /* NOCONTEXT */ |
4589 %{ /* NOCONTEXT */ |
4438 extern unsigned INT __freeListSpace(); |
4590 extern unsigned INT __freeListSpace(); |
4439 |
4591 |
4440 RETURN ( __MKUINT(__freeListSpace()) ); |
4592 RETURN ( __MKUINT(__freeListSpace()) ); |
4441 %} |
4593 %}. |
4594 ^ 0 |
|
4595 |
|
4442 " |
4596 " |
4443 ObjectMemory freeListSpace |
4597 ObjectMemory freeListSpace |
4444 " |
4598 " |
4445 ! |
4599 ! |
4446 |
4600 |
4450 |
4604 |
4451 %{ /* NOCONTEXT */ |
4605 %{ /* NOCONTEXT */ |
4452 extern unsigned INT __oldSpaceSize(), __oldSpaceUsed(); |
4606 extern unsigned INT __oldSpaceSize(), __oldSpaceUsed(); |
4453 |
4607 |
4454 RETURN ( __MKUINT(__oldSpaceSize() - __oldSpaceUsed()) ); |
4608 RETURN ( __MKUINT(__oldSpaceSize() - __oldSpaceUsed()) ); |
4455 %} |
4609 %}. |
4610 ^ 0 |
|
4611 |
|
4456 " |
4612 " |
4457 ObjectMemory freeSpace |
4613 ObjectMemory freeSpace |
4458 " |
4614 " |
4459 ! |
4615 ! |
4460 |
4616 |
4463 |
4619 |
4464 %{ /* NOCONTEXT */ |
4620 %{ /* NOCONTEXT */ |
4465 extern int __garbageCollectCount(); |
4621 extern int __garbageCollectCount(); |
4466 |
4622 |
4467 RETURN (__mkSmallInteger(__garbageCollectCount())); |
4623 RETURN (__mkSmallInteger(__garbageCollectCount())); |
4468 %} |
4624 %}. |
4625 ^ 0 |
|
4626 |
|
4469 " |
4627 " |
4470 ObjectMemory garbageCollectCount |
4628 ObjectMemory garbageCollectCount |
4471 " |
4629 " |
4472 ! |
4630 ! |
4473 |
4631 |
4476 |
4634 |
4477 %{ /* NOCONTEXT */ |
4635 %{ /* NOCONTEXT */ |
4478 extern int __incrementalGCCount(); |
4636 extern int __incrementalGCCount(); |
4479 |
4637 |
4480 RETURN (__mkSmallInteger(__incrementalGCCount())); |
4638 RETURN (__mkSmallInteger(__incrementalGCCount())); |
4481 %} |
4639 %}. |
4640 ^ 0 |
|
4641 |
|
4482 " |
4642 " |
4483 ObjectMemory incrementalGCCount |
4643 ObjectMemory incrementalGCCount |
4484 " |
4644 " |
4485 ! |
4645 ! |
4486 |
4646 |
4497 |
4657 |
4498 %{ /* NOCONTEXT */ |
4658 %{ /* NOCONTEXT */ |
4499 extern int __incrGCphase(); |
4659 extern int __incrGCphase(); |
4500 |
4660 |
4501 RETURN (__mkSmallInteger(__incrGCphase())); |
4661 RETURN (__mkSmallInteger(__incrGCphase())); |
4502 %} |
4662 %}. |
4663 ^ 2 |
|
4503 ! |
4664 ! |
4504 |
4665 |
4505 incrementalGCPhaseSymbolic |
4666 incrementalGCPhaseSymbolic |
4506 "returns the internal state of the incremental GC |
4667 "returns the internal state of the incremental GC |
4507 in a symbolic form. |
4668 in a symbolic form. |
4522 ^ #sweeping |
4683 ^ #sweeping |
4523 |
4684 |
4524 "Created: / 10.8.1998 / 15:02:52 / cg" |
4685 "Created: / 10.8.1998 / 15:02:52 / cg" |
4525 ! |
4686 ! |
4526 |
4687 |
4688 isSchteamEngine |
|
4689 "is this Smalltalk/X system running under the new Schteam engine?" |
|
4690 %{ |
|
4691 #ifdef __SCHTEAM__ |
|
4692 return __c__._RETURN_true(); |
|
4693 #endif |
|
4694 %}. |
|
4695 ^ false |
|
4696 ! |
|
4697 |
|
4527 lastScavengeReclamation |
4698 lastScavengeReclamation |
4528 "returns the number of bytes replacimed by the last scavenge. |
4699 "returns the number of bytes replacimed by the last scavenge. |
4529 For statistic only - this may vanish." |
4700 For statistic only - this may vanish." |
4530 |
4701 |
4531 %{ /* NOCONTEXT */ |
4702 %{ /* NOCONTEXT */ |
4532 extern int __newSpaceReclaimed(); |
4703 extern int __newSpaceReclaimed(); |
4533 |
4704 |
4534 RETURN ( __mkSmallInteger(__newSpaceReclaimed()) ); |
4705 RETURN ( __mkSmallInteger(__newSpaceReclaimed()) ); |
4535 %} |
4706 %}. |
4707 ^ 0 |
|
4708 |
|
4536 "percentage of reclaimed objects is returned by: |
4709 "percentage of reclaimed objects is returned by: |
4537 |
4710 |
4538 ((ObjectMemory lastScavengeReclamation) |
4711 ((ObjectMemory lastScavengeReclamation) |
4539 / (ObjectMemory newSpaceSize)) * 100.0 |
4712 / (ObjectMemory newSpaceSize)) * 100.0 |
4540 " |
4713 " |
4546 |
4719 |
4547 %{ /* NOCONTEXT */ |
4720 %{ /* NOCONTEXT */ |
4548 extern OBJ __lifoRememberedSet(); |
4721 extern OBJ __lifoRememberedSet(); |
4549 |
4722 |
4550 RETURN ( __lifoRememberedSet() ); |
4723 RETURN ( __lifoRememberedSet() ); |
4551 %} |
4724 %}. |
4725 ^ nil |
|
4726 |
|
4552 " |
4727 " |
4553 ObjectMemory lifoRememberedSet |
4728 ObjectMemory lifoRememberedSet |
4554 " |
4729 " |
4555 ! |
4730 ! |
4556 |
4731 |
4560 |
4735 |
4561 %{ /* NOCONTEXT */ |
4736 %{ /* NOCONTEXT */ |
4562 extern int __lifoRememberedSetSize(); |
4737 extern int __lifoRememberedSetSize(); |
4563 |
4738 |
4564 RETURN (__mkSmallInteger(__lifoRememberedSetSize())); |
4739 RETURN (__mkSmallInteger(__lifoRememberedSetSize())); |
4565 %} |
4740 %}. |
4741 ^ 0 |
|
4742 |
|
4566 " |
4743 " |
4567 ObjectMemory lifoRememberedSetSize |
4744 ObjectMemory lifoRememberedSetSize |
4568 " |
4745 " |
4569 ! |
4746 ! |
4570 |
4747 |
4579 filled = __stx_malloc_stats(statsArray, sizeof(statsArray)); |
4756 filled = __stx_malloc_stats(statsArray, sizeof(statsArray)); |
4580 if (filled < 1) { |
4757 if (filled < 1) { |
4581 RETURN(__mkSmallInteger(0)); |
4758 RETURN(__mkSmallInteger(0)); |
4582 } |
4759 } |
4583 RETURN ( __MKUINT(statsArray[0])); |
4760 RETURN ( __MKUINT(statsArray[0])); |
4584 %} |
4761 %}. |
4762 ^ 0 |
|
4763 |
|
4585 " |
4764 " |
4586 ObjectMemory mallocAllocated |
4765 ObjectMemory mallocAllocated |
4587 " |
4766 " |
4588 ! |
4767 ! |
4589 |
4768 |
4607 __arrayVal(allStats)[i] = temp = __MKUINT(statsArray[i]); |
4786 __arrayVal(allStats)[i] = temp = __MKUINT(statsArray[i]); |
4608 __STORE(allStats, temp); |
4787 __STORE(allStats, temp); |
4609 } |
4788 } |
4610 |
4789 |
4611 RETURN ( allStats ); |
4790 RETURN ( allStats ); |
4612 %} |
4791 %}. |
4792 ^ #() |
|
4793 |
|
4613 " |
4794 " |
4614 ObjectMemory mallocStatsArray |
4795 ObjectMemory mallocStatsArray |
4615 " |
4796 " |
4616 ! |
4797 ! |
4617 |
4798 |
4626 filled = __stx_malloc_stats(statsArray, sizeof(statsArray)); |
4807 filled = __stx_malloc_stats(statsArray, sizeof(statsArray)); |
4627 if (filled < 2) { |
4808 if (filled < 2) { |
4628 RETURN(__mkSmallInteger(0)); |
4809 RETURN(__mkSmallInteger(0)); |
4629 } |
4810 } |
4630 RETURN ( __MKUINT(statsArray[1])); |
4811 RETURN ( __MKUINT(statsArray[1])); |
4631 %} |
4812 %}. |
4813 ^ 0 |
|
4814 |
|
4632 " |
4815 " |
4633 ObjectMemory mallocTotal |
4816 ObjectMemory mallocTotal |
4634 " |
4817 " |
4635 ! |
4818 ! |
4636 |
4819 |
4639 |
4822 |
4640 %{ /* NOCONTEXT */ |
4823 %{ /* NOCONTEXT */ |
4641 extern int __markAndSweepCount(); |
4824 extern int __markAndSweepCount(); |
4642 |
4825 |
4643 RETURN (__mkSmallInteger(__markAndSweepCount())); |
4826 RETURN (__mkSmallInteger(__markAndSweepCount())); |
4644 %} |
4827 %}. |
4828 ^ 0 |
|
4829 |
|
4645 " |
4830 " |
4646 ObjectMemory markAndSweepCount |
4831 ObjectMemory markAndSweepCount |
4647 " |
4832 " |
4648 ! |
4833 ! |
4649 |
4834 |
4653 Since ST/X uses direct pointers, a field in the objectHeader |
4838 Since ST/X uses direct pointers, a field in the objectHeader |
4654 is used, which is currently 11 bits in size." |
4839 is used, which is currently 11 bits in size." |
4655 |
4840 |
4656 %{ /* NOCONTEXT */ |
4841 %{ /* NOCONTEXT */ |
4657 RETURN ( __mkSmallInteger( __MAX_HASH__ << __HASH_SHIFT__) ); |
4842 RETURN ( __mkSmallInteger( __MAX_HASH__ << __HASH_SHIFT__) ); |
4658 %} |
4843 %}. |
4844 ^ 8191 |
|
4845 |
|
4659 " |
4846 " |
4660 ObjectMemory maximumIdentityHashValue |
4847 ObjectMemory maximumIdentityHashValue |
4661 " |
4848 " |
4662 ! |
4849 ! |
4663 |
4850 |
4664 minScavengeReclamation |
4851 minScavengeReclamation |
4665 "returns the number of bytes replacimed by the least effective scavenge. |
4852 "returns the number of bytes replaimed by the least effective scavenge. |
4666 For statistic only - this may vanish." |
4853 For statistic only - this may vanish." |
4667 |
4854 |
4668 %{ /* NOCONTEXT */ |
4855 %{ /* NOCONTEXT */ |
4669 extern int __newSpaceReclaimedMin(); |
4856 extern int __newSpaceReclaimedMin(); |
4670 |
4857 |
4671 RETURN ( __mkSmallInteger(__newSpaceReclaimedMin()) ); |
4858 RETURN ( __mkSmallInteger(__newSpaceReclaimedMin()) ); |
4672 %} |
4859 %}. |
4860 ^ 0 |
|
4861 |
|
4673 " |
4862 " |
4674 ObjectMemory minScavengeReclamation |
4863 ObjectMemory minScavengeReclamation |
4675 " |
4864 " |
4676 ! |
4865 ! |
4677 |
4866 |
4680 |
4869 |
4681 %{ /* NOCONTEXT */ |
4870 %{ /* NOCONTEXT */ |
4682 extern unsigned __newSpaceSize(); |
4871 extern unsigned __newSpaceSize(); |
4683 |
4872 |
4684 RETURN ( __MKUINT(__newSpaceSize()) ); |
4873 RETURN ( __MKUINT(__newSpaceSize()) ); |
4685 %} |
4874 %}. |
4875 ^ 0 |
|
4876 |
|
4686 " |
4877 " |
4687 ObjectMemory newSpaceSize |
4878 ObjectMemory newSpaceSize |
4688 " |
4879 " |
4689 ! |
4880 ! |
4690 |
4881 |
4695 |
4886 |
4696 %{ /* NOCONTEXT */ |
4887 %{ /* NOCONTEXT */ |
4697 extern unsigned int __newSpaceUsed(); |
4888 extern unsigned int __newSpaceUsed(); |
4698 |
4889 |
4699 RETURN ( __MKUINT(__newSpaceUsed()) ); |
4890 RETURN ( __MKUINT(__newSpaceUsed()) ); |
4700 %} |
4891 %}. |
4892 ^ 0 |
|
4893 |
|
4701 " |
4894 " |
4702 ObjectMemory newSpaceUsed |
4895 ObjectMemory newSpaceUsed |
4703 " |
4896 " |
4704 ! |
4897 ! |
4705 |
4898 |
4722 |
4915 |
4723 %{ /* NOCONTEXT */ |
4916 %{ /* NOCONTEXT */ |
4724 extern int __weakListSize(); |
4917 extern int __weakListSize(); |
4725 |
4918 |
4726 RETURN ( __mkSmallInteger(__weakListSize()) ); |
4919 RETURN ( __mkSmallInteger(__weakListSize()) ); |
4727 %} |
4920 %}. |
4921 ^ 0 |
|
4922 |
|
4728 " |
4923 " |
4729 ObjectMemory numberOfWeakObjects |
4924 ObjectMemory numberOfWeakObjects |
4730 " |
4925 " |
4731 ! |
4926 ! |
4732 |
4927 |
4735 #ifdef OLDSPACE_ADDRESS |
4930 #ifdef OLDSPACE_ADDRESS |
4736 RETURN(__MKUINT(OLDSPACE_ADDRESS)); |
4931 RETURN(__MKUINT(OLDSPACE_ADDRESS)); |
4737 #else |
4932 #else |
4738 RETURN(__mkSmallInteger(0)); |
4933 RETURN(__mkSmallInteger(0)); |
4739 #endif |
4934 #endif |
4740 %} |
4935 %}. |
4936 ^ 0 |
|
4741 |
4937 |
4742 " |
4938 " |
4743 self oldSpaceAddress |
4939 self oldSpaceAddress |
4744 " |
4940 " |
4745 ! |
4941 ! |
4752 |
4948 |
4753 %{ /* NOCONTEXT */ |
4949 %{ /* NOCONTEXT */ |
4754 extern unsigned INT __oldSpaceAllocatedSinceLastGC(); |
4950 extern unsigned INT __oldSpaceAllocatedSinceLastGC(); |
4755 |
4951 |
4756 RETURN ( __MKUINT(__oldSpaceAllocatedSinceLastGC()) ); |
4952 RETURN ( __MKUINT(__oldSpaceAllocatedSinceLastGC()) ); |
4757 %} |
4953 %}. |
4954 ^ 0 |
|
4955 |
|
4758 " |
4956 " |
4759 ObjectMemory oldSpaceAllocatedSinceLastGC |
4957 ObjectMemory oldSpaceAllocatedSinceLastGC |
4760 " |
4958 " |
4761 ! |
4959 ! |
4762 |
4960 |
4765 |
4963 |
4766 %{ /* NOCONTEXT */ |
4964 %{ /* NOCONTEXT */ |
4767 extern unsigned INT __oldSpaceSize(); |
4965 extern unsigned INT __oldSpaceSize(); |
4768 |
4966 |
4769 RETURN ( __MKUINT(__oldSpaceSize()) ); |
4967 RETURN ( __MKUINT(__oldSpaceSize()) ); |
4770 %} |
4968 %}. |
4969 ^ 0 |
|
4970 |
|
4771 " |
4971 " |
4772 ObjectMemory oldSpaceSize |
4972 ObjectMemory oldSpaceSize |
4773 " |
4973 " |
4774 ! |
4974 ! |
4775 |
4975 |
4779 |
4979 |
4780 %{ /* NOCONTEXT */ |
4980 %{ /* NOCONTEXT */ |
4781 extern unsigned INT __oldSpaceUsed(); |
4981 extern unsigned INT __oldSpaceUsed(); |
4782 |
4982 |
4783 RETURN ( __MKUINT(__oldSpaceUsed()) ); |
4983 RETURN ( __MKUINT(__oldSpaceUsed()) ); |
4784 %} |
4984 %}. |
4985 ^ 0 |
|
4986 |
|
4785 " |
4987 " |
4786 ObjectMemory oldSpaceUsed |
4988 ObjectMemory oldSpaceUsed |
4787 " |
4989 " |
4788 ! |
4990 ! |
4789 |
4991 |
4793 |
4995 |
4794 %{ /* NOCONTEXT */ |
4996 %{ /* NOCONTEXT */ |
4795 extern unsigned int __rememberedSetSize(); |
4997 extern unsigned int __rememberedSetSize(); |
4796 |
4998 |
4797 RETURN (__mkSmallInteger(__rememberedSetSize())); |
4999 RETURN (__mkSmallInteger(__rememberedSetSize())); |
4798 %} |
5000 %}. |
5001 ^ 0 |
|
5002 |
|
4799 " |
5003 " |
4800 ObjectMemory rememberedSetSize |
5004 ObjectMemory rememberedSetSize |
4801 " |
5005 " |
4802 ! |
5006 ! |
4803 |
5007 |
4809 extern void __resetNewSpaceReclaimedMin(); |
5013 extern void __resetNewSpaceReclaimedMin(); |
4810 |
5014 |
4811 __resetNewSpaceReclaimedMin(); |
5015 __resetNewSpaceReclaimedMin(); |
4812 %}. |
5016 %}. |
4813 ^ self |
5017 ^ self |
5018 |
|
4814 " |
5019 " |
4815 ObjectMemory resetMinScavengeReclamation. |
5020 ObjectMemory resetMinScavengeReclamation. |
4816 ObjectMemory minScavengeReclamation |
5021 ObjectMemory minScavengeReclamation |
4817 " |
5022 " |
4818 ! |
5023 ! |
4832 |
5037 |
4833 %{ /* NOCONTEXT */ |
5038 %{ /* NOCONTEXT */ |
4834 extern int __runsSingleOldSpace(); |
5039 extern int __runsSingleOldSpace(); |
4835 |
5040 |
4836 RETURN ( (__runsSingleOldSpace() ? true : false) ); |
5041 RETURN ( (__runsSingleOldSpace() ? true : false) ); |
4837 %} |
5042 %}. |
5043 ^ true |
|
5044 |
|
4838 " |
5045 " |
4839 ObjectMemory runsSingleOldSpace |
5046 ObjectMemory runsSingleOldSpace |
4840 " |
5047 " |
4841 ! |
5048 ! |
4842 |
5049 |
4845 |
5052 |
4846 %{ /* NOCONTEXT */ |
5053 %{ /* NOCONTEXT */ |
4847 extern int __scavengeCount(); |
5054 extern int __scavengeCount(); |
4848 |
5055 |
4849 RETURN (__mkSmallInteger(__scavengeCount())); |
5056 RETURN (__mkSmallInteger(__scavengeCount())); |
4850 %} |
5057 %}. |
5058 ^ 0 |
|
5059 |
|
4851 " |
5060 " |
4852 ObjectMemory scavengeCount |
5061 ObjectMemory scavengeCount |
4853 " |
5062 " |
4854 ! |
5063 ! |
4855 |
5064 |
4858 |
5067 |
4859 %{ /* NOCONTEXT */ |
5068 %{ /* NOCONTEXT */ |
4860 extern unsigned __symSpaceSize(); |
5069 extern unsigned __symSpaceSize(); |
4861 |
5070 |
4862 RETURN ( __mkSmallInteger(__symSpaceSize()) ); |
5071 RETURN ( __mkSmallInteger(__symSpaceSize()) ); |
4863 %} |
5072 %}. |
5073 ^ 0 |
|
5074 |
|
4864 " |
5075 " |
4865 ObjectMemory symSpaceSize |
5076 ObjectMemory symSpaceSize |
4866 " |
5077 " |
4867 ! |
5078 ! |
4868 |
5079 |
4871 |
5082 |
4872 %{ /* NOCONTEXT */ |
5083 %{ /* NOCONTEXT */ |
4873 extern unsigned __symSpaceUsed(); |
5084 extern unsigned __symSpaceUsed(); |
4874 |
5085 |
4875 RETURN ( __mkSmallInteger(__symSpaceUsed()) ); |
5086 RETURN ( __mkSmallInteger(__symSpaceUsed()) ); |
4876 %} |
5087 %}. |
5088 ^ 0 |
|
5089 |
|
4877 " |
5090 " |
4878 ObjectMemory symSpaceUsed |
5091 ObjectMemory symSpaceUsed |
4879 " |
5092 " |
4880 ! |
5093 ! |
4881 |
5094 |
4886 |
5099 |
4887 %{ /* NOCONTEXT */ |
5100 %{ /* NOCONTEXT */ |
4888 extern unsigned __tenureAge(); |
5101 extern unsigned __tenureAge(); |
4889 |
5102 |
4890 RETURN ( __mkSmallInteger(__tenureAge()) ); |
5103 RETURN ( __mkSmallInteger(__tenureAge()) ); |
4891 %} |
5104 %}. |
5105 ^ 0 |
|
4892 ! |
5106 ! |
4893 |
5107 |
4894 vmSymbols |
5108 vmSymbols |
4895 "return a collection of symbols used by the VM" |
5109 "return a collection of symbols used by the VM" |
4896 |
5110 |
5054 |
5268 |
5055 |modules| |
5269 |modules| |
5056 |
5270 |
5057 modules := IdentityDictionary new. |
5271 modules := IdentityDictionary new. |
5058 self allBinaryModulesDo:[:idArg :nameArg :flagsArg :libName :timeStamp | |
5272 self allBinaryModulesDo:[:idArg :nameArg :flagsArg :libName :timeStamp | |
5059 |type subModuleName module dynamic infoRec handle pathName |
5273 |type subModuleName module dynamic infoRec handle pathName |
5060 typeName name nameString| |
5274 typeName name nameString| |
5061 |
5275 |
5062 nameArg isString ifFalse:[ |
5276 nameArg isString ifFalse:[ |
5063 'Error in binaryModuleInfo - skip entry' errorPrintCR. |
5277 'Error in binaryModuleInfo - skip entry' errorPrintCR. |
5064 ] ifTrue:[ |
5278 ] ifTrue:[ |
5065 name := nameArg. |
5279 name := nameArg. |
5066 subModuleName := name asSymbol. |
5280 subModuleName := name asSymbol. |
5067 |
5281 |
5068 idArg > 0 ifTrue:[ |
5282 idArg > 0 ifTrue:[ |
5069 dynamic := true. |
5283 dynamic := true. |
5070 typeName := 'dynamic '. |
5284 typeName := 'dynamic '. |
5071 handle := ObjectFileLoader handleFromID:idArg. |
5285 handle := ObjectFileLoader handleFromID:idArg. |
5072 (handle isNil or:[(pathName := handle pathName) isNil]) ifTrue:[ |
5286 (handle isNil or:[(pathName := handle pathName) isNil]) ifTrue:[ |
5073 name := '?' |
5287 name := '?' |
5074 ] ifFalse:[ |
5288 ] ifFalse:[ |
5075 name := pathName asFilename baseName |
5289 name := pathName asFilename baseName |
5076 ] |
5290 ] |
5077 ] ifFalse:[ |
5291 ] ifFalse:[ |
5078 dynamic := false. |
5292 dynamic := false. |
5079 typeName := 'builtIn '. |
5293 typeName := 'builtIn '. |
5080 pathName := nil. |
5294 pathName := nil. |
5081 libName isNil ifTrue:[ |
5295 libName isNil ifTrue:[ |
5082 name := subModuleName |
5296 name := subModuleName |
5083 ] ifFalse:[ |
5297 ] ifFalse:[ |
5084 name := libName |
5298 name := libName |
5085 ]. |
5299 ]. |
5086 ]. |
5300 ]. |
5087 nameString := typeName. |
5301 nameString := typeName. |
5088 libName isNil ifTrue:[ |
5302 libName isNil ifTrue:[ |
5089 nameString := nameString, 'module ' |
5303 nameString := nameString, 'module ' |
5090 ] ifFalse:[ |
5304 ] ifFalse:[ |
5091 nameString := nameString, 'classLib ' |
5305 nameString := nameString, 'classLib ' |
5092 ]. |
5306 ]. |
5093 nameString := nameString , name. |
5307 nameString := nameString , name. |
5094 |
5308 |
5095 libName isNil ifTrue:[ |
5309 libName isNil ifTrue:[ |
5096 type := #classObject |
5310 type := #classObject |
5097 ] ifFalse:[ |
5311 ] ifFalse:[ |
5098 type := #classLibrary |
5312 type := #classLibrary |
5099 ]. |
5313 ]. |
5100 |
5314 |
5101 infoRec := modules at:idArg ifAbsent:nil. |
5315 infoRec := modules at:idArg ifAbsent:nil. |
5102 infoRec notNil ifTrue:[ |
5316 infoRec notNil ifTrue:[ |
5103 infoRec classNames add:subModuleName. |
5317 infoRec classNames add:subModuleName. |
5104 ] ifFalse:[ |
5318 ] ifFalse:[ |
5105 infoRec := BinaryModuleDescriptor |
5319 infoRec := BinaryModuleDescriptor |
5106 name:nameString |
5320 name:nameString |
5107 type:type |
5321 type:type |
5108 id:idArg |
5322 id:idArg |
5109 dynamic:dynamic |
5323 dynamic:dynamic |
5110 classNames:( (OrderedSet ? Set) with:subModuleName) |
5324 classNames:( (OrderedSet ? Set) with:subModuleName) |
5111 handle:handle |
5325 handle:handle |
5112 pathName:pathName |
5326 pathName:pathName |
5113 libraryName:libName |
5327 libraryName:libName |
5114 timeStamp:nil. |
5328 timeStamp:nil. |
5115 |
5329 |
5116 modules at:idArg put:infoRec. |
5330 modules at:idArg put:infoRec. |
5117 ]. |
5331 ]. |
5118 ]. |
5332 ]. |
5119 ]. |
5333 ]. |
5120 ^ modules |
5334 ^ modules |
5121 |
5335 |
5122 " |
5336 " |
5123 ObjectMemory binaryModuleInfo |
5337 ObjectMemory binaryModuleInfo |
5135 |
5349 |
5136 %{ |
5350 %{ |
5137 extern OBJ __getVMReleaseStrings(); |
5351 extern OBJ __getVMReleaseStrings(); |
5138 |
5352 |
5139 RETURN (__getVMReleaseStrings()); |
5353 RETURN (__getVMReleaseStrings()); |
5140 %} |
5354 %}. |
5355 ^ #() |
|
5356 |
|
5141 " |
5357 " |
5142 ObjectMemory getVMIdentificationStrings |
5358 ObjectMemory getVMIdentificationStrings |
5143 " |
5359 " |
5144 ! ! |
5360 ! ! |
5145 |
5361 |
5151 dir := Filename currentDirectory. |
5367 dir := Filename currentDirectory. |
5152 |
5368 |
5153 "/ the current directory is not a good idea, if stx is started via a desktop manager |
5369 "/ the current directory is not a good idea, if stx is started via a desktop manager |
5154 "/ or in osx, by clicking on stx.app. |
5370 "/ or in osx, by clicking on stx.app. |
5155 dir isRootDirectory ifTrue:[ |
5371 dir isRootDirectory ifTrue:[ |
5156 exeDir := OperatingSystem nameOfSTXExecutable asFilename directory. |
5372 exeDir := OperatingSystem nameOfSTXExecutable asFilename directory. |
5157 dir ~= exeDir ifTrue:[ |
5373 dir ~= exeDir ifTrue:[ |
5158 "/ Change it to ~/.smalltalk or is executable directory better? |
5374 "/ Change it to ~/.smalltalk or is executable directory better? |
5159 |
5375 |
5160 "/ use executable dir, as otherwise I'd have to change the VM to include an image path... |
5376 "/ use executable dir, as otherwise I'd have to change the VM to include an image path... |
5161 "/ dir := Filename usersPrivateSmalltalkDirectory. |
5377 "/ dir := Filename usersPrivateSmalltalkDirectory. |
5162 dir := exeDir. |
5378 dir := exeDir. |
5163 ]. |
5379 ]. |
5164 ]. |
5380 ]. |
5165 ^ dir |
5381 ^ dir |
5166 |
5382 |
5167 " |
5383 " |
5168 self directoryForImageAndChangeFile |
5384 self directoryForImageAndChangeFile |
5214 |
5430 |
5215 initChangeFilename |
5431 initChangeFilename |
5216 "/ make the changeFilePath an absolute one, |
5432 "/ make the changeFilePath an absolute one, |
5217 "/ in case some stupid windows fileDialog changes the current directory... |
5433 "/ in case some stupid windows fileDialog changes the current directory... |
5218 self |
5434 self |
5219 nameForChanges:(self directoryForImageAndChangeFile / ObjectMemory nameForChangesLocal) |
5435 nameForChanges:(self directoryForImageAndChangeFile / ObjectMemory nameForChangesLocal) |
5220 asAbsoluteFilename pathName |
5436 asAbsoluteFilename pathName |
5221 |
5437 |
5222 " |
5438 " |
5223 self initChangeFilename |
5439 self initChangeFilename |
5224 " |
5440 " |
5225 ! |
5441 ! |
5318 oldImageName := ImageName. |
5534 oldImageName := ImageName. |
5319 oldImageTime := ImageSaveTime. |
5535 oldImageTime := ImageSaveTime. |
5320 |
5536 |
5321 ImageName := filenameString. |
5537 ImageName := filenameString. |
5322 ImageSaveTime := Timestamp now. |
5538 ImageSaveTime := Timestamp now. |
5539 ok := false. |
|
5323 |
5540 |
5324 %{ /* CALLSSTACK:32000 */ |
5541 %{ /* CALLSSTACK:32000 */ |
5325 |
5542 |
5326 OBJ __snapShotOn(); |
5543 OBJ __snapShotOn(); |
5327 OBJ funny = @symbol(funnySnapshotSymbol); |
5544 OBJ funny = @symbol(funnySnapshotSymbol); |
5391 |
5608 |
5392 " |
5609 " |
5393 ST-80 compatibility; send #preSnapshot to all classes |
5610 ST-80 compatibility; send #preSnapshot to all classes |
5394 " |
5611 " |
5395 Smalltalk allClassesDo:[:aClass | |
5612 Smalltalk allClassesDo:[:aClass | |
5396 aClass preSnapshot |
5613 aClass preSnapshot |
5397 ]. |
5614 ]. |
5398 |
5615 |
5399 " |
5616 " |
5400 save in a temp file and rename - just in case something |
5617 save in a temp file and rename - just in case something |
5401 bad happens while writing the image. |
5618 bad happens while writing the image. |
5402 (could be ST/X error or file-system errors etc.) |
5619 (could be ST/X error or file-system errors etc.) |
5403 " |
5620 " |
5404 snapshotFilename := aFileName asFilename. |
5621 snapshotFilename := aFileName asFilename. |
5405 snapshotFilename isAbsolute ifFalse:[ |
5622 snapshotFilename isAbsolute ifFalse:[ |
5406 snapshotFilename := self directoryForImageAndChangeFile |
5623 snapshotFilename := self directoryForImageAndChangeFile |
5407 / snapshotFilename name. |
5624 / snapshotFilename name. |
5408 ]. |
5625 ]. |
5409 |
5626 |
5410 tempFilename := (FileStream newTemporaryIn:snapshotFilename directory) |
5627 tempFilename := (FileStream newTemporaryIn:snapshotFilename directory) |
5411 close; |
5628 close; |
5412 fileName. |
5629 fileName. |
5413 ok := self primSnapShotOn:tempFilename. |
5630 ok := self primSnapShotOn:tempFilename. |
5414 |
5631 |
5415 ok ifTrue:[ |
5632 ok ifTrue:[ |
5416 "keep history of one snapshot file" |
5633 "keep history of one snapshot file" |
5417 snapshotFilename exists ifTrue:[ |
5634 snapshotFilename exists ifTrue:[ |
5418 tempFilename symbolicAccessRights:snapshotFilename symbolicAccessRights. |
5635 tempFilename symbolicAccessRights:snapshotFilename symbolicAccessRights. |
5419 snapshotFilename renameTo:(snapshotFilename withSuffix:'sav'). |
5636 snapshotFilename renameTo:(snapshotFilename withSuffix:'sav'). |
5420 ] ifFalse:[ |
5637 ] ifFalse:[ |
5421 "image file hat stx as interpreter and can be executed" |
5638 "image file hat stx as interpreter and can be executed" |
5422 tempFilename makeExecutable. |
5639 tempFilename makeExecutable. |
5423 ]. |
5640 ]. |
5424 tempFilename renameTo:snapshotFilename. |
5641 tempFilename renameTo:snapshotFilename. |
5425 |
5642 |
5426 Class addChangeRecordForSnapshot:aFileName. |
5643 Class addChangeRecordForSnapshot:aFileName. |
5427 |
5644 |
5428 setImageName ifTrue:[ |
5645 setImageName ifTrue:[ |
5429 oldChangeFile := self nameForChanges. |
5646 oldChangeFile := self nameForChanges. |
5430 ImageName := snapshotFilename asAbsoluteFilename asString. |
5647 ImageName := snapshotFilename asAbsoluteFilename asString. |
5431 self refreshChangesFrom:oldChangeFile. |
5648 self refreshChangesFrom:oldChangeFile. |
5432 ]. |
5649 ]. |
5433 ] ifFalse:[ |
5650 ] ifFalse:[ |
5434 tempFilename remove. |
5651 tempFilename remove. |
5435 ]. |
5652 ]. |
5436 |
5653 |
5437 " |
5654 " |
5438 ST-80 compatibility; send #postSnapshot to all classes |
5655 ST-80 compatibility; send #postSnapshot to all classes |
5439 " |
5656 " |
5440 Smalltalk allClassesDo:[:aClass | |
5657 Smalltalk allClassesDo:[:aClass | |
5441 aClass postSnapshot |
5658 aClass postSnapshot |
5442 ]. |
5659 ]. |
5443 self changed:#finishedSnapshot. "/ ST-80 compatibility |
5660 self changed:#finishedSnapshot. "/ ST-80 compatibility |
5444 |
5661 |
5445 ok ifFalse:[ |
5662 ok ifFalse:[ |
5446 SnapshotError raise. |
5663 SnapshotError raise. |
5447 "not reached" |
5664 "not reached" |
5448 ]. |
5665 ]. |
5449 |
5666 |
5450 Transcript |
5667 Transcript |
5451 show:'Snapshot '; |
5668 show:'Snapshot '; |
5452 show:snapshotFilename baseName allBold; |
5669 show:snapshotFilename baseName allBold; |
5453 show:' saved '; |
5670 show:' saved '; |
5454 show:Timestamp now; |
5671 show:Timestamp now; |
5455 show:' in '; |
5672 show:' in '; |
5456 show:snapshotFilename asAbsoluteFilename directoryName; |
5673 show:snapshotFilename asAbsoluteFilename directoryName; |
5457 showCR:'.'. |
5674 showCR:'.'. |
5458 |
5675 |
5459 ^ ok |
5676 ^ ok |
5460 |
5677 |
5461 " |
5678 " |
5462 ObjectMemory snapShotOn:'myimage.img' setImageName:false |
5679 ObjectMemory snapShotOn:'myimage.img' setImageName:false |
5615 ! ! |
5832 ! ! |
5616 |
5833 |
5617 !ObjectMemory class methodsFor:'documentation'! |
5834 !ObjectMemory class methodsFor:'documentation'! |
5618 |
5835 |
5619 version |
5836 version |
5620 ^ '$Header: /cvs/stx/stx/libbasic/ObjectMemory.st,v 1.286 2015-02-20 22:45:22 cg Exp $' |
5837 ^ '$Header: /cvs/stx/stx/libbasic/ObjectMemory.st,v 1.287 2015-05-24 12:52:28 cg Exp $' |
5621 ! |
5838 ! |
5622 |
5839 |
5623 version_CVS |
5840 version_CVS |
5624 ^ '$Header: /cvs/stx/stx/libbasic/ObjectMemory.st,v 1.286 2015-02-20 22:45:22 cg Exp $' |
5841 ^ '$Header: /cvs/stx/stx/libbasic/ObjectMemory.st,v 1.287 2015-05-24 12:52:28 cg Exp $' |
5625 ! |
5842 ! |
5626 |
5843 |
5627 version_SVN |
5844 version_SVN |
5628 ^ '$ Id: ObjectMemory.st 10643 2011-06-08 21:53:07Z vranyj1 $' |
5845 ^ '$ Id: ObjectMemory.st 10643 2011-06-08 21:53:07Z vranyj1 $' |
5629 ! ! |
5846 ! ! |