[squeak-dev] How does ImageSegmentLoader>>readObject work?

H. Hirzel hannes.hirzel at gmail.com
Wed May 23 11:15:41 UTC 2018


Hello

this is a follow up mail on loading a project file (*.pr) saved in
Squeak 3.10.2 [1] into Squeak 6.0a-#18000  [2]

The code breaks at

    ImageSegmentLoader>>readObject [3]

I'd like to find out which class causes this problem.


readObject
	| header oop nWords class format |
	header := self readUint32.
	(header bitAnd: HeaderTypeMask) caseOf: {
		[HeaderTypeSizeAndClass] ->
			[nWords := header >> 2. class := self readUint32. header := self readUint32].
		[HeaderTypeClass] ->


The header is a 32 bit integer denoting the class, I assume.
I'd like to know which class causes the problem.

How can I find out which class this 32 bit integer refers to?

Regards

Hannes


--------------------------------------------------------------------------------------------------------------------------------

[1] The project file has a workspace in it in addition to some
RectangleMorphs and SimpleButtonMorphs which were loaded succesfully
in another test.

http://forum.world.st/The-Trunk-Morphic-kfr-1435-mcz-tp5077266p5077476.html
The reference has a test project *.pr file attached.

[2]
http://lists.squeakfoundation.org/pipermail/squeak-dev/2018-May/198848.html

New method added

SmartRefStream  >> in the conversion protocol

methodPropertiespps0

       ^ AdditionalMethodState




[3] readObject
	| header oop nWords class format |
	header := self readUint32.
	(header bitAnd: HeaderTypeMask) caseOf: {
		[HeaderTypeSizeAndClass] ->
			[nWords := header >> 2. class := self readUint32. header := self readUint32].
		[HeaderTypeClass] ->
			[class := header - 1. header := self readUint32. nWords := header
>> 2 bitAnd: 63].
		[HeaderTypeShort] ->
			[nWords := header >> 2 bitAnd: 63. class := header >> 12 bitAnd: 31].
	} otherwise: [self error: 'unexpected free chunk'].
	nWords := nWords - 1.	"nWords includes 1 header word"
	oop := position.
	^[oopMap at: oop ifAbsentPut:
		[format := header >> 8 bitAnd: 15.
		"hash := header >> 17 bitAnd: 4095."
		self allocateObject: format class: class size: nWords]]
			ensure: [position := oop + (nWords * 4)]


More information about the Squeak-dev mailing list