On Sat, Jan 31, 2009 at 11:15:02AM +0100, Damien Cassou wrote:
On Fri, Jan 30, 2009 at 6:29 PM, Andreas Raab andreas.raab@gmx.de wrote:
fprintf(stderr, "oldLimit=%p\ndelta=%d\nnewSize=%d\nnewDelta=%d\n");
oldLimit=0x80562b8 delta=-1077506096 newSize=0 newDelta=423027548 squeak: /tmp/squeak-svn/platforms/unix/vm/sqUnixMemory.c:175: uxGrowMemoryBy: Assertion `newDelta >= 0' failed.
Does it help?
Yes. I don't think newSize is supposed to be 0 here.
int newSize= min(valign(oldLimit - heap + delta), heapLimit); int newDelta= newSize - heapSize;
I'm not sure what is wrong, but apparently it's in the expression "min(valign(oldLimit - heap + delta), heapLimit)".
Could be a CSE bug. Considering that min(a,b) is usually defined as "a < b ? a : b" or so, a compiler might do something with the valign(...) expression. I would try to move the expression out of there and see if that helps.
Nobody noticed, but I did a very stupid mistake. Look at the call to fprintf that I copy/pasted in my previous mail. I forgot all the parameters :-). I don't how it is possible that gcc still compiled the code...
I moved valign out:
int align = valign(oldLimit - heap + delta); int newSize= min(align, heapLimit);
And printed the values:
if(newDelta < 0) fprintf(stderr, "oldLimit=%p\ndelta=%d\nnewSize=%d\nnewDelta=%d\nalign=%d\n",oldLimit,delta,newSize,newDelta,align);
And got:
oldLimit=0x791c8fe8 delta=0 newSize=23293952 newDelta=-4096 align=23293952 squeak: /tmp/squeak-svn/platforms/unix/vm/sqUnixMemory.c:175: uxGrowMemoryBy: Assertion `newDelta >= 0' failed. Aborted
Does that make sense to anyone?
Something is going wrong in the call to valign. I can't quite spot it, but note that valign(x) is {(x) & pageMask}, where pageMask is 0xfffff000. Your newDelta result is -4096, which also happens to be 0xfffff000.
Maybe as a next step you can break out the calculation further: int argToAlign = oldLimit - heap + delta; int align = valign(argToAlign); int newSize= min(align, heapLimit);
Also printing the values of heap and heapLimit might give a clue.
Just a hunch, but I would guess that if you changed valign() from a macro to a function that it would somehow decide to start working.
Dave