Fathom.Dynamic (fathom v0.1.0)

Copy Markdown View Source

Finds dispatch sites that the compiler tracer is structurally unable to see.

When you write mod.handle(arg) and mod is a variable, the compiler never resolves a module, so no :remote_function event is emitted and no edge appears in the call graph. The same is true of apply/3 with a computed module and of a function name held in a variable.

These are the places where a call graph quietly stops being complete, so Fathom records them as facts in their own right. An agent that asks "who calls this?" can also ask "does this module dispatch dynamically?" and know how far to trust the answer.

Summary

Functions

Walks an expanded AST body and returns the dynamic dispatch sites in it.

Types

site()

@type site() ::
  {line :: non_neg_integer(), kind :: :dynamic_module | :dynamic_function}

Functions

sites(body)

@spec sites(Macro.t()) :: [site()]

Walks an expanded AST body and returns the dynamic dispatch sites in it.

Returns {line, kind} pairs, where kind is :dynamic_module when the module half of the dot is computed and :dynamic_function when the function name is.