[MLton] share bug
Henry Cejtin
henry.cejtin@sbcglobal.net
Wed, 19 Apr 2006 12:34:36 -0500
One strange thing I meant to remark on before I put your patch in: the word
`maybeSharePointer' NEVER appears in the stderr output. This means, from my
reading of gc.c, that maybeSharePointer was never called with shouldHashCons
true. Sorry, I see now that your fix was only to that code. I don't get why
it was never called with the flag true, because certainly there are pointers
to non-mutable objects (strings) which should be shared.
Unrelated to that, and not understanding perfectly what the card being marked
for a location says, when you replace a reference to p with one for q, don't
you have to or in the marks on p into those for q.
Any way, here is the lines around the start of GC_share:
About to start doGC()
GC state
cardMap = 0x401ae000
oldGen = 0x600b2000
oldGenSize = 895,933,492
oldGen + oldGenSize = 0x9571fc34
nursery = 0x9a6f4e1c
frontier = 0x9f6c9e08
frontier - nursery = 83709932
limitPlusSlop - frontier = 504
canHandle = 1
signalsIsPending = 0
currentThread = 0x600b31dc
stackBottom = 0x690375cc
stackTop - stackBottom = 136
stackLimit - stackTop = 408
exnStack = 8
bytesNeeded = 512
reserved = 800
used = 136
Starting gc. Request 512 nursery bytes and 0 old gen bytes.
Minor GC.
Minor GC done. 441,124 bytes copied.
Finished gc.
time: 7,080 ms
old gen size: 896,374,616 bytes (84.3%)
About to leave doGC()
GC state
cardMap = 0x401ae000
oldGen = 0x600b2000
oldGenSize = 896,374,616
oldGen + oldGenSize = 0x9578b758
nursery = 0x9a72abac
frontier = 0x9a72abac
frontier - nursery = 0
limitPlusSlop - frontier = 83489876
canHandle = 1
signalsIsPending = 0
currentThread = 0x600b31dc
stackBottom = 0x690375cc
stackTop - stackBottom = 136
stackLimit - stackTop = 408
exnStack = 8
bytesNeeded = 512
reserved = 800
used = 136
Done reading
GC_share 0x600b3398
GC state
cardMap = 0x401ae000
oldGen = 0x600b2000
oldGenSize = 896,374,616
oldGen + oldGenSize = 0x9578b758
nursery = 0x9a72abac
frontier = 0x9e0b2c64
frontier - nursery = 60326072
limitPlusSlop - frontier = 23163804
canHandle = 0
signalsIsPending = 0
currentThread = 0x600b31dc
stackBottom = 0x690375cc
stackTop - stackBottom = 140
stackLimit - stackTop = 404
exnStack = 8
bytesNeeded = 512
reserved = 800
used = 136
using minor space
maxElementsSize = 10436234
elementsIsInHeap = TRUE
elementsSize = 8388608
0x08074018 = newTable ()
hashCons (0x600ba678)
0x600ba678 = hashCons (0x600ba678)
hashCons (0x600ba680)
0x600ba680 = hashCons (0x600ba680)
hashCons (0x68d8d808)
tableInsert (3941444285, 0x68d8d808, TRUE, 0x00000003, 0x68d8d814)
probe = 0x0038075b
slot = 0x0038075b
numProbes = 1
0x68d8d808 = hashCons (0x68d8d808)
and here are the lines around the end:
0x600ba594 = hashCons (0x600ba594)
hashCons (0x600b5268)
0x600b5268 = hashCons (0x600b5268)
hashCons (0x600b3398)
tableInsert (368121331, 0x600b3398, TRUE, 0x00000055, 0x600b367c)
probe = 0x01ff36dd
slot = 0x01ff36de
slot = 0x03fe6dbb
0x600b3398 = hashCons (0x600b3398)
GC state
cardMap = 0x401ae000
oldGen = 0x600b2000
oldGenSize = 896,374,616
oldGen + oldGenSize = 0x9578b758
nursery = 0x9a72abac
frontier = 0x9e0b2c64
frontier - nursery = 60326072
limitPlusSlop - frontier = 23163804
canHandle = 0
signalsIsPending = 0
currentThread = 0x600b31dc
stackBottom = 0x690375cc
stackTop - stackBottom = 140
stackLimit - stackTop = 404
exnStack = 8
bytesNeeded = 512
reserved = 800
used = 136
32,016,852 bytes hash consed (5.7%).
About to start doGC()
GC state
cardMap = 0x401ae000
oldGen = 0x600b2000
oldGenSize = 896,374,616
oldGen + oldGenSize = 0x9578b758
nursery = 0x9a72abac
frontier = 0x9e0b3bfc
frontier - nursery = 60330064
limitPlusSlop - frontier = 23159812
canHandle = 1
signalsIsPending = 0
currentThread = 0x600b31dc
stackBottom = 0x690375cc
stackTop - stackBottom = 160
stackLimit - stackTop = 384
exnStack = 8
bytesNeeded = 512
reserved = 800
used = 160
Starting gc. Request 0 nursery bytes and 4,000,012 old gen bytes.
Minor GC.
Minor GC done. 294,392 bytes copied.
Finished gc.
time: 6,690 ms
old gen size: 896,669,008 bytes (84.3%)
gc.c: assertIsInFromSpace p = 0x665aeab4 *p = 0x9ac95540);
Just before the call to share it computed the size of the object being
shared, and it was
561,950,212 bytes
Just after it computed the size and it was
529,933,360 bytes
just like before. The latter must have been done before the first minor GC
was needed.