1417
|
1 |
'From Smalltalk/X, Version:4.1.1 on 24-Okt-2000 at 12:50:47' !
|
|
2 |
|
1416
|
3 |
"{ Package: 'cg:private' }"
|
|
4 |
|
|
5 |
Object subclass:#SnapShotImageMemory
|
1417
|
6 |
instanceVariableNames:'image stream msb ptrSize intSize intTag spaceInfos symbolEntries
|
1416
|
7 |
globalEntries addrToObjectMapping'
|
|
8 |
classVariableNames:''
|
|
9 |
poolDictionaries:''
|
|
10 |
category:'System-Support'
|
|
11 |
!
|
|
12 |
|
1417
|
13 |
Object subclass:#ImageHeader
|
|
14 |
instanceVariableNames:'memory classRef bits byteSize'
|
|
15 |
classVariableNames:''
|
|
16 |
poolDictionaries:''
|
|
17 |
privateIn:SnapShotImageMemory
|
|
18 |
!
|
|
19 |
|
1416
|
20 |
Object subclass:#SpaceInfo
|
|
21 |
instanceVariableNames:'start end size flags imageBase'
|
|
22 |
classVariableNames:''
|
|
23 |
poolDictionaries:''
|
|
24 |
privateIn:SnapShotImageMemory
|
|
25 |
!
|
|
26 |
|
1417
|
27 |
SnapShotImageMemory::ImageHeader variableSubclass:#ImageObject
|
|
28 |
instanceVariableNames:''
|
1416
|
29 |
classVariableNames:''
|
|
30 |
poolDictionaries:''
|
|
31 |
privateIn:SnapShotImageMemory
|
|
32 |
!
|
|
33 |
|
|
34 |
SnapShotImageMemory::ImageObject variableSubclass:#ImageClassObject
|
|
35 |
instanceVariableNames:''
|
|
36 |
classVariableNames:''
|
|
37 |
poolDictionaries:''
|
|
38 |
privateIn:SnapShotImageMemory
|
|
39 |
!
|
|
40 |
|
1417
|
41 |
SnapShotImageMemory::ImageHeader variableByteSubclass:#ImageByteObject
|
|
42 |
instanceVariableNames:''
|
|
43 |
classVariableNames:''
|
|
44 |
poolDictionaries:''
|
|
45 |
privateIn:SnapShotImageMemory
|
|
46 |
!
|
|
47 |
|
1416
|
48 |
|
|
49 |
!SnapShotImageMemory class methodsFor:'instance creation'!
|
|
50 |
|
|
51 |
for:aFilename
|
|
52 |
^ self new for:aFilename
|
|
53 |
! !
|
|
54 |
|
|
55 |
!SnapShotImageMemory class methodsFor:'private'!
|
|
56 |
|
|
57 |
isNilOOP:anOOP
|
|
58 |
^ anOOP == 0
|
|
59 |
!
|
|
60 |
|
|
61 |
isPointerOOP:anOOP
|
|
62 |
^ (anOOP bitTest:1) not
|
|
63 |
!
|
|
64 |
|
|
65 |
isSmallIntegerOOP:anOOP
|
|
66 |
^ anOOP bitTest:1
|
|
67 |
! !
|
|
68 |
|
|
69 |
!SnapShotImageMemory methodsFor:'accessing'!
|
|
70 |
|
|
71 |
globalEntries
|
|
72 |
"return the value of the instance variable 'globalEntries' (automatically generated)"
|
|
73 |
|
|
74 |
^ globalEntries!
|
|
75 |
|
|
76 |
globalEntries:something
|
|
77 |
"set the value of the instance variable 'globalEntries' (automatically generated)"
|
|
78 |
|
1417
|
79 |
globalEntries := something.!
|
|
80 |
|
|
81 |
image
|
|
82 |
|
|
83 |
^ image
|
|
84 |
!
|
|
85 |
|
|
86 |
image:something
|
|
87 |
|
|
88 |
image := something.
|
|
89 |
!
|
|
90 |
|
|
91 |
ptrSize
|
|
92 |
"return the value of the instance variable 'ptrSize' (automatically generated)"
|
|
93 |
|
|
94 |
^ ptrSize!
|
|
95 |
|
|
96 |
ptrSize:something
|
|
97 |
"set the value of the instance variable 'ptrSize' (automatically generated)"
|
|
98 |
|
|
99 |
ptrSize := something.! !
|
1416
|
100 |
|
|
101 |
!SnapShotImageMemory methodsFor:'object access'!
|
|
102 |
|
1417
|
103 |
fetchByteAt:addr
|
|
104 |
|byte imgAddr|
|
|
105 |
|
|
106 |
imgAddr := self imageAddressOf:addr.
|
|
107 |
stream position:imgAddr.
|
|
108 |
byte := stream next.
|
|
109 |
^ byte
|
|
110 |
!
|
|
111 |
|
1416
|
112 |
fetchClassObjectAt:baseAddr
|
1417
|
113 |
|addr classPtr size bits o classRef nInsts|
|
|
114 |
|
|
115 |
(baseAddr bitAnd:3) ~~ 0 ifTrue:[self halt].
|
1416
|
116 |
|
|
117 |
o := addrToObjectMapping at:baseAddr ifAbsent:nil.
|
|
118 |
o notNil ifTrue:[^ o].
|
|
119 |
|
|
120 |
addr := baseAddr.
|
|
121 |
classPtr := self fetchPointerAt:addr.
|
|
122 |
addr := addr + ptrSize.
|
|
123 |
size := self fetchUnboxedIntegerAt:addr.
|
|
124 |
addr := addr + ptrSize.
|
|
125 |
bits := self fetchUnboxedIntegerAt:addr.
|
|
126 |
addr := addr + ptrSize.
|
|
127 |
|
1417
|
128 |
nInsts := (size - (intSize *3)) // intSize.
|
|
129 |
o := ImageClassObject new:nInsts.
|
|
130 |
addrToObjectMapping at:baseAddr put:o.
|
|
131 |
|
|
132 |
(self class isPointerOOP:classPtr) ifFalse:[
|
|
133 |
self halt
|
|
134 |
].
|
|
135 |
|
|
136 |
classRef := self fetchClassObjectAt:classPtr.
|
|
137 |
|
|
138 |
o classRef:classRef.
|
|
139 |
size > 8000 ifTrue:[self halt].
|
|
140 |
o byteSize:size.
|
1416
|
141 |
o bits:bits.
|
|
142 |
|
1417
|
143 |
1 to:nInsts do:[:idx |
|
1416
|
144 |
o at:idx put:(self fetchUnboxedIntegerAt:addr).
|
1417
|
145 |
"/ o at:idx put:(self fetchObjectAt:(self fetchUnboxedIntegerAt:addr)).
|
|
146 |
addr := addr + ptrSize.
|
1416
|
147 |
].
|
1417
|
148 |
o memory:self.
|
1416
|
149 |
^ o
|
|
150 |
!
|
|
151 |
|
|
152 |
fetchObjectAt:baseAddr
|
1417
|
153 |
|addr classPtr classRef size bits o nBytes nInsts flags imgAddr|
|
|
154 |
|
|
155 |
baseAddr == 0 ifTrue:[^ nil].
|
|
156 |
(baseAddr bitAnd:1) == 1 ifTrue:[(baseAddr bitTest:16r80000000) ifTrue:[
|
|
157 |
^ (baseAddr - 16r100000000) bitShift32:-1
|
|
158 |
] ifFalse:[
|
|
159 |
^ baseAddr bitShift32:-1
|
|
160 |
]
|
|
161 |
].
|
|
162 |
(baseAddr bitAnd:3) ~~ 0 ifTrue:[self halt].
|
1416
|
163 |
|
|
164 |
o := addrToObjectMapping at:baseAddr ifAbsent:nil.
|
|
165 |
o notNil ifTrue:[^ o].
|
|
166 |
|
|
167 |
addr := baseAddr.
|
|
168 |
classPtr := self fetchPointerAt:addr.
|
|
169 |
addr := addr + ptrSize.
|
|
170 |
size := self fetchUnboxedIntegerAt:addr.
|
|
171 |
addr := addr + ptrSize.
|
|
172 |
bits := self fetchUnboxedIntegerAt:addr.
|
|
173 |
addr := addr + ptrSize.
|
|
174 |
|
|
175 |
(self class isPointerOOP:classPtr) ifFalse:[
|
|
176 |
self halt
|
|
177 |
].
|
|
178 |
|
|
179 |
classRef := self fetchClassObjectAt:classPtr.
|
1417
|
180 |
|
|
181 |
flags := classRef flags bitAnd:Behavior maskIndexType.
|
|
182 |
(flags = Behavior flagBytes) ifTrue:[
|
|
183 |
nBytes := (size - (intSize * 3)).
|
|
184 |
o := ImageByteObject new:nBytes.
|
|
185 |
o classRef:classRef.
|
|
186 |
size > 8000 ifTrue:[self halt].
|
|
187 |
o byteSize:size.
|
|
188 |
o bits:bits.
|
1416
|
189 |
|
1417
|
190 |
imgAddr := self imageAddressOf:addr.
|
|
191 |
stream position:imgAddr.
|
1416
|
192 |
|
1417
|
193 |
1 to:nBytes do:[:idx |
|
|
194 |
o at:idx put:(stream next).
|
|
195 |
addr := addr + 1.
|
|
196 |
].
|
|
197 |
|
|
198 |
"/Transcript show:'#'.
|
|
199 |
"/Transcript show:((ByteArray new:nBytes-1) replaceFrom:1 to:nBytes-1 with:o startingAt:1) asString.
|
|
200 |
"/Transcript cr.
|
1416
|
201 |
|
1417
|
202 |
] ifFalse:[
|
|
203 |
(flags = Behavior flagNotIndexed) ifFalse:[
|
|
204 |
(flags ~= Behavior flagPointers) ifTrue:[
|
|
205 |
(flags ~= Behavior flagWeakPointers) ifTrue:[
|
|
206 |
self halt
|
|
207 |
]
|
|
208 |
].
|
|
209 |
].
|
1416
|
210 |
|
1417
|
211 |
nInsts := (size - (intSize * 3)) // intSize.
|
|
212 |
(classRef flags bitTest:Behavior flagBehavior)
|
|
213 |
"/ classRef isImageBehavior
|
|
214 |
ifTrue:[
|
|
215 |
o := ImageClassObject new:nInsts.
|
|
216 |
] ifFalse:[
|
|
217 |
o := ImageObject new:nInsts.
|
|
218 |
].
|
|
219 |
o classRef:classRef.
|
|
220 |
size > 8000 ifTrue:[self halt].
|
|
221 |
o byteSize:size.
|
|
222 |
o bits:bits.
|
|
223 |
addrToObjectMapping at:baseAddr put:o.
|
1416
|
224 |
|
1417
|
225 |
1 to:nInsts do:[:idx |
|
|
226 |
o at:idx put:(self fetchUnboxedIntegerAt:addr).
|
|
227 |
"/ o at:idx put:(self fetchObjectAt:(self fetchUnboxedIntegerAt:addr)).
|
|
228 |
addr := addr + ptrSize.
|
|
229 |
]
|
|
230 |
].
|
|
231 |
o memory:self.
|
|
232 |
^ o
|
1416
|
233 |
!
|
|
234 |
|
|
235 |
fetchPointerAt:addr
|
|
236 |
^ self fetchUnboxedIntegerAt:addr
|
|
237 |
!
|
|
238 |
|
|
239 |
fetchUnboxedIntegerAt:addr
|
1417
|
240 |
|ptr imgAddr|
|
|
241 |
|
|
242 |
(addr bitAnd:3) ~~ 0 ifTrue:[self halt].
|
|
243 |
|
|
244 |
imgAddr := self imageAddressOf:addr.
|
|
245 |
stream position:imgAddr.
|
|
246 |
ptr := stream nextUnsignedLongMSB:msb.
|
|
247 |
^ ptr
|
|
248 |
!
|
|
249 |
|
|
250 |
imageAddressOf:addr
|
1416
|
251 |
spaceInfos do:[:eachSpace |
|
1417
|
252 |
|byte imgAddr|
|
1416
|
253 |
|
|
254 |
addr >= eachSpace start ifTrue:[
|
|
255 |
addr <= eachSpace end ifTrue:[
|
|
256 |
imgAddr := eachSpace imageBase + (addr - eachSpace start).
|
1417
|
257 |
^ imgAddr
|
1416
|
258 |
]
|
|
259 |
].
|
|
260 |
].
|
1417
|
261 |
self halt:'image address error'.
|
1416
|
262 |
! !
|
|
263 |
|
|
264 |
!SnapShotImageMemory methodsFor:'private'!
|
|
265 |
|
|
266 |
allClassesDo:aBlock
|
|
267 |
self allGlobalKeysDo:[:eachKey |
|
|
268 |
|val|
|
|
269 |
|
|
270 |
val := self at:eachKey.
|
|
271 |
val isBehavior ifTrue:[
|
|
272 |
aBlock value:val
|
1417
|
273 |
] ifFalse:[
|
|
274 |
self halt.
|
|
275 |
].
|
1416
|
276 |
].
|
|
277 |
!
|
|
278 |
|
|
279 |
allGlobalKeysDo:aBlock
|
1417
|
280 |
globalEntries isNil ifTrue:[
|
1416
|
281 |
self readHeader.
|
|
282 |
self readGlobals.
|
|
283 |
].
|
|
284 |
!
|
|
285 |
|
1417
|
286 |
fetchStringFor:aStringRef
|
|
287 |
|nBytes|
|
|
288 |
|
|
289 |
(aStringRef isImageBytes) ifFalse:[self halt].
|
|
290 |
|
|
291 |
nBytes := aStringRef byteSize - (intSize * 3).
|
|
292 |
^ ((ByteArray new:nBytes-1) replaceFrom:1 to:nBytes-1 with:aStringRef startingAt:1) asString.
|
|
293 |
!
|
|
294 |
|
1416
|
295 |
for:aFilename
|
|
296 |
stream := aFilename asFilename readStream binary.
|
|
297 |
addrToObjectMapping := IdentityDictionary new.
|
1417
|
298 |
|
|
299 |
addrToObjectMapping at:(ObjectMemory addressOf:false) put:false.
|
|
300 |
addrToObjectMapping at:(ObjectMemory addressOf:true) put:true.
|
|
301 |
!
|
|
302 |
|
|
303 |
printStringOfClass:aClassRef
|
|
304 |
|nameSlot|
|
|
305 |
|
|
306 |
(aClassRef isImageBehavior) ifFalse:[self halt].
|
|
307 |
((aClassRef byteSize // intSize) - 3) < Class instSize ifTrue:[self halt.].
|
|
308 |
|
|
309 |
nameSlot := aClassRef at:7.
|
|
310 |
nameSlot isInteger ifTrue:[
|
|
311 |
nameSlot := self fetchObjectAt:nameSlot
|
|
312 |
].
|
|
313 |
nameSlot isImageSymbol ifFalse:[self halt].
|
|
314 |
^ 'Class: ' , (self printStringOfSymbol:nameSlot)
|
|
315 |
!
|
|
316 |
|
|
317 |
printStringOfObject:anObjectRef
|
|
318 |
|s nBytes|
|
|
319 |
|
|
320 |
anObjectRef isNil ifTrue:[^ 'nil'].
|
|
321 |
(anObjectRef isInteger) ifTrue:[^ anObjectRef printString].
|
|
322 |
(anObjectRef == true ) ifTrue:[^ anObjectRef printString].
|
|
323 |
(anObjectRef == false) ifTrue:[^ anObjectRef printString].
|
|
324 |
|
|
325 |
(anObjectRef isImageSymbol) ifTrue:[^ self printStringOfSymbol:anObjectRef].
|
|
326 |
(anObjectRef isImageBehavior) ifTrue:[^ self printStringOfClass:anObjectRef].
|
|
327 |
|
|
328 |
^ 'obj(' , anObjectRef printString , ')'
|
|
329 |
!
|
|
330 |
|
|
331 |
printStringOfString:aStringRef
|
|
332 |
|nBytes|
|
|
333 |
|
|
334 |
(aStringRef isString) ifFalse:[self halt].
|
|
335 |
^ self fetchStringFor:aStringRef.
|
|
336 |
!
|
|
337 |
|
|
338 |
printStringOfSymbol:aSymbolRef
|
|
339 |
|nBytes|
|
|
340 |
|
|
341 |
(aSymbolRef isImageSymbol) ifFalse:[self halt].
|
|
342 |
^ self fetchStringFor:aSymbolRef.
|
|
343 |
"/ nBytes := aSymbolRef size - (intSize * 3).
|
|
344 |
"/ ^ ((ByteArray new:nBytes-1) replaceFrom:1 to:nBytes-1 with:aSymbolRef startingAt:1) asString.
|
1416
|
345 |
!
|
|
346 |
|
|
347 |
readGlobalEntries
|
1417
|
348 |
|refPointer theSymbolPtr theSymbolRef theValuePtr theValueRef pos|
|
1416
|
349 |
|
|
350 |
globalEntries := OrderedCollection new.
|
|
351 |
[
|
|
352 |
refPointer := stream nextUnsignedLongMSB:msb.
|
1417
|
353 |
theSymbolPtr := stream nextUnsignedLongMSB:msb.
|
|
354 |
theValuePtr := stream nextUnsignedLongMSB:msb.
|
|
355 |
theSymbolPtr ~~ 0
|
1416
|
356 |
] whileTrue:[
|
1417
|
357 |
globalEntries add:(theSymbolPtr -> theValuePtr).
|
1416
|
358 |
].
|
1417
|
359 |
globalEntries := globalEntries asArray.
|
|
360 |
|
|
361 |
"/ globalEntries inspect.
|
|
362 |
pos := stream position.
|
|
363 |
globalEntries do:[:item |
|
|
364 |
theSymbolPtr := item key.
|
|
365 |
theValuePtr := item value.
|
|
366 |
theSymbolRef := self fetchObjectAt:theSymbolPtr.
|
|
367 |
|
|
368 |
"/ Transcript show:(self printStringOfSymbol:theSymbolRef).
|
|
369 |
"/ Transcript show:'->'.
|
|
370 |
|
|
371 |
theValueRef := self fetchObjectAt:theValuePtr.
|
|
372 |
"/ Transcript show:(self printStringOfObject:theValueRef).
|
|
373 |
"/ Transcript cr.
|
|
374 |
|
|
375 |
item key:theSymbolRef.
|
|
376 |
item value:theValueRef.
|
|
377 |
].
|
|
378 |
stream position:pos.
|
1416
|
379 |
!
|
|
380 |
|
|
381 |
readHeader
|
|
382 |
"
|
|
383 |
(self for:'stmeas.img') readHeader
|
|
384 |
"
|
|
385 |
|
|
386 |
|order magic version timeStamp snapID last_util_addr hiText_addr flags
|
|
387 |
lowData hiData charSlots charTableSlots fixMemStart fixMemEnd
|
|
388 |
symMemStart symMemEnd vmDataAddr sharedMethodCode sharedBlockCode
|
|
389 |
nContexts contextSpace nRegistered symbolsSeqNr nSpaces
|
1417
|
390 |
classNameSize spaceSize|
|
1416
|
391 |
|
|
392 |
stream next:256. "/ skip execCmd
|
|
393 |
|
|
394 |
msb := false.
|
|
395 |
order := stream nextUnsignedLongMSB:msb.
|
|
396 |
order = 16r076543210 ifTrue:[
|
|
397 |
] ifFalse:[
|
|
398 |
order = 16r01234567 ifTrue:[
|
|
399 |
msb := true.
|
|
400 |
] ifFalse:[
|
|
401 |
self error:'unhandled byteorder'
|
|
402 |
].
|
|
403 |
].
|
|
404 |
magic := (stream next:8) asString.
|
|
405 |
magic ~= 'ST/X-IMG' ifTrue:[
|
|
406 |
self error:'not an st/x image'
|
|
407 |
].
|
|
408 |
version := stream nextUnsignedLongMSB:msb.
|
|
409 |
timeStamp := stream nextUnsignedLongMSB:msb.
|
|
410 |
ptrSize := stream nextByte.
|
|
411 |
ptrSize ~~ 4 ifTrue:[
|
|
412 |
self error:'unhandled ptr format'
|
|
413 |
].
|
|
414 |
stream next:7. "/ filler
|
|
415 |
intSize := stream nextUnsignedLongMSB:msb.
|
|
416 |
intSize == 9 ifTrue:[
|
|
417 |
intSize := 4.
|
|
418 |
intTag := 1.
|
|
419 |
] ifFalse:[
|
|
420 |
self error:'unhandled int format'
|
|
421 |
].
|
|
422 |
|
|
423 |
snapID := stream nextUnsignedLongMSB:msb.
|
|
424 |
last_util_addr := stream next:intSize.
|
|
425 |
hiText_addr := stream next:intSize.
|
|
426 |
flags := stream next:intSize.
|
|
427 |
stream next:8. "/ info, debug & filler
|
|
428 |
|
|
429 |
lowData := stream nextUnsignedLongMSB:msb.
|
|
430 |
hiData := stream nextUnsignedLongMSB:msb.
|
|
431 |
|
|
432 |
charSlots := stream nextUnsignedLongMSB:msb.
|
|
433 |
charTableSlots := stream nextUnsignedLongMSB:msb.
|
|
434 |
|
|
435 |
version >= 8 ifTrue:[
|
|
436 |
fixMemStart := stream nextUnsignedLongMSB:msb.
|
|
437 |
fixMemEnd := stream nextUnsignedLongMSB:msb.
|
|
438 |
symMemStart := stream nextUnsignedLongMSB:msb.
|
|
439 |
symMemEnd := stream nextUnsignedLongMSB:msb.
|
|
440 |
vmDataAddr := stream nextUnsignedLongMSB:msb.
|
|
441 |
].
|
|
442 |
stream next:(128 * intSize). "/ skip sharedMethodCode ptrs
|
|
443 |
stream next:(128 * intSize). "/ skip sharedBlockCode ptrs
|
|
444 |
|
|
445 |
nContexts := stream nextUnsignedLongMSB:msb.
|
|
446 |
contextSpace := stream nextUnsignedLongMSB:msb.
|
|
447 |
nRegistered := stream nextUnsignedLongMSB:msb.
|
|
448 |
|
|
449 |
version >= 8 ifTrue:[
|
|
450 |
version >= 9 ifTrue:[
|
|
451 |
symbolsSeqNr := stream nextUnsignedLongMSB:msb.
|
|
452 |
stream next:(intSize * 31).
|
|
453 |
] ifFalse:[
|
|
454 |
stream next:(intSize * 32).
|
|
455 |
]
|
|
456 |
].
|
|
457 |
|
|
458 |
nSpaces := stream nextUnsignedLongMSB:msb.
|
|
459 |
spaceInfos := (1 to:nSpaces) collect:[:idx | SpaceInfo new].
|
|
460 |
|
|
461 |
1 to:nSpaces do:[:i |
|
|
462 |
(spaceInfos at:i) flags:(stream nextUnsignedLongMSB:msb).
|
|
463 |
].
|
|
464 |
nSpaces+1 to:32 do:[:i | stream nextUnsignedLongMSB:msb].
|
|
465 |
|
|
466 |
1 to:nSpaces do:[:i |
|
|
467 |
(spaceInfos at:i) start:(stream nextUnsignedLongMSB:msb).
|
|
468 |
].
|
|
469 |
nSpaces+1 to:32 do:[:i | stream nextUnsignedLongMSB:msb].
|
|
470 |
|
|
471 |
1 to:nSpaces do:[:i |
|
|
472 |
(spaceInfos at:i) size:(stream nextUnsignedLongMSB:msb).
|
|
473 |
].
|
|
474 |
nSpaces+1 to:32 do:[:i | stream nextUnsignedLongMSB:msb].
|
|
475 |
|
|
476 |
version >= 8 ifTrue:[
|
1417
|
477 |
stream position:(stream class zeroPosition).
|
|
478 |
stream skip:4096.
|
1416
|
479 |
].
|
|
480 |
|
|
481 |
1 to:nSpaces do:[:i |
|
|
482 |
(spaceInfos at:i) end:((spaceInfos at:i) start + (spaceInfos at:i) size - 1).
|
|
483 |
].
|
|
484 |
1 to:nSpaces do:[:i |
|
|
485 |
(spaceInfos at:i) imageBase:(stream position).
|
1417
|
486 |
spaceSize := (spaceInfos at:i) size.
|
|
487 |
stream skip:spaceSize.
|
1416
|
488 |
].
|
|
489 |
|
|
490 |
"/ registration
|
|
491 |
|
|
492 |
self readRegistrationEntries.
|
1417
|
493 |
Transcript showCR:'reading symbols...'.
|
1416
|
494 |
self readSymbolEntries.
|
1417
|
495 |
self readUGlobalEntries.
|
|
496 |
Transcript showCR:'reading globals...'.
|
1416
|
497 |
self readGlobalEntries.
|
|
498 |
|
|
499 |
|
|
500 |
"/struct basicImageHeader {
|
|
501 |
"/ char h_execCmd[256];
|
|
502 |
"/
|
|
503 |
"/ int h_orderWord;
|
|
504 |
"/ char h_magic[8];
|
|
505 |
"/ int h_version;
|
|
506 |
"/ int h_timeStamp;
|
|
507 |
"/ char h_ptrSize;
|
|
508 |
"/ char h_filler1[7];
|
|
509 |
"/ int h_intSize;
|
|
510 |
"/ int h_snapID;
|
|
511 |
"/ INT h_last_util_addr;
|
|
512 |
"/ INT h_hiText_addr;
|
|
513 |
"/ INT h_flags;
|
|
514 |
"/ char h_infoPrinting;
|
|
515 |
"/ char h_debugPrinting;
|
|
516 |
"/ char h_filler2[6];
|
|
517 |
"/
|
|
518 |
"/ /*
|
|
519 |
"/ * these are to verify compatibility of the image with
|
|
520 |
"/ * myself ...
|
|
521 |
"/ * this is now obsolete.
|
|
522 |
"/ */
|
|
523 |
"/ INT h_lowData, h_hiData;
|
|
524 |
"/
|
|
525 |
"/ /*
|
|
526 |
"/ * base address of character- and characterTable slots
|
|
527 |
"/ */
|
|
528 |
"/ INT h_charSlots;
|
|
529 |
"/ INT h_charTableSlots;
|
|
530 |
"/
|
|
531 |
"/#if HEADER_VERSION >= 8
|
|
532 |
"/ /*
|
|
533 |
"/ * the fixBase (VMDATA address)
|
|
534 |
"/ */
|
|
535 |
"/ INT h_fixMemStart;
|
|
536 |
"/ INT h_fixMemEnd;
|
|
537 |
"/ INT h_symMemStart;
|
|
538 |
"/ INT h_symMemEnd;
|
|
539 |
"/
|
|
540 |
"/ INT h_vmDataAddr;
|
|
541 |
"/#endif
|
|
542 |
"/
|
|
543 |
"/ INT h_sharedMethodCode[128];
|
|
544 |
"/ INT h_sharedBlockCode[128];
|
|
545 |
"/
|
|
546 |
"/ /*
|
|
547 |
"/ * space needed to restore contexts
|
|
548 |
"/ */
|
|
549 |
"/ INT h_nContexts;
|
|
550 |
"/ INT h_contextSpace;
|
|
551 |
"/
|
|
552 |
"/ /*
|
|
553 |
"/ * number of class registration info records
|
|
554 |
"/ */
|
|
555 |
"/ INT h_nRegistered;
|
|
556 |
"/
|
|
557 |
"/#if HEADER_VERSION >= 8
|
|
558 |
"/ /*
|
|
559 |
"/ * reserved slots, for future versions
|
|
560 |
"/ * (can add additional info, without affecting position of following stuff)
|
|
561 |
"/ * If you add slots, you MUST DECREMENT the fillcount.
|
|
562 |
"/ */
|
|
563 |
"/# if HEADER_VERSION >= 9
|
|
564 |
"/ INT h_symbolsSeqNr;
|
|
565 |
"/ INT h_reserved[31];
|
|
566 |
"/# else
|
|
567 |
"/ INT h_reserved[32];
|
|
568 |
"/# endif
|
|
569 |
"/#endif
|
|
570 |
"/
|
|
571 |
"/ /*
|
|
572 |
"/ * number of spaces, base and size of each
|
|
573 |
"/ */
|
|
574 |
"/ INT h_nSpaces;
|
|
575 |
"/ INT h_spaceFlags[MAXSPACES];
|
|
576 |
"/ INT h_spaceBase[MAXSPACES];
|
|
577 |
"/ INT h_spaceSize[MAXSPACES];
|
|
578 |
"/
|
|
579 |
"/ /*
|
|
580 |
"/ * here come nSpaces object spaces
|
|
581 |
"/ */
|
|
582 |
"/
|
|
583 |
"/ /*
|
|
584 |
"/ * here comes registration info
|
|
585 |
"/ */
|
|
586 |
"/
|
|
587 |
"/ /*
|
|
588 |
"/ * here come nSymbols symbolEntries
|
|
589 |
"/ * followed by a zero/zero entry
|
|
590 |
"/ */
|
|
591 |
"/
|
|
592 |
"/ /*
|
|
593 |
"/ * here come nGlobal globalEntries
|
|
594 |
"/ * followed by a zero/zero entry
|
|
595 |
"/ */
|
|
596 |
"/
|
|
597 |
"/ /*
|
|
598 |
"/ * here come nUnnamedGlobal globalEntries
|
|
599 |
"/ * followed by a zero/zero entry
|
|
600 |
"/ */
|
|
601 |
"/
|
|
602 |
"/ /*
|
|
603 |
"/ * here come stack contexts
|
|
604 |
"/ */
|
|
605 |
"/};
|
|
606 |
!
|
|
607 |
|
|
608 |
readRegistrationEntries
|
|
609 |
|classNameSize|
|
|
610 |
|
|
611 |
[
|
|
612 |
classNameSize := stream nextUnsignedLongMSB:msb.
|
|
613 |
classNameSize ~~ 0
|
|
614 |
] whileTrue:[
|
|
615 |
|className flags moduleTimestamp signature nMethods nBlocks oldLitRefs nLitRefs
|
|
616 |
oldConstTable nConsts|
|
|
617 |
|
|
618 |
className := (stream next:classNameSize) asString.
|
|
619 |
stream next. "/ 0-byte
|
|
620 |
flags := stream nextUnsignedLongMSB:msb.
|
|
621 |
moduleTimestamp := stream nextUnsignedLongMSB:msb.
|
|
622 |
signature := stream nextUnsignedLongMSB:msb.
|
|
623 |
nMethods := stream nextUnsignedLongMSB:msb.
|
|
624 |
nMethods timesRepeat:[ stream nextUnsignedLongMSB:msb ].
|
|
625 |
nBlocks := stream nextUnsignedLongMSB:msb.
|
|
626 |
nBlocks timesRepeat:[ stream nextUnsignedLongMSB:msb ].
|
|
627 |
oldLitRefs := stream nextUnsignedLongMSB:msb.
|
|
628 |
nLitRefs := stream nextUnsignedLongMSB:msb.
|
|
629 |
nLitRefs timesRepeat:[ stream nextUnsignedLongMSB:msb ].
|
|
630 |
stream nextUnsignedLongMSB:msb. "/ 0-litRef
|
|
631 |
oldConstTable := stream nextUnsignedLongMSB:msb.
|
|
632 |
nConsts := stream nextUnsignedLongMSB:msb.
|
|
633 |
nConsts timesRepeat:[ stream nextUnsignedLongMSB:msb ].
|
|
634 |
|
|
635 |
Transcript showCR:className.
|
|
636 |
].
|
|
637 |
!
|
|
638 |
|
|
639 |
readSymbolEntries
|
1417
|
640 |
|refPointer theSymbolPtr theSymbolRef pos|
|
1416
|
641 |
|
|
642 |
symbolEntries := OrderedCollection new.
|
|
643 |
|
|
644 |
[
|
|
645 |
refPointer := stream nextUnsignedLongMSB:msb.
|
1417
|
646 |
theSymbolPtr := stream nextUnsignedLongMSB:msb.
|
|
647 |
theSymbolPtr ~~ 0
|
1416
|
648 |
] whileTrue:[
|
1417
|
649 |
symbolEntries add:theSymbolPtr.
|
1416
|
650 |
].
|
1417
|
651 |
symbolEntries := symbolEntries asArray.
|
|
652 |
|
|
653 |
pos := stream position.
|
|
654 |
symbolEntries := symbolEntries collect:[:theSymbolPtr |
|
|
655 |
theSymbolRef := self fetchObjectAt:theSymbolPtr.
|
|
656 |
theSymbolRef isImageSymbol ifFalse:[
|
|
657 |
self halt
|
|
658 |
].
|
|
659 |
].
|
|
660 |
stream position:pos
|
1416
|
661 |
!
|
|
662 |
|
|
663 |
readUGlobalEntries
|
|
664 |
|refPointer theValue|
|
|
665 |
|
|
666 |
[
|
|
667 |
refPointer := stream nextUnsignedLongMSB:msb.
|
|
668 |
theValue := stream nextUnsignedLongMSB:msb.
|
|
669 |
refPointer ~~ 0
|
|
670 |
] whileTrue
|
|
671 |
! !
|
|
672 |
|
1417
|
673 |
!SnapShotImageMemory::ImageHeader methodsFor:'accessing'!
|
|
674 |
|
|
675 |
bits
|
|
676 |
"return the value of the instance variable 'bits' (automatically generated)"
|
|
677 |
|
|
678 |
^ bits!
|
|
679 |
|
|
680 |
bits:something
|
|
681 |
"set the value of the instance variable 'bits' (automatically generated)"
|
|
682 |
|
|
683 |
bits := something.!
|
|
684 |
|
|
685 |
byteSize
|
|
686 |
"return the value of the instance variable 'size' (automatically generated)"
|
|
687 |
|
|
688 |
^ byteSize
|
|
689 |
!
|
|
690 |
|
|
691 |
byteSize:something
|
|
692 |
"set the value of the instance variable 'size' (automatically generated)"
|
|
693 |
|
|
694 |
something > 8000 ifTrue:[self halt].
|
|
695 |
byteSize := something.
|
|
696 |
!
|
|
697 |
|
|
698 |
classRef
|
|
699 |
"return the value of the instance variable 'classRef' (automatically generated)"
|
|
700 |
|
|
701 |
^ classRef!
|
|
702 |
|
|
703 |
classRef:something
|
|
704 |
"set the value of the instance variable 'classRef' (automatically generated)"
|
|
705 |
|
|
706 |
classRef := something.!
|
|
707 |
|
|
708 |
memory
|
|
709 |
"return the value of the instance variable 'memory' (automatically generated)"
|
|
710 |
|
|
711 |
^ memory!
|
|
712 |
|
|
713 |
memory:something
|
|
714 |
"set the value of the instance variable 'memory' (automatically generated)"
|
|
715 |
|
|
716 |
memory := something.! !
|
|
717 |
|
|
718 |
!SnapShotImageMemory::ImageHeader methodsFor:'queries'!
|
|
719 |
|
|
720 |
category
|
|
721 |
|categoryPtr categoryRef category|
|
|
722 |
|
|
723 |
self isMethodOrLazyMethod ifTrue:[
|
|
724 |
categoryPtr := self at:6.
|
|
725 |
categoryRef := memory fetchObjectAt:categoryPtr.
|
|
726 |
category := memory fetchStringFor:categoryRef.
|
|
727 |
^ category
|
|
728 |
].
|
|
729 |
self halt.
|
|
730 |
!
|
|
731 |
|
|
732 |
isImageBehavior
|
|
733 |
|flags|
|
|
734 |
|
|
735 |
flags := classRef flags.
|
|
736 |
^ flags bitTest:Behavior flagBehavior
|
|
737 |
!
|
|
738 |
|
|
739 |
isImageBytes
|
|
740 |
|flags|
|
|
741 |
|
|
742 |
flags := classRef flags bitAnd:Behavior maskIndexType.
|
|
743 |
^ flags = Behavior flagBytes
|
|
744 |
!
|
|
745 |
|
|
746 |
isImageMethod
|
|
747 |
|flags|
|
|
748 |
|
|
749 |
flags := classRef flags.
|
|
750 |
^ flags bitTest:Behavior flagMethod
|
|
751 |
!
|
|
752 |
|
|
753 |
isImageSymbol
|
|
754 |
|flags|
|
|
755 |
|
|
756 |
flags := classRef flags.
|
|
757 |
^ flags bitTest:Behavior flagSymbol
|
|
758 |
!
|
|
759 |
|
|
760 |
isMeta
|
|
761 |
^ false
|
|
762 |
!
|
|
763 |
|
|
764 |
isMethod
|
|
765 |
^ classRef name = 'Method'
|
|
766 |
!
|
|
767 |
|
|
768 |
isMethodDictionary
|
|
769 |
^ classRef name = 'MethodDictionary'
|
|
770 |
!
|
|
771 |
|
|
772 |
isMethodOrLazyMethod
|
|
773 |
classRef name = 'LazyMethod' ifTrue:[^ true].
|
|
774 |
^ classRef name = 'Method'
|
|
775 |
!
|
|
776 |
|
|
777 |
isString
|
|
778 |
^ classRef name = 'String'
|
|
779 |
! !
|
|
780 |
|
1416
|
781 |
!SnapShotImageMemory::SpaceInfo methodsFor:'accessing'!
|
|
782 |
|
|
783 |
end
|
|
784 |
"return the value of the instance variable 'end' (automatically generated)"
|
|
785 |
|
|
786 |
^ end!
|
|
787 |
|
|
788 |
end:something
|
|
789 |
"set the value of the instance variable 'end' (automatically generated)"
|
|
790 |
|
|
791 |
end := something.!
|
|
792 |
|
|
793 |
flags
|
|
794 |
"return the value of the instance variable 'flags' (automatically generated)"
|
|
795 |
|
|
796 |
^ flags!
|
|
797 |
|
|
798 |
flags:something
|
|
799 |
"set the value of the instance variable 'flags' (automatically generated)"
|
|
800 |
|
|
801 |
flags := something.!
|
|
802 |
|
|
803 |
imageBase
|
|
804 |
"return the value of the instance variable 'imageBase' (automatically generated)"
|
|
805 |
|
|
806 |
^ imageBase!
|
|
807 |
|
|
808 |
imageBase:something
|
|
809 |
"set the value of the instance variable 'imageBase' (automatically generated)"
|
|
810 |
|
|
811 |
imageBase := something.!
|
|
812 |
|
|
813 |
size
|
|
814 |
"return the value of the instance variable 'size' (automatically generated)"
|
|
815 |
|
|
816 |
^ size!
|
|
817 |
|
|
818 |
size:something
|
|
819 |
"set the value of the instance variable 'size' (automatically generated)"
|
|
820 |
|
|
821 |
size := something.!
|
|
822 |
|
|
823 |
start
|
|
824 |
"return the value of the instance variable 'start' (automatically generated)"
|
|
825 |
|
|
826 |
^ start!
|
|
827 |
|
|
828 |
start:something
|
|
829 |
"set the value of the instance variable 'start' (automatically generated)"
|
|
830 |
|
|
831 |
start := something.! !
|
|
832 |
|
1417
|
833 |
!SnapShotImageMemory::ImageObject methodsFor:'object protocol'!
|
1416
|
834 |
|
1417
|
835 |
at:aSelector ifAbsent:exceptionValue
|
|
836 |
|symPtr symRef mthdPtr mthdRef s|
|
1416
|
837 |
|
1417
|
838 |
self isMethodDictionary ifTrue:[
|
|
839 |
1 to:self size by:2 do:[:idx |
|
|
840 |
symPtr := self at:idx.
|
|
841 |
symRef := memory fetchObjectAt:symPtr.
|
|
842 |
symRef isImageSymbol ifFalse:[self halt].
|
|
843 |
s := memory fetchStringFor:symRef.
|
|
844 |
mthdPtr := self at:idx + 1.
|
|
845 |
mthdRef := memory fetchObjectAt:mthdPtr.
|
|
846 |
^ mthdRef.
|
|
847 |
].
|
|
848 |
].
|
|
849 |
^ exceptionValue value
|
|
850 |
!
|
1416
|
851 |
|
1417
|
852 |
do:aBlock
|
|
853 |
|mthdPtr mthdRef|
|
1416
|
854 |
|
1417
|
855 |
self isMethodDictionary ifTrue:[
|
|
856 |
2 to:self size by:2 do:[:idx |
|
|
857 |
mthdPtr := self at:idx.
|
|
858 |
mthdRef := memory fetchObjectAt:mthdPtr.
|
|
859 |
aBlock value:mthdRef.
|
|
860 |
].
|
|
861 |
].
|
|
862 |
!
|
1416
|
863 |
|
1417
|
864 |
isWrapped
|
|
865 |
^ false
|
1416
|
866 |
!
|
|
867 |
|
1417
|
868 |
keysAndValuesDo:aBlock
|
|
869 |
|symPtr symRef mthdPtr mthdRef s|
|
|
870 |
|
|
871 |
self isMethodDictionary ifTrue:[
|
|
872 |
1 to:self size by:2 do:[:idx |
|
|
873 |
symPtr := self at:idx.
|
|
874 |
symRef := memory fetchObjectAt:symPtr.
|
|
875 |
symRef isImageSymbol ifFalse:[self halt].
|
|
876 |
s := memory fetchStringFor:symRef.
|
|
877 |
mthdPtr := self at:idx + 1.
|
|
878 |
mthdRef := memory fetchObjectAt:mthdPtr.
|
|
879 |
aBlock value:s asSymbol value:mthdRef.
|
|
880 |
].
|
|
881 |
].
|
|
882 |
!
|
|
883 |
|
|
884 |
printStringForBrowserWithSelector:selector
|
|
885 |
^ selector
|
|
886 |
!
|
|
887 |
|
|
888 |
resources
|
|
889 |
^ nil
|
|
890 |
!
|
|
891 |
|
|
892 |
source
|
|
893 |
|sourcePosition source aStream junk|
|
|
894 |
|
|
895 |
self isMethod ifTrue:[
|
|
896 |
sourcePosition := self at:(Method instVarOffsetOf:'sourcePosition').
|
|
897 |
source := self at:(Method instVarOffsetOf:'source').
|
|
898 |
source := memory fetchObjectAt:source.
|
|
899 |
source isString ifFalse:[
|
|
900 |
self halt.
|
|
901 |
].
|
|
902 |
source := memory printStringOfString:source.
|
|
903 |
sourcePosition isNil ifTrue:[
|
|
904 |
self halt.
|
|
905 |
^ source
|
|
906 |
].
|
|
907 |
sourcePosition := memory fetchObjectAt:sourcePosition.
|
|
908 |
|
|
909 |
aStream := self sourceStream.
|
|
910 |
aStream notNil ifTrue:[
|
|
911 |
Stream positionErrorSignal handle:[:ex |
|
|
912 |
^ nil
|
|
913 |
] do:[
|
|
914 |
aStream position:sourcePosition abs.
|
|
915 |
].
|
|
916 |
junk := aStream nextChunk.
|
|
917 |
|
|
918 |
aStream close.
|
|
919 |
^ junk
|
|
920 |
].
|
|
921 |
].
|
1416
|
922 |
self halt.
|
|
923 |
!
|
|
924 |
|
1417
|
925 |
sourceStream
|
|
926 |
|sourcePosition source aStream fileName junk who
|
|
927 |
myClass mgr className sep dir mod package|
|
|
928 |
|
|
929 |
self isMethod ifTrue:[
|
|
930 |
sourcePosition := self at:(Method instVarOffsetOf:'sourcePosition').
|
|
931 |
source := self at:(Method instVarOffsetOf:'source').
|
|
932 |
source := memory fetchObjectAt:source.
|
|
933 |
source isString ifTrue:[
|
|
934 |
source := memory printStringOfString:source.
|
|
935 |
].
|
|
936 |
sourcePosition notNil ifTrue:[
|
|
937 |
sourcePosition := memory fetchObjectAt:sourcePosition.
|
|
938 |
].
|
|
939 |
|
|
940 |
source isNil ifTrue:[^ nil].
|
|
941 |
sourcePosition isNil ifTrue:[^ source readStream].
|
|
942 |
|
|
943 |
sourcePosition < 0 ifTrue:[
|
|
944 |
aStream := source asFilename readStream.
|
|
945 |
aStream notNil ifTrue:[
|
|
946 |
^ aStream
|
|
947 |
].
|
|
948 |
|
|
949 |
fileName := Smalltalk getSourceFileName:source.
|
|
950 |
fileName notNil ifTrue:[
|
|
951 |
aStream := fileName asFilename readStream.
|
|
952 |
aStream notNil ifTrue:[
|
|
953 |
^ aStream
|
|
954 |
].
|
|
955 |
].
|
|
956 |
].
|
|
957 |
|
|
958 |
"/
|
|
959 |
"/ if there is no SourceManager, look in local standard places first
|
|
960 |
"/
|
|
961 |
(mgr := Smalltalk at:#SourceCodeManager) isNil ifTrue:[
|
|
962 |
aStream := self localSourceStream.
|
|
963 |
aStream notNil ifTrue:[
|
|
964 |
^ aStream
|
|
965 |
].
|
|
966 |
].
|
|
967 |
|
|
968 |
"/
|
|
969 |
"/ nope - ask my class for the source (this also invokes the SCMgr)
|
|
970 |
"/
|
|
971 |
myClass := self mclass.
|
1416
|
972 |
|
1417
|
973 |
package := self package.
|
|
974 |
(package notNil and:[package ~= myClass package]) ifTrue:[
|
|
975 |
mgr notNil ifTrue:[
|
|
976 |
"/ try to get the source using my package information ...
|
|
977 |
sep := package indexOfAny:'/\:'.
|
|
978 |
sep ~~ 0 ifTrue:[
|
|
979 |
mod := package copyTo:sep - 1.
|
|
980 |
dir := package copyFrom:sep + 1.
|
|
981 |
aStream := mgr streamForClass:nil fileName:source revision:nil directory:dir module:mod cache:true.
|
|
982 |
aStream notNil ifTrue:[
|
|
983 |
^ aStream
|
|
984 |
].
|
|
985 |
].
|
|
986 |
].
|
|
987 |
].
|
|
988 |
|
|
989 |
aStream := myClass sourceStreamFor:source.
|
|
990 |
aStream notNil ifTrue:[
|
|
991 |
^ aStream
|
|
992 |
].
|
|
993 |
|
|
994 |
"/
|
|
995 |
"/ nope - look in standard places
|
|
996 |
"/ (if there is a source-code manager - otherwise, we already did that)
|
|
997 |
"/
|
|
998 |
mgr notNil ifTrue:[
|
|
999 |
aStream := self localSourceStream.
|
|
1000 |
aStream notNil ifTrue:[
|
|
1001 |
^ aStream
|
|
1002 |
].
|
|
1003 |
].
|
|
1004 |
|
|
1005 |
"/
|
|
1006 |
"/ final chance: try current directory
|
|
1007 |
"/
|
|
1008 |
aStream isNil ifTrue:[
|
|
1009 |
aStream := source asFilename readStream.
|
|
1010 |
aStream notNil ifTrue:[
|
|
1011 |
^ aStream
|
|
1012 |
].
|
|
1013 |
].
|
|
1014 |
|
|
1015 |
(who isNil and:[source notNil]) ifTrue:[
|
|
1016 |
"/
|
|
1017 |
"/ mhmh - seems to be a method which used to be in some
|
|
1018 |
"/ class, but has been overwritten by another or removed.
|
|
1019 |
"/ (i.e. it has no containing class anyMore)
|
|
1020 |
"/ try to guess the class from the sourceFileName.
|
|
1021 |
"/ and retry.
|
|
1022 |
"/
|
|
1023 |
className := Smalltalk classNameForFile:source.
|
|
1024 |
className knownAsSymbol ifTrue:[
|
|
1025 |
myClass := Smalltalk at:className asSymbol ifAbsent:nil.
|
|
1026 |
myClass notNil ifTrue:[
|
|
1027 |
aStream := myClass sourceStreamFor:source.
|
|
1028 |
aStream notNil ifTrue:[
|
|
1029 |
^ aStream
|
|
1030 |
].
|
|
1031 |
]
|
|
1032 |
]
|
|
1033 |
].
|
|
1034 |
|
|
1035 |
^ nil
|
|
1036 |
].
|
1416
|
1037 |
self halt.
|
|
1038 |
! !
|
|
1039 |
|
|
1040 |
!SnapShotImageMemory::ImageClassObject methodsFor:'accessing - slots'!
|
|
1041 |
|
1417
|
1042 |
category
|
|
1043 |
|categoryRef category|
|
|
1044 |
|
|
1045 |
categoryRef := self categorySlot.
|
|
1046 |
categoryRef isInteger ifTrue:[
|
|
1047 |
categoryRef := memory fetchObjectAt:categoryRef.
|
|
1048 |
].
|
|
1049 |
categoryRef notNil ifTrue:[
|
|
1050 |
category := memory fetchStringFor:categoryRef.
|
|
1051 |
].
|
|
1052 |
^ category
|
|
1053 |
!
|
|
1054 |
|
1416
|
1055 |
categorySlot
|
|
1056 |
^ self at:8
|
|
1057 |
!
|
|
1058 |
|
|
1059 |
classFilenameSlot
|
|
1060 |
^ self at:12
|
|
1061 |
!
|
|
1062 |
|
1417
|
1063 |
classVarNames
|
|
1064 |
|classVarNamesRef classVarNames s|
|
|
1065 |
|
|
1066 |
classVarNamesRef := self classVarsSlot.
|
|
1067 |
classVarNamesRef isInteger ifTrue:[
|
|
1068 |
classVarNamesRef := memory fetchObjectAt:classVarNamesRef.
|
|
1069 |
].
|
|
1070 |
classVarNamesRef notNil ifTrue:[
|
|
1071 |
classVarNamesRef isImageBytes ifTrue:[
|
|
1072 |
"/ a string
|
|
1073 |
classVarNames := memory fetchStringFor:classVarNamesRef.
|
|
1074 |
classVarNames := classVarNames asCollectionOfWords.
|
|
1075 |
] ifFalse:[
|
|
1076 |
classVarNames := Array new:(classVarNamesRef size).
|
|
1077 |
1 to:classVarNames size do:[:idx |
|
|
1078 |
s := classVarNamesRef at:idx.
|
|
1079 |
s := memory fetchObjectAt:s.
|
|
1080 |
s isImageBytes ifFalse:[self halt].
|
|
1081 |
s := memory fetchStringFor:s.
|
|
1082 |
classVarNames at:idx put:s.
|
|
1083 |
].
|
|
1084 |
].
|
|
1085 |
].
|
|
1086 |
^ classVarNames
|
|
1087 |
!
|
|
1088 |
|
1416
|
1089 |
classVarsSlot
|
|
1090 |
^ self at:9
|
|
1091 |
!
|
|
1092 |
|
1417
|
1093 |
comment
|
|
1094 |
|commentRef comment|
|
|
1095 |
|
|
1096 |
commentRef := self commentSlot.
|
|
1097 |
commentRef isInteger ifTrue:[
|
|
1098 |
commentRef := memory fetchObjectAt:commentRef.
|
|
1099 |
].
|
|
1100 |
commentRef notNil ifTrue:[
|
|
1101 |
comment := memory fetchStringFor:commentRef.
|
|
1102 |
].
|
|
1103 |
^ comment
|
|
1104 |
!
|
|
1105 |
|
1416
|
1106 |
commentSlot
|
|
1107 |
^ self at:10
|
|
1108 |
!
|
|
1109 |
|
1417
|
1110 |
flags
|
1416
|
1111 |
|flags|
|
|
1112 |
|
|
1113 |
flags := self flagsSlot.
|
|
1114 |
|
|
1115 |
(SnapShotImageMemory isSmallIntegerOOP:flags) ifFalse:[
|
|
1116 |
self halt
|
|
1117 |
].
|
|
1118 |
^ flags bitShift:-1.
|
|
1119 |
!
|
|
1120 |
|
1417
|
1121 |
flagsSlot
|
|
1122 |
^ self at:2
|
|
1123 |
!
|
|
1124 |
|
1416
|
1125 |
instSizeSlot
|
|
1126 |
^ self at:5
|
|
1127 |
!
|
|
1128 |
|
1417
|
1129 |
instVarNames
|
|
1130 |
|instVarNamesRef instVarNames s|
|
|
1131 |
|
|
1132 |
instVarNamesRef := self instVarsSlot.
|
|
1133 |
instVarNamesRef isInteger ifTrue:[
|
|
1134 |
instVarNamesRef := memory fetchObjectAt:instVarNamesRef.
|
|
1135 |
].
|
|
1136 |
instVarNamesRef notNil ifTrue:[
|
|
1137 |
instVarNamesRef isImageBytes ifTrue:[
|
|
1138 |
"/ a string
|
|
1139 |
instVarNames := memory fetchStringFor:instVarNamesRef.
|
|
1140 |
instVarNames := instVarNames asCollectionOfWords.
|
|
1141 |
] ifFalse:[
|
|
1142 |
instVarNames := Array new:(instVarNamesRef size).
|
|
1143 |
1 to:instVarNames size do:[:idx |
|
|
1144 |
s := instVarNamesRef at:idx.
|
|
1145 |
s := memory fetchObjectAt:s.
|
|
1146 |
s isImageBytes ifFalse:[self halt].
|
|
1147 |
s := memory fetchStringFor:s.
|
|
1148 |
instVarNames at:idx put:s.
|
|
1149 |
].
|
|
1150 |
].
|
|
1151 |
].
|
|
1152 |
^ instVarNames
|
|
1153 |
!
|
|
1154 |
|
1416
|
1155 |
instVarsSlot
|
|
1156 |
^ self at:6
|
|
1157 |
!
|
|
1158 |
|
1417
|
1159 |
methodDictionary
|
|
1160 |
|methodDictionaryRef methodDictionary|
|
|
1161 |
|
|
1162 |
methodDictionaryRef := self methodDictionarySlot.
|
|
1163 |
methodDictionaryRef isInteger ifTrue:[
|
|
1164 |
methodDictionaryRef == 0 ifTrue:[^ nil].
|
|
1165 |
methodDictionary := memory fetchObjectAt:methodDictionaryRef.
|
|
1166 |
].
|
|
1167 |
^ methodDictionary
|
|
1168 |
!
|
|
1169 |
|
1416
|
1170 |
methodDictionarySlot
|
|
1171 |
^ self at:3
|
|
1172 |
!
|
|
1173 |
|
1417
|
1174 |
name
|
|
1175 |
|nameRef name|
|
|
1176 |
|
|
1177 |
nameRef := self nameSlot.
|
|
1178 |
nameRef isInteger ifTrue:[
|
|
1179 |
nameRef := memory fetchObjectAt:nameRef.
|
|
1180 |
].
|
|
1181 |
nameRef notNil ifTrue:[
|
|
1182 |
name := memory fetchStringFor:nameRef.
|
|
1183 |
].
|
|
1184 |
nameRef notNil ifTrue:[
|
|
1185 |
name := name asSymbol.
|
|
1186 |
].
|
|
1187 |
^ name
|
|
1188 |
!
|
|
1189 |
|
1416
|
1190 |
nameSlot
|
|
1191 |
^ self at:7
|
|
1192 |
!
|
|
1193 |
|
|
1194 |
packageSlot
|
|
1195 |
^ self at:13
|
|
1196 |
!
|
|
1197 |
|
|
1198 |
revisionSlot
|
|
1199 |
^ self at:14
|
|
1200 |
!
|
|
1201 |
|
1417
|
1202 |
superclass
|
|
1203 |
|superClassRef superClass|
|
|
1204 |
|
|
1205 |
superClassRef := self superclassSlot.
|
|
1206 |
superClassRef isInteger ifTrue:[
|
|
1207 |
superClass := memory fetchObjectAt:superClassRef.
|
|
1208 |
].
|
|
1209 |
^ superClass
|
|
1210 |
!
|
|
1211 |
|
|
1212 |
superclassSlot
|
1416
|
1213 |
^ self at:1
|
|
1214 |
! !
|
|
1215 |
|
1417
|
1216 |
!SnapShotImageMemory::ImageClassObject methodsFor:'class protocol'!
|
|
1217 |
|
|
1218 |
basicFileOutDefinitionOn:aStream withNameSpace:forceNameSpace withPackage:showPackage
|
|
1219 |
"append an expression on aStream, which defines myself."
|
|
1220 |
|
|
1221 |
|s owner ns nsName fullName superName cls topOwner
|
|
1222 |
syntaxHilighting superclass category|
|
|
1223 |
|
|
1224 |
superclass := self superclass.
|
|
1225 |
category := self category.
|
|
1226 |
|
|
1227 |
UserPreferences isNil ifTrue:[
|
|
1228 |
syntaxHilighting := false
|
|
1229 |
] ifFalse:[
|
|
1230 |
syntaxHilighting := UserPreferences current syntaxColoring.
|
|
1231 |
].
|
|
1232 |
|
|
1233 |
owner := self owningClass.
|
|
1234 |
|
|
1235 |
owner isNil ifTrue:[
|
|
1236 |
ns := self nameSpace.
|
|
1237 |
] ifFalse:[
|
|
1238 |
ns := self topOwningClass nameSpace
|
|
1239 |
].
|
|
1240 |
fullName := Class fileOutNameSpaceQuerySignal query == true.
|
|
1241 |
|
|
1242 |
(showPackage and:[owner isNil]) ifTrue:[
|
|
1243 |
aStream nextPutAll:'"{ Package: '''.
|
|
1244 |
aStream nextPutAll:self package asString.
|
|
1245 |
aStream nextPutAll:''' }"'; cr; cr.
|
|
1246 |
].
|
|
1247 |
|
|
1248 |
((owner isNil and:[fullName not])
|
|
1249 |
or:[owner notNil and:[forceNameSpace and:[fullName not]]]) ifTrue:[
|
|
1250 |
(ns notNil and:[ns ~~ Smalltalk]) ifTrue:[
|
|
1251 |
nsName := ns name.
|
|
1252 |
(nsName includes:$:) ifTrue:[
|
|
1253 |
nsName := '''' , nsName , ''''
|
|
1254 |
].
|
|
1255 |
"/ aStream nextPutLine:'"{ NameSpace: ' , nsName , ' }"'; cr.
|
|
1256 |
aStream nextPutAll:'"{ NameSpace: '.
|
|
1257 |
syntaxHilighting ifTrue:[aStream bold].
|
|
1258 |
aStream nextPutAll:nsName.
|
|
1259 |
syntaxHilighting ifTrue:[aStream normal].
|
|
1260 |
aStream nextPutAll:' }"'; cr; cr.
|
|
1261 |
]
|
|
1262 |
].
|
|
1263 |
|
|
1264 |
"take care of nil-superclass"
|
|
1265 |
superclass isNil ifTrue:[
|
|
1266 |
s := 'nil'
|
|
1267 |
] ifFalse:[
|
|
1268 |
fullName ifTrue:[
|
|
1269 |
superclass == owner ifTrue:[
|
|
1270 |
s := superclass nameWithoutNameSpacePrefix
|
|
1271 |
] ifFalse:[
|
|
1272 |
s := superclass name
|
|
1273 |
]
|
|
1274 |
] ifFalse:[
|
|
1275 |
(ns == superclass nameSpace
|
|
1276 |
and:[superclass owningClass isNil]) ifTrue:[
|
|
1277 |
"/ superclass is in the same namespace;
|
|
1278 |
"/ still prepend namespace prefix, to avoid
|
|
1279 |
"/ confusing stc, which needs that information ...
|
|
1280 |
s := superclass nameWithoutPrefix
|
|
1281 |
] ifFalse:[
|
|
1282 |
"/ a very special (rare) situation:
|
|
1283 |
"/ my superclass resides in another nameSpace,
|
|
1284 |
"/ but there is something else named like this
|
|
1285 |
"/ to be found in my nameSpace (or a private class)
|
|
1286 |
|
|
1287 |
superName := superclass nameWithoutNameSpacePrefix asSymbol.
|
|
1288 |
cls := self privateClassesAt:superName.
|
|
1289 |
cls isNil ifTrue:[
|
|
1290 |
(topOwner := self topOwningClass) isNil ifTrue:[
|
|
1291 |
ns := self nameSpace.
|
|
1292 |
ns notNil ifTrue:[
|
|
1293 |
cls := ns privateClassesAt:superName
|
|
1294 |
] ifFalse:[
|
|
1295 |
"/ self error:'unexpected nil namespace'
|
|
1296 |
]
|
|
1297 |
] ifFalse:[
|
|
1298 |
cls := topOwner nameSpace at:superName.
|
|
1299 |
]
|
|
1300 |
].
|
|
1301 |
(cls notNil and:[cls ~~ superclass]) ifTrue:[
|
|
1302 |
s := superclass nameSpace name , '::' , superName
|
|
1303 |
] ifFalse:[
|
|
1304 |
"/ no class with that name found in my namespace ...
|
|
1305 |
"/ if the superclass resides in Smalltalk,
|
|
1306 |
"/ suppress prefix; otherwise, use full prefix.
|
|
1307 |
(superclass nameSpace notNil
|
|
1308 |
and:[superclass nameSpace ~~ Smalltalk]) ifTrue:[
|
|
1309 |
(owner notNil
|
|
1310 |
and:[owner nameSpace == superclass owningClass nameSpace])
|
|
1311 |
ifTrue:[
|
|
1312 |
s := superclass nameWithoutNameSpacePrefix
|
|
1313 |
] ifFalse:[
|
|
1314 |
s := superclass name
|
|
1315 |
]
|
|
1316 |
] ifFalse:[
|
|
1317 |
s := superName
|
|
1318 |
]
|
|
1319 |
]
|
|
1320 |
]
|
|
1321 |
]
|
|
1322 |
].
|
|
1323 |
|
|
1324 |
syntaxHilighting ifTrue:[aStream bold].
|
|
1325 |
aStream nextPutAll:s. "/ superclass
|
|
1326 |
syntaxHilighting ifTrue:[aStream normal].
|
|
1327 |
aStream space.
|
|
1328 |
self basicFileOutInstvarTypeKeywordOn:aStream.
|
|
1329 |
|
|
1330 |
(fullName and:[owner isNil]) ifTrue:[
|
|
1331 |
aStream nextPutAll:'#'''.
|
|
1332 |
syntaxHilighting ifTrue:[aStream bold].
|
|
1333 |
aStream nextPutAll:(self name).
|
|
1334 |
syntaxHilighting ifTrue:[aStream normal].
|
|
1335 |
aStream nextPutAll:''''.
|
|
1336 |
] ifFalse:[
|
|
1337 |
aStream nextPut:$#.
|
|
1338 |
syntaxHilighting ifTrue:[aStream bold].
|
|
1339 |
aStream nextPutAll:(self nameWithoutPrefix).
|
|
1340 |
syntaxHilighting ifTrue:[aStream normal].
|
|
1341 |
].
|
|
1342 |
|
|
1343 |
aStream crtab.
|
|
1344 |
aStream nextPutAll:'instanceVariableNames:'''.
|
|
1345 |
syntaxHilighting ifTrue:[aStream bold].
|
|
1346 |
self printInstVarNamesOn:aStream indent:16.
|
|
1347 |
syntaxHilighting ifTrue:[aStream normal].
|
|
1348 |
aStream nextPutAll:''''.
|
|
1349 |
|
|
1350 |
aStream crtab.
|
|
1351 |
aStream nextPutAll:'classVariableNames:'''.
|
|
1352 |
syntaxHilighting ifTrue:[aStream bold].
|
|
1353 |
self printClassVarNamesOn:aStream indent:16.
|
|
1354 |
syntaxHilighting ifTrue:[aStream normal].
|
|
1355 |
aStream nextPutAll:''''.
|
|
1356 |
|
|
1357 |
aStream crtab.
|
|
1358 |
aStream nextPutAll:'poolDictionaries:'''''.
|
|
1359 |
|
|
1360 |
aStream crtab.
|
|
1361 |
owner isNil ifTrue:[
|
|
1362 |
"/ a public class
|
|
1363 |
aStream nextPutAll:'category:'.
|
|
1364 |
category isNil ifTrue:[
|
|
1365 |
s := ''''''
|
|
1366 |
] ifFalse:[
|
|
1367 |
s := category asString storeString
|
|
1368 |
].
|
|
1369 |
aStream nextPutAll:s.
|
|
1370 |
] ifFalse:[
|
|
1371 |
"/ a private class
|
|
1372 |
aStream nextPutAll:'privateIn:'.
|
|
1373 |
syntaxHilighting ifTrue:[aStream bold].
|
|
1374 |
"/ fullName ifTrue:[
|
|
1375 |
"/ s := owner name.
|
|
1376 |
"/ ] ifFalse:[
|
|
1377 |
"/ s := owner nameWithoutNameSpacePrefix.
|
|
1378 |
"/ ].
|
|
1379 |
s := owner nameWithoutNameSpacePrefix.
|
|
1380 |
aStream nextPutAll:s.
|
|
1381 |
syntaxHilighting ifTrue:[aStream normal].
|
|
1382 |
].
|
|
1383 |
aStream cr
|
|
1384 |
|
|
1385 |
"Created: / 4.1.1997 / 20:38:16 / cg"
|
|
1386 |
"Modified: / 8.8.1997 / 10:59:50 / cg"
|
|
1387 |
"Modified: / 18.3.1999 / 18:15:46 / stefan"
|
|
1388 |
!
|
|
1389 |
|
|
1390 |
basicFileOutInstvarTypeKeywordOn:aStream
|
|
1391 |
"a helper for fileOutDefinition"
|
|
1392 |
|
|
1393 |
|isVar s superclass|
|
|
1394 |
|
|
1395 |
superclass := self superclass.
|
|
1396 |
superclass isNil ifTrue:[
|
|
1397 |
isVar := self isVariable
|
|
1398 |
] ifFalse:[
|
|
1399 |
"I cant remember what this is for ?"
|
|
1400 |
isVar := (self isVariable and:[superclass isVariable not])
|
|
1401 |
].
|
|
1402 |
|
|
1403 |
aStream nextPutAll:(self firstDefinitionSelectorPart).
|
|
1404 |
|
|
1405 |
"Created: 11.10.1996 / 18:57:29 / cg"
|
|
1406 |
!
|
|
1407 |
|
|
1408 |
compiledMethodAt:aSelector
|
|
1409 |
|
|
1410 |
^ self compiledMethodAt:aSelector ifAbsent:nil
|
|
1411 |
!
|
|
1412 |
|
|
1413 |
compiledMethodAt:aSelector ifAbsent:exceptionValue
|
|
1414 |
|dict|
|
|
1415 |
|
|
1416 |
dict := self methodDictionary.
|
|
1417 |
dict isNil ifTrue:[
|
|
1418 |
('Behavior [warning]: nil methodDictionary in ' , self name printString) errorPrintCR.
|
|
1419 |
^ exceptionValue value
|
|
1420 |
].
|
|
1421 |
|
|
1422 |
^ dict at:aSelector ifAbsent:exceptionValue
|
|
1423 |
!
|
|
1424 |
|
|
1425 |
evaluatorClass
|
|
1426 |
^ Object evaluatorClass
|
|
1427 |
!
|
|
1428 |
|
|
1429 |
firstDefinitionSelectorPart
|
|
1430 |
"return the first part of the selector with which I was (can be) defined in my superclass"
|
|
1431 |
|
|
1432 |
self isVariable ifFalse:[
|
|
1433 |
^ #'subclass:'
|
|
1434 |
].
|
|
1435 |
self isBytes ifTrue:[
|
|
1436 |
^ #'variableByteSubclass:'
|
|
1437 |
].
|
|
1438 |
self isLongs ifTrue:[
|
|
1439 |
^ #'variableLongSubclass:'
|
|
1440 |
].
|
|
1441 |
self isFloats ifTrue:[
|
|
1442 |
^ #'variableFloatSubclass:'
|
|
1443 |
].
|
|
1444 |
self isDoubles ifTrue:[
|
|
1445 |
^ #'variableDoubleSubclass:'
|
|
1446 |
].
|
|
1447 |
self isWords ifTrue:[
|
|
1448 |
^ #'variableWordSubclass:'
|
|
1449 |
].
|
|
1450 |
self isSignedWords ifTrue:[
|
|
1451 |
^ #'variableSignedWordSubclass:'
|
|
1452 |
].
|
|
1453 |
self isSignedLongs ifTrue:[
|
|
1454 |
^ #'variableSignedLongSubclass:'
|
|
1455 |
].
|
|
1456 |
self isSignedLongLongs ifTrue:[
|
|
1457 |
^ #'variableSignedLongLongSubclass:'
|
|
1458 |
].
|
|
1459 |
self isLongLongs ifTrue:[
|
|
1460 |
^ #'variableLongLongSubclass:'
|
|
1461 |
].
|
|
1462 |
^ #'variableSubclass:'
|
|
1463 |
!
|
|
1464 |
|
|
1465 |
nameWithoutNameSpacePrefix
|
|
1466 |
|nm owner|
|
|
1467 |
|
|
1468 |
nm := self nameWithoutPrefix.
|
|
1469 |
(owner := self owningClass) isNil ifTrue:[
|
|
1470 |
^ nm
|
|
1471 |
].
|
|
1472 |
|
|
1473 |
^ (owner nameWithoutNameSpacePrefix , '::' , nm)
|
|
1474 |
!
|
|
1475 |
|
|
1476 |
nameWithoutPrefix
|
|
1477 |
|nm idx|
|
|
1478 |
|
|
1479 |
nm := self name.
|
|
1480 |
idx := nm lastIndexOf:$:.
|
|
1481 |
idx == 0 ifTrue:[
|
|
1482 |
^ nm
|
|
1483 |
].
|
|
1484 |
^ nm copyFrom:idx+1.
|
|
1485 |
!
|
|
1486 |
|
|
1487 |
printClassVarNamesOn:aStream indent:indent
|
|
1488 |
"print the class variable names indented and breaking at line end"
|
|
1489 |
|
|
1490 |
self printNameArray:(self classVarNames) on:aStream indent:indent
|
|
1491 |
!
|
|
1492 |
|
|
1493 |
printHierarchyAnswerIndentOn:aStream
|
|
1494 |
"print my class hierarchy on aStream - return indent
|
|
1495 |
recursively calls itself to print superclass and use returned indent
|
|
1496 |
for my description - used in the browser"
|
|
1497 |
|
|
1498 |
|indent nm superclass|
|
|
1499 |
|
|
1500 |
superclass := self superclass.
|
|
1501 |
indent := 0.
|
|
1502 |
(superclass notNil) ifTrue:[
|
|
1503 |
indent := (superclass printHierarchyAnswerIndentOn:aStream) + 2
|
|
1504 |
].
|
|
1505 |
aStream spaces:indent.
|
|
1506 |
nm := self printNameInHierarchy.
|
|
1507 |
aStream nextPutAll:nm; nextPutAll:' ('.
|
|
1508 |
self printInstVarNamesOn:aStream indent:(indent + nm size + 2).
|
|
1509 |
aStream nextPutLine:')'.
|
|
1510 |
^ indent
|
|
1511 |
!
|
|
1512 |
|
|
1513 |
printHierarchyOn:aStream
|
|
1514 |
self printHierarchyAnswerIndentOn:aStream
|
|
1515 |
!
|
|
1516 |
|
|
1517 |
printInstVarNamesOn:aStream indent:indent
|
|
1518 |
"print the instance variable names indented and breaking at line end"
|
|
1519 |
|
|
1520 |
self printNameArray:(self instVarNames) on:aStream indent:indent
|
|
1521 |
|
|
1522 |
"Created: 22.3.1997 / 14:12:00 / cg"
|
|
1523 |
!
|
|
1524 |
|
|
1525 |
printNameArray:anArray on:aStream indent:indent
|
|
1526 |
"print an array of strings separated by spaces; when the stream
|
|
1527 |
defines a lineLength, break when this limit is reached; indent
|
|
1528 |
every line; used to printOut instance variable names"
|
|
1529 |
|
|
1530 |
|thisName nextName arraySize lenMax pos mustBreak line spaces|
|
|
1531 |
|
|
1532 |
arraySize := anArray size.
|
|
1533 |
arraySize ~~ 0 ifTrue:[
|
|
1534 |
pos := indent.
|
|
1535 |
lenMax := aStream lineLength.
|
|
1536 |
thisName := anArray at:1.
|
|
1537 |
line := ''.
|
|
1538 |
1 to:arraySize do:[:index |
|
|
1539 |
line := line , thisName.
|
|
1540 |
pos := pos + thisName size.
|
|
1541 |
(index == arraySize) ifFalse:[
|
|
1542 |
nextName := anArray at:(index + 1).
|
|
1543 |
mustBreak := false.
|
|
1544 |
(lenMax > 0) ifTrue:[
|
|
1545 |
((pos + nextName size) > lenMax) ifTrue:[
|
|
1546 |
mustBreak := true
|
|
1547 |
]
|
|
1548 |
].
|
|
1549 |
mustBreak ifTrue:[
|
|
1550 |
aStream nextPutLine:line withTabs.
|
|
1551 |
spaces isNil ifTrue:[
|
|
1552 |
spaces := String new:indent
|
|
1553 |
].
|
|
1554 |
line := spaces.
|
|
1555 |
pos := indent
|
|
1556 |
] ifFalse:[
|
|
1557 |
line := line , ' '.
|
|
1558 |
pos := pos + 1
|
|
1559 |
].
|
|
1560 |
thisName := nextName
|
|
1561 |
]
|
|
1562 |
].
|
|
1563 |
aStream nextPutAll:line withTabs
|
|
1564 |
]
|
|
1565 |
|
|
1566 |
"Modified: 9.11.1996 / 00:12:06 / cg"
|
|
1567 |
"Created: 22.3.1997 / 14:12:12 / cg"
|
|
1568 |
!
|
|
1569 |
|
|
1570 |
printNameInHierarchy
|
|
1571 |
^ self name
|
|
1572 |
!
|
|
1573 |
|
|
1574 |
privateClassesAt:aClassNameStringOrSymbol
|
|
1575 |
|nmSym|
|
|
1576 |
|
|
1577 |
nmSym := (self name , '::' , aClassNameStringOrSymbol) asSymbolIfInterned.
|
|
1578 |
nmSym isNil ifTrue:[
|
|
1579 |
"/ no such symbol - there cannot be a corresponding private class
|
|
1580 |
^ nil
|
|
1581 |
].
|
|
1582 |
|
|
1583 |
^ memory at:nmSym.
|
|
1584 |
!
|
|
1585 |
|
|
1586 |
sourceCodeManager
|
|
1587 |
^ SourceCodeManager
|
|
1588 |
!
|
|
1589 |
|
|
1590 |
syntaxHighlighterClass
|
|
1591 |
^ Object syntaxHighlighterClass
|
|
1592 |
!
|
|
1593 |
|
|
1594 |
withAllSuperclassesDo:aBlock
|
|
1595 |
|sc|
|
|
1596 |
|
|
1597 |
aBlock value:self.
|
|
1598 |
sc := self superclass.
|
|
1599 |
sc notNil ifTrue:[
|
|
1600 |
sc withAllSuperclassesDo:aBlock.
|
|
1601 |
]
|
|
1602 |
! !
|
|
1603 |
|
|
1604 |
!SnapShotImageMemory::ImageClassObject methodsFor:'queries'!
|
|
1605 |
|
|
1606 |
categories
|
|
1607 |
|newList|
|
|
1608 |
|
|
1609 |
newList := Set new.
|
|
1610 |
self methodDictionary do:[:aMethod |
|
|
1611 |
|cat|
|
|
1612 |
|
|
1613 |
cat := aMethod category.
|
|
1614 |
cat isNil ifTrue:[
|
|
1615 |
cat := '* no category *'
|
|
1616 |
].
|
|
1617 |
newList add:cat
|
|
1618 |
].
|
|
1619 |
^ newList
|
|
1620 |
!
|
|
1621 |
|
|
1622 |
isBytes
|
|
1623 |
^ (self flags bitAnd:Behavior maskIndexType) == Behavior flagBytes.
|
|
1624 |
!
|
|
1625 |
|
|
1626 |
isDoubles
|
|
1627 |
^ (self flags bitAnd:Behavior maskIndexType) == Behavior flagDoubles.
|
|
1628 |
!
|
|
1629 |
|
|
1630 |
isFloats
|
|
1631 |
^ (self flags bitAnd:Behavior maskIndexType) == Behavior flagFloats.
|
|
1632 |
!
|
|
1633 |
|
|
1634 |
isLoaded
|
|
1635 |
^ self superclass name ~= 'Autoload'
|
|
1636 |
!
|
|
1637 |
|
|
1638 |
isLongLongs
|
|
1639 |
^ (self flags bitAnd:Behavior maskIndexType) == Behavior flagLongLongs.
|
|
1640 |
!
|
|
1641 |
|
|
1642 |
isLongs
|
|
1643 |
^ (self flags bitAnd:Behavior maskIndexType) == Behavior flagLongs.
|
|
1644 |
!
|
|
1645 |
|
|
1646 |
isMeta
|
|
1647 |
^ self size == (Metaclass instSize * memory ptrSize).
|
|
1648 |
"/ ^ classRef classRef name = 'Metaclass'
|
|
1649 |
!
|
|
1650 |
|
|
1651 |
isPrivate
|
|
1652 |
^ classRef isPrivateMeta
|
|
1653 |
!
|
|
1654 |
|
|
1655 |
isPrivateMeta
|
|
1656 |
^ classRef name = 'PrivateMetaclass'
|
|
1657 |
!
|
|
1658 |
|
|
1659 |
isSignedLongLongs
|
|
1660 |
^ (self flags bitAnd:Behavior maskIndexType) == Behavior flagSignedLongLongs.
|
|
1661 |
!
|
|
1662 |
|
|
1663 |
isSignedLongs
|
|
1664 |
^ (self flags bitAnd:Behavior maskIndexType) == Behavior flagSignedLongs.
|
|
1665 |
!
|
|
1666 |
|
|
1667 |
isSignedWords
|
|
1668 |
^ (self flags bitAnd:Behavior maskIndexType) == Behavior flagSignedWords.
|
|
1669 |
!
|
|
1670 |
|
|
1671 |
isVariable
|
|
1672 |
^ (self flags bitAnd:Behavior maskIndexType) ~= 0.
|
|
1673 |
!
|
|
1674 |
|
|
1675 |
isWords
|
|
1676 |
^ (self flags bitAnd:Behavior maskIndexType) == Behavior flagWords.
|
|
1677 |
!
|
|
1678 |
|
|
1679 |
nameSpace
|
|
1680 |
|env name idx nsName|
|
|
1681 |
|
|
1682 |
"/ (env := self environment) notNil ifTrue:[^ env].
|
|
1683 |
name := self name.
|
|
1684 |
idx := name lastIndexOf:$:.
|
|
1685 |
idx ~~ 0 ifTrue:[
|
|
1686 |
(name at:idx-1) == $: ifTrue:[
|
|
1687 |
nsName := name copyTo:(idx - 2).
|
|
1688 |
env := Smalltalk at:nsName asSymbol.
|
|
1689 |
]
|
|
1690 |
].
|
|
1691 |
^ env
|
|
1692 |
!
|
|
1693 |
|
|
1694 |
owningClass
|
|
1695 |
|ownerPtr owner|
|
|
1696 |
|
|
1697 |
classRef isPrivateMeta ifFalse:[^ nil].
|
|
1698 |
ownerPtr := classRef at:8.
|
|
1699 |
owner := memory fetchClassObjectAt:ownerPtr.
|
|
1700 |
^ owner
|
|
1701 |
!
|
|
1702 |
|
|
1703 |
supportsMethodCategories
|
|
1704 |
^ true
|
|
1705 |
!
|
|
1706 |
|
|
1707 |
topOwningClass
|
|
1708 |
|owner|
|
|
1709 |
|
|
1710 |
classRef isPrivateMeta ifTrue:[
|
|
1711 |
owner := self owningClass.
|
|
1712 |
[owner classRef isPrivateMeta] whileTrue:[
|
|
1713 |
owner := owner owningClass
|
|
1714 |
].
|
|
1715 |
^ owner
|
|
1716 |
] ifFalse:[
|
|
1717 |
^ nil
|
|
1718 |
].
|
|
1719 |
^ self halt.
|
|
1720 |
!
|
|
1721 |
|
|
1722 |
wasAutoloaded
|
|
1723 |
^ false
|
|
1724 |
! !
|
|
1725 |
|
|
1726 |
!SnapShotImageMemory::ImageByteObject methodsFor:'queries'!
|
|
1727 |
|
|
1728 |
size
|
|
1729 |
^ byteSize
|
|
1730 |
! !
|
|
1731 |
|
1416
|
1732 |
!SnapShotImageMemory class methodsFor:'documentation'!
|
|
1733 |
|
|
1734 |
version
|
|
1735 |
^ '$Header$'
|
|
1736 |
! !
|