[Vm-dev] I think I've found a bug in the 64-bit Squeak VM memory compactor

John M McIntosh johnmci at smalltalkconsulting.com
Tue Jun 15 18:41:36 UTC 2010


In reflecting on this this morning I think I"m going to rework the SQ_FAKE_MEMORY_OFFSET logic for the os-x code so that we start with an offset of 4096 so that the first oops can't have an address of zero so that we avoid the problematic code.  This also side-steps the problem of checking the code for usage of nil as nil versus nil as zero, plus I'm wondering on some CPUs the test for zero/non zero is quite different from a cost view point verus checking for a constant value of 0xFFFFFFFF.  

Also what is "Splash" ? 

You might also find that ESUG is a workable venue too since it's in Barcelona this year.  Last year the French hosts set a very high bar for the quality of the food & wine. 


On 2010-06-15, at 11:29 AM, ungar at mac.com wrote:

> John,
> 
> Thank you. Regarding your questions:
> 
>>> ifFalse: ["start a new free chunk"
>>> 							freeChunk := oop - hdrBytes.
>>> 							"chunk may start 4 or 8 bytes before oop"
>>> 							freeChunkSize := oopSize + (oop - freeChunk).
>>> 							"adjust size for possible extra header bytes"
>>> 							firstFree = nil ifTrue: [firstFree := freeChunk]]]
> 
>> 
> 
> 
> Oop starts at zero. hdrBytes is zero, so freeChunk is zero. freeChunkSize gets 4, I think. Then firstFree gets set to zero, too.
> 
> The sweep phase DOES complete. But later, when the compaction phase comes along, the sweep phase never updated the length of that free chunk at oop = 0, so the compaction phase reads a header word containing just "2", which specifies a free chunk of size zero, including the header itself! This causes the compactor, to spin, reading the same free chunk at oop = 0 over and over again.
> 
> I have worked around the issue by altering the snapshot-writing code in my VM to skip over any free chunks at the start of the heap. But this bug could bite others, so I'm very glad you are fixing it. I haven't looked to see if there are other "nil" tests in the Squeak VM GC code anywhere, but they could be problematic as well.
> 
> Take care,
> 
> - David
> 
> PS: I'm hoping to make it to Splash to talk about the VM at the Squeak BoF. Hope to see you and lots of others there!


> --

===========================================================================
John M. McIntosh <johnmci at smalltalkconsulting.com>   Twitter:  squeaker68882
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
===========================================================================




-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2445 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20100615/5180e310/smime.bin


More information about the Vm-dev mailing list