View Source Hologram.Compiler.CallGraph (hologram v0.2.0)
Summary
Functions
Adds an edge between two vertices in the call graph.
Adds multiple edges to the call graph.
Adds the vertex to the call graph.
Builds a call graph from IR.
Builds a call graph from a module definition IR located in the given IR PLT.
Returns a clone of the given call graph.
Serializes the call graph and writes it to a file.
Returns graph edges.
Returns the underlying libgraph %Graph{} struct containing vertices and edges data.
Checks if an edge exists between two given vertices in the call graph.
Checks if the given vertex exists in the call graph.
Returns the edges in which the second vertex is either the given module or a function from the given module, and the first vertex is a function from a different module.
Lists the entry MFAs {module, function, arity} for a given page module.
Returns the list of MFAs that are reachable by the given page.
Lists entry runtime MFAs, which include MFAs used by the client runtime JS classes and client MFAs used by all pages and components. The returned MFAs are sorted.
Lists MFAs required by the runtime JS script.
Loads the graph from the given dump file.
Loads the graph from the given dump file if the file exists.
Returns the list of vertices that are MFAs belonging to the given module.
Given a diff of changes, updates the call graph by deleting the graph paths of modules that have been removed, rebuilding the graph paths of modules that have been updated, and adding the graph paths of modules that have been added.
Replace the state of underlying Agent process with the given graph.
Lists vertices that are reachable from the given graph vertex or vertices.
Removes call graph vertices for Elixir functions ported manually.
Removes call graph vertices and edges related to MFAs used by the runtime.
Removes the vertex from the call graph.
Removes the vertices from the call graph.
Returns sorted graph edges.
Lists MFAs that are reachable from the given call graph vertex or vertices. Unimplemented protocol implentations are excluded. The MFAs returned are sorted.
Returns sorted graph vertices.
Starts a new CallGraph agent with (optional) initial graph.
Stops the CallGraph agent.
Returns graph vertices.
Types
Functions
Adds an edge between two vertices in the call graph.
@spec add_edges(t(), [Graph.Edge.t()]) :: t()
Adds multiple edges to the call graph.
Adds the vertex to the call graph.
@spec build(t(), Hologram.Compiler.IR.t(), vertex() | nil) :: t()
Builds a call graph from IR.
@spec build_for_module(t(), Hologram.Commons.PLT.t(), module()) :: t()
Builds a call graph from a module definition IR located in the given IR PLT.
Returns a clone of the given call graph.
Benchmark: https://github.com/bartblast/hologram/blob/master/benchmarks/compiler/call_graph/clone_1/README.md
Serializes the call graph and writes it to a file.
Benchmarks: https://github.com/bartblast/hologram/blob/master/benchmarks/compiler/call_graph/dump_2/README.md
@spec edges(t()) :: [Graph.Edge.t()]
Returns graph edges.
Returns the underlying libgraph %Graph{} struct containing vertices and edges data.
Checks if an edge exists between two given vertices in the call graph.
Checks if the given vertex exists in the call graph.
@spec inbound_remote_edges(t(), module()) :: [Graph.Edge.t()]
Returns the edges in which the second vertex is either the given module or a function from the given module, and the first vertex is a function from a different module.
Lists the entry MFAs {module, function, arity} for a given page module.
This function returns a list of MFAs that are considered entry points for a page, including functions from both the page module and its associated layout module.
Parameters
page_module
- The module of the page for which to list entry MFAs.
Returns
A list of MFAs (tuples of {module, function, arity}) that serve as entry points for the given page module and its layout.
Returns the list of MFAs that are reachable by the given page.
@spec list_runtime_entry_mfas() :: [mfa()]
Lists entry runtime MFAs, which include MFAs used by the client runtime JS classes and client MFAs used by all pages and components. The returned MFAs are sorted.
Lists MFAs required by the runtime JS script.
Loads the graph from the given dump file.
Loads the graph from the given dump file if the file exists.
Returns the list of vertices that are MFAs belonging to the given module.
@spec patch(t(), Hologram.Commons.PLT.t(), map()) :: t()
Given a diff of changes, updates the call graph by deleting the graph paths of modules that have been removed, rebuilding the graph paths of modules that have been updated, and adding the graph paths of modules that have been added.
Benchmarks: https://github.com/bartblast/hologram/blob/master/benchmarks/compiler/call_graph/patch_3/README.md
Replace the state of underlying Agent process with the given graph.
Lists vertices that are reachable from the given graph vertex or vertices.
Removes call graph vertices for Elixir functions ported manually.
Removes call graph vertices and edges related to MFAs used by the runtime.
remove_vertices/2 is very slow on large graphs - for a base case it would take over 7 seconds to remove runtime MFAs that way.
Removes the vertex from the call graph.
Removes the vertices from the call graph.
Benchmarks: https://github.com/bartblast/hologram/blob/master/benchmarks/compiler/call_graph/remove_vertices_2/README.md
@spec sorted_edges(t()) :: [Graph.Edge.t()]
Returns sorted graph edges.
Lists MFAs that are reachable from the given call graph vertex or vertices. Unimplemented protocol implentations are excluded. The MFAs returned are sorted.
Returns sorted graph vertices.
Starts a new CallGraph agent with (optional) initial graph.
@spec stop(t()) :: :ok
Stops the CallGraph agent.
Returns graph vertices.