SnapShotImageMemory.st
changeset 3324 dee0c393db4e
parent 3250 48b1dfb0b16f
child 3326 4ecde59f7563
equal deleted inserted replaced
3323:9c579009a14b 3324:dee0c393db4e
   322 allClassesDo:aBlock
   322 allClassesDo:aBlock
   323     globalEntries do:[:eachGlobal |
   323     globalEntries do:[:eachGlobal |
   324         |val|
   324         |val|
   325 
   325 
   326         val := eachGlobal value.
   326         val := eachGlobal value.
   327         (val notNil     
   327         (val notNil
   328         and:[(val isKindOf:ImageHeader)
   328         and:[(val isKindOf:ImageHeader)
   329         and:[val isImageBehavior]]) ifTrue:[
   329         and:[val isImageBehavior]]) ifTrue:[
   330             aBlock value:val
   330             aBlock value:val
   331         ].
   331         ].
   332     ].
   332     ].
   872 
   872 
   873     flags := classRef flags.
   873     flags := classRef flags.
   874     ^ flags bitTest:Behavior flagSymbol 
   874     ^ flags bitTest:Behavior flagSymbol 
   875 !
   875 !
   876 
   876 
   877 isJavaMethod    
   877 isJavaMethod
   878     |nm|
   878     |nm|
   879 
   879 
   880     nm := classRef name.
   880     nm := classRef name.
   881     ^ (nm = 'JavaMethod'
   881     ^ (nm = 'JavaMethod'
   882       or:[ nm = 'JavaMethodWithException' 
   882       or:[ nm = 'JavaMethodWithException'
   883       or:[ nm = 'JavaMethodWithHandler' 
   883       or:[ nm = 'JavaMethodWithHandler'
   884       or:[ nm = 'JavaNativeMethod' ]]])
   884       or:[ nm = 'JavaNativeMethod' ]]])
   885 !
   885 !
   886 
   886 
   887 isLazyMethod                               
   887 isLazyMethod
   888     ^ classRef name = 'LazyMethod'
   888     ^ classRef name = 'LazyMethod'
   889 !
   889 !
   890 
   890 
   891 isMeta
   891 isMeta
   892     ^ false
   892     ^ false
   893 !
   893 !
   894 
   894 
   895 isMethod                               
   895 isMethod
   896     |cls|
   896     |cls|
   897 
   897 
   898     cls := classRef.
   898     cls := classRef.
   899     [cls notNil] whileTrue:[
   899     [cls notNil] whileTrue:[
   900         cls name = 'Method' ifTrue:[^ true].
   900         cls name = 'Method' ifTrue:[^ true].
   905 
   905 
   906 isMethodDictionary
   906 isMethodDictionary
   907     ^ classRef name = 'MethodDictionary'
   907     ^ classRef name = 'MethodDictionary'
   908 !
   908 !
   909 
   909 
   910 isMethodOrLazyMethod                 
   910 isMethodOrLazyMethod
   911     classRef name = 'LazyMethod' ifTrue:[^ true].
   911     classRef name = 'LazyMethod' ifTrue:[^ true].
   912     ^ self isMethod
   912     ^ self isMethod
   913 !
   913 !
   914 
   914 
   915 isString                               
   915 isString                               
  1212     ].
  1212     ].
  1213     self halt.
  1213     self halt.
  1214 !
  1214 !
  1215 
  1215 
  1216 sourceStream
  1216 sourceStream
  1217     |sourcePosition source aStream fileName junk who 
  1217     |sourcePosition source aStream fileName junk who
  1218      myClass mgr className sep dir mod package|
  1218      myClass mgr className sep dir mod package|
  1219 
  1219 
  1220     self isMethod ifTrue:[
  1220     self isMethod ifTrue:[
  1221         sourcePosition := self at:(Method instVarOffsetOf:'sourcePosition').
  1221         sourcePosition := self at:(Method instVarOffsetOf:'sourcePosition').
  1222         source := self at:(Method instVarOffsetOf:'source').
  1222         source := self at:(Method instVarOffsetOf:'source').
  1281         aStream notNil ifTrue:[
  1281         aStream notNil ifTrue:[
  1282             ^ aStream
  1282             ^ aStream
  1283         ].
  1283         ].
  1284 
  1284 
  1285         "/
  1285         "/
  1286         "/ nope - look in standard places 
  1286         "/ nope - look in standard places
  1287         "/ (if there is a source-code manager - otherwise, we already did that)
  1287         "/ (if there is a source-code manager - otherwise, we already did that)
  1288         "/
  1288         "/
  1289         mgr notNil ifTrue:[
  1289         mgr notNil ifTrue:[
  1290             aStream := self localSourceStream.
  1290             aStream := self localSourceStream.
  1291             aStream notNil ifTrue:[
  1291             aStream notNil ifTrue:[
  1319                     aStream notNil ifTrue:[
  1319                     aStream notNil ifTrue:[
  1320                         ^ aStream
  1320                         ^ aStream
  1321                     ].
  1321                     ].
  1322                 ]
  1322                 ]
  1323             ]
  1323             ]
  1324         ].                
  1324         ].
  1325 
  1325 
  1326         ^ nil
  1326         ^ nil
  1327     ].
  1327     ].
  1328     ^ nil
  1328     ^ nil
  1329 ! !
  1329 ! !
  3431     "return the primitiveDefinition string or nil"
  3431     "return the primitiveDefinition string or nil"
  3432 
  3432 
  3433     ^ self getPrimitiveSpecsAt:1
  3433     ^ self getPrimitiveSpecsAt:1
  3434 
  3434 
  3435     "
  3435     "
  3436      Object primitiveDefinitionsString 
  3436      Object primitiveDefinitionsString
  3437      String primitiveDefinitionsString
  3437      String primitiveDefinitionsString
  3438     "
  3438     "
  3439 !
  3439 !
  3440 
  3440 
  3441 primitiveFunctionsString
  3441 primitiveFunctionsString
  3775     classFilename := self classFilename.
  3775     classFilename := self classFilename.
  3776     package := self package.
  3776     package := self package.
  3777     name := self name.
  3777     name := self name.
  3778 
  3778 
  3779     "/
  3779     "/
  3780     "/ if there is no SourceCodeManager, 
  3780     "/ if there is no SourceCodeManager,
  3781     "/ or TryLocalSourceFirst is true,
  3781     "/ or TryLocalSourceFirst is true,
  3782     "/ look in standard places first
  3782     "/ look in standard places first
  3783     "/
  3783     "/
  3784     ((mgr := self sourceCodeManager) isNil 
  3784     ((mgr := self sourceCodeManager) isNil
  3785     or:[Class tryLocalSourceFirst == true]) ifTrue:[
  3785     or:[Class tryLocalSourceFirst == true]) ifTrue:[
  3786         aStream := self localSourceStreamFor:source.
  3786         aStream := self localSourceStreamFor:source.
  3787     ].
  3787     ].
  3788 
  3788 
  3789     aStream isNil ifTrue:[
  3789     aStream isNil ifTrue:[
  3790         "/ mhmh - still no source file.
  3790         "/ mhmh - still no source file.
  3791         "/ If there is a SourceCodeManager, ask it to aquire the
  3791         "/ If there is a SourceCodeManager, ask it to acquire the
  3792         "/ the source for my class, and return an open stream on it. 
  3792         "/ the source for my class, and return an open stream on it.
  3793         "/ if that one does not know about the source, look in
  3793         "/ if that one does not know about the source, look in
  3794         "/ standard places
  3794         "/ standard places
  3795 
  3795 
  3796         mgr notNil ifTrue:[
  3796         mgr notNil ifTrue:[
  3797             self classFilename ~= source ifTrue:[
  3797             self classFilename ~= source ifTrue:[
  3810                     aStream := mgr getSourceStreamFor:self.
  3810                     aStream := mgr getSourceStreamFor:self.
  3811                 ]
  3811                 ]
  3812             ].
  3812             ].
  3813             aStream notNil ifTrue:[
  3813             aStream notNil ifTrue:[
  3814                 (self validateSourceStream:aStream) ifFalse:[
  3814                 (self validateSourceStream:aStream) ifFalse:[
  3815                     ('Class [info]: repositories source for `' 
  3815                     ('Class [info]: repositories source for `'
  3816                      , (self isMeta ifTrue:[self soleInstance name]
  3816                      , (self isMeta ifTrue:[self soleInstance name]
  3817                                     ifFalse:[name])
  3817                                     ifFalse:[name])
  3818                      , ''' is invalid.') infoPrintCR.
  3818                      , ''' is invalid.') infoPrintCR.
  3819                     aStream close.
  3819                     aStream close.
  3820                     aStream := nil
  3820                     aStream := nil
  3824             ].
  3824             ].
  3825         ]
  3825         ]
  3826     ].
  3826     ].
  3827 
  3827 
  3828     aStream isNil ifTrue:[
  3828     aStream isNil ifTrue:[
  3829         "/      
  3829         "/
  3830         "/ hard case - there is no source file for this class
  3830         "/ hard case - there is no source file for this class
  3831         "/ (in the source-dir-path).
  3831         "/ (in the source-dir-path).
  3832         "/      
  3832         "/
  3833 
  3833 
  3834         "/      
  3834         "/
  3835         "/ look if my binary is from a dynamically loaded module,
  3835         "/ look if my binary is from a dynamically loaded module,
  3836         "/ and, if so, look in the modules directory for the
  3836         "/ and, if so, look in the modules directory for the
  3837         "/ source file.
  3837         "/ source file.
  3838         "/      
  3838         "/
  3839         ObjectFileLoader notNil ifTrue:[
  3839         ObjectFileLoader notNil ifTrue:[
  3840             ObjectFileLoader loadedObjectHandlesDo:[:h |
  3840             ObjectFileLoader loadedObjectHandlesDo:[:h |
  3841                 |f classes|
  3841                 |f classes|
  3842 
  3842 
  3843                 aStream isNil ifTrue:[
  3843                 aStream isNil ifTrue:[
  4159     ^ superclass notNil
  4159     ^ superclass notNil
  4160       and:[ superclass name = 'NameSpace' ].
  4160       and:[ superclass name = 'NameSpace' ].
  4161 !
  4161 !
  4162 
  4162 
  4163 isPrivate
  4163 isPrivate
  4164     ^ classRef isPrivateMeta 
  4164     ^ classRef isPrivateMeta
  4165 !
  4165 !
  4166 
  4166 
  4167 isPrivateMeta
  4167 isPrivateMeta
  4168     thisContext isRecursive ifTrue:[^ false].
  4168     thisContext isRecursive ifTrue:[^ false].
  4169     byteSize = memory privateMetaClassByteSize ifFalse:[^ false].
  4169     byteSize = memory privateMetaClassByteSize ifFalse:[^ false].
  4255     ].
  4255     ].
  4256     ^ self halt.
  4256     ^ self halt.
  4257 !
  4257 !
  4258 
  4258 
  4259 wasAutoloaded
  4259 wasAutoloaded
  4260     ^ false 
  4260     ^ false
  4261 ! !
  4261 ! !
  4262 
  4262 
  4263 !SnapShotImageMemory::SpaceInfo methodsFor:'accessing'!
  4263 !SnapShotImageMemory::SpaceInfo methodsFor:'accessing'!
  4264 
  4264 
  4265 end
  4265 end