Graph

Graph structure storing a Gyre (sub)program.

Any such graph could also be used as the definition of an associated macro node.

Postblit

A postblit is present on this object, but not explicitly documented in the source.

Members

Functions

dispose
void dispose()

Frees all resources allocated by this graph and sets it to an uninitialized state.

export_
int export_(const(InEdge) definition)

Registers a new exported definition.

initialize
err_t initialize(MacroNode.ID id, uint exports, uint imports, size_t capacity)

Initializes an empty Gyre graph, must be later disposed to avoid leaking memory.

merge
err_t merge(Graph consumed)

Destructively merges another graph into this one.

Properties

exported
uint exported [@property getter]

Number of definitions exported by this graph.

id
MacroNode.ID id [@property getter]

This graph's unique identifier.

imported
uint imported [@property getter]

Number of definitions imported by this graph.

length
size_t length [@property getter]

Number of unique nodes in the graph.

See Also

Meta

Version

NOTE: Every graph manages memory for its own nodes and edges, which in turn cannot be safely shared with the outside world. Due to our representation, internal graph storage will probably resemble a spaghetti of pointers, and if a node (or edge slot!) ever moves in memory, we'll need to fix every pointer which referenced it. As a result, relocations are expensive, and in the worst case we could be moving the entire graph (e.g. if we need to expand our backing memory arena). Since references may need to be adjusted anyway, we might as well keep related nodes close to each other, improving locality while we're at it. In the end, we'll have something similar to a copying GC over a private memory pool.