Note: This website is archived. For up-to-date information about D projects and development, please visit

Ticket #20 (new enhancement)

Opened 10 years ago

64 bits architecture compatibility in the GC

Reported by: llucax Assigned to: somebody
Priority: major Milestone:
Component: component1 Version:
Keywords: gc, 64bits Cc:


I didn't know if tag this as a defect or enhancement. The problem is, there is a lot of code in the GC that assumes word size of 32 bits. Everything seems to work fine with this in 64 bits architectures (I don't have a 64 bits computer to test it myself, but I guess people are using this with GDC and LDC in 64 bits), but I'm pretty sure there are a few inefficiencies because of this. For example, in fullcollect(), when visiting cells with the scan bit, the scan bit set is addressed and iterated using an uint (bbase, b and btop variables), but when testing for the bits in a group, a size_t is used:

    uint *b;
    // ...
    size_t bitm;
    bitm = *b;
    if (!bitm) {
    *b = 0;

Here if size_t.sizeof is 8, and all 64 bits are cleared, in the next iteration half bitm is tested again because b is incremented in just 4 bytes.

There are other places where 32 bits is assumed (in GCBits for example).