[Issue 3463] Integrate Precise Heap Scanning Into the GC

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jul 20 19:33:16 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=3463



--- Comment #27 from Leandro Lucarella <llucax at gmail.com> 2010-07-20 19:33:05 PDT ---
I'm trying to test this patch but I'm having some problems compiling Tango (I'm
using 0.99.9, not trunk). With the patched DMD, I get this error:

dmd: mtype.c:5671: void PointerMap::pointer(size_t): Assertion `offset <
m_size' failed.

Compiling the file: tango/util/digest/MerkleDamgard.d

Here is some output from a GDB session:

(gdb) bt
#0  0x00002b421bf3c175 in *__GI_raise (sig=<value optimized out>) at
../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1  0x00002b421bf3ef80 in *__GI_abort () at abort.c:92
#2  0x00002b421bf352b1 in *__GI___assert_fail (assertion=0x58be62 "offset <
m_size", file=<value optimized out>, line=5671, function=0x58bea0 "void
PointerMap::pointer(size_t)") at assert.c:81
#3  0x00000000004f5d55 in PointerMap::pointer (this=0x7fff15974fc0, offset=20)
at mtype.c:5671
#4  0x00000000004eaf15 in TypeDArray::fillPointerMap (this=0x11735e0,
pm=0x7fff15974fc0, offset=12) at mtype.c:2241
#5  0x00000000004679d4 in VarDeclaration::fillPointerMap (this=0x1130700,
pm=0x7fff15974fc0, a_offset=0) at declaration.c:1379
#6  0x000000000040488b in AttribDeclaration::fillPointerMap (this=0x11307c0,
pm=0x7fff15974fc0, offset=0) at attrib.c:289
#7  0x0000000000542327 in ClassDeclaration::toObjFile (this=0x1130150,
multiobj=0) at toobj.c:484
#8  0x0000000000404689 in AttribDeclaration::toObjFile (this=0x113afd0,
multiobj=0) at attrib.c:240
#9  0x00000000004c0da1 in Module::genobjfile (this=0x112bfd0, multiobj=0) at
glue.c:267
#10 0x00000000004e1560 in main (argc=13, argv=0x111f930) at mars.c:1285


(gdb) list
5666     * Actually does nothing if the offset isn't aligned.
5667     */
5668
5669    void PointerMap::pointer(size_t offset)
5670    {
5671        assert(offset < m_size);
5672        //reject unaligned pointers
5673        if (offset % sizeof(size_t))
5674            return;
5675        size_t bitpos = offset / sizeof(size_t);
(gdb) print offset
$1 = 20
(gdb) print m_size
$2 = 20


(gdb) up
#4  0x00000000004eaf15 in TypeDArray::fillPointerMap (this=0x11735e0,
pm=0x7fff15974fc0, offset=12) at mtype.c:2241
2241        pm->pointer(offset + sizeof(size_t));
(gdb) list
2236    }
2237
2238    void TypeDArray::fillPointerMap(PointerMap *pm, size_t offset)
2239    {
2240        // like struct Array { size_t length; byte* data; }
2241        pm->pointer(offset + sizeof(size_t));
2242    }
2243
2244    /***************************** TypeAArray
*****************************/
2245
(gdb) print *pm
$3 = {
  m_bits = {
    <Object> = {
      _vptr.Object = 0x5939d0
    }, 
    members of Bits: 
    bitdim = 3, 
    allocdim = 1, 
    data = 0x11e4c70
  }, 
  m_size = 20
}
(gdb) print offset
$4 = 12


I don't know enough about DMD internals to debug this myself, so any help will
be very much appreciated.

I'd like to run my test suite to the GC with precise scanning to see how it
goes. I've noticed that false pointers can add a lot of variance in the time a
program can take in Linux, where the addresses returned by mmap() is
randomized, so there are times where the address range returned by mmap() is
much more prone to receive false pointers. See this for the full story:
http://www.llucax.com.ar/blog/blog/post/-7a56a111

Running dil to generate the full Tango documentation can take from 50 to 80
seconds depending on the address range returned by the OS (I suspect because of
false pointers; which I hope to prove trying this patch :)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list