8 DGS node flags

DGBaseNode has a member variable m_flags which records up to 32 bit flags:


class DGBaseNode
{
public:
    DGBaseNode(uint32 flags);
    ...

protected:
    void SetFlag(uint32 f) const
    {
        m_flags |= f;
    }
    void ClearFlag(uint32 f) const
    {
        m_flags &= ~f;
    }
    bool Enabled(uint32 f) const
    {
        return (m_flags & f) != 0;
    }

    mutable uint32 m_flags;
};

Static flags

The following flags don't change over time, and appear in the low 16 bits.

Name Value Description
DF_SYNC_DEP 0x00000001 Set for synchronous dep nodes (as distinct from either indep nodes or async nodes)
DF_ASYNC 0x00000002 Set for a dep node that represents an async node
DF_ASYNC_IO 0x00000004 Set for a dep node that represents an async node that performs pure I/O
DF_PROPAGATE_HARD_DIRTINESS 0x00000008 Set for $dep^ nodes (i.e. synchronous dep nodes that don't check whether their calculated value has changed). When these nodes become hard-dirty they synchronously mark their out-nodes as hard-dirty as well. This flag is not set for async nodes.

These 4 bits don't give 16 cases, there are only 5 cases which are meaningful:

MnemomicDF_SYNC_DEPDF_ASYNCDF_ASYNC_IODF_PROPAGATE_HARD_DIRTINESS
indepFFFF
depTFFF
dep^TFFT
asyncFTFF
asyncioFTTF

Dynamic flags

The following flags can change over time, and appear in the high 16 bits.

Name Value Description
DF_SOFT_DIRTY 0x00010000
DF_HARD_DIRTY 0x00020000
DF_CALCULATING 0x00040000 Set when a dependent node is being calculated in order to detect cycles
DF_CYCLE 0x00080000 Set for nodes whose value cannot be calculated because of a cycle. Note that the node may not itself be part of a cycle.
DF_IN_EVICTION_QUEUE 0x00100000 Set if and only if the node is in the eviction queue
DF_SCHEDULED_FOR_EVICTION 0x00200000
DF_ASYNC_RUNNING 0x00400000 Set for an async task, while the posted task is running
DF_CALLED_READ 0x00800000 Used by DGAsyncIndepNode and DGAsyncNodeOnInput to determine whether read() has been called for the first time